Start map beating
This commit is contained in:
parent
50ceea3f0a
commit
9fb117901d
1 changed files with 49 additions and 1 deletions
50
game.h
50
game.h
|
@ -268,7 +268,6 @@ static inline void LCR_gameDrawPixelXYSafe(unsigned int x, unsigned int y,
|
|||
#define LCR_GUI_GAP \
|
||||
((LCR_EFFECTIVE_RESOLUTION_X + LCR_EFFECTIVE_RESOLUTION_Y) / 128)
|
||||
|
||||
|
||||
struct
|
||||
{
|
||||
uint8_t state;
|
||||
|
@ -285,6 +284,7 @@ struct
|
|||
frames for which the key has been
|
||||
continuously held. */
|
||||
uint32_t runTime; ///< Current time of the run, in ticks.
|
||||
uint8_t mapBeaten;
|
||||
|
||||
char popupStr[LCR_POPUP_STR_SIZE];
|
||||
uint8_t popupCountdown;
|
||||
|
@ -709,6 +709,44 @@ void LCR_seekDataByIndex(unsigned int index, char magicNumber)
|
|||
} while (c);
|
||||
}
|
||||
|
||||
uint8_t LCR_mapIsBeaten(const char *name)
|
||||
{
|
||||
LCR_gameRewindDataFile();
|
||||
|
||||
while (1)
|
||||
{
|
||||
char c = LCR_gameGetNextDataFileChar();
|
||||
|
||||
if (c == 'B')
|
||||
{
|
||||
uint8_t i = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
c = LCR_gameGetNextDataFileChar();
|
||||
|
||||
if (name[i] == 0)
|
||||
{
|
||||
if (c < ' ' || c == LCR_RESOURCE_FILE_SEPARATOR ||
|
||||
c == LCR_RESOURCE_FILE_SEPARATOR2 || c == 0)
|
||||
return 1;
|
||||
else
|
||||
break;
|
||||
}
|
||||
else if (c != name[i])
|
||||
break;
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
if (c == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void LCR_gameLoadMap(unsigned int mapIndex)
|
||||
{
|
||||
char mapName[LCR_MAP_NAME_MAX_LEN];
|
||||
|
@ -730,6 +768,7 @@ void LCR_gameLoadMap(unsigned int mapIndex)
|
|||
}
|
||||
|
||||
LCR_mapLoadFromStr(LCR_gameGetNextDataStrChar,mapName);
|
||||
LCR_game.mapBeaten = LCR_mapIsBeaten(mapName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1479,8 +1518,17 @@ uint8_t LCR_gameStep(uint32_t time)
|
|||
LCR_LOG1("finished");
|
||||
|
||||
if (LCR_game.runTime <= LCR_currentMap.targetTime)
|
||||
{
|
||||
LCR_gameSaveReplay();
|
||||
|
||||
if (!LCR_game.mapBeaten && !LCR_game.ghost.active &&
|
||||
!LCR_racing.playingReplay)
|
||||
{
|
||||
LCR_LOG1("map beaten");
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
LCR_audioPlaySound(LCR_SOUND_CLICK);
|
||||
LCR_gameSetState(LCR_GAME_STATE_RUN_FINISHED);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue