Start replays
This commit is contained in:
parent
c259e35348
commit
a0ab837aec
3 changed files with 31 additions and 1 deletions
1
TODO.txt
1
TODO.txt
|
@ -1,5 +1,6 @@
|
||||||
=========== GENERAL ==============
|
=========== GENERAL ==============
|
||||||
|
|
||||||
|
- add time slow down setting
|
||||||
- the horizon on background seems too low? maybe add setting to shift it a bit?
|
- 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
|
- add argc/argv to gameInit? could be used to quickly start maps, verify
|
||||||
replays etc.
|
replays etc.
|
||||||
|
|
25
racing.h
25
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
|
#ifndef _LCR_RACING_H
|
||||||
|
@ -86,6 +103,12 @@ struct
|
||||||
uint8_t carNotOKCount;
|
uint8_t carNotOKCount;
|
||||||
} LCR_racing;
|
} LCR_racing;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint16_t eventCount;
|
||||||
|
uint16_t events[LCR_SETTING_REPLAY_MAX_SIZE];
|
||||||
|
} LCR_currentReplay;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Gets times of the run in milliseconds.
|
Gets times of the run in milliseconds.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -193,4 +193,10 @@
|
||||||
#define LCR_SETTING_MAP_CHUNK_RELOAD_INTERVAL 16
|
#define LCR_SETTING_MAP_CHUNK_RELOAD_INTERVAL 16
|
||||||
#endif
|
#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
|
#endif // guard
|
||||||
|
|
Loading…
Reference in a new issue