123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- #include "Precompiled.h"
- #include "globaldata.h"
- #include "z_zone.h"
- #include "p_local.h"
- #include "doomstat.h"
- void P_InitThinkers (void)
- {
- ::g->thinkercap.prev = ::g->thinkercap.next = &::g->thinkercap;
- }
- void P_AddThinker (thinker_t* thinker)
- {
- ::g->thinkercap.prev->next = thinker;
- thinker->next = &::g->thinkercap;
- thinker->prev = ::g->thinkercap.prev;
- ::g->thinkercap.prev = thinker;
- }
- void P_RemoveThinker (thinker_t* thinker)
- {
-
- thinker->function.acv = (actionf_v)(-1);
- }
- void P_AllocateThinker (thinker_t* thinker)
- {
- }
- void P_RunThinkers (void)
- {
- thinker_t* currentthinker;
- currentthinker = ::g->thinkercap.next;
- while (currentthinker != &::g->thinkercap)
- {
- if ( currentthinker->function.acv == (actionf_v)(-1) )
- {
-
- currentthinker->next->prev = currentthinker->prev;
- currentthinker->prev->next = currentthinker->next;
- Z_Free(currentthinker);
- }
- else
- {
- if (currentthinker->function.acp1)
- currentthinker->function.acp1 ((mobj_t*)currentthinker);
- }
- currentthinker = currentthinker->next;
- }
- }
- extern byte demoversion;
- void P_Ticker (void)
- {
- int i;
-
-
- if (::g->paused)
- return;
-
- if ( !::g->netgame && (!::g->demoplayback || demoversion == VERSION ) && ::g->wipe ) {
- return;
- }
-
- if ( !::g->netgame
- && ::g->menuactive
- && !::g->demoplayback
- && ::g->players[::g->consoleplayer].viewz != 1)
- {
- return;
- }
- for (i=0 ; i<MAXPLAYERS ; i++) {
- if (::g->playeringame[i]) {
- P_PlayerThink (&::g->players[i]);
- }
- }
- P_RunThinkers ();
- P_UpdateSpecials ();
- P_RespawnSpecials ();
-
- ::g->leveltime++;
- }
|