2011-08-24 14:14:44 +02:00
|
|
|
/*
|
|
|
|
Copyright (C) 2003 Parallel Realities
|
2015-03-01 21:37:32 +01:00
|
|
|
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
|
|
|
Copyright (C) 2012, 2015 Julian Marchant
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
2015-02-26 17:20:36 +01:00
|
|
|
as published by the Free Software Foundation; either version 3
|
2011-08-24 14:14:44 +02:00
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2015-02-26 17:20:36 +01:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2015-02-26 17:20:36 +01:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2011-08-24 14:14:44 +02:00
|
|
|
*/
|
|
|
|
|
2011-08-26 21:29:04 +02:00
|
|
|
#include "Starfighter.h"
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2012-03-11 15:19:25 +01:00
|
|
|
const char *systemNames[] = {"Spirit", "Eyananth", "Mordor", "Sol"};
|
|
|
|
|
|
|
|
const char *systemBackground[] = {
|
|
|
|
"gfx/spirit.jpg", "gfx/eyananth.jpg",
|
|
|
|
"gfx/mordor.jpg", "gfx/sol.jpg"
|
|
|
|
};
|
|
|
|
|
2011-08-24 14:14:44 +02:00
|
|
|
/*
|
|
|
|
Drives the cursor. Is used by some other screens too
|
|
|
|
*/
|
2011-08-26 21:29:04 +02:00
|
|
|
static void doCursor()
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
getPlayerInput();
|
|
|
|
|
2013-07-10 21:54:14 +02:00
|
|
|
limitInt(&engine.cursor_x, 10, screen->w - 10 - shape[0]->w);
|
|
|
|
limitInt(&engine.cursor_y, 10, screen->h - 10 - shape[0]->h);
|
2011-08-26 23:53:46 +02:00
|
|
|
blit(shape[0], engine.cursor_x, engine.cursor_y);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
Sets the player's current status information lines. These are the lines
|
|
|
|
that are scrolled up the screen when the player clicks on Current Status
|
|
|
|
These are set only once.
|
|
|
|
*/
|
2011-08-26 21:29:04 +02:00
|
|
|
static void setStatusLines()
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
char string[50];
|
|
|
|
|
|
|
|
sprintf(string, "System : %s", systemNames[currentGame.system]);
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(0, string, 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
signed char total = 0;
|
|
|
|
signed char completed = 0;
|
|
|
|
|
|
|
|
for (int i = 0 ; i < 10 ; i++)
|
|
|
|
{
|
|
|
|
if (systemPlanet[i].missionNumber > -1)
|
|
|
|
{
|
|
|
|
switch(systemPlanet[i].missionCompleted)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
total++;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
total++;
|
|
|
|
completed++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0 ; i < 30 ; i++)
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(i, "", 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
sprintf(string, "Missions Completed : %d/%d", completed, total);
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(1, string, 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
sprintf(string, "Shots Fired : %d", currentGame.shots);
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(2, string, 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
sprintf(string, "Hits Scored : %d", currentGame.hits);
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(3, string, 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
sprintf(string, "Accuracy : %d%%", currentGame.accuracy);
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(4, string, 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
sprintf(string, "Enemies Killed by Others : %d", currentGame.totalOtherKills);
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(5, string, 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
sprintf(string, "Total Cash Earned : %d", currentGame.cashEarned);
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(6, string, 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(7, "*** Chris ***", 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
sprintf(string, "Enemies Killed : %d", currentGame.totalKills);
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(8, string, 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
sprintf(string, "Shield Restores Picked Up : %d", currentGame.shieldPickups);
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(9, string, 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
sprintf(string, "Plasma Cells Picked Up : %d", currentGame.cellPickups);
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(10, string, 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
sprintf(string, "Rockets Picked Up : %d", currentGame.rocketPickups);
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(11, string, 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
sprintf(string, "Powerups Picked Up : %d", currentGame.rocketPickups);
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(12, string, 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
sprintf(string, "Mines Destroyed : %d", currentGame.minesKilled);
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(13, string, 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
sprintf(string, "Slaves Rescued : %d", currentGame.slavesRescued);
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(14, string, 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
sprintf(string, "Cargo Picked Up : %d", currentGame.cargoPickups);
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(15, string, 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
if (currentGame.hasWingMate1)
|
|
|
|
{
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(16, "*** Phoebe ***", 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
sprintf(string, "Enemies Killed : %d", currentGame.wingMate1Kills);
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(17, string, 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
sprintf(string, "Ejections : %d", currentGame.wingMate1Ejects);
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(18, string, 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (currentGame.hasWingMate2)
|
|
|
|
{
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(19, "*** Ursula ***", 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
sprintf(string, "Enemies Killed : %d", currentGame.wingMate2Kills);
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(20, string, 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
sprintf(string, "Ejections : %d", currentGame.wingMate2Ejects);
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(21, string, 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
signed char percentage = 0;
|
|
|
|
if ((currentGame.secondaryMissions > 0) && (currentGame.secondaryMissionsCompleted > 0))
|
|
|
|
percentage = (currentGame.secondaryMissionsCompleted / currentGame.secondaryMissions) * 100;
|
|
|
|
sprintf(string, "Seconday Missions Completed : %d / %d (%d%%)", currentGame.secondaryMissionsCompleted, currentGame.secondaryMissions, percentage);
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(24, string, 0, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
int timeTaken = currentGame.timeTaken;
|
|
|
|
|
2011-08-24 16:01:36 +02:00
|
|
|
snprintf(string, sizeof string, "Total Time : %2d:%02d:%02d", timeTaken / 3600, (timeTaken / 60) % 60, timeTaken % 60);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(26, string, -1, 0, FONT_WHITE);
|
|
|
|
textSurface(27, "Current Status", -1, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
textShape[0].y = 400;
|
|
|
|
textShape[0].x = 150;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
for (int i = 1 ; i < 25 ; i++)
|
|
|
|
{
|
2011-08-26 23:53:46 +02:00
|
|
|
textShape[i].y = textShape[i - 1].y + 20;
|
2011-08-24 14:14:44 +02:00
|
|
|
if ((i == 7) || (i == 16) || (i == 19))
|
2011-08-26 23:53:46 +02:00
|
|
|
textShape[i].y += 25;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
textShape[i].x = 150;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
textShape[26].y = 404;
|
|
|
|
textShape[27].y = 83;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
Sets the names and stats of the planets within the current system.
|
|
|
|
This will later be placed into a data file.
|
|
|
|
*/
|
2011-08-26 21:29:04 +02:00
|
|
|
static void setSystemPlanets()
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
FILE *fp;
|
|
|
|
|
|
|
|
char string[100];
|
|
|
|
strcpy(string, "");
|
|
|
|
|
|
|
|
switch (currentGame.system)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
strcpy(string, "data/planets_spirit.dat");
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
strcpy(string, "data/planets_eyananth.dat");
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
strcpy(string, "data/planets_mordor.dat");
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
strcpy(string, "data/planets_sol.dat");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
fp = fopen(string, "rb");
|
|
|
|
|
|
|
|
int distance;
|
|
|
|
char name[50];
|
|
|
|
int image;
|
|
|
|
|
|
|
|
for (int i = 0 ; i < 10 ; i++)
|
|
|
|
{
|
2015-02-27 20:53:23 +01:00
|
|
|
if (fscanf(fp, "%d %s %d", &distance, name, &image) < 3)
|
|
|
|
{
|
2015-02-27 23:59:25 +01:00
|
|
|
printf("Warning: Data for planet %i in \"%s\" is not correctly formatted\n", i, string);
|
2015-02-27 20:53:23 +01:00
|
|
|
break;
|
|
|
|
}
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
systemPlanet[i].y = distance;
|
|
|
|
strcpy(systemPlanet[i].name, name);
|
2011-08-26 23:53:46 +02:00
|
|
|
systemPlanet[i].image = shape[image];
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int messageMission;
|
|
|
|
int messageSlot;
|
|
|
|
char face[50];
|
|
|
|
char from[100];
|
|
|
|
char subject[100];
|
|
|
|
|
|
|
|
for (int i = 0 ; i < 10 ; i++)
|
|
|
|
{
|
2015-02-27 20:53:23 +01:00
|
|
|
if ((fscanf(fp, "%d %d %s%*c", &messageMission, &messageSlot, face) < 3) ||
|
|
|
|
(fscanf(fp, "%[^\n]%*c", from) < 1) ||
|
|
|
|
(fscanf(fp, "%[^\n]%*c", subject) < 1))
|
|
|
|
{
|
2015-02-27 23:59:25 +01:00
|
|
|
printf("Warning: Mission data for planet %i in \"%s\" is not correctly formatted\n", i, string);
|
2015-02-27 20:53:23 +01:00
|
|
|
break;
|
|
|
|
}
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
systemPlanet[i].messageMission = messageMission;
|
|
|
|
systemPlanet[i].messageSlot = messageSlot;
|
|
|
|
systemPlanet[i].faceImage = getFace(face);
|
|
|
|
|
|
|
|
strcpy(systemPlanet[i].from, from);
|
|
|
|
strcpy(systemPlanet[i].subject, subject);
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
Spins the planets around the sun, spaced according to their Y value
|
|
|
|
as defined in setSystemPlanets(). Moving the cursor over the planet
|
|
|
|
will show their name and their current status
|
|
|
|
*/
|
2012-02-29 14:12:22 +01:00
|
|
|
static bool showSystem(float x, float y, bool selectable)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
SDL_Rect r;
|
|
|
|
signed char planet = 0;
|
|
|
|
int planetSpace = systemPlanet[planet].y;
|
2011-08-26 16:55:46 +02:00
|
|
|
bool rtn = false;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
// Blit the sun
|
2011-08-26 23:53:46 +02:00
|
|
|
blit(shape[30], 370, 220);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
for (int i = 50 ; i < 300 ; i+= planetSpace)
|
|
|
|
{
|
|
|
|
x *= 0.75;
|
|
|
|
y *= 0.75;
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
circle(400, 250, i, screen, darkGrey);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-24 22:43:54 +02:00
|
|
|
r.x = int(400 + (sinf(x) * i));
|
|
|
|
r.y = int(250 + (cosf(y) * i));
|
2011-08-24 14:14:44 +02:00
|
|
|
r.w = 10;
|
|
|
|
r.h = 10;
|
|
|
|
|
|
|
|
r.x -= (systemPlanet[planet].image->w / 2);
|
|
|
|
r.y -= (systemPlanet[planet].image->h / 2);
|
2011-08-26 23:53:46 +02:00
|
|
|
blit(systemPlanet[planet].image, r.x, r.y);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-03-04 01:28:15 +01:00
|
|
|
if (selectable &&
|
|
|
|
collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6,
|
|
|
|
r.x, r.y, systemPlanet[planet].image->w,
|
|
|
|
systemPlanet[planet].image->h))
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2011-08-26 23:53:46 +02:00
|
|
|
drawString(systemPlanet[planet].name, -1, 545, FONT_WHITE);
|
2013-09-30 16:52:43 +02:00
|
|
|
if ((engine.keyState[KEY_FIRE]))
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
if (currentGame.system == 0)
|
|
|
|
{
|
|
|
|
currentGame.stationedPlanet = planet;
|
|
|
|
currentGame.destinationPlanet = planet;
|
|
|
|
currentGame.area = systemPlanet[currentGame.stationedPlanet].missionNumber;
|
|
|
|
strcpy(currentGame.stationedName, systemPlanet[currentGame.stationedPlanet].name);
|
2015-03-04 01:28:15 +01:00
|
|
|
saveGame(0);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
currentGame.destinationPlanet = planet;
|
|
|
|
strcpy(currentGame.destinationName, systemPlanet[currentGame.destinationPlanet].name);
|
|
|
|
}
|
|
|
|
|
2011-08-26 16:55:46 +02:00
|
|
|
rtn = true;
|
2013-09-30 16:52:43 +02:00
|
|
|
engine.keyState[KEY_FIRE] = 0;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
planet++;
|
|
|
|
if (systemPlanet[planet].y == -1)
|
|
|
|
break;
|
|
|
|
planetSpace = systemPlanet[planet].y;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rtn;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
Scrolls the player's current information up the screen. When
|
|
|
|
the specified status line reaches a certain Y value, the entire
|
|
|
|
list is reset and the information lines begin again from the bottom
|
|
|
|
(in other words, they loop around).
|
|
|
|
*/
|
2011-08-26 21:29:04 +02:00
|
|
|
static void showStatus(SDL_Surface *infoSurface)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2012-03-11 17:52:10 +01:00
|
|
|
float speed = 0.25;
|
|
|
|
|
2013-09-30 16:52:43 +02:00
|
|
|
if(engine.keyState[KEY_DOWN])
|
2012-03-11 17:52:10 +01:00
|
|
|
speed = 1;
|
2013-09-30 16:52:43 +02:00
|
|
|
else if(engine.keyState[KEY_UP])
|
2012-03-11 17:52:10 +01:00
|
|
|
speed = -1;
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
blit(infoSurface, 100, 80);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
for (int i = 0 ; i < 22 ; i++)
|
|
|
|
{
|
2012-03-11 17:52:10 +01:00
|
|
|
textShape[i].y -= speed;
|
2011-08-26 23:53:46 +02:00
|
|
|
if ((textShape[i].y > 80) && (textShape[i].y < 400))
|
|
|
|
blitText(i);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
if (textShape[21].y < 65)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2011-08-26 23:53:46 +02:00
|
|
|
textShape[0].y = 400;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
for (int i = 1 ; i < 25 ; i++)
|
|
|
|
{
|
2011-08-26 23:53:46 +02:00
|
|
|
textShape[i].y = textShape[i - 1].y + 20;
|
2011-08-24 14:14:44 +02:00
|
|
|
if ((i == 7) || (i == 16) || (i == 19))
|
2011-08-26 23:53:46 +02:00
|
|
|
textShape[i].y += 25;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
blevelRect(100, 80, 600, 20, 0x00, 0x00, 0x99);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
blevelRect(100, 400, 600, 20, 0x00, 0x00, 0x99);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
blitText(26);
|
|
|
|
blitText(27);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2011-08-26 21:29:04 +02:00
|
|
|
static void createOptions(SDL_Surface *optionsSurface)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2011-08-26 23:53:46 +02:00
|
|
|
SDL_FillRect(optionsSurface, NULL, black);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
blevelRect(optionsSurface, 0, 0, optionsSurface->w - 2, optionsSurface->h - 2, 0x00, 0x00, 0x44);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
drawString("++ OPTIONS ++", 105, 8, FONT_WHITE, optionsSurface);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
blevelRect(optionsSurface, 190, 45, 50, 22, 0x00, 0x00, 0x00);
|
|
|
|
blevelRect(optionsSurface, 250, 45, 50, 22, 0x00, 0x00, 0x00);
|
|
|
|
blevelRect(optionsSurface, 20, 45, 150, 22, 0x00, 0x00, 0x00);
|
2011-08-26 22:48:52 +02:00
|
|
|
if (engine.useSound)
|
2011-08-26 23:53:46 +02:00
|
|
|
blevelRect(optionsSurface, 190, 45, 50, 22, 0xff, 0x00, 0x00);
|
2011-08-24 14:14:44 +02:00
|
|
|
else
|
2011-08-26 23:53:46 +02:00
|
|
|
blevelRect(optionsSurface, 250, 45, 50, 22, 0xff, 0x00, 0x00);
|
|
|
|
drawString("ON", 207, 50, FONT_WHITE, optionsSurface);
|
|
|
|
drawString("OFF", 263, 50, FONT_WHITE, optionsSurface);
|
|
|
|
drawString("SOUND", 30, 50, FONT_WHITE, optionsSurface);
|
|
|
|
|
|
|
|
blevelRect(optionsSurface, 190, 95, 50, 22, 0x00, 0x00, 0x00);
|
|
|
|
blevelRect(optionsSurface, 250, 95, 50, 22, 0x00, 0x00, 0x00);
|
|
|
|
blevelRect(optionsSurface, 20, 95, 150, 22, 0x00, 0x00, 0x00);
|
2011-08-26 22:48:52 +02:00
|
|
|
if (engine.useMusic)
|
2011-08-26 23:53:46 +02:00
|
|
|
blevelRect(optionsSurface, 190, 95, 50, 22, 0xff, 0x00, 0x00);
|
2011-08-24 14:14:44 +02:00
|
|
|
else
|
2011-08-26 23:53:46 +02:00
|
|
|
blevelRect(optionsSurface, 250, 95, 50, 22, 0xff, 0x00, 0x00);
|
|
|
|
drawString("ON", 207, 100, FONT_WHITE, optionsSurface);
|
|
|
|
drawString("OFF", 263, 100, FONT_WHITE, optionsSurface);
|
|
|
|
drawString("MUSIC", 30, 100, FONT_WHITE, optionsSurface);
|
|
|
|
|
|
|
|
blevelRect(optionsSurface, 190, 145, 50, 22, 0x00, 0x00, 0x00);
|
|
|
|
blevelRect(optionsSurface, 250, 145, 50, 22, 0x00, 0x00, 0x00);
|
|
|
|
blevelRect(optionsSurface, 20, 145, 150, 22, 0x00, 0x00, 0x00);
|
2011-08-26 22:48:52 +02:00
|
|
|
if (engine.fullScreen)
|
2011-08-26 23:53:46 +02:00
|
|
|
blevelRect(optionsSurface, 190, 145, 50, 22, 0xff, 0x00, 0x00);
|
2011-08-24 14:14:44 +02:00
|
|
|
else
|
2011-08-26 23:53:46 +02:00
|
|
|
blevelRect(optionsSurface, 250, 145, 50, 22, 0xff, 0x00, 0x00);
|
|
|
|
drawString("ON", 207, 150, FONT_WHITE, optionsSurface);
|
|
|
|
drawString("OFF", 263, 150, FONT_WHITE, optionsSurface);
|
|
|
|
drawString("FULLSCREEN", 30, 150, FONT_WHITE, optionsSurface);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2011-08-26 21:29:04 +02:00
|
|
|
static void showOptions(SDL_Surface *optionsSurface)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2013-09-30 16:52:43 +02:00
|
|
|
if ((engine.keyState[KEY_FIRE]))
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2011-08-26 23:27:16 +02:00
|
|
|
if (collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 417, 172, 45, 22))
|
2011-08-26 22:48:52 +02:00
|
|
|
engine.useSound = true;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 23:27:16 +02:00
|
|
|
if (collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 478, 172, 45, 22))
|
2011-08-26 22:48:52 +02:00
|
|
|
engine.useSound = false;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
|
2011-08-26 23:27:16 +02:00
|
|
|
if (collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 417, 222, 45, 22))
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2011-08-26 22:48:52 +02:00
|
|
|
engine.useMusic = true;
|
2011-08-24 14:14:44 +02:00
|
|
|
if (engine.useAudio)
|
|
|
|
{
|
|
|
|
if (Mix_PausedMusic() == 1)
|
|
|
|
Mix_ResumeMusic();
|
|
|
|
else
|
|
|
|
Mix_PlayMusic(engine.music, -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-26 23:27:16 +02:00
|
|
|
if (collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 478, 222, 45, 22))
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2011-08-26 22:48:52 +02:00
|
|
|
engine.useMusic = false;
|
2011-08-24 14:14:44 +02:00
|
|
|
if (engine.useAudio)
|
|
|
|
Mix_PauseMusic();
|
|
|
|
}
|
|
|
|
|
2011-08-26 23:27:16 +02:00
|
|
|
if (collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 417, 272, 45, 22))
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2011-08-26 22:48:52 +02:00
|
|
|
if (!engine.fullScreen)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2013-09-30 16:52:43 +02:00
|
|
|
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
2011-08-26 22:48:52 +02:00
|
|
|
engine.fullScreen = true;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-26 23:27:16 +02:00
|
|
|
if (collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 478, 272, 45, 22))
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2011-08-26 22:48:52 +02:00
|
|
|
if (engine.fullScreen)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2013-09-30 16:52:43 +02:00
|
|
|
SDL_SetWindowFullscreen(window, 0);
|
2011-08-26 22:48:52 +02:00
|
|
|
engine.fullScreen = false;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
createOptions(optionsSurface);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
Oddly named function that controls the entire intermission
|
|
|
|
screen. This simply draws a background, stars, gridlines and the icons
|
|
|
|
at the bottom of the screen. Will call (and continue to call) the specified
|
|
|
|
functions when the player has selected an icon.
|
|
|
|
*/
|
|
|
|
int galaxyMap()
|
|
|
|
{
|
2011-08-26 23:53:46 +02:00
|
|
|
freeGraphics();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
checkForBossMission(); // double check just to make sure!
|
|
|
|
|
|
|
|
// Tell the game we are not in a mission so
|
|
|
|
// do not perform certain keyboard actions
|
|
|
|
engine.gameSection = SECTION_INTERMISSION;
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
clearScreen(black);
|
|
|
|
updateScreen();
|
|
|
|
clearScreen(black);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
initSaveSlots();
|
|
|
|
|
2015-02-26 20:18:27 +01:00
|
|
|
loadMusic("music/through_space.ogg");
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2012-03-11 15:19:25 +01:00
|
|
|
loadBackground(systemBackground[currentGame.system]);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
char string[25];
|
|
|
|
|
2012-03-14 16:54:48 +01:00
|
|
|
engine.cursor_x = screen->w / 2;
|
|
|
|
engine.cursor_y = screen->h / 2;
|
2011-08-27 16:18:29 +02:00
|
|
|
shape[0] = loadImage("gfx/cursor.png");
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
// Icons 1 - 29
|
|
|
|
for (int i = 0 ; i < 26 ; i++)
|
|
|
|
{
|
2011-08-27 16:18:29 +02:00
|
|
|
sprintf(string, "gfx/icon%d.png", (i + 1));
|
2011-08-26 23:53:46 +02:00
|
|
|
shape[i + 1] = loadImage(string);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2011-08-27 16:18:29 +02:00
|
|
|
shape[27] = loadImage("gfx/buyIcon.png");
|
|
|
|
shape[28] = loadImage("gfx/sellIcon.png");
|
2011-08-26 23:53:46 +02:00
|
|
|
shape[29] = loadImage("gfx/firefly1.png");
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
// Planets 30 - 39
|
2011-08-27 16:18:29 +02:00
|
|
|
shape[30] = loadImage("gfx/planet_sun.png");
|
|
|
|
shape[31] = loadImage("gfx/planet_green.png");
|
|
|
|
shape[32] = loadImage("gfx/planet_blue.png");
|
|
|
|
shape[33] = loadImage("gfx/planet_red.png");
|
|
|
|
shape[34] = loadImage("gfx/planet_orange.png");
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
// Faces (as defines)
|
2011-08-26 23:53:46 +02:00
|
|
|
shape[FACE_CHRIS] = loadImage("gfx/face_chris.png");
|
|
|
|
shape[FACE_SID] = loadImage("gfx/face_sid.png");
|
|
|
|
shape[FACE_KRASS] = loadImage("gfx/face_krass.png");
|
|
|
|
shape[FACE_PHOEBE] = loadImage("gfx/face_phoebe.png");
|
|
|
|
shape[FACE_URSULA] = loadImage("gfx/face_ursula.png");
|
|
|
|
shape[FACE_KLINE] = loadImage("gfx/face_kline.png");
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
engine.done = 0;
|
2013-09-30 16:52:43 +02:00
|
|
|
engine.keyState[KEY_FIRE] = 0;
|
2015-02-27 05:23:08 +01:00
|
|
|
engine.ssx = 0;
|
|
|
|
engine.ssy = 0;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
SDL_Rect r;
|
|
|
|
SDL_Rect destRect;
|
|
|
|
int distance = 0;
|
|
|
|
int interceptionChance = 0;
|
|
|
|
|
|
|
|
setStatusLines();
|
|
|
|
initShop();
|
|
|
|
setSystemPlanets();
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
SDL_Surface *statsSurface = alphaRect(600, 330, 0x00, 0x00, 0x99);
|
|
|
|
SDL_Surface *savesSurface = createSurface(350, 300);
|
|
|
|
SDL_Surface *optionsSurface = createSurface(320, 240);
|
|
|
|
SDL_Surface *commsSurface = createSurface(450, 400);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
createSavesSurface(savesSurface, -1);
|
|
|
|
createOptions(optionsSurface);
|
|
|
|
createCommsSurface(commsSurface);
|
|
|
|
|
|
|
|
signed char section = 1;
|
|
|
|
|
|
|
|
float sinX = 300;
|
|
|
|
float cosY = 300;
|
2011-08-26 16:55:46 +02:00
|
|
|
bool movePlanets = true;
|
2011-08-24 14:14:44 +02:00
|
|
|
signed char saveSlot = -1;
|
|
|
|
|
Several adjustments for difficulty purposes.
Started out adjusting prices, then ended up doing other things
while testing. Committing this now before I start doing other
random stuff!
But all of the changes are related to balancing difficulty, mostly
with prices, except for a couple bugfixes in the shop. Most notably:
* Ammo now costs $10, not $50. You no longer have to worry about
saving ammo quite as much as a result.
* Plasma upgrades' cost is now calculated differently, and the result
is slightly lower prices than before.
* Easy mode now grants the player more max ammo than other difficulties.
* Increasing max plasma ammo now costs less at the start, and increases
in cost faster.
* You increase max plasma ammo by 25 at a time, not 10. (10 was just too
small of a number.)
* Destroying enemy ships no longer gives you money. I found that, even
in hard mode, I had *way* too much money coming in, and this cuts it
down substantially. It also makes the shield bonus at the end of missions
much more significant. To compensate for the loss of massive bonuses
bosses used to give, these bosses now drop a lot more stuff.
* Kline has decreased health in his first encounter, and increased health
in his last two encounters (the numbers have been reversed).
2015-03-07 18:19:35 +01:00
|
|
|
// Remove the Supercharge, if it is there
|
|
|
|
if (currentGame.difficulty > DIFFICULTY_EASY)
|
|
|
|
{
|
|
|
|
weapon[W_PLAYER_WEAPON].reload[0] = max(weapon[W_PLAYER_WEAPON].reload[0],
|
|
|
|
rate2reload[currentGame.maxPlasmaRate]);
|
|
|
|
weapon[W_PLAYER_WEAPON].ammo[0] = min(weapon[W_PLAYER_WEAPON].ammo[0],
|
|
|
|
currentGame.maxPlasmaOutput);
|
|
|
|
weapon[W_PLAYER_WEAPON].damage = min(weapon[W_PLAYER_WEAPON].damage,
|
|
|
|
currentGame.maxPlasmaDamage);
|
|
|
|
}
|
|
|
|
|
2011-08-24 14:14:44 +02:00
|
|
|
if (currentGame.system > 0)
|
|
|
|
interceptionChance = (300 / currentGame.system);
|
|
|
|
|
|
|
|
// There is no chance of being interceptted after the final attack on Earth
|
|
|
|
if ((currentGame.system == 3) && (systemPlanet[2].missionCompleted))
|
|
|
|
interceptionChance = 0;
|
|
|
|
|
|
|
|
int rtn = 0;
|
|
|
|
|
2011-08-26 22:48:52 +02:00
|
|
|
if ((engine.useAudio) && (engine.useMusic))
|
2011-08-24 14:14:44 +02:00
|
|
|
Mix_PlayMusic(engine.music, -1);
|
|
|
|
|
|
|
|
textObject iconInfo[12];
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
iconInfo[0].image = textSurface("Start Next Mission", FONT_WHITE);
|
|
|
|
iconInfo[1].image = textSurface("View System Map", FONT_WHITE);
|
|
|
|
iconInfo[2].image = textSurface("Current Status", FONT_WHITE);
|
|
|
|
iconInfo[3].image = textSurface("Save Game", FONT_WHITE);
|
|
|
|
iconInfo[4].image = textSurface("Upgrade FIREFLY", FONT_WHITE);
|
|
|
|
iconInfo[5].image = textSurface("Comms", FONT_WHITE);
|
|
|
|
iconInfo[6].image = textSurface("Options", FONT_WHITE);
|
|
|
|
iconInfo[7].image = textSurface("Exit to Title Screen", FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
sprintf(string, "System : %s", systemNames[currentGame.system]);
|
2011-08-26 23:53:46 +02:00
|
|
|
iconInfo[8].image = textSurface(string, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
sprintf(string, "Stationed At: %s", systemPlanet[currentGame.stationedPlanet].name);
|
2011-08-26 23:53:46 +02:00
|
|
|
iconInfo[9].image = textSurface(string, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
if (currentGame.destinationPlanet > -1)
|
|
|
|
sprintf(string, "Destination: %s", systemPlanet[currentGame.destinationPlanet].name);
|
2012-03-11 15:23:12 +01:00
|
|
|
else
|
|
|
|
strcpy(string, "Destination: None");
|
2011-08-26 23:53:46 +02:00
|
|
|
iconInfo[10].image = textSurface(string, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
for (int i = 0 ; i < 9 ; i++)
|
|
|
|
iconInfo[i].x = (800 - iconInfo[i].image->w) / 2;
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
iconInfo[11].image = textSurface("Go to Destination Planet", FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 16:55:46 +02:00
|
|
|
bool redrawBackGround = true;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
if (currentGame.distanceCovered > 0)
|
|
|
|
section = 0;
|
|
|
|
else
|
|
|
|
player.shield = player.maxShield;
|
|
|
|
|
|
|
|
flushInput();
|
2013-09-30 16:52:43 +02:00
|
|
|
engine.keyState[KEY_FIRE] = engine.keyState[KEY_ALTFIRE] = 0;
|
2011-08-24 14:14:44 +02:00
|
|
|
engine.done = 0;
|
|
|
|
|
|
|
|
while (!engine.done)
|
|
|
|
{
|
2011-08-26 23:53:46 +02:00
|
|
|
updateScreen();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
if (redrawBackGround)
|
|
|
|
{
|
2011-08-26 23:53:46 +02:00
|
|
|
drawBackGround();
|
2011-08-26 16:55:46 +02:00
|
|
|
redrawBackGround = false;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-08-26 23:53:46 +02:00
|
|
|
unBuffer();
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
doStarfield();
|
|
|
|
|
|
|
|
r.x = 0;
|
|
|
|
r.y = 0;
|
2012-03-12 04:16:56 +01:00
|
|
|
r.h = screen->h;
|
2011-08-24 14:14:44 +02:00
|
|
|
r.w = 1;
|
2012-03-12 04:16:56 +01:00
|
|
|
for (int i = 40 ; i < screen->w ; i+= 40)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
r.x = i;
|
2011-08-26 23:53:46 +02:00
|
|
|
SDL_FillRect(screen, &r, darkerBlue);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
r.x = 0;
|
|
|
|
r.y = 0;
|
|
|
|
r.h = 1;
|
2012-03-12 04:16:56 +01:00
|
|
|
r.w = screen->w;
|
|
|
|
for (int i = 40 ; i < screen->h ; i+= 40)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
r.y = i;
|
2011-08-26 23:53:46 +02:00
|
|
|
SDL_FillRect(screen, &r, darkerBlue);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (rand() % 1000 < 2)
|
|
|
|
{
|
2011-08-26 23:27:16 +02:00
|
|
|
engine.ssx = rrand(100, 100);
|
|
|
|
engine.ssy = rrand(100, 100);
|
2011-08-24 14:14:44 +02:00
|
|
|
engine.ssx /= 100;
|
|
|
|
engine.ssy /= 100;
|
|
|
|
}
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
blit(iconInfo[8].image, (int)iconInfo[8].x, 15);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
switch(section)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
if (currentGame.stationedPlanet == currentGame.destinationPlanet)
|
|
|
|
{
|
|
|
|
currentGame.area = systemPlanet[currentGame.stationedPlanet].missionNumber;
|
|
|
|
rtn = 2;
|
|
|
|
engine.done = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
distance = abs(currentGame.stationedPlanet - currentGame.destinationPlanet);
|
|
|
|
distance = (5 / distance);
|
|
|
|
if (distance < 1)
|
|
|
|
distance = 1;
|
|
|
|
|
|
|
|
SDL_FreeSurface(iconInfo[9].image);
|
2011-08-26 23:53:46 +02:00
|
|
|
iconInfo[9].image = textSurface(systemPlanet[currentGame.stationedPlanet].name, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
SDL_FreeSurface(iconInfo[10].image);
|
2011-08-26 23:53:46 +02:00
|
|
|
iconInfo[10].image = textSurface(systemPlanet[currentGame.destinationPlanet].name, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
section = 8;
|
|
|
|
|
|
|
|
destRect.x = 180;
|
|
|
|
destRect.y = 450;
|
|
|
|
destRect.w = 1;
|
|
|
|
if (currentGame.distanceCovered > 0)
|
|
|
|
destRect.w = currentGame.distanceCovered;
|
|
|
|
destRect.h = 20;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2013-09-30 16:52:43 +02:00
|
|
|
if (engine.keyState[KEY_ALTFIRE])
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
movePlanets = !movePlanets;
|
2013-09-30 16:52:43 +02:00
|
|
|
engine.keyState[KEY_ALTFIRE] = 0;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (movePlanets)
|
|
|
|
{
|
|
|
|
sinX += 0.01;
|
|
|
|
cosY += 0.01;
|
|
|
|
}
|
|
|
|
|
2012-02-29 14:12:22 +01:00
|
|
|
if (showSystem(sinX, cosY, true))
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
if (currentGame.system == 0)
|
|
|
|
{
|
|
|
|
sprintf(string, "Stationed At: %s", systemPlanet[currentGame.stationedPlanet].name);
|
|
|
|
SDL_FreeSurface(iconInfo[9].image);
|
2011-08-26 23:53:46 +02:00
|
|
|
iconInfo[9].image = textSurface(string, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
updateCommsSurface(commsSurface);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprintf(string, "Destination: %s", systemPlanet[currentGame.destinationPlanet].name);
|
|
|
|
SDL_FreeSurface(iconInfo[10].image);
|
2011-08-26 23:53:46 +02:00
|
|
|
iconInfo[10].image = textSurface(string, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
blit(iconInfo[9].image, 90, 450);
|
2011-08-24 14:14:44 +02:00
|
|
|
if ((currentGame.system > 0) && (currentGame.stationedPlanet != currentGame.destinationPlanet))
|
2011-08-26 23:53:46 +02:00
|
|
|
blit(iconInfo[10].image, 550, 450);
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
showStatus(statsSurface);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2011-08-26 23:53:46 +02:00
|
|
|
blit(savesSurface, 200, 100);
|
2011-08-24 14:14:44 +02:00
|
|
|
saveSlot = showSaveSlots(savesSurface, saveSlot);
|
|
|
|
break;
|
|
|
|
|
2012-02-29 14:12:22 +01:00
|
|
|
case 4:
|
|
|
|
showShop();
|
|
|
|
break;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
case 5:
|
2011-08-26 23:53:46 +02:00
|
|
|
blit(commsSurface, 170, 70);
|
2011-08-24 14:14:44 +02:00
|
|
|
doComms(commsSurface);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 6:
|
2011-08-26 23:53:46 +02:00
|
|
|
blit(optionsSurface, 230, 130);
|
2011-08-24 14:14:44 +02:00
|
|
|
showOptions(optionsSurface);
|
|
|
|
break;
|
|
|
|
|
2012-02-29 14:12:22 +01:00
|
|
|
case 7:
|
|
|
|
rtn = 0;
|
2011-08-24 14:14:44 +02:00
|
|
|
engine.done = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 8:
|
2012-02-29 14:12:22 +01:00
|
|
|
showSystem(sinX, cosY, false);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
blit(systemPlanet[currentGame.stationedPlanet].image, 150, 450);
|
|
|
|
blit(iconInfo[9].image, 135, 480);
|
|
|
|
blit(systemPlanet[currentGame.destinationPlanet].image, 650, 450);
|
|
|
|
blit(iconInfo[10].image, 635, 480);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
destRect.w += distance;
|
2011-08-26 23:53:46 +02:00
|
|
|
SDL_FillRect(screen, &destRect, red);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
if (destRect.w >= 450)
|
|
|
|
{
|
|
|
|
currentGame.stationedPlanet = currentGame.destinationPlanet;
|
|
|
|
currentGame.distanceCovered = 0;
|
|
|
|
player.shield = player.maxShield;
|
2015-03-04 01:28:15 +01:00
|
|
|
sprintf(string, "Stationed At: %s",
|
|
|
|
systemPlanet[currentGame.stationedPlanet].name);
|
|
|
|
strcpy(currentGame.stationedName,
|
|
|
|
systemPlanet[currentGame.stationedPlanet].name);
|
2011-08-24 14:14:44 +02:00
|
|
|
SDL_FreeSurface(iconInfo[9].image);
|
2011-08-26 23:53:46 +02:00
|
|
|
iconInfo[9].image = textSurface(string, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
updateCommsSurface(commsSurface);
|
|
|
|
section = 1;
|
2011-08-26 16:55:46 +02:00
|
|
|
redrawBackGround = true;
|
2015-03-04 01:28:15 +01:00
|
|
|
saveGame(0);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
2012-03-11 13:12:12 +01:00
|
|
|
else if (interceptionChance > 0)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
if ((rand() % interceptionChance) == 0)
|
|
|
|
{
|
|
|
|
currentGame.area = MAX_MISSIONS - 1;
|
|
|
|
rtn = 2;
|
|
|
|
engine.done = 1;
|
|
|
|
currentGame.distanceCovered = destRect.w;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
addBuffer(300, 545, 200, 15);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
if (section != 8)
|
|
|
|
{
|
|
|
|
for (int i = 0 ; i < 8 ; i++)
|
|
|
|
{
|
2015-03-04 01:28:15 +01:00
|
|
|
// if the mission has been completed, there is no
|
|
|
|
// "Start Next Mission" icon
|
2011-08-24 14:14:44 +02:00
|
|
|
if (i == 0)
|
|
|
|
{
|
2015-03-04 01:28:15 +01:00
|
|
|
if ((currentGame.stationedPlanet == currentGame.destinationPlanet) &&
|
|
|
|
(systemPlanet[currentGame.stationedPlanet].missionCompleted != 0))
|
2011-08-24 14:14:44 +02:00
|
|
|
continue;
|
|
|
|
else if (currentGame.stationedPlanet == currentGame.destinationPlanet)
|
2011-08-26 23:53:46 +02:00
|
|
|
blit(shape[1], 80 + (i * 90), 500);
|
2011-08-24 14:14:44 +02:00
|
|
|
else if (currentGame.stationedPlanet != currentGame.destinationPlanet)
|
2011-08-26 23:53:46 +02:00
|
|
|
blit(shape[26], 80 + (i * 90), 500);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-08-26 23:53:46 +02:00
|
|
|
blit(shape[i + 1], 80 + (i * 90), 500);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2011-08-26 23:27:16 +02:00
|
|
|
if (collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 80 + (i * 90), 500, 32, 32))
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
if (i != 0)
|
|
|
|
{
|
2011-08-26 23:53:46 +02:00
|
|
|
blit(iconInfo[i].image, (int)iconInfo[i].x, 545);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (currentGame.stationedPlanet == currentGame.destinationPlanet)
|
2011-08-26 23:53:46 +02:00
|
|
|
blit(iconInfo[0].image, (int)iconInfo[i].x, 545);
|
2011-08-24 14:14:44 +02:00
|
|
|
else
|
2011-08-26 23:53:46 +02:00
|
|
|
blit(iconInfo[11].image, (int)iconInfo[i].x, 545);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2013-09-30 16:52:43 +02:00
|
|
|
if ((engine.keyState[KEY_FIRE]))
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2011-08-26 16:55:46 +02:00
|
|
|
redrawBackGround = true;
|
2011-08-24 14:14:44 +02:00
|
|
|
section = i;
|
2013-09-30 16:52:43 +02:00
|
|
|
engine.keyState[KEY_FIRE] = 0;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-30 16:52:43 +02:00
|
|
|
engine.keyState[KEY_FIRE] = engine.keyState[KEY_ALTFIRE] = 0;
|
2011-08-24 14:14:44 +02:00
|
|
|
doCursor();
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
delayFrame();
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Mix_HaltMusic();
|
|
|
|
SDL_FreeSurface(statsSurface);
|
|
|
|
SDL_FreeSurface(savesSurface);
|
|
|
|
SDL_FreeSurface(optionsSurface);
|
|
|
|
SDL_FreeSurface(commsSurface);
|
|
|
|
for (int i = 0 ; i < 12 ; i++)
|
|
|
|
SDL_FreeSurface(iconInfo[i].image);
|
|
|
|
|
|
|
|
if (currentGame.distanceCovered == 0)
|
|
|
|
player.shield = player.maxShield;
|
|
|
|
|
|
|
|
return rtn;
|
|
|
|
}
|
|
|
|
|