From ca9d73ffeec41d8b674818cb8134b8a30e2b4886 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 24 Dec 2021 09:19:43 +0100 Subject: [PATCH] - renamed some shadowing variables in common code. --- source/build/src/clip.cpp | 12 +-- source/build/src/mdsprite.cpp | 16 ++-- source/build/src/polymost.cpp | 89 +++++++++---------- source/common/platform/win32/i_crash.cpp | 6 +- .../vulkan/renderer/vk_renderbuffers.cpp | 12 +-- .../rendering/vulkan/system/vk_device.cpp | 14 +-- .../vulkan/system/vk_framebuffer.cpp | 4 +- .../vulkan/textures/vk_hwtexture.cpp | 12 +-- source/core/automap.cpp | 4 +- source/core/d_net.cpp | 22 ++--- source/core/maploader.cpp | 4 +- source/core/rendering/render.h | 4 +- 12 files changed, 99 insertions(+), 100 deletions(-) diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index 86b4e526d..0f60aaee4 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -1508,13 +1508,13 @@ int hitscan(const vec3_t& start, const sectortype* startsect, const vec3_t& dire if (j == 0) continue; if ((cstat & 64) != 0) if ((j < 0) == ((cstat & 8) == 0)) continue; - int32_t i = ((spr->pos.Z - sv->Z) << 8) + DMulScale(dax, sv->Y - spr->pos.Y, -day, sv->X - spr->pos.X, 15); - if ((i ^ j) < 0 || (abs(i) >> 1) >= abs(j)) continue; + int32_t dist2 = ((spr->pos.Z - sv->Z) << 8) + DMulScale(dax, sv->Y - spr->pos.Y, -day, sv->X - spr->pos.X, 15); + if ((dist2 ^ j) < 0 || (abs(dist2) >> 1) >= abs(j)) continue; - i = DivScale(i, j, 30); - intx = sv->X + MulScale(vx, i, 30); - inty = sv->Y + MulScale(vy, i, 30); - intz = sv->Z + MulScale(vz, i, 30); + dist2 = DivScale(dist2, j, 30); + intx = sv->X + MulScale(vx, dist2, 30); + inty = sv->Y + MulScale(vy, dist2, 30); + intz = sv->Z + MulScale(vz, dist2, 30); if (abs(intx - sv->X) + abs(inty - sv->Y) > abs((hitinfo.hitpos.X) - sv->X) + abs((hitinfo.hitpos.Y) - sv->Y)) continue; diff --git a/source/build/src/mdsprite.cpp b/source/build/src/mdsprite.cpp index 1664f0960..e38722045 100644 --- a/source/build/src/mdsprite.cpp +++ b/source/build/src/mdsprite.cpp @@ -1264,14 +1264,14 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr) // PLAG: Cleaner model rotation code if (ownerActor->sprext.pitch || ownerActor->sprext.roll) { - float f = 1.f/((fxdimen * fviewingrange) * (256.f/(65536.f*128.f)) * (m0.X+m1.X)); + float factor = 1.f/((fxdimen * fviewingrange) * (256.f/(65536.f*128.f)) * (m0.X+m1.X)); memset(&a0, 0, sizeof(a0)); if (ownerActor->sprext.pivot_offset.X) - a0.X = (float) ownerActor->sprext.pivot_offset.X * f; + a0.X = (float) ownerActor->sprext.pivot_offset.X * factor; if (ownerActor->sprext.pivot_offset.Y) // Compare with SCREEN_FACTORS above - a0.Y = (float) ownerActor->sprext.pivot_offset.Y * f; + a0.Y = (float) ownerActor->sprext.pivot_offset.Y * factor; if ((ownerActor->sprext.pivot_offset.Z) && !(tspr->clipdist & TSPR_FLAGS_MDHACK)) // Compare with SCREEN_FACTORS above a0.Z = (float)ownerActor->sprext.pivot_offset.Z / (gxyaspect * fxdimen * (65536.f/128.f) * (m0.Z+m1.Z)); @@ -1339,7 +1339,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr) //Let OpenGL (and perhaps hardware :) handle the matrix rotation mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f; - for (int i = 0; i < 15; i++) mat[i] *= 1024.f; + for (int mm = 0; mm < 15; mm++) mat[mm] *= 1024.f; GLInterface.SetMatrix(Matrix_Model, mat); // PLAG: End @@ -1367,7 +1367,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr) FVector3 const vlt[3] = { vertlist[s->tris[i].i[0]], vertlist[s->tris[i].i[1]], vertlist[s->tris[i].i[2]] }; // Matrix multiplication - ugly but clear - FVector3 const fp[3] = { { (vlt[0].X * mat[0]) + (vlt[0].Y * mat[4]) + (vlt[0].Z * mat[8]) + mat[12], + FVector3 const fpmat[3] = { { (vlt[0].X * mat[0]) + (vlt[0].Y * mat[4]) + (vlt[0].Z * mat[8]) + mat[12], (vlt[0].X * mat[1]) + (vlt[0].Y * mat[5]) + (vlt[0].Z * mat[9]) + mat[13], (vlt[0].X * mat[2]) + (vlt[0].Y * mat[6]) + (vlt[0].Z * mat[10]) + mat[14] }, @@ -1379,13 +1379,13 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr) (vlt[2].X * mat[1]) + (vlt[2].Y * mat[5]) + (vlt[2].Z * mat[9]) + mat[13], (vlt[2].X * mat[2]) + (vlt[2].Y * mat[6]) + (vlt[2].Z * mat[10]) + mat[14] } }; - f = (fp[0].X * fp[0].X) + (fp[0].Y * fp[0].Y) + (fp[0].Z * fp[0].Z); - g = (fp[1].X * fp[1].X) + (fp[1].Y * fp[1].Y) + (fp[1].Z * fp[1].Z); + f = (fpmat[0].X * fpmat[0].X) + (fpmat[0].Y * fpmat[0].Y) + (fpmat[0].Z * fpmat[0].Z); + g = (fpmat[1].X * fpmat[1].X) + (fpmat[1].Y * fpmat[1].Y) + (fpmat[1].Z * fpmat[1].Z); if (f > g) f = g; - g = (fp[2].X * fp[2].X) + (fp[2].Y * fp[2].Y) + (fp[2].Z * fp[2].Z); + g = (fpmat[2].X * fpmat[2].X) + (fpmat[2].Y * fpmat[2].Y) + (fpmat[2].Z * fpmat[2].Z); if (f > g) f = g; diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 0b7de9d9b..09c5bc763 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -734,16 +734,16 @@ static void polymost_domost(float x0, float y0, float x1, float y1, float y0top float const d[2] = { ((dm0.Y - dm1.Y) * dx) - ((dm0.X - dm1.X) * cv[0]), ((dm0.Y - dm1.Y) * dx) - ((dm0.X - dm1.X) * cv[1]) }; - float const n[2] = { ((dm0.Y - cy[0]) * dx) - ((dm0.X - n0.X) * cv[0]), + float const nn[2] = { ((dm0.Y - cy[0]) * dx) - ((dm0.X - n0.X) * cv[0]), ((dm0.Y - cy[1]) * dx) - ((dm0.X - n0.X) * cv[1]) }; - float const fnx[2] = { dm0.X + ((n[0] / d[0]) * (dm1.X - dm0.X)), - dm0.X + ((n[1] / d[1]) * (dm1.X - dm0.X)) }; + float const fnx[2] = { dm0.X + ((nn[0] / d[0]) * (dm1.X - dm0.X)), + dm0.X + ((nn[1] / d[1]) * (dm1.X - dm0.X)) }; - if ((fabsf(d[0]) > fabsf(n[0])) && (d[0] * n[0] >= 0.f) && (fnx[0] > n0.X) && (fnx[0] < n1.X)) + if ((fabsf(d[0]) > fabsf(nn[0])) && (d[0] * nn[0] >= 0.f) && (fnx[0] > n0.X) && (fnx[0] < n1.X)) spx[scnt] = fnx[0], spt[scnt++] = 0; - if ((fabsf(d[1]) > fabsf(n[1])) && (d[1] * n[1] >= 0.f) && (fnx[1] > n0.X) && (fnx[1] < n1.X)) + if ((fabsf(d[1]) > fabsf(nn[1])) && (d[1] * nn[1] >= 0.f) && (fnx[1] > n0.X) && (fnx[1] < n1.X)) spx[scnt] = fnx[1], spt[scnt++] = 1; //Nice hack to avoid full sort later :) @@ -1145,10 +1145,10 @@ static void polymost_internal_nonparallaxed(FVector2 n0, FVector2 n1, float ryp0 if (globalorientation&64) //Hack for relative alignment on slopes { - float r = global_cf_heinum * (1.0f / 4096.f); - r = sqrtf(r*r+1); - if (!(globalorientation&4)) { xtex.v *= r; ytex.v *= r; otex.v *= r; } - else { xtex.u *= r; ytex.u *= r; otex.u *= r; } + float dist = global_cf_heinum * (1.0f / 4096.f); + dist = sqrtf(dist*dist+1); + if (!(globalorientation&4)) { xtex.v *= dist; ytex.v *= dist; otex.v *= dist; } + else { xtex.u *= dist; ytex.u *= dist; otex.u *= dist; } } } @@ -1373,8 +1373,8 @@ static void polymost_flatskyrender(FVector2 const* const dpxy, int32_t const n, for (int i = 0; i < 3; i++) { - FVector2 const o = { fxy[i].X-ghalfx, fxy[i].Y-ghalfy }; - FVector3 const o2 = { o.X, o.Y, ghalfx / gvrcorrection }; + FVector2 const o1 = { fxy[i].X-ghalfx, fxy[i].Y-ghalfy }; + FVector3 const o2 = { o1.X, o1.Y, ghalfx / gvrcorrection }; //Up/down rotation (backwards) vec3d_t v = { o2.X, o2.Y * gchang + o2.Z * gshang, o2.Z * gchang - o2.Y * gshang }; @@ -1440,10 +1440,10 @@ static void polymost_flatskyrender(FVector2 const* const dpxy, int32_t const n, // Transform back to polymost coordinates for (int i = 0; i < n3; i++) { - FVector3 const o = { cxy2[i].X-ghalfx, cxy2[i].Y-ghalfy, ghalfx / gvrcorrection }; + FVector3 const o1 = { cxy2[i].X-ghalfx, cxy2[i].Y-ghalfy, ghalfx / gvrcorrection }; //Up/down rotation - vec3d_t v = { o.X, o.Y * gchang + o.Z * gshang, o.Z * gchang - o.Y * gshang }; + vec3d_t v = { o1.X, o1.Y * gchang + o1.Z * gshang, o1.Z * gchang - o1.Y * gshang }; float const r = (ghalfx / gvrcorrection) / v.z; cxy[i].X = v.x * r + ghalfx; cxy[i].Y = v.y * r + ghalfy; @@ -1582,8 +1582,8 @@ static void polymost_drawalls(int32_t const bunch) } else if (!(globalorientation&1)) { - int32_t fz = getflorzofslopeptr(sec, globalposx, globalposy); - if (globalposz <= fz) + int32_t fslopez = getflorzofslopeptr(sec, globalposx, globalposy); + if (globalposz <= fslopez) polymost_internal_nonparallaxed(n0, n1, ryp0, ryp1, x0, x1, fy0, fy1, sectnum, true); } else if ((nextsectnum < 0) || (!(sector[nextsectnum].floorstat & CSTAT_SECTOR_SKY))) @@ -1635,8 +1635,8 @@ static void polymost_drawalls(int32_t const bunch) } else if (!(globalorientation&1)) { - int32_t cz = getceilzofslopeptr(sec, globalposx, globalposy); - if (globalposz >= cz) + int32_t cslopez = getceilzofslopeptr(sec, globalposx, globalposy); + if (globalposz >= cslopez) polymost_internal_nonparallaxed(n0, n1, ryp0, ryp1, x0, x1, cy0, cy1, sectnum, false); } else if ((nextsectnum < 0) || (!(sector[nextsectnum].ceilingstat & CSTAT_SECTOR_SKY))) @@ -1981,20 +1981,20 @@ void polymost_scansector(int32_t sectnum) } } - for (intptr_t z=onumscans; z nexttowardf(dxb1[bunchp2[z]], dxb2[z]))) + if ((wall[thewall[scan]].point2 != thewall[bunchp2[scan]]) || (dxb2[scan] > nexttowardf(dxb1[bunchp2[scan]], dxb2[scan]))) { - bunchfirst[numbunches++] = bunchp2[z]; - bunchp2[z] = -1; + bunchfirst[numbunches++] = bunchp2[scan]; + bunchp2[scan] = -1; } } - for (intptr_t z=bunchfrst; z=0; zz=bunchp2[zz]) { } - bunchlast[z] = zz; + for (zz=bunchfirst[bunch]; bunchp2[zz]>=0; zz=bunchp2[zz]) { } + bunchlast[bunch] = zz; } } while (sectorbordercnt > 0); @@ -2082,12 +2082,12 @@ static void polymost_initmosts(const float * px, const float * py, int const n) xbt = py[0]; xbb = py[0]; - for (intptr_t i=n-1; i>=1; i--) + for (intptr_t ii = n - 1; ii >= 1; ii--) { - if (xbl > px[i]) xbl = px[i]; - if (xbr < px[i]) xbr = px[i]; - if (xbt > py[i]) xbt = py[i]; - if (xbb < py[i]) xbb = py[i]; + if (xbl > px[ii]) xbl = px[ii]; + if (xbr < px[ii]) xbr = px[ii]; + if (xbt > py[ii]) xbt = py[ii]; + if (xbb < py[ii]) xbb = py[ii]; } gtag = vcnt; @@ -3559,14 +3559,13 @@ void renderDrawMasks(void) if (pm_spritesortcnt < numSprites) { - i = pm_spritesortcnt; - for (intptr_t i = pm_spritesortcnt; i < numSprites;) + for (intptr_t spr = pm_spritesortcnt; spr < numSprites;) { - int32_t py = spritesxyz[i].Y; - int32_t pcstat = tspriteptr[i]->cstat & CSTAT_SPRITE_ALIGNMENT_MASK; - int32_t pangle = tspriteptr[i]->ang; - int j = i + 1; - if (!spriteIsModelOrVoxel(tspriteptr[i])) + int32_t py = spritesxyz[spr].Y; + int32_t pcstat = tspriteptr[spr]->cstat & CSTAT_SPRITE_ALIGNMENT_MASK; + int32_t pangle = tspriteptr[spr]->ang; + int j = spr + 1; + if (!spriteIsModelOrVoxel(tspriteptr[spr])) { while (j < numSprites && py == spritesxyz[j].Y && pcstat == (tspriteptr[j]->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) && (pcstat != 16 || pangle == tspriteptr[j]->ang) && !spriteIsModelOrVoxel(tspriteptr[j])) @@ -3574,17 +3573,17 @@ void renderDrawMasks(void) j++; } } - if (j - i == 1) + if (j - spr == 1) { - debugmask_add(i | 32768, tspriteptr[i]->owner); - Polymost::polymost_drawsprite(i); - tspriteptr[i] = NULL; + debugmask_add(spr | 32768, tspriteptr[spr]->owner); + Polymost::polymost_drawsprite(spr); + tspriteptr[spr] = NULL; } else { GLInterface.SetDepthMask(false); - for (intptr_t k = j - 1; k >= i; k--) + for (intptr_t k = j - 1; k >= spr; k--) { debugmask_add(k | 32768, tspriteptr[k]->owner); Polymost::polymost_drawsprite(k); @@ -3594,7 +3593,7 @@ void renderDrawMasks(void) GLInterface.SetColorMask(false); - for (intptr_t k = j - 1; k >= i; k--) + for (intptr_t k = j - 1; k >= spr; k--) { Polymost::polymost_drawsprite(k); tspriteptr[k] = NULL; @@ -3603,7 +3602,7 @@ void renderDrawMasks(void) GLInterface.SetColorMask(true); } - i = j; + spr = j; } } @@ -3908,9 +3907,9 @@ int32_t polymost_voxdraw(voxmodel_t* m, tspriteptr_t const tspr, bool rotate) // Adjust to backend coordinate system being used by the vertex buffer. for (int i = 4; i < 8; i++) { - float f = mat[i]; + float val = mat[i]; mat[i] = -mat[i + 4]; - mat[i + 4] = -f; + mat[i + 4] = -val; } GLInterface.SetMatrix(Matrix_Model, mat); diff --git a/source/common/platform/win32/i_crash.cpp b/source/common/platform/win32/i_crash.cpp index 82265e5c1..a8d7b5c54 100644 --- a/source/common/platform/win32/i_crash.cpp +++ b/source/common/platform/win32/i_crash.cpp @@ -710,14 +710,14 @@ HANDLE WriteTextReport () ctxt->Rip, ctxt->Rsp, ctxt->SegCs, ctxt->SegSs, ctxt->EFlags); #endif - DWORD j; + DWORD dw; - for (i = 0, j = 1; (size_t)i < sizeof(eflagsBits)/sizeof(eflagsBits[0]); j <<= 1, ++i) + for (i = 0, dw = 1; (size_t)i < sizeof(eflagsBits)/sizeof(eflagsBits[0]); dw <<= 1, ++i) { if (eflagsBits[i][0] != 'x') { Writef (file, " %c%c%c", eflagsBits[i][0], eflagsBits[i][1], - ctxt->EFlags & j ? '+' : '-'); + ctxt->EFlags & dw ? '+' : '-'); } } Writef (file, "\r\n"); diff --git a/source/common/rendering/vulkan/renderer/vk_renderbuffers.cpp b/source/common/rendering/vulkan/renderer/vk_renderbuffers.cpp index 466acd5f4..aa8598805 100644 --- a/source/common/rendering/vulkan/renderer/vk_renderbuffers.cpp +++ b/source/common/rendering/vulkan/renderer/vk_renderbuffers.cpp @@ -255,12 +255,12 @@ void VkRenderBuffers::CreateShadowmap() if (!ShadowmapSampler) { - SamplerBuilder builder; - builder.setMipmapMode(VK_SAMPLER_MIPMAP_MODE_NEAREST); - builder.setMinFilter(VK_FILTER_NEAREST); - builder.setMagFilter(VK_FILTER_NEAREST); - builder.setAddressMode(VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE); - ShadowmapSampler = builder.create(fb->device); + SamplerBuilder samplerBuilder; + samplerBuilder.setMipmapMode(VK_SAMPLER_MIPMAP_MODE_NEAREST); + samplerBuilder.setMinFilter(VK_FILTER_NEAREST); + samplerBuilder.setMagFilter(VK_FILTER_NEAREST); + samplerBuilder.setAddressMode(VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE); + ShadowmapSampler = samplerBuilder.create(fb->device); ShadowmapSampler->SetDebugName("VkRenderBuffers.ShadowmapSampler"); } } diff --git a/source/common/rendering/vulkan/system/vk_device.cpp b/source/common/rendering/vulkan/system/vk_device.cpp index add03b8e6..720188096 100644 --- a/source/common/rendering/vulkan/system/vk_device.cpp +++ b/source/common/rendering/vulkan/system/vk_device.cpp @@ -325,20 +325,20 @@ void VulkanDevice::CreateInstance() if (debugLayerFound) { - VkDebugUtilsMessengerCreateInfoEXT createInfo = {}; - createInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT; - createInfo.messageSeverity = + VkDebugUtilsMessengerCreateInfoEXT dbgCreateInfo = {}; + dbgCreateInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT; + dbgCreateInfo.messageSeverity = //VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT | //VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT; - createInfo.messageType = + dbgCreateInfo.messageType = VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT; - createInfo.pfnUserCallback = DebugCallback; - createInfo.pUserData = this; - result = vkCreateDebugUtilsMessengerEXT(instance, &createInfo, nullptr, &debugMessenger); + dbgCreateInfo.pfnUserCallback = DebugCallback; + dbgCreateInfo.pUserData = this; + result = vkCreateDebugUtilsMessengerEXT(instance, &dbgCreateInfo, nullptr, &debugMessenger); CheckVulkanError(result, "vkCreateDebugUtilsMessengerEXT failed"); DebugLayerActive = true; diff --git a/source/common/rendering/vulkan/system/vk_framebuffer.cpp b/source/common/rendering/vulkan/system/vk_framebuffer.cpp index ca9f1a4a6..76444dfb9 100644 --- a/source/common/rendering/vulkan/system/vk_framebuffer.cpp +++ b/source/common/rendering/vulkan/system/vk_framebuffer.cpp @@ -392,8 +392,8 @@ void VulkanFrameBuffer::PrecacheMaterial(FMaterial *mat, int translation) int numLayers = mat->NumLayers(); for (int i = 1; i < numLayers; i++) { - auto systex = static_cast(mat->GetLayer(i, 0, &layer)); - systex->GetImage(layer->layerTexture, 0, layer->scaleFlags); + auto syslayer = static_cast(mat->GetLayer(i, 0, &layer)); + syslayer->GetImage(layer->layerTexture, 0, layer->scaleFlags); } } diff --git a/source/common/rendering/vulkan/textures/vk_hwtexture.cpp b/source/common/rendering/vulkan/textures/vk_hwtexture.cpp index b3ad6e66b..83733d6ec 100644 --- a/source/common/rendering/vulkan/textures/vk_hwtexture.cpp +++ b/source/common/rendering/vulkan/textures/vk_hwtexture.cpp @@ -407,18 +407,18 @@ VulkanDescriptorSet* VkMaterial::GetDescriptorSet(const FMaterialState& state) { for (int i = 1; i < numLayers; i++) { - auto systex = static_cast(GetLayer(i, 0, &layer)); - auto systeximage = systex->GetImage(layer->layerTexture, 0, layer->scaleFlags); - update.addCombinedImageSampler(descriptor.get(), i, systeximage->View.get(), sampler, systeximage->Layout); + auto syslayer = static_cast(GetLayer(i, 0, &layer)); + auto syslayerimage = syslayer->GetImage(layer->layerTexture, 0, layer->scaleFlags); + update.addCombinedImageSampler(descriptor.get(), i, syslayerimage->View.get(), sampler, syslayerimage->Layout); } } else { for (int i = 1; i < 3; i++) { - auto systex = static_cast(GetLayer(i, translation, &layer)); - auto systeximage = systex->GetImage(layer->layerTexture, 0, layer->scaleFlags); - update.addCombinedImageSampler(descriptor.get(), i, systeximage->View.get(), sampler, systeximage->Layout); + auto syslayer = static_cast(GetLayer(i, translation, &layer)); + auto syslayerimage = syslayer->GetImage(layer->layerTexture, 0, layer->scaleFlags); + update.addCombinedImageSampler(descriptor.get(), i, syslayerimage->View.get(), sampler, syslayerimage->Layout); } numLayers = 3; } diff --git a/source/core/automap.cpp b/source/core/automap.cpp index 5959df19f..9d8c887a8 100644 --- a/source/core/automap.cpp +++ b/source/core/automap.cpp @@ -585,10 +585,10 @@ void renderDrawMapView(int cposx, int cposy, int czoom, int cang) PalEntry light = shadeToLight(sector[i].floorshade); gotpic.Set(picnum); - for (auto sect : sectionsPerSector[i]) + for (auto section : sectionsPerSector[i]) { TArray* indices; - auto mesh = sectionGeometry.get(sect, 0, { 0.f, 0.f }, &indices); + auto mesh = sectionGeometry.get(section, 0, { 0.f, 0.f }, &indices); vertices.Resize(mesh->vertices.Size()); for (unsigned j = 0; j < mesh->vertices.Size(); j++) { diff --git a/source/core/d_net.cpp b/source/core/d_net.cpp index 33cc07970..0171a234a 100644 --- a/source/core/d_net.cpp +++ b/source/core/d_net.cpp @@ -717,7 +717,7 @@ void PlayerIsGone (int netnode, int netconsole) if (netconsole == Net_Arbitrator) { // Pick a new network arbitrator - for (int i = 0; i < MAXPLAYERS; i++) + for (int pl = 0; pl < MAXPLAYERS; pl++) { #if 0 if (i != netconsole && playeringame[i] && players[i].Bot == NULL) @@ -1010,18 +1010,18 @@ void NetUpdate (void) if (maketic % ticdup != 0) { int mod = maketic - maketic % ticdup; - int j; + int tic; // Update the buttons for all tics in this ticdup set as soon as // possible so that the prediction shows jumping as correctly as // possible. (If you press +jump in the middle of a ticdup set, // the jump will actually begin at the beginning of the set, not // in the middle.) - for (j = maketic-2; j >= mod; --j) + for (tic = maketic-2; tic >= mod; --tic) { - localcmds[j % LOCALCMDTICS].ucmd.actions |= - localcmds[(j + 1) % LOCALCMDTICS].ucmd.actions; - localcmds[j % LOCALCMDTICS].ucmd.setNewWeapon(localcmds[(j + 1) % LOCALCMDTICS].ucmd.getNewWeapon()); + localcmds[tic % LOCALCMDTICS].ucmd.actions |= + localcmds[(tic + 1) % LOCALCMDTICS].ucmd.actions; + localcmds[tic % LOCALCMDTICS].ucmd.setNewWeapon(localcmds[(tic + 1) % LOCALCMDTICS].ucmd.getNewWeapon()); } } else @@ -1031,16 +1031,16 @@ void NetUpdate (void) // need to update them in all the localcmds slots that // are dupped so that prediction works properly. int mod = maketic - ticdup; - int modp, j; + int modp, tic; int svel = 0; int fvel = 0; float avel = 0; float horz = 0; - for (j = 0; j < ticdup; ++j) + for (tic = 0; tic < ticdup; ++tic) { - modp = (mod + j) % LOCALCMDTICS; + modp = (mod + tic) % LOCALCMDTICS; svel += localcmds[modp].ucmd.svel; fvel += localcmds[modp].ucmd.fvel; avel += localcmds[modp].ucmd.avel; @@ -1052,9 +1052,9 @@ void NetUpdate (void) avel /= ticdup; horz /= ticdup; - for (j = 0; j < ticdup; ++j) + for (tic = 0; tic < ticdup; ++tic) { - modp = (mod + j) % LOCALCMDTICS; + modp = (mod + tic) % LOCALCMDTICS; localcmds[modp].ucmd.svel = svel; localcmds[modp].ucmd.fvel = fvel; localcmds[modp].ucmd.avel = avel; diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index 2b4016799..f6522fdbd 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -534,7 +534,6 @@ void loadMapBackup(const char* filename) // Sets the sector reference for each wall. We need this for the triangulation cache. void setWallSectors() { - int i = 0; for (auto& wal : wall) { wal.sector = -1; @@ -587,6 +586,7 @@ void setWallSectors() } } + int i = 0; for(auto& sect: sector) { sect.dirty = EDirty::AllDirty; @@ -617,7 +617,7 @@ void setWallSectors() { if (wal.nextsector != wal.nextWall()->sector) { - DPrintf(DMSG_ERROR, "Bad 'nextsector' reference %d on wall %d\n", wal.nextsector, i); + DPrintf(DMSG_ERROR, "Bad 'nextsector' reference %d on wall %d\n", wal.nextsector, wall.IndexOf(&wal)); wal.nextsector = wal.nextWall()->sector; } } diff --git a/source/core/rendering/render.h b/source/core/rendering/render.h index a830ae3e0..23a5e1f90 100644 --- a/source/core/rendering/render.h +++ b/source/core/rendering/render.h @@ -62,10 +62,10 @@ inline void mergePortals() pt1.targets.Append(pt2.targets); pt2.targets.Reset(); pt2.type = -1; - for (auto& s : sector) + for (auto& sec : sector) { //Printf("Merged %d and %d\n", i, j); - if (s.portalnum == (int)j) s.portalnum = i; + if (sec.portalnum == (int)j) sec.portalnum = i; } didsomething = true; break;