Added "unwinnable" mission flag, to automatically continue the game when the player is defeated.

This commit is contained in:
Steve 2016-01-25 14:58:07 +00:00
parent bf3de041c6
commit a251459413
4 changed files with 23 additions and 5 deletions

View File

@ -169,6 +169,15 @@ static void doBattle(void)
}
battle.stats[STAT_TIME]++;
if (battle.unwinnable && battle.missionFinishedTimer <= -FPS * 6)
{
postBattle();
destroyBattle();
initGalacticMap();
}
}
static void draw(void)

View File

@ -52,6 +52,8 @@ void drawMissionInfo(void)
case MS_COMPLETE:
case MS_FAILED:
if (!battle.unwinnable)
{
if (battle.missionFinishedTimer <= -FPS)
{
drawMissionSummary(battle.status == MS_COMPLETE ? missionCompleteTexture : missionFailedTexture);
@ -61,6 +63,7 @@ void drawMissionInfo(void)
drawWidgets(battle.status == MS_COMPLETE ? "battleWon" : "battleLost");
}
}
}
break;
}
}

View File

@ -72,6 +72,11 @@ void loadMission(char *filename)
loadEpicData(cJSON_GetObjectItem(root, "epic"));
}
if (cJSON_GetObjectItem(root, "unwinnable"))
{
battle.unwinnable = cJSON_GetObjectItem(root, "unwinnable")->valueint;
}
initScript(cJSON_GetObjectItem(root, "script"));
free(text);

View File

@ -278,6 +278,7 @@ typedef struct {
int epic;
int epicFighterLimit;
int playerSelect;
int unwinnable;
int missionFinishedTimer;
int boostTimer;
int ecmTimer;