Fix replay and ghost

This commit is contained in:
Miloslav Ciz 2025-01-31 15:55:01 +01:00
parent 2ff43a0d1a
commit 1f0d3587f6
4 changed files with 39 additions and 30 deletions

View file

@ -20,12 +20,12 @@
- Replay text format: first there is the name of the map terminated by ';',
then hexadecimal hash of the map follows (exactly 8 characters), then
blank character follows, then achieved time as a series of decimal digits
expressing the number of milliseconds, then the replay data, i.e. the series
of 16 bit words in hexadecimal, each preceded by ':'. The events (but
nothing else) may otherwise be preceeded or followed by other characters
(possible comments). 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.
expressing the physics frame at which the run finished, then the replay
data, i.e. the series of 16 bit words in hexadecimal, each preceded by ':'.
The events (but nothing else) may otherwise be preceeded or followed by
other characters (possible comments). 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.
*/
typedef int32_t LCR_GameUnit; ///< abstract game unit
@ -123,7 +123,7 @@ struct
// for playing
uint16_t currentEvent;
uint16_t currentFrame;
uint32_t achievedTime;
uint32_t achievedTime; ///< Time achieved in physics frames.
} replay;
} LCR_racing;
@ -186,12 +186,12 @@ void LCR_replayOutputStr(void (*printChar)(char))
printChar(' ');
// 8 decimal digits are enough to record 24 hours
// 7 decimal digits are enough to record 24 hours
#define PUTD(order) \
printChar('0' + (LCR_racing.replay.achievedTime / order) % 10);
PUTD(10000000) PUTD(1000000) PUTD(100000) PUTD(10000)
PUTD(1000000) PUTD(100000) PUTD(10000)
PUTD(1000) PUTD(100) PUTD(10) PUTD(1)
#undef PUTD