- renamed all shadowing variables in Duke.

This commit is contained in:
Christoph Oelckers 2021-12-24 10:53:27 +01:00
parent 032c597fa5
commit 7bbd4343a8
14 changed files with 127 additions and 128 deletions

View file

@ -831,11 +831,11 @@ public:
if (result) if (result)
{ {
IMAGEHLP_LINE64 line64; IMAGEHLP_LINE64 line64;
displacement = 0; DWORD displacement1 = 0;
memset(&line64, 0, sizeof(IMAGEHLP_LINE64)); memset(&line64, 0, sizeof(IMAGEHLP_LINE64));
line64.SizeOfStruct = sizeof(IMAGEHLP_LINE64); line64.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
auto symresult = SymGetLineFromAddr64(GetCurrentProcess(), (DWORD64)frame, &displacement, &line64); result = SymGetLineFromAddr64(GetCurrentProcess(), (DWORD64)frame, &displacement1, &line64);
if (symresult) if (result)
{ {
s.Format("Called from %s at %s, line %d\n", symbol64->Name, line64.FileName, (int)line64.LineNumber); s.Format("Called from %s at %s, line %d\n", symbol64->Name, line64.FileName, (int)line64.LineNumber);
} }

View file

@ -589,15 +589,15 @@ void movefx(void)
int flags = S_GetUserFlags(act->spr.lotag); int flags = S_GetUserFlags(act->spr.lotag);
if (flags & SF_MSFX) if (flags & SF_MSFX)
{ {
int x = dist(ps[screenpeek].GetActor(), act); int distance = dist(ps[screenpeek].GetActor(), act);
if (x < ht && act->temp_data[0] == 0) if (distance < ht && act->temp_data[0] == 0)
{ {
// Start playing an ambience sound. // Start playing an ambience sound.
S_PlayActorSound(act->spr.lotag, act, CHAN_AUTO, CHANF_LOOP); S_PlayActorSound(act->spr.lotag, act, CHAN_AUTO, CHANF_LOOP);
act->temp_data[0] = 1; // AMBIENT_SFX_PLAYING act->temp_data[0] = 1; // AMBIENT_SFX_PLAYING
} }
else if (x >= ht && act->temp_data[0] == 1) else if (distance >= ht && act->temp_data[0] == 1)
{ {
// Stop playing ambience sound because we're out of its range. // Stop playing ambience sound because we're out of its range.
S_StopSound(act->spr.lotag, act); S_StopSound(act->spr.lotag, act);
@ -2932,10 +2932,10 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
} }
} }
auto Owner = actor->GetOwner(); auto actOwner = actor->GetOwner();
if (Owner) if (actOwner)
{ {
DukeSectIterator itr(Owner->sector()); DukeSectIterator itr(actOwner->sector());
while (auto a2 = itr.Next()) while (auto a2 = itr.Next())
{ {
if (a2->spr.statnum == 1 && badguy(a2) && a2->spr.picnum != SECTOREFFECTOR && a2->spr.picnum != LOCATORS) if (a2->spr.statnum == 1 && badguy(a2) && a2->spr.picnum != SECTOREFFECTOR && a2->spr.picnum != LOCATORS)
@ -3874,8 +3874,8 @@ void handle_se17(DDukeActor* actor)
actor->temp_data[1] = 0; actor->temp_data[1] = 0;
DDukeActor* act2; DDukeActor* act2;
DukeStatIterator it(STAT_EFFECTOR); DukeStatIterator itr(STAT_EFFECTOR);
while ((act2 = it.Next())) while ((act2 = itr.Next()))
{ {
if (actor != act2 && (act2->spr.lotag) == 17) if (actor != act2 && (act2->spr.lotag) == 17)
if ((sc->hitag - actor->temp_data[0]) == (act2->sector()->hitag) && sh == (act2->spr.hitag)) if ((sc->hitag - actor->temp_data[0]) == (act2->sector()->hitag) && sh == (act2->spr.hitag))
@ -4872,8 +4872,8 @@ void makeitfall(DDukeActor* actor)
if ((actor->spr.statnum == STAT_ACTOR || actor->spr.statnum == STAT_PLAYER || actor->spr.statnum == STAT_ZOMBIEACTOR || actor->spr.statnum == STAT_STANDABLE)) if ((actor->spr.statnum == STAT_ACTOR || actor->spr.statnum == STAT_PLAYER || actor->spr.statnum == STAT_ZOMBIEACTOR || actor->spr.statnum == STAT_STANDABLE))
{ {
Collision c; Collision coll;
getzrange({ actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (FOURSLEIGHT) }, actor->spr.sector(), &actor->ceilingz, c, &actor->floorz, c, 127, CLIPMASK0); getzrange({ actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (FOURSLEIGHT) }, actor->spr.sector(), &actor->ceilingz, coll, &actor->floorz, coll, 127, CLIPMASK0);
} }
else else
{ {

View file

@ -1768,15 +1768,15 @@ static void weaponcommon_d(DDukeActor* proj)
} }
else if (proj->spr.picnum != COOLEXPLOSION1 && proj->spr.picnum != FREEZEBLAST && proj->spr.picnum != FIRELASER && (!isWorldTour() || proj->spr.picnum != FIREBALL)) else if (proj->spr.picnum != COOLEXPLOSION1 && proj->spr.picnum != FREEZEBLAST && proj->spr.picnum != FIRELASER && (!isWorldTour() || proj->spr.picnum != FIREBALL))
{ {
auto k = spawn(proj, EXPLOSION2); auto spawned = spawn(proj, EXPLOSION2);
if (k) if (spawned)
{ {
k->spr.xrepeat = k->spr.yrepeat = proj->spr.xrepeat >> 1; spawned->spr.xrepeat = spawned->spr.yrepeat = proj->spr.xrepeat >> 1;
if (coll.type == kHitSector) if (coll.type == kHitSector)
{ {
if (proj->spr.zvel < 0) if (proj->spr.zvel < 0)
{ {
k->spr.cstat |= CSTAT_SPRITE_YFLIP; k->spr.pos.Z += (72 << 8); spawned->spr.cstat |= CSTAT_SPRITE_YFLIP; spawned->spr.pos.Z += (72 << 8);
} }
} }
} }
@ -2302,16 +2302,16 @@ static void greenslime(DDukeActor *actor)
{ {
for (x = 0; x < 8; x++) for (x = 0; x < 8; x++)
{ {
auto j = EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (8 << 8), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (actor->spr.zvel >> 2), actor, 5); auto spawned = EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (8 << 8), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (actor->spr.zvel >> 2), actor, 5);
j->spr.pal = 6; spawned->spr.pal = 6;
} }
S_PlayActorSound(SLIM_DYING, actor); S_PlayActorSound(SLIM_DYING, actor);
S_PlayActorSound(SQUISHED, actor); S_PlayActorSound(SQUISHED, actor);
if ((krand() & 255) < 32) if ((krand() & 255) < 32)
{ {
auto j = spawn(actor, BLOODPOOL); auto spawned = spawn(actor, BLOODPOOL);
if (j) j->spr.pal = 0; if (spawned) spawned->spr.pal = 0;
} }
ps[p].actors_killed++; ps[p].actors_killed++;
actor->temp_data[0] = -3; actor->temp_data[0] = -3;
@ -2411,14 +2411,14 @@ static void greenslime(DDukeActor *actor)
if ((krand() & 255) < 32) if ((krand() & 255) < 32)
{ {
auto j = spawn(actor, BLOODPOOL); auto spawned = spawn(actor, BLOODPOOL);
if (j) j->spr.pal = 0; if (spawned) spawned->spr.pal = 0;
} }
for (x = 0; x < 8; x++) for (x = 0; x < 8; x++)
{ {
auto j = EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (8 << 8), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (actor->spr.zvel >> 2), actor, 5); auto spawned = EGS(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (8 << 8), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (actor->spr.zvel >> 2), actor, 5);
if (j) j->spr.pal = 6; if (spawned) spawned->spr.pal = 6;
} }
actor->temp_data[0] = -3; actor->temp_data[0] = -3;
deletesprite(actor); deletesprite(actor);
@ -2963,8 +2963,8 @@ void moveactors_d(void)
act->spr.cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR | CSTAT_SPRITE_YCENTER; act->spr.cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR | CSTAT_SPRITE_YCENTER;
k = 1; k = 1;
DukeStatIterator it(STAT_ACTOR); DukeStatIterator itr(STAT_ACTOR);
while (auto act2 = it.Next()) while (auto act2 = itr.Next())
{ {
if (act2->spr.lotag == act->spr.lotag && if (act2->spr.lotag == act->spr.lotag &&
act2->spr.picnum == act->spr.picnum) act2->spr.picnum == act->spr.picnum)

View file

@ -790,8 +790,8 @@ void movefallers_r(void)
if (act->spr.extra <= 0) if (act->spr.extra <= 0)
{ {
act->temp_data[0] = 1; act->temp_data[0] = 1;
DukeStatIterator it(STAT_FALLER); DukeStatIterator itr(STAT_FALLER);
while (auto ac2 = it.Next()) while (auto ac2 = itr.Next())
{ {
if (ac2->spr.hitag == act->spr.hitag) if (ac2->spr.hitag == act->spr.hitag)
{ {
@ -1446,16 +1446,16 @@ static void weaponcommon_r(DDukeActor *proj)
else if (isRRRA() && proj->spr.picnum == RRTILE1790) rpgexplode(proj, coll.type, oldpos, EXPLOSION2, -1, 160, RPG_EXPLODE); else if (isRRRA() && proj->spr.picnum == RRTILE1790) rpgexplode(proj, coll.type, oldpos, EXPLOSION2, -1, 160, RPG_EXPLODE);
else if (proj->spr.picnum != FREEZEBLAST && proj->spr.picnum != FIRELASER && proj->spr.picnum != SHRINKSPARK) else if (proj->spr.picnum != FREEZEBLAST && proj->spr.picnum != FIRELASER && proj->spr.picnum != SHRINKSPARK)
{ {
auto k = spawn(proj, 1441); auto spawned = spawn(proj, 1441);
if (k) if (spawned)
{ {
k->spr.xrepeat = k->spr.yrepeat = proj->spr.xrepeat >> 1; spawned->spr.xrepeat = spawned->spr.yrepeat = proj->spr.xrepeat >> 1;
if (coll.type == kHitSector) if (coll.type == kHitSector)
{ {
if (proj->spr.zvel < 0) if (proj->spr.zvel < 0)
{ {
k->spr.cstat |= CSTAT_SPRITE_YFLIP; spawned->spr.cstat |= CSTAT_SPRITE_YFLIP;
k->spr.pos.Z += (72 << 8); spawned->spr.pos.Z += (72 << 8);
} }
} }
} }
@ -1802,12 +1802,12 @@ void movetransports_r(void)
if (sectlotag > 0) if (sectlotag > 0)
{ {
auto k = spawn(act2, WATERSPLASH2); auto spawned = spawn(act2, WATERSPLASH2);
if (k && sectlotag == 1 && act2->spr.statnum == 4) if (spawned && sectlotag == 1 && act2->spr.statnum == 4)
{ {
k->spr.xvel = act2->spr.xvel >> 1; spawned->spr.xvel = act2->spr.xvel >> 1;
k->spr.ang = act2->spr.ang; spawned->spr.ang = act2->spr.ang;
ssp(k, CLIPMASK0); ssp(spawned, CLIPMASK0);
} }
} }
@ -1986,8 +1986,8 @@ static void rrra_specialstats()
if (enemysizecheat > 0) if (enemysizecheat > 0)
{ {
DukeSpriteIterator it; DukeSpriteIterator itr;
while (auto act = it.Next()) while (auto act = itr.Next())
{ {
switch (act->spr.picnum) switch (act->spr.picnum)
{ {

View file

@ -397,10 +397,10 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int
//Draw sprites //Draw sprites
auto pactor = ps[screenpeek].GetActor(); auto pactor = ps[screenpeek].GetActor();
for (unsigned i = 0; i < sector.Size(); i++) for (unsigned ii = 0; ii < sector.Size(); ii++)
{ {
if (!gFullMap || !show2dsector[i]) continue; if (!gFullMap || !show2dsector[ii]) continue;
DukeSectIterator it(i); DukeSectIterator it(ii);
while (auto act = it.Next()) while (auto act = it.Next())
{ {
if (act == pactor || (act->spr.cstat & CSTAT_SPRITE_INVISIBLE) || act->spr.cstat == CSTAT_SPRITE_BLOCK_ALL || act->spr.xrepeat == 0) continue; if (act == pactor || (act->spr.cstat & CSTAT_SPRITE_INVISIBLE) || act->spr.cstat == CSTAT_SPRITE_BLOCK_ALL || act->spr.xrepeat == 0) continue;

View file

@ -1629,7 +1629,7 @@ int ConCompiler::parsecommand()
parsecommand(); parsecommand();
setscriptvalue(tempscrptr, scriptpos()); setscriptvalue(tempscrptr, scriptpos());
auto k = keyword(); auto kw = keyword();
// Cannot be done - the code starts misbehaving with this check, it is especially noticeable on the soldiers in NAM. // Cannot be done - the code starts misbehaving with this check, it is especially noticeable on the soldiers in NAM.
// Unfortunately this means one less error check, but ultimately CON is too broken to begin with anyway // Unfortunately this means one less error check, but ultimately CON is too broken to begin with anyway
#if 0 #if 0
@ -1911,7 +1911,7 @@ int ConCompiler::parsecommand()
// What a mess. The only way to detect which game version we are running is to count the parsed values here. // What a mess. The only way to detect which game version we are running is to count the parsed values here.
int params[34]; // 34 is the maximum for RRRA. int params[34]; // 34 is the maximum for RRRA.
int pcount = 0; int pcount = 0;
for (int i = 0; i < 34; i++) for (int ii = 0; ii < 34; ii++)
{ {
transnum(LABEL_DEFINE); transnum(LABEL_DEFINE);
params[pcount++] = popscriptvalue(); params[pcount++] = popscriptvalue();
@ -2719,10 +2719,10 @@ int ConCompiler::parsecommand()
{ {
popscriptvalue(); popscriptvalue();
transnum(LABEL_DEFINE); transnum(LABEL_DEFINE);
int k = popscriptvalue(); int val = popscriptvalue();
if (k > VERSIONCHECK) if (val > VERSIONCHECK)
{ {
Printf(TEXTCOLOR_RED " * ERROR: This CON Code requires at least Build %d, but we are only Build %d\n", k, (int)VERSIONCHECK); Printf(TEXTCOLOR_RED " * ERROR: This CON Code requires at least Build %d, but we are only Build %d\n", val, (int)VERSIONCHECK);
errorcount++; errorcount++;
} }
break; break;

View file

@ -2073,10 +2073,10 @@ int ParseState::parse(void)
updatesector(ps[g_p].pos.X,ps[g_p].pos.Y,&ps[g_p].cursector); updatesector(ps[g_p].pos.X,ps[g_p].pos.Y,&ps[g_p].cursector);
DukeStatIterator it(STAT_ACTOR); DukeStatIterator it(STAT_ACTOR);
while (auto j = it.Next()) while (auto actj = it.Next())
{ {
if (j->spr.picnum == TILE_CAMERA1) if (actj->spr.picnum == TILE_CAMERA1)
j->spr.yvel = 0; actj->spr.yvel = 0;
} }
} }
@ -2189,16 +2189,16 @@ int ParseState::parse(void)
s = 0; s = 0;
else s = (krand()%3); else s = (krand()%3);
auto l = EGS(g_ac->spr.sector(), auto spawned = EGS(g_ac->spr.sector(),
g_ac->spr.pos.X + (krand() & 255) - 128, g_ac->spr.pos.Y + (krand() & 255) - 128, g_ac->spr.pos.Z - (8 << 8) - (krand() & 8191), g_ac->spr.pos.X + (krand() & 255) - 128, g_ac->spr.pos.Y + (krand() & 255) - 128, g_ac->spr.pos.Z - (8 << 8) - (krand() & 8191),
dnum + s, g_ac->spr.shade, 32 + (krand() & 15), 32 + (krand() & 15), dnum + s, g_ac->spr.shade, 32 + (krand() & 15), 32 + (krand() & 15),
krand() & 2047, (krand() & 127) + 32, -(krand() & 2047), g_ac, 5); krand() & 2047, (krand() & 127) + 32, -(krand() & 2047), g_ac, 5);
if (l) if (spawned)
{ {
if (weap) if (weap)
l->spr.yvel = gs.weaponsandammosprites[j % 14]; spawned->spr.yvel = gs.weaponsandammosprites[j % 14];
else l->spr.yvel = -1; else spawned->spr.yvel = -1;
l->spr.pal = g_ac->spr.pal; spawned->spr.pal = g_ac->spr.pal;
} }
} }
insptr++; insptr++;
@ -2577,20 +2577,20 @@ int ParseState::parse(void)
break; break;
*/ */
case concmd_addlog: case concmd_addlog:
{ int l; { int instr;
int lFile; int lFile;
insptr++; insptr++;
lFile=*(insptr++); // file lFile=*(insptr++); // file
l=*(insptr++); // line instr=*(insptr++); // line
// this was only printing file name and line number as debug output. // this was only printing file name and line number as debug output.
break; break;
} }
case concmd_addlogvar: case concmd_addlogvar:
{ int l; { int instr;
int lFile; int lFile;
insptr++; insptr++;
lFile=*(insptr++); // file lFile=*(insptr++); // file
l=*(insptr++); // l=Line number, *instpr=varID instr=*(insptr++); // l=Line number, *instpr=varID
if( (*insptr >= iGameVarCount) if( (*insptr >= iGameVarCount)
|| *insptr < 0 || *insptr < 0
) )
@ -2960,16 +2960,16 @@ int ParseState::parse(void)
lDist = 32767; // big number lDist = 32767; // big number
DukeStatIterator it(STAT_ACTOR); DukeStatIterator it(STAT_ACTOR);
while (auto j = it.Next()) while (auto actj = it.Next())
{ {
if (j->spr.picnum == lType) if (actj->spr.picnum == lType)
{ {
lTemp = ldist(g_ac, j); lTemp = ldist(g_ac, actj);
if (lTemp < lMaxDist) if (lTemp < lMaxDist)
{ {
if (lTemp < lDist) if (lTemp < lDist)
{ {
lFound = j; lFound = actj;
} }
} }
@ -3003,16 +3003,16 @@ int ParseState::parse(void)
lDist = 32767; // big number lDist = 32767; // big number
DukeStatIterator it(STAT_ACTOR); DukeStatIterator it(STAT_ACTOR);
while (auto j = it.Next()) while (auto actj = it.Next())
{ {
if (j->spr.picnum == lType) if (actj->spr.picnum == lType)
{ {
lTemp = ldist(g_ac, j); lTemp = ldist(g_ac, actj);
if (lTemp < lMaxDist) if (lTemp < lMaxDist)
{ {
if (lTemp < lDist) if (lTemp < lDist)
{ {
lFound = j; lFound = actj;
} }
} }
@ -3230,16 +3230,16 @@ int ParseState::parse(void)
case concmd_modvar: case concmd_modvar:
{ {
int i; int i;
int l; int instr;
int lResult; int lResult;
insptr++; insptr++;
i = *(insptr++); // ID of def i = *(insptr++); // ID of def
l = (*insptr); instr = (*insptr);
if (l == 0) if (instr == 0)
{ {
I_Error("Divide by Zero in CON"); I_Error("Divide by Zero in CON");
} }
lResult = GetGameVarID(i, g_ac, g_p).safeValue() % l; lResult = GetGameVarID(i, g_ac, g_p).safeValue() % instr;
SetGameVarID(i, lResult, g_ac, g_p); SetGameVarID(i, lResult, g_ac, g_p);
insptr++; insptr++;
break; break;
@ -3247,12 +3247,12 @@ int ParseState::parse(void)
case concmd_andvar: case concmd_andvar:
{ {
int i; int i;
int l; int instr;
int lResult; int lResult;
insptr++; insptr++;
i = *(insptr++); // ID of def i = *(insptr++); // ID of def
l = (*insptr); instr = (*insptr);
lResult = GetGameVarID(i, g_ac, g_p).safeValue() & l; lResult = GetGameVarID(i, g_ac, g_p).safeValue() & instr;
SetGameVarID(i, lResult, g_ac, g_p); SetGameVarID(i, lResult, g_ac, g_p);
insptr++; insptr++;
break; break;
@ -3260,12 +3260,12 @@ int ParseState::parse(void)
case concmd_xorvar: case concmd_xorvar:
{ {
int i; int i;
int l; int instr;
int lResult; int lResult;
insptr++; insptr++;
i = *(insptr++); // ID of def i = *(insptr++); // ID of def
l = (*insptr); instr = (*insptr);
lResult = GetGameVarID(i, g_ac, g_p).safeValue() ^ l; lResult = GetGameVarID(i, g_ac, g_p).safeValue() ^ instr;
SetGameVarID(i, lResult, g_ac, g_p); SetGameVarID(i, lResult, g_ac, g_p);
insptr++; insptr++;
break; break;
@ -3273,12 +3273,12 @@ int ParseState::parse(void)
case concmd_orvar: case concmd_orvar:
{ {
int i; int i;
int l; int instr;
int lResult; int lResult;
insptr++; insptr++;
i = *(insptr++); // ID of def i = *(insptr++); // ID of def
l = (*insptr); instr = (*insptr);
lResult = GetGameVarID(i, g_ac, g_p).safeValue() | l; lResult = GetGameVarID(i, g_ac, g_p).safeValue() | instr;
SetGameVarID(i, lResult, g_ac, g_p); SetGameVarID(i, lResult, g_ac, g_p);
insptr++; insptr++;
break; break;

View file

@ -1120,8 +1120,8 @@ void shoot_d(DDukeActor* actor, int atwith)
{ {
if (actor->spr.extra >= 0) actor->spr.shade = -96; if (actor->spr.extra >= 0) actor->spr.shade = -96;
auto j = ps[findplayer(actor, &x)].GetActor(); auto plActor = ps[findplayer(actor, &x)].GetActor();
x = ldist(j, actor); x = ldist(plActor, actor);
zvel = -x >> 1; zvel = -x >> 1;
@ -1161,15 +1161,15 @@ void shoot_d(DDukeActor* actor, int atwith)
} }
else zvel = 0; else zvel = 0;
auto j = EGS(sect, auto spawned = EGS(sect,
sx - bsin(sa, -12), sx - bsin(sa, -12),
sy + bcos(sa, -12), sy + bcos(sa, -12),
sz + (2 << 8), SHRINKSPARK, -16, 28, 28, sa, 768, zvel, actor, 4); sz + (2 << 8), SHRINKSPARK, -16, 28, 28, sa, 768, zvel, actor, 4);
if (j) if (spawned)
{ {
j->spr.cstat = CSTAT_SPRITE_YCENTER; spawned->spr.cstat = CSTAT_SPRITE_YCENTER;
j->spr.clipdist = 32; spawned->spr.clipdist = 32;
} }
@ -2323,7 +2323,7 @@ static void operateweapon(int snum, ESyncBits actions)
if (p->kickback_pic == 4) if (p->kickback_pic == 4)
{ {
for(int i = 0; i < 7; i++) for(int ii = 0; ii < 7; ii++)
fi.shoot(pact, SHOTGUN); fi.shoot(pact, SHOTGUN);
p->ammo_amount[SHOTGUN_WEAPON]--; p->ammo_amount[SHOTGUN_WEAPON]--;

View file

@ -497,15 +497,14 @@ void operateweapon_ww(int snum, ESyncBits actions)
) )
{ {
// reload in progress... // reload in progress...
int i; int timer = aplWeaponReload(p->curr_weapon, snum) - aplWeaponTotalTime(p->curr_weapon, snum);
i = aplWeaponReload(p->curr_weapon, snum) - aplWeaponTotalTime(p->curr_weapon, snum);
// time for 'reload' // time for 'reload'
if (p->kickback_pic == (aplWeaponTotalTime(p->curr_weapon, snum) + 1)) if (p->kickback_pic == (aplWeaponTotalTime(p->curr_weapon, snum) + 1))
{ // eject shortly after 'total time' { // eject shortly after 'total time'
S_PlayActorSound(EJECT_CLIP, pact); S_PlayActorSound(EJECT_CLIP, pact);
} }
else if (p->kickback_pic == (aplWeaponReload(p->curr_weapon, snum) - (i / 3))) else if (p->kickback_pic == (aplWeaponReload(p->curr_weapon, snum) - (timer / 3)))
{ {
// insert occurs 2/3 of way through reload delay // insert occurs 2/3 of way through reload delay
S_PlayActorSound(INSERT_CLIP, pact); S_PlayActorSound(INSERT_CLIP, pact);

View file

@ -412,8 +412,8 @@ void prelevel_d(int g, TArray<DDukeActor*>& actors)
break; break;
case W_FORCEFIELD: case W_FORCEFIELD:
for (int j = 0; j < 3; j++) for (int jj = 0; jj < 3; jj++)
tloadtile(W_FORCEFIELD + j); tloadtile(W_FORCEFIELD + jj);
[[fallthrough]]; [[fallthrough]];
case W_FORCEFIELD + 1: case W_FORCEFIELD + 1:
case W_FORCEFIELD + 2: case W_FORCEFIELD + 2:
@ -448,8 +448,8 @@ void prelevel_d(int g, TArray<DDukeActor*>& actors)
case SCREENBREAK6: case SCREENBREAK6:
case SCREENBREAK7: case SCREENBREAK7:
case SCREENBREAK8: case SCREENBREAK8:
for (int j = SCREENBREAK6; j < SCREENBREAK9; j++) for (int jj = SCREENBREAK6; jj < SCREENBREAK9; jj++)
tloadtile(j); tloadtile(jj);
animwall[numanimwalls].wall = &wal; animwall[numanimwalls].wall = &wal;
animwall[numanimwalls].tag = -1; animwall[numanimwalls].tag = -1;
numanimwalls++; numanimwalls++;

View file

@ -503,13 +503,13 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors)
dist = act->spr.lotag << 4; dist = act->spr.lotag << 4;
speed = act->spr.hitag; speed = act->spr.hitag;
DukeSpriteIterator itt; DukeSpriteIterator itt;
while(auto act = itt.Next()) while(auto act1 = itt.Next())
{ {
if (act->spr.picnum == RRTILE66) if (act1->spr.picnum == RRTILE66)
if (act->spr.lotag == act->spr.sectno()) // bad map format design... Should have used a tag instead... if (act1->spr.lotag == act->spr.sectno()) // bad map format design... Should have used a tag instead...
{ {
childsectnum = act->spr.sector(); childsectnum = act1->spr.sector();
deletesprite(act); deletesprite(act1);
} }
} }
deletesprite(act); deletesprite(act);
@ -694,10 +694,10 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors)
I_Error("Too many switches (64 max)."); I_Error("Too many switches (64 max).");
DukeStatIterator it1(STAT_EFFECTOR); DukeStatIterator it1(STAT_EFFECTOR);
while (auto j = it1.Next()) while (auto actj = it1.Next())
{ {
if (j->spr.lotag == 12 && j->spr.hitag == ac->spr.lotag) if (actj->spr.lotag == 12 && actj->spr.hitag == ac->spr.lotag)
j->temp_data[0] = 1; actj->temp_data[0] = 1;
} }
} }
break; break;

View file

@ -829,9 +829,9 @@ static void handle_st23(sectortype* sptr, DDukeActor* actor)
if (act2) if (act2)
{ {
DukeStatIterator it(STAT_EFFECTOR); DukeStatIterator itr(STAT_EFFECTOR);
while (auto act3 = it.Next()) while (auto act3 = itr.Next())
{ {
if (l == (act3->sector()->lotag & 0x8000) && act3->spr.lotag == SE_11_SWINGING_DOOR && act2->spr.hitag == act3->spr.hitag && act3->temp_data[4]) if (l == (act3->sector()->lotag & 0x8000) && act3->spr.lotag == SE_11_SWINGING_DOOR && act2->spr.hitag == act3->spr.hitag && act3->temp_data[4])
{ {
@ -839,8 +839,8 @@ static void handle_st23(sectortype* sptr, DDukeActor* actor)
} }
} }
it.Reset(STAT_EFFECTOR); itr.Reset(STAT_EFFECTOR);
while (auto act3 = it.Next()) while (auto act3 = itr.Next())
{ {
if (l == (act3->sector()->lotag & 0x8000) && act3->spr.lotag == SE_11_SWINGING_DOOR && act2->spr.hitag == act3->spr.hitag) if (l == (act3->sector()->lotag & 0x8000) && act3->spr.lotag == SE_11_SWINGING_DOOR && act2->spr.hitag == act3->spr.hitag)
{ {
@ -1136,8 +1136,8 @@ void operateactivators(int low, int plnum)
if (act->sector()->lotag < 3) if (act->sector()->lotag < 3)
{ {
DukeSectIterator it(act->sector()); DukeSectIterator itr(act->sector());
while (auto a2 = it.Next()) while (auto a2 = itr.Next())
{ {
if (a2->spr.statnum == 3) switch (a2->spr.lotag) if (a2->spr.statnum == 3) switch (a2->spr.lotag)
{ {

View file

@ -551,8 +551,8 @@ bool checkhitswitch_d(int snum, walltype* wwal, DDukeActor *act)
picnum == (MULTISWITCH + 2) || picnum == (MULTISWITCH + 3)) picnum == (MULTISWITCH + 2) || picnum == (MULTISWITCH + 3))
lotag += picnum - MULTISWITCH; lotag += picnum - MULTISWITCH;
DukeStatIterator it(STAT_EFFECTOR); DukeStatIterator itr(STAT_EFFECTOR);
while (auto other = it.Next()) while (auto other = itr.Next())
{ {
if (other->spr.hitag == lotag) if (other->spr.hitag == lotag)
{ {
@ -1110,8 +1110,8 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
case HEAVYHBOMB: case HEAVYHBOMB:
for (k = 0; k < 64; k++) for (k = 0; k < 64; k++)
{ {
auto j = EGS(targ->spr.sector(), targ->spr.pos.X, targ->spr.pos.Y, targ->spr.pos.Z - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (targ->spr.zvel >> 2), targ, 5); auto spawned = EGS(targ->spr.sector(), targ->spr.pos.X, targ->spr.pos.Y, targ->spr.pos.Z - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (targ->spr.zvel >> 2), targ, 5);
j->spr.pal = 8; spawned->spr.pal = 8;
} }
if (targ->spr.picnum == CACTUS) if (targ->spr.picnum == CACTUS)
@ -1310,8 +1310,8 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
case PIPE6:targ->spr.picnum = PIPE6B; break; case PIPE6:targ->spr.picnum = PIPE6B; break;
} }
{ {
auto j = spawn(targ, STEAM); auto spawned = spawn(targ, STEAM);
if (j) j->spr.pos.Z = targ->spr.sector()->floorz - (32 << 8); if (spawned) spawned->spr.pos.Z = targ->spr.sector()->floorz - (32 << 8);
} }
break; break;
@ -1472,9 +1472,9 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
updatesector(ps[p].pos.X, ps[p].pos.Y, &ps[p].cursector); updatesector(ps[p].pos.X, ps[p].pos.Y, &ps[p].cursector);
DukeStatIterator it(STAT_ACTOR); DukeStatIterator it(STAT_ACTOR);
while (auto j = it.Next()) while (auto itActor = it.Next())
{ {
if (j->spr.picnum == CAMERA1) j->spr.yvel = 0; if (itActor->spr.picnum == CAMERA1) itActor->spr.yvel = 0;
} }
} }

View file

@ -789,8 +789,8 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
DDukeActor* switches[3]; DDukeActor* switches[3];
int switchcount = 0, j; int switchcount = 0, j;
S_PlaySound3D(SWITCH_ON, act, &v); S_PlaySound3D(SWITCH_ON, act, &v);
DukeSpriteIterator it; DukeSpriteIterator itr;
while (auto actt = it.Next()) while (auto actt = itr.Next())
{ {
int jpn = actt->spr.picnum; int jpn = actt->spr.picnum;
int jht = actt->spr.hitag; int jht = actt->spr.hitag;
@ -835,8 +835,8 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
lotag += picnum - MULTISWITCH2; lotag += picnum - MULTISWITCH2;
} }
DukeStatIterator it(STAT_EFFECTOR); DukeStatIterator itr(STAT_EFFECTOR);
while (auto other = it.Next()) while (auto other = itr.Next())
{ {
if (other->spr.hitag == lotag) if (other->spr.hitag == lotag)
{ {
@ -1503,8 +1503,8 @@ bool checkhitceiling_r(sectortype* sectp)
{ {
if (act1->spr.picnum == SECTOREFFECTOR && (act1->spr.lotag == 12 || (isRRRA() && (act1->spr.lotag == 47 || act1->spr.lotag == 48)))) if (act1->spr.picnum == SECTOREFFECTOR && (act1->spr.lotag == 12 || (isRRRA() && (act1->spr.lotag == 47 || act1->spr.lotag == 48))))
{ {
DukeStatIterator it(STAT_EFFECTOR); DukeStatIterator itr(STAT_EFFECTOR);
while (auto act2 = it.Next()) while (auto act2 = itr.Next())
{ {
if (act2->spr.hitag == act1->spr.hitag) if (act2->spr.hitag == act1->spr.hitag)
act2->temp_data[3] = 1; act2->temp_data[3] = 1;
@ -2164,8 +2164,8 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
case UWHIP: case UWHIP:
for (k = 0; k < 64; k++) for (k = 0; k < 64; k++)
{ {
auto j = EGS(targ->spr.sector(), targ->spr.pos.X, targ->spr.pos.Y, targ->spr.pos.Z - (krand() % (48 << 8)), SCRAP6 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (targ->spr.zvel >> 2), targ, 5); auto spawned = EGS(targ->spr.sector(), targ->spr.pos.X, targ->spr.pos.Y, targ->spr.pos.Z - (krand() % (48 << 8)), SCRAP6 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (targ->spr.zvel >> 2), targ, 5);
j->spr.pal = 8; if (spawned) spawned->spr.pal = 8;
} }
if (targ->spr.picnum == CACTUS) if (targ->spr.picnum == CACTUS)
@ -2322,8 +2322,8 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
case PIPE6:targ->spr.picnum = PIPE6B; break; case PIPE6:targ->spr.picnum = PIPE6B; break;
} }
{ {
auto j = spawn(targ, STEAM); auto spawned = spawn(targ, STEAM);
if (j) j->spr.pos.Z = targ->spr.sector()->floorz - (32 << 8); if (spawned) spawned->spr.pos.Z = targ->spr.sector()->floorz - (32 << 8);
} }
break; break;