diff --git a/TODO.txt b/TODO.txt index 02786ca..fa1b668 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,5 +1,6 @@ =========== GENERAL ============== +- add time slow down setting - the horizon on background seems too low? maybe add setting to shift it a bit? - add argc/argv to gameInit? could be used to quickly start maps, verify replays etc. diff --git a/racing.h b/racing.h index 8bd4ef5..7381d83 100644 --- a/racing.h +++ b/racing.h @@ -1,5 +1,22 @@ /** - racing module: implements the racing physics and logic. + Racing module: implements the racing physics and logic as well as replays and + other related things. + + Some comments: + - Replays are internally stored as follows: the replay consists of 16 bit + words representing changes in input at specific frame. In lowest 4 bits the + new input state is recorded, the remaining 12 bits record physics frame + offset against the previous input change. If the 12 bits don't suffice + because the offset is too big (input didn't change for more than 2^12 + frames), there must simply be inserted an extra word that just copies the + current input state. + - Replay text format: first there is hexadeciaml hash of the map (exactly 8 + characters), then the name of the map follows immediately, then the + character ';', then the replay data, i.e. the sries of 16 bit words in + hexadecimal. The blocks (but nothing else) may be preceeded or followed by + blank characters. All hexadecimal letters must be lowercase. The word + 00000000 may optinally be used to terminate the replay, the rest of the + string will be ignored. */ #ifndef _LCR_RACING_H @@ -86,6 +103,12 @@ struct uint8_t carNotOKCount; } LCR_racing; +struct +{ + uint16_t eventCount; + uint16_t events[LCR_SETTING_REPLAY_MAX_SIZE]; +} LCR_currentReplay; + /** Gets times of the run in milliseconds. */ diff --git a/settings.h b/settings.h index 62ed9a9..d14b282 100644 --- a/settings.h +++ b/settings.h @@ -193,4 +193,10 @@ #define LCR_SETTING_MAP_CHUNK_RELOAD_INTERVAL 16 #endif +#ifndef LCR_SETTING_REPLAY_MAX_SIZE + /** Says the maximum size of a replay (in replay events). The value 0 will + turn replays off completely. */ + #define LCR_SETTING_REPLAY_MAX_SIZE 256 +#endif + #endif // guard