From 727e2ceb29a5b23fc3a2ca6c67d5704fa708127d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 15 Oct 2020 17:45:07 +0200 Subject: [PATCH] - iterator variable cleanup. --- source/sw/src/ai.cpp | 2 +- source/sw/src/break.cpp | 4 +-- source/sw/src/bunny.cpp | 2 +- source/sw/src/cache.cpp | 2 +- source/sw/src/coolie.cpp | 2 +- source/sw/src/draw.cpp | 11 +++----- source/sw/src/game.cpp | 2 +- source/sw/src/hornet.cpp | 2 +- source/sw/src/jsector.cpp | 2 +- source/sw/src/jweapon.cpp | 6 ++-- source/sw/src/light.cpp | 10 +++---- source/sw/src/miscactr.cpp | 2 +- source/sw/src/player.cpp | 23 ++++++++-------- source/sw/src/quake.cpp | 8 +++--- source/sw/src/rooms.cpp | 10 +++---- source/sw/src/rotator.cpp | 8 +++--- source/sw/src/sector.cpp | 25 ++++++++--------- source/sw/src/slidor.cpp | 8 +++--- source/sw/src/sounds.cpp | 2 +- source/sw/src/spike.cpp | 12 ++++---- source/sw/src/sprite.cpp | 42 ++++++++++++---------------- source/sw/src/sumo.cpp | 3 +- source/sw/src/track.cpp | 10 +++---- source/sw/src/vator.cpp | 16 +++++------ source/sw/src/vis.cpp | 6 ++-- source/sw/src/wallmove.cpp | 4 +-- source/sw/src/warp.cpp | 6 ++-- source/sw/src/weapon.cpp | 56 +++++++++++++++++++------------------- 28 files changed, 138 insertions(+), 148 deletions(-) diff --git a/source/sw/src/ai.cpp b/source/sw/src/ai.cpp index 1f69c99b7..d103f325f 100644 --- a/source/sw/src/ai.cpp +++ b/source/sw/src/ai.cpp @@ -399,7 +399,7 @@ DoActorPickClosePlayer(short SpriteNum) // if actor can still see the player int look_height = SPRITEp_TOS(sp); bool found = false; - int i,nexti; + int i; if (u->ID == ZOMBIE_RUN_R0 && gNet.MultiGameType == MULTI_GAME_COOPERATIVE) goto TARGETACTOR; diff --git a/source/sw/src/break.cpp b/source/sw/src/break.cpp index 1c75eb89d..115c82d51 100644 --- a/source/sw/src/break.cpp +++ b/source/sw/src/break.cpp @@ -543,7 +543,7 @@ BREAK_INFOp SetupSpriteForBreak(SPRITEp sp) short FindBreakSpriteMatch(short match) { - short i,nexti; + int i; StatIterator it(STAT_BREAKABLE); while ((i = it.NextIndex()) >= 0) @@ -1119,7 +1119,7 @@ void DoWallBreakMatch(short match) static void DoWallBreakSpriteMatch(short match) { - short i,nexti; + int i; StatIterator it(STAT_ENEMY); while ((i = it.NextIndex()) >= 0) diff --git a/source/sw/src/bunny.cpp b/source/sw/src/bunny.cpp index 7614df02f..60cc32d34 100644 --- a/source/sw/src/bunny.cpp +++ b/source/sw/src/bunny.cpp @@ -925,7 +925,7 @@ DoPickCloseBunny(short SpriteNum) USERp u = User[SpriteNum],tu; SPRITEp sp = &sprite[SpriteNum],tsp; int dist, near_dist = 1000, a,b,c; - short i, nexti; + int i; //short BunnyCount=0, Bunny_Result = -1; // if actor can still see the player diff --git a/source/sw/src/cache.cpp b/source/sw/src/cache.cpp index c90ae5562..654025157 100644 --- a/source/sw/src/cache.cpp +++ b/source/sw/src/cache.cpp @@ -293,7 +293,7 @@ PreCacheRange(short start_pic, short end_pic) void PreCacheOverride(void) { - int i,nexti; + int i; StatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE); while ((i = it.NextIndex()) >= 0) diff --git a/source/sw/src/coolie.cpp b/source/sw/src/coolie.cpp index 4e9c342f3..ae5c97bf2 100644 --- a/source/sw/src/coolie.cpp +++ b/source/sw/src/coolie.cpp @@ -473,7 +473,7 @@ void EnemyDefaults(short SpriteNum, ACTOR_ACTION_SETp action, PERSONALITYp perso // make sure we start in the water if thats where we are if (u->lo_sectp) // && SectUser[u->lo_sectp - sector]) { - short i,nexti; + int i; short sectnum = u->lo_sectp - sector; if (SectUser[sectnum] && TEST(u->lo_sectp->extra, SECTFX_SINK)) diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 7bfe7b40a..2442e19a6 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -1263,7 +1263,7 @@ void DrawCrosshair(PLAYERp pp) void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, binangle *tang, fixedhoriz *thoriz) { - int i,nexti; + int i; binangle ang; SPRITEp sp; bool found_camera = false; @@ -1379,8 +1379,7 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, binangle void PreDraw(void) { - short i, nexti; - + int i; PreDrawStackedWater(); StatIterator it(STAT_FLOOR_SLOPE_DONT_DRAW); @@ -1393,8 +1392,7 @@ PreDraw(void) void PostDraw(void) { - short i, nexti; - + int i; StatIterator it(STAT_FLOOR_SLOPE_DONT_DRAW); while ((i = it.NextIndex()) >= 0) { @@ -1546,8 +1544,7 @@ void PreDrawStackedWater(void) void FAF_DrawRooms(int x, int y, int z, fixed_t q16ang, fixed_t q16horiz, short sectnum) { - short i,nexti; - + int i; StatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE); while ((i = it.NextIndex()) >= 0) { diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index b0fb3fdf0..2f6a57fd2 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -479,7 +479,7 @@ void TerminateLevel(void) videoFadePalette(0, 0, 0, 0); if (!currentLevel) return; - int i, nexti, stat, pnum, ndx; + int i, stat, pnum, ndx; SECT_USERp* sectu; // Free any track points diff --git a/source/sw/src/hornet.cpp b/source/sw/src/hornet.cpp index e1297a12f..43406027f 100644 --- a/source/sw/src/hornet.cpp +++ b/source/sw/src/hornet.cpp @@ -552,7 +552,7 @@ DoHornetDeath(short SpriteNum) // Hornets can swarm around other hornets or whatever is tagged as swarm target int DoCheckSwarm(short SpriteNum) { - short i,nexti; + int i; SPRITEp sp = &sprite[SpriteNum], tsp; USERp u = User[SpriteNum], tu; int dist, pdist, a,b,c; diff --git a/source/sw/src/jsector.cpp b/source/sw/src/jsector.cpp index 2e7d31787..989c4e37d 100644 --- a/source/sw/src/jsector.cpp +++ b/source/sw/src/jsector.cpp @@ -478,7 +478,7 @@ void drawroomstotile(int daposx, int daposy, int daposz, void JS_ProcessEchoSpot() { - short i,nexti; + int i; SPRITEp tp; int j,dist; PLAYERp pp = Player+screenpeek; diff --git a/source/sw/src/jweapon.cpp b/source/sw/src/jweapon.cpp index b84d60dd4..c0b8895db 100644 --- a/source/sw/src/jweapon.cpp +++ b/source/sw/src/jweapon.cpp @@ -1584,7 +1584,7 @@ InitChemBomb(short SpriteNum) int PlayerInitFlashBomb(PLAYERp pp) { - short i, nexti; + int i; unsigned int stat; int dist, tx, ty, tmin; short damage; @@ -1654,7 +1654,7 @@ PlayerInitFlashBomb(PLAYERp pp) int InitFlashBomb(int16_t SpriteNum) { - short i, nexti; + int i; unsigned int stat; int dist, tx, ty, tmin; short damage; @@ -2138,7 +2138,7 @@ DoFlagRangeTest(short Weapon, short range) SPRITEp wp = &sprite[Weapon]; SPRITEp sp; - short i, nexti; + int i; unsigned int stat; int dist, tx, ty; int tmin; diff --git a/source/sw/src/light.cpp b/source/sw/src/light.cpp index 7714e7467..22537de2d 100644 --- a/source/sw/src/light.cpp +++ b/source/sw/src/light.cpp @@ -111,7 +111,7 @@ void SectorLightShade(SPRITEp sp, short intensity) void DiffuseLighting(SPRITEp sp) { - short i, nexti; + int i; short count; short shade; SPRITEp dsp; @@ -143,7 +143,7 @@ void DiffuseLighting(SPRITEp sp) void DoLightingMatch(short match, short state) { - short i,nexti; + int i; SPRITEp sp; StatIterator it(STAT_LIGHTING); @@ -266,9 +266,8 @@ void DoLightingMatch(short match, short state) void InitLighting(void) { - short i,nexti; SPRITEp sp; - + int i; // processed on level startup // puts lights in correct state @@ -286,9 +285,8 @@ void InitLighting(void) void DoLighting(void) { - short i,nexti; SPRITEp sp; - + int i; StatIterator it(STAT_LIGHTING); while ((i = it.NextIndex()) >= 0) diff --git a/source/sw/src/miscactr.cpp b/source/sw/src/miscactr.cpp index 2bf0377c1..9bff44fcc 100644 --- a/source/sw/src/miscactr.cpp +++ b/source/sw/src/miscactr.cpp @@ -819,7 +819,7 @@ int PachinkoCheckWin(short SpriteNum) /*short rnd = */RANDOM_RANGE(1000); if (RANDOM_RANGE(1000) > 900 || Pachinko_Win_Cheat) { - short i, nexti; + int i; SPRITEp tsp; USERp tu; diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index ba584abc7..84a57e827 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1145,7 +1145,8 @@ DoPickTarget(SPRITEp sp, uint32_t max_delta_ang, int skip_targets) { #define PICK_DIST 40000L - short i, nexti, angle2, delta_ang; + int i; + short angle2, delta_ang; int dist, zh; SPRITEp ep; USERp eu; @@ -2401,7 +2402,7 @@ DoPlayerSectorUpdatePostMove(PLAYERp pp) void PlaySOsound(short sectnum, short sound_num) { - short i,nexti; + int i; // play idle sound - sound 1 SectIterator it(StatDamageList[sectnum]); @@ -2417,7 +2418,7 @@ void PlaySOsound(short sectnum, short sound_num) void StopSOsound(short sectnum) { - short i,nexti; + int i; // play idle sound - sound 1 SectIterator it(StatDamageList[sectnum]); @@ -2517,7 +2518,7 @@ DoPlayerMoveBoat(PLAYERp pp) void DoTankTreads(PLAYERp pp) { SPRITEp sp; - short i,nexti; + int i; int vel; SECTORp *sectp; int j; @@ -2642,7 +2643,7 @@ DriveCrush(PLAYERp pp, int *x, int *y) SECTOR_OBJECTp sop = pp->sop_control; SPRITEp sp; USERp u; - int i,nexti; + int i; short stat; SECTORp *sectp; @@ -4297,7 +4298,7 @@ GetOverlapSector(int x, int y, short *over, short *under) int GetOverlapSector2(int x, int y, short *over, short *under) { - int i, nexti, found = 0; + int i, found = 0; short sf[2]= {0,0}; // sectors found unsigned stat; @@ -4389,7 +4390,7 @@ void DoPlayerWarpToUnderwater(PLAYERp pp) { USERp u = User[pp->PlayerSprite]; - short i, nexti; + int i; SECT_USERp sectu = SectUser[pp->cursectnum]; SPRITEp under_sp = NULL, over_sp = NULL; bool Found = false; @@ -4466,7 +4467,7 @@ void DoPlayerWarpToSurface(PLAYERp pp) { USERp u = User[pp->PlayerSprite]; - short i, nexti; + int i; SECT_USERp sectu = SectUser[pp->cursectnum]; short over, under; @@ -5303,7 +5304,7 @@ void FindMainSector(SECTOR_OBJECTp sop) void DoPlayerOperateMatch(PLAYERp pp, bool starting) { SPRITEp sp; - short i,nexti; + int i; if (!pp->sop) return; @@ -6352,7 +6353,7 @@ SPRITEp DoPlayerDeathCheckKick(PLAYERp pp) { SPRITEp sp = pp->SpriteP, hp; USERp u = User[pp->PlayerSprite], hu; - short i,nexti; + int i; unsigned stat,dist; int a,b,c; @@ -6960,7 +6961,7 @@ MoveSkipSavePos(void) { SPRITEp sp; USERp u; - short i,nexti; + int i; short pnum; PLAYERp pp; diff --git a/source/sw/src/quake.cpp b/source/sw/src/quake.cpp index f8b7727b3..f524b2418 100644 --- a/source/sw/src/quake.cpp +++ b/source/sw/src/quake.cpp @@ -79,7 +79,7 @@ short CopyQuakeSpotToOn(SPRITEp sp) void DoQuakeMatch(short match) { - short i, nexti; + int i; SPRITEp sp; StatIterator it(STAT_QUAKE_SPOT); @@ -110,7 +110,7 @@ void DoQuakeMatch(short match) void ProcessQuakeOn(void) { - short i, nexti; + int i; SPRITEp sp; StatIterator it(STAT_QUAKE_ON); @@ -130,7 +130,7 @@ void ProcessQuakeOn(void) void ProcessQuakeSpot(void) { - short i, nexti; + int i; SPRITEp sp; int rand_test; @@ -178,7 +178,7 @@ void ProcessQuakeSpot(void) void QuakeViewChange(PLAYERp pp, int *z_diff, int *x_diff, int *y_diff, short *ang_diff) { - short i, nexti; + int i; SPRITEp sp; SPRITEp save_sp = NULL; int dist,save_dist = 999999; diff --git a/source/sw/src/rooms.cpp b/source/sw/src/rooms.cpp index 245c6baf6..9ead9b237 100644 --- a/source/sw/src/rooms.cpp +++ b/source/sw/src/rooms.cpp @@ -349,7 +349,7 @@ FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects, int GetZadjustment(short sectnum, short hitag) { - short i, nexti; + int i; SPRITEp sp; if (sectnum < 0 || !TEST(sector[sectnum].extra, SECTFX_Z_ADJUST)) @@ -651,7 +651,7 @@ PicInView(short tile_num, bool reset) void SetupMirrorTiles(void) { - int i, nexti; + int i; SPRITEp sp; StatIterator it(STAT_FAF); @@ -802,7 +802,7 @@ FindCeilingView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum { int xoff = 0; int yoff = 0; - short i, nexti; + int i; SPRITEp sp = NULL; int pix_diff; int newz; @@ -892,7 +892,7 @@ FindFloorView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum) { int xoff = 0; int yoff = 0; - short i, nexti; + int i; SPRITEp sp = NULL; int newz; int pix_diff; @@ -983,7 +983,7 @@ FindFloorView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum) short ViewSectorInScene(short cursectnum, short level) { - int i, nexti; + int i; SPRITEp sp; short match; diff --git a/source/sw/src/rotator.cpp b/source/sw/src/rotator.cpp index b5d377b5b..6dadb98b9 100644 --- a/source/sw/src/rotator.cpp +++ b/source/sw/src/rotator.cpp @@ -77,7 +77,7 @@ bool RotatorSwitch(short match, short setting) { SPRITEp sp; - short i,nexti; + int i; bool found = false; StatIterator it(STAT_DEFAULT); @@ -159,7 +159,7 @@ DoRotatorMatch(PLAYERp pp, short match, bool manual) short sectnum; short first_vator = -1; - short i,nexti; + int i; //RotatorSwitch(match, ON); @@ -238,7 +238,7 @@ TestRotatorMatchActive(short match) USERp fu; SPRITEp fsp; - short i,nexti; + int i; StatIterator it(STAT_ROTATOR); while ((i = it.NextIndex()) >= 0) @@ -315,7 +315,7 @@ int DoRotatorMove(short SpriteNum) ROTATORp r; short ndx,w,startwall,endwall; SPRITEp pivot = NULL; - int i, nexti; + int i; vec2_t nxy; int dist,closest; bool kill = false; diff --git a/source/sw/src/sector.cpp b/source/sw/src/sector.cpp index 0af503633..0dd951a97 100644 --- a/source/sw/src/sector.cpp +++ b/source/sw/src/sector.cpp @@ -834,7 +834,7 @@ SectorDistanceByMid(short sect1, int sect2) short DoSpawnActorTrigger(short match) { - int i, nexti; + int i; short spawn_count = 0; SPRITEp sp; @@ -866,8 +866,7 @@ OperateSector(short sectnum, short player_is_operating) if (!player_is_operating) { SPRITEp fsp; - short i,nexti; - + int i; if (SectUser[sectnum] && SectUser[sectnum]->stag == SECT_LOCK_DOOR) return false; @@ -1348,7 +1347,7 @@ DoSectorObjectKillMatch(short match) bool SearchExplodeSectorMatch(short match) { - short i,nexti; + int i; // THIS IS ONLY CALLED FROM DoMatchEverything StatIterator it(STAT_SPRITE_HIT_MATCH); @@ -1370,7 +1369,7 @@ SearchExplodeSectorMatch(short match) void KillMatchingCrackSprites(short match) { - short i,nexti; + int i; SPRITEp sp; StatIterator it(STAT_SPRITE_HIT_MATCH); @@ -1391,7 +1390,7 @@ KillMatchingCrackSprites(short match) void WeaponExplodeSectorInRange(short weapon) { - short i, nexti; + int i; SPRITEp wp = &sprite[weapon]; USERp wu = User[weapon]; SPRITEp sp; @@ -1472,7 +1471,7 @@ void DoDeleteSpriteMatch(short match) }; int del_x = 0,del_y = 0; - short i,nexti; + int i; unsigned stat; short found; @@ -1632,7 +1631,7 @@ void DoMatchEverything(PLAYERp pp, short match, short state) bool ComboSwitchTest(short combo_type, short match) { - short i,nexti; + int i; SPRITEp sp; int state; @@ -1983,7 +1982,7 @@ OperateSprite(short SpriteNum, short player_is_operating) int DoTrapReset(short match) { - short i, nexti; + int i; SPRITEp sp; USERp u; @@ -2013,7 +2012,7 @@ int DoTrapReset(short match) int DoTrapMatch(short match) { - short i, nexti; + int i; SPRITEp sp; USERp u; @@ -2145,7 +2144,7 @@ OperateTripTrigger(PLAYERp pp) case TAG_TRIGGER_ACTORS: { int dist; - short i, nexti; + int i; SPRITEp sp; USERp u; @@ -2221,7 +2220,7 @@ OperateContinuousTrigger(PLAYERp pp) #if 1 DoTrapMatch(sector[pp->cursectnum].hitag); #else - short i, nexti; + int i; SPRITEp sp; USERp u; @@ -3190,7 +3189,7 @@ void DoPanning(void) { int nx, ny; - short i,nexti; + int i; SPRITEp sp; SECTORp sectp; WALLp wallp; diff --git a/source/sw/src/slidor.cpp b/source/sw/src/slidor.cpp index c7a71f0b0..f16d48f48 100644 --- a/source/sw/src/slidor.cpp +++ b/source/sw/src/slidor.cpp @@ -72,7 +72,7 @@ bool SlidorSwitch(short match, short setting) { SPRITEp sp; - short i,nexti; + int i; bool found = false; StatIterator it(STAT_DEFAULT); @@ -155,7 +155,7 @@ DoSlidorMatch(PLAYERp pp, short match, bool manual) short sectnum; short first_vator = -1; - short i,nexti; + int i; //SlidorSwitch(match, ON); @@ -234,7 +234,7 @@ TestSlidorMatchActive(short match) USERp fu; SPRITEp fsp; - short i,nexti; + int i; StatIterator it(STAT_SLIDOR); while ((i = it.NextIndex()) >= 0) @@ -623,7 +623,7 @@ int DoSlidorMove(short SpriteNum) // if heading for the OFF (original) position and should NOT CRUSH if (TEST_BOOL3(sp) && r->tgt == 0) { - int i,nexti; + int i; SPRITEp bsp; USERp bu; bool found = false; diff --git a/source/sw/src/sounds.cpp b/source/sw/src/sounds.cpp index fa9602dbe..d3cd551d4 100644 --- a/source/sw/src/sounds.cpp +++ b/source/sw/src/sounds.cpp @@ -280,7 +280,7 @@ void InitAmbient(int num, SPRITEp sp) void StartAmbientSound(void) { - int i, nexti; + int i; if (!SoundEnabled()) return; diff --git a/source/sw/src/spike.cpp b/source/sw/src/spike.cpp index f1f5cbf42..2a4f57dfe 100644 --- a/source/sw/src/spike.cpp +++ b/source/sw/src/spike.cpp @@ -76,7 +76,7 @@ bool SpikeSwitch(short match, short setting) { SPRITEp sp; - short i,nexti; + int i; bool found = false; StatIterator it(STAT_DEFAULT); @@ -146,7 +146,7 @@ short DoSpikeOperate(short sectnum) { SPRITEp fsp; short match; - short i,nexti; + int i; SectIterator it(sectnum); while ((i = it.NextIndex()) >= 0) @@ -183,7 +183,7 @@ DoSpikeMatch(short match) SPRITEp fsp; short first_spike = -1; - short i,nexti; + int i; //SpikeSwitch(match, ON); @@ -219,7 +219,7 @@ TestSpikeMatchActive(short match) USERp fu; SPRITEp fsp; - short i,nexti; + int i; StatIterator it(STAT_SPIKE); while ((i = it.NextIndex()) >= 0) @@ -304,7 +304,7 @@ void SpikeAlign(short SpriteNum) void MoveSpritesWithSpike(short sectnum) { SPRITEp sp; - short i,nexti; + int i; int cz,fz; SectIterator it(sectnum); @@ -399,7 +399,7 @@ int DoSpike(short SpriteNum) // if heading for the OFF (original) position and should NOT CRUSH if (TEST_BOOL3(sp) && u->z_tgt == u->oz) { - int i,nexti; + int i; SPRITEp bsp; USERp bu; bool found = false; diff --git a/source/sw/src/sprite.cpp b/source/sw/src/sprite.cpp index 2ed163d33..7ef5b05ae 100644 --- a/source/sw/src/sprite.cpp +++ b/source/sw/src/sprite.cpp @@ -622,7 +622,7 @@ KillSprite(int16_t SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; USERp u = User[SpriteNum]; - short i,nexti; + int i; unsigned stat; short statnum,sectnum; //extern short Zombies; @@ -1759,7 +1759,7 @@ SpriteSetupPost(void) SPRITEp ds; USERp u; short SpriteNum, NextSprite; - short i, nexti; + int i; int cz,fz; // Post processing of some sprites after gone through the main SpriteSetup() @@ -2882,7 +2882,7 @@ SpriteSetup(void) case VIEW_THRU_CEILING: case VIEW_THRU_FLOOR: { - int i,nexti; + int i; // make sure there is only one set per level of these StatIterator it(STAT_FAF); while ((i = it.NextIndex()) >= 0) @@ -3819,7 +3819,7 @@ NUKE_REPLACEMENT: bool ItemSpotClear(SPRITEp sip, short statnum, short id) { bool found = false; - short i,nexti; + int i; if (TEST_BOOL2(sip)) { @@ -6693,7 +6693,7 @@ StateControl(int16_t SpriteNum) void SpriteControl(void) { - int32_t i, nexti, stat; + int32_t i, stat; SPRITEp sp; USERp u; short pnum, CloseToPlayer; @@ -6709,11 +6709,11 @@ SpriteControl(void) u = User[i]; sp = User[i]->SpriteP; STATE_CONTROL(i, sp, u, StateTics) - // ASSERT(nexti >= 0 ? User[nexti] != NULL : true); + // ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true); #else ASSERT(User[i]); StateControl(i); - // ASSERT(nexti >= 0 ? User[nexti] != NULL : true); + // ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true); #endif } @@ -6730,11 +6730,11 @@ SpriteControl(void) u = User[i]; sp = User[i]->SpriteP; STATE_CONTROL(i, sp, u, StateTics) - ASSERT(nexti >= 0 ? User[nexti] != NULL : true); + ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true); #else ASSERT(User[i]); StateControl(i); - ASSERT(nexti >= 0 ? User[nexti] != NULL : true); + ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true); #endif } } @@ -6780,12 +6780,12 @@ SpriteControl(void) u = User[i]; sp = User[i]->SpriteP; STATE_CONTROL(i, sp, u, StateTics) - ASSERT(nexti >= 0 ? User[nexti] != NULL : true); + ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true); #else StateControl(i); - ASSERT(nexti >= 0 ? User[nexti] != NULL : true); + ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true); #endif - ASSERT(nexti >= 0 ? User[nexti] != NULL : true); + ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true); } else { @@ -6808,22 +6808,22 @@ SpriteControl(void) u = User[i]; sp = User[i]->SpriteP; STATE_CONTROL(i, sp, u, StateTics) - ASSERT(nexti >= 0 ? User[nexti] != NULL : true); + ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true); #else ASSERT(User[i]); StateControl(i); - ASSERT(nexti >= 0 ? User[nexti] != NULL : true); + ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true); #endif } } } - StatIterator it(STAT_NO_STATE); + it.Reset(STAT_NO_STATE); while ((i = it.NextIndex()) >= 0) { if (User[i] && User[i]->ActorActionFunc) (*User[i]->ActorActionFunc)(i); - ASSERT(nexti >= 0 ? sprite[nexti].statnum != MAXSTATUS : true); + ASSERT(it.PeekIndex() >= 0 ? sprite[it.PeekIndex()].statnum != MAXSTATUS : true); } if (MoveSkip8 == 0) @@ -6842,17 +6842,11 @@ SpriteControl(void) it.Reset(STAT_WALLBLOOD_QUEUE); while ((i = it.NextIndex()) >= 0) { -#if INLINE_STATE ASSERT(User[i]); u = User[i]; sp = User[i]->SpriteP; STATE_CONTROL(i, sp, u, StateTics) - ASSERT(nexti >= 0 ? User[nexti] != NULL : true); -#else - ASSERT(User[i]); - StateControl(i); - ASSERT(nexti >= 0 ? User[nexti] != NULL : true); -#endif + ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true); } } @@ -6896,7 +6890,7 @@ SpriteControl(void) if (!TEST(u->Flags, SPR_ACTIVE)) continue; - if (i == 69 && nexti == -1) + if (i == 69 && it.PeekIndex() == -1) continue; (*User[i]->ActorActionFunc)(i); diff --git a/source/sw/src/sumo.cpp b/source/sw/src/sumo.cpp index 5063ee1e2..bdcc4e9d3 100644 --- a/source/sw/src/sumo.cpp +++ b/source/sw/src/sumo.cpp @@ -814,7 +814,8 @@ BossHealthMeter(void) SPRITEp sp; USERp u; PLAYERp pp = Player + myconnectindex; - short color=0,i=0,nexti,metertics,meterunit; + short color=0,metertics,meterunit; + int i = 0; int y; extern bool NoMeters; short health; diff --git a/source/sw/src/track.cpp b/source/sw/src/track.cpp index 664d0bb37..039185ffb 100644 --- a/source/sw/src/track.cpp +++ b/source/sw/src/track.cpp @@ -637,13 +637,13 @@ TrackSetup(void) // didn't find the start point of the track if (t->NumPoints == 0) { - int i, nexti; + int i; auto const sp = (uspritetype const *)&sprite[headspritestat[STAT_TRACK+ndx]]; Printf("WARNING: Did not find first point of Track Number %d, x %d, y %d\n", ndx, sp->x, sp->y); - for (i=headspritestat[STAT_TRACK+ndx]; i>=0; i=nexti) + StatIterator it(STAT_TRACK + ndx); + while ((i = it.NextIndex()) >= 0) { // neuter the track's sprite list - nexti = nextspritestat[i]; deletesprite(i); } continue; @@ -1544,7 +1544,7 @@ PlaceSectorObjectsOnTracks(void) void PlaceActorsOnTracks(void) { - short i, nexti, j, tag; + short i, j, tag; SPRITEp sp; USERp u; TRACK_POINTp tpoint = NULL; @@ -2238,7 +2238,7 @@ void CallbackSOsink(ANIMp ap, void *data) short startwall, endwall, j; short dest_sector = -1; short src_sector = -1; - short i, nexti, ndx; + short i, ndx; char found = false; int tgt_depth; diff --git a/source/sw/src/vator.cpp b/source/sw/src/vator.cpp index 183afb1b0..946205239 100644 --- a/source/sw/src/vator.cpp +++ b/source/sw/src/vator.cpp @@ -81,7 +81,7 @@ bool VatorSwitch(short match, short setting) { SPRITEp sp; - short i,nexti; + int i; bool found = false; StatIterator it(STAT_DEFAULT); @@ -151,7 +151,7 @@ short DoVatorOperate(PLAYERp pp, short sectnum) { SPRITEp fsp; short match; - short i,nexti; + int i; SectIterator it(sectnum); while ((i = it.NextIndex()) >= 0) @@ -222,7 +222,7 @@ DoVatorMatch(PLAYERp pp, short match) short sectnum; short first_vator = -1; - short i,nexti; + int i; //VatorSwitch(match, ON); @@ -296,7 +296,7 @@ TestVatorMatchActive(short match) USERp fu; SPRITEp fsp; - short i,nexti; + int i; StatIterator it(STAT_VATOR); while ((i = it.NextIndex()) >= 0) @@ -322,7 +322,7 @@ TestVatorMatchActive(short match) void InterpSectorSprites(short sectnum, bool state) { SPRITEp sp; - short i,nexti; + int i; SectIterator it(sectnum); while ((i = it.NextIndex()) >= 0) @@ -348,7 +348,7 @@ void InterpSectorSprites(short sectnum, bool state) void MoveSpritesWithSector(short sectnum, int z_amt, bool type) { SPRITEp sp; - short i,nexti; + int i; bool both = false; if (SectUser[sectnum]) @@ -541,7 +541,7 @@ int DoVator(short SpriteNum) // if heading for the OFF (original) position and should NOT CRUSH if (TEST_BOOL3(sp) && u->z_tgt == u->oz) { - int i,nexti; + int i; SPRITEp bsp; USERp bu; bool found = false; @@ -595,7 +595,7 @@ int DoVator(short SpriteNum) } else { - int i,nexti; + int i; SPRITEp bsp; SectIterator it(sp->sectnum); diff --git a/source/sw/src/vis.cpp b/source/sw/src/vis.cpp index 3334e1c9c..7055a9e61 100644 --- a/source/sw/src/vis.cpp +++ b/source/sw/src/vis.cpp @@ -45,7 +45,7 @@ extern short NormalVisibility; // player.c void ProcessVisOn(void) { - short i, nexti; + int i; SPRITEp sp; StatIterator it(STAT_VIS_ON); @@ -86,7 +86,7 @@ void ProcessVisOn(void) void VisViewChange(PLAYERp pp, int *vis) { - short i, nexti; + int i; SPRITEp sp; short BrightestVis = NormalVisibility; int x,y,z; @@ -131,7 +131,7 @@ int SpawnVis(short Parent, short sectnum, int x, int y, int z, int amt) { short SpriteNum; SPRITEp sp; - short i,nexti; + int i; if (Parent >= 0) { diff --git a/source/sw/src/wallmove.cpp b/source/sw/src/wallmove.cpp index 2a6ac387c..3ec489eaf 100644 --- a/source/sw/src/wallmove.cpp +++ b/source/sw/src/wallmove.cpp @@ -164,7 +164,7 @@ int DoWallMove(SPRITEp sp) bool CanSeeWallMove(SPRITEp wp, short match) { - short i,nexti; + int i; bool found = false; SPRITEp sp; @@ -193,7 +193,7 @@ bool CanSeeWallMove(SPRITEp wp, short match) int DoWallMoveMatch(short match) { SPRITEp sp; - short i,nexti; + int i; bool found = false; // just all with the same matching tags diff --git a/source/sw/src/warp.cpp b/source/sw/src/warp.cpp index 1b8fe5fe8..232e9dac9 100644 --- a/source/sw/src/warp.cpp +++ b/source/sw/src/warp.cpp @@ -43,7 +43,7 @@ extern bool Prediction; bool WarpPlaneSectorInfo(short sectnum, SPRITEp *sp_ceiling, SPRITEp *sp_floor) { - int i,nexti; + int i; SPRITEp sp; *sp_floor = NULL; @@ -116,7 +116,7 @@ WarpToArea(SPRITEp sp_from, int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum int xoff; int yoff; int zoff; - short i, nexti; + int i; SPRITEp sp = sp_from; short match; short to_tag = 0; @@ -215,7 +215,7 @@ WarpToArea(SPRITEp sp_from, int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum bool WarpSectorInfo(short sectnum, SPRITEp *sp_warp) { - int i,nexti; + int i; SPRITEp sp; *sp_warp = NULL; diff --git a/source/sw/src/weapon.cpp b/source/sw/src/weapon.cpp index 86cc8dada..7dd6b3f37 100644 --- a/source/sw/src/weapon.cpp +++ b/source/sw/src/weapon.cpp @@ -2760,7 +2760,7 @@ int DoLavaErupt(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; USERp u = User[SpriteNum]; - short i,nexti,pnum; + short i,pnum; PLAYERp pp; SPRITEp tsp; bool found = false; @@ -7523,7 +7523,7 @@ DoDamageTest(short Weapon) USERp u; SPRITEp sp; - short i, nexti; + int i; unsigned stat; int dist, tx, ty; int tmin; @@ -7595,7 +7595,7 @@ DoFlamesDamageTest(short Weapon) USERp u; SPRITEp sp; - short i, nexti; + int i; unsigned stat; int dist, tx, ty; int tmin; @@ -7769,7 +7769,7 @@ int DoExpDamageTest(short Weapon) USERp u; SPRITEp sp; - short i, nexti, stat; + short i, stat; int dist, tx, ty; int tmin; int max_stat; @@ -7922,7 +7922,7 @@ int DoMineExpMine(short Weapon) USERp u; SPRITEp sp; - short i, nexti; + int i; int dist, tx, ty; int tmin; int zdist; @@ -9341,7 +9341,7 @@ DoMineRangeTest(short Weapon, short range) USERp u; SPRITEp sp; - short i, nexti; + int i; unsigned stat; int dist, tx, ty; int tmin; @@ -12278,7 +12278,7 @@ DoBloodWorm(int16_t Weapon) { SPRITEp tsp; USERp tu; - int i,nexti; + int i; InitBloodSpray(Weapon, false, 1); InitBloodSpray(Weapon, false, 1); @@ -12393,7 +12393,7 @@ DoBloodWorm(int16_t Weapon) { SPRITEp tsp; USERp tu; - int i,nexti; + int i; InitBloodSpray(Weapon, false, 1); InitBloodSpray(Weapon, false, 1); @@ -13683,7 +13683,7 @@ InitSwordAttack(PLAYERp pp) { USERp u = User[pp->PlayerSprite],tu; SPRITEp sp = NULL; - short i, nexti; + int i; unsigned stat; int dist; short reach,face; @@ -13862,7 +13862,7 @@ InitFistAttack(PLAYERp pp) { USERp u = User[pp->PlayerSprite],tu; SPRITEp sp = NULL; - short i, nexti; + int i; unsigned stat; int dist; short reach,face; @@ -14213,7 +14213,7 @@ InitSumoStompAttack(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = &sprite[SpriteNum],tsp; - short i, nexti; + int i; unsigned stat; int dist; short reach; @@ -15987,7 +15987,7 @@ InitRipperSlash(short SpriteNum) USERp u = User[SpriteNum], hu; SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp hp; - short i, nexti; + int i; unsigned stat; int dist, a, b, c; @@ -16025,7 +16025,7 @@ InitBunnySlash(short SpriteNum) { SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp hp; - short i, nexti; + int i; unsigned stat; int dist, a, b, c; @@ -16059,7 +16059,7 @@ InitSerpSlash(short SpriteNum) { SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp hp; - short i, nexti; + int i; unsigned stat; int dist, a, b, c; @@ -16129,7 +16129,7 @@ DoBladeDamage(short SpriteNum) { SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp hp; - short i, nexti; + int i; unsigned stat; int dist, a, b, c; @@ -16173,7 +16173,7 @@ DoStaticFlamesDamage(short SpriteNum) USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp hp; - short i, nexti; + int i; unsigned stat; int dist, a, b, c; @@ -16218,7 +16218,7 @@ InitCoolgBash(short SpriteNum) { SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp hp; - short i, nexti; + int i; unsigned stat; int dist, a, b, c; @@ -16256,7 +16256,7 @@ InitSkelSlash(short SpriteNum) { SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp hp; - short i, nexti; + int i; unsigned stat; int dist, a, b, c; @@ -16290,7 +16290,7 @@ InitGoroChop(short SpriteNum) { SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp hp; - short i, nexti; + int i; unsigned stat; int dist, a, b, c; @@ -17195,7 +17195,7 @@ InitEelFire(short SpriteNum) USERp u = User[SpriteNum], hu; SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp hp; - short i, nexti; + int i; unsigned stat; int dist, a, b, c; @@ -19770,7 +19770,7 @@ InitEnemyFireball(short SpriteNum) bool WarpToUnderwater(short *sectnum, int *x, int *y, int *z) { - short i, nexti; + int i; SECT_USERp sectu = SectUser[*sectnum]; SPRITEp under_sp = NULL, over_sp = NULL; bool Found = false; @@ -19800,7 +19800,7 @@ WarpToUnderwater(short *sectnum, int *x, int *y, int *z) Found = false; // search for UNDERWATER "under" sprite for reference point - StatIterator it(STAT_UNDERWATER); + it.Reset(STAT_UNDERWATER); while ((i = it.NextIndex()) >= 0) { under_sp = &sprite[i]; @@ -19844,7 +19844,7 @@ WarpToUnderwater(short *sectnum, int *x, int *y, int *z) bool WarpToSurface(short *sectnum, int *x, int *y, int *z) { - short i, nexti; + int i; SECT_USERp sectu = SectUser[*sectnum]; short over, under; int sx, sy; @@ -19875,7 +19875,7 @@ WarpToSurface(short *sectnum, int *x, int *y, int *z) Found = false; // search for DIVE_AREA "over" sprite for reference point - StatIterator it(STAT_DIVE_AREA); + it.Reset(STAT_DIVE_AREA); while ((i = it.NextIndex()) >= 0) { over_sp = &sprite[i]; @@ -19919,7 +19919,7 @@ bool SpriteWarpToUnderwater(SPRITEp sp) { USERp u = User[sp - sprite]; - short i, nexti; + int i; SECT_USERp sectu = SectUser[sp->sectnum]; SPRITEp under_sp = NULL, over_sp = NULL; bool Found = false; @@ -19949,7 +19949,7 @@ SpriteWarpToUnderwater(SPRITEp sp) Found = false; // search for UNDERWATER "under" sprite for reference point - StatIterator it(STAT_UNDERWATER); + it.Reset(STAT_UNDERWATER); while ((i = it.NextIndex()) >= 0) { under_sp = &sprite[i]; @@ -19999,7 +19999,7 @@ bool SpriteWarpToSurface(SPRITEp sp) { USERp u = User[sp - sprite]; - short i, nexti; + int i; SECT_USERp sectu = SectUser[sp->sectnum]; short over, under; int sx, sy; @@ -20034,7 +20034,7 @@ SpriteWarpToSurface(SPRITEp sp) Found = false; // search for DIVE_AREA "over" sprite for reference point - StatIterator it(STAT_DIVE_AREA); + it.Reset(STAT_DIVE_AREA); while ((i = it.NextIndex()) >= 0) { over_sp = &sprite[i];