2016-03-01 15:47:10 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
2017-04-17 11:33:19 +00:00
|
|
|
// Copyright 1993-1996 id Software
|
|
|
|
// Copyright 1999-2016 Randy Heit
|
|
|
|
// Copyright 2002-2016 Christoph Oelckers
|
2016-03-01 15:47:10 +00:00
|
|
|
//
|
2017-04-17 11:33:19 +00:00
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
2016-03-01 15:47:10 +00:00
|
|
|
//
|
2017-04-17 11:33:19 +00:00
|
|
|
// This program is distributed in the hope that it will be useful,
|
2016-03-01 15:47:10 +00:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2017-04-17 11:33:19 +00:00
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program. If not, see http://www.gnu.org/licenses/
|
2016-03-01 15:47:10 +00:00
|
|
|
//
|
2017-04-17 11:33:19 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
2016-03-01 15:47:10 +00:00
|
|
|
//
|
|
|
|
// DESCRIPTION:
|
|
|
|
// Ticker.
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "p_effect.h"
|
|
|
|
#include "c_console.h"
|
|
|
|
#include "b_bot.h"
|
|
|
|
#include "doomstat.h"
|
|
|
|
#include "sbar.h"
|
|
|
|
#include "r_data/r_interpolate.h"
|
|
|
|
#include "d_player.h"
|
|
|
|
#include "r_utility.h"
|
|
|
|
#include "p_spec.h"
|
2017-01-08 17:45:30 +00:00
|
|
|
#include "g_levellocals.h"
|
2017-01-31 01:24:38 +00:00
|
|
|
#include "events.h"
|
2017-08-12 11:41:23 +00:00
|
|
|
#include "actorinlines.h"
|
2019-01-30 23:28:43 +00:00
|
|
|
#include "g_game.h"
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
extern gamestate_t wipegamestate;
|
2019-01-30 00:38:18 +00:00
|
|
|
extern uint8_t globalfreeze, globalchangefreeze;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// P_CheckTickerPaused
|
|
|
|
//
|
2016-08-28 07:55:04 +00:00
|
|
|
// Returns true if the ticker should be paused. In that case, it also
|
2016-03-01 15:47:10 +00:00
|
|
|
// pauses sound effects and possibly music. If the ticker should not be
|
|
|
|
// paused, then it returns false but does not unpause anything.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
bool P_CheckTickerPaused ()
|
|
|
|
{
|
|
|
|
// pause if in menu or console and at least one tic has been run
|
|
|
|
if ( !netgame
|
|
|
|
&& gamestate != GS_TITLELEVEL
|
|
|
|
&& ((menuactive != MENU_Off && menuactive != MENU_OnNoPause) ||
|
|
|
|
ConsoleState == c_down || ConsoleState == c_falling)
|
|
|
|
&& !demoplayback
|
|
|
|
&& !demorecording
|
2016-03-23 09:42:41 +00:00
|
|
|
&& players[consoleplayer].viewz != NO_VALUE
|
2016-03-01 15:47:10 +00:00
|
|
|
&& wipegamestate == gamestate)
|
|
|
|
{
|
2019-01-28 21:33:50 +00:00
|
|
|
// Only the current UI level's settings are relevant for sound.
|
2019-02-01 23:24:43 +00:00
|
|
|
S_PauseSound (!(primaryLevel->flags2 & LEVEL2_PAUSE_MUSIC_IN_MENUS), false);
|
2016-03-01 15:47:10 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// P_Ticker
|
|
|
|
//
|
|
|
|
void P_Ticker (void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2019-01-28 17:26:14 +00:00
|
|
|
for (auto Level : AllLevels())
|
|
|
|
{
|
|
|
|
Level->interpolator.UpdateInterpolations();
|
|
|
|
}
|
2016-03-01 15:47:10 +00:00
|
|
|
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;
|
|
|
|
|
2016-05-09 18:03:47 +00:00
|
|
|
DPSprite::NewTick();
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
// [RH] Frozen mode is only changed every 4 tics, to make it work with A_Tracer().
|
2019-01-28 21:33:50 +00:00
|
|
|
// This may not be perfect but it is not really relevant for sublevels that tracer homing behavior is preserved.
|
2019-02-01 23:24:43 +00:00
|
|
|
if ((primaryLevel->maptime & 3) == 0)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2019-01-30 00:38:18 +00:00
|
|
|
if (globalchangefreeze)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2019-01-30 00:38:18 +00:00
|
|
|
globalfreeze ^= 1;
|
|
|
|
globalchangefreeze = 0;
|
2019-01-28 21:33:50 +00:00
|
|
|
for (auto Level : AllLevels())
|
|
|
|
{
|
2019-01-30 00:38:18 +00:00
|
|
|
Level->frozenstate = (Level->frozenstate & ~2) | (2 * globalfreeze);
|
2019-01-28 21:33:50 +00:00
|
|
|
}
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// [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.
|
|
|
|
for (i = 0; i < MAXPLAYERS; i++ )
|
|
|
|
{
|
|
|
|
if (playeringame[i] && players[i].timefreezer != 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( i == MAXPLAYERS )
|
|
|
|
S_ResumeSound (false);
|
|
|
|
|
|
|
|
P_ResetSightCounters (false);
|
|
|
|
R_ClearInterpolationPath();
|
|
|
|
|
2019-01-28 21:33:50 +00:00
|
|
|
// Reset all actor interpolations on all levels before the current thinking turn so that indirect actor movement gets properly interpolated.
|
|
|
|
for (auto Level : AllLevels())
|
2017-08-12 09:48:36 +00:00
|
|
|
{
|
2019-01-28 21:33:50 +00:00
|
|
|
auto it = Level->GetThinkerIterator<AActor>();
|
|
|
|
AActor *ac;
|
|
|
|
|
|
|
|
while ((ac = it.Next()))
|
|
|
|
{
|
|
|
|
ac->ClearInterpolation();
|
|
|
|
}
|
2019-01-29 00:09:02 +00:00
|
|
|
P_ThinkParticles(Level); // [RH] make the particles think
|
2017-08-12 09:48:36 +00:00
|
|
|
}
|
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
// Since things will be moving, it's okay to interpolate them in the renderer.
|
|
|
|
r_NoInterpolate = false;
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i<MAXPLAYERS; i++)
|
2019-01-28 19:15:48 +00:00
|
|
|
if (playeringame[i])
|
2016-03-01 15:47:10 +00:00
|
|
|
P_PlayerThink (&players[i]);
|
|
|
|
|
2017-01-31 01:24:38 +00:00
|
|
|
// [ZZ] call the WorldTick hook
|
|
|
|
E_WorldTick();
|
2017-03-21 19:09:09 +00:00
|
|
|
StatusBar->CallTick (); // [RH] moved this here
|
2019-02-01 23:24:43 +00:00
|
|
|
for (auto Level : AllLevels())
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2019-02-01 23:24:43 +00:00
|
|
|
// todo: set up a sandbox for secondary levels here.
|
|
|
|
Level->Tick(); // [RH] let the level tick
|
|
|
|
Level->Thinkers.RunThinkers(Level);
|
|
|
|
|
|
|
|
//if added by MC: Freeze mode.
|
|
|
|
if (!Level->isFrozen())
|
|
|
|
{
|
|
|
|
P_UpdateSpecials(Level);
|
|
|
|
P_RunEffects(Level); // [RH] Run particle effects
|
|
|
|
}
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2019-01-28 19:15:48 +00:00
|
|
|
// for par times
|
2019-02-01 23:24:43 +00:00
|
|
|
Level->time++;
|
|
|
|
Level->maptime++;
|
|
|
|
Level->totaltime++;
|
|
|
|
}
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|