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
|
|
|
|
2011-08-26 21:29:04 +02:00
|
|
|
static signed char showGameMenu(signed char continueSaveSlot)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2015-03-03 05:32:48 +01:00
|
|
|
blitText(TS_START_NEW_GAME);
|
|
|
|
if (continueSaveSlot != -1)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2015-03-03 05:32:48 +01:00
|
|
|
blitText(TS_LOAD_GAME);
|
|
|
|
blitText(TS_CONTINUE_CURRENT_GAME);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
2015-03-03 05:32:48 +01:00
|
|
|
blitText(TS_OPTIONS);
|
2011-08-24 14:14:44 +02:00
|
|
|
if (engine.cheat)
|
|
|
|
{
|
2015-03-03 05:32:48 +01:00
|
|
|
textShape[TS_QUIT].y = 450;
|
|
|
|
blitText(TS_CHEAT_OPTIONS);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-03-03 05:32:48 +01:00
|
|
|
textShape[TS_QUIT].y = 430;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
2015-03-03 05:32:48 +01:00
|
|
|
blitText(TS_QUIT);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
if (engine.cheat)
|
|
|
|
return 6;
|
|
|
|
|
|
|
|
return 5;
|
|
|
|
}
|
|
|
|
|
2011-08-26 21:29:04 +02:00
|
|
|
static signed char showLoadMenu()
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
signed char rtn = 1;
|
|
|
|
|
2015-03-03 05:32:48 +01:00
|
|
|
for (int i = TS_SAVESLOT_0 ; i <= TS_SAVESLOT_5 ; i++)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2015-03-03 05:32:48 +01:00
|
|
|
rtn++;
|
2011-08-26 23:53:46 +02:00
|
|
|
if (textShape[i].image != NULL)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2011-08-26 23:53:46 +02:00
|
|
|
blitText(i);
|
2015-03-03 05:32:48 +01:00
|
|
|
textShape[TS_BACK_TO_MAIN_MENU].y = textShape[i].y + 40;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
}
|
2015-03-03 05:32:48 +01:00
|
|
|
blitText(TS_BACK_TO_MAIN_MENU);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
return rtn;
|
|
|
|
}
|
|
|
|
|
2012-12-09 16:11:55 +01:00
|
|
|
static void createDifficultyMenu()
|
|
|
|
{
|
2015-03-03 05:32:48 +01:00
|
|
|
textSurface(TS_START_GAME, "START GAME", -1, 350, FONT_WHITE);
|
2012-12-09 16:11:55 +01:00
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.difficulty == DIFFICULTY_EASY)
|
2015-03-03 05:32:48 +01:00
|
|
|
textSurface(TS_DIFFICULTY, "DIFFICULTY - EASY", -1, 370, FONT_WHITE);
|
2015-05-21 01:41:43 +02:00
|
|
|
else if (game.difficulty == DIFFICULTY_HARD)
|
2015-03-03 05:32:48 +01:00
|
|
|
textSurface(TS_DIFFICULTY, "DIFFICULTY - HARD", -1, 370, FONT_WHITE);
|
2015-05-21 01:41:43 +02:00
|
|
|
else if (game.difficulty == DIFFICULTY_NIGHTMARE)
|
2015-03-13 03:14:07 +01:00
|
|
|
textSurface(TS_DIFFICULTY, "DIFFICULTY - NIGHTMARE!", -1, 370, FONT_WHITE);
|
2015-05-21 01:41:43 +02:00
|
|
|
else if (game.difficulty == DIFFICULTY_ORIGINAL)
|
2015-03-28 14:51:49 +01:00
|
|
|
textSurface(TS_DIFFICULTY, "DIFFICULTY - ORIGINAL", -1, 370, FONT_WHITE);
|
2012-12-09 16:11:55 +01:00
|
|
|
else
|
2015-03-03 05:32:48 +01:00
|
|
|
textSurface(TS_DIFFICULTY, "DIFFICULTY - NORMAL", -1, 370, FONT_WHITE);
|
2012-12-09 16:11:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static signed char showDifficultyMenu()
|
|
|
|
{
|
2015-03-03 05:32:48 +01:00
|
|
|
textShape[TS_BACK_TO_MAIN_MENU].y = 410;
|
2012-12-09 16:11:55 +01:00
|
|
|
|
2015-03-03 05:32:48 +01:00
|
|
|
blitText(TS_START_GAME);
|
|
|
|
blitText(TS_DIFFICULTY);
|
|
|
|
blitText(TS_BACK_TO_MAIN_MENU);
|
2012-12-09 16:11:55 +01:00
|
|
|
|
2015-02-27 02:51:30 +01:00
|
|
|
return 3;
|
2012-12-09 16:11:55 +01:00
|
|
|
}
|
|
|
|
|
2011-08-26 21:29:04 +02:00
|
|
|
static void createOptionsMenu()
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2011-08-26 22:48:52 +02:00
|
|
|
if (engine.useSound)
|
2015-03-03 05:32:48 +01:00
|
|
|
textSurface(TS_SOUND, "SOUND - ON", -1, 350, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
else
|
2015-03-03 05:32:48 +01:00
|
|
|
textSurface(TS_SOUND, "SOUND - OFF", -1, 350, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 22:48:52 +02:00
|
|
|
if (engine.useMusic)
|
2015-03-03 05:32:48 +01:00
|
|
|
textSurface(TS_MUSIC, "MUSIC - ON", -1, 370, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
else
|
2015-03-03 05:32:48 +01:00
|
|
|
textSurface(TS_MUSIC, "MUSIC - OFF", -1, 370, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 22:48:52 +02:00
|
|
|
if (engine.fullScreen)
|
2015-03-03 05:32:48 +01:00
|
|
|
textSurface(TS_FULLSCREEN, "FULLSCREEN - ON", -1, 390, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
else
|
2015-03-03 05:32:48 +01:00
|
|
|
textSurface(TS_FULLSCREEN, "FULLSCREEN - OFF", -1, 390, FONT_WHITE);
|
2015-05-22 00:49:04 +02:00
|
|
|
|
|
|
|
if (engine.autoPause)
|
|
|
|
textSurface(TS_AUTOPAUSE, "AUTOPAUSE - ON", -1, 410, FONT_WHITE);
|
|
|
|
else
|
|
|
|
textSurface(TS_AUTOPAUSE, "AUTOPAUSE - OFF", -1, 410, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2011-08-26 21:29:04 +02:00
|
|
|
static signed char showOptionsMenu()
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2015-05-22 00:49:04 +02:00
|
|
|
textShape[TS_BACK_TO_MAIN_MENU].y = 450;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-03-03 05:32:48 +01:00
|
|
|
blitText(TS_SOUND);
|
|
|
|
blitText(TS_MUSIC);
|
|
|
|
blitText(TS_FULLSCREEN);
|
2015-05-22 00:49:04 +02:00
|
|
|
blitText(TS_AUTOPAUSE);
|
2015-03-03 05:32:48 +01:00
|
|
|
blitText(TS_BACK_TO_MAIN_MENU);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-05-22 00:49:04 +02:00
|
|
|
return 5;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2011-08-26 21:29:04 +02:00
|
|
|
static void createCheatMenu()
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
if (engine.cheatShield)
|
2015-03-03 05:32:48 +01:00
|
|
|
textSurface(TS_UNLIMITED_SHIELD, "UNLIMITED SHIELD - ON", -1, 350,
|
|
|
|
FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
else
|
2015-03-03 05:32:48 +01:00
|
|
|
textSurface(TS_UNLIMITED_SHIELD, "UNLIMITED SHIELD - OFF", -1, 350,
|
|
|
|
FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
if (engine.cheatAmmo)
|
2015-03-03 05:32:48 +01:00
|
|
|
textSurface(TS_UNLIMITED_AMMO, "UNLIMITED AMMO - ON", -1, 370,
|
|
|
|
FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
else
|
2015-03-03 05:32:48 +01:00
|
|
|
textSurface(TS_UNLIMITED_AMMO, "UNLIMITED AMMO - OFF", -1, 370,
|
|
|
|
FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
if (engine.cheatCash)
|
2015-03-03 05:32:48 +01:00
|
|
|
textSurface(TS_UNLIMITED_CASH, "UNLIMITED CASH - ON", -1, 390,
|
|
|
|
FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
else
|
2015-03-03 05:32:48 +01:00
|
|
|
textSurface(TS_UNLIMITED_CASH, "UNLIMITED CASH - OFF", -1, 390,
|
|
|
|
FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
if (engine.cheatTime)
|
2015-03-03 05:32:48 +01:00
|
|
|
textSurface(TS_UNLIMITED_TIME, "UNLIMITED TIME - ON", -1, 410,
|
|
|
|
FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
else
|
2015-03-03 05:32:48 +01:00
|
|
|
textSurface(TS_UNLIMITED_TIME, "UNLIMITED TIME - OFF", -1, 410,
|
|
|
|
FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2011-08-26 21:29:04 +02:00
|
|
|
static signed char showCheatMenu()
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2015-03-03 05:32:48 +01:00
|
|
|
textShape[TS_BACK_TO_MAIN_MENU].y = 450;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-03-03 05:32:48 +01:00
|
|
|
blitText(TS_UNLIMITED_SHIELD);
|
|
|
|
blitText(TS_UNLIMITED_AMMO);
|
|
|
|
blitText(TS_UNLIMITED_CASH);
|
|
|
|
blitText(TS_UNLIMITED_TIME);
|
|
|
|
blitText(TS_BACK_TO_MAIN_MENU);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
return 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
This is the main title screen, with the stars whirling past and the
|
|
|
|
"Parallel Realities, Present..." text. Nothing too special.
|
|
|
|
*/
|
|
|
|
int doTitle()
|
|
|
|
{
|
2015-05-21 01:41:43 +02:00
|
|
|
game_init();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
engine.gameSection = SECTION_TITLE;
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
flushBuffer();
|
|
|
|
freeGraphics();
|
2011-08-24 14:14:44 +02:00
|
|
|
resetLists();
|
|
|
|
|
|
|
|
// required to stop the title screen crashing
|
2015-05-21 01:41:43 +02:00
|
|
|
game.system = 0;
|
|
|
|
game.area = MISN_START;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
loadGameGraphics();
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
clearScreen(black);
|
|
|
|
updateScreen();
|
|
|
|
clearScreen(black);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
signed char continueSaveSlot = initSaveSlots();
|
|
|
|
|
|
|
|
loadBackground("gfx/spirit.jpg");
|
|
|
|
|
|
|
|
SDL_Surface *prlogo, *sflogo;
|
2011-08-27 16:18:29 +02:00
|
|
|
prlogo = loadImage("gfx/prlogo.png");
|
|
|
|
sflogo = loadImage("gfx/sflogo.png");
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2012-03-12 04:16:56 +01:00
|
|
|
int prx = ((screen->w - prlogo->w) / 2);
|
|
|
|
int pry = ((screen->h - prlogo->h) / 2);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2012-03-12 04:16:56 +01:00
|
|
|
int sfx = ((screen->w - sflogo->w) / 2);
|
|
|
|
int sfy = ((screen->h - sflogo->h) / 2);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-03-03 05:32:48 +01:00
|
|
|
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);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
createOptionsMenu();
|
2012-12-09 16:11:55 +01:00
|
|
|
createDifficultyMenu();
|
2015-03-03 05:32:48 +01:00
|
|
|
textSurface(TS_BACK_TO_MAIN_MENU, "BACK TO MAIN MENU", -1, 0, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
createCheatMenu();
|
|
|
|
|
|
|
|
// Set the star motion
|
|
|
|
engine.ssx = -0.5;
|
|
|
|
engine.ssy = 0;
|
2015-02-27 05:23:08 +01:00
|
|
|
engine.smx = 0;
|
|
|
|
engine.smy = 0;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
int then = SDL_GetTicks();
|
|
|
|
int now;
|
|
|
|
|
|
|
|
for (int i = 0 ; i < 15 ; i++)
|
|
|
|
{
|
2015-03-07 15:42:24 +01:00
|
|
|
aliens[i] = alien_defs[rand() % 3];
|
2011-08-24 14:14:44 +02:00
|
|
|
if ((rand() % 5) == 0)
|
2015-03-07 15:42:24 +01:00
|
|
|
aliens[i] = alien_defs[CD_TRANSPORTSHIP];
|
2011-08-24 14:14:44 +02:00
|
|
|
if ((rand() % 5) == 0)
|
2015-03-07 15:42:24 +01:00
|
|
|
aliens[i] = alien_defs[CD_MINER];
|
|
|
|
aliens[i].x = rand() % screen->w;
|
|
|
|
aliens[i].y = rand() % (screen->h - 40);
|
|
|
|
aliens[i].dx = 1 + rand() % 3;
|
|
|
|
aliens[i].face = 0;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int redGlow = 255;
|
|
|
|
signed char redDir = -2;
|
|
|
|
char buildVersion[25];
|
|
|
|
sprintf(buildVersion, "Version "VERSION);
|
|
|
|
|
|
|
|
SDL_Rect optionRec;
|
|
|
|
|
|
|
|
optionRec.x = 290;
|
|
|
|
optionRec.y = 345;
|
|
|
|
optionRec.h = 22;
|
|
|
|
optionRec.w = 215;
|
|
|
|
|
|
|
|
signed char selectedOption = 1;
|
2015-03-03 05:32:48 +01:00
|
|
|
if (continueSaveSlot > -1)
|
2011-08-24 14:14:44 +02:00
|
|
|
{selectedOption = 3; optionRec.y += 40;}
|
|
|
|
|
2011-08-26 16:55:46 +02:00
|
|
|
bool skip = false;
|
2011-08-24 14:14:44 +02:00
|
|
|
signed char listLength = 5; // menu list length
|
2015-03-03 05:32:48 +01:00
|
|
|
signed char menuType = MENU_MAIN;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
drawBackGround();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
engine.done = 0;
|
|
|
|
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
|
|
|
|
2015-03-08 15:38:58 +01:00
|
|
|
audio_playMusic("music/walking_among_androids.ogg", 1);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
while (!engine.done)
|
|
|
|
{
|
2011-08-26 23:53:46 +02:00
|
|
|
updateScreen();
|
|
|
|
unBuffer();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
now = SDL_GetTicks();
|
|
|
|
|
2015-06-20 17:58:37 +02:00
|
|
|
game_doStars();
|
2015-05-01 00:51:26 +02:00
|
|
|
game_doExplosions();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
for (int i = 0 ; i < 15 ; i++)
|
|
|
|
{
|
2015-05-01 00:51:26 +02:00
|
|
|
explosion_addEngine(&aliens[i]);
|
2015-03-07 15:42:24 +01:00
|
|
|
aliens[i].x += aliens[i].dx;
|
2015-09-26 14:49:21 +02:00
|
|
|
screen_blit(aliens[i].image[0], (int)aliens[i].x, (int)aliens[i].y);
|
2015-03-07 15:42:24 +01:00
|
|
|
if (aliens[i].x > 830)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2015-03-07 15:42:24 +01:00
|
|
|
aliens[i].x = -40;
|
|
|
|
aliens[i].y = rand() % (screen->h - 20);
|
|
|
|
aliens[i].dx = 1 + rand() % 3;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((now - then > 2000) && (now - then < 8000) && (!skip))
|
|
|
|
{
|
2015-09-26 14:49:21 +02:00
|
|
|
screen_blit(prlogo, prx, pry);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
else if ((now - then > 9000) && (now - then < 15000) && (!skip))
|
|
|
|
{
|
2015-03-03 05:32:48 +01:00
|
|
|
blitText(TS_PRESENTS);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
else if ((now - then > 16000) && (now - then < 21000) && (!skip))
|
|
|
|
{
|
2015-03-03 05:32:48 +01:00
|
|
|
blitText(TS_AN_SDL_GAME);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
else if ((now - then > 25500) || (skip))
|
|
|
|
{
|
2015-09-26 14:49:21 +02:00
|
|
|
screen_blit(sflogo, sfx, sfy);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
if ((now - then >= 27500) || (skip))
|
|
|
|
{
|
2015-09-26 14:49:21 +02:00
|
|
|
gfx_addBuffer(0, 0, screen->w, screen->h);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
blevelRect(optionRec.x, optionRec.y, optionRec.w, optionRec.h, redGlow, 0x00, 0x00);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
switch(menuType)
|
|
|
|
{
|
2015-03-03 05:32:48 +01:00
|
|
|
case MENU_MAIN:
|
2011-08-24 14:14:44 +02:00
|
|
|
listLength = showGameMenu(continueSaveSlot);
|
|
|
|
break;
|
2015-03-03 05:32:48 +01:00
|
|
|
case MENU_DIFFICULTY:
|
|
|
|
listLength = showDifficultyMenu();
|
|
|
|
break;
|
|
|
|
case MENU_LOAD:
|
2011-08-24 14:14:44 +02:00
|
|
|
listLength = showLoadMenu();
|
|
|
|
break;
|
2015-03-03 05:32:48 +01:00
|
|
|
case MENU_OPTIONS:
|
2011-08-24 14:14:44 +02:00
|
|
|
listLength = showOptionsMenu();
|
|
|
|
break;
|
2015-03-03 05:32:48 +01:00
|
|
|
case MENU_CHEAT:
|
2011-08-24 14:14:44 +02:00
|
|
|
listLength = showCheatMenu();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
redGlow += redDir;
|
|
|
|
if (redGlow <= 0) {redDir = 2; redGlow = 0;}
|
|
|
|
if (redGlow >= 255) {redDir = -2; redGlow = 255;}
|
|
|
|
|
2013-09-30 16:52:43 +02:00
|
|
|
if (engine.keyState[KEY_UP])
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2013-09-30 16:52:43 +02:00
|
|
|
engine.keyState[KEY_UP] = 0;
|
2015-03-24 23:51:12 +01:00
|
|
|
WRAP_ADD(selectedOption, -1, 1, listLength + 1);
|
2015-03-03 05:32:48 +01:00
|
|
|
if (menuType == MENU_MAIN)
|
2011-08-24 14:14:44 +02:00
|
|
|
if ((selectedOption == 2) || (selectedOption == 3))
|
2015-03-03 05:32:48 +01:00
|
|
|
if (continueSaveSlot == -1)
|
2011-08-24 14:14:44 +02:00
|
|
|
selectedOption = 1;
|
|
|
|
}
|
2013-09-30 16:52:43 +02:00
|
|
|
if (engine.keyState[KEY_DOWN])
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2013-09-30 16:52:43 +02:00
|
|
|
engine.keyState[KEY_DOWN] = 0;
|
2015-03-24 23:51:12 +01:00
|
|
|
WRAP_ADD(selectedOption, 1, 0, listLength);
|
2015-03-03 05:32:48 +01:00
|
|
|
if (menuType == MENU_MAIN)
|
2011-08-24 14:14:44 +02:00
|
|
|
if ((selectedOption == 2) || (selectedOption == 3))
|
2015-03-03 05:32:48 +01:00
|
|
|
if (continueSaveSlot == -1)
|
2011-08-24 14:14:44 +02:00
|
|
|
selectedOption = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
optionRec.y = 326 + (20 * selectedOption);
|
2015-03-03 05:32:48 +01:00
|
|
|
if (menuType > MENU_MAIN)
|
2011-08-24 14:14:44 +02:00
|
|
|
if (selectedOption == listLength)
|
|
|
|
optionRec.y += 20;
|
|
|
|
|
|
|
|
if (!skip)
|
|
|
|
{
|
2012-02-26 22:25:57 +01:00
|
|
|
drawString("Copyright Parallel Realities 2003", 5, 560, FONT_WHITE, background);
|
|
|
|
drawString("Copyright Guus Sliepen, Astrid S. de Wijn and others 2012", 5, 580, FONT_WHITE, background);
|
2011-08-28 12:28:05 +02:00
|
|
|
drawString(buildVersion, 794 - strlen(buildVersion) * 9, 580, FONT_WHITE, background);
|
2015-09-26 14:49:21 +02:00
|
|
|
gfx_addBuffer(0, 560, 800, 40);
|
2011-08-26 16:55:46 +02:00
|
|
|
skip = true;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
getPlayerInput();
|
|
|
|
|
|
|
|
// if someone has invoked the credits cheat
|
|
|
|
if (engine.cheatCredits)
|
|
|
|
{
|
2015-03-04 14:20:11 +01:00
|
|
|
doCredits();
|
2011-08-26 16:14:58 +02:00
|
|
|
engine.cheatCredits = false;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2013-09-30 16:52:43 +02:00
|
|
|
if ((engine.keyState[KEY_FIRE] || engine.keyState[KEY_ALTFIRE]))
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
if ((now - then <= 27500) && (!skip))
|
|
|
|
{
|
2012-02-26 22:25:57 +01:00
|
|
|
drawString("Copyright Parallel Realities 2003", 5, 560, FONT_WHITE, background);
|
|
|
|
drawString("Copyright Guus Sliepen, Astrid S. de Wijn and others 2012", 5, 580, FONT_WHITE, background);
|
2011-08-28 12:28:05 +02:00
|
|
|
drawString(buildVersion, 794 - strlen(buildVersion) * 9, 580, FONT_WHITE, background);
|
2015-09-26 14:49:21 +02:00
|
|
|
gfx_addBuffer(0, 560, 800, 40);
|
2011-08-26 16:55:46 +02:00
|
|
|
skip = true;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-03-03 05:32:48 +01:00
|
|
|
switch (menuType)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2015-03-03 05:32:48 +01:00
|
|
|
case MENU_MAIN:
|
2012-12-09 16:11:55 +01:00
|
|
|
if (selectedOption == 1)
|
2015-03-03 05:32:48 +01:00
|
|
|
{
|
|
|
|
menuType = MENU_DIFFICULTY;
|
|
|
|
selectedOption = 1;
|
|
|
|
}
|
2011-08-24 14:14:44 +02:00
|
|
|
else if (selectedOption == 2)
|
2015-03-03 05:32:48 +01:00
|
|
|
{
|
|
|
|
menuType = MENU_LOAD;
|
|
|
|
selectedOption = 1;
|
|
|
|
}
|
2012-12-09 16:11:55 +01:00
|
|
|
else if (selectedOption == 3)
|
|
|
|
engine.done = 1;
|
2011-08-24 14:14:44 +02:00
|
|
|
else if (selectedOption == 4)
|
2015-03-03 05:32:48 +01:00
|
|
|
{
|
|
|
|
menuType = MENU_OPTIONS;
|
|
|
|
selectedOption = 1;
|
|
|
|
}
|
2011-08-24 14:14:44 +02:00
|
|
|
else if (selectedOption == 5)
|
|
|
|
{
|
|
|
|
if (engine.cheat)
|
2015-03-03 05:32:48 +01:00
|
|
|
{
|
|
|
|
menuType = MENU_CHEAT;
|
|
|
|
selectedOption = 1;
|
|
|
|
}
|
2011-08-24 14:14:44 +02:00
|
|
|
else
|
|
|
|
engine.done = 1;
|
|
|
|
}
|
|
|
|
else if (selectedOption == 6)
|
|
|
|
engine.done = 1;
|
|
|
|
break;
|
|
|
|
|
2015-03-03 05:32:48 +01:00
|
|
|
case MENU_DIFFICULTY:
|
|
|
|
if (selectedOption == 1)
|
|
|
|
engine.done = 1;
|
|
|
|
else if (selectedOption == 2)
|
|
|
|
{
|
2015-05-21 01:41:43 +02:00
|
|
|
game.difficulty++;
|
|
|
|
game.difficulty %= DIFFICULTY_MAX;
|
2015-03-03 05:32:48 +01:00
|
|
|
}
|
|
|
|
else if (selectedOption == listLength)
|
|
|
|
{
|
|
|
|
menuType = MENU_MAIN;
|
|
|
|
selectedOption = 1;
|
|
|
|
}
|
|
|
|
createDifficultyMenu();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MENU_LOAD:
|
2011-08-24 14:14:44 +02:00
|
|
|
if (selectedOption != listLength)
|
2015-03-03 05:32:48 +01:00
|
|
|
{
|
|
|
|
engine.done = 1;
|
|
|
|
continueSaveSlot = selectedOption - 1;
|
|
|
|
selectedOption = 3;
|
|
|
|
}
|
2011-08-24 14:14:44 +02:00
|
|
|
else
|
2015-03-03 05:32:48 +01:00
|
|
|
{
|
|
|
|
menuType = MENU_MAIN;
|
|
|
|
selectedOption = 1;
|
|
|
|
}
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
|
|
|
|
2015-03-03 05:32:48 +01:00
|
|
|
case MENU_OPTIONS:
|
2011-08-24 14:14:44 +02:00
|
|
|
if ((selectedOption == 1) && (engine.useAudio))
|
2011-08-26 22:48:52 +02:00
|
|
|
engine.useSound = !engine.useSound;
|
2011-08-24 14:14:44 +02:00
|
|
|
else if ((selectedOption == 2) && (engine.useAudio))
|
|
|
|
{
|
2011-08-26 22:48:52 +02:00
|
|
|
engine.useMusic = !engine.useMusic;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 22:48:52 +02:00
|
|
|
if (engine.useMusic)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2015-03-08 15:38:58 +01:00
|
|
|
audio_playMusic(
|
|
|
|
"music/walking_among_androids.ogg", 1);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-03-08 15:38:58 +01:00
|
|
|
audio_haltMusic();
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (selectedOption == 3)
|
|
|
|
{
|
2011-08-26 22:48:52 +02:00
|
|
|
engine.fullScreen = !engine.fullScreen;
|
2015-03-03 05:32:48 +01:00
|
|
|
SDL_SetWindowFullscreen(window,
|
|
|
|
(engine.fullScreen ?
|
|
|
|
SDL_WINDOW_FULLSCREEN_DESKTOP : 0));
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
2015-05-22 00:49:04 +02:00
|
|
|
else if (selectedOption == 4)
|
|
|
|
{
|
|
|
|
engine.autoPause = !engine.autoPause;
|
|
|
|
}
|
2011-08-24 14:14:44 +02:00
|
|
|
else if (selectedOption == listLength)
|
2015-03-03 05:32:48 +01:00
|
|
|
{
|
|
|
|
menuType = MENU_MAIN;
|
|
|
|
selectedOption = 1;
|
|
|
|
}
|
2011-08-24 14:14:44 +02:00
|
|
|
createOptionsMenu();
|
|
|
|
break;
|
|
|
|
|
2015-03-03 05:32:48 +01:00
|
|
|
case MENU_CHEAT:
|
2011-08-24 14:14:44 +02:00
|
|
|
if (selectedOption == 1)
|
2011-08-26 16:14:58 +02:00
|
|
|
engine.cheatShield = !engine.cheatShield;
|
2011-08-24 14:14:44 +02:00
|
|
|
else if (selectedOption == 2)
|
2011-08-26 16:14:58 +02:00
|
|
|
engine.cheatAmmo = !engine.cheatAmmo;
|
2011-08-24 14:14:44 +02:00
|
|
|
else if (selectedOption == 3)
|
2011-08-26 16:14:58 +02:00
|
|
|
engine.cheatCash = !engine.cheatCash;
|
2011-08-24 14:14:44 +02:00
|
|
|
else if (selectedOption == 4)
|
2011-08-26 16:14:58 +02:00
|
|
|
engine.cheatTime = !engine.cheatTime;
|
2011-08-24 14:14:44 +02:00
|
|
|
else if (selectedOption == listLength)
|
2015-02-28 01:52:55 +01:00
|
|
|
{
|
2015-03-03 05:32:48 +01:00
|
|
|
menuType = MENU_MAIN;
|
|
|
|
selectedOption = 1;
|
2015-02-28 01:52:55 +01:00
|
|
|
}
|
2015-03-03 05:32:48 +01:00
|
|
|
createCheatMenu();
|
2012-12-09 16:11:55 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2015-03-03 05:32:48 +01:00
|
|
|
menuType = MENU_MAIN;
|
|
|
|
selectedOption = 1;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
delayFrame();
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2015-03-08 15:38:58 +01:00
|
|
|
audio_haltMusic();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
SDL_FreeSurface(prlogo);
|
|
|
|
SDL_FreeSurface(sflogo);
|
|
|
|
|
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
|
|
|
|
|
|
|
resetLists();
|
|
|
|
|
|
|
|
if (selectedOption == 1)
|
2015-02-27 02:51:30 +01:00
|
|
|
{
|
2015-05-21 01:41:43 +02:00
|
|
|
game_init();
|
2011-08-24 14:14:44 +02:00
|
|
|
selectedOption = 2; // go straight to mission 0
|
2015-02-27 02:51:30 +01:00
|
|
|
}
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
if (selectedOption == 3)
|
|
|
|
{
|
2015-05-21 01:41:43 +02:00
|
|
|
game_init();
|
2011-08-24 14:14:44 +02:00
|
|
|
selectedOption = loadGame(continueSaveSlot);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Send back a negative number...
|
|
|
|
if (selectedOption > 4)
|
|
|
|
{
|
|
|
|
selectedOption = -1;
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return selectedOption;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2015-02-27 02:51:30 +01:00
|
|
|
Scrolls the intro text up the screen and nothing else.
|
2011-08-24 14:14:44 +02:00
|
|
|
*/
|
|
|
|
void showStory()
|
|
|
|
{
|
2011-08-26 23:53:46 +02:00
|
|
|
freeGraphics();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2012-03-12 04:16:56 +01:00
|
|
|
int y = screen->h + 20;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
FILE *fp;
|
|
|
|
|
|
|
|
fp = fopen("data/intro.txt", "rb");
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
int nextPos = -1;
|
|
|
|
char string[255];
|
|
|
|
|
2015-02-27 23:59:25 +01:00
|
|
|
while (fscanf(fp, "%d %[^\n]%*c", &nextPos, string) == 2)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
y += nextPos;
|
2011-08-26 23:53:46 +02:00
|
|
|
textSurface(i, string, -1, y, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
|
|
|
|
loadBackground("gfx/startUp.jpg");
|
2015-09-26 14:49:21 +02:00
|
|
|
drawBackGround();
|
2011-08-26 23:53:46 +02:00
|
|
|
flushBuffer();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
while (true)
|
|
|
|
{
|
2011-08-26 23:53:46 +02:00
|
|
|
updateScreen();
|
|
|
|
unBuffer();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
getPlayerInput();
|
|
|
|
|
2013-09-30 16:52:43 +02:00
|
|
|
if ((engine.keyState[KEY_FIRE] || engine.keyState[KEY_ALTFIRE]))
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
|
|
|
|
2012-03-14 17:02:04 +01:00
|
|
|
if (textShape[8].y > (screen->h / 2) + 150)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
for (int i = 0 ; i < 9 ; i++)
|
|
|
|
{
|
2011-08-26 23:53:46 +02:00
|
|
|
textShape[i].y -= 0.33333;
|
|
|
|
blitText(i);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SDL_Delay(3000);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
delayFrame();
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
The game over screen :(
|
|
|
|
*/
|
|
|
|
void gameover()
|
|
|
|
{
|
2011-08-26 23:53:46 +02:00
|
|
|
flushBuffer();
|
|
|
|
freeGraphics();
|
|
|
|
SDL_FillRect(background, NULL, black);
|
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
|
|
|
engine.gameSection = SECTION_INTERMISSION;
|
|
|
|
|
|
|
|
SDL_Surface *gameover = loadImage("gfx/gameover.png");
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
clearScreen(black);
|
|
|
|
updateScreen();
|
|
|
|
clearScreen(black);
|
2011-08-24 14:14:44 +02:00
|
|
|
SDL_Delay(1000);
|
|
|
|
|
2015-03-14 00:02:28 +01:00
|
|
|
audio_playMusic("music/death.ogg", -1);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2012-03-12 04:16:56 +01:00
|
|
|
int x = (screen->w - gameover->w) / 2;
|
|
|
|
int y = (screen->h - gameover->h) / 2;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
updateScreen();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
getPlayerInput();
|
|
|
|
|
2015-05-20 16:53:10 +02:00
|
|
|
if (engine.keyState[KEY_FIRE] || engine.keyState[KEY_ALTFIRE])
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
updateScreen();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
unBuffer();
|
2015-03-29 16:19:53 +02:00
|
|
|
x = ((screen->w - gameover->w) / 2) - RANDRANGE(-2, 2);
|
|
|
|
y = ((screen->h - gameover->h) / 2) - RANDRANGE(-2, 2);
|
2015-09-26 14:49:21 +02:00
|
|
|
screen_blit(gameover, x, y);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
delayFrame();
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
SDL_FreeSurface(gameover);
|
2015-03-08 15:38:58 +01:00
|
|
|
audio_haltMusic();
|
2011-08-26 23:53:46 +02:00
|
|
|
flushBuffer();
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2015-03-04 14:20:11 +01:00
|
|
|
void doCredits()
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
loadBackground("gfx/credits.jpg");
|
2011-08-26 23:53:46 +02:00
|
|
|
flushBuffer();
|
|
|
|
freeGraphics();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
FILE *fp;
|
2015-02-27 23:59:25 +01:00
|
|
|
int lastCredit = -1;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
int yPos = 0;
|
2012-03-12 04:16:56 +01:00
|
|
|
int yPos2 = screen->h;
|
2011-08-24 14:14:44 +02:00
|
|
|
char text[255];
|
2015-02-27 23:59:25 +01:00
|
|
|
int i;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
textObject *credit;
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
clearScreen(black);
|
|
|
|
updateScreen();
|
|
|
|
clearScreen(black);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
drawBackGround();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-03-08 15:38:58 +01:00
|
|
|
audio_playMusic("music/rise_of_spirit.ogg", 1);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-02-27 23:59:25 +01:00
|
|
|
fp = fopen("data/credits.txt", "rb");
|
|
|
|
// FIXME: It would be nice for the size of this array to be determined
|
|
|
|
// by the number of lines in the text file. I'm not sure how to do
|
|
|
|
// that at the moment, so just giving it a very large number for now.
|
|
|
|
credit = (textObject*) malloc(sizeof(textObject) * 300);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-02-27 23:59:25 +01:00
|
|
|
while (fscanf(fp, "%d %[^\n]%*c", &yPos, text) == 2)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2015-02-27 23:59:25 +01:00
|
|
|
lastCredit++;
|
|
|
|
credit[lastCredit].image = textSurface(text, FONT_WHITE);
|
|
|
|
credit[lastCredit].x = (screen->w - credit[lastCredit].image->w) / 2;
|
|
|
|
yPos2 += yPos;
|
|
|
|
credit[lastCredit].y = yPos2;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2015-02-27 23:59:25 +01:00
|
|
|
fclose(fp);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
engine.done = 0;
|
|
|
|
|
2013-09-30 16:52:43 +02:00
|
|
|
engine.keyState[KEY_ESCAPE] = 0;
|
2015-05-20 16:53:10 +02:00
|
|
|
engine.keyState[KEY_FIRE] = 0;
|
|
|
|
engine.keyState[KEY_ALTFIRE] = 0;
|
2011-08-24 14:14:44 +02:00
|
|
|
flushInput();
|
|
|
|
|
|
|
|
while (true)
|
|
|
|
{
|
2011-08-26 23:53:46 +02:00
|
|
|
updateScreen();
|
|
|
|
unBuffer();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
getPlayerInput();
|
2015-05-20 16:53:10 +02:00
|
|
|
if (engine.keyState[KEY_ESCAPE] || engine.keyState[KEY_FIRE] ||
|
|
|
|
engine.keyState[KEY_ALTFIRE])
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
|
|
|
|
2011-08-27 00:29:23 +02:00
|
|
|
float speed = 0.5;
|
2013-09-30 16:52:43 +02:00
|
|
|
if(engine.keyState[KEY_DOWN])
|
2011-08-27 00:29:23 +02:00
|
|
|
speed = 2;
|
2013-09-30 16:52:43 +02:00
|
|
|
else if(engine.keyState[KEY_UP])
|
2011-08-27 00:29:23 +02:00
|
|
|
speed = -2;
|
|
|
|
|
2015-02-27 23:59:25 +01:00
|
|
|
for (i = 0 ; i <= lastCredit ; i++)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2012-03-12 04:16:56 +01:00
|
|
|
if ((credit[i].y > -10) && (credit[i].y < (screen->h + 10)))
|
2015-09-26 14:49:21 +02:00
|
|
|
screen_blit(credit[i].image, (int)credit[i].x, (int)credit[i].y);
|
2012-03-14 17:02:04 +01:00
|
|
|
if (speed > 0 && credit[lastCredit].y > ((screen->h / 2) + 100))
|
2011-08-27 00:29:23 +02:00
|
|
|
credit[i].y -= speed;
|
2012-03-12 04:16:56 +01:00
|
|
|
else if(speed < 0 && credit[0].y < screen->h)
|
2011-08-27 00:29:23 +02:00
|
|
|
credit[i].y -= speed;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2011-08-26 23:53:46 +02:00
|
|
|
delayFrame();
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2015-02-27 23:59:25 +01:00
|
|
|
for (i = 0 ; i <= lastCredit ; i++)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
SDL_FreeSurface(credit[i].image);
|
|
|
|
}
|
|
|
|
|
|
|
|
free(credit);
|
|
|
|
}
|
|
|
|
|