- P_Ticker handled

It may be a bit tricky to separate per-session and per-level actions here - for now only the sound resuming has been moved because that cannot be done per level.
This commit is contained in:
Christoph Oelckers 2019-01-07 17:33:17 +01:00
parent 15f933f20a
commit aac7657fb1
2 changed files with 41 additions and 38 deletions

View file

@ -71,36 +71,17 @@ bool P_CheckTickerPaused ()
//
// P_Ticker
//
// (split up to prepare for running multiple levels.)
//
void P_Ticker (void)
{
int i;
interpolator.UpdateInterpolations ();
r_NoInterpolate = true;
if (!demoplayback)
{
// This is a separate slot from the wipe in D_Display(), because this
// is delayed slightly due to latency. (Even on a singleplayer game!)
// GSnd->SetSfxPaused(!!playerswiping, 2);
}
// run the tic
if (paused || P_CheckTickerPaused())
return;
DPSprite::NewTick();
// [RH] Frozen mode is only changed every 4 tics, to make it work with A_Tracer().
if ((level.time & 3) == 0)
{
if (bglobal.changefreeze)
{
bglobal.freeze ^= 1;
bglobal.changefreeze = 0;
}
}
level.Tick();
// [BC] Do a quick check to see if anyone has the freeze time power. If they do,
// then don't resume the sound, since one of the effects of that power is to shut
// off the music.
@ -109,10 +90,33 @@ void P_Ticker (void)
if (playeringame[i] && players[i].timefreezer != 0)
break;
}
if ( i == MAXPLAYERS )
S_ResumeSound (false);
}
void FLevelLocals::Tick()
{
// run the tic
interpolator.UpdateInterpolations ();
r_NoInterpolate = true;
DPSprite::NewTick();
// [RH] Frozen mode is only changed every 4 tics, to make it work with A_Tracer().
if ((maptime & 3) == 0)
{
if (bglobal.changefreeze)
{
bglobal.freeze ^= 1;
bglobal.changefreeze = 0;
}
}
P_ResetSightCounters (false);
R_ClearInterpolationPath();
@ -130,27 +134,31 @@ void P_Ticker (void)
P_ThinkParticles(); // [RH] make the particles think
for (i = 0; i<MAXPLAYERS; i++)
for (int i = 0; i<MAXPLAYERS; i++)
if (playeringame[i] &&
/*Added by MC: Freeze mode.*/!(bglobal.freeze && players[i].Bot != NULL))
P_PlayerThink (&players[i]);
// [ZZ] call the WorldTick hook
E_WorldTick();
StatusBar->SetLevel(&level);
StatusBar->SetLevel(this);
StatusBar->CallTick (); // [RH] moved this here
level.Tick (); // [RH] let the level tick
// Reset carry sectors
if (Scrolls.Size() > 0)
{
memset (&Scrolls[0], 0, sizeof(Scrolls[0])*Scrolls.Size());
}
DThinker::RunThinkers ();
//if added by MC: Freeze mode.
if (!bglobal.freeze && !(level.flags2 & LEVEL2_FROZEN))
if (!bglobal.freeze && !(flags2 & LEVEL2_FROZEN))
{
P_UpdateSpecials (&level);
P_RunEffects (); // [RH] Run particle effects
}
// for par times
level.time++;
level.maptime++;
level.totaltime++;
time++;
maptime++;
totaltime++;
}

View file

@ -225,13 +225,8 @@ extend class Actor
// killough 1/18/98: this is why some missiles do not have smoke
// and some do. Also, internal demos start at random gametics, thus
// the bug in which revenants cause internal demos to go out of sync.
//
// killough 3/6/98: fix revenant internal demo bug by subtracting
// levelstarttic from gametic:
//
// [RH] Level.time is always 0-based, so nothing special to do here.
if (Level.time & 3) return;
if (Level.maptime & 3) return;
// spawn a puff of smoke behind the rocket
SpawnPuff ("BulletPuff", pos, angle, angle, 3);