- 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,35 +71,16 @@ bool P_CheckTickerPaused ()
// //
// P_Ticker // P_Ticker
// //
// (split up to prepare for running multiple levels.)
//
void P_Ticker (void) void P_Ticker (void)
{ {
int i; 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()) if (paused || P_CheckTickerPaused())
return; return;
DPSprite::NewTick(); level.Tick();
// [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;
}
}
// [BC] Do a quick check to see if anyone has the freeze time power. If they do, // [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 // then don't resume the sound, since one of the effects of that power is to shut
@ -113,6 +94,29 @@ void P_Ticker (void)
if ( i == MAXPLAYERS ) if ( i == MAXPLAYERS )
S_ResumeSound (false); 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); P_ResetSightCounters (false);
R_ClearInterpolationPath(); R_ClearInterpolationPath();
@ -130,27 +134,31 @@ void P_Ticker (void)
P_ThinkParticles(); // [RH] make the particles think P_ThinkParticles(); // [RH] make the particles think
for (i = 0; i<MAXPLAYERS; i++) for (int i = 0; i<MAXPLAYERS; i++)
if (playeringame[i] && if (playeringame[i] &&
/*Added by MC: Freeze mode.*/!(bglobal.freeze && players[i].Bot != NULL)) /*Added by MC: Freeze mode.*/!(bglobal.freeze && players[i].Bot != NULL))
P_PlayerThink (&players[i]); P_PlayerThink (&players[i]);
// [ZZ] call the WorldTick hook // [ZZ] call the WorldTick hook
E_WorldTick(); E_WorldTick();
StatusBar->SetLevel(&level); StatusBar->SetLevel(this);
StatusBar->CallTick (); // [RH] moved this here 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 (); DThinker::RunThinkers ();
//if added by MC: Freeze mode. //if added by MC: Freeze mode.
if (!bglobal.freeze && !(level.flags2 & LEVEL2_FROZEN)) if (!bglobal.freeze && !(flags2 & LEVEL2_FROZEN))
{ {
P_UpdateSpecials (&level); P_UpdateSpecials (&level);
P_RunEffects (); // [RH] Run particle effects P_RunEffects (); // [RH] Run particle effects
} }
// for par times // for par times
level.time++; time++;
level.maptime++; maptime++;
level.totaltime++; totaltime++;
} }

View file

@ -225,13 +225,8 @@ extend class Actor
// killough 1/18/98: this is why some missiles do not have smoke // killough 1/18/98: this is why some missiles do not have smoke
// and some do. Also, internal demos start at random gametics, thus // and some do. Also, internal demos start at random gametics, thus
// the bug in which revenants cause internal demos to go out of sync. // 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 // spawn a puff of smoke behind the rocket
SpawnPuff ("BulletPuff", pos, angle, angle, 3); SpawnPuff ("BulletPuff", pos, angle, angle, 3);