Use type in Star System instead of isSol, to allow for special Pandoran missions.

This commit is contained in:
Steve 2016-05-15 10:50:09 +01:00
parent 7865a22072
commit 0116202471
5 changed files with 40 additions and 22 deletions

View File

@ -139,6 +139,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MB_IMPORTANT 1 #define MB_IMPORTANT 1
#define MB_PANDORAN 2 #define MB_PANDORAN 2
#define SS_NORMAL 0
#define SS_SOL 1
#define SS_PANDORAN 2
enum enum
{ {
CONTROL_FIRE, CONTROL_FIRE,

View File

@ -299,16 +299,22 @@ static void addPulses(void)
pulse->x = starSystem->x; pulse->x = starSystem->x;
pulse->y = starSystem->y; pulse->y = starSystem->y;
pulse->life = 255; pulse->life = 255;
if (!starSystem->isSol) switch (starSystem->type)
{ {
pulse->r = 255; case SS_NORMAL:
pulse->r = 255;
break;
case SS_SOL:
pulse->g = 255;
break;
case SS_PANDORAN:
pulse->b = 255;
break;
} }
else
{
pulse->g = 255;
}
pulseTail->next = pulse; pulseTail->next = pulse;
pulseTail = pulse; pulseTail = pulse;
} }
@ -462,15 +468,21 @@ static void drawGalaxy(void)
if (aa != -1) if (aa != -1)
{ {
if (!starSystem->isSol) switch (starSystem->type)
{ {
SDL_SetTextureColorMod(arrowTexture, 255, 0, 0); case SS_NORMAL:
SDL_SetTextureColorMod(arrowTexture, 255, 0, 0);
break;
case SS_SOL:
SDL_SetTextureColorMod(arrowTexture, 0, 255, 0);
break;
case SS_PANDORAN:
SDL_SetTextureColorMod(arrowTexture, 0, 0, 255);
break;
} }
else
{
SDL_SetTextureColorMod(arrowTexture, 0, 255, 0);
}
blitRotated(arrowTexture, ax, ay, aa); blitRotated(arrowTexture, ax, ay, aa);
} }
} }
@ -593,7 +605,7 @@ static void drawStarSystemDetail(void)
drawText(525, SCREEN_HEIGHT - 95, 18, TA_LEFT, colors.yellow, _("Note: this is an Epic Mission.")); drawText(525, SCREEN_HEIGHT - 95, 18, TA_LEFT, colors.yellow, _("Note: this is an Epic Mission."));
} }
startMissionButton->enabled = (!game.currentMission->completed || selectedStarSystem->isSol); startMissionButton->enabled = (!game.currentMission->completed || selectedStarSystem->type == SS_SOL);
drawWidgets("starSystem"); drawWidgets("starSystem");
} }

View File

@ -57,10 +57,12 @@ static StarSystem *loadStarSystem(cJSON *starSystemJSON)
starSystem->x = cJSON_GetObjectItem(starSystemJSON, "x")->valueint; starSystem->x = cJSON_GetObjectItem(starSystemJSON, "x")->valueint;
starSystem->y = cJSON_GetObjectItem(starSystemJSON, "y")->valueint; starSystem->y = cJSON_GetObjectItem(starSystemJSON, "y")->valueint;
starSystem->fallsToPandorans = getJSONValue(starSystemJSON, "fallsToPandorans", 0); starSystem->fallsToPandorans = getJSONValue(starSystemJSON, "fallsToPandorans", 0);
starSystem->type = (starSystem->side != SIDE_PANDORAN) ? SS_NORMAL : SS_PANDORAN;
if (strcmp(starSystem->name, "Sol") == 0) if (strcmp(starSystem->name, "Sol") == 0)
{ {
starSystem->isSol = 1; starSystem->type = SS_SOL;
} }
starSystem->missionHead.completed = 1; starSystem->missionHead.completed = 1;
@ -148,7 +150,7 @@ void updateStarSystemMissions(void)
} }
} }
if (!starSystem->isSol) if (starSystem->type == SS_NORMAL)
{ {
game.totalMissions += starSystem->totalMissions; game.totalMissions += starSystem->totalMissions;
game.completedMissions += starSystem->completedMissions; game.completedMissions += starSystem->completedMissions;
@ -161,7 +163,7 @@ void updateStarSystemMissions(void)
for (mission = starSystem->missionHead.next ; mission != NULL ; mission = mission->next) for (mission = starSystem->missionHead.next ; mission != NULL ; mission = mission->next)
{ {
mission->available = starSystem->isSol || isMissionAvailable(mission, prev); mission->available = starSystem->type == SS_SOL || isMissionAvailable(mission, prev);
if (mission->available) if (mission->available)
{ {
@ -171,7 +173,7 @@ void updateStarSystemMissions(void)
prev = mission; prev = mission;
} }
if (!starSystem->isSol) if (starSystem->type == SS_NORMAL)
{ {
game.availableMissions += starSystem->availableMissions; game.availableMissions += starSystem->availableMissions;
} }

View File

@ -103,7 +103,7 @@ static void calculatePercentComplete(void)
for (starSystem = game.starSystemHead.next ; starSystem != NULL ; starSystem = starSystem->next) for (starSystem = game.starSystemHead.next ; starSystem != NULL ; starSystem = starSystem->next)
{ {
if (!starSystem->isSol) if (starSystem->type == SS_NORMAL)
{ {
completed += starSystem->completedMissions; completed += starSystem->completedMissions;
total += starSystem->totalMissions; total += starSystem->totalMissions;

View File

@ -297,7 +297,7 @@ struct StarSystem {
int totalMissions; int totalMissions;
int availableMissions; int availableMissions;
int fallsToPandorans; int fallsToPandorans;
int isSol; int type;
Mission missionHead; Mission missionHead;
StarSystem *next; StarSystem *next;
}; };