1 | /* (c) Redix and Sushi */ |
2 | |
3 | #ifndef GAME_CLIENT_COMPONENTS_RACE_DEMO_H |
4 | #define GAME_CLIENT_COMPONENTS_RACE_DEMO_H |
5 | |
6 | #include <chrono> |
7 | #include <game/client/component.h> |
8 | |
9 | class CRaceDemo : public CComponent |
10 | { |
11 | enum |
12 | { |
13 | RACE_NONE = 0, |
14 | RACE_IDLE, |
15 | RACE_PREPARE, |
16 | RACE_STARTED, |
17 | RACE_FINISHED, |
18 | }; |
19 | |
20 | static const char *ms_pRaceDemoDir; |
21 | |
22 | char m_aTmpFilename[128]; |
23 | |
24 | int m_RaceState; |
25 | int m_RaceStartTick; |
26 | int m_RecordStopTick; |
27 | int m_Time; |
28 | |
29 | std::chrono::nanoseconds m_RaceDemosLoadStartTime{0}; |
30 | |
31 | static int RaceDemolistFetchCallback(const CFsFileInfo *pInfo, int IsDir, int StorageType, void *pUser); |
32 | |
33 | void GetPath(char *pBuf, int Size, int Time = -1) const; |
34 | |
35 | void StopRecord(int Time = -1); |
36 | bool CheckDemo(int Time); |
37 | |
38 | public: |
39 | bool m_AllowRestart; |
40 | |
41 | CRaceDemo(); |
42 | virtual int Sizeof() const override { return sizeof(*this); } |
43 | |
44 | virtual void OnReset() override; |
45 | virtual void OnStateChange(int NewState, int OldState) override; |
46 | virtual void OnMessage(int MsgType, void *pRawMsg) override; |
47 | virtual void OnMapLoad() override; |
48 | virtual void OnShutdown() override; |
49 | virtual void OnNewSnapshot() override; |
50 | }; |
51 | #endif |
52 | |