| 966 | } |
| 967 | |
| 968 | void 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 | |
| 995 | bool CDemoPlayer::SeekPercent(float Percent) |
| 996 | { |
no test coverage detected