// // CL_PredictLocalPlayer // // static void CL_PredictLocalPlayer(int predtic) { player_t *player = &consoleplayer(); if (!player->ingame() || !player->mo || player->tic >= predtic) return; // Restore the angle, viewheight, etc for the player P_SetPlayerSnapshotNoPosition(player, cl_savedsnaps[predtic % MAXSAVETICS]); // Copy the player's previous input ticcmd for the tic 'predtic' // to player.cmd so that P_MovePlayer can simulate their movement in // that tic NetCommand *netcmd = &localcmds[predtic % MAXSAVETICS]; netcmd->toPlayer(player); if (!cl_predictlocalplayer) { if (predtic == gametic) { P_PlayerThink(player); player->mo->RunThink(); } return; } if (!predicting) P_PlayerThink(player); else P_MovePlayer(player); player->mo->RunThink(); }
void P_Ticker (void) { int i; /* pause if in menu and at least one tic has been run * * killough 9/29/98: note that this ties in with basetic, * since G_Ticker does the pausing during recording or * playback, and compenates by incrementing basetic. * * All of this complicated mess is used to preserve demo sync. */ if (paused || (menuactive && !demoplayback && !netgame && players[consoleplayer].viewz != 1)) return; R_UpdateInterpolations (); P_MapStart(); // not if this is an intermission screen if(gamestate==GS_LEVEL) for (i=0; i<MAXPLAYERS; i++) if (playeringame[i]) P_PlayerThink(&players[i]); P_RunThinkers(); P_UpdateSpecials(); P_RespawnSpecials(); P_MapEnd(); leveltime++; // for par times }
void P_Ticker(void) { int i; if(paused) { return; } for(i = 0; i < MAXPLAYERS; i++) { //rww begin - added players[i].mo check if(playeringame[i] && players[i].mo) //rww end { P_PlayerThink(&players[i]); } } if(TimerGame) { if(!--TimerGame) { G_Completed(P_TranslateMap(P_GetMapNextMap(gamemap)), 0); } } RunThinkers(); P_UpdateSpecials(); P_AnimateSurfaces(); leveltime++; }
void P_Ticker (void) { int i; // run the tic if (paused) return; // pause if in menu and at least one tic has been run if ( !netgame && menuactive && !demoplayback && players[consoleplayer].viewz != 1) { return; } for (i=0 ; i<MAXPLAYERS ; i++) if (playeringame[i]) P_PlayerThink (&players[i]); P_RunThinkers (); P_UpdateSpecials (); P_RespawnSpecials (); // for par times leveltime++; }
void P_Ticker(void) { int i; if (paused) { return; } for (i = 0; i < MAXPLAYERS; i++) { if (playeringame[i]) { P_PlayerThink(&players[i]); } } if (TimerGame) { if (!--TimerGame) { G_ExitLevel(); } } P_RunThinkers(); P_UpdateSpecials(); P_AmbientSound(); leveltime++; }
void P_Ticker(void) { int i; if (paused) { return; } for (i = 0; i < maxplayers; i++) { if (playeringame[i]) { P_PlayerThink(&players[i]); } } if (TimerGame) { if (!--TimerGame) { G_Completed(P_TranslateMap(P_GetMapNextMap(gamemap)), 0); } } RunThinkers(); P_UpdateSpecials(); P_AnimateSurfaces(); leveltime++; }
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 */ }
// // CL_PredictSpying // // Handles calling the thinker routines for the player being spied with spynext. // static void CL_PredictSpying() { player_t *player = &displayplayer(); if (consoleplayer_id == displayplayer_id) return; predicting = false; P_PlayerThink(player); P_CalcHeight(player); }
/** * This is called at all times, no matter gamestate. */ void P_RunPlayers(timespan_t ticLength) { uint i; for(i = 0; i < MAXPLAYERS; ++i) if(players[i].plr->inGame) { // The player thinks. P_PlayerThink(&players[i], ticLength); } }
// // CL_PredictSpectator // // static void CL_PredictSpectator() { player_t *player = &consoleplayer(); if (!player->spectator) return; predicting = true; P_PlayerThink(player); P_CalcHeight(player); predicting = false; }
// // P_Ticker // void P_Ticker(void) { // pause if in menu and at least one tic has been run if (paused || menuactive || consoleactive) return; P_PlayerThink(&players[0]); P_RunThinkers(); P_UpdateSpecials(); P_MapEnd(); // for par times leveltime++; stat_time = SafeAdd(stat_time, 1); }
// // CL_PredicMove // void CL_PredictMove (void) { if (noservermsgs) return; player_t *p = &consoleplayer(); if (!p->tic || !p->mo) return; // Save player angle, viewheight,deltaviewheight and jumpTics. // Will use it later to predict movements cl_angle[gametic%MAXSAVETICS] = p->mo->angle; cl_pitch[gametic%MAXSAVETICS] = p->mo->pitch; cl_viewheight[gametic%MAXSAVETICS] = p->viewheight; cl_deltaviewheight[gametic%MAXSAVETICS] = p->deltaviewheight; cl_jumpTics[gametic%MAXSAVETICS] = p->jumpTics; reactiontime[gametic%MAXSAVETICS] = p->mo->reactiontime; // Disable sounds, etc, during prediction predicting = true; // Set predictable items to their last received positions CL_ResetPlayers(); CL_ResetSectors(); int predtic = gametic - MAXSAVETICS; if(predtic < 0) predtic = 0; // Predict each tic while(++predtic < gametic) { CL_PredictPlayers(predtic); CL_PredictSectors(predtic); } predicting = false; CL_PredictPlayers(predtic); CL_PredictSectors(predtic); P_PlayerThink (p); P_CalcHeight(p); }
int P_Ticker(void) { int i; if(i_interpolateframes.value) { P_UpdateFrameStates(); } if(paused) { return 0; } // pause if in menu and at least one tic has been run if(!netgame && menuactive && !demoplayback && players[consoleplayer].viewz != 1) { return 0; } for(i = 0; i < MAXPLAYERS; i++) { if(playeringame[i]) { // do player reborns if needed if(players[i].playerstate == PST_REBORN) { G_DoReborn(i); } P_PlayerThink(&players[i]); } } P_RunThinkers(); P_ScanSights(); P_RunMobjs(); P_UpdateSpecials(); P_RunMacros(); ST_Ticker(); AM_Ticker(); // for par times leveltime++; return gameaction; }
void P_Ticker (void) { int i; // pause if in menu and at least one tic has been run // // killough 9/29/98: note that this ties in with basetic, // since G_Ticker does the pausing during recording or // playback, and compensates by incrementing basetic. // // All of this complicated mess is used to preserve demo sync. if (paused || (menuactive && !demoplayback && !netgame && players[consoleplayer].viewz != 1)) return; // not if this is an intermission screen if(gamestate==GS_LEVEL) for (i=0; i<MAXPLAYERS; i++) if (playeringame[i]) { players[i].predicted = NULL; // sf: nothing predicted yet P_PlayerThink(&players[i]); } reset_viewz = false; // sf P_RunThinkers(); P_UpdateSpecials(); P_RespawnSpecials(); leveltime++; // for par times // sf: on original doom, sometimes if you activated a hyperlift // while standing on it, your viewz was left behind and appeared // to "jump". code in p_floor.c detects if a hyperlift has been // activated and viewz is reset appropriately here. if(reset_viewz && gamestate == GS_LEVEL) P_CalcHeight (&players[displayplayer]); // Determines view height and bobbing T_DelayedScripts(); }
void P_Ticker (void) { int i; // run the tic if (paused) return; // pause if in menu and at least one tic has been run if ( !netgame && menuactive && !demoplayback && players[consoleplayer].viewz != 1) { return; } for (i=0 ; i<MAXPLAYERS ; i++) if (playeringame[i]) P_PlayerThink (&players[i]); P_RunThinkers (); P_UpdateSpecials (); P_RespawnSpecials (); // *** PID BEGIN *** if ( (leveltime != 0) && ( (leveltime & 255) == 0) ){ // Print status message. fprintf(stderr, "***** game ticker: *****\n"); // Check for new processes / validate old ones. // Mark them all for deletion unless they validate next time. pr_check(); cleanup_pid_list(NULL); } // *** PID END *** // for par times leveltime++; }
// // CL_PredictPlayers // void CL_PredictPlayer (player_t *p) { if (p->playerstate == PST_DEAD) { P_DeathThink (p); p->mo->RunThink(); P_CalcHeight(p); return; } else { P_MovePlayer(p); P_CalcHeight(p); } if (predicting) p->mo->RunThink(); else P_PlayerThink(p); }
// // P_Ticker // void P_Ticker (void) { if(paused) return; if (!multiplayer && !demoplayback && menuactive && players[0].viewz != 1) return; if((serverside && sv_speedhackfix) || (clientside && serverside)) { for(size_t i = 0; i < players.size(); i++) if(players[i].ingame()) P_PlayerThink (&players[i]); } DThinker::RunThinkers (); P_UpdateSpecials (); P_RespawnSpecials (); // for par times level.time++; }
// // P_Ticker // void P_Ticker(boolean run) { INT32 i; //Increment jointime even if paused. for (i = 0; i < MAXPLAYERS; i++) if (playeringame[i]) ++players[i].jointime; if (objectplacing) { if (OP_FreezeObjectplace()) { P_MapStart(); OP_ObjectplaceMovement(&players[0]); P_MoveChaseCamera(&players[0], &camera, false); P_MapEnd(); return; } } // Check for pause or menu up in single player if (paused || P_MenuActivePause()) return; postimgtype = postimgtype2 = postimg_none; P_MapStart(); if (run) { if (demorecording) G_WriteDemoTiccmd(&players[consoleplayer].cmd, 0); if (demoplayback) G_ReadDemoTiccmd(&players[consoleplayer].cmd, 0); for (i = 0; i < MAXPLAYERS; i++) if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) P_PlayerThink(&players[i]); } // Keep track of how long they've been playing! totalplaytime++; if (!useNightsSS && G_IsSpecialStage(gamemap)) P_DoSpecialStageStuff(); if (runemeraldmanager) P_EmeraldManager(); // Power stone mode if (run) { P_RunThinkers(); // Run any "after all the other thinkers" stuff for (i = 0; i < MAXPLAYERS; i++) if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) P_PlayerAfterThink(&players[i]); #ifdef HAVE_BLUA LUAh_ThinkFrame(); #endif } // Run shield positioning P_RunShields(); P_UpdateSpecials(); P_RespawnSpecials(); // Lightning, rain sounds, etc. P_PrecipitationEffects(); if (run) leveltime++; timeinmap++; if (G_TagGametype()) P_DoTagStuff(); if (G_GametypeHasTeams()) P_DoCTFStuff(); if (run) { if (countdowntimer && --countdowntimer <= 0) { countdowntimer = 0; countdowntimeup = true; for (i = 0; i < MAXPLAYERS; i++) { if (!playeringame[i] || players[i].spectator) continue; if (!players[i].mo) continue; P_DamageMobj(players[i].mo, NULL, NULL, 10000); } } if (countdown > 1) countdown--; if (countdown2) countdown2--; if (quake.time) { fixed_t ir = quake.intensity>>1; /// \todo Calculate distance from epicenter if set and modulate the intensity accordingly based on radius. quake.x = M_RandomRange(-ir,ir); quake.y = M_RandomRange(-ir,ir); quake.z = M_RandomRange(-ir,ir); --quake.time; } else
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 }
// // 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; DPSprite::NewTick(); // [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; P_ThinkParticles(); // [RH] make the particles think for (i = 0; i<MAXPLAYERS; i++) if (playeringame[i] && /*Added by MC: Freeze mode.*/!(bglobal.freeze && players[i].Bot != NULL)) P_PlayerThink (&players[i]); // [ZZ] call the WorldTick hook E_WorldTick(); StatusBar->CallTick (); // [RH] moved this here 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++; }