Fix replay and ghost
This commit is contained in:
parent
2ff43a0d1a
commit
1f0d3587f6
4 changed files with 39 additions and 30 deletions
2
assets.h
2
assets.h
|
@ -71,7 +71,7 @@ static const char *LCR_internalDataFile =
|
||||||
|
|
||||||
":;p0w0L :f5130" // bugs
|
":;p0w0L :f5130" // bugs
|
||||||
|
|
||||||
":of0s0 :fd110" // small labyrinth
|
":>f0s0 :fd110" // small labyrinth
|
||||||
":oc0p0 :fd110"
|
":oc0p0 :fd110"
|
||||||
":=f0s0 :f11d0"
|
":=f0s0 :f11d0"
|
||||||
":=c0p0 :f11d0"
|
":=c0p0 :f11d0"
|
||||||
|
|
21
game.h
21
game.h
|
@ -1054,7 +1054,8 @@ else
|
||||||
|
|
||||||
LCR_rendererDrawText(str,
|
LCR_rendererDrawText(str,
|
||||||
(LCR_EFFECTIVE_RESOLUTION_X - LCR_rendererComputeTextWidth(str,8)) / 2,
|
(LCR_EFFECTIVE_RESOLUTION_X - LCR_rendererComputeTextWidth(str,8)) / 2,
|
||||||
LCR_EFFECTIVE_RESOLUTION_Y / 2,0x0707,8);
|
LCR_EFFECTIVE_RESOLUTION_Y / 2
|
||||||
|
,0x0707,8);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1069,18 +1070,23 @@ else
|
||||||
str[2] = '0' + val % 10;
|
str[2] = '0' + val % 10;
|
||||||
str[3] = 0;
|
str[3] = 0;
|
||||||
|
|
||||||
LCR_rendererDrawText(str,
|
LCR_rendererDrawText(str,LCR_EFFECTIVE_RESOLUTION_X -
|
||||||
LCR_EFFECTIVE_RESOLUTION_X -
|
|
||||||
LCR_rendererComputeTextWidth(str,2) - 20,
|
LCR_rendererComputeTextWidth(str,2) - 20,
|
||||||
LCR_EFFECTIVE_RESOLUTION_Y -
|
LCR_EFFECTIVE_RESOLUTION_Y - LCR_rendererComputeTextHeight(2) - 20,0,2);
|
||||||
LCR_rendererComputeTextHeight(2) - 20,0,2);
|
|
||||||
|
|
||||||
LCR_gameTimeToStr(LCR_game.runTimeMS,str);
|
LCR_gameTimeToStr(LCR_game.runTimeMS,str);
|
||||||
|
|
||||||
|
if (LCR_game.state != LCR_GAME_STATE_RUN_FINISHED)
|
||||||
LCR_rendererDrawText(str,20,LCR_EFFECTIVE_RESOLUTION_Y -
|
LCR_rendererDrawText(str,20,LCR_EFFECTIVE_RESOLUTION_Y -
|
||||||
LCR_rendererComputeTextHeight(2) - 45,0,2);
|
LCR_rendererComputeTextHeight(2) - 45,0,2);
|
||||||
|
else
|
||||||
|
LCR_rendererDrawText(str,((LCR_EFFECTIVE_RESOLUTION_X -
|
||||||
|
LCR_rendererComputeTextWidth(str,4)) / 2),
|
||||||
|
LCR_EFFECTIVE_RESOLUTION_Y / 2,
|
||||||
|
LCR_game.runTimeMS <= LCR_currentMap.targetTime * LCR_RACING_TICK_MS ?
|
||||||
|
0x0700 : 0x4208,4);
|
||||||
|
|
||||||
LCR_gameTimeToStr(LCR_currentMap.targetTime,str);
|
LCR_gameTimeToStr(LCR_currentMap.targetTime * LCR_RACING_TICK_MS,str);
|
||||||
|
|
||||||
LCR_rendererDrawText(str,20,LCR_EFFECTIVE_RESOLUTION_Y -
|
LCR_rendererDrawText(str,20,LCR_EFFECTIVE_RESOLUTION_Y -
|
||||||
LCR_rendererComputeTextHeight(2) - 20,0x4208,2);
|
LCR_rendererComputeTextHeight(2) - 20,0x4208,2);
|
||||||
|
@ -1333,7 +1339,10 @@ uint8_t LCR_gameStep(uint32_t time)
|
||||||
LCR_rendererLoadMap();
|
LCR_rendererLoadMap();
|
||||||
|
|
||||||
if (LCR_game.menu.selectedTab == 3)
|
if (LCR_game.menu.selectedTab == 3)
|
||||||
|
{
|
||||||
_LCR_gamePrepareGhost();
|
_LCR_gamePrepareGhost();
|
||||||
|
LCR_currentMap.targetTime = LCR_racing.replay.achievedTime;
|
||||||
|
}
|
||||||
|
|
||||||
LCR_gameResetRun(
|
LCR_gameResetRun(
|
||||||
LCR_game.menu.selectedTab == 2,
|
LCR_game.menu.selectedTab == 2,
|
||||||
|
|
18
racing.h
18
racing.h
|
@ -20,12 +20,12 @@
|
||||||
- Replay text format: first there is the name of the map terminated by ';',
|
- Replay text format: first there is the name of the map terminated by ';',
|
||||||
then hexadecimal hash of the map follows (exactly 8 characters), then
|
then hexadecimal hash of the map follows (exactly 8 characters), then
|
||||||
blank character follows, then achieved time as a series of decimal digits
|
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
|
expressing the physics frame at which the run finished, then the replay
|
||||||
of 16 bit words in hexadecimal, each preceded by ':'. The events (but
|
data, i.e. the series of 16 bit words in hexadecimal, each preceded by ':'.
|
||||||
nothing else) may otherwise be preceeded or followed by other characters
|
The events (but nothing else) may otherwise be preceeded or followed by
|
||||||
(possible comments). All hexadecimal letters must be lowercase. The word
|
other characters (possible comments). All hexadecimal letters must be
|
||||||
00000000 may optinally be used to terminate the replay, the rest of the
|
lowercase. The word 00000000 may optinally be used to terminate the replay,
|
||||||
string will be ignored.
|
the rest of the string will be ignored.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef int32_t LCR_GameUnit; ///< abstract game unit
|
typedef int32_t LCR_GameUnit; ///< abstract game unit
|
||||||
|
@ -123,7 +123,7 @@ struct
|
||||||
// for playing
|
// for playing
|
||||||
uint16_t currentEvent;
|
uint16_t currentEvent;
|
||||||
uint16_t currentFrame;
|
uint16_t currentFrame;
|
||||||
uint32_t achievedTime;
|
uint32_t achievedTime; ///< Time achieved in physics frames.
|
||||||
} replay;
|
} replay;
|
||||||
} LCR_racing;
|
} LCR_racing;
|
||||||
|
|
||||||
|
@ -186,12 +186,12 @@ void LCR_replayOutputStr(void (*printChar)(char))
|
||||||
|
|
||||||
printChar(' ');
|
printChar(' ');
|
||||||
|
|
||||||
// 8 decimal digits are enough to record 24 hours
|
// 7 decimal digits are enough to record 24 hours
|
||||||
|
|
||||||
#define PUTD(order) \
|
#define PUTD(order) \
|
||||||
printChar('0' + (LCR_racing.replay.achievedTime / order) % 10);
|
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)
|
PUTD(1000) PUTD(100) PUTD(10) PUTD(1)
|
||||||
#undef PUTD
|
#undef PUTD
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
where it is looking. This is to save resources, we don't draw the far away
|
where it is looking. This is to save resources, we don't draw the far away
|
||||||
chunks or those behind the camera.
|
chunks or those behind the camera.
|
||||||
- Extremely simple LOD of far away chunks is implemented: we keep an 8x8x8
|
- Extremely simple LOD of far away chunks is implemented: we keep an 8x8x8
|
||||||
bit map of where there is empty space and where there is "something", then
|
bit array of where there is empty space and where there is "something", then
|
||||||
for far away areas with "something" we just draw some 2D rectangles.
|
for far away areas with "something" we just draw some 2D rectangles.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -67,8 +67,8 @@ struct
|
||||||
{
|
{
|
||||||
S3L_Scene scene; ///< Whole 3D scene.
|
S3L_Scene scene; ///< Whole 3D scene.
|
||||||
S3L_Model3D mapModel; ///< Whole map model.
|
S3L_Model3D mapModel; ///< Whole map model.
|
||||||
S3L_Model3D *carModel; ///< Shortcut pointer to the car model in scene.
|
S3L_Model3D *carModel; ///< Shortcut ptr to the car model in the scene.
|
||||||
S3L_Model3D *ghostModel; ///< Shortcut pointer to the ghost model in scene.
|
S3L_Model3D *ghostModel; ///< Shortcut ptr to the ghost model in the scene.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The scene model array.
|
The scene model array.
|
||||||
|
@ -1951,7 +1951,7 @@ void LCR_rendererDraw3D(void)
|
||||||
{
|
{
|
||||||
carGhostVisibility <<= 1;
|
carGhostVisibility <<= 1;
|
||||||
|
|
||||||
if (LCR_renderer.carModel->config.visible)
|
if (m->config.visible)
|
||||||
{
|
{
|
||||||
carGhostVisibility |= 1;
|
carGhostVisibility |= 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue