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)
|
||||
{
|
||||
updateSystemStatus();
|
||||
|
||||
saveGame(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -273,7 +273,10 @@ static bool showSystem(float x, float y, bool selectable)
|
|||
r.y -= (systemPlanet[planet].image->h / 2);
|
||||
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);
|
||||
if ((engine.keyState[KEY_FIRE]))
|
||||
|
@ -284,6 +287,7 @@ static bool showSystem(float x, float y, bool selectable)
|
|||
currentGame.destinationPlanet = planet;
|
||||
currentGame.area = systemPlanet[currentGame.stationedPlanet].missionNumber;
|
||||
strcpy(currentGame.stationedName, systemPlanet[currentGame.stationedPlanet].name);
|
||||
saveGame(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -740,13 +744,16 @@ int galaxyMap()
|
|||
currentGame.stationedPlanet = currentGame.destinationPlanet;
|
||||
currentGame.distanceCovered = 0;
|
||||
player.shield = player.maxShield;
|
||||
sprintf(string, "Stationed At: %s", systemPlanet[currentGame.stationedPlanet].name);
|
||||
strcpy(currentGame.stationedName, systemPlanet[currentGame.stationedPlanet].name);
|
||||
sprintf(string, "Stationed At: %s",
|
||||
systemPlanet[currentGame.stationedPlanet].name);
|
||||
strcpy(currentGame.stationedName,
|
||||
systemPlanet[currentGame.stationedPlanet].name);
|
||||
SDL_FreeSurface(iconInfo[9].image);
|
||||
iconInfo[9].image = textSurface(string, FONT_WHITE);
|
||||
updateCommsSurface(commsSurface);
|
||||
section = 1;
|
||||
redrawBackGround = true;
|
||||
saveGame(0);
|
||||
}
|
||||
else if (interceptionChance > 0)
|
||||
{
|
||||
|
@ -768,10 +775,12 @@ int galaxyMap()
|
|||
{
|
||||
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 ((currentGame.stationedPlanet == currentGame.destinationPlanet) && (systemPlanet[currentGame.stationedPlanet].missionCompleted != 0))
|
||||
if ((currentGame.stationedPlanet == currentGame.destinationPlanet) &&
|
||||
(systemPlanet[currentGame.stationedPlanet].missionCompleted != 0))
|
||||
continue;
|
||||
else if (currentGame.stationedPlanet == currentGame.destinationPlanet)
|
||||
blit(shape[1], 80 + (i * 90), 500);
|
||||
|
|
|
@ -776,19 +776,22 @@ void missionBriefScreen()
|
|||
|
||||
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();
|
||||
|
||||
flushInput();
|
||||
engine.done = 0;
|
||||
engine.keyState[KEY_FIRE] = 0;
|
||||
engine.keyState[KEY_ALTFIRE] = 0;
|
||||
engine.keyState[KEY_ESCAPE] = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
delayFrame();
|
||||
getPlayerInput();
|
||||
if ((engine.keyState[KEY_FIRE]))
|
||||
if ((engine.keyState[KEY_FIRE]) || (engine.keyState[KEY_ALTFIRE]) ||
|
||||
(engine.keyState[KEY_ESCAPE]))
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -367,25 +367,51 @@ void flushInput()
|
|||
static enum keys mapkey(uint32_t code) {
|
||||
switch (code) {
|
||||
case SDLK_UP:
|
||||
case SDLK_KP_8:
|
||||
return KEY_UP;
|
||||
case SDLK_DOWN:
|
||||
case SDLK_KP_2:
|
||||
case SDLK_KP_5:
|
||||
return KEY_DOWN;
|
||||
case SDLK_LEFT:
|
||||
case SDLK_KP_4:
|
||||
return KEY_LEFT;
|
||||
case SDLK_RIGHT:
|
||||
case SDLK_KP_6:
|
||||
return KEY_RIGHT;
|
||||
case SDLK_LCTRL:
|
||||
case SDLK_RCTRL:
|
||||
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;
|
||||
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;
|
||||
case SDLK_LSHIFT:
|
||||
case SDLK_RSHIFT:
|
||||
case SDLK_LALT:
|
||||
case SDLK_RALT:
|
||||
case SDLK_KP_7:
|
||||
case SDLK_KP_9:
|
||||
return KEY_SWITCH;
|
||||
case SDLK_p:
|
||||
return KEY_PAUSE;
|
||||
case SDLK_ESCAPE:
|
||||
case SDLK_q:
|
||||
case SDLK_BACKSPACE:
|
||||
return KEY_ESCAPE;
|
||||
case SDLK_F11:
|
||||
return KEY_FULLSCREEN;
|
||||
|
|
|
@ -186,7 +186,8 @@ void doCutscene(int scene)
|
|||
updateScreen();
|
||||
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.ssy = 0;
|
||||
|
@ -300,7 +301,8 @@ void doCutscene(int scene)
|
|||
|
||||
delayFrame();
|
||||
|
||||
if (engine.keyState[KEY_ESCAPE])
|
||||
if ((engine.keyState[KEY_ESCAPE]) || (engine.keyState[KEY_FIRE]) ||
|
||||
(engine.keyState[KEY_ALTFIRE]))
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -615,6 +615,7 @@ static void buy(int i)
|
|||
|
||||
if (!engine.cheatCash)
|
||||
currentGame.cash -= shopItems[i].price;
|
||||
saveGame(0);
|
||||
}
|
||||
|
||||
static void sell(int i)
|
||||
|
@ -724,6 +725,7 @@ static void sell(int i)
|
|||
|
||||
adjustShopPrices();
|
||||
currentGame.cash += (shopItems[i].price / 2);
|
||||
saveGame(0);
|
||||
}
|
||||
|
||||
void showShop()
|
||||
|
|
Loading…
Reference in New Issue