- renamed some shadowing variables in common code.

This commit is contained in:
Christoph Oelckers 2021-12-24 09:19:43 +01:00
parent 95d270fbdd
commit ca9d73ffee
12 changed files with 99 additions and 100 deletions

View file

@ -1508,13 +1508,13 @@ int hitscan(const vec3_t& start, const sectortype* startsect, const vec3_t& dire
if (j == 0) continue; if (j == 0) continue;
if ((cstat & 64) != 0) if ((cstat & 64) != 0)
if ((j < 0) == ((cstat & 8) == 0)) continue; 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); int32_t dist2 = ((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; if ((dist2 ^ j) < 0 || (abs(dist2) >> 1) >= abs(j)) continue;
i = DivScale(i, j, 30); dist2 = DivScale(dist2, j, 30);
intx = sv->X + MulScale(vx, i, 30); intx = sv->X + MulScale(vx, dist2, 30);
inty = sv->Y + MulScale(vy, i, 30); inty = sv->Y + MulScale(vy, dist2, 30);
intz = sv->Z + MulScale(vz, i, 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)) if (abs(intx - sv->X) + abs(inty - sv->Y) > abs((hitinfo.hitpos.X) - sv->X) + abs((hitinfo.hitpos.Y) - sv->Y))
continue; continue;

View file

@ -1264,14 +1264,14 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
// PLAG: Cleaner model rotation code // PLAG: Cleaner model rotation code
if (ownerActor->sprext.pitch || ownerActor->sprext.roll) 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)); memset(&a0, 0, sizeof(a0));
if (ownerActor->sprext.pivot_offset.X) 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 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 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)); 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 //Let OpenGL (and perhaps hardware :) handle the matrix rotation
mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f; 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); GLInterface.SetMatrix(Matrix_Model, mat);
// PLAG: End // 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]] }; 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 // 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[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] }, (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[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] } }; (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); f = (fpmat[0].X * fpmat[0].X) + (fpmat[0].Y * fpmat[0].Y) + (fpmat[0].Z * fpmat[0].Z);
g = (fp[1].X * fp[1].X) + (fp[1].Y * fp[1].Y) + (fp[1].Z * fp[1].Z); g = (fpmat[1].X * fpmat[1].X) + (fpmat[1].Y * fpmat[1].Y) + (fpmat[1].Z * fpmat[1].Z);
if (f > g) if (f > g)
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) if (f > g)
f = g; f = g;

View file

@ -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]), 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]) }; ((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]) }; ((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)), float const fnx[2] = { dm0.X + ((nn[0] / d[0]) * (dm1.X - dm0.X)),
dm0.X + ((n[1] / d[1]) * (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; 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; spx[scnt] = fnx[1], spt[scnt++] = 1;
//Nice hack to avoid full sort later :) //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 if (globalorientation&64) //Hack for relative alignment on slopes
{ {
float r = global_cf_heinum * (1.0f / 4096.f); float dist = global_cf_heinum * (1.0f / 4096.f);
r = sqrtf(r*r+1); dist = sqrtf(dist*dist+1);
if (!(globalorientation&4)) { xtex.v *= r; ytex.v *= r; otex.v *= r; } if (!(globalorientation&4)) { xtex.v *= dist; ytex.v *= dist; otex.v *= dist; }
else { xtex.u *= r; ytex.u *= r; otex.u *= r; } 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++) for (int i = 0; i < 3; i++)
{ {
FVector2 const o = { fxy[i].X-ghalfx, fxy[i].Y-ghalfy }; FVector2 const o1 = { fxy[i].X-ghalfx, fxy[i].Y-ghalfy };
FVector3 const o2 = { o.X, o.Y, ghalfx / gvrcorrection }; FVector3 const o2 = { o1.X, o1.Y, ghalfx / gvrcorrection };
//Up/down rotation (backwards) //Up/down rotation (backwards)
vec3d_t v = { o2.X, o2.Y * gchang + o2.Z * gshang, o2.Z * gchang - o2.Y * gshang }; 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 // Transform back to polymost coordinates
for (int i = 0; i < n3; i++) 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 //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; float const r = (ghalfx / gvrcorrection) / v.z;
cxy[i].X = v.x * r + ghalfx; cxy[i].X = v.x * r + ghalfx;
cxy[i].Y = v.y * r + ghalfy; cxy[i].Y = v.y * r + ghalfy;
@ -1582,8 +1582,8 @@ static void polymost_drawalls(int32_t const bunch)
} }
else if (!(globalorientation&1)) else if (!(globalorientation&1))
{ {
int32_t fz = getflorzofslopeptr(sec, globalposx, globalposy); int32_t fslopez = getflorzofslopeptr(sec, globalposx, globalposy);
if (globalposz <= fz) if (globalposz <= fslopez)
polymost_internal_nonparallaxed(n0, n1, ryp0, ryp1, x0, x1, fy0, fy1, sectnum, true); polymost_internal_nonparallaxed(n0, n1, ryp0, ryp1, x0, x1, fy0, fy1, sectnum, true);
} }
else if ((nextsectnum < 0) || (!(sector[nextsectnum].floorstat & CSTAT_SECTOR_SKY))) 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)) else if (!(globalorientation&1))
{ {
int32_t cz = getceilzofslopeptr(sec, globalposx, globalposy); int32_t cslopez = getceilzofslopeptr(sec, globalposx, globalposy);
if (globalposz >= cz) if (globalposz >= cslopez)
polymost_internal_nonparallaxed(n0, n1, ryp0, ryp1, x0, x1, cy0, cy1, sectnum, false); polymost_internal_nonparallaxed(n0, n1, ryp0, ryp1, x0, x1, cy0, cy1, sectnum, false);
} }
else if ((nextsectnum < 0) || (!(sector[nextsectnum].ceilingstat & CSTAT_SECTOR_SKY))) 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<numscans; z++) for (intptr_t scan=onumscans; scan<numscans; scan++)
{ {
if ((wall[thewall[z]].point2 != thewall[bunchp2[z]]) || (dxb2[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]; bunchfirst[numbunches++] = bunchp2[scan];
bunchp2[z] = -1; bunchp2[scan] = -1;
} }
} }
for (intptr_t z=bunchfrst; z<numbunches; z++) for (intptr_t bunch=bunchfrst; bunch<numbunches; bunch++)
{ {
int zz; int zz;
for (zz=bunchfirst[z]; bunchp2[zz]>=0; zz=bunchp2[zz]) { } for (zz=bunchfirst[bunch]; bunchp2[zz]>=0; zz=bunchp2[zz]) { }
bunchlast[z] = zz; bunchlast[bunch] = zz;
} }
} }
while (sectorbordercnt > 0); while (sectorbordercnt > 0);
@ -2082,12 +2082,12 @@ static void polymost_initmosts(const float * px, const float * py, int const n)
xbt = py[0]; xbt = py[0];
xbb = 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 (xbl > px[ii]) xbl = px[ii];
if (xbr < px[i]) xbr = px[i]; if (xbr < px[ii]) xbr = px[ii];
if (xbt > py[i]) xbt = py[i]; if (xbt > py[ii]) xbt = py[ii];
if (xbb < py[i]) xbb = py[i]; if (xbb < py[ii]) xbb = py[ii];
} }
gtag = vcnt; gtag = vcnt;
@ -3559,14 +3559,13 @@ void renderDrawMasks(void)
if (pm_spritesortcnt < numSprites) if (pm_spritesortcnt < numSprites)
{ {
i = pm_spritesortcnt; for (intptr_t spr = pm_spritesortcnt; spr < numSprites;)
for (intptr_t i = pm_spritesortcnt; i < numSprites;)
{ {
int32_t py = spritesxyz[i].Y; int32_t py = spritesxyz[spr].Y;
int32_t pcstat = tspriteptr[i]->cstat & CSTAT_SPRITE_ALIGNMENT_MASK; int32_t pcstat = tspriteptr[spr]->cstat & CSTAT_SPRITE_ALIGNMENT_MASK;
int32_t pangle = tspriteptr[i]->ang; int32_t pangle = tspriteptr[spr]->ang;
int j = i + 1; int j = spr + 1;
if (!spriteIsModelOrVoxel(tspriteptr[i])) 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) while (j < numSprites && py == spritesxyz[j].Y && pcstat == (tspriteptr[j]->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) && (pcstat != 16 || pangle == tspriteptr[j]->ang)
&& !spriteIsModelOrVoxel(tspriteptr[j])) && !spriteIsModelOrVoxel(tspriteptr[j]))
@ -3574,17 +3573,17 @@ void renderDrawMasks(void)
j++; j++;
} }
} }
if (j - i == 1) if (j - spr == 1)
{ {
debugmask_add(i | 32768, tspriteptr[i]->owner); debugmask_add(spr | 32768, tspriteptr[spr]->owner);
Polymost::polymost_drawsprite(i); Polymost::polymost_drawsprite(spr);
tspriteptr[i] = NULL; tspriteptr[spr] = NULL;
} }
else else
{ {
GLInterface.SetDepthMask(false); 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); debugmask_add(k | 32768, tspriteptr[k]->owner);
Polymost::polymost_drawsprite(k); Polymost::polymost_drawsprite(k);
@ -3594,7 +3593,7 @@ void renderDrawMasks(void)
GLInterface.SetColorMask(false); 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); Polymost::polymost_drawsprite(k);
tspriteptr[k] = NULL; tspriteptr[k] = NULL;
@ -3603,7 +3602,7 @@ void renderDrawMasks(void)
GLInterface.SetColorMask(true); 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. // Adjust to backend coordinate system being used by the vertex buffer.
for (int i = 4; i < 8; i++) for (int i = 4; i < 8; i++)
{ {
float f = mat[i]; float val = mat[i];
mat[i] = -mat[i + 4]; mat[i] = -mat[i + 4];
mat[i + 4] = -f; mat[i + 4] = -val;
} }
GLInterface.SetMatrix(Matrix_Model, mat); GLInterface.SetMatrix(Matrix_Model, mat);

View file

@ -710,14 +710,14 @@ HANDLE WriteTextReport ()
ctxt->Rip, ctxt->Rsp, ctxt->SegCs, ctxt->SegSs, ctxt->EFlags); ctxt->Rip, ctxt->Rsp, ctxt->SegCs, ctxt->SegSs, ctxt->EFlags);
#endif #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') if (eflagsBits[i][0] != 'x')
{ {
Writef (file, " %c%c%c", eflagsBits[i][0], eflagsBits[i][1], Writef (file, " %c%c%c", eflagsBits[i][0], eflagsBits[i][1],
ctxt->EFlags & j ? '+' : '-'); ctxt->EFlags & dw ? '+' : '-');
} }
} }
Writef (file, "\r\n"); Writef (file, "\r\n");

View file

@ -255,12 +255,12 @@ void VkRenderBuffers::CreateShadowmap()
if (!ShadowmapSampler) if (!ShadowmapSampler)
{ {
SamplerBuilder builder; SamplerBuilder samplerBuilder;
builder.setMipmapMode(VK_SAMPLER_MIPMAP_MODE_NEAREST); samplerBuilder.setMipmapMode(VK_SAMPLER_MIPMAP_MODE_NEAREST);
builder.setMinFilter(VK_FILTER_NEAREST); samplerBuilder.setMinFilter(VK_FILTER_NEAREST);
builder.setMagFilter(VK_FILTER_NEAREST); samplerBuilder.setMagFilter(VK_FILTER_NEAREST);
builder.setAddressMode(VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE); samplerBuilder.setAddressMode(VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE);
ShadowmapSampler = builder.create(fb->device); ShadowmapSampler = samplerBuilder.create(fb->device);
ShadowmapSampler->SetDebugName("VkRenderBuffers.ShadowmapSampler"); ShadowmapSampler->SetDebugName("VkRenderBuffers.ShadowmapSampler");
} }
} }

View file

@ -325,20 +325,20 @@ void VulkanDevice::CreateInstance()
if (debugLayerFound) if (debugLayerFound)
{ {
VkDebugUtilsMessengerCreateInfoEXT createInfo = {}; VkDebugUtilsMessengerCreateInfoEXT dbgCreateInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT; dbgCreateInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT;
createInfo.messageSeverity = dbgCreateInfo.messageSeverity =
//VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT | //VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT |
//VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT | //VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT |
VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT |
VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_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_GENERAL_BIT_EXT |
VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT |
VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT; VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT;
createInfo.pfnUserCallback = DebugCallback; dbgCreateInfo.pfnUserCallback = DebugCallback;
createInfo.pUserData = this; dbgCreateInfo.pUserData = this;
result = vkCreateDebugUtilsMessengerEXT(instance, &createInfo, nullptr, &debugMessenger); result = vkCreateDebugUtilsMessengerEXT(instance, &dbgCreateInfo, nullptr, &debugMessenger);
CheckVulkanError(result, "vkCreateDebugUtilsMessengerEXT failed"); CheckVulkanError(result, "vkCreateDebugUtilsMessengerEXT failed");
DebugLayerActive = true; DebugLayerActive = true;

View file

@ -392,8 +392,8 @@ void VulkanFrameBuffer::PrecacheMaterial(FMaterial *mat, int translation)
int numLayers = mat->NumLayers(); int numLayers = mat->NumLayers();
for (int i = 1; i < numLayers; i++) for (int i = 1; i < numLayers; i++)
{ {
auto systex = static_cast<VkHardwareTexture*>(mat->GetLayer(i, 0, &layer)); auto syslayer = static_cast<VkHardwareTexture*>(mat->GetLayer(i, 0, &layer));
systex->GetImage(layer->layerTexture, 0, layer->scaleFlags); syslayer->GetImage(layer->layerTexture, 0, layer->scaleFlags);
} }
} }

View file

@ -407,18 +407,18 @@ VulkanDescriptorSet* VkMaterial::GetDescriptorSet(const FMaterialState& state)
{ {
for (int i = 1; i < numLayers; i++) for (int i = 1; i < numLayers; i++)
{ {
auto systex = static_cast<VkHardwareTexture*>(GetLayer(i, 0, &layer)); auto syslayer = static_cast<VkHardwareTexture*>(GetLayer(i, 0, &layer));
auto systeximage = systex->GetImage(layer->layerTexture, 0, layer->scaleFlags); auto syslayerimage = syslayer->GetImage(layer->layerTexture, 0, layer->scaleFlags);
update.addCombinedImageSampler(descriptor.get(), i, systeximage->View.get(), sampler, systeximage->Layout); update.addCombinedImageSampler(descriptor.get(), i, syslayerimage->View.get(), sampler, syslayerimage->Layout);
} }
} }
else else
{ {
for (int i = 1; i < 3; i++) for (int i = 1; i < 3; i++)
{ {
auto systex = static_cast<VkHardwareTexture*>(GetLayer(i, translation, &layer)); auto syslayer = static_cast<VkHardwareTexture*>(GetLayer(i, translation, &layer));
auto systeximage = systex->GetImage(layer->layerTexture, 0, layer->scaleFlags); auto syslayerimage = syslayer->GetImage(layer->layerTexture, 0, layer->scaleFlags);
update.addCombinedImageSampler(descriptor.get(), i, systeximage->View.get(), sampler, systeximage->Layout); update.addCombinedImageSampler(descriptor.get(), i, syslayerimage->View.get(), sampler, syslayerimage->Layout);
} }
numLayers = 3; numLayers = 3;
} }

View file

@ -585,10 +585,10 @@ void renderDrawMapView(int cposx, int cposy, int czoom, int cang)
PalEntry light = shadeToLight(sector[i].floorshade); PalEntry light = shadeToLight(sector[i].floorshade);
gotpic.Set(picnum); gotpic.Set(picnum);
for (auto sect : sectionsPerSector[i]) for (auto section : sectionsPerSector[i])
{ {
TArray<int>* indices; TArray<int>* 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()); vertices.Resize(mesh->vertices.Size());
for (unsigned j = 0; j < mesh->vertices.Size(); j++) for (unsigned j = 0; j < mesh->vertices.Size(); j++)
{ {

View file

@ -717,7 +717,7 @@ void PlayerIsGone (int netnode, int netconsole)
if (netconsole == Net_Arbitrator) if (netconsole == Net_Arbitrator)
{ {
// Pick a new network arbitrator // Pick a new network arbitrator
for (int i = 0; i < MAXPLAYERS; i++) for (int pl = 0; pl < MAXPLAYERS; pl++)
{ {
#if 0 #if 0
if (i != netconsole && playeringame[i] && players[i].Bot == NULL) if (i != netconsole && playeringame[i] && players[i].Bot == NULL)
@ -1010,18 +1010,18 @@ void NetUpdate (void)
if (maketic % ticdup != 0) if (maketic % ticdup != 0)
{ {
int mod = maketic - maketic % ticdup; int mod = maketic - maketic % ticdup;
int j; int tic;
// Update the buttons for all tics in this ticdup set as soon as // Update the buttons for all tics in this ticdup set as soon as
// possible so that the prediction shows jumping as correctly as // possible so that the prediction shows jumping as correctly as
// possible. (If you press +jump in the middle of a ticdup set, // possible. (If you press +jump in the middle of a ticdup set,
// the jump will actually begin at the beginning of the set, not // the jump will actually begin at the beginning of the set, not
// in the middle.) // in the middle.)
for (j = maketic-2; j >= mod; --j) for (tic = maketic-2; tic >= mod; --tic)
{ {
localcmds[j % LOCALCMDTICS].ucmd.actions |= localcmds[tic % LOCALCMDTICS].ucmd.actions |=
localcmds[(j + 1) % LOCALCMDTICS].ucmd.actions; localcmds[(tic + 1) % LOCALCMDTICS].ucmd.actions;
localcmds[j % LOCALCMDTICS].ucmd.setNewWeapon(localcmds[(j + 1) % LOCALCMDTICS].ucmd.getNewWeapon()); localcmds[tic % LOCALCMDTICS].ucmd.setNewWeapon(localcmds[(tic + 1) % LOCALCMDTICS].ucmd.getNewWeapon());
} }
} }
else else
@ -1031,16 +1031,16 @@ void NetUpdate (void)
// need to update them in all the localcmds slots that // need to update them in all the localcmds slots that
// are dupped so that prediction works properly. // are dupped so that prediction works properly.
int mod = maketic - ticdup; int mod = maketic - ticdup;
int modp, j; int modp, tic;
int svel = 0; int svel = 0;
int fvel = 0; int fvel = 0;
float avel = 0; float avel = 0;
float horz = 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; svel += localcmds[modp].ucmd.svel;
fvel += localcmds[modp].ucmd.fvel; fvel += localcmds[modp].ucmd.fvel;
avel += localcmds[modp].ucmd.avel; avel += localcmds[modp].ucmd.avel;
@ -1052,9 +1052,9 @@ void NetUpdate (void)
avel /= ticdup; avel /= ticdup;
horz /= 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.svel = svel;
localcmds[modp].ucmd.fvel = fvel; localcmds[modp].ucmd.fvel = fvel;
localcmds[modp].ucmd.avel = avel; localcmds[modp].ucmd.avel = avel;

View file

@ -534,7 +534,6 @@ void loadMapBackup(const char* filename)
// Sets the sector reference for each wall. We need this for the triangulation cache. // Sets the sector reference for each wall. We need this for the triangulation cache.
void setWallSectors() void setWallSectors()
{ {
int i = 0;
for (auto& wal : wall) for (auto& wal : wall)
{ {
wal.sector = -1; wal.sector = -1;
@ -587,6 +586,7 @@ void setWallSectors()
} }
} }
int i = 0;
for(auto& sect: sector) for(auto& sect: sector)
{ {
sect.dirty = EDirty::AllDirty; sect.dirty = EDirty::AllDirty;
@ -617,7 +617,7 @@ void setWallSectors()
{ {
if (wal.nextsector != wal.nextWall()->sector) 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; wal.nextsector = wal.nextWall()->sector;
} }
} }

View file

@ -62,10 +62,10 @@ inline void mergePortals()
pt1.targets.Append(pt2.targets); pt1.targets.Append(pt2.targets);
pt2.targets.Reset(); pt2.targets.Reset();
pt2.type = -1; pt2.type = -1;
for (auto& s : sector) for (auto& sec : sector)
{ {
//Printf("Merged %d and %d\n", i, j); //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; didsomething = true;
break; break;