Skip to content

Commit

Permalink
- minor cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers authored and mjr4077au committed Nov 26, 2022
1 parent becafec commit eaca494
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 14 deletions.
14 changes: 11 additions & 3 deletions source/games/duke/src/actors.cpp
Expand Up @@ -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);
}
}

//---------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/actors_d.cpp
Expand Up @@ -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();
}
Expand Down
24 changes: 15 additions & 9 deletions source/games/duke/src/actors_r.cpp
Expand Up @@ -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);
Expand All @@ -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);
}
}
}
Expand Down Expand Up @@ -3579,7 +3585,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();
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/funct.h
Expand Up @@ -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();
Expand Down

0 comments on commit eaca494

Please sign in to comment.