diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index a0e91df34..ba11cd7c4 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -4561,7 +4561,7 @@ void HWR_AddSprites(sector_t *sec) // BSP is traversed by subsector. // A sector might have been split into several - // subsectors during BSP building. + // subsectors during BSP building. // Thus we check whether its already added. if (sec->validcount == validcount) return; diff --git a/src/r_things.c b/src/r_things.c index 5b204a354..85fe49f63 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1931,14 +1931,13 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) { mobj_t *thing; INT32 lightnum; - fixed_t limit_dist; if (rendermode != render_soft) return; // BSP is traversed by subsector. // A sector might have been split into several - // subsectors during BSP building. + // subsectors during BSP building. // Thus we check whether its already added. if (sec->validcount == validcount) return; @@ -1962,7 +1961,7 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) // Handle all things in sector. // If a limit exists, handle things a tiny bit different. - limit_dist = (fixed_t)(cv_drawdist.value) * mapobjectscale; + const fixed_t limit_dist = (fixed_t)(cv_drawdist.value) * mapobjectscale; for (thing = sec->thinglist; thing; thing = thing->snext) { if (!R_ThingWithinDist(thing, limit_dist)) @@ -2798,11 +2797,13 @@ boolean R_ThingVisible (mobj_t *thing) boolean R_ThingWithinDist (mobj_t *thing, fixed_t limit_dist) { - const fixed_t dist = P_AproxDistance(viewx-thing->x, viewy-thing->y); - - if (limit_dist && dist > limit_dist) + if (limit_dist) { - return false; + const fixed_t dist = P_AproxDistance(viewx-thing->x, viewy-thing->y); + if (dist > limit_dist) + { + return false; + } } return true;