From 032c597fa5f9b214d682f02db3a5c51fe6d475a1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 24 Dec 2021 10:25:18 +0100 Subject: [PATCH] - renamed shadowing variables in Blood. --- source/games/blood/src/_polymost.cpp | 8 +-- source/games/blood/src/actor.cpp | 22 +++---- source/games/blood/src/ai.cpp | 2 +- source/games/blood/src/aibeast.cpp | 10 ++-- source/games/blood/src/aicerber.cpp | 14 ++--- source/games/blood/src/aigarg.cpp | 24 ++++---- source/games/blood/src/aighost.cpp | 24 ++++---- source/games/blood/src/aitchern.cpp | 12 ++-- source/games/blood/src/aiunicult.cpp | 8 +-- source/games/blood/src/animatesprite.cpp | 10 ++-- source/games/blood/src/db.cpp | 4 +- source/games/blood/src/gameutil.cpp | 74 ++++++++++++------------ source/games/blood/src/hudsprites.cpp | 6 +- source/games/blood/src/levels.cpp | 4 +- source/games/blood/src/nnexts.cpp | 34 +++++------ source/games/blood/src/qav.cpp | 2 +- source/games/blood/src/triggers.cpp | 8 +-- source/games/blood/src/view.cpp | 4 +- source/games/blood/src/warp.cpp | 4 +- source/games/blood/src/weapon.cpp | 4 +- 20 files changed, 139 insertions(+), 139 deletions(-) diff --git a/source/games/blood/src/_polymost.cpp b/source/games/blood/src/_polymost.cpp index 08e3eac72..293a1eb23 100644 --- a/source/games/blood/src/_polymost.cpp +++ b/source/games/blood/src/_polymost.cpp @@ -276,8 +276,8 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int sector[nSector].floorstat |= CSTAT_SECTOR_SKY; renderDrawMasks(); sector[nSector].floorstat = fstat; - for (int i = 0; i < 16; i++) - gotpic.Clear(4080 + i); + for (int ii = 0; ii < 16; ii++) + gotpic.Clear(4080 + ii); if (viewPlayer >= 0) { gPlayer[viewPlayer].actor->spr.cstat = bakCstat; @@ -308,8 +308,8 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int sector[nSector].ceilingstat |= CSTAT_SECTOR_SKY; renderDrawMasks(); sector[nSector].ceilingstat = cstat; - for (int i = 0; i < 16; i++) - gotpic.Clear(4080 + i); + for (int ii = 0; ii < 16; ii++) + gotpic.Clear(4080 + ii); if (viewPlayer >= 0) { gPlayer[viewPlayer].actor->spr.cstat = bakCstat; diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index 7639d96d2..2b19518e4 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -6740,10 +6740,10 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6, nSurf = surfType[pWall->picnum]; if (actCanSplatWall(pWall)) { - int x = gHitInfo.hitpos.X - MulScale(a4, 16, 14); - int y = gHitInfo.hitpos.Y - MulScale(a5, 16, 14); - int z = gHitInfo.hitpos.Z - MulScale(a6, 256, 14); - int nSurf = surfType[pWall->picnum]; + x = gHitInfo.hitpos.X - MulScale(a4, 16, 14); + y = gHitInfo.hitpos.Y - MulScale(a5, 16, 14); + z = gHitInfo.hitpos.Z - MulScale(a6, 256, 14); + nSurf = surfType[pWall->picnum]; assert(nSurf < kSurfMax); if (pVectorData->surfHit[nSurf].fx1 >= 0) { @@ -6828,7 +6828,7 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6, } if (Chance(pVectorData->fxChance)) { - int t = gVectorData[19].maxDist; + t = gVectorData[19].maxDist; a4 += Random3(4000); a5 += Random3(4000); a6 += Random3(4000); @@ -6837,14 +6837,14 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6, if (approxDist(gHitInfo.hitpos.X - actor->spr.pos.X, gHitInfo.hitpos.Y - actor->spr.pos.Y) <= t) { auto pWall = gHitInfo.hitWall; - auto pSector = gHitInfo.hitSector; + pSector = gHitInfo.hitSector; if (actCanSplatWall(pWall)) { - int x = gHitInfo.hitpos.X - MulScale(a4, 16, 14); - int y = gHitInfo.hitpos.Y - MulScale(a5, 16, 14); - int z = gHitInfo.hitpos.Z - MulScale(a6, 16 << 4, 14); - int nSurf = surfType[pWall->picnum]; - const VECTORDATA* pVectorData = &gVectorData[19]; + x = gHitInfo.hitpos.X - MulScale(a4, 16, 14); + y = gHitInfo.hitpos.Y - MulScale(a5, 16, 14); + z = gHitInfo.hitpos.Z - MulScale(a6, 16 << 4, 14); + nSurf = surfType[pWall->picnum]; + pVectorData = &gVectorData[19]; FX_ID t2 = pVectorData->surfHit[nSurf].fx2; FX_ID t3 = pVectorData->surfHit[nSurf].fx3; diff --git a/source/games/blood/src/ai.cpp b/source/games/blood/src/ai.cpp index d510637dc..c27c1c591 100644 --- a/source/games/blood/src/ai.cpp +++ b/source/games/blood/src/ai.cpp @@ -1592,7 +1592,7 @@ void aiLookForTarget(DBloodActor* actor) int nDist = approxDist(dx, dy); if (actor2->spr.type == kDudeInnocent) { - DUDEINFO* pDudeInfo = getDudeInfo(actor2->spr.type); + pDudeInfo = getDudeInfo(actor2->spr.type); if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist) continue; aiSetTarget(actor, actor2); diff --git a/source/games/blood/src/aibeast.cpp b/source/games/blood/src/aibeast.cpp index 3a1366925..c041d59fe 100644 --- a/source/games/blood/src/aibeast.cpp +++ b/source/games/blood/src/aibeast.cpp @@ -80,8 +80,8 @@ void SlashSeqCallback(int, DBloodActor* actor) void StompSeqCallback(int, DBloodActor* actor) { - int dx = bcos(actor->spr.ang); - int dy = bsin(actor->spr.ang); + int angx = bcos(actor->spr.ang); + int angy = bsin(actor->spr.ang); int x = actor->spr.pos.X; int y = actor->spr.pos.Y; int z = actor->spr.pos.Z; @@ -91,9 +91,9 @@ void StompSeqCallback(int, DBloodActor* actor) int v10 = 25 + 30 * gGameOptions.nDifficulty; const bool newSectCheckMethod = !cl_bloodvanillaenemies && !VanillaMode(); // use new sector checking logic auto sectorMap = GetClosestSpriteSectors(pSector, x, y, vc, nullptr, newSectCheckMethod); - int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0); - DBloodActor* actor2 = nullptr; - actHitcodeToData(hit, &gHitInfo, &actor2); + int hit = HitScan(actor, actor->spr.pos.Z, angx, angy, 0, CLIPMASK1, 0); + DBloodActor* actorh = nullptr; + actHitcodeToData(hit, &gHitInfo, &actorh); vc <<= 4; BloodStatIterator it1(kStatDude); diff --git a/source/games/blood/src/aicerber.cpp b/source/games/blood/src/aicerber.cpp index af44bdb22..2d8992434 100644 --- a/source/games/blood/src/aicerber.cpp +++ b/source/games/blood/src/aicerber.cpp @@ -122,16 +122,16 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor) int nDeltaAngle = ((nAngle - actor->spr.ang + 1024) & 2047) - 1024; if (abs(nDeltaAngle) <= tt1.at8) { - int tz = actor2->spr.pos.Z - actor->spr.pos.Z; + int tz1 = actor2->spr.pos.Z - actor->spr.pos.Z; if (cansee(x, y, z, actor->spr.sector(), x2, y2, z2, actor2->spr.sector())) { nClosest = nDist2; aim.dx = bcos(nAngle); aim.dy = bsin(nAngle); - aim.dz = DivScale(tz, nDist, 10); + aim.dz = DivScale(tz1, nDist, 10); } else - aim.dz = tz; + aim.dz = tz1; } } } @@ -200,17 +200,17 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor) if (abs(nDeltaAngle) <= tt1.at8) { DUDEINFO* pDudeInfo2 = getDudeInfo(actor2->spr.type); - int height = (pDudeInfo2->aimHeight * actor2->spr.yrepeat) << 2; - int tz = (z2 - height) - z; + int height1 = (pDudeInfo2->aimHeight * actor2->spr.yrepeat) << 2; + int tz1 = (z2 - height1) - z; if (cansee(x, y, z, actor->spr.sector(), x2, y2, z2, actor2->spr.sector())) { nClosest = nDist2; aim.dx = bcos(nAngle); aim.dy = bsin(nAngle); - aim.dz = DivScale(tz, nDist, 10); + aim.dz = DivScale(tz1, nDist, 10); } else - aim.dz = tz; + aim.dz = tz1; } } } diff --git a/source/games/blood/src/aigarg.cpp b/source/games/blood/src/aigarg.cpp index 076b27d7f..b1751dd35 100644 --- a/source/games/blood/src/aigarg.cpp +++ b/source/games/blood/src/aigarg.cpp @@ -151,26 +151,26 @@ void BlastSSeqCallback(int, DBloodActor* actor) int nDeltaAngle = ((nAngle - actor->spr.ang + 1024) & 2047) - 1024; if (abs(nDeltaAngle) <= tt.at8) { - int tz = actor2->spr.pos.Z - actor->spr.pos.Z; + int tz1 = actor2->spr.pos.Z - actor->spr.pos.Z; if (cansee(x, y, z, actor->spr.sector(), x2, y2, z2, actor2->spr.sector())) { nClosest = nDist2; aim.dx = bcos(nAngle); aim.dy = bsin(nAngle); - aim.dz = DivScale(tz, nDist, 10); - if (tz > -0x333) - aim.dz = DivScale(tz, nDist, 10); - else if (tz < -0x333 && tz > -0xb33) - aim.dz = DivScale(tz, nDist, 10) + 9460; - else if (tz < -0xb33 && tz > -0x3000) - aim.dz = DivScale(tz, nDist, 10) + 9460; - else if (tz < -0x3000) - aim.dz = DivScale(tz, nDist, 10) - 7500; + aim.dz = DivScale(tz1, nDist, 10); + if (tz1 > -0x333) + aim.dz = DivScale(tz1, nDist, 10); + else if (tz1 < -0x333 && tz1 > -0xb33) + aim.dz = DivScale(tz1, nDist, 10) + 9460; + else if (tz1 < -0xb33 && tz1 > -0x3000) + aim.dz = DivScale(tz1, nDist, 10) + 9460; + else if (tz1 < -0x3000) + aim.dz = DivScale(tz1, nDist, 10) - 7500; else - aim.dz = DivScale(tz, nDist, 10); + aim.dz = DivScale(tz1, nDist, 10); } else - aim.dz = DivScale(tz, nDist, 10); + aim.dz = DivScale(tz1, nDist, 10); } } } diff --git a/source/games/blood/src/aighost.cpp b/source/games/blood/src/aighost.cpp index 3805ce20f..f54457d6f 100644 --- a/source/games/blood/src/aighost.cpp +++ b/source/games/blood/src/aighost.cpp @@ -137,26 +137,26 @@ void ghostBlastSeqCallback(int, DBloodActor* actor) int nDeltaAngle = ((nAngle - actor->spr.ang + 1024) & 2047) - 1024; if (abs(nDeltaAngle) <= tt.at8) { - int tz = actor2->spr.pos.Z - actor->spr.pos.Z; + int tz1 = actor2->spr.pos.Z - actor->spr.pos.Z; if (cansee(x, y, z, actor->spr.sector(), x2, y2, z2, actor2->spr.sector())) { nClosest = nDist2; aim.dx = bcos(nAngle); aim.dy = bsin(nAngle); - aim.dz = DivScale(tz, nDist, 10); - if (tz > -0x333) - aim.dz = DivScale(tz, nDist, 10); - else if (tz < -0x333 && tz > -0xb33) - aim.dz = DivScale(tz, nDist, 10) + 9460; - else if (tz < -0xb33 && tz > -0x3000) - aim.dz = DivScale(tz, nDist, 10) + 9460; - else if (tz < -0x3000) - aim.dz = DivScale(tz, nDist, 10) - 7500; + aim.dz = DivScale(tz1, nDist, 10); + if (tz1 > -0x333) + aim.dz = DivScale(tz1, nDist, 10); + else if (tz1 < -0x333 && tz1 > -0xb33) + aim.dz = DivScale(tz1, nDist, 10) + 9460; + else if (tz1 < -0xb33 && tz1 > -0x3000) + aim.dz = DivScale(tz1, nDist, 10) + 9460; + else if (tz1 < -0x3000) + aim.dz = DivScale(tz1, nDist, 10) - 7500; else - aim.dz = DivScale(tz, nDist, 10); + aim.dz = DivScale(tz1, nDist, 10); } else - aim.dz = DivScale(tz, nDist, 10); + aim.dz = DivScale(tz1, nDist, 10); } } } diff --git a/source/games/blood/src/aitchern.cpp b/source/games/blood/src/aitchern.cpp index 7a1851de5..268a1877e 100644 --- a/source/games/blood/src/aitchern.cpp +++ b/source/games/blood/src/aitchern.cpp @@ -106,16 +106,16 @@ void sub_71BD4(int, DBloodActor* actor) int nDeltaAngle = ((nAngle - actor->spr.ang + 1024) & 2047) - 1024; if (abs(nDeltaAngle) <= tt.at8) { - int tz = actor2->spr.pos.Z - actor->spr.pos.Z; + int tz1 = actor2->spr.pos.Z - actor->spr.pos.Z; if (cansee(x, y, z, actor->spr.sector(), x2, y2, z2, actor2->spr.sector())) { nClosest = nDist2; aim.dx = bcos(nAngle); aim.dy = bsin(nAngle); - aim.dz = DivScale(tz, nDist, 10); + aim.dz = DivScale(tz1, nDist, 10); } else - aim.dz = tz; + aim.dz = tz1; } } } @@ -178,16 +178,16 @@ void sub_720AC(int, DBloodActor* actor) int nDeltaAngle = ((nAngle - actor->spr.ang + 1024) & 2047) - 1024; if (abs(nDeltaAngle) <= tt.at8) { - int tz = actor2->spr.pos.Z - actor->spr.pos.Z; + int tz1 = actor2->spr.pos.Z - actor->spr.pos.Z; if (cansee(x, y, z, actor->spr.sector(), x2, y2, z2, actor2->spr.sector())) { nClosest = nDist2; aim.dx = bcos(nAngle); aim.dy = bsin(nAngle); - aim.dz = DivScale(tz, nDist, 10); + aim.dz = DivScale(tz1, nDist, 10); } else - aim.dz = tz; + aim.dz = tz1; } } } diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index 2fd74385b..6c581bb56 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -940,7 +940,7 @@ static void unicultThinkChase(DBloodActor* actor) { // allow attack if dude is far from object, but target is close to it int dudeDist = approxDist(gHitInfo.hitpos.X - actor->spr.pos.X, gHitInfo.hitpos.Y - actor->spr.pos.Y); - int targetDist = approxDist(gHitInfo.hitpos.X - target->spr.pos.X, gHitInfo.hitpos.Y - target->spr.pos.Y); + int targetDist1 = approxDist(gHitInfo.hitpos.X - target->spr.pos.X, gHitInfo.hitpos.Y - target->spr.pos.Y); if (dudeDist < mdist) { //viewSetSystemMessage("DUDE CLOSE TO OBJ: %d, MDIST: %d", dudeDist, mdist); @@ -948,7 +948,7 @@ static void unicultThinkChase(DBloodActor* actor) else aiGenDudeNewState(actor, &genDudeChaseL); return; } - else if (targetDist <= mdist >> 1) + else if (targetDist1 <= mdist >> 1) { //viewSetSystemMessage("TARGET CLOSE TO OBJ: %d, MDIST: %d", targetDist, mdist >> 1); break; @@ -2353,8 +2353,8 @@ bool genDudePrepare(DBloodActor* actor, int propId) else if ((i - seqStartId) == kGenDudeSeqAttackPunch) { pExtra->forcePunch = true; // required for those who don't have fire trigger in punch seq and for default animation - for (int i = 0; i < pSeq->nFrames; i++) { - if (!pSeq->frames[i].trigger) continue; + for (int ii = 0; ii < pSeq->nFrames; ii++) { + if (!pSeq->frames[ii].trigger) continue; pExtra->forcePunch = false; break; } diff --git a/source/games/blood/src/animatesprite.cpp b/source/games/blood/src/animatesprite.cpp index 2f75241d2..6a84bf91d 100644 --- a/source/games/blood/src/animatesprite.cpp +++ b/source/games/blood/src/animatesprite.cpp @@ -802,15 +802,15 @@ void viewProcessSprites(tspritetype* tsprite, int& spritesortcnt, int32_t cX, in viewAddEffect(tsprite, spritesortcnt, nTSprite, kViewEffectFlareHalo); if (pTSprite->type != kMissileFlareRegular) break; - sectortype *pSector = pTSprite->sector(); + sectortype *pSector1 = pTSprite->sector(); - int zDiff = (pTSprite->pos.Z - pSector->ceilingz) >> 8; - if ((pSector->ceilingstat & CSTAT_SECTOR_SKY) == 0 && zDiff < 64) { + int zDiff = (pTSprite->pos.Z - pSector1->ceilingz) >> 8; + if ((pSector1->ceilingstat & CSTAT_SECTOR_SKY) == 0 && zDiff < 64) { viewAddEffect(tsprite, spritesortcnt, nTSprite, kViewEffectCeilGlow); } - zDiff = (pSector->floorz - pTSprite->pos.Z) >> 8; - if ((pSector->floorstat & CSTAT_SECTOR_SKY) == 0 && zDiff < 64) { + zDiff = (pSector1->floorz - pTSprite->pos.Z) >> 8; + if ((pSector1->floorstat & CSTAT_SECTOR_SKY) == 0 && zDiff < 64) { viewAddEffect(tsprite, spritesortcnt, nTSprite, kViewEffectFloorGlow); } break; diff --git a/source/games/blood/src/db.cpp b/source/games/blood/src/db.cpp index f7a92647f..bf2af7540 100644 --- a/source/games/blood/src/db.cpp +++ b/source/games/blood/src/db.cpp @@ -171,7 +171,7 @@ struct walltypedisk #pragma pack(pop) -void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, sectortype** pSector, unsigned int* pCRC, BloodSpawnSpriteDef& sprites) +void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, sectortype** ppSector, unsigned int* pCRC, BloodSpawnSpriteDef& sprites) { int16_t tpskyoff[256]; ClearAutomap(); @@ -264,7 +264,7 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, sect #if 1 // bad, bad hack, just for making Polymost happy... PolymostAllocFakeSector(); #endif - * pSector = mapHeader.sect >= 0? §or[mapHeader.sect] : nullptr; + * ppSector = mapHeader.sect >= 0? §or[mapHeader.sect] : nullptr; if (encrypted) { diff --git a/source/games/blood/src/gameutil.cpp b/source/games/blood/src/gameutil.cpp index d484a6f63..60f2a5710 100644 --- a/source/games/blood/src/gameutil.cpp +++ b/source/games/blood/src/gameutil.cpp @@ -418,9 +418,9 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in int otherZ = other->spr.pos.Z; if (other->spr.cstat & CSTAT_SPRITE_YCENTER) otherZ += height / 2; - int nOffset = tileTopOffset(nPicnum); - if (nOffset) - otherZ -= (nOffset*other->spr.yrepeat)<<2; + int nTopOfs = tileTopOffset(nPicnum); + if (nTopOfs) + otherZ -= (nTopOfs*other->spr.yrepeat)<<2; assert(height > 0); int height2 = scale(otherZ-gHitInfo.hitpos.Z, tileHeight(nPicnum), height); if (!(other->spr.cstat & CSTAT_SPRITE_YFLIP)) @@ -432,8 +432,8 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in int check1 = ((y1 - other->spr.pos.Y)*dx - (x1 - other->spr.pos.X)*dy) / ksqrt(dx*dx+dy*dy); assert(width > 0); int width2 = scale(check1, tileWidth(nPicnum), width); - int nOffset = tileLeftOffset(nPicnum); - width2 += nOffset + tileWidth(nPicnum) / 2; + int nLeftOfs = tileLeftOffset(nPicnum); + width2 += nLeftOfs + tileWidth(nPicnum) / 2; if (width2 >= 0 && width2 < tileWidth(nPicnum)) { auto pData = tilePtr(nPicnum); @@ -441,7 +441,7 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in return 3; } } - auto bakCstat = other->spr.cstat; + bakCstat = other->spr.cstat; other->spr.cstat &= ~CSTAT_SPRITE_BLOCK_HITSCAN; gHitInfo.clearObj(); pos = gHitInfo.hitpos; // must make a copy! @@ -468,14 +468,14 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in } if (!(pWall->cstat & (CSTAT_WALL_MASKED | CSTAT_WALL_1WAY))) return 0; - int nOffset; + int nOfs; if (pWall->cstat & CSTAT_WALL_ALIGN_BOTTOM) - nOffset = ClipHigh(pSector->floorz, pSectorNext->floorz); + nOfs = ClipHigh(pSector->floorz, pSectorNext->floorz); else - nOffset = ClipLow(pSector->ceilingz, pSectorNext->ceilingz); - nOffset = (gHitInfo.hitpos.Z - nOffset) >> 8; + nOfs = ClipLow(pSector->ceilingz, pSectorNext->ceilingz); + nOfs = (gHitInfo.hitpos.Z - nOfs) >> 8; if (pWall->cstat & CSTAT_WALL_YFLIP) - nOffset = -nOffset; + nOfs = -nOfs; int nPicnum = pWall->overpicnum; int nSizX = tileWidth(nPicnum); @@ -483,8 +483,8 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in if (!nSizX || !nSizY) return 0; - nOffset = (nOffset*pWall->yrepeat) / 8; - nOffset += int((nSizY*pWall->ypan_) / 256); + nOfs = (nOfs*pWall->yrepeat) / 8; + nOfs += int((nSizY*pWall->ypan_) / 256); int nLength = approxDist(pWall->pos.X - pWall->point2Wall()->pos.X, pWall->pos.Y - pWall->point2Wall()->pos.Y); int nHOffset; if (pWall->cstat & CSTAT_WALL_XFLIP) @@ -494,14 +494,14 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in nHOffset = pWall->xpan() + ((nHOffset*pWall->xrepeat) << 3) / nLength; nHOffset %= nSizX; - nOffset %= nSizY; + nOfs %= nSizY; auto pData = tilePtr(nPicnum); int nPixel; - nPixel = nHOffset*nSizY + nOffset; + nPixel = nHOffset*nSizY + nOfs; if (pData[nPixel] == TRANSPARENT_INDEX) { - auto bakCstat = pWall->cstat; + auto bakCstat1 = pWall->cstat; pWall->cstat &= ~CSTAT_WALL_BLOCK_HITSCAN; auto bakCstat2 = pWall->nextWall()->cstat; pWall->nextWall()->cstat &= ~CSTAT_WALL_BLOCK_HITSCAN; @@ -509,7 +509,7 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in pos = gHitInfo.hitpos; hitscan(pos, pWall->nextSector(), { dx, dy, dz << 4 }, gHitInfo, CLIPMASK1); - pWall->cstat = bakCstat; + pWall->cstat = bakCstat1; pWall->nextWall()->cstat = bakCstat2; continue; } @@ -519,13 +519,13 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in { if (dz > 0) { - auto actor = barrier_cast(gHitInfo.hitSector->upperLink); - if (!actor) return 2; - auto link = actor->GetOwner(); + auto upper = barrier_cast(gHitInfo.hitSector->upperLink); + if (!upper) return 2; + auto link = upper->GetOwner(); gHitInfo.clearObj(); - x1 = gHitInfo.hitpos.X + link->spr.pos.X - actor->spr.pos.X; - y1 = gHitInfo.hitpos.Y + link->spr.pos.Y - actor->spr.pos.Y; - z1 = gHitInfo.hitpos.Z + link->spr.pos.Z - actor->spr.pos.Z; + x1 = gHitInfo.hitpos.X + link->spr.pos.X - upper->spr.pos.X; + y1 = gHitInfo.hitpos.Y + link->spr.pos.Y - upper->spr.pos.Y; + z1 = gHitInfo.hitpos.Z + link->spr.pos.Z - upper->spr.pos.Z; pos = { x1, y1, z1 }; hitscan(pos, link->spr.sector(), { dx, dy, dz << 4 }, gHitInfo, CLIPMASK1); @@ -533,13 +533,13 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in } else { - auto actor = barrier_cast(gHitInfo.hitSector->lowerLink); - if (!actor) return 1; - auto link = actor->GetOwner(); + auto lower = barrier_cast(gHitInfo.hitSector->lowerLink); + if (!lower) return 1; + auto link = lower->GetOwner(); gHitInfo.clearObj(); - x1 = gHitInfo.hitpos.X + link->spr.pos.X - actor->spr.pos.X; - y1 = gHitInfo.hitpos.Y + link->spr.pos.Y - actor->spr.pos.Y; - z1 = gHitInfo.hitpos.Z + link->spr.pos.Z - actor->spr.pos.Z; + x1 = gHitInfo.hitpos.X + link->spr.pos.X - lower->spr.pos.X; + y1 = gHitInfo.hitpos.Y + link->spr.pos.Y - lower->spr.pos.Y; + z1 = gHitInfo.hitpos.Z + link->spr.pos.Z - lower->spr.pos.Z; pos = { x1, y1, z1 }; hitscan(pos, link->spr.sector(), { dx, dy, dz << 4 }, gHitInfo, CLIPMASK1); continue; @@ -603,15 +603,15 @@ void GetZRangeAtXYZ(int x, int y, int z, sectortype* pSector, int *ceilZ, Collis getzrange(lpos, pSector, (int32_t*)ceilZ, *ceilColl, (int32_t*)floorZ, *floorColl, nDist, nMask); if (floorColl->type == kHitSector) { - auto pSector = floorColl->hitSector; - if ((nClipParallax & PARALLAXCLIP_FLOOR) == 0 && (pSector->floorstat & CSTAT_SECTOR_SKY)) + auto pHitSect = floorColl->hitSector; + if ((nClipParallax & PARALLAXCLIP_FLOOR) == 0 && (pHitSect->floorstat & CSTAT_SECTOR_SKY)) *floorZ = 0x7fffffff; - if (pSector->hasX()) + if (pHitSect->hasX()) { - XSECTOR* pXSector = &pSector->xs(); + XSECTOR* pXSector = &pHitSect->xs(); *floorZ += pXSector->Depth << 10; } - auto actor = barrier_cast(pSector->upperLink); + auto actor = barrier_cast(pHitSect->upperLink); if (actor) { auto link = actor->GetOwner(); @@ -622,10 +622,10 @@ void GetZRangeAtXYZ(int x, int y, int z, sectortype* pSector, int *ceilZ, Collis } if (ceilColl->type == kHitSector) { - auto pSector = ceilColl->hitSector; - if ((nClipParallax & PARALLAXCLIP_CEILING) == 0 && (pSector->ceilingstat & CSTAT_SECTOR_SKY)) + auto pHitSect = ceilColl->hitSector; + if ((nClipParallax & PARALLAXCLIP_CEILING) == 0 && (pHitSect->ceilingstat & CSTAT_SECTOR_SKY)) *ceilZ = 0x80000000; - auto actor = barrier_cast(pSector->lowerLink); + auto actor = barrier_cast(pHitSect->lowerLink); if (actor) { auto link = actor->GetOwner(); diff --git a/source/games/blood/src/hudsprites.cpp b/source/games/blood/src/hudsprites.cpp index 97a3b8b88..208a33be4 100644 --- a/source/games/blood/src/hudsprites.cpp +++ b/source/games/blood/src/hudsprites.cpp @@ -119,10 +119,10 @@ void hudDraw(PLAYER *gView, sectortype* pSector, double bobx, double boby, doubl int nShade = pSector->floorshade; int nPalette = 0; if (gView->actor->spr.sector()->hasX()) { - sectortype* pSector = gView->actor->spr.sector(); - XSECTOR* pXSector = &pSector->xs(); + sectortype* pViewSect = gView->actor->spr.sector(); + XSECTOR* pXSector = &pViewSect->xs(); if (pXSector->color) - nPalette = pSector->floorpal; + nPalette = pViewSect->floorpal; } #ifdef NOONE_EXTENSIONS diff --git a/source/games/blood/src/levels.cpp b/source/games/blood/src/levels.cpp index f60c981e8..935d197b6 100644 --- a/source/games/blood/src/levels.cpp +++ b/source/games/blood/src/levels.cpp @@ -200,8 +200,8 @@ void levelLoadDefaults(void) { CutsceneDef& csA = pLevelInfo->intro; csA.video = cleanPath(BloodINI->GetKeyString(buffer, "CutSceneA", "")); - int soundint = BloodINI->GetKeyInt(buffer, "CutWavA", -1); - if (soundint > 0) csA.soundID = soundint + 0x40000000; + int soundfileint = BloodINI->GetKeyInt(buffer, "CutWavA", -1); + if (soundfileint > 0) csA.soundID = soundfileint + 0x40000000; else csA.soundName = cleanPath(BloodINI->GetKeyString(buffer, "CutWavA", "")); } } diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 6ab78aeb2..6f7a65613 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -1155,8 +1155,8 @@ void nnExtProcessSuperSprites() if (!pProx->xspr.DudeLockout) { - BloodStatIterator it(kStatDude); - while (auto affected = it.Next()) + BloodStatIterator itr(kStatDude); + while (auto affected = itr.Next()) { if (!affected->hasX() || affected->xspr.health <= 0) continue; else if (CheckProximity(affected, x, y, z, pSect, okDist)) @@ -1742,9 +1742,9 @@ void debrisMove(int listIndex) else { evPostActor(actor, 0, kCallbackEnemeyBubble); - for (int i = 2; i <= 5; i++) + for (int ii = 2; ii <= 5; ii++) { - if (Chance(0x5000 * i)) + if (Chance(0x5000 * ii)) evPostActor(actor, Random(5), kCallbackEnemeyBubble); } } @@ -2753,17 +2753,17 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe // data4 = sprite cstat if (valueIsBetween(sourceactor->xspr.data4, -1, 65535)) { - auto old = targetactor->spr.cstat; + auto oldstat = targetactor->spr.cstat; // set new cstat if ((sourceactor->spr.flags & kModernTypeFlag1)) targetactor->spr.cstat |= ESpriteFlags::FromInt(sourceactor->xspr.data4); // relative else targetactor->spr.cstat = ESpriteFlags::FromInt(sourceactor->xspr.data4 & 0xffff); // absolute // and handle exceptions - if ((old & CSTAT_SPRITE_BLOOD_BIT1)) targetactor->spr.cstat |= CSTAT_SPRITE_BLOOD_BIT1; //kSpritePushable - if ((old & CSTAT_SPRITE_YCENTER)) targetactor->spr.cstat |= CSTAT_SPRITE_YCENTER; + if ((oldstat & CSTAT_SPRITE_BLOOD_BIT1)) targetactor->spr.cstat |= CSTAT_SPRITE_BLOOD_BIT1; //kSpritePushable + if ((oldstat & CSTAT_SPRITE_YCENTER)) targetactor->spr.cstat |= CSTAT_SPRITE_YCENTER; - targetactor->spr.cstat |= (old & CSTAT_SPRITE_MOVE_MASK); + targetactor->spr.cstat |= (oldstat & CSTAT_SPRITE_MOVE_MASK); #if 0 // looks very broken. if (old & 0x6000) @@ -4205,9 +4205,9 @@ bool condCheckDude(DBloodActor* aCond, int cmpOp, bool PUSH) switch (cond) { case 10: { - auto var = aiPatrolMarkerBusy(objActor, targ); - if (!var) return false; - else if (PUSH) condPush(aCond, var); + auto check = aiPatrolMarkerBusy(objActor, targ); + if (!check) return false; + else if (PUSH) condPush(aCond, check); break; } case 11: @@ -4977,9 +4977,9 @@ bool aiFightGetDudesForBattle(DBloodActor* actor) for (int i = bucketHead[txID]; i < bucketHead[txID + 1]; i++) { if (!rxBucket[i].isActor()) continue; - auto actor = rxBucket[i].actor(); - if (!actor || !actor->hasX() || !actor->IsDudeActor()) continue; - if (actor->xspr.health > 0) return true; + auto rxactor = rxBucket[i].actor(); + if (!rxactor || !rxactor->hasX() || !rxactor->IsDudeActor()) continue; + if (rxactor->xspr.health > 0) return true; } // check redirected TX buckets @@ -4990,9 +4990,9 @@ bool aiFightGetDudesForBattle(DBloodActor* actor) for (int i = bucketHead[rx]; i < bucketHead[rx + 1]; i++) { if (!rxBucket[i].isActor()) continue; - auto actor = rxBucket[i].actor(); - if (!actor || !actor->hasX() || !actor->IsDudeActor()) continue; - if (actor->xspr.health > 0) return true; + auto rxactor = rxBucket[i].actor(); + if (!rxactor || !rxactor->hasX() || !rxactor->IsDudeActor()) continue; + if (rxactor->xspr.health > 0) return true; } } return false; diff --git a/source/games/blood/src/qav.cpp b/source/games/blood/src/qav.cpp index 58150e09c..95ecaf11b 100644 --- a/source/games/blood/src/qav.cpp +++ b/source/games/blood/src/qav.cpp @@ -358,7 +358,7 @@ QAV* getQAV(int res_id) qavdata->frames[i].sound.priority = fr.ReadUInt8(); qavdata->frames[i].sound.sndFlags = fr.ReadUInt8(); qavdata->frames[i].sound.sndRange = fr.ReadUInt8(); - for (int i = 0; i < 1; i++) fr.ReadUInt8(); + for (int j = 0; j < 1; j++) fr.ReadUInt8(); // Read TILE_FRAME data. for (int j = 0; j < 8; j++) diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index 32c4b2d6d..c50447730 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -1805,8 +1805,8 @@ void ProcessMotion(void) viewInterpolateSector(pSector); pSector->floorz = pSector->baseFloor + vdi; - BloodSectIterator it(pSector); - while (auto actor = it.Next()) + BloodSectIterator itr(pSector); + while (auto actor = itr.Next()) { if (actor->spr.flags&2) actor->spr.flags |= 4; @@ -1828,8 +1828,8 @@ void ProcessMotion(void) viewInterpolateSector(pSector); pSector->ceilingz = pSector->baseCeil + vdi; - BloodSectIterator it(pSector); - while (auto actor = it.Next()) + BloodSectIterator itr(pSector); + while (auto actor = itr.Next()) { int top, bottom; GetActorExtents(actor, &top, &bottom); diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index 518f14edd..05fa8a2cf 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -781,8 +781,8 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int x, int y, int z, int a int nScale = (actor->spr.yrepeat + ((floorZ - nBottom) >> 8)) * z; nScale = ClipRange(nScale, 8000, 65536 << 1); // Players on automap - double x = xdim / 2. + x1 / double(1 << 12); - double y = ydim / 2. + y1 / double(1 << 12); + double xsize = xdim / 2. + x1 / double(1 << 12); + double ysize = ydim / 2. + y1 / double(1 << 12); // This very likely needs fixing later DrawTexture(twod, tileGetTexture(nTile, true), xx, yy, DTA_ClipLeft, windowxy1.X, DTA_ClipTop, windowxy1.Y, DTA_ScaleX, z/1536., DTA_ScaleY, z/1536., DTA_CenterOffset, true, DTA_ClipRight, windowxy2.X + 1, DTA_ClipBottom, windowxy2.Y + 1, DTA_Alpha, (actor->spr.cstat & CSTAT_SPRITE_TRANSLUCENT ? 0.5 : 1.), TAG_DONE); diff --git a/source/games/blood/src/warp.cpp b/source/games/blood/src/warp.cpp index c0a9400ef..fd42cc046 100644 --- a/source/games/blood/src/warp.cpp +++ b/source/games/blood/src/warp.cpp @@ -165,9 +165,9 @@ void warpInit(TArray& actors) if (actor && actor->hasX()) { int nLink = actor->xspr.data1; - for(auto& sect: sector) + for(auto& isect: sector) { - auto actor2 = barrier_cast(sect.lowerLink); + auto actor2 = barrier_cast(isect.lowerLink); if (actor2 && actor2->hasX()) { if (actor2->xspr.data1 == nLink) diff --git a/source/games/blood/src/weapon.cpp b/source/games/blood/src/weapon.cpp index fdcd60b97..0a32e484d 100644 --- a/source/games/blood/src/weapon.cpp +++ b/source/games/blood/src/weapon.cpp @@ -417,8 +417,8 @@ void UpdateAimVector(PLAYER * pPlayer) } if (pWeaponTrack->thingAngle > 0) { - BloodStatIterator it(kStatThing); - while (auto actor = it.Next()) + BloodStatIterator itr(kStatThing); + while (auto actor = itr.Next()) { if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pPlayer, actor)) continue;