From 3dbd8e72f74c200afa5374b78f4846d1252a4719 Mon Sep 17 00:00:00 2001 From: Steve Date: Mon, 21 Dec 2015 14:19:21 +0000 Subject: [PATCH] Missions now unlock depending on number of other missions completed (and previous mission, where applicable). --- data/missions/alba/01 - patrol #1.json | 2 +- data/missions/alba/02 - patrol #2.json | 2 +- .../clarke/01 - clarke defence #1.json | 2 +- .../clarke/02 - clarke defence #2.json | 2 +- .../clarke/03 - clarke defence #3.json | 2 +- .../coyote/01 - coyote assault #1.json | 2 +- .../coyote/02 - coyote assault #2.json | 2 +- .../coyote/03 - coyote assault #3.json | 2 +- .../granada/01 - suspect packages #1.json | 2 +- .../granada/02 - suspect packages #2.json | 2 +- .../granada/03 - suspect packages #3.json | 2 +- data/missions/granada/04 - pirate smash.json | 2 +- .../missions/iliad/01 - iliad defence #1.json | 2 +- .../missions/iliad/02 - iliad defence #2.json | 2 +- data/missions/mace/01 - rebel assault #1.json | 4 +- .../temper/02 - pirate uprising #2.json | 2 +- .../temper/03 - pirate uprising #3.json | 2 +- .../temper/04 - pirate uprising #4.json | 2 +- .../temper/05 - pirate uprising #5.json | 4 +- data/missions/warro/01 - evacuation #1.json | 2 +- data/missions/warro/02 - evacuation #2.json | 2 +- data/missions/warro/03 - evacuation #3.json | 2 +- data/missions/warro/04 - evacuation #4.json | 2 +- src/galaxy/galacticMap.c | 45 ++++++++----------- src/galaxy/galacticMap.h | 1 - src/galaxy/mission.c | 24 +--------- src/galaxy/starSystems.c | 44 +++++++++--------- src/structs.h | 5 ++- 28 files changed, 71 insertions(+), 98 deletions(-) diff --git a/data/missions/alba/01 - patrol #1.json b/data/missions/alba/01 - patrol #1.json index 52a6312..bfd8be2 100644 --- a/data/missions/alba/01 - patrol #1.json +++ b/data/missions/alba/01 - patrol #1.json @@ -1,10 +1,10 @@ { "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.", + "requires" : 8, "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", diff --git a/data/missions/alba/02 - patrol #2.json b/data/missions/alba/02 - patrol #2.json index 593ca23..4d26fde 100644 --- a/data/missions/alba/02 - patrol #2.json +++ b/data/missions/alba/02 - patrol #2.json @@ -1,10 +1,10 @@ { "name" : "Patrol #2", "description" : "Patrols so far have not uncovered anything unusual, and it seems as though the increase in military presense is reducing the amount of illegal activity in this sector, with reported incidents down 80%. Still, we cannot afford to become complacent, and must continue with our sweeps.", + "requires" : 13, "background" : "gfx/backgrounds/background03.jpg", "planet" : "gfx/planets/torelli.png", "music" : "music/heroism.ogg", - "requires" : "PREVIOUS", "objectives" : [ { "description" : "Check all Waypoints", diff --git a/data/missions/clarke/01 - clarke defence #1.json b/data/missions/clarke/01 - clarke defence #1.json index 65d8c79..ac4c840 100644 --- a/data/missions/clarke/01 - clarke defence #1.json +++ b/data/missions/clarke/01 - clarke defence #1.json @@ -1,10 +1,10 @@ { "name" : "Clarke Defence #1", "description" : "The day that we have feared and the events that we attempted to avert are now upon us - the Pandoran army has commenced its push beyond Mitikas space, and is beginning to assault neighbouring Independent star systems. We need to fight back, in order to protect Clarke from becoming underrun by this menace. Take heed: this will not be an easy battle, but we have little choice and must secure victory here today.", + "requires" : 4, "background" : "gfx/backgrounds/background04.jpg", "planet" : "gfx/planets/bluePlanet.png", "music" : "music/heroism.ogg", - "requires" : "data/missions/temper/03 - pirate uprising #3.json", "epic" : { "fighterLimit" : 12 }, diff --git a/data/missions/clarke/02 - clarke defence #2.json b/data/missions/clarke/02 - clarke defence #2.json index 253ac94..0d6ca80 100644 --- a/data/missions/clarke/02 - clarke defence #2.json +++ b/data/missions/clarke/02 - clarke defence #2.json @@ -1,10 +1,10 @@ { "name" : "Clarke Defence #2", "description" : "We have successfully punched our way through several squadrons of Pandoran fighters, but their capital ships are fast approaching Dublin. Your objective is to take down two of their corvettes: INF Dirk and INF Blackjack. Ensure the Khepri-class bombers can get in close enough to delivery a strike.", + "requires" : 12, "background" : "gfx/backgrounds/background04.jpg", "planet" : "gfx/planets/bluePlanet.png", "music" : "music/heroism.ogg", - "requires" : "PREVIOUS", "objectives" : [ { "description" : "Destroy INF Dirk", diff --git a/data/missions/clarke/03 - clarke defence #3.json b/data/missions/clarke/03 - clarke defence #3.json index 13057bd..c380a49 100644 --- a/data/missions/clarke/03 - clarke defence #3.json +++ b/data/missions/clarke/03 - clarke defence #3.json @@ -1,10 +1,10 @@ { "name" : "Clarke Defence #3", "description" : "We need continue taking down the enemy's captial ships, digging in, and holding the line here. More of our own cap ships are heading up the field to meet the Pandorans head on. UNF Cleopatra is moving to intecept more enemy corvettes. Your orders are to assist it in achieving its goals.", + "requires" : 18, "background" : "gfx/backgrounds/background04.jpg", "planet" : "gfx/planets/bluePlanet.png", "music" : "music/heroism.ogg", - "requires" : "PREVIOUS", "objectives" : [ { "description" : "Destroy INF Khopesh", diff --git a/data/missions/coyote/01 - coyote assault #1.json b/data/missions/coyote/01 - coyote assault #1.json index 90526ac..5fcc928 100644 --- a/data/missions/coyote/01 - coyote assault #1.json +++ b/data/missions/coyote/01 - coyote assault #1.json @@ -1,10 +1,10 @@ { "name" : "Coyote Assault #1", "description" : "Though we suffered heavy losses at Coyote, it is still important that we attempt to prevent, or at least slow, the Pandoran war machine's advance. Admiral Jenkins has ordered that the White Knights lead an attack on the enemy forces gathered in the system. The weight of the opposing forces remains tremendous, though the ATAFs should help to give us the edge in battle. Be advised that the enemy are now in possession of UNF fighter craft.", + "requires" : 2, "background" : "gfx/backgrounds/background03.jpg", "planet" : "gfx/planets/mythos.png", "music" : "music/heroism.ogg", - "requires" : "data/missions/temper/03 - pirate uprising #3.json", "objectives" : [ { "description" : "Destroy all enemy targets", diff --git a/data/missions/coyote/02 - coyote assault #2.json b/data/missions/coyote/02 - coyote assault #2.json index 6b1f5e7..0be7545 100644 --- a/data/missions/coyote/02 - coyote assault #2.json +++ b/data/missions/coyote/02 - coyote assault #2.json @@ -1,10 +1,10 @@ { "name" : "Coyote Assault #2", "description" : "The initial fight back against the Pandoran has gone well, but the system is still choked with their forces. We need to continue to engage them and force them to abandon the system.", + "requires" : 4, "background" : "gfx/backgrounds/background03.jpg", "planet" : "gfx/planets/mythos.png", "music" : "music/heroism.ogg", - "requires" : "PREVIOUS", "epic" : { "fighterLimit" : 12 }, diff --git a/data/missions/coyote/03 - coyote assault #3.json b/data/missions/coyote/03 - coyote assault #3.json index 0164456..19cf3d8 100644 --- a/data/missions/coyote/03 - coyote assault #3.json +++ b/data/missions/coyote/03 - coyote assault #3.json @@ -1,10 +1,10 @@ { "name" : "Coyote Assault #3", "description" : "The assault isn't going as well as we want, and we're beginning to suffer heavy losses as the Pandoran forces overwhelm us. However, we need to continue the fight back, and attempt to hold the enemy here. They cannot be allowed to advance further in to Independent space.", + "requires" : 8, "background" : "gfx/backgrounds/background03.jpg", "planet" : "gfx/planets/mythos.png", "music" : "music/heroism.ogg", - "requires" : "PREVIOUS", "epic" : { "fighterLimit" : 12 }, diff --git a/data/missions/granada/01 - suspect packages #1.json b/data/missions/granada/01 - suspect packages #1.json index 74f419b..e3cfb67 100644 --- a/data/missions/granada/01 - suspect packages #1.json +++ b/data/missions/granada/01 - suspect packages #1.json @@ -1,10 +1,10 @@ { "name" : "Suspect Packages #1", "description" : "A patrol group has sighted a number of crates drifting near to Alexandria. The contents of the crates is currently unknown, but they have been confirmed to be belong to the CSN. A shuttle has been dispatched to retrieve them, in case they should wander in to any shipping lanes. Once we have them in our possession, we will work to determine how they came to be here.", + "requires" : 3, "background" : "gfx/backgrounds/background03.jpg", "planet" : "gfx/planets/bluePlanet.png", "music" : "music/determination.mp3", - "requires" : "data/missions/coyote/01 - coyote assault #1.json", "objectives" : [ { "description" : "Retrieve all packages", diff --git a/data/missions/granada/02 - suspect packages #2.json b/data/missions/granada/02 - suspect packages #2.json index 6685425..f7a008a 100644 --- a/data/missions/granada/02 - suspect packages #2.json +++ b/data/missions/granada/02 - suspect packages #2.json @@ -2,9 +2,9 @@ "name" : "Suspect Packages #2", "description" : "The crates were found to be carrying a variety of munitions, though we're still unsure of where they came from. We're dispatching shuttles to accompany the next few patrols, in case we should encounter any more.", "background" : "gfx/backgrounds/background03.jpg", + "requires" : 4, "planet" : "gfx/planets/bluePlanet.png", "music" : "music/determination.mp3", - "requires" : "PREVIOUS", "objectives" : [ { "description" : "Check all wayponts", diff --git a/data/missions/granada/03 - suspect packages #3.json b/data/missions/granada/03 - suspect packages #3.json index 4637923..f41fd04 100644 --- a/data/missions/granada/03 - suspect packages #3.json +++ b/data/missions/granada/03 - suspect packages #3.json @@ -1,10 +1,10 @@ { "name" : "Suspect Packages #3", "description" : "The interogation of the pilot brought in earlier revealed that munitions are being traded with Helios' age-old enemy, the Nation of Tzac. The arms are being routed to Rothan, via Temper. This would explain the high pirate presence along the border. It doesn't explain why the packages were spilled, however, and our guest is keeping mum on the subject. Patrols are being stepped up, in an effort to help provide more intelligence.", + "requires" : 12, "background" : "gfx/backgrounds/background03.jpg", "planet" : "gfx/planets/bluePlanet.png", "music" : "music/determination.mp3", - "requires" : "PREVIOUS", "player" : { "pilot" : "Lt. Cdr. Daniel Carr", "squadron" : "Iron Patriots", diff --git a/data/missions/granada/04 - pirate smash.json b/data/missions/granada/04 - pirate smash.json index 8d3bbb5..62d74ff 100644 --- a/data/missions/granada/04 - pirate smash.json +++ b/data/missions/granada/04 - pirate smash.json @@ -1,10 +1,10 @@ { "name" : "Pirate Smash", "description" : "We finally have all the information we need to help safeguard the Confederation in these turbulent times. By smashing the pirate ring involved in the supplying of arms to Tzac, we can regain control of our internal security matters, and refocus on the war against the Pandorans. All targets must be destroyed, but be advised that the pirates have acquired rocket cannons, that could prove costly if underestimated.", + "requires" : 17, "background" : "gfx/backgrounds/background03.jpg", "planet" : "gfx/planets/bluePlanet.png", "music" : "music/track-4.mp3", - "requires" : "PREVIOUS", "player" : { "pilot" : "Lt. Cdr. Daniel Carr", "squadron" : "Iron Patriots", diff --git a/data/missions/iliad/01 - iliad defence #1.json b/data/missions/iliad/01 - iliad defence #1.json index f0f3398..81517a0 100644 --- a/data/missions/iliad/01 - iliad defence #1.json +++ b/data/missions/iliad/01 - iliad defence #1.json @@ -1,10 +1,10 @@ { "name" : "Iliad Defence #1", "description" : "The Pandorans have commenced their attack on our home, and we must act immediately to defend ourselves. A wave of bombers is heading towards one of our starports. They need to be taken down with haste, before they get in range. They may only be being escorted by Jackals, but bare in a mind that the Pandoran pilots are highly skilled, and unrelenting in battle.", + "requires" : 13, "background" : "gfx/backgrounds/background01.jpg", "planet" : "gfx/planets/bluePlanet.png", "music" : "music/track-3.mp3", - "requires" : "data/missions/warro/03 - evacuation #3.json", "objectives" : [ { "description" : "Destroy incoming bombers", diff --git a/data/missions/iliad/02 - iliad defence #2.json b/data/missions/iliad/02 - iliad defence #2.json index c3040c7..716c87c 100644 --- a/data/missions/iliad/02 - iliad defence #2.json +++ b/data/missions/iliad/02 - iliad defence #2.json @@ -1,10 +1,10 @@ { "name" : "Iliad Defence #2", "description" : "The Pandoran war machine has commenced its advancement beyond Mitikas space. We must prepare to defend Iliad from this powerful foe. Exercise caution: despite outnumbering the enemy units that have entered our space, the Pandorans are said to be relentless in battle, and this small number could well still test us.", + "requires" : 18, "background" : "gfx/backgrounds/background01.jpg", "planet" : "gfx/planets/bluePlanet.png", "music" : "music/heroism.ogg", - "requires" : "PREVIOUS", "epic" : { "fighterLimit" : 12 }, diff --git a/data/missions/mace/01 - rebel assault #1.json b/data/missions/mace/01 - rebel assault #1.json index 774c0f0..e5d1814 100644 --- a/data/missions/mace/01 - rebel assault #1.json +++ b/data/missions/mace/01 - rebel assault #1.json @@ -1,10 +1,10 @@ { - "name" : "", + "name" : "Rebel Assault #1", "description" : "", + "requires" : 23, "background" : "gfx/backgrounds/background03.jpg", "planet" : "gfx/planets/spirit.png", "music" : "music/InnerCore_Low.ogg", - "requires" : "data/missions/granada/04 - pirate smash.json", "player" : { "type" : "TAF", "pilot" : "", diff --git a/data/missions/temper/02 - pirate uprising #2.json b/data/missions/temper/02 - pirate uprising #2.json index ae61d01..cef2e01 100644 --- a/data/missions/temper/02 - pirate uprising #2.json +++ b/data/missions/temper/02 - pirate uprising #2.json @@ -1,10 +1,10 @@ { "name" : "Pirate Uprising #2", "description" : "Despite recent efforts, the pirate and insurgent activity shows no sign of abating. We need to continue to smash the rings as we find them and prevent them from gaining a foothold in Temper, as this could only be bad for morale and the war effort. While we still face Darts, the modifications to these craft are becoming more prevelant, and there are more shielded and plasma-equipped fighters to be found in their ranks.", + "requires" : 1, "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 6e14228..32d0484 100644 --- a/data/missions/temper/03 - pirate uprising #3.json +++ b/data/missions/temper/03 - pirate uprising #3.json @@ -1,10 +1,10 @@ { "name" : "Pirate Uprising #3", "description" : "Allied intelligence have managed to locate one of the pirate ring lieutenants. We need to bring this man in alive, as he could provide us with further useful information that will allow us to track down and eliminate high ranking individuals. You will be piloting a Ray, and will need to use your Mag cannons to disable the target. Do not destroy the lieutenant's Dart.", + "requires" : 2, "background" : "gfx/backgrounds/background03.jpg", "planet" : "gfx/planets/spirit.png", "music" : "music/battleThemeA.mp3", - "requires" : "PREVIOUS", "objectives" : [ { "description" : "Capture pirate lieutenant", diff --git a/data/missions/temper/04 - pirate uprising #4.json b/data/missions/temper/04 - pirate uprising #4.json index ce9dbc0..995eadd 100644 --- a/data/missions/temper/04 - pirate uprising #4.json +++ b/data/missions/temper/04 - pirate uprising #4.json @@ -1,10 +1,10 @@ { "name" : "Pirate Uprising #4", "description" : "It took some time, but we have finally been able to extract the required information from the lieutenant we captured. His information has revealed that the pirates have formed a coalition to take advantage of the brewing war. We need to smash this alliance apart by targetting the faction leaders. They are currently fleeing an earlier ambush, one designed to send them your way. The leaders are all piloting acquired Nymphs. Take them down.", + "requires" : 3, "background" : "gfx/backgrounds/background03.jpg", "planet" : "gfx/planets/spirit.png", "music" : "music/battleThemeA.mp3", - "requires" : "PREVIOUS", "objectives" : [ { "description" : "Eliminate pirate leaders", diff --git a/data/missions/temper/05 - pirate uprising #5.json b/data/missions/temper/05 - pirate uprising #5.json index 442d20b..06a0cf4 100644 --- a/data/missions/temper/05 - pirate uprising #5.json +++ b/data/missions/temper/05 - pirate uprising #5.json @@ -1,10 +1,10 @@ { "name" : "Pirate Uprising #5", - "description" : "", + "description" : "With the leaders all gone, we're now in a position to end the organised piracy problem in Temper for good. We have identified a number of Darts massing for what appears to be a strike against CSN assets, in retribution. We're not going to give the pirates the chance to do so, and strike them first. Strickland will lead the Steel Bulls into battle.", + "requires" : 4, "background" : "gfx/backgrounds/background03.jpg", "planet" : "gfx/planets/spirit.png", "music" : "music/battleThemeA.mp3", - "requires" : "PREVIOUS", "objectives" : [ { "description" : "Destroy all pirate forces", diff --git a/data/missions/warro/01 - evacuation #1.json b/data/missions/warro/01 - evacuation #1.json index 5ad3f9f..6a8206c 100644 --- a/data/missions/warro/01 - evacuation #1.json +++ b/data/missions/warro/01 - evacuation #1.json @@ -1,8 +1,8 @@ { "name" : "Evacuation #1", "description" : "As already confirmed by Neal Stockwell, the evacuation of Oracle IX in response to the supernova has not be progressing as rapidly as many would like. And now, with the Pandoran army on the move, we need to quicken the pace. A number of civilian stragglers has been identified near to Oracle IX, who are in need of escort to the evacuation point. Your objective is to locate all the civilation craft in the area, and bring them in. No enemy forces are expected, but it is best to be on your guard.", + "requires" : 3, "background" : "gfx/backgrounds/background03.jpg", - "requires" : "data/missions/temper/03 - pirate uprising #3.json", "planet" : "gfx/planets/oracleIX.png", "music" : "music/determination.mp3", "objectives" : [ diff --git a/data/missions/warro/02 - evacuation #2.json b/data/missions/warro/02 - evacuation #2.json index bc19792..027f332 100644 --- a/data/missions/warro/02 - evacuation #2.json +++ b/data/missions/warro/02 - evacuation #2.json @@ -1,10 +1,10 @@ { "name" : "Evacuation #2", "description" : "We have identified around a dozen more stragglers that need to be brought in. Lead them to the evacuation point as before. Take caution: intelligence picked up encrypted signals that appear to match those used by the Pandorans for their transmissions. Enemy forces should be engaged and destroyed or routed on contact. Civilian losses should be minimised.", + "requires" : 8, "background" : "gfx/backgrounds/background03.jpg", "planet" : "gfx/planets/oracleIX.png", "music" : "music/determination.mp3", - "requires" : "PREVIOUS", "objectives" : [ { "description" : "Rescue all civilians", diff --git a/data/missions/warro/03 - evacuation #3.json b/data/missions/warro/03 - evacuation #3.json index f0b3749..d0c1fe0 100644 --- a/data/missions/warro/03 - evacuation #3.json +++ b/data/missions/warro/03 - evacuation #3.json @@ -1,10 +1,10 @@ { "name" : "Evacuation #3", "description" : "The final stages of the evacuation are in progress, but the situation is getting tight. We've received an SOS from a group of civilians who have had a run in with some scavengers. Ordinarily, we would secure the area first before deploying rescue, but with the situation becoming ever desperate, we are going to send out the tug now. Bring home each civilian craft - the enemy should ignore them for now.", + "requires" : 8, "background" : "gfx/backgrounds/background03.jpg", "planet" : "gfx/planets/oracleIX.png", "music" : "music/determination.mp3", - "requires" : "PREVIOUS", "objectives" : [ { "description" : "Rescue all civilians", diff --git a/data/missions/warro/04 - evacuation #4.json b/data/missions/warro/04 - evacuation #4.json index 0dc3a18..3dff70e 100644 --- a/data/missions/warro/04 - evacuation #4.json +++ b/data/missions/warro/04 - evacuation #4.json @@ -1,10 +1,10 @@ { "name" : "Evacuation #4", "description" : "The Pandorans are here!.", + "requires" : 13, "background" : "gfx/backgrounds/background03.jpg", "planet" : "gfx/planets/oracleIX.png", "music" : "music/determination.mp3", - "requires" : "data/missions/iliad/02 - iliad defence #2.json", "objectives" : [ { "description" : "Rescue all civilians", diff --git a/src/galaxy/galacticMap.c b/src/galaxy/galacticMap.c index 4849b57..e766ff0 100644 --- a/src/galaxy/galacticMap.c +++ b/src/galaxy/galacticMap.c @@ -57,7 +57,6 @@ static int pulseTimer; static float ssx, ssy; static float arrowPulse; static int show; -static int completedMissions, totalMissions; void initGalacticMap(void) { @@ -77,8 +76,6 @@ void initGalacticMap(void) selectedStarSystem = getStarSystem(game.selectedStarSystem); - updateStarSystemDescriptions(); - centerOnSelectedStarSystem(); saveGame(); @@ -152,8 +149,6 @@ static void doStarSystems(void) StarSystem *starSystem; int cx, cy; - completedMissions = totalMissions = 0; - cx = app.mouse.x - 32; cy = app.mouse.y - 32; @@ -161,9 +156,6 @@ static void doStarSystems(void) for (starSystem = game.starSystemHead.next ; starSystem != NULL ; starSystem = starSystem->next) { - completedMissions += starSystem->completedMissions; - totalMissions += starSystem->totalMissions; - if (starSystem->totalMissions > 0 && collision(cx, cy, 64, 64, starSystem->x - camera.x, starSystem->y - camera.y, 4, 4)) { if (selectedStarSystem != starSystem) @@ -259,27 +251,19 @@ static void addPulses(void) pulse->x = starSystem->x; pulse->y = starSystem->y; pulse->life = 255; - pulse->r = 255; + + if (!starSystem->isSol) + { + pulse->r = 255; + } + else + { + pulse->g = 255; + } pulseTail->next = pulse; pulseTail = pulse; } - else if (starSystem->totalMissions > 0) - { - if (pulseTimer % (FPS * 3) == 0) - { - pulse = malloc(sizeof(Pulse)); - memset(pulse, 0, sizeof(Pulse)); - - pulse->x = starSystem->x; - pulse->y = starSystem->y; - pulse->life = 255; - pulse->g = 255; - - pulseTail->next = pulse; - pulseTail = pulse; - } - } } } @@ -430,7 +414,14 @@ static void drawGalaxy(void) if (aa != -1) { - SDL_SetTextureColorMod(arrowTexture, 255, 0, 0); + if (!starSystem->isSol) + { + SDL_SetTextureColorMod(arrowTexture, 255, 0, 0); + } + else + { + SDL_SetTextureColorMod(arrowTexture, 0, 255, 0); + } blitRotated(arrowTexture, ax, ay, aa); } @@ -466,7 +457,7 @@ static void drawInfoBars(void) SDL_RenderFillRect(app.renderer, &r); SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE); - drawText((SCREEN_WIDTH / 2), 5, 18, TA_CENTER, colors.white, "Missions: %d / %d", completedMissions, totalMissions); + drawText((SCREEN_WIDTH / 2), 5, 18, TA_CENTER, colors.white, "Missions: %d / %d", game.completedMissions, game.totalMissions); } static void selectStarSystem(void) diff --git a/src/galaxy/galacticMap.h b/src/galaxy/galacticMap.h index d1198dc..9a83384 100644 --- a/src/galaxy/galacticMap.h +++ b/src/galaxy/galacticMap.h @@ -37,7 +37,6 @@ extern void endSectionTransition(void); extern void saveGame(void); extern void blit(SDL_Texture *t, int x, int y, int centered); extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2); -extern void updateStarSystemDescriptions(void); extern void drawCircle(int cx, int cy, int radius, int r, int g, int b, int a); extern void playMusic(char *filename); extern void stopMusic(void); diff --git a/src/galaxy/mission.c b/src/galaxy/mission.c index ebd5b97..4bff541 100644 --- a/src/galaxy/mission.c +++ b/src/galaxy/mission.c @@ -702,29 +702,7 @@ Mission *getMission(char *filename) int isMissionAvailable(Mission *mission, Mission *prev) { - Mission *reqMission; - - if (!dev.debug) - { - 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; + return prev->completed && mission->requires <= game.completedMissions; } static unsigned long hashcode(const char *str) diff --git a/src/galaxy/starSystems.c b/src/galaxy/starSystems.c index c21a2b1..1acc34d 100644 --- a/src/galaxy/starSystems.c +++ b/src/galaxy/starSystems.c @@ -60,6 +60,11 @@ static void loadStarSystem(cJSON *starSystemJSON) starSystem->fallsToPandorans = cJSON_GetObjectItem(starSystemJSON, "fallsToPandorans")->valueint; } + if (strcmp(starSystem->name, "Sol") == 0) + { + starSystem->isSol = 1; + } + starSystem->missionHead.completed = 1; starSystem->missionTail = &starSystem->missionHead; @@ -123,7 +128,7 @@ static void loadMissionMeta(char *filename, StarSystem *starSystem) if (cJSON_GetObjectItem(root, "requires")) { - STRNCPY(mission->requires, cJSON_GetObjectItem(root, "requires")->valuestring, MAX_DESCRIPTION_LENGTH); + mission->requires = cJSON_GetObjectItem(root, "requires")->valueint; } if (cJSON_GetObjectItem(root, "epic")) @@ -182,56 +187,53 @@ StarSystem *getStarSystem(char *name) return NULL; } -void updateStarSystemDescriptions(void) +void updateStarSystemMissions(void) { StarSystem *starSystem; - Mission *mission; + Mission *mission, *prev; + + game.completedMissions = game.totalMissions = 0; for (starSystem = game.starSystemHead.next ; starSystem != NULL ; starSystem = starSystem->next) { - starSystem->completedMissions = starSystem->totalMissions; + starSystem->completedMissions = starSystem->totalMissions = 0; for (mission = starSystem->missionHead.next ; mission != NULL ; mission = mission->next) { - starSystem->totalMissions++; - if (mission->completed) { starSystem->completedMissions++; } } - sprintf(starSystem->description, "[ %s ] [ Missions %d / %d ]", starSystem->name, starSystem->completedMissions, starSystem->totalMissions); + if (strcmp(starSystem->name, "Sol") != 0) + { + game.completedMissions += starSystem->completedMissions; + } } -} - -void updateStarSystemMissions(void) -{ - StarSystem *starSystem; - Mission *mission, *prev; for (starSystem = game.starSystemHead.next ; starSystem != NULL ; starSystem = starSystem->next) { - starSystem->completedMissions = starSystem->totalMissions = 0; - prev = &starSystem->missionHead; for (mission = starSystem->missionHead.next ; mission != NULL ; mission = mission->next) { - mission->available = isMissionAvailable(mission, prev); + mission->available = strcmp(starSystem->name, "Sol") == 0 || isMissionAvailable(mission, prev); if (mission->available) { starSystem->totalMissions++; - - if (mission->completed) - { - starSystem->completedMissions++; - } } prev = mission; } + + if (strcmp(starSystem->name, "Sol") != 0) + { + game.totalMissions += starSystem->totalMissions; + } + + sprintf(starSystem->description, "[ %s ] [ Missions %d / %d ]", starSystem->name, starSystem->completedMissions, starSystem->totalMissions); } } diff --git a/src/structs.h b/src/structs.h index dc103e9..128e405 100644 --- a/src/structs.h +++ b/src/structs.h @@ -226,7 +226,7 @@ struct Mission { char name[MAX_NAME_LENGTH]; char description[MAX_DESCRIPTION_LENGTH]; char filename[MAX_DESCRIPTION_LENGTH]; - char requires[MAX_DESCRIPTION_LENGTH]; + int requires; char pilot[MAX_NAME_LENGTH]; char squadron[MAX_NAME_LENGTH]; char craft[MAX_NAME_LENGTH]; @@ -247,6 +247,7 @@ struct StarSystem { int completedMissions; int totalMissions; int fallsToPandorans; + int isSol; Mission missionHead, *missionTail; StarSystem *next; }; @@ -296,6 +297,8 @@ typedef struct { StarSystem starSystemHead, *starSystemTail; Mission *currentMission; char selectedStarSystem[MAX_NAME_LENGTH]; + int completedMissions; + int totalMissions; unsigned int stats[STAT_MAX]; } Game;