Autosave when changing planets and when buying/selling.
Previously, it just saved after completing a mission, so it wasn't something you could really rely on. Now it saves every time something changes.
This commit is contained in:
parent
cc6989328d
commit
3d1ad2b674
|
@ -335,7 +335,6 @@ int mainGameLoop()
|
||||||
if (currentGame.area < 26)
|
if (currentGame.area < 26)
|
||||||
{
|
{
|
||||||
updateSystemStatus();
|
updateSystemStatus();
|
||||||
|
|
||||||
saveGame(0);
|
saveGame(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -273,7 +273,10 @@ static bool showSystem(float x, float y, bool selectable)
|
||||||
r.y -= (systemPlanet[planet].image->h / 2);
|
r.y -= (systemPlanet[planet].image->h / 2);
|
||||||
blit(systemPlanet[planet].image, r.x, r.y);
|
blit(systemPlanet[planet].image, r.x, r.y);
|
||||||
|
|
||||||
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))
|
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))
|
||||||
{
|
{
|
||||||
drawString(systemPlanet[planet].name, -1, 545, FONT_WHITE);
|
drawString(systemPlanet[planet].name, -1, 545, FONT_WHITE);
|
||||||
if ((engine.keyState[KEY_FIRE]))
|
if ((engine.keyState[KEY_FIRE]))
|
||||||
|
@ -284,6 +287,7 @@ static bool showSystem(float x, float y, bool selectable)
|
||||||
currentGame.destinationPlanet = planet;
|
currentGame.destinationPlanet = planet;
|
||||||
currentGame.area = systemPlanet[currentGame.stationedPlanet].missionNumber;
|
currentGame.area = systemPlanet[currentGame.stationedPlanet].missionNumber;
|
||||||
strcpy(currentGame.stationedName, systemPlanet[currentGame.stationedPlanet].name);
|
strcpy(currentGame.stationedName, systemPlanet[currentGame.stationedPlanet].name);
|
||||||
|
saveGame(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -740,13 +744,16 @@ int galaxyMap()
|
||||||
currentGame.stationedPlanet = currentGame.destinationPlanet;
|
currentGame.stationedPlanet = currentGame.destinationPlanet;
|
||||||
currentGame.distanceCovered = 0;
|
currentGame.distanceCovered = 0;
|
||||||
player.shield = player.maxShield;
|
player.shield = player.maxShield;
|
||||||
sprintf(string, "Stationed At: %s", systemPlanet[currentGame.stationedPlanet].name);
|
sprintf(string, "Stationed At: %s",
|
||||||
strcpy(currentGame.stationedName, systemPlanet[currentGame.stationedPlanet].name);
|
systemPlanet[currentGame.stationedPlanet].name);
|
||||||
|
strcpy(currentGame.stationedName,
|
||||||
|
systemPlanet[currentGame.stationedPlanet].name);
|
||||||
SDL_FreeSurface(iconInfo[9].image);
|
SDL_FreeSurface(iconInfo[9].image);
|
||||||
iconInfo[9].image = textSurface(string, FONT_WHITE);
|
iconInfo[9].image = textSurface(string, FONT_WHITE);
|
||||||
updateCommsSurface(commsSurface);
|
updateCommsSurface(commsSurface);
|
||||||
section = 1;
|
section = 1;
|
||||||
redrawBackGround = true;
|
redrawBackGround = true;
|
||||||
|
saveGame(0);
|
||||||
}
|
}
|
||||||
else if (interceptionChance > 0)
|
else if (interceptionChance > 0)
|
||||||
{
|
{
|
||||||
|
@ -768,10 +775,12 @@ int galaxyMap()
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < 8 ; i++)
|
for (int i = 0 ; i < 8 ; i++)
|
||||||
{
|
{
|
||||||
// if the mission has been completed, there is no "Start Next Mission" icon
|
// if the mission has been completed, there is no
|
||||||
|
// "Start Next Mission" icon
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
if ((currentGame.stationedPlanet == currentGame.destinationPlanet) && (systemPlanet[currentGame.stationedPlanet].missionCompleted != 0))
|
if ((currentGame.stationedPlanet == currentGame.destinationPlanet) &&
|
||||||
|
(systemPlanet[currentGame.stationedPlanet].missionCompleted != 0))
|
||||||
continue;
|
continue;
|
||||||
else if (currentGame.stationedPlanet == currentGame.destinationPlanet)
|
else if (currentGame.stationedPlanet == currentGame.destinationPlanet)
|
||||||
blit(shape[1], 80 + (i * 90), 500);
|
blit(shape[1], 80 + (i * 90), 500);
|
||||||
|
|
|
@ -776,19 +776,22 @@ void missionBriefScreen()
|
||||||
|
|
||||||
if (currentGame.area != MAX_MISSIONS - 1)
|
if (currentGame.area != MAX_MISSIONS - 1)
|
||||||
{
|
{
|
||||||
drawString("PRESS CTRL TO CONTINUE...", -1, 550, FONT_WHITE);
|
drawString("PRESS ENTER TO CONTINUE...", -1, 550, FONT_WHITE);
|
||||||
|
|
||||||
updateScreen();
|
updateScreen();
|
||||||
|
|
||||||
flushInput();
|
flushInput();
|
||||||
engine.done = 0;
|
engine.done = 0;
|
||||||
engine.keyState[KEY_FIRE] = 0;
|
engine.keyState[KEY_FIRE] = 0;
|
||||||
|
engine.keyState[KEY_ALTFIRE] = 0;
|
||||||
|
engine.keyState[KEY_ESCAPE] = 0;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
delayFrame();
|
delayFrame();
|
||||||
getPlayerInput();
|
getPlayerInput();
|
||||||
if ((engine.keyState[KEY_FIRE]))
|
if ((engine.keyState[KEY_FIRE]) || (engine.keyState[KEY_ALTFIRE]) ||
|
||||||
|
(engine.keyState[KEY_ESCAPE]))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -367,25 +367,51 @@ void flushInput()
|
||||||
static enum keys mapkey(uint32_t code) {
|
static enum keys mapkey(uint32_t code) {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case SDLK_UP:
|
case SDLK_UP:
|
||||||
|
case SDLK_KP_8:
|
||||||
return KEY_UP;
|
return KEY_UP;
|
||||||
case SDLK_DOWN:
|
case SDLK_DOWN:
|
||||||
|
case SDLK_KP_2:
|
||||||
|
case SDLK_KP_5:
|
||||||
return KEY_DOWN;
|
return KEY_DOWN;
|
||||||
case SDLK_LEFT:
|
case SDLK_LEFT:
|
||||||
|
case SDLK_KP_4:
|
||||||
return KEY_LEFT;
|
return KEY_LEFT;
|
||||||
case SDLK_RIGHT:
|
case SDLK_RIGHT:
|
||||||
|
case SDLK_KP_6:
|
||||||
return KEY_RIGHT;
|
return KEY_RIGHT;
|
||||||
case SDLK_LCTRL:
|
case SDLK_LCTRL:
|
||||||
case SDLK_RCTRL:
|
case SDLK_RCTRL:
|
||||||
case SDLK_RETURN:
|
case SDLK_RETURN:
|
||||||
|
case SDLK_z:
|
||||||
|
case SDLK_c:
|
||||||
|
case SDLK_f:
|
||||||
|
case SDLK_a:
|
||||||
|
case SDLK_SLASH:
|
||||||
|
case SDLK_COMMA:
|
||||||
|
case SDLK_1:
|
||||||
|
case SDLK_3:
|
||||||
|
case SDLK_KP_0:
|
||||||
return KEY_FIRE;
|
return KEY_FIRE;
|
||||||
case SDLK_SPACE:
|
case SDLK_SPACE:
|
||||||
|
case SDLK_x:
|
||||||
|
case SDLK_s:
|
||||||
|
case SDLK_d:
|
||||||
|
case SDLK_PERIOD:
|
||||||
|
case SDLK_2:
|
||||||
|
case SDLK_KP_1:
|
||||||
return KEY_ALTFIRE;
|
return KEY_ALTFIRE;
|
||||||
case SDLK_LSHIFT:
|
case SDLK_LSHIFT:
|
||||||
case SDLK_RSHIFT:
|
case SDLK_RSHIFT:
|
||||||
|
case SDLK_LALT:
|
||||||
|
case SDLK_RALT:
|
||||||
|
case SDLK_KP_7:
|
||||||
|
case SDLK_KP_9:
|
||||||
return KEY_SWITCH;
|
return KEY_SWITCH;
|
||||||
case SDLK_p:
|
case SDLK_p:
|
||||||
return KEY_PAUSE;
|
return KEY_PAUSE;
|
||||||
case SDLK_ESCAPE:
|
case SDLK_ESCAPE:
|
||||||
|
case SDLK_q:
|
||||||
|
case SDLK_BACKSPACE:
|
||||||
return KEY_ESCAPE;
|
return KEY_ESCAPE;
|
||||||
case SDLK_F11:
|
case SDLK_F11:
|
||||||
return KEY_FULLSCREEN;
|
return KEY_FULLSCREEN;
|
||||||
|
|
|
@ -186,7 +186,8 @@ void doCutscene(int scene)
|
||||||
updateScreen();
|
updateScreen();
|
||||||
clearScreen(black);
|
clearScreen(black);
|
||||||
|
|
||||||
engine.keyState[KEY_FIRE] = engine.keyState[KEY_ALTFIRE] = 0;
|
engine.keyState[KEY_FIRE] = 0;
|
||||||
|
engine.keyState[KEY_ALTFIRE] = 0;
|
||||||
|
|
||||||
engine.ssx = -0.5;
|
engine.ssx = -0.5;
|
||||||
engine.ssy = 0;
|
engine.ssy = 0;
|
||||||
|
@ -300,7 +301,8 @@ void doCutscene(int scene)
|
||||||
|
|
||||||
delayFrame();
|
delayFrame();
|
||||||
|
|
||||||
if (engine.keyState[KEY_ESCAPE])
|
if ((engine.keyState[KEY_ESCAPE]) || (engine.keyState[KEY_FIRE]) ||
|
||||||
|
(engine.keyState[KEY_ALTFIRE]))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -615,6 +615,7 @@ static void buy(int i)
|
||||||
|
|
||||||
if (!engine.cheatCash)
|
if (!engine.cheatCash)
|
||||||
currentGame.cash -= shopItems[i].price;
|
currentGame.cash -= shopItems[i].price;
|
||||||
|
saveGame(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sell(int i)
|
static void sell(int i)
|
||||||
|
@ -724,6 +725,7 @@ static void sell(int i)
|
||||||
|
|
||||||
adjustShopPrices();
|
adjustShopPrices();
|
||||||
currentGame.cash += (shopItems[i].price / 2);
|
currentGame.cash += (shopItems[i].price / 2);
|
||||||
|
saveGame(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showShop()
|
void showShop()
|
||||||
|
|
Loading…
Reference in New Issue