MCPcopy Create free account
hub / github.com/ddnet/ddnet / CheckStart

Method CheckStart

src/game/client/components/ghost.cpp:186–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186void CGhost::CheckStart()
187{
188 int RaceTick = -GameClient()->m_Snap.m_pGameInfoObj->m_WarmupTimer;
189 int RenderTick = m_NewRenderTick;
190
191 if(GameClient()->LastRaceTick() != RaceTick && Client()->GameTick(g_Config.m_ClDummy) - RaceTick < Client()->GameTickSpeed())
192 {
193 if(m_Rendering && m_RenderingStartedByServer) // race restarted: stop rendering
194 StopRender();
195 if(m_Recording && GameClient()->LastRaceTick() != -1) // race restarted: activate restarting for local start detection so we have a smooth transition
196 m_AllowRestart = true;
197 if(GameClient()->LastRaceTick() == -1) // no restart: reset rendering preparations
198 m_NewRenderTick = -1;
199 if(GhostRecorder()->IsRecording()) // race restarted: stop recording
200 GhostRecorder()->Stop(0, -1);
201 int StartTick = RaceTick;
202
203 if(GameClient()->m_GameInfo.m_BugDDRaceGhost) // the client recognizes the start one tick earlier than ddrace servers
204 StartTick--;
205 StartRecord(StartTick);
206 RenderTick = StartTick;
207 }
208
209 TryRenderStart(RenderTick, true);
210}
211
212void CGhost::CheckStartLocal(bool Predicted)
213{

Callers

nothing calls this directly

Calls 6

LastRaceTickMethod · 0.80
ClientFunction · 0.50
GameTickMethod · 0.45
GameTickSpeedMethod · 0.45
IsRecordingMethod · 0.45
StopMethod · 0.45

Tested by

no test coverage detected