Correctly handle free play mode.

This commit is contained in:
Steve 2018-04-15 09:26:29 +01:00
parent 7cfac40aa8
commit 2031d5a301
1 changed files with 26 additions and 23 deletions

View File

@ -152,6 +152,8 @@ void initHub(void)
teeka = NULL; teeka = NULL;
unlockedMissions = 0;
for (mission = hubMissionHead.next ; mission != NULL ; mission = mission->next) for (mission = hubMissionHead.next ; mission != NULL ; mission = mission->next)
{ {
if (requiredMissionUnlocked(mission->requires) || dev.cheatLevels || game.isComplete) if (requiredMissionUnlocked(mission->requires) || dev.cheatLevels || game.isComplete)
@ -161,6 +163,8 @@ void initHub(void)
mission->status = getMissionStatus(mission->id); mission->status = getMissionStatus(mission->id);
if (!game.isComplete)
{
if (strcmp(mission->id, "teeka") == 0) if (strcmp(mission->id, "teeka") == 0)
{ {
teeka = mission; teeka = mission;
@ -170,25 +174,18 @@ void initHub(void)
unlockTeeka = 0; unlockTeeka = 0;
} }
game.totalMissions++; if (mission->status == MS_MISSING_HEART_CELL)
}
for (mission = hubMissionHead.next ; mission != NULL ; mission = mission->next)
{
if (game.isComplete)
{
STRNCPY(mission->description, app.strings[ST_FREEPLAY], MAX_DESCRIPTION_LENGTH);
}
else if (mission->status == MS_MISSING_HEART_CELL)
{ {
STRNCPY(mission->description, app.strings[ST_HEART_CELL], MAX_DESCRIPTION_LENGTH); STRNCPY(mission->description, app.strings[ST_HEART_CELL], MAX_DESCRIPTION_LENGTH);
} }
} }
else
/* keep our unlock count in sync */
unlockedMissions = 0;
for (mission = hubMissionHead.next ; mission != NULL ; mission = mission->next)
{ {
STRNCPY(mission->description, app.strings[ST_FREEPLAY], MAX_DESCRIPTION_LENGTH);
}
game.totalMissions++;
if (mission->status != MS_LOCKED) if (mission->status != MS_LOCKED)
{ {
unlockedMissions++; unlockedMissions++;
@ -509,6 +506,12 @@ static void unlockMission(char *id)
{ {
t->value.i = MS_INCOMPLETE; t->value.i = MS_INCOMPLETE;
/* if the game is complete, don't reset these two */
if (game.isComplete && (strcmp(t->key, "teeka") == 0 || strcmp(t->key, "beachApproach") == 0))
{
t->value.i = MS_COMPLETE;
}
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "Unlocked mission %s", id); SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "Unlocked mission %s", id);
} }