- renamed shadowing variables in Blood.

This commit is contained in:
Christoph Oelckers 2021-12-24 10:25:18 +01:00
parent 9e14b168bb
commit 032c597fa5
20 changed files with 139 additions and 139 deletions

View file

@ -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; sector[nSector].floorstat |= CSTAT_SECTOR_SKY;
renderDrawMasks(); renderDrawMasks();
sector[nSector].floorstat = fstat; sector[nSector].floorstat = fstat;
for (int i = 0; i < 16; i++) for (int ii = 0; ii < 16; ii++)
gotpic.Clear(4080 + i); gotpic.Clear(4080 + ii);
if (viewPlayer >= 0) if (viewPlayer >= 0)
{ {
gPlayer[viewPlayer].actor->spr.cstat = bakCstat; 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; sector[nSector].ceilingstat |= CSTAT_SECTOR_SKY;
renderDrawMasks(); renderDrawMasks();
sector[nSector].ceilingstat = cstat; sector[nSector].ceilingstat = cstat;
for (int i = 0; i < 16; i++) for (int ii = 0; ii < 16; ii++)
gotpic.Clear(4080 + i); gotpic.Clear(4080 + ii);
if (viewPlayer >= 0) if (viewPlayer >= 0)
{ {
gPlayer[viewPlayer].actor->spr.cstat = bakCstat; gPlayer[viewPlayer].actor->spr.cstat = bakCstat;

View file

@ -6740,10 +6740,10 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6,
nSurf = surfType[pWall->picnum]; nSurf = surfType[pWall->picnum];
if (actCanSplatWall(pWall)) if (actCanSplatWall(pWall))
{ {
int x = gHitInfo.hitpos.X - MulScale(a4, 16, 14); x = gHitInfo.hitpos.X - MulScale(a4, 16, 14);
int y = gHitInfo.hitpos.Y - MulScale(a5, 16, 14); y = gHitInfo.hitpos.Y - MulScale(a5, 16, 14);
int z = gHitInfo.hitpos.Z - MulScale(a6, 256, 14); z = gHitInfo.hitpos.Z - MulScale(a6, 256, 14);
int nSurf = surfType[pWall->picnum]; nSurf = surfType[pWall->picnum];
assert(nSurf < kSurfMax); assert(nSurf < kSurfMax);
if (pVectorData->surfHit[nSurf].fx1 >= 0) 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)) if (Chance(pVectorData->fxChance))
{ {
int t = gVectorData[19].maxDist; t = gVectorData[19].maxDist;
a4 += Random3(4000); a4 += Random3(4000);
a5 += Random3(4000); a5 += Random3(4000);
a6 += 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) if (approxDist(gHitInfo.hitpos.X - actor->spr.pos.X, gHitInfo.hitpos.Y - actor->spr.pos.Y) <= t)
{ {
auto pWall = gHitInfo.hitWall; auto pWall = gHitInfo.hitWall;
auto pSector = gHitInfo.hitSector; pSector = gHitInfo.hitSector;
if (actCanSplatWall(pWall)) if (actCanSplatWall(pWall))
{ {
int x = gHitInfo.hitpos.X - MulScale(a4, 16, 14); x = gHitInfo.hitpos.X - MulScale(a4, 16, 14);
int y = gHitInfo.hitpos.Y - MulScale(a5, 16, 14); y = gHitInfo.hitpos.Y - MulScale(a5, 16, 14);
int z = gHitInfo.hitpos.Z - MulScale(a6, 16 << 4, 14); z = gHitInfo.hitpos.Z - MulScale(a6, 16 << 4, 14);
int nSurf = surfType[pWall->picnum]; nSurf = surfType[pWall->picnum];
const VECTORDATA* pVectorData = &gVectorData[19]; pVectorData = &gVectorData[19];
FX_ID t2 = pVectorData->surfHit[nSurf].fx2; FX_ID t2 = pVectorData->surfHit[nSurf].fx2;
FX_ID t3 = pVectorData->surfHit[nSurf].fx3; FX_ID t3 = pVectorData->surfHit[nSurf].fx3;

View file

@ -1592,7 +1592,7 @@ void aiLookForTarget(DBloodActor* actor)
int nDist = approxDist(dx, dy); int nDist = approxDist(dx, dy);
if (actor2->spr.type == kDudeInnocent) if (actor2->spr.type == kDudeInnocent)
{ {
DUDEINFO* pDudeInfo = getDudeInfo(actor2->spr.type); pDudeInfo = getDudeInfo(actor2->spr.type);
if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist) if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist)
continue; continue;
aiSetTarget(actor, actor2); aiSetTarget(actor, actor2);

View file

@ -80,8 +80,8 @@ void SlashSeqCallback(int, DBloodActor* actor)
void StompSeqCallback(int, DBloodActor* actor) void StompSeqCallback(int, DBloodActor* actor)
{ {
int dx = bcos(actor->spr.ang); int angx = bcos(actor->spr.ang);
int dy = bsin(actor->spr.ang); int angy = bsin(actor->spr.ang);
int x = actor->spr.pos.X; int x = actor->spr.pos.X;
int y = actor->spr.pos.Y; int y = actor->spr.pos.Y;
int z = actor->spr.pos.Z; int z = actor->spr.pos.Z;
@ -91,9 +91,9 @@ void StompSeqCallback(int, DBloodActor* actor)
int v10 = 25 + 30 * gGameOptions.nDifficulty; int v10 = 25 + 30 * gGameOptions.nDifficulty;
const bool newSectCheckMethod = !cl_bloodvanillaenemies && !VanillaMode(); // use new sector checking logic const bool newSectCheckMethod = !cl_bloodvanillaenemies && !VanillaMode(); // use new sector checking logic
auto sectorMap = GetClosestSpriteSectors(pSector, x, y, vc, nullptr, newSectCheckMethod); auto sectorMap = GetClosestSpriteSectors(pSector, x, y, vc, nullptr, newSectCheckMethod);
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(actor, actor->spr.pos.Z, angx, angy, 0, CLIPMASK1, 0);
DBloodActor* actor2 = nullptr; DBloodActor* actorh = nullptr;
actHitcodeToData(hit, &gHitInfo, &actor2); actHitcodeToData(hit, &gHitInfo, &actorh);
vc <<= 4; vc <<= 4;
BloodStatIterator it1(kStatDude); BloodStatIterator it1(kStatDude);

View file

@ -122,16 +122,16 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor)
int nDeltaAngle = ((nAngle - actor->spr.ang + 1024) & 2047) - 1024; int nDeltaAngle = ((nAngle - actor->spr.ang + 1024) & 2047) - 1024;
if (abs(nDeltaAngle) <= tt1.at8) 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())) if (cansee(x, y, z, actor->spr.sector(), x2, y2, z2, actor2->spr.sector()))
{ {
nClosest = nDist2; nClosest = nDist2;
aim.dx = bcos(nAngle); aim.dx = bcos(nAngle);
aim.dy = bsin(nAngle); aim.dy = bsin(nAngle);
aim.dz = DivScale(tz, nDist, 10); aim.dz = DivScale(tz1, nDist, 10);
} }
else else
aim.dz = tz; aim.dz = tz1;
} }
} }
} }
@ -200,17 +200,17 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor)
if (abs(nDeltaAngle) <= tt1.at8) if (abs(nDeltaAngle) <= tt1.at8)
{ {
DUDEINFO* pDudeInfo2 = getDudeInfo(actor2->spr.type); DUDEINFO* pDudeInfo2 = getDudeInfo(actor2->spr.type);
int height = (pDudeInfo2->aimHeight * actor2->spr.yrepeat) << 2; int height1 = (pDudeInfo2->aimHeight * actor2->spr.yrepeat) << 2;
int tz = (z2 - height) - z; int tz1 = (z2 - height1) - z;
if (cansee(x, y, z, actor->spr.sector(), x2, y2, z2, actor2->spr.sector())) if (cansee(x, y, z, actor->spr.sector(), x2, y2, z2, actor2->spr.sector()))
{ {
nClosest = nDist2; nClosest = nDist2;
aim.dx = bcos(nAngle); aim.dx = bcos(nAngle);
aim.dy = bsin(nAngle); aim.dy = bsin(nAngle);
aim.dz = DivScale(tz, nDist, 10); aim.dz = DivScale(tz1, nDist, 10);
} }
else else
aim.dz = tz; aim.dz = tz1;
} }
} }
} }

View file

@ -151,26 +151,26 @@ void BlastSSeqCallback(int, DBloodActor* actor)
int nDeltaAngle = ((nAngle - actor->spr.ang + 1024) & 2047) - 1024; int nDeltaAngle = ((nAngle - actor->spr.ang + 1024) & 2047) - 1024;
if (abs(nDeltaAngle) <= tt.at8) 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())) if (cansee(x, y, z, actor->spr.sector(), x2, y2, z2, actor2->spr.sector()))
{ {
nClosest = nDist2; nClosest = nDist2;
aim.dx = bcos(nAngle); aim.dx = bcos(nAngle);
aim.dy = bsin(nAngle); aim.dy = bsin(nAngle);
aim.dz = DivScale(tz, nDist, 10); aim.dz = DivScale(tz1, nDist, 10);
if (tz > -0x333) if (tz1 > -0x333)
aim.dz = DivScale(tz, nDist, 10); aim.dz = DivScale(tz1, nDist, 10);
else if (tz < -0x333 && tz > -0xb33) else if (tz1 < -0x333 && tz1 > -0xb33)
aim.dz = DivScale(tz, nDist, 10) + 9460; aim.dz = DivScale(tz1, nDist, 10) + 9460;
else if (tz < -0xb33 && tz > -0x3000) else if (tz1 < -0xb33 && tz1 > -0x3000)
aim.dz = DivScale(tz, nDist, 10) + 9460; aim.dz = DivScale(tz1, nDist, 10) + 9460;
else if (tz < -0x3000) else if (tz1 < -0x3000)
aim.dz = DivScale(tz, nDist, 10) - 7500; aim.dz = DivScale(tz1, nDist, 10) - 7500;
else else
aim.dz = DivScale(tz, nDist, 10); aim.dz = DivScale(tz1, nDist, 10);
} }
else else
aim.dz = DivScale(tz, nDist, 10); aim.dz = DivScale(tz1, nDist, 10);
} }
} }
} }

View file

@ -137,26 +137,26 @@ void ghostBlastSeqCallback(int, DBloodActor* actor)
int nDeltaAngle = ((nAngle - actor->spr.ang + 1024) & 2047) - 1024; int nDeltaAngle = ((nAngle - actor->spr.ang + 1024) & 2047) - 1024;
if (abs(nDeltaAngle) <= tt.at8) 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())) if (cansee(x, y, z, actor->spr.sector(), x2, y2, z2, actor2->spr.sector()))
{ {
nClosest = nDist2; nClosest = nDist2;
aim.dx = bcos(nAngle); aim.dx = bcos(nAngle);
aim.dy = bsin(nAngle); aim.dy = bsin(nAngle);
aim.dz = DivScale(tz, nDist, 10); aim.dz = DivScale(tz1, nDist, 10);
if (tz > -0x333) if (tz1 > -0x333)
aim.dz = DivScale(tz, nDist, 10); aim.dz = DivScale(tz1, nDist, 10);
else if (tz < -0x333 && tz > -0xb33) else if (tz1 < -0x333 && tz1 > -0xb33)
aim.dz = DivScale(tz, nDist, 10) + 9460; aim.dz = DivScale(tz1, nDist, 10) + 9460;
else if (tz < -0xb33 && tz > -0x3000) else if (tz1 < -0xb33 && tz1 > -0x3000)
aim.dz = DivScale(tz, nDist, 10) + 9460; aim.dz = DivScale(tz1, nDist, 10) + 9460;
else if (tz < -0x3000) else if (tz1 < -0x3000)
aim.dz = DivScale(tz, nDist, 10) - 7500; aim.dz = DivScale(tz1, nDist, 10) - 7500;
else else
aim.dz = DivScale(tz, nDist, 10); aim.dz = DivScale(tz1, nDist, 10);
} }
else else
aim.dz = DivScale(tz, nDist, 10); aim.dz = DivScale(tz1, nDist, 10);
} }
} }
} }

View file

@ -106,16 +106,16 @@ void sub_71BD4(int, DBloodActor* actor)
int nDeltaAngle = ((nAngle - actor->spr.ang + 1024) & 2047) - 1024; int nDeltaAngle = ((nAngle - actor->spr.ang + 1024) & 2047) - 1024;
if (abs(nDeltaAngle) <= tt.at8) 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())) if (cansee(x, y, z, actor->spr.sector(), x2, y2, z2, actor2->spr.sector()))
{ {
nClosest = nDist2; nClosest = nDist2;
aim.dx = bcos(nAngle); aim.dx = bcos(nAngle);
aim.dy = bsin(nAngle); aim.dy = bsin(nAngle);
aim.dz = DivScale(tz, nDist, 10); aim.dz = DivScale(tz1, nDist, 10);
} }
else 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; int nDeltaAngle = ((nAngle - actor->spr.ang + 1024) & 2047) - 1024;
if (abs(nDeltaAngle) <= tt.at8) 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())) if (cansee(x, y, z, actor->spr.sector(), x2, y2, z2, actor2->spr.sector()))
{ {
nClosest = nDist2; nClosest = nDist2;
aim.dx = bcos(nAngle); aim.dx = bcos(nAngle);
aim.dy = bsin(nAngle); aim.dy = bsin(nAngle);
aim.dz = DivScale(tz, nDist, 10); aim.dz = DivScale(tz1, nDist, 10);
} }
else else
aim.dz = tz; aim.dz = tz1;
} }
} }
} }

View file

@ -940,7 +940,7 @@ static void unicultThinkChase(DBloodActor* actor)
{ {
// allow attack if dude is far from object, but target is close to it // 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 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) if (dudeDist < mdist)
{ {
//viewSetSystemMessage("DUDE CLOSE TO OBJ: %d, MDIST: %d", 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); else aiGenDudeNewState(actor, &genDudeChaseL);
return; return;
} }
else if (targetDist <= mdist >> 1) else if (targetDist1 <= mdist >> 1)
{ {
//viewSetSystemMessage("TARGET CLOSE TO OBJ: %d, MDIST: %d", targetDist, mdist >> 1); //viewSetSystemMessage("TARGET CLOSE TO OBJ: %d, MDIST: %d", targetDist, mdist >> 1);
break; break;
@ -2353,8 +2353,8 @@ bool genDudePrepare(DBloodActor* actor, int propId)
else if ((i - seqStartId) == kGenDudeSeqAttackPunch) else if ((i - seqStartId) == kGenDudeSeqAttackPunch)
{ {
pExtra->forcePunch = true; // required for those who don't have fire trigger in punch seq and for default animation 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++) { for (int ii = 0; ii < pSeq->nFrames; ii++) {
if (!pSeq->frames[i].trigger) continue; if (!pSeq->frames[ii].trigger) continue;
pExtra->forcePunch = false; pExtra->forcePunch = false;
break; break;
} }

View file

@ -802,15 +802,15 @@ void viewProcessSprites(tspritetype* tsprite, int& spritesortcnt, int32_t cX, in
viewAddEffect(tsprite, spritesortcnt, nTSprite, kViewEffectFlareHalo); viewAddEffect(tsprite, spritesortcnt, nTSprite, kViewEffectFlareHalo);
if (pTSprite->type != kMissileFlareRegular) break; if (pTSprite->type != kMissileFlareRegular) break;
sectortype *pSector = pTSprite->sector(); sectortype *pSector1 = pTSprite->sector();
int zDiff = (pTSprite->pos.Z - pSector->ceilingz) >> 8; int zDiff = (pTSprite->pos.Z - pSector1->ceilingz) >> 8;
if ((pSector->ceilingstat & CSTAT_SECTOR_SKY) == 0 && zDiff < 64) { if ((pSector1->ceilingstat & CSTAT_SECTOR_SKY) == 0 && zDiff < 64) {
viewAddEffect(tsprite, spritesortcnt, nTSprite, kViewEffectCeilGlow); viewAddEffect(tsprite, spritesortcnt, nTSprite, kViewEffectCeilGlow);
} }
zDiff = (pSector->floorz - pTSprite->pos.Z) >> 8; zDiff = (pSector1->floorz - pTSprite->pos.Z) >> 8;
if ((pSector->floorstat & CSTAT_SECTOR_SKY) == 0 && zDiff < 64) { if ((pSector1->floorstat & CSTAT_SECTOR_SKY) == 0 && zDiff < 64) {
viewAddEffect(tsprite, spritesortcnt, nTSprite, kViewEffectFloorGlow); viewAddEffect(tsprite, spritesortcnt, nTSprite, kViewEffectFloorGlow);
} }
break; break;

View file

@ -171,7 +171,7 @@ struct walltypedisk
#pragma pack(pop) #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]; int16_t tpskyoff[256];
ClearAutomap(); 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... #if 1 // bad, bad hack, just for making Polymost happy...
PolymostAllocFakeSector(); PolymostAllocFakeSector();
#endif #endif
* pSector = mapHeader.sect >= 0? &sector[mapHeader.sect] : nullptr; * ppSector = mapHeader.sect >= 0? &sector[mapHeader.sect] : nullptr;
if (encrypted) if (encrypted)
{ {

View file

@ -418,9 +418,9 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in
int otherZ = other->spr.pos.Z; int otherZ = other->spr.pos.Z;
if (other->spr.cstat & CSTAT_SPRITE_YCENTER) if (other->spr.cstat & CSTAT_SPRITE_YCENTER)
otherZ += height / 2; otherZ += height / 2;
int nOffset = tileTopOffset(nPicnum); int nTopOfs = tileTopOffset(nPicnum);
if (nOffset) if (nTopOfs)
otherZ -= (nOffset*other->spr.yrepeat)<<2; otherZ -= (nTopOfs*other->spr.yrepeat)<<2;
assert(height > 0); assert(height > 0);
int height2 = scale(otherZ-gHitInfo.hitpos.Z, tileHeight(nPicnum), height); int height2 = scale(otherZ-gHitInfo.hitpos.Z, tileHeight(nPicnum), height);
if (!(other->spr.cstat & CSTAT_SPRITE_YFLIP)) 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); int check1 = ((y1 - other->spr.pos.Y)*dx - (x1 - other->spr.pos.X)*dy) / ksqrt(dx*dx+dy*dy);
assert(width > 0); assert(width > 0);
int width2 = scale(check1, tileWidth(nPicnum), width); int width2 = scale(check1, tileWidth(nPicnum), width);
int nOffset = tileLeftOffset(nPicnum); int nLeftOfs = tileLeftOffset(nPicnum);
width2 += nOffset + tileWidth(nPicnum) / 2; width2 += nLeftOfs + tileWidth(nPicnum) / 2;
if (width2 >= 0 && width2 < tileWidth(nPicnum)) if (width2 >= 0 && width2 < tileWidth(nPicnum))
{ {
auto pData = tilePtr(nPicnum); auto pData = tilePtr(nPicnum);
@ -441,7 +441,7 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in
return 3; return 3;
} }
} }
auto bakCstat = other->spr.cstat; bakCstat = other->spr.cstat;
other->spr.cstat &= ~CSTAT_SPRITE_BLOCK_HITSCAN; other->spr.cstat &= ~CSTAT_SPRITE_BLOCK_HITSCAN;
gHitInfo.clearObj(); gHitInfo.clearObj();
pos = gHitInfo.hitpos; // must make a copy! 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))) if (!(pWall->cstat & (CSTAT_WALL_MASKED | CSTAT_WALL_1WAY)))
return 0; return 0;
int nOffset; int nOfs;
if (pWall->cstat & CSTAT_WALL_ALIGN_BOTTOM) if (pWall->cstat & CSTAT_WALL_ALIGN_BOTTOM)
nOffset = ClipHigh(pSector->floorz, pSectorNext->floorz); nOfs = ClipHigh(pSector->floorz, pSectorNext->floorz);
else else
nOffset = ClipLow(pSector->ceilingz, pSectorNext->ceilingz); nOfs = ClipLow(pSector->ceilingz, pSectorNext->ceilingz);
nOffset = (gHitInfo.hitpos.Z - nOffset) >> 8; nOfs = (gHitInfo.hitpos.Z - nOfs) >> 8;
if (pWall->cstat & CSTAT_WALL_YFLIP) if (pWall->cstat & CSTAT_WALL_YFLIP)
nOffset = -nOffset; nOfs = -nOfs;
int nPicnum = pWall->overpicnum; int nPicnum = pWall->overpicnum;
int nSizX = tileWidth(nPicnum); int nSizX = tileWidth(nPicnum);
@ -483,8 +483,8 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in
if (!nSizX || !nSizY) if (!nSizX || !nSizY)
return 0; return 0;
nOffset = (nOffset*pWall->yrepeat) / 8; nOfs = (nOfs*pWall->yrepeat) / 8;
nOffset += int((nSizY*pWall->ypan_) / 256); nOfs += int((nSizY*pWall->ypan_) / 256);
int nLength = approxDist(pWall->pos.X - pWall->point2Wall()->pos.X, pWall->pos.Y - pWall->point2Wall()->pos.Y); int nLength = approxDist(pWall->pos.X - pWall->point2Wall()->pos.X, pWall->pos.Y - pWall->point2Wall()->pos.Y);
int nHOffset; int nHOffset;
if (pWall->cstat & CSTAT_WALL_XFLIP) 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 = pWall->xpan() + ((nHOffset*pWall->xrepeat) << 3) / nLength;
nHOffset %= nSizX; nHOffset %= nSizX;
nOffset %= nSizY; nOfs %= nSizY;
auto pData = tilePtr(nPicnum); auto pData = tilePtr(nPicnum);
int nPixel; int nPixel;
nPixel = nHOffset*nSizY + nOffset; nPixel = nHOffset*nSizY + nOfs;
if (pData[nPixel] == TRANSPARENT_INDEX) if (pData[nPixel] == TRANSPARENT_INDEX)
{ {
auto bakCstat = pWall->cstat; auto bakCstat1 = pWall->cstat;
pWall->cstat &= ~CSTAT_WALL_BLOCK_HITSCAN; pWall->cstat &= ~CSTAT_WALL_BLOCK_HITSCAN;
auto bakCstat2 = pWall->nextWall()->cstat; auto bakCstat2 = pWall->nextWall()->cstat;
pWall->nextWall()->cstat &= ~CSTAT_WALL_BLOCK_HITSCAN; 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; pos = gHitInfo.hitpos;
hitscan(pos, pWall->nextSector(), { dx, dy, dz << 4 }, gHitInfo, CLIPMASK1); hitscan(pos, pWall->nextSector(), { dx, dy, dz << 4 }, gHitInfo, CLIPMASK1);
pWall->cstat = bakCstat; pWall->cstat = bakCstat1;
pWall->nextWall()->cstat = bakCstat2; pWall->nextWall()->cstat = bakCstat2;
continue; continue;
} }
@ -519,13 +519,13 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in
{ {
if (dz > 0) if (dz > 0)
{ {
auto actor = barrier_cast<DBloodActor*>(gHitInfo.hitSector->upperLink); auto upper = barrier_cast<DBloodActor*>(gHitInfo.hitSector->upperLink);
if (!actor) return 2; if (!upper) return 2;
auto link = actor->GetOwner(); auto link = upper->GetOwner();
gHitInfo.clearObj(); gHitInfo.clearObj();
x1 = gHitInfo.hitpos.X + link->spr.pos.X - actor->spr.pos.X; x1 = gHitInfo.hitpos.X + link->spr.pos.X - upper->spr.pos.X;
y1 = gHitInfo.hitpos.Y + link->spr.pos.Y - actor->spr.pos.Y; y1 = gHitInfo.hitpos.Y + link->spr.pos.Y - upper->spr.pos.Y;
z1 = gHitInfo.hitpos.Z + link->spr.pos.Z - actor->spr.pos.Z; z1 = gHitInfo.hitpos.Z + link->spr.pos.Z - upper->spr.pos.Z;
pos = { x1, y1, z1 }; pos = { x1, y1, z1 };
hitscan(pos, link->spr.sector(), { dx, dy, dz << 4 }, gHitInfo, CLIPMASK1); 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 else
{ {
auto actor = barrier_cast<DBloodActor*>(gHitInfo.hitSector->lowerLink); auto lower = barrier_cast<DBloodActor*>(gHitInfo.hitSector->lowerLink);
if (!actor) return 1; if (!lower) return 1;
auto link = actor->GetOwner(); auto link = lower->GetOwner();
gHitInfo.clearObj(); gHitInfo.clearObj();
x1 = gHitInfo.hitpos.X + link->spr.pos.X - actor->spr.pos.X; x1 = gHitInfo.hitpos.X + link->spr.pos.X - lower->spr.pos.X;
y1 = gHitInfo.hitpos.Y + link->spr.pos.Y - actor->spr.pos.Y; y1 = gHitInfo.hitpos.Y + link->spr.pos.Y - lower->spr.pos.Y;
z1 = gHitInfo.hitpos.Z + link->spr.pos.Z - actor->spr.pos.Z; z1 = gHitInfo.hitpos.Z + link->spr.pos.Z - lower->spr.pos.Z;
pos = { x1, y1, z1 }; pos = { x1, y1, z1 };
hitscan(pos, link->spr.sector(), { dx, dy, dz << 4 }, gHitInfo, CLIPMASK1); hitscan(pos, link->spr.sector(), { dx, dy, dz << 4 }, gHitInfo, CLIPMASK1);
continue; 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); getzrange(lpos, pSector, (int32_t*)ceilZ, *ceilColl, (int32_t*)floorZ, *floorColl, nDist, nMask);
if (floorColl->type == kHitSector) if (floorColl->type == kHitSector)
{ {
auto pSector = floorColl->hitSector; auto pHitSect = floorColl->hitSector;
if ((nClipParallax & PARALLAXCLIP_FLOOR) == 0 && (pSector->floorstat & CSTAT_SECTOR_SKY)) if ((nClipParallax & PARALLAXCLIP_FLOOR) == 0 && (pHitSect->floorstat & CSTAT_SECTOR_SKY))
*floorZ = 0x7fffffff; *floorZ = 0x7fffffff;
if (pSector->hasX()) if (pHitSect->hasX())
{ {
XSECTOR* pXSector = &pSector->xs(); XSECTOR* pXSector = &pHitSect->xs();
*floorZ += pXSector->Depth << 10; *floorZ += pXSector->Depth << 10;
} }
auto actor = barrier_cast<DBloodActor*>(pSector->upperLink); auto actor = barrier_cast<DBloodActor*>(pHitSect->upperLink);
if (actor) if (actor)
{ {
auto link = actor->GetOwner(); 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) if (ceilColl->type == kHitSector)
{ {
auto pSector = ceilColl->hitSector; auto pHitSect = ceilColl->hitSector;
if ((nClipParallax & PARALLAXCLIP_CEILING) == 0 && (pSector->ceilingstat & CSTAT_SECTOR_SKY)) if ((nClipParallax & PARALLAXCLIP_CEILING) == 0 && (pHitSect->ceilingstat & CSTAT_SECTOR_SKY))
*ceilZ = 0x80000000; *ceilZ = 0x80000000;
auto actor = barrier_cast<DBloodActor*>(pSector->lowerLink); auto actor = barrier_cast<DBloodActor*>(pHitSect->lowerLink);
if (actor) if (actor)
{ {
auto link = actor->GetOwner(); auto link = actor->GetOwner();

View file

@ -119,10 +119,10 @@ void hudDraw(PLAYER *gView, sectortype* pSector, double bobx, double boby, doubl
int nShade = pSector->floorshade; int nShade = pSector->floorshade;
int nPalette = 0; int nPalette = 0;
if (gView->actor->spr.sector()->hasX()) { if (gView->actor->spr.sector()->hasX()) {
sectortype* pSector = gView->actor->spr.sector(); sectortype* pViewSect = gView->actor->spr.sector();
XSECTOR* pXSector = &pSector->xs(); XSECTOR* pXSector = &pViewSect->xs();
if (pXSector->color) if (pXSector->color)
nPalette = pSector->floorpal; nPalette = pViewSect->floorpal;
} }
#ifdef NOONE_EXTENSIONS #ifdef NOONE_EXTENSIONS

View file

@ -200,8 +200,8 @@ void levelLoadDefaults(void)
{ {
CutsceneDef& csA = pLevelInfo->intro; CutsceneDef& csA = pLevelInfo->intro;
csA.video = cleanPath(BloodINI->GetKeyString(buffer, "CutSceneA", "")); csA.video = cleanPath(BloodINI->GetKeyString(buffer, "CutSceneA", ""));
int soundint = BloodINI->GetKeyInt(buffer, "CutWavA", -1); int soundfileint = BloodINI->GetKeyInt(buffer, "CutWavA", -1);
if (soundint > 0) csA.soundID = soundint + 0x40000000; if (soundfileint > 0) csA.soundID = soundfileint + 0x40000000;
else csA.soundName = cleanPath(BloodINI->GetKeyString(buffer, "CutWavA", "")); else csA.soundName = cleanPath(BloodINI->GetKeyString(buffer, "CutWavA", ""));
} }
} }

View file

@ -1155,8 +1155,8 @@ void nnExtProcessSuperSprites()
if (!pProx->xspr.DudeLockout) if (!pProx->xspr.DudeLockout)
{ {
BloodStatIterator it(kStatDude); BloodStatIterator itr(kStatDude);
while (auto affected = it.Next()) while (auto affected = itr.Next())
{ {
if (!affected->hasX() || affected->xspr.health <= 0) continue; if (!affected->hasX() || affected->xspr.health <= 0) continue;
else if (CheckProximity(affected, x, y, z, pSect, okDist)) else if (CheckProximity(affected, x, y, z, pSect, okDist))
@ -1742,9 +1742,9 @@ void debrisMove(int listIndex)
else else
{ {
evPostActor(actor, 0, kCallbackEnemeyBubble); 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); evPostActor(actor, Random(5), kCallbackEnemeyBubble);
} }
} }
@ -2753,17 +2753,17 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe
// data4 = sprite cstat // data4 = sprite cstat
if (valueIsBetween(sourceactor->xspr.data4, -1, 65535)) if (valueIsBetween(sourceactor->xspr.data4, -1, 65535))
{ {
auto old = targetactor->spr.cstat; auto oldstat = targetactor->spr.cstat;
// set new cstat // set new cstat
if ((sourceactor->spr.flags & kModernTypeFlag1)) targetactor->spr.cstat |= ESpriteFlags::FromInt(sourceactor->xspr.data4); // relative 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 else targetactor->spr.cstat = ESpriteFlags::FromInt(sourceactor->xspr.data4 & 0xffff); // absolute
// and handle exceptions // and handle exceptions
if ((old & CSTAT_SPRITE_BLOOD_BIT1)) targetactor->spr.cstat |= CSTAT_SPRITE_BLOOD_BIT1; //kSpritePushable if ((oldstat & 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_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 #if 0
// looks very broken. // looks very broken.
if (old & 0x6000) if (old & 0x6000)
@ -4205,9 +4205,9 @@ bool condCheckDude(DBloodActor* aCond, int cmpOp, bool PUSH)
switch (cond) { switch (cond) {
case 10: case 10:
{ {
auto var = aiPatrolMarkerBusy(objActor, targ); auto check = aiPatrolMarkerBusy(objActor, targ);
if (!var) return false; if (!check) return false;
else if (PUSH) condPush(aCond, var); else if (PUSH) condPush(aCond, check);
break; break;
} }
case 11: case 11:
@ -4977,9 +4977,9 @@ bool aiFightGetDudesForBattle(DBloodActor* actor)
for (int i = bucketHead[txID]; i < bucketHead[txID + 1]; i++) for (int i = bucketHead[txID]; i < bucketHead[txID + 1]; i++)
{ {
if (!rxBucket[i].isActor()) continue; if (!rxBucket[i].isActor()) continue;
auto actor = rxBucket[i].actor(); auto rxactor = rxBucket[i].actor();
if (!actor || !actor->hasX() || !actor->IsDudeActor()) continue; if (!rxactor || !rxactor->hasX() || !rxactor->IsDudeActor()) continue;
if (actor->xspr.health > 0) return true; if (rxactor->xspr.health > 0) return true;
} }
// check redirected TX buckets // check redirected TX buckets
@ -4990,9 +4990,9 @@ bool aiFightGetDudesForBattle(DBloodActor* actor)
for (int i = bucketHead[rx]; i < bucketHead[rx + 1]; i++) for (int i = bucketHead[rx]; i < bucketHead[rx + 1]; i++)
{ {
if (!rxBucket[i].isActor()) continue; if (!rxBucket[i].isActor()) continue;
auto actor = rxBucket[i].actor(); auto rxactor = rxBucket[i].actor();
if (!actor || !actor->hasX() || !actor->IsDudeActor()) continue; if (!rxactor || !rxactor->hasX() || !rxactor->IsDudeActor()) continue;
if (actor->xspr.health > 0) return true; if (rxactor->xspr.health > 0) return true;
} }
} }
return false; return false;

View file

@ -358,7 +358,7 @@ QAV* getQAV(int res_id)
qavdata->frames[i].sound.priority = fr.ReadUInt8(); qavdata->frames[i].sound.priority = fr.ReadUInt8();
qavdata->frames[i].sound.sndFlags = fr.ReadUInt8(); qavdata->frames[i].sound.sndFlags = fr.ReadUInt8();
qavdata->frames[i].sound.sndRange = 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. // Read TILE_FRAME data.
for (int j = 0; j < 8; j++) for (int j = 0; j < 8; j++)

View file

@ -1805,8 +1805,8 @@ void ProcessMotion(void)
viewInterpolateSector(pSector); viewInterpolateSector(pSector);
pSector->floorz = pSector->baseFloor + vdi; pSector->floorz = pSector->baseFloor + vdi;
BloodSectIterator it(pSector); BloodSectIterator itr(pSector);
while (auto actor = it.Next()) while (auto actor = itr.Next())
{ {
if (actor->spr.flags&2) if (actor->spr.flags&2)
actor->spr.flags |= 4; actor->spr.flags |= 4;
@ -1828,8 +1828,8 @@ void ProcessMotion(void)
viewInterpolateSector(pSector); viewInterpolateSector(pSector);
pSector->ceilingz = pSector->baseCeil + vdi; pSector->ceilingz = pSector->baseCeil + vdi;
BloodSectIterator it(pSector); BloodSectIterator itr(pSector);
while (auto actor = it.Next()) while (auto actor = itr.Next())
{ {
int top, bottom; int top, bottom;
GetActorExtents(actor, &top, &bottom); GetActorExtents(actor, &top, &bottom);

View file

@ -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; int nScale = (actor->spr.yrepeat + ((floorZ - nBottom) >> 8)) * z;
nScale = ClipRange(nScale, 8000, 65536 << 1); nScale = ClipRange(nScale, 8000, 65536 << 1);
// Players on automap // Players on automap
double x = xdim / 2. + x1 / double(1 << 12); double xsize = xdim / 2. + x1 / double(1 << 12);
double y = ydim / 2. + y1 / double(1 << 12); double ysize = ydim / 2. + y1 / double(1 << 12);
// This very likely needs fixing later // 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, 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); DTA_ClipRight, windowxy2.X + 1, DTA_ClipBottom, windowxy2.Y + 1, DTA_Alpha, (actor->spr.cstat & CSTAT_SPRITE_TRANSLUCENT ? 0.5 : 1.), TAG_DONE);

View file

@ -165,9 +165,9 @@ void warpInit(TArray<DBloodActor*>& actors)
if (actor && actor->hasX()) if (actor && actor->hasX())
{ {
int nLink = actor->xspr.data1; int nLink = actor->xspr.data1;
for(auto& sect: sector) for(auto& isect: sector)
{ {
auto actor2 = barrier_cast<DBloodActor*>(sect.lowerLink); auto actor2 = barrier_cast<DBloodActor*>(isect.lowerLink);
if (actor2 && actor2->hasX()) if (actor2 && actor2->hasX())
{ {
if (actor2->xspr.data1 == nLink) if (actor2->xspr.data1 == nLink)

View file

@ -417,8 +417,8 @@ void UpdateAimVector(PLAYER * pPlayer)
} }
if (pWeaponTrack->thingAngle > 0) if (pWeaponTrack->thingAngle > 0)
{ {
BloodStatIterator it(kStatThing); BloodStatIterator itr(kStatThing);
while (auto actor = it.Next()) while (auto actor = itr.Next())
{ {
if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pPlayer, actor)) if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pPlayer, actor))
continue; continue;