2016-03-01 15:47:10 +00:00
|
|
|
// Emacs style mode select -*- C++ -*-
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// $Id:$
|
|
|
|
//
|
|
|
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
|
|
//
|
|
|
|
// This source is available for distribution and/or modification
|
|
|
|
// only under the terms of the DOOM Source Code License as
|
|
|
|
// published by id Software. All rights reserved.
|
|
|
|
//
|
|
|
|
// The source is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
// $Log:$
|
|
|
|
//
|
|
|
|
// DESCRIPTION:
|
|
|
|
// Ticker.
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-03-22 17:06:08 +00:00
|
|
|
#include <float.h>
|
2016-03-01 15:47:10 +00:00
|
|
|
#include "p_local.h"
|
|
|
|
#include "p_effect.h"
|
|
|
|
#include "c_console.h"
|
|
|
|
#include "b_bot.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "doomstat.h"
|
|
|
|
#include "sbar.h"
|
|
|
|
#include "r_data/r_interpolate.h"
|
|
|
|
#include "i_sound.h"
|
|
|
|
#include "d_player.h"
|
|
|
|
#include "g_level.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"
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
extern gamestate_t wipegamestate;
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// 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)
|
|
|
|
{
|
|
|
|
S_PauseSound (!(level.flags2 & LEVEL2_PAUSE_MUSIC_IN_MENUS), false);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// P_Ticker
|
|
|
|
//
|
|
|
|
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;
|
|
|
|
|
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().
|
|
|
|
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,
|
|
|
|
// 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();
|
|
|
|
|
|
|
|
// Since things will be moving, it's okay to interpolate them in the renderer.
|
|
|
|
r_NoInterpolate = false;
|
|
|
|
|
2016-06-10 23:15:43 +00:00
|
|
|
P_ThinkParticles(); // [RH] make the particles think
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
for (i = 0; i<MAXPLAYERS; i++)
|
|
|
|
if (playeringame[i] &&
|
|
|
|
/*Added by MC: Freeze mode.*/!(bglobal.freeze && players[i].Bot != NULL))
|
|
|
|
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
|
2016-03-01 15:47:10 +00:00
|
|
|
level.Tick (); // [RH] let the level tick
|
|
|
|
DThinker::RunThinkers ();
|
|
|
|
|
|
|
|
//if added by MC: Freeze mode.
|
|
|
|
if (!bglobal.freeze && !(level.flags2 & LEVEL2_FROZEN))
|
|
|
|
{
|
|
|
|
P_UpdateSpecials ();
|
|
|
|
P_RunEffects (); // [RH] Run particle effects
|
|
|
|
}
|
|
|
|
|
|
|
|
// for par times
|
|
|
|
level.time++;
|
|
|
|
level.maptime++;
|
|
|
|
level.totaltime++;
|
|
|
|
}
|