| 141 | } |
| 142 | |
| 143 | GameStatus GamePhase(bool insideMenu) |
| 144 | { |
| 145 | auto time1 = std::chrono::high_resolution_clock::now(); |
| 146 | bool isTitle = (CurrentLevel == 0); |
| 147 | |
| 148 | g_Renderer.PrepareScene(); |
| 149 | g_Renderer.SaveOldState(); |
| 150 | |
| 151 | ClearFires(); |
| 152 | ClearLensFlares(); |
| 153 | ClearAllDisplaySprites(); |
| 154 | |
| 155 | SetupInterpolation(); |
| 156 | PrepareCamera(); |
| 157 | |
| 158 | RegeneratePickups(); |
| 159 | |
| 160 | g_DrawItems.Prepare(); |
| 161 | g_GameStringsHandler->ProcessDisplayStrings(DELTA_TIME); |
| 162 | |
| 163 | // Controls are polled before OnLoop to allow input data to be overwritten by script API methods. |
| 164 | HandleControls(isTitle); |
| 165 | |
| 166 | // Pre-loop script and event handling. |
| 167 | g_GameScript->OnLoop(DELTA_TIME, false); // TODO: Don't use DELTA_TIME constant with high framerate. |
| 168 | HandleAllGlobalEvents(EventType::Loop, (Activator)short(LaraItem->Index)); |
| 169 | |
| 170 | // Queued input actions are read again after OnLoop, so that remaining control loop can immediately register |
| 171 | // emulated keypresses from the script. |
| 172 | ApplyActionQueue(); |
| 173 | |
| 174 | // Control lock is processed after handling scripts because builder may want to process input externally |
| 175 | // while locking player from input. |
| 176 | if (!isTitle && Lara.Control.IsLocked) |
| 177 | ClearAllActions(); |
| 178 | |
| 179 | // Item update should happen before camera update, so potential flyby/track camera triggers |
| 180 | // are processed correctly. |
| 181 | UpdateAllItems(); |
| 182 | UpdateAllEffects(); |
| 183 | UpdateLara(LaraItem, isTitle); |
| 184 | g_GameScriptEntities->TestCollidingObjects(); |
| 185 | |
| 186 | // Smash shatters and clear stopper flags under them. |
| 187 | UpdateShatters(); |
| 188 | |
| 189 | // Clear last selected item in inventory (must be after on loop event handling, so they can detect that). |
| 190 | g_Gui.CancelInventorySelection(); |
| 191 | |
| 192 | // Update weather. |
| 193 | Weather.Update(); |
| 194 | |
| 195 | // Update effects. |
| 196 | StreamerEffect.Update(); |
| 197 | UpdateWibble(); |
| 198 | UpdateSparks(); |
| 199 | UpdateFireSparks(); |
| 200 | UpdateSmoke(); |
no test coverage detected