Missions now unlock depending on number of other missions completed (and previous mission, where applicable).

This commit is contained in:
Steve 2015-12-21 14:19:21 +00:00
parent b44b894c4b
commit 3dbd8e72f7
28 changed files with 71 additions and 98 deletions

View File

@ -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",

View File

@ -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",

View File

@ -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
},

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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
},

View File

@ -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
},

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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
},

View File

@ -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" : "",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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" : [

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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)

View File

@ -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);

View File

@ -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)

View File

@ -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);
}
}

View File

@ -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;