Allow for a kill threshold to be specified in epic missions (for use with unwinnable missions).
This commit is contained in:
parent
b8dccb9882
commit
e59af4bfbc
|
@ -363,6 +363,11 @@ void doFighter(void)
|
|||
|
||||
updateObjective(self->name, TT_DESTROY);
|
||||
updateObjective(self->groupName, TT_DESTROY);
|
||||
|
||||
if (battle.isEpic && self->killedBy == player)
|
||||
{
|
||||
updateObjective("EPIC_PLAYER_KILLS", TT_DESTROY);
|
||||
}
|
||||
|
||||
adjustObjectiveTargetValue(self->name, TT_ESCAPED, -1);
|
||||
|
||||
|
|
|
@ -346,3 +346,23 @@ void addEpicLivesObjective(void)
|
|||
o->active = 1;
|
||||
o->isCondition = 1;
|
||||
}
|
||||
|
||||
void addEpicKillsObjective(void)
|
||||
{
|
||||
Objective *o;
|
||||
char id[MAX_DESCRIPTION_LENGTH];
|
||||
|
||||
o = malloc(sizeof(Objective));
|
||||
memset(o, 0, sizeof(Objective));
|
||||
battle.objectiveTail->next = o;
|
||||
battle.objectiveTail = o;
|
||||
|
||||
sprintf(id, _("Destroy at least %d enemy fighters"), battle.epicKills);
|
||||
|
||||
STRNCPY(o->id, id, MAX_DESCRIPTION_LENGTH);
|
||||
STRNCPY(o->description, id, MAX_DESCRIPTION_LENGTH);
|
||||
STRNCPY(o->targetName, "EPIC_PLAYER_KILLS", MAX_NAME_LENGTH);
|
||||
o->targetValue = battle.epicKills;
|
||||
o->targetType = TT_DESTROY;
|
||||
o->active = 1;
|
||||
}
|
||||
|
|
|
@ -432,15 +432,15 @@ static void preFireMissile(void)
|
|||
}
|
||||
}
|
||||
|
||||
void initPlayerSelect(void)
|
||||
static void initPlayerSelect(void)
|
||||
{
|
||||
Entity *e;
|
||||
|
||||
memset(&availablePlayerUnits, 0, sizeof(Entity*) * MAX_SELECTABLE_PLAYERS);
|
||||
|
||||
selectedPlayerIndex = 0;
|
||||
|
||||
if (battle.epicLives > 0 && --battle.epicLives > 0)
|
||||
|
||||
if (battle.epicLives == 0 || (battle.epicLives > 0 && --battle.epicLives > 0))
|
||||
{
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
{
|
||||
|
@ -460,6 +460,11 @@ void initPlayerSelect(void)
|
|||
else
|
||||
{
|
||||
battle.isEpic = 0;
|
||||
|
||||
if (battle.epicKills > 0 && battle.stats[STAT_ENEMIES_KILLED_PLAYER] < battle.epicKills)
|
||||
{
|
||||
battle.unwinnable = 0;
|
||||
}
|
||||
|
||||
failMission();
|
||||
}
|
||||
|
|
|
@ -421,11 +421,17 @@ static void loadEpicData(cJSON *node)
|
|||
battle.epicFighterLimit = cJSON_GetObjectItem(node, "fighterLimit")->valueint;
|
||||
battle.unlimitedEnemies = getJSONValue(node, "unlimitedEnemies", 0);
|
||||
battle.epicLives = getJSONValue(node, "lives", 0);
|
||||
battle.epicKills = getJSONValue(node, "kills", 0);
|
||||
|
||||
if (battle.epicLives > 0)
|
||||
{
|
||||
addEpicLivesObjective();
|
||||
}
|
||||
|
||||
if (battle.epicKills != 0)
|
||||
{
|
||||
addEpicKillsObjective();
|
||||
}
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
{
|
||||
|
|
|
@ -65,6 +65,7 @@ extern void awardPostMissionTrophies(void);
|
|||
extern void awardCraftTrophy(void);
|
||||
extern void setInitialPlayerAngle(void);
|
||||
extern void addEpicLivesObjective(void);
|
||||
extern void addEpicKillsObjective(void);
|
||||
|
||||
extern Battle battle;
|
||||
extern Dev dev;
|
||||
|
|
|
@ -345,6 +345,7 @@ typedef struct {
|
|||
int unlimitedEnemies;
|
||||
int epicFighterLimit;
|
||||
int epicLives;
|
||||
int epicKills;
|
||||
int playerSelect;
|
||||
int manualComplete;
|
||||
int unwinnable;
|
||||
|
|
Loading…
Reference in New Issue