GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — UZDoom/src/p_tick.cpp at trunk · UZDoom/UZDoom Expand file tree/ Copy pathp_tick.cppMore file actions 276 lines (238 loc) · 6.51 KB / Copy pathp_tick.cppFile metadata and controls276 lines (238 loc) · 6.51 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 /* ** p_tick.cpp ** ** Ticker. ** **--------------------------------------------------------------------------- ** ** Copyright 1993-1996 id Software ** Copyright 1999-2016 Marisa Heit ** Copyright 2002-2016 Christoph Oelckers ** Copyright 2017-2025 GZDoom Maintainers and Contributors ** Copyright 2025-2026 UZDoom Maintainers and Contributors ** ** SPDX-License-Identifier: GPL-3.0-or-later ** **--------------------------------------------------------------------------- ** */ #include "p_local.h" #include "p_effect.h" #include "c_console.h" #include "b_bot.h" #include "doomstat.h" #include "sbar.h" #include "r_data/r_interpolate.h" #include "d_player.h" #include "r_utility.h" #include "p_spec.h" #include "g_levellocals.h" #include "events.h" #include "actorinlines.h" #include "g_game.h" #include "am_map.h" #include "i_interface.h" extern gamestate_t wipegamestate; extern uint8_t globalfreeze, globalchangefreeze; void C_Ticker(); void M_Ticker(); void D_RunCutscene(); //========================================================================== // // P_RunClientsideLogic // // Handles all logic that should be ran every tick including while // predicting. Only put non-playsim behaviors in here to avoid desyncs // when playing online. // //========================================================================== void P_RunClientSideLogic() { C_Ticker(); M_Ticker(); // [ZZ] also tick the UI part of the events primaryLevel->localEventManager->UiTick(); if (gamestate == GS_LEVEL || gamestate == GS_TITLELEVEL) { if (!WorldPaused(false)) { for (unsigned int i = 0; i < MAXPLAYERS; ++i) { if (playeringame[i] && players[i].inventorytics > 0) --players[i].inventorytics; } } for (auto level : AllLevels()) { auto it = level->GetClientSideThinkerIterator<AActor>(); AActor* ac = nullptr; while ((ac = it.Next()) != nullptr) { ac->ClearInterpolation(); ac->ClearFOVInterpolation(); } level->ClientSideThinkers.RunClientSideThinkers(level); } StatusBar->CallTick(); // TODO: Should this be called on all maps...? if (gamestate == GS_LEVEL) primaryLevel->automap->Ticker(); } else if (gamestate == GS_CUTSCENE || gamestate == GS_INTRO) { D_RunCutscene(); } // [MK] Additional ticker for UI events right after all others primaryLevel->localEventManager->PostUiTick(); } //========================================================================== // // P_CheckTickerPaused // // Returns true if the ticker should be paused. In that case, it also // 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 && menuactive != MENU_GameplayMenu) || ConsoleState == c_down || ConsoleState == c_falling) && !demoplayback && !demorecording && players[consoleplayer].viewz != NO_VALUE && wipegamestate == gamestate) { // Only the current UI level's settings are relevant for sound. S_PauseSound (!(primaryLevel->flags2 & LEVEL2_PAUSE_MUSIC_IN_MENUS), false); return true; } return false; } void P_ClearLevelInterpolation() { for (auto Level : AllLevels()) { Level->interpolator.UpdateInterpolations(); auto it = Level->GetThinkerIterator<AActor>(); AActor* ac; while ((ac = it.Next())) { ac->ClearInterpolation(); ac->ClearFOVInterpolation(); } } for (unsigned int i = 0; i < MAXPLAYERS; i++) { if (playeringame[i]) { DPSprite* pspr = players[i].psprites; while (pspr) { pspr->ResetInterpolation(); pspr = pspr->Next; } } } R_ClearInterpolationPath(); if (StatusBar != nullptr) StatusBar->ClearInterpolation(); } // // P_Ticker // void P_Ticker (void) { unsigned int i; for (auto Level : AllLevels()) { Level->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()) { // This must run even when the game is paused to catch changes from netevents before the frame is rendered. for (auto Level : AllLevels()) { auto it = Level->GetThinkerIterator<AActor>(); AActor* ac; while ((ac = it.Next())) { if (ac->flags8 & MF8_RECREATELIGHTS) { ac->flags8 &= ~MF8_RECREATELIGHTS; ac->SetDynamicLights(); } } } return; } DPSprite::NewTick(); // [RH] Frozen mode is only changed every 4 tics, to make it work with A_Tracer(). // This may not be perfect but it is not really relevant for sublevels that tracer homing behavior is preserved. if ((primaryLevel->maptime & 3) == 0) { if (globalchangefreeze) { globalfreeze ^= 1; globalchangefreeze = 0; for (auto Level : AllLevels()) { Level->frozenstate = (Level->frozenstate & ~2) | (2 * globalfreeze); } } } // [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; // Reset all actor interpolations on all levels before the current thinking turn so that indirect actor movement gets properly interpolated. for (auto Level : AllLevels()) { // todo: set up a sandbox for secondary levels here. auto it = Level->GetThinkerIterator<AActor>(); AActor *ac; while ((ac = it.Next())) { ac->ClearInterpolation(); ac->ClearFOVInterpolation(); } P_ThinkParticles(Level); // [RH] make the particles think for (i = 0; i < MAXPLAYERS; i++) if (Level->PlayerInGame(i)) P_PlayerThink(Level->Players[i]); // [ZZ] call the WorldTick hook Level->localEventManager->WorldTick(); Level->Tick(); // [RH] let the level tick Level->Thinkers.RunThinkers(Level); //if added by MC: Freeze mode. if (!Level->isFrozen()) { P_UpdateSpecials(Level); } // for par times Level->time++; Level->maptime++; Level->totaltime++; } } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |