From 483768fe797b21c9a0248d3551763a39982009ba Mon Sep 17 00:00:00 2001 From: Steve Date: Thu, 29 Oct 2015 08:03:05 +0000 Subject: [PATCH] Added Firefly, tweaked fighter speeds. Adjusted mission requirements. --- data/fighters/firefly.json | 30 +++++++++++++ data/fighters/list.json | 3 +- data/galaxy/starSystems.json | 4 +- data/missions/alba/01 - patrol #1.json | 43 +++++++++++++++++++ .../coyote/01 - coyote assault #1.json | 2 +- .../temper/02 - pirate uprising #2.json | 1 + .../temper/03 - pirate uprising #3.json | 1 + src/galaxy/galacticMap.c | 4 -- src/galaxy/mission.c | 24 +++++++++++ src/galaxy/starSystems.c | 31 ++++--------- src/galaxy/starSystems.h | 2 +- 11 files changed, 114 insertions(+), 31 deletions(-) create mode 100644 data/fighters/firefly.json create mode 100644 data/missions/alba/01 - patrol #1.json diff --git a/data/fighters/firefly.json b/data/fighters/firefly.json new file mode 100644 index 0000000..87ee435 --- /dev/null +++ b/data/fighters/firefly.json @@ -0,0 +1,30 @@ +{ + "name" : "Firefly", + "health" : 35, + "shield" : 35, + "speed" : 1.9, + "reloadTime" : 12, + "shieldRechargeRate" : 30, + "textureName" : "gfx/fighters/firefly.png", + "guns" : [ + { + "type" : "BT_PARTICLE", + "x" : -12, + "y" : -2 + }, + { + "type" : "BT_PARTICLE", + "x" : 12, + "y" : -2 + }, + { + "type" : "BT_PARTICLE", + "x" : 0, + "y" : -4 + } + ], + "missiles" : { + "type" : "MISSILE_MISSILE", + "ammo" : 3 + } +} diff --git a/data/fighters/list.json b/data/fighters/list.json index 1f17bb4..0ce613d 100644 --- a/data/fighters/list.json +++ b/data/fighters/list.json @@ -8,5 +8,6 @@ "data/fighters/taf.json", "data/fighters/unarmedDart.json", "data/fighters/ray.json", - "data/fighters/nymph.json" + "data/fighters/nymph.json", + "data/fighters/firefly.json" ] diff --git a/data/galaxy/starSystems.json b/data/galaxy/starSystems.json index 35d00a2..6378300 100644 --- a/data/galaxy/starSystems.json +++ b/data/galaxy/starSystems.json @@ -114,7 +114,9 @@ "side" : "SIDE_UNF", "x": 465, "y": 235, - "missions" : [] + "missions" : [ + "data/missions/alba/01 - patrol #1.json" + ] }, { "name": "Aster", diff --git a/data/missions/alba/01 - patrol #1.json b/data/missions/alba/01 - patrol #1.json new file mode 100644 index 0000000..94869e4 --- /dev/null +++ b/data/missions/alba/01 - patrol #1.json @@ -0,0 +1,43 @@ +{ + "name" : "Patrol #1", + "description" : "With the Pandorans having invaded Independent systems boardering the Mitikas Empire, we need to become more vigilant. Patrols around Torelli are being stepped up. Ensure you hit all the waypoints, and report any unusual activity that you encounter.", + "background" : "gfx/backgrounds/background03.jpg", + "planet" : "gfx/planets/torelli.png", + "music" : "music/heroism.ogg", + "requires" : "data/missions/temper/03 - pirate uprising #3.json", + "objectives" : [ + { + "description" : "Check all Wayponts", + "targetName" : "Waypoint", + "targetValue" : 5, + "targetType" : "TT_WAYPOINT" + } + ], + "player" : { + "type" : "Firefly", + "side" : "SIDE_ALLIES", + "pilot" : "Curtis Rice", + "squadron" : "Eightballers" + }, + "fighterGroups" : [ + { + "name" : "Ally", + "types" : "Firefly;Nymph", + "number" : 3, + "side" : "SIDE_ALLIES", + "x" : 640, + "y" : 1000, + "scatter" : 64 + } + ], + "entityGroups" : [ + { + "type" : "ET_WAYPOINT", + "number" : 5, + "x" : 640, + "y" : 480, + "scatter" : 7500 + } + ] +} + diff --git a/data/missions/coyote/01 - coyote assault #1.json b/data/missions/coyote/01 - coyote assault #1.json index bcf5f93..afad183 100644 --- a/data/missions/coyote/01 - coyote assault #1.json +++ b/data/missions/coyote/01 - coyote assault #1.json @@ -4,7 +4,7 @@ "background" : "gfx/backgrounds/background03.jpg", "planet" : "gfx/planets/mythos.png", "music" : "music/heroism.ogg", - "requires" : "temper/03 - pirate uprising #3.json", + "requires" : "data/missions/temper/03 - pirate uprising #3.json", "objectives" : [ { "description" : "Destroy all enemy targets", diff --git a/data/missions/temper/02 - pirate uprising #2.json b/data/missions/temper/02 - pirate uprising #2.json index d856a1e..3be9301 100644 --- a/data/missions/temper/02 - pirate uprising #2.json +++ b/data/missions/temper/02 - pirate uprising #2.json @@ -4,6 +4,7 @@ "background" : "gfx/backgrounds/background03.jpg", "planet" : "gfx/planets/spirit.png", "music" : "music/battleThemeA.mp3", + "requires" : "PREVIOUS", "objectives" : [ { "description" : "Eliminate Darts", diff --git a/data/missions/temper/03 - pirate uprising #3.json b/data/missions/temper/03 - pirate uprising #3.json index 62f8947..c4ab28c 100644 --- a/data/missions/temper/03 - pirate uprising #3.json +++ b/data/missions/temper/03 - pirate uprising #3.json @@ -4,6 +4,7 @@ "background" : "gfx/backgrounds/background03.jpg", "planet" : "gfx/planets/spirit.png", "music" : "music/battleThemeA.mp3", + "requires" : "PREVIOUS", "objectives" : [ { "description" : "Capture Pirate Leader", diff --git a/src/galaxy/galacticMap.c b/src/galaxy/galacticMap.c index cd4dd15..6d44f71 100644 --- a/src/galaxy/galacticMap.c +++ b/src/galaxy/galacticMap.c @@ -492,10 +492,6 @@ static void drawStarSystemDetail(void) { drawText(210, y, 24, TA_LEFT, mission->completed ? colors.white : colors.yellow, mission->name); } - else - { - drawText(210, y, 24, TA_LEFT, colors.darkGrey, "[LOCKED]"); - } y += 50; } diff --git a/src/galaxy/mission.c b/src/galaxy/mission.c index ac406bc..c41a48c 100644 --- a/src/galaxy/mission.c +++ b/src/galaxy/mission.c @@ -398,6 +398,30 @@ Mission *getMission(char *filename) return NULL; } +int isMissionAvailable(Mission *mission, Mission *prev) +{ + Mission *reqMission; + + if (mission->requires) + { + if (strcmp(mission->requires, "PREVIOUS") == 0) + { + return prev->completed; + } + else + { + reqMission = getMission(mission->requires); + + if (reqMission != NULL) + { + return reqMission->completed; + } + } + } + + return 1; +} + static unsigned long hashcode(const char *str) { unsigned long hash = 5381; diff --git a/src/galaxy/starSystems.c b/src/galaxy/starSystems.c index 0e2cf9c..db87795 100644 --- a/src/galaxy/starSystems.c +++ b/src/galaxy/starSystems.c @@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static void loadStarSystem(cJSON *starSystemJSON); static void loadMissionMeta(char *filename, StarSystem *starSystem); -static int isAvailable(Mission *mission, Mission *prev); void initStarSystems(void) { @@ -193,37 +192,23 @@ void updateStarSystemMissions(void) for (mission = starSystem->missionHead.next ; mission != NULL ; mission = mission->next) { - starSystem->totalMissions++; + mission->available = isMissionAvailable(mission, prev); - if (mission->completed) + if (mission->available) { - starSystem->completedMissions++; + starSystem->totalMissions++; + + if (mission->completed) + { + starSystem->completedMissions++; + } } - mission->available = isAvailable(mission, prev); - prev = mission; } } } -static int isAvailable(Mission *mission, Mission *prev) -{ - Mission *reqMission; - - if (mission->requires) - { - reqMission = getMission(mission->requires); - - if (reqMission != NULL) - { - return reqMission->completed; - } - } - - return prev->completed; -} - void destroyStarSystems(void) { StarSystem *starSystem; diff --git a/src/galaxy/starSystems.h b/src/galaxy/starSystems.h index 90712ff..3165067 100644 --- a/src/galaxy/starSystems.h +++ b/src/galaxy/starSystems.h @@ -26,6 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern char *readFile(char *filename); extern long lookup(char *name); -extern Mission *getMission(char *filename); +extern int isMissionAvailable(Mission *mission, Mission *prev); extern Game game;