diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 89d4476b0..b8063f7c4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -72,7 +72,7 @@ add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 r_draw.c r_fps.c r_main.c - r_plane.c + r_plane.cpp r_segs.cpp r_skins.c r_sky.c diff --git a/src/r_plane.c b/src/r_plane.cpp similarity index 98% rename from src/r_plane.c rename to src/r_plane.cpp index a66f6bad2..448f75fc0 100644 --- a/src/r_plane.c +++ b/src/r_plane.cpp @@ -201,6 +201,11 @@ static void R_MapPlane(INT32 y, INT32 x1, INT32 x2) ds_xfrac += planeripple.xfrac; ds_yfrac += planeripple.yfrac; ds_bgofs >>= FRACBITS; + + if ((y + ds_bgofs) >= viewheight) + ds_bgofs = viewheight-y-1; + if ((y + ds_bgofs) < 0) + ds_bgofs = -y; } pindex = distance >> LIGHTZSHIFT; @@ -330,7 +335,7 @@ static visplane_t *new_visplane(unsigned hash) visplane_t *check = freetail; if (!check) { - check = calloc(1, sizeof (*check)); + check = static_cast(calloc(1, sizeof (*check))); if (check == NULL) I_Error("%s: Out of memory", "new_visplane"); // FIXME: ugly } else @@ -786,11 +791,11 @@ d->z = (v1.x * v2.y) - (v1.y * v2.x) void R_SetTiltedSpan(INT32 span) { if (ds_su == NULL) - ds_su = Z_Malloc(sizeof(*ds_su) * vid.height, PU_STATIC, NULL); + ds_su = static_cast(Z_Malloc(sizeof(*ds_su) * vid.height, PU_STATIC, NULL)); if (ds_sv == NULL) - ds_sv = Z_Malloc(sizeof(*ds_sv) * vid.height, PU_STATIC, NULL); + ds_sv = static_cast(Z_Malloc(sizeof(*ds_sv) * vid.height, PU_STATIC, NULL)); if (ds_sz == NULL) - ds_sz = Z_Malloc(sizeof(*ds_sz) * vid.height, PU_STATIC, NULL); + ds_sz = static_cast(Z_Malloc(sizeof(*ds_sz) * vid.height, PU_STATIC, NULL)); ds_sup = &ds_su[span]; ds_svp = &ds_sv[span]; @@ -840,7 +845,7 @@ void R_DrawSinglePlane(visplane_t *pl) INT32 x, stop; ffloor_t *rover; INT32 type, spanfunctype = BASEDRAWFUNC; - debugrender_highlight_t debug = 0; + debugrender_highlight_t debug = debugrender_highlight_t::SW_HI_PLANES; void (*mapfunc)(INT32, INT32, INT32) = R_MapPlane; if (!(pl->minx <= pl->maxx)) diff --git a/src/r_things.c b/src/r_things.c index 6a7496495..26a430a94 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2408,7 +2408,7 @@ static void R_ProjectSprite(mobj_t *thing) vis->xscale = FixedMul(spritexscale, xscale); //SoM: 4/17/2000 vis->scale = FixedMul(spriteyscale, yscale); //<thingscale = interp.scale; + vis->thingscale = this_scale; vis->spritexscale = spritexscale; vis->spriteyscale = spriteyscale; @@ -2649,7 +2649,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing) vis = R_NewVisSprite(); vis->scale = FixedMul(yscale, this_scale); vis->sortscale = yscale; //<thingscale = interp.scale; + vis->thingscale = this_scale; vis->dispoffset = 0; // Monster Iestyn: 23/11/15 vis->gx = interp.x; vis->gy = interp.y; @@ -3635,14 +3635,14 @@ void R_ClipSprites(drawseg_t* dsstart, portal_t* portal) // e6y: ~13% of speed improvement on sunder.wad map10 if (ds->x1 < cx) { - drawsegs_xranges[1].items[drawsegs_xranges[1].count] = + drawsegs_xranges[1].items[drawsegs_xranges[1].count] = drawsegs_xranges[0].items[drawsegs_xranges[0].count]; drawsegs_xranges[1].count++; } if (ds->x2 >= cx) { - drawsegs_xranges[2].items[drawsegs_xranges[2].count] = + drawsegs_xranges[2].items[drawsegs_xranges[2].count] = drawsegs_xranges[0].items[drawsegs_xranges[0].count]; drawsegs_xranges[2].count++; }