diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index b4915bca0..5b55b3877 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -526,11 +526,19 @@ void moveplayers(void) // //--------------------------------------------------------------------------- -void movefx(void) +void tickstat(int stat) { - DukeStatIterator iti(STAT_FX); + DukeStatIterator iti(stat); while (auto act = iti.Next()) - CallTick(act); + { + if (actorflag(act, SFLAG2_DIENOW)) + { + act->Destroy(); + continue; + } + if (act->GetClass() != RUNTIME_CLASS(DDukeActor)) + CallTick(act); + } } //--------------------------------------------------------------------------- diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 5e89dbe5e..cbb8f6b85 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -3283,7 +3283,7 @@ void think_d(void) moveeffectors_d(); //ST 3 movestandables_d(); //ST 6 doanimations(); - movefx(); //ST 11 + tickstat(STAT_FX); //ST 11 thinktime.Unclock(); } diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 6291c98e3..a808c7fc4 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -1881,10 +1881,22 @@ static void rrra_specialstats() //--------------------------------------------------------------------------- // -// +// this one's a hack. Can only be replaced with something better when +// the switch code has been redone. // //--------------------------------------------------------------------------- +void resetswitch(int tag) +{ + DukeStatIterator it2(STAT_DEFAULT); + while (auto act2 = it2.Next()) + { + if (act2->spr.picnum == DIPSWITCH3 + 1) + if (act2->spr.hitag == tag) + act2->spr.picnum = DIPSWITCH3; + } +} + void rr_specialstats() { DukeStatIterator it(STAT_LUMBERMILL); @@ -1906,13 +1918,7 @@ void rr_specialstats() act->spr.pos.Z = act->sector()->floorz - 59.25; act->spr.extra = 0; act->spr.picnum = LUMBERBLADE1; - DukeStatIterator it2(STAT_DEFAULT); - while (auto act2 = it2.Next()) - { - if (act2->spr.picnum == DIPSWITCH3 + 1) - if (act2->spr.hitag == 999) - act2->spr.picnum = DIPSWITCH3; - } + resetswitch(999); } } } @@ -3581,7 +3587,7 @@ void think_r(void) moveeffectors_r(); //ST 3 movestandables_r(); //ST 6 doanimations(); - movefx(); //ST 11 + tickstat(STAT_FX); //ST 11 if (numplayers < 2 && thunderon) thunder(); diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index c459839c6..3654afad5 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -26,7 +26,7 @@ void movedummyplayers(void); void resetlanepics(void); void moveplayers(); void doanimations(); -void movefx(); +void tickstat(int stat); void operaterespawns(int low); void moveclouds(double interpfrac); void movefta();