1.1 --- a/core/TimerSys.h Fri Jul 11 06:51:21 2008 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,110 +0,0 @@
1.4 -/**
1.5 - * vim: set ts=4 :
1.6 - * =============================================================================
1.7 - * SourceMod
1.8 - * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
1.9 - * =============================================================================
1.10 - *
1.11 - * This program is free software; you can redistribute it and/or modify it under
1.12 - * the terms of the GNU General Public License, version 3.0, as published by the
1.13 - * Free Software Foundation.
1.14 - *
1.15 - * This program is distributed in the hope that it will be useful, but WITHOUT
1.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1.17 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
1.18 - * details.
1.19 - *
1.20 - * You should have received a copy of the GNU General Public License along with
1.21 - * this program. If not, see <http://www.gnu.org/licenses/>.
1.22 - *
1.23 - * As a special exception, AlliedModders LLC gives you permission to link the
1.24 - * code of this program (as well as its derivative works) to "Half-Life 2," the
1.25 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
1.26 - * by the Valve Corporation. You must obey the GNU General Public License in
1.27 - * all respects for all other code used. Additionally, AlliedModders LLC grants
1.28 - * this exception to all derivative works. AlliedModders LLC defines further
1.29 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
1.30 - * or <http://www.sourcemod.net/license.php>.
1.31 - *
1.32 - * Version: $Id$
1.33 - */
1.34 -
1.35 -#ifndef _INCLUDE_SOURCEMOD_CTIMERSYS_H_
1.36 -#define _INCLUDE_SOURCEMOD_CTIMERSYS_H_
1.37 -
1.38 -#include "ShareSys.h"
1.39 -#include <ITimerSystem.h>
1.40 -#include <sh_stack.h>
1.41 -#include <sh_list.h>
1.42 -#include "sourcemm_api.h"
1.43 -
1.44 -using namespace SourceHook;
1.45 -using namespace SourceMod;
1.46 -
1.47 -typedef List<ITimer *> TimerList;
1.48 -typedef List<ITimer *>::iterator TimerIter;
1.49 -
1.50 -class SourceMod::ITimer
1.51 -{
1.52 -public:
1.53 - void Initialize(ITimedEvent *pCallbacks, float fInterval, float fToExec, void *pData, int flags);
1.54 - ITimedEvent *m_Listener;
1.55 - void *m_pData;
1.56 - float m_Interval;
1.57 - double m_ToExec;
1.58 - int m_Flags;
1.59 - bool m_InExec;
1.60 - bool m_KillMe;
1.61 -};
1.62 -
1.63 -class TimerSystem :
1.64 - public ITimerSystem,
1.65 - public SMGlobalClass
1.66 -{
1.67 -public:
1.68 - TimerSystem();
1.69 - ~TimerSystem();
1.70 -public: //SMGlobalClass
1.71 - void OnSourceModAllInitialized();
1.72 - void OnSourceModLevelEnd();
1.73 - void OnSourceModGameInitialized();
1.74 - void OnSourceModShutdown();
1.75 -public: //ITimerSystem
1.76 - ITimer *CreateTimer(ITimedEvent *pCallbacks, float fInterval, void *pData, int flags);
1.77 - void KillTimer(ITimer *pTimer);
1.78 - void FireTimerOnce(ITimer *pTimer, bool delayExec=false);
1.79 - void MapTimeLeftChanged();
1.80 - IMapTimer *SetMapTimer(IMapTimer *pTimer);
1.81 - float GetTickedTime();
1.82 - void NotifyOfGameStart(float offset /* = 0.0f */);
1.83 - bool GetMapTimeLeft(float *pTime);
1.84 -public:
1.85 - void RunFrame();
1.86 - void RemoveMapChangeTimers();
1.87 - void GameFrame(bool simulating);
1.88 - IMapTimer *GetMapTimer();
1.89 -private:
1.90 - List<ITimer *> m_SingleTimers;
1.91 - List<ITimer *> m_LoopTimers;
1.92 - CStack<ITimer *> m_FreeTimers;
1.93 - IMapTimer *m_pMapTimer;
1.94 -
1.95 - /* This is stuff for our manual ticking escapades. */
1.96 - bool m_bHasMapTickedYet; /** Has the map ticked yet? */
1.97 - bool m_bHasMapSimulatedYet; /** Has the map simulated yet? */
1.98 - float m_fLastTickedTime; /** Last time that the game currently gave
1.99 - us while ticking.
1.100 - */
1.101 -
1.102 - IForward *m_pOnGameFrame;
1.103 - IForward *m_pOnMapTimeLeftChanged;
1.104 -};
1.105 -
1.106 -time_t GetAdjustedTime(time_t *buf = NULL);
1.107 -
1.108 -extern const double *g_pUniversalTime;
1.109 -extern TimerSystem g_Timers;
1.110 -extern int g_TimeLeftMode;
1.111 -
1.112 -#endif //_INCLUDE_SOURCEMOD_CTIMERSYS_H_
1.113 -