Restore game state if the mission remains in incomplete status.

This commit is contained in:
Steve 2018-02-21 08:43:45 +00:00
parent 84c934a1cb
commit e887e385c7
6 changed files with 9 additions and 6 deletions

View File

@ -354,7 +354,7 @@ static void draw(void)
case SHOW_NONE: case SHOW_NONE:
if (selectedMission != NULL) if (selectedMission != NULL)
{ {
drawMissionInfo(); drawMissionInfo();
drawWidgets(); drawWidgets();
} }
blitRect(atlasTexture->texture, cursor.x, cursor.y, getCurrentFrame(cursorSpr), 1); blitRect(atlasTexture->texture, cursor.x, cursor.y, getCurrentFrame(cursorSpr), 1);

View File

@ -80,9 +80,13 @@ static void updateMissionStatus(void)
if (status != MS_INCOMPLETE) if (status != MS_INCOMPLETE)
{ {
saveGame(); saveGame();
saveWorld(); saveWorld();
} }
else
{
restoreGameState();
}
} }
static void logic(void) static void logic(void)

View File

@ -35,6 +35,7 @@ extern float limit(float i, float low, float high);
extern void playSound(int snd, int ch); extern void playSound(int snd, int ch);
extern int isAcceptControl(void); extern int isAcceptControl(void);
extern void clearControls(void); extern void clearControls(void);
extern void restoreGameState(void);
extern App app; extern App app;
extern Colors colors; extern Colors colors;

View File

@ -54,8 +54,6 @@ void initAtlasTest(void)
case 3: case 3:
STRNCPY(game.worldId, "beachFront1", MAX_NAME_LENGTH); STRNCPY(game.worldId, "beachFront1", MAX_NAME_LENGTH);
initWorld(); initWorld();
stopMusic();
initPostMission();
break; break;
} }
} }

View File

@ -47,7 +47,7 @@ void doHud(void)
{ {
if (--messageTime <= 0) if (--messageTime <= 0)
{ {
messageType = MSG_STANDARD; messageType = MSG_STANDARD;
messageTime = 0; messageTime = 0;
} }

View File

@ -259,7 +259,7 @@ static void startMission(void)
world.state = WS_IN_PROGRESS; world.state = WS_IN_PROGRESS;
world.betweenTimer = FPS / 2; world.betweenTimer = FPS / 2;
r = &self->sprite[self->facing]->frames[self->spriteFrame]->rect; r = &self->sprite[self->facing]->frames[self->spriteFrame]->rect;
self->w = r->w; self->w = r->w;
self->h = r->h; self->h = r->h;