- use tickstat for all thinker loops that have no more special cases.

This commit is contained in:
Christoph Oelckers 2022-12-03 17:24:41 +01:00
parent 6de147b77f
commit 3ee28eb600
4 changed files with 10 additions and 130 deletions

View file

@ -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);
}
}

View file

@ -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

View file

@ -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

View file

@ -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();