Word P_Ticker(void) { player_t *pl; /* wait for refresh to latch all needed data before */ /* running the next tick */ gameaction = ga_nothing; /* Game in progress */ Tick1 = FALSE; /* Reset the flags */ Tick2 = FALSE; Tick4 = FALSE; TimeMark1+=ElapsedTime; /* Timer for ticks */ TimeMark2+=ElapsedTime; TimeMark4+=ElapsedTime; if (TimeMark1>=TICKSPERSEC) { /* Now see if the time has passed... */ TimeMark1-=TICKSPERSEC; Tick1 = TRUE; } if (TimeMark2>=(TICKSPERSEC/2)) { TimeMark2-=(TICKSPERSEC/2); Tick2 = TRUE; } if (TimeMark4>=(TICKSPERSEC/4)) { TimeMark4-=(TICKSPERSEC/4); Tick4 = TRUE; } CheckCheats(); /* Handle pause and cheats */ /* Do option screen processing and control reading */ if (gamepaused) { /* If in pause mode, then don't do any game logic */ return gameaction; } /* Run player actions */ pl = &players; if (pl->playerstate == PST_REBORN) { /* Restart player? */ G_DoReborn(); /* Poof!! */ } AM_Control(pl); /* Handle automap controls */ O_Control(pl); /* Handle option controls */ P_PlayerThink(pl); /* Process player in the game */ if (!(players.AutomapFlags & AF_OPTIONSACTIVE)) { RunThinkers(); /* Handle logic for doors, walls etc... */ P_RunMobjBase(); /* Handle critter think logic */ } P_UpdateSpecials(); /* Handle wall and floor animations */ ST_Ticker(); /* Update status bar */ return gameaction; /* may have been set to ga_died, ga_completed, */ /* or ga_secretexit */ }
int P_Ticker(void) { //int start; //int ticstart; player_t *pl; //ticstart = samplecount; while(!I_RefreshLatched()) ; // wait for refresh to latch all needed data before running the next tick gameaction = ga_nothing; gametic++; // // check for pause and cheats // P_CheckCheats(); // // do option screen processing // for(playernum = 0, pl = players; playernum < MAXPLAYERS; playernum++, pl++) { if(playeringame[playernum]) O_Control(pl); } if(gamepaused) return 0; // // run player actions // //start = samplecount; for(playernum = 0, pl = players; playernum < MAXPLAYERS; playernum++, pl++) { if(playeringame[playernum]) { if(pl->playerstate == PST_REBORN) G_DoReborn(playernum); AM_Control(pl); P_PlayerThink(pl); } } //playertics = samplecount - start; //start = samplecount; P_RunThinkers(); //thinkertics = samplecount - start; //start = samplecount; P_CheckSights(); //sighttics = samplecount - start; //start = samplecount; P_RunMobjBase(); //basetics = samplecount - start; //start = samplecount; P_RunMobjLate(); //latetics = samplecount - start; P_UpdateSpecials(); P_RespawnSpecials(); ST_Ticker(); // update status bar //tictics = samplecount - ticstart; return gameaction; // may have been set to ga_died, ga_completed, or ga_secretexit }