From 1b43e4908ceb00640575545aed9acd0591f557d5 Mon Sep 17 00:00:00 2001 From: Steve Date: Wed, 16 Mar 2016 19:24:41 +0000 Subject: [PATCH] Added ability to hide objective numbers. --- data/missions/clarke/05 - clarke defence #5.json | 10 ++++++---- src/battle/missionInfo.c | 2 +- src/battle/objectives.c | 15 +++++++++------ src/galaxy/mission.c | 3 ++- src/structs.h | 1 + 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/data/missions/clarke/05 - clarke defence #5.json b/data/missions/clarke/05 - clarke defence #5.json index 2433849..15588ed 100644 --- a/data/missions/clarke/05 - clarke defence #5.json +++ b/data/missions/clarke/05 - clarke defence #5.json @@ -31,13 +31,15 @@ "targetName" : "swarmers-1", "targetValue" : 24, "targetType" : "TT_DESTROY", + "hideNumbers" : 1, "active" : 0 }, { "description" : "Eliminate Swarmers", "targetName" : "Swarmer", - "targetValue" : 50, + "targetValue" : 80, "targetType" : "TT_DESTROY", + "hideNumbers" : 1, "active" : 0 } ], @@ -118,9 +120,9 @@ "name" : "SwarmerSpawner", "types" : "Swarmer", "side" : "SIDE_PANDORAN", - "interval" : 1, - "total" : 50, - "step" : 1, + "interval" : 2, + "total" : 80, + "step" : 3, "offscreen" : 1, "active" : 0 } diff --git a/src/battle/missionInfo.c b/src/battle/missionInfo.c index 62970a9..6fa8e90 100644 --- a/src/battle/missionInfo.c +++ b/src/battle/missionInfo.c @@ -142,7 +142,7 @@ static void drawObjectives(void) } drawText(SCREEN_WIDTH / 2 - 100, y, 22, TA_RIGHT, colors.white, o->description); - if (o->targetValue > 1 && !o->isCondition) + if (o->targetValue > 1 && !o->isCondition && !o->hideNumbers) { drawText(SCREEN_WIDTH / 2, y, 22, TA_CENTER, colors.white, "%d / %d", o->currentValue, o->targetValue); } diff --git a/src/battle/objectives.c b/src/battle/objectives.c index 8fd3c39..8a1acff 100644 --- a/src/battle/objectives.c +++ b/src/battle/objectives.c @@ -88,13 +88,16 @@ void updateObjective(char *name, int type) { o->currentValue++; - if (o->targetValue - o->currentValue <= 10) + if (!o->hideNumbers) { - addHudMessage(colors.cyan, "%s - %d / %d", o->description, o->currentValue, o->targetValue); - } - else if (o->currentValue % 10 == 0) - { - addHudMessage(colors.cyan, "%s - %d / %d", o->description, o->currentValue, o->targetValue); + if (o->targetValue - o->currentValue <= 10) + { + addHudMessage(colors.cyan, "%s - %d / %d", o->description, o->currentValue, o->targetValue); + } + else if (o->currentValue % 10 == 0) + { + addHudMessage(colors.cyan, "%s - %d / %d", o->description, o->currentValue, o->targetValue); + } } if (o->currentValue == o->targetValue) diff --git a/src/galaxy/mission.c b/src/galaxy/mission.c index 88099cc..fe62e7d 100644 --- a/src/galaxy/mission.c +++ b/src/galaxy/mission.c @@ -336,8 +336,9 @@ static void loadObjectives(cJSON *node) o->targetType = lookup(cJSON_GetObjectItem(node, "targetType")->valuestring); o->active = getJSONValue(node, "active", 1); o->isCondition = getJSONValue(node, "isCondition", 0); - o->isEliminateAll = getJSONValue(node, "isEliminateAll", 0); + o->hideNumbers = getJSONValue(node, "hideNumbers", 0); + if (o->isEliminateAll) { o->targetValue = 1; diff --git a/src/structs.h b/src/structs.h index 9ddee64..c909afd 100644 --- a/src/structs.h +++ b/src/structs.h @@ -235,6 +235,7 @@ struct Objective { int status; int isCondition; int isEliminateAll; + int hideNumbers; Objective *next; };