Allow challenges to specify that all enemies must be defeated before activating waypoint.

This commit is contained in:
Steve 2016-05-09 09:33:35 +01:00
parent 9c9f456c6e
commit 6287e10746
4 changed files with 10 additions and 0 deletions

View File

@ -96,6 +96,13 @@ static int isCurrentObjective(void)
return 0; return 0;
} }
if (game.currentMission->challengeData.isChallenge && game.currentMission->challengeData.clearWaypointEnemies && battle.numEnemies > 0)
{
addHudMessage(colors.cyan, _("Cannot activate waypoint - eliminate enemies first"));
self->aiActionTime = FPS;
return 0;
}
return 1; return 1;
} }

View File

@ -32,3 +32,4 @@ extern Battle battle;
extern Colors colors; extern Colors colors;
extern Entity *self; extern Entity *self;
extern Entity *player; extern Entity *player;
extern Game game;

View File

@ -113,6 +113,7 @@ void loadChallenge(Mission *mission, cJSON *node)
/* misc */ /* misc */
mission->challengeData.allowPlayerDeath = getJSONValue(node, "allowPlayerDeath", 0); mission->challengeData.allowPlayerDeath = getJSONValue(node, "allowPlayerDeath", 0);
mission->challengeData.clearWaypointEnemies = getJSONValue(node, "clearWaypointEnemies", 0);
node = cJSON_GetObjectItem(node, "challenges"); node = cJSON_GetObjectItem(node, "challenges");

View File

@ -263,6 +263,7 @@ typedef struct {
int noGuns; int noGuns;
int scriptedEnd; int scriptedEnd;
int allowPlayerDeath; int allowPlayerDeath;
int clearWaypointEnemies;
Challenge *challenges[MAX_CHALLENGES]; Challenge *challenges[MAX_CHALLENGES];
} ChallengeData; } ChallengeData;