Dedicated autosave slot + much improved menu code.

I found it kind of odd to be able to manually save to the autosave
slot, *and* have no reliable way to even know what the autosave
slot is. I noticed that it's an actual problem when my brothers
played Starfighter; one of them used an autosave slot, and the
other unwittingly ended up erasing the first one's save because of
this. To fix this, I have replaced the behavior of allowing the
player to define a slot as autosave, with a dedicated autosave
slot.

While I was there, I had no choice but to vastly improve on this
game's *atrocious* menu system. Granted, I didn't do much more
than replace the magic numbers with enums, but it makes the code
much more clear and more easy to edit.
This commit is contained in:
onpon4 2015-03-02 23:32:48 -05:00
parent 39254f42bb
commit 1f2ef8ac50
6 changed files with 231 additions and 167 deletions

View File

@ -85,7 +85,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MAX_SHIPSHAPES 120
#define MAX_SOUNDS 17
#define MAX_ALIENS 25
#define MAX_TEXTSHAPES 70
#define MAX_TEXTSHAPES 150
#define MAX_FONTSHAPES 6
#define MAX_SHOPSHAPES 6
#define MAX_DEFALIENS 40
@ -246,6 +246,45 @@ enum {
CD_URSULA
};
// Text shapes
enum {
TS_PRESENTS,
TS_AN_SDL_GAME,
TS_START_NEW_GAME,
TS_LOAD_GAME,
TS_CONTINUE_CURRENT_GAME,
TS_OPTIONS,
TS_CHEAT_OPTIONS,
TS_QUIT,
TS_SOUND,
TS_MUSIC,
TS_FULLSCREEN,
TS_BACK_TO_MAIN_MENU,
TS_SAVESLOT_0,
TS_SAVESLOT_1,
TS_SAVESLOT_2,
TS_SAVESLOT_3,
TS_SAVESLOT_4,
TS_SAVESLOT_5,
TS_UNLIMITED_SHIELD,
TS_UNLIMITED_AMMO,
TS_UNLIMITED_CASH,
TS_UNLIMITED_TIME,
TS_START_GAME,
TS_DIFFICULTY
};
// Menu types
enum {
MENU_MAIN,
MENU_DIFFICULTY,
MENU_LOAD,
MENU_OPTIONS,
MENU_CHEAT
};
// Font Colors
enum {

View File

@ -34,8 +34,6 @@ void newGame()
engine.useMusic = false;
}
currentGame.autoSaveSlot = -1;
currentGame.cash = 0;
currentGame.cashEarned = 0;
currentGame.shots = 0;
@ -338,8 +336,7 @@ int mainGameLoop()
{
updateSystemStatus();
if (currentGame.autoSaveSlot > -1)
saveGame(currentGame.autoSaveSlot + 1);
saveGame(0);
}
rtn = 1;

View File

@ -389,21 +389,6 @@ static void createOptions(SDL_Surface *optionsSurface)
drawString("ON", 207, 150, FONT_WHITE, optionsSurface);
drawString("OFF", 263, 150, FONT_WHITE, optionsSurface);
drawString("FULLSCREEN", 30, 150, FONT_WHITE, optionsSurface);
blevelRect(optionsSurface, 20, 195, 150, 22, 0x00, 0x00, 0x00);
blevelRect(optionsSurface, 190, 195, 110, 22, 0x00, 0x00, 0x00);
if (currentGame.autoSaveSlot == -1)
{
drawString("NONE", 225, 200, FONT_WHITE, optionsSurface);
}
else
{
char string[] = "Slot %d";
sprintf(string, "Slot %d", currentGame.autoSaveSlot + 1);
blevelRect(optionsSurface, 190, 195, 110, 22, 0xff, 0x00, 0x00);
drawString(string, 225, 200, FONT_WHITE, optionsSurface);
}
drawString("AUTOSAVE SLOT", 30, 200, FONT_WHITE, optionsSurface);
}
static void showOptions(SDL_Surface *optionsSurface)
@ -453,12 +438,6 @@ static void showOptions(SDL_Surface *optionsSurface)
engine.fullScreen = false;
}
}
if (collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 417, 322, 100, 22))
{
wrapChar(&(++currentGame.autoSaveSlot), -1, 4);
engine.keyState[KEY_FIRE] = 0;
}
createOptions(optionsSurface);
}

View File

@ -40,33 +40,45 @@ int initSaveSlots()
FILE *fp;
//READ SAVE GAME DATA
for (int i = 0 ; i < 5 ; i++)
for (int i = 0 ; i <= 5 ; i++)
{
sprintf(fileName, "%ssave%.2d.dat", engine.userHomeDirectory, (i + 1));
sprintf(fileName, "%ssave%.2d.dat", engine.userHomeDirectory, i);
fp = fopen(fileName, "rb");
if (fp == NULL)
{
sprintf(saveSlot[i], "%.2d - Empty", (i + 1));
sprintf(saveSlot[i], (i == 0 ? "AUTOSAVE (Empty)" : "Empty"));
if (engine.gameSection == SECTION_TITLE)
textSurface(13 + i, saveSlot[i], -1, imagePos, FONT_WHITE);
textSurface(TS_SAVESLOT_0 + i, saveSlot[i], -1, imagePos,
FONT_WHITE);
}
else
{
if (fread(&tempGame, sizeof(Game), 1, fp) != 1)
if (i == 0)
{
sprintf(saveSlot[i], "%.2d - Corrupt Game Data", (i + 1));
sprintf(saveSlot[i], "AUTOSAVE");
}
else
{
sprintf(saveSlot[i], "%.2d - %s, %s", (i + 1), systemNames[tempGame.system], tempGame.stationedName);
if (engine.gameSection == SECTION_TITLE)
textSurface(13 + i, saveSlot[i], -1, imagePos, FONT_WHITE);
if (fread(&tempGame, sizeof(Game), 1, fp) != 1)
{
sprintf(saveSlot[i], "Corrupt Game Data");
}
else
{
sprintf(saveSlot[i], "%s, %s", systemNames[tempGame.system],
tempGame.stationedName);
}
}
if (engine.gameSection == SECTION_TITLE)
textSurface(TS_SAVESLOT_0 + i, saveSlot[i], -1,
imagePos, FONT_WHITE);
if (stat(fileName, &fileInfo) != -1)
{
if (fileInfo.st_mtime > modTime)
{modTime = fileInfo.st_mtime; continueSaveIndex = (i + 1);}
{modTime = fileInfo.st_mtime; continueSaveIndex = i;}
}
fclose(fp);
@ -118,9 +130,9 @@ bool loadGame(int slot)
void saveGame(int slot)
{
if ((slot < 1) || (slot > 5))
if ((slot < 0) || (slot > 5))
{
printf("Error - Saves may only be 1 to 5\n");
printf("Error - Saves may only be 0 to 5\n");
return;
}
@ -159,7 +171,7 @@ void createSavesSurface(SDL_Surface *savesSurface, signed char clickedSlot)
int y = 10;
for (int i = 0 ; i < 5 ; i++)
for (int i = 1 ; i <= 5 ; i++)
{
if (clickedSlot == i)
blevelRect(savesSurface, 5, y, 338, 25, 0x99, 0x00, 0x00);
@ -171,13 +183,13 @@ void createSavesSurface(SDL_Surface *savesSurface, signed char clickedSlot)
drawString("*** HELP ***", 120, 170, FONT_WHITE, savesSurface);
switch(clickedSlot)
switch (clickedSlot)
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
blevelRect(savesSurface, 5, 265, 100, 25, 0x00, 0x99, 0x00);
blevelRect(savesSurface, 125, 265, 100, 25, 0x99, 0x99, 0x00);
blevelRect(savesSurface, 243, 265, 100, 25, 0x99, 0x00, 0x00);
@ -186,11 +198,14 @@ void createSavesSurface(SDL_Surface *savesSurface, signed char clickedSlot)
drawString("DELETE", 270, 270, FONT_WHITE, savesSurface);
drawString("SAVE will save the game", 17, 200, FONT_WHITE, savesSurface);
drawString("CANCEL will unselect that slot", 17, 220, FONT_WHITE, savesSurface);
drawString("DELETE will remove the save", 17, 240, FONT_WHITE, savesSurface);
drawString("CANCEL will unselect that slot", 17, 220, FONT_WHITE,
savesSurface);
drawString("DELETE will remove the save", 17, 240, FONT_WHITE,
savesSurface);
break;
case -1:
drawString("First click a Save game slot to use", 17, 200, FONT_WHITE, savesSurface);
drawString("First click a Save game slot to use", 17, 200,
FONT_WHITE, savesSurface);
break;
case -10:
drawString("Game Saved", 130, 200, FONT_WHITE, savesSurface);
@ -220,9 +235,10 @@ int showSaveSlots(SDL_Surface *savesSurface, signed char saveSlot)
if ((engine.keyState[KEY_FIRE]))
{
for (int i = 0 ; i < 5 ; i++)
for (int i = 1 ; i <= 5 ; i++)
{
if (collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, r.x, r.y, r.w, r.h))
if (collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6,
r.x, r.y, r.w, r.h))
{
clickedSlot = i;
createSavesSurface(savesSurface, i);
@ -230,19 +246,23 @@ int showSaveSlots(SDL_Surface *savesSurface, signed char saveSlot)
r.y += 30;
}
if (collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 215, 365, 100, 25))
if (collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 215,
365, 100, 25))
{
saveGame(saveSlot + 1);
saveGame(saveSlot);
createSavesSurface(savesSurface, -10);
}
if (collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 335, 365, 100, 25))
if (collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 335,
365, 100, 25))
createSavesSurface(savesSurface, -1);
if (collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 453, 365, 100, 25))
if (collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 453,
365, 100, 25))
{
char filename[PATH_MAX];
sprintf(filename, "%ssave%.2d.dat", engine.userHomeDirectory, (saveSlot + 1));
sprintf(filename, "%ssave%.2d.dat", engine.userHomeDirectory,
saveSlot);
remove(filename);
initSaveSlots();
createSavesSurface(savesSurface, -11);

View File

@ -130,8 +130,6 @@ struct Game {
signed char saveFormat;
signed char difficulty;
signed char autoSaveSlot;
unsigned int cash;
unsigned int cashEarned;
unsigned int shots;

View File

@ -21,23 +21,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
static signed char showGameMenu(signed char continueSaveSlot)
{
blitText(2);
if (continueSaveSlot != 0)
blitText(TS_START_NEW_GAME);
if (continueSaveSlot != -1)
{
blitText(3);
blitText(4);
blitText(TS_LOAD_GAME);
blitText(TS_CONTINUE_CURRENT_GAME);
}
blitText(5);
blitText(TS_OPTIONS);
if (engine.cheat)
{
textShape[7].y = 450;
blitText(6);
textShape[TS_QUIT].y = 450;
blitText(TS_CHEAT_OPTIONS);
}
else
{
textShape[7].y = 430;
textShape[TS_QUIT].y = 430;
}
blitText(7);
blitText(TS_QUIT);
if (engine.cheat)
return 6;
@ -49,41 +49,41 @@ static signed char showLoadMenu()
{
signed char rtn = 1;
for (int i = 13 ; i < 18 ; i++)
for (int i = TS_SAVESLOT_0 ; i <= TS_SAVESLOT_5 ; i++)
{
rtn++;
if (textShape[i].image != NULL)
{
blitText(i);
rtn++;
textShape[12].y = textShape[i].y + 40;
textShape[TS_BACK_TO_MAIN_MENU].y = textShape[i].y + 40;
}
}
blitText(12);
blitText(TS_BACK_TO_MAIN_MENU);
return rtn;
}
static void createDifficultyMenu()
{
textSurface(23, "START GAME", -1, 350, FONT_WHITE);
textSurface(TS_START_GAME, "START GAME", -1, 350, FONT_WHITE);
if (currentGame.difficulty == DIFFICULTY_EASY)
textSurface(24, "DIFFICULTY - EASY", -1, 370, FONT_WHITE);
textSurface(TS_DIFFICULTY, "DIFFICULTY - EASY", -1, 370, FONT_WHITE);
else if (currentGame.difficulty == DIFFICULTY_HARD)
textSurface(24, "DIFFICULTY - HARD", -1, 370, FONT_WHITE);
textSurface(TS_DIFFICULTY, "DIFFICULTY - HARD", -1, 370, FONT_WHITE);
else if (currentGame.difficulty == DIFFICULTY_NIGHTMARE)
textSurface(24, "DIFFICULTY - NIGHTMARE", -1, 370, FONT_WHITE);
textSurface(TS_DIFFICULTY, "DIFFICULTY - NIGHTMARE", -1, 370, FONT_WHITE);
else
textSurface(24, "DIFFICULTY - NORMAL", -1, 370, FONT_WHITE);
textSurface(TS_DIFFICULTY, "DIFFICULTY - NORMAL", -1, 370, FONT_WHITE);
}
static signed char showDifficultyMenu()
{
textShape[12].y = 410;
textShape[TS_BACK_TO_MAIN_MENU].y = 410;
blitText(23);
blitText(24);
blitText(12);
blitText(TS_START_GAME);
blitText(TS_DIFFICULTY);
blitText(TS_BACK_TO_MAIN_MENU);
return 3;
}
@ -91,72 +91,73 @@ static signed char showDifficultyMenu()
static void createOptionsMenu()
{
if (engine.useSound)
textSurface(8, "SOUND - ON", -1, 350, FONT_WHITE);
textSurface(TS_SOUND, "SOUND - ON", -1, 350, FONT_WHITE);
else
textSurface(8, "SOUND - OFF", -1, 350, FONT_WHITE);
textSurface(TS_SOUND, "SOUND - OFF", -1, 350, FONT_WHITE);
if (engine.useMusic)
textSurface(9, "MUSIC - ON", -1, 370, FONT_WHITE);
textSurface(TS_MUSIC, "MUSIC - ON", -1, 370, FONT_WHITE);
else
textSurface(9, "MUSIC - OFF", -1, 370, FONT_WHITE);
textSurface(TS_MUSIC, "MUSIC - OFF", -1, 370, FONT_WHITE);
if (engine.fullScreen)
textSurface(10, "FULLSCREEN - ON", -1, 390, FONT_WHITE);
textSurface(TS_FULLSCREEN, "FULLSCREEN - ON", -1, 390, FONT_WHITE);
else
textSurface(10, "FULLSCREEN - OFF", -1, 390, FONT_WHITE);
char string[50];
strcpy(string, "AUTO SAVE SLOT - NONE");
if (currentGame.autoSaveSlot > -1)
sprintf(string, "AUTO SAVE SLOT - #%d", currentGame.autoSaveSlot + 1);
textSurface(11, string, -1, 410, FONT_WHITE);
textSurface(TS_FULLSCREEN, "FULLSCREEN - OFF", -1, 390, FONT_WHITE);
}
static signed char showOptionsMenu()
{
textShape[12].y = 450;
textShape[TS_BACK_TO_MAIN_MENU].y = 430;
blitText(8);
blitText(9);
blitText(10);
blitText(11);
blitText(12);
blitText(TS_SOUND);
blitText(TS_MUSIC);
blitText(TS_FULLSCREEN);
blitText(TS_BACK_TO_MAIN_MENU);
return 5;
return 4;
}
static void createCheatMenu()
{
if (engine.cheatShield)
textSurface(18, "UNLIMITED SHIELD - ON", -1, 350, FONT_WHITE);
textSurface(TS_UNLIMITED_SHIELD, "UNLIMITED SHIELD - ON", -1, 350,
FONT_WHITE);
else
textSurface(18, "UNLIMITED SHIELD - OFF", -1, 350, FONT_WHITE);
textSurface(TS_UNLIMITED_SHIELD, "UNLIMITED SHIELD - OFF", -1, 350,
FONT_WHITE);
if (engine.cheatAmmo)
textSurface(19, "UNLIMITED AMMO - ON", -1, 370, FONT_WHITE);
textSurface(TS_UNLIMITED_AMMO, "UNLIMITED AMMO - ON", -1, 370,
FONT_WHITE);
else
textSurface(19, "UNLIMITED AMMO - OFF", -1, 370, FONT_WHITE);
textSurface(TS_UNLIMITED_AMMO, "UNLIMITED AMMO - OFF", -1, 370,
FONT_WHITE);
if (engine.cheatCash)
textSurface(20, "UNLIMITED CASH - ON", -1, 390, FONT_WHITE);
textSurface(TS_UNLIMITED_CASH, "UNLIMITED CASH - ON", -1, 390,
FONT_WHITE);
else
textSurface(20, "UNLIMITED CASH - OFF", -1, 390, FONT_WHITE);
textSurface(TS_UNLIMITED_CASH, "UNLIMITED CASH - OFF", -1, 390,
FONT_WHITE);
if (engine.cheatTime)
textSurface(21, "UNLIMITED TIME - ON", -1, 410, FONT_WHITE);
textSurface(TS_UNLIMITED_TIME, "UNLIMITED TIME - ON", -1, 410,
FONT_WHITE);
else
textSurface(21, "UNLIMITED TIME - OFF", -1, 410, FONT_WHITE);
textSurface(TS_UNLIMITED_TIME, "UNLIMITED TIME - OFF", -1, 410,
FONT_WHITE);
}
static signed char showCheatMenu()
{
textShape[12].y = 450;
textShape[TS_BACK_TO_MAIN_MENU].y = 450;
blitText(18);
blitText(19);
blitText(20);
blitText(21);
blitText(12);
blitText(TS_UNLIMITED_SHIELD);
blitText(TS_UNLIMITED_AMMO);
blitText(TS_UNLIMITED_CASH);
blitText(TS_UNLIMITED_TIME);
blitText(TS_BACK_TO_MAIN_MENU);
return 5;
}
@ -201,18 +202,19 @@ int doTitle()
int sfx = ((screen->w - sflogo->w) / 2);
int sfy = ((screen->h - sflogo->h) / 2);
textSurface(0, "PRESENTS", -1, 300, FONT_WHITE);
textSurface(1, "AN SDL GAME", -1, 300, FONT_WHITE);
textSurface(2, "START NEW GAME", -1, 350, FONT_WHITE);
textSurface(3, "LOAD GAME", -1, 370, FONT_WHITE);
textSurface(4, "CONTINUE CURRENT GAME", -1, 390, FONT_WHITE);
textSurface(5, "OPTIONS", -1, 410, FONT_WHITE);
textSurface(6, "CHEAT OPTIONS", -1, 430, FONT_WHITE);
textSurface(7, "QUIT", -1, 430, FONT_WHITE);
textSurface(TS_PRESENTS, "PRESENTS", -1, 300, FONT_WHITE);
textSurface(TS_AN_SDL_GAME, "AN SDL GAME", -1, 300, FONT_WHITE);
textSurface(TS_START_NEW_GAME, "START NEW GAME", -1, 350, FONT_WHITE);
textSurface(TS_LOAD_GAME, "LOAD GAME", -1, 370, FONT_WHITE);
textSurface(TS_CONTINUE_CURRENT_GAME, "CONTINUE CURRENT GAME", -1, 390,
FONT_WHITE);
textSurface(TS_OPTIONS, "OPTIONS", -1, 410, FONT_WHITE);
textSurface(TS_CHEAT_OPTIONS, "CHEAT OPTIONS", -1, 430, FONT_WHITE);
textSurface(TS_QUIT, "QUIT", -1, 430, FONT_WHITE);
createOptionsMenu();
createDifficultyMenu();
textSurface(12, "BACK TO MAIN MENU", -1, 0, FONT_WHITE);
textSurface(TS_BACK_TO_MAIN_MENU, "BACK TO MAIN MENU", -1, 0, FONT_WHITE);
createCheatMenu();
@ -251,12 +253,12 @@ int doTitle()
optionRec.w = 215;
signed char selectedOption = 1;
if (continueSaveSlot > 0)
if (continueSaveSlot > -1)
{selectedOption = 3; optionRec.y += 40;}
bool skip = false;
signed char listLength = 5; // menu list length
signed char menuType = 0;
signed char menuType = MENU_MAIN;
drawBackGround();
@ -296,11 +298,11 @@ int doTitle()
}
else if ((now - then > 9000) && (now - then < 15000) && (!skip))
{
blitText(0);
blitText(TS_PRESENTS);
}
else if ((now - then > 16000) && (now - then < 21000) && (!skip))
{
blitText(1);
blitText(TS_AN_SDL_GAME);
}
else if ((now - then > 25500) || (skip))
{
@ -308,27 +310,27 @@ int doTitle()
if ((now - then >= 27500) || (skip))
{
addBuffer(280, 345, 235, 145);
addBuffer(0, 0, screen->w, screen->h);
blevelRect(optionRec.x, optionRec.y, optionRec.w, optionRec.h, redGlow, 0x00, 0x00);
switch(menuType)
{
case 0:
case MENU_MAIN:
listLength = showGameMenu(continueSaveSlot);
break;
case 1:
case MENU_DIFFICULTY:
listLength = showDifficultyMenu();
break;
case MENU_LOAD:
listLength = showLoadMenu();
break;
case 2:
case MENU_OPTIONS:
listLength = showOptionsMenu();
break;
case 3:
case MENU_CHEAT:
listLength = showCheatMenu();
break;
case 4:
listLength = showDifficultyMenu();
break;
}
redGlow += redDir;
@ -339,23 +341,23 @@ int doTitle()
{
engine.keyState[KEY_UP] = 0;
wrapChar(&(--selectedOption), 1, listLength + 1);
if (menuType == 0)
if (menuType == MENU_MAIN)
if ((selectedOption == 2) || (selectedOption == 3))
if (continueSaveSlot == 0)
if (continueSaveSlot == -1)
selectedOption = 1;
}
if (engine.keyState[KEY_DOWN])
{
engine.keyState[KEY_DOWN] = 0;
wrapChar(&(++selectedOption), 0, listLength);
if (menuType == 0)
if (menuType == MENU_MAIN)
if ((selectedOption == 2) || (selectedOption == 3))
if (continueSaveSlot == 0)
if (continueSaveSlot == -1)
selectedOption = 4;
}
optionRec.y = 326 + (20 * selectedOption);
if (menuType > 0)
if (menuType > MENU_MAIN)
if (selectedOption == listLength)
optionRec.y += 20;
@ -391,21 +393,33 @@ int doTitle()
}
else
{
switch(menuType)
switch (menuType)
{
case 0: // Main menu
case MENU_MAIN:
if (selectedOption == 1)
{menuType = 4; selectedOption = 1;}
{
menuType = MENU_DIFFICULTY;
selectedOption = 1;
}
else if (selectedOption == 2)
{menuType = 1; selectedOption = 1;}
{
menuType = MENU_LOAD;
selectedOption = 1;
}
else if (selectedOption == 3)
engine.done = 1;
else if (selectedOption == 4)
{menuType = 2; selectedOption = 1;}
{
menuType = MENU_OPTIONS;
selectedOption = 1;
}
else if (selectedOption == 5)
{
if (engine.cheat)
{menuType = 3; selectedOption = 1;}
{
menuType = MENU_CHEAT;
selectedOption = 1;
}
else
engine.done = 1;
}
@ -413,14 +427,38 @@ int doTitle()
engine.done = 1;
break;
case 1: // Load game menu
if (selectedOption != listLength)
{engine.done = 1; continueSaveSlot = selectedOption; selectedOption = 3;}
else
{menuType = 0; selectedOption = 1;}
case MENU_DIFFICULTY:
if (selectedOption == 1)
engine.done = 1;
else if (selectedOption == 2)
{
currentGame.difficulty++;
if (currentGame.difficulty > DIFFICULTY_NIGHTMARE)
currentGame.difficulty = DIFFICULTY_EASY;
}
else if (selectedOption == listLength)
{
menuType = MENU_MAIN;
selectedOption = 1;
}
createDifficultyMenu();
break;
case 2: // Options menu
case MENU_LOAD:
if (selectedOption != listLength)
{
engine.done = 1;
continueSaveSlot = selectedOption - 1;
selectedOption = 3;
}
else
{
menuType = MENU_MAIN;
selectedOption = 1;
}
break;
case MENU_OPTIONS:
if ((selectedOption == 1) && (engine.useAudio))
engine.useSound = !engine.useSound;
else if ((selectedOption == 2) && (engine.useAudio))
@ -442,16 +480,19 @@ int doTitle()
else if (selectedOption == 3)
{
engine.fullScreen = !engine.fullScreen;
SDL_SetWindowFullscreen(window, engine.fullScreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
SDL_SetWindowFullscreen(window,
(engine.fullScreen ?
SDL_WINDOW_FULLSCREEN_DESKTOP : 0));
}
else if (selectedOption == 4)
wrapChar(&(++currentGame.autoSaveSlot), -1, 4);
else if (selectedOption == listLength)
{menuType = 0; selectedOption = 1;}
{
menuType = MENU_MAIN;
selectedOption = 1;
}
createOptionsMenu();
break;
case 3: // Cheat menu
case MENU_CHEAT:
if (selectedOption == 1)
engine.cheatShield = !engine.cheatShield;
else if (selectedOption == 2)
@ -461,26 +502,16 @@ int doTitle()
else if (selectedOption == 4)
engine.cheatTime = !engine.cheatTime;
else if (selectedOption == listLength)
{menuType = 0; selectedOption = 1;}
{
menuType = MENU_MAIN;
selectedOption = 1;
}
createCheatMenu();
break;
case 4: // Difficulty menu
if (selectedOption == 1)
engine.done = 1;
else if (selectedOption == 2)
{
currentGame.difficulty++;
if (currentGame.difficulty > DIFFICULTY_NIGHTMARE)
currentGame.difficulty = DIFFICULTY_EASY;
}
else if (selectedOption == listLength)
{menuType = 0; selectedOption = 1;}
createDifficultyMenu();
break;
default:
menuType = 0, selectedOption = 1;
menuType = MENU_MAIN;
selectedOption = 1;
break;
}
}