diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 745d63e35..15597de36 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -569,18 +569,17 @@ void moveplayers(void) // //--------------------------------------------------------------------------- -void tickstat(int stat) +void tickstat(int stat, bool deleteinvalid) { DukeStatIterator iti(stat); while (auto act = iti.Next()) { - if (actorflag(act, SFLAG2_DIENOW)) + if (actorflag(act, SFLAG2_DIENOW) || act->sector() == nullptr || (deleteinvalid && act->spr.scale.X == 0)) { act->Destroy(); continue; } - if (act->GetClass() != RUNTIME_CLASS(DDukeActor)) - CallTick(act); + CallTick(act); } } diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 415ee5f66..7cf34f6dd 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -689,52 +689,6 @@ void movefallers_d(void) } -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -void movestandables_d(void) -{ - DukeStatIterator it(STAT_STANDABLE); - while (auto act = it.Next()) - { - int picnum = act->spr.picnum; - - if (!act->insector() || actorflag(act, SFLAG2_DIENOW)) - { - act->Destroy(); - } - else - { - CallTick(act); - } - } -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -void moveweapons_d(void) -{ - DukeStatIterator it(STAT_PROJECTILE); - while (auto act = it.Next()) - { - if (!act->insector() || actorflag(act, SFLAG2_DIENOW)) - { - act->Destroy(); - } - else - { - CallTick(act); - } - } -} - //--------------------------------------------------------------------------- // // @@ -1781,7 +1735,7 @@ void think_d(void) thinktime.Clock(); movefta(); //ST 2 - moveweapons_d(); //ST 4 + tickstat(STAT_PROJECTILE); //ST 4 moveplayers(); //ST 10 movefallers_d(); //ST 12 moveexplosions_d(); //ST 5 @@ -1792,7 +1746,7 @@ void think_d(void) actortime.Unclock(); moveeffectors_d(); //ST 3 - movestandables_d(); //ST 6 + tickstat(STAT_STANDABLE); //ST 6 doanimations(); tickstat(STAT_FX); //ST 11 diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index b027c40f6..76e6aa92c 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -549,52 +549,6 @@ void movefallers_r(void) } } -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -void movestandables_r(void) -{ - DukeStatIterator it(STAT_STANDABLE); - while (auto act = it.Next()) - { - int picnum = act->spr.picnum; - - if (!act->insector() || actorflag(act, SFLAG2_DIENOW)) - { - act->Destroy(); - } - else - { - CallTick(act); - } - } -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -void moveweapons_r(void) -{ - DukeStatIterator it(STAT_PROJECTILE); - while (auto act = it.Next()) - { - if (!act->insector() || actorflag(act, SFLAG2_DIENOW)) - { - act->Destroy(); - } - else - { - CallTick(act); - } - } -} - //--------------------------------------------------------------------------- // // @@ -1051,11 +1005,7 @@ static void rrra_specialstats() enemysizecheat = 0; } - it.Reset(STAT_RABBITSPAWN); - while (auto act = it.Next()) - { - CallTick(act); - } + tickstat(STAT_RABBITSPAWN); } //--------------------------------------------------------------------------- @@ -1163,29 +1113,6 @@ void moveactors_r(void) // //--------------------------------------------------------------------------- -void moveexplosions_r(void) // STATNUM 5 -{ - - DukeStatIterator it(STAT_MISC); - while (auto act = it.Next()) - { - if (act->spr.scale.X == 0 || act->spr.sectp == nullptr || actorflag(act, SFLAG2_DIENOW)) - { - act->Destroy(); - } - else - { - CallTick(act); - } - } -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - void handle_se06_r(DDukeActor *actor) { auto sc = actor->sector(); @@ -2038,10 +1965,10 @@ void think_r(void) thinktime.Clock(); movefta(); //ST 2 - moveweapons_r(); //ST 4 + tickstat(STAT_PROJECTILE); moveplayers(); //ST 10 movefallers_r(); //ST 12 - moveexplosions_r(); //ST 5 + tickstat(STAT_MISC, true); actortime.Reset(); actortime.Clock(); @@ -2049,7 +1976,7 @@ void think_r(void) actortime.Unclock(); moveeffectors_r(); //ST 3 - movestandables_r(); //ST 6 + tickstat(STAT_STANDABLE); doanimations(); tickstat(STAT_FX); //ST 11 diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index 591c3d546..22a9c239c 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -29,7 +29,7 @@ void movedummyplayers(void); void resetlanepics(void); void moveplayers(); void doanimations(); -void tickstat(int stat); +void tickstat(int stat, bool deleteinvalid = false); void operaterespawns(int low); void moveclouds(double interpfrac); void movefta();