Start ghost

This commit is contained in:
Miloslav Ciz 2025-01-21 22:46:56 +01:00
parent c0f5e5cf5b
commit 0a91d5f54e
4 changed files with 105 additions and 9 deletions

View file

@ -295,7 +295,10 @@ for (int i = 0; i < 8; ++i) // hash
uint8_t LCR_replayGetNextInput(void)
{
if (LCR_replay.currentEvent >= LCR_replay.eventCount)
{
LCR_replay.currentFrame++; // has to be here
return 0;
}
if (LCR_replay.currentFrame ==
(LCR_replay.events[LCR_replay.currentEvent] >> 4))
@ -312,7 +315,19 @@ uint8_t LCR_replayGetNextInput(void)
int LCR_replayHasFinished(void)
{
return LCR_replay.currentEvent >= LCR_replay.eventCount;
if (LCR_replay.currentEvent == LCR_replay.eventCount)
{
uint32_t totalTime = LCR_replay.currentFrame;
for (int i = 0; i < LCR_replay.eventCount; ++i)
totalTime += LCR_replay.events[i] >> 4;
return totalTime >= LCR_replay.achievedTime;
}
return LCR_replay.currentEvent > LCR_replay.eventCount;
// return LCR_replay.currentEvent >= LCR_replay.eventCount;
}
/**
@ -1084,8 +1099,13 @@ uint32_t LCR_racingStep(unsigned int input)
if (LCR_racing.tick == 0)
LCR_replayInitPlaying();
input = LCR_replayGetNextInput();
if (LCR_replayHasFinished())
{
LCR_LOG1("replay finished");
return LCR_RACING_EVENT_FINISHED;
}
input = LCR_replayGetNextInput();
}
else
{