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

Method Play

src/engine/shared/demo.cpp:968–993  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

966}
967
968void CDemoPlayer::Play()
969{
970 // Fill in previous and next tick
971 while(m_Info.m_PreviousTick == -1)
972 {
973 DoTick();
974 if(!IsPlaying())
975 {
976 // Empty demo or error playing tick
977 return;
978 }
979 }
980
981 // Initialize playback time. Using `set_new_tick` is essential so that `Time`
982 // returns the updated time, otherwise the delta between `m_LastUpdate` and
983 // the value that `Time` returns when called in the `Update` function can be
984 // very large depending on the time required to load the demo, which causes
985 // demo playback to start later. This ensures it always starts at 00:00.
986 set_new_tick();
987 m_Info.m_CurrentTime = m_Info.m_PreviousTick * time_freq() / SERVER_TICK_SPEED;
988 m_Info.m_LastUpdate = Time();
989 if(m_Info.m_LiveStateUpdating && m_Info.m_LastScan <= 0)
990 {
991 m_Info.m_LastScan = m_Info.m_LastUpdate;
992 }
993}
994
995bool CDemoPlayer::SeekPercent(float Percent)
996{

Callers 2

ExtractDemoChatFunction · 0.45
SliceMethod · 0.45

Calls 2

set_new_tickFunction · 0.85
time_freqFunction · 0.85

Tested by

no test coverage detected