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
|
2017-01-25 16:48:29 +01:00
|
|
|
Copyright (C) 2012, 2015-2017 Julie Marchant <onpon4@riseup.net>
|
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
|
|
|
*/
|
|
|
|
|
2017-01-25 16:48:29 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2017-01-25 16:48:29 +01:00
|
|
|
#include "SDL.h"
|
|
|
|
|
|
|
|
#include "colors.h"
|
2016-11-26 00:21:31 +01:00
|
|
|
#include "defs.h"
|
|
|
|
#include "structs.h"
|
|
|
|
|
2017-01-25 16:48:29 +01:00
|
|
|
#include "alien.h"
|
|
|
|
#include "audio.h"
|
|
|
|
#include "engine.h"
|
|
|
|
#include "explosion.h"
|
|
|
|
#include "game.h"
|
|
|
|
#include "gfx.h"
|
|
|
|
#include "player.h"
|
|
|
|
#include "renderer.h"
|
|
|
|
#include "save.h"
|
|
|
|
#include "screen.h"
|
|
|
|
#include "title.h"
|
|
|
|
#include "window.h"
|
|
|
|
|
2016-01-07 02:35:37 +01:00
|
|
|
static int showGameMenu(int continueSaveSlot)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2015-10-11 18:04:52 +02:00
|
|
|
screen_blitText(TS_START_NEW_GAME);
|
2016-01-10 04:30:25 +01:00
|
|
|
screen_blitText(TS_LOAD_GAME);
|
2015-03-03 05:32:48 +01:00
|
|
|
if (continueSaveSlot != -1)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2015-10-11 18:04:52 +02:00
|
|
|
screen_blitText(TS_CONTINUE_CURRENT_GAME);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
2015-10-11 18:04:52 +02:00
|
|
|
screen_blitText(TS_OPTIONS);
|
2016-11-25 23:23:23 +01:00
|
|
|
screen_blitText(TS_CREDITS);
|
2011-08-24 14:14:44 +02:00
|
|
|
if (engine.cheat)
|
|
|
|
{
|
2016-11-25 23:23:23 +01:00
|
|
|
gfx_textSprites[TS_QUIT].y = screen->h / 3 + 170;
|
2015-10-11 18:04:52 +02:00
|
|
|
screen_blitText(TS_CHEAT_OPTIONS);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-11-25 23:23:23 +01:00
|
|
|
gfx_textSprites[TS_QUIT].y = screen->h / 3 + 150;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
2015-10-11 18:04:52 +02:00
|
|
|
screen_blitText(TS_QUIT);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
if (engine.cheat)
|
2016-11-25 23:23:23 +01:00
|
|
|
return 7;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2016-11-25 23:23:23 +01:00
|
|
|
return 6;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2016-01-07 02:35:37 +01:00
|
|
|
static int showLoadMenu()
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2016-01-07 02:35:37 +01:00
|
|
|
int rtn = 1;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
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++;
|
2016-01-04 04:39:16 +01:00
|
|
|
if (gfx_textSprites[i].image != NULL)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2015-10-11 18:04:52 +02:00
|
|
|
screen_blitText(i);
|
2016-01-04 04:39:16 +01:00
|
|
|
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = gfx_textSprites[i].y + 40;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
}
|
2015-10-11 18:04:52 +02:00
|
|
|
screen_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()
|
|
|
|
{
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_START_GAME, "START GAME",
|
|
|
|
-1, screen->h / 3 + 50, FONT_WHITE);
|
2012-12-09 16:11:55 +01:00
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.difficulty == DIFFICULTY_EASY)
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_DIFFICULTY, "DIFFICULTY - EASY",
|
|
|
|
-1, screen->h / 3 + 70, FONT_WHITE);
|
2015-05-21 01:41:43 +02:00
|
|
|
else if (game.difficulty == DIFFICULTY_HARD)
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_DIFFICULTY, "DIFFICULTY - HARD",
|
|
|
|
-1, screen->h / 3 + 70, FONT_WHITE);
|
2015-05-21 01:41:43 +02:00
|
|
|
else if (game.difficulty == DIFFICULTY_NIGHTMARE)
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_DIFFICULTY, "DIFFICULTY - NIGHTMARE!",
|
|
|
|
-1, screen->h / 3 + 70, FONT_WHITE);
|
2015-05-21 01:41:43 +02:00
|
|
|
else if (game.difficulty == DIFFICULTY_ORIGINAL)
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_DIFFICULTY, "DIFFICULTY - CLASSIC",
|
|
|
|
-1, screen->h / 3 + 70, FONT_WHITE);
|
2012-12-09 16:11:55 +01:00
|
|
|
else
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_DIFFICULTY, "DIFFICULTY - NORMAL",
|
|
|
|
-1, screen->h / 3 + 70, FONT_WHITE);
|
2012-12-09 16:11:55 +01:00
|
|
|
}
|
|
|
|
|
2016-01-07 02:35:37 +01:00
|
|
|
static int showDifficultyMenu()
|
2012-12-09 16:11:55 +01:00
|
|
|
{
|
2016-01-04 04:39:16 +01:00
|
|
|
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 110;
|
2012-12-09 16:11:55 +01:00
|
|
|
|
2015-10-11 18:04:52 +02:00
|
|
|
screen_blitText(TS_START_GAME);
|
|
|
|
screen_blitText(TS_DIFFICULTY);
|
|
|
|
screen_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)
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_SOUND, "SOUND - ON",
|
|
|
|
-1, screen->h / 3 + 50, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
else
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_SOUND, "SOUND - OFF",
|
|
|
|
-1, screen->h / 3 + 50, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 22:48:52 +02:00
|
|
|
if (engine.useMusic)
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_MUSIC, "MUSIC - ON",
|
|
|
|
-1, screen->h / 3 + 70, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
else
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_MUSIC, "MUSIC - OFF",
|
|
|
|
-1, screen->h / 3 + 70, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2011-08-26 22:48:52 +02:00
|
|
|
if (engine.fullScreen)
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_FULLSCREEN, "FULLSCREEN - ON",
|
|
|
|
-1, screen->h / 3 + 90, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
else
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_FULLSCREEN, "FULLSCREEN - OFF",
|
|
|
|
-1, screen->h / 3 + 90, FONT_WHITE);
|
2015-05-22 00:49:04 +02:00
|
|
|
|
|
|
|
if (engine.autoPause)
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_AUTOPAUSE, "AUTOPAUSE - ON",
|
|
|
|
-1, screen->h / 3 + 110, FONT_WHITE);
|
2015-05-22 00:49:04 +02:00
|
|
|
else
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_AUTOPAUSE, "AUTOPAUSE - OFF",
|
|
|
|
-1, screen->h / 3 + 110, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2016-01-07 02:35:37 +01:00
|
|
|
static int showOptionsMenu()
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2016-01-04 04:39:16 +01:00
|
|
|
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 150;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-10-11 18:04:52 +02:00
|
|
|
screen_blitText(TS_SOUND);
|
|
|
|
screen_blitText(TS_MUSIC);
|
|
|
|
screen_blitText(TS_FULLSCREEN);
|
|
|
|
screen_blitText(TS_AUTOPAUSE);
|
|
|
|
screen_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)
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_UNLIMITED_SHIELD, "UNLIMITED SHIELD - ON",
|
|
|
|
-1, screen->h / 3 + 50, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
else
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_UNLIMITED_SHIELD, "UNLIMITED SHIELD - OFF",
|
|
|
|
-1, screen->h / 3 + 50, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
if (engine.cheatAmmo)
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_UNLIMITED_AMMO, "UNLIMITED AMMO - ON",
|
|
|
|
-1, screen->h / 3 + 70, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
else
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_UNLIMITED_AMMO, "UNLIMITED AMMO - OFF",
|
|
|
|
-1, screen->h / 3 + 70, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
if (engine.cheatCash)
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_UNLIMITED_CASH, "UNLIMITED CASH - ON",
|
|
|
|
-1, screen->h / 3 + 90, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
else
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_UNLIMITED_CASH, "UNLIMITED CASH - OFF",
|
|
|
|
-1, screen->h / 3 + 90, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
if (engine.cheatTime)
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_UNLIMITED_TIME, "UNLIMITED TIME - ON",
|
|
|
|
-1, screen->h / 3 + 110, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
else
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_UNLIMITED_TIME, "UNLIMITED TIME - OFF",
|
|
|
|
-1, screen->h / 3 + 110, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2016-01-07 02:35:37 +01:00
|
|
|
static int showCheatMenu()
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2016-01-04 04:39:16 +01:00
|
|
|
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 150;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-10-11 18:04:52 +02:00
|
|
|
screen_blitText(TS_UNLIMITED_SHIELD);
|
|
|
|
screen_blitText(TS_UNLIMITED_AMMO);
|
|
|
|
screen_blitText(TS_UNLIMITED_CASH);
|
|
|
|
screen_blitText(TS_UNLIMITED_TIME);
|
|
|
|
screen_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.
|
|
|
|
*/
|
2016-11-25 23:10:08 +01:00
|
|
|
int title_show()
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2016-01-07 02:35:37 +01:00
|
|
|
int continueSaveSlot;
|
|
|
|
|
|
|
|
int prx;
|
|
|
|
int pry;
|
|
|
|
int sfx;
|
|
|
|
int sfy;
|
|
|
|
|
|
|
|
int then;
|
|
|
|
int now;
|
|
|
|
|
|
|
|
int redGlow = 255;
|
|
|
|
int redDir = -2;
|
|
|
|
char buildVersion[25];
|
|
|
|
|
|
|
|
int selectedOption = 1;
|
2016-11-19 17:43:50 +01:00
|
|
|
int skip = 0;
|
2016-11-25 23:23:23 +01:00
|
|
|
int listLength = 6; // menu list length
|
2016-01-07 02:35:37 +01:00
|
|
|
int menuType = MENU_MAIN;
|
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
game_init();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
engine.gameSection = SECTION_TITLE;
|
|
|
|
|
2015-11-02 23:53:05 +01:00
|
|
|
screen_flushBuffer();
|
2016-01-02 22:59:48 +01:00
|
|
|
gfx_free();
|
2016-11-23 03:16:49 +01:00
|
|
|
engine_resetLists();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
// 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
|
|
|
|
2016-11-25 18:50:32 +01:00
|
|
|
gfx_loadSprites();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-11-07 03:35:07 +01:00
|
|
|
screen_clear(black);
|
2015-10-27 01:07:31 +01:00
|
|
|
renderer_update();
|
2015-11-07 03:35:07 +01:00
|
|
|
screen_clear(black);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2016-11-17 01:43:03 +01:00
|
|
|
continueSaveSlot = save_initSlots();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2016-11-25 18:50:32 +01:00
|
|
|
gfx_loadBackground("gfx/spirit.jpg");
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
SDL_Surface *prlogo, *sflogo;
|
2016-01-02 22:59:48 +01:00
|
|
|
prlogo = gfx_loadImage("gfx/prlogo.png");
|
|
|
|
sflogo = gfx_loadImage("gfx/sflogo.png");
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2016-01-07 02:35:37 +01:00
|
|
|
prx = ((screen->w - prlogo->w) / 2);
|
|
|
|
pry = ((screen->h - prlogo->h) / 2);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2016-01-07 02:35:37 +01:00
|
|
|
sfx = ((screen->w - sflogo->w) / 2);
|
|
|
|
sfy = ((screen->h - sflogo->h) / 3);
|
2016-01-04 00:19:20 +01:00
|
|
|
|
|
|
|
gfx_createTextObject(TS_PRESENTS, "PRESENTS",
|
|
|
|
-1, screen->h / 2, FONT_WHITE);
|
|
|
|
gfx_createTextObject(TS_AN_SDL_GAME, "AN SDL GAME",
|
|
|
|
-1, screen->h / 2, FONT_WHITE);
|
|
|
|
gfx_createTextObject(TS_START_NEW_GAME, "START NEW GAME",
|
|
|
|
-1, screen->h / 3 + 50, FONT_WHITE);
|
|
|
|
gfx_createTextObject(TS_LOAD_GAME, "LOAD GAME",
|
|
|
|
-1, screen->h / 3 + 70, FONT_WHITE);
|
|
|
|
gfx_createTextObject(TS_CONTINUE_CURRENT_GAME, "CONTINUE CURRENT GAME",
|
|
|
|
-1, screen->h / 3 + 90, FONT_WHITE);
|
|
|
|
gfx_createTextObject(TS_OPTIONS, "OPTIONS",
|
|
|
|
-1, screen->h / 3 + 110, FONT_WHITE);
|
2016-11-25 23:23:23 +01:00
|
|
|
gfx_createTextObject(TS_CREDITS, "CREDITS",
|
2016-01-04 00:19:20 +01:00
|
|
|
-1, screen->h / 3 + 130, FONT_WHITE);
|
2016-11-25 23:23:23 +01:00
|
|
|
gfx_createTextObject(TS_CHEAT_OPTIONS, "CHEAT OPTIONS",
|
|
|
|
-1, screen->h / 3 + 150, FONT_WHITE);
|
2016-01-04 00:19:20 +01:00
|
|
|
gfx_createTextObject(TS_QUIT, "QUIT",
|
2016-11-25 23:23:23 +01:00
|
|
|
-1, screen->h / 3 + 150, FONT_WHITE);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
createOptionsMenu();
|
2012-12-09 16:11:55 +01:00
|
|
|
createDifficultyMenu();
|
2015-12-31 16:47:27 +01:00
|
|
|
gfx_createTextObject(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
|
|
|
|
2016-01-07 02:35:37 +01:00
|
|
|
then = SDL_GetTicks();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2016-08-04 17:51:46 +02:00
|
|
|
sprintf(buildVersion, "Version %s", VERSION );
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
SDL_Rect optionRec;
|
|
|
|
|
2016-01-04 00:19:20 +01:00
|
|
|
optionRec.x = screen->w / 2 - 110;
|
|
|
|
optionRec.y = screen->h / 3 + 45;
|
2011-08-24 14:14:44 +02:00
|
|
|
optionRec.h = 22;
|
|
|
|
optionRec.w = 215;
|
|
|
|
|
2016-01-10 04:30:25 +01:00
|
|
|
if (continueSaveSlot != -1)
|
|
|
|
{
|
|
|
|
selectedOption = 3;
|
|
|
|
optionRec.y += 40;
|
|
|
|
}
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-11-07 01:43:34 +01:00
|
|
|
screen_drawBackground();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
engine.done = 0;
|
2016-11-26 00:01:36 +01:00
|
|
|
player_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)
|
|
|
|
{
|
2015-10-27 01:07:31 +01:00
|
|
|
renderer_update();
|
2015-11-02 23:53:05 +01:00
|
|
|
screen_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);
|
2016-01-04 00:19:20 +01:00
|
|
|
if (aliens[i].x > screen->w + 30)
|
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-10-11 18:04:52 +02:00
|
|
|
screen_blitText(TS_PRESENTS);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
else if ((now - then > 16000) && (now - then < 21000) && (!skip))
|
|
|
|
{
|
2015-10-11 18:04:52 +02:00
|
|
|
screen_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-11-02 23:53:05 +01:00
|
|
|
screen_addBuffer(0, 0, screen->w, screen->h);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-12-31 16:47:27 +01:00
|
|
|
screen_drawRect(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)
|
2016-01-10 04:30:25 +01:00
|
|
|
if (selectedOption == 3)
|
2015-03-03 05:32:48 +01:00
|
|
|
if (continueSaveSlot == -1)
|
2016-01-10 04:30:25 +01:00
|
|
|
selectedOption = 2;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
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)
|
2016-01-10 04:30:25 +01:00
|
|
|
if (selectedOption == 3)
|
2015-03-03 05:32:48 +01:00
|
|
|
if (continueSaveSlot == -1)
|
2011-08-24 14:14:44 +02:00
|
|
|
selectedOption = 4;
|
|
|
|
}
|
|
|
|
|
2016-01-04 00:19:20 +01:00
|
|
|
optionRec.y = screen->h / 3 + 26 + (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)
|
|
|
|
{
|
2016-01-04 00:00:22 +01:00
|
|
|
gfx_renderString("Copyright Parallel Realities 2003",
|
2017-02-21 03:46:35 +01:00
|
|
|
5, gfx_background->h - 60, FONT_WHITE, 0, gfx_background);
|
2015-11-06 16:12:57 +01:00
|
|
|
gfx_renderString("Copyright Guus Sliepen, Astrid S. de Wijn and others 2012",
|
2017-02-21 03:46:35 +01:00
|
|
|
5, gfx_background->h - 40, FONT_WHITE, 0, gfx_background);
|
2017-01-22 05:55:54 +01:00
|
|
|
gfx_renderString("Copyright 2015-2017 Julie Marchant",
|
2017-02-21 03:46:35 +01:00
|
|
|
5, gfx_background->h - 20, FONT_WHITE, 0, gfx_background);
|
|
|
|
gfx_renderString(buildVersion, gfx_background->w - 6 - strlen(buildVersion) * 9,
|
|
|
|
gfx_background->h - 20, FONT_WHITE, 0, gfx_background);
|
2016-01-04 00:00:22 +01:00
|
|
|
screen_addBuffer(0, 0, screen->w, screen->h);
|
2016-11-19 17:43:50 +01:00
|
|
|
skip = 1;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-26 00:01:36 +01:00
|
|
|
player_getInput();
|
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))
|
|
|
|
{
|
2016-01-04 00:00:22 +01:00
|
|
|
gfx_renderString("Copyright Parallel Realities 2003",
|
|
|
|
5, screen->h - 60, FONT_WHITE, 0, gfx_background);
|
2015-11-06 16:12:57 +01:00
|
|
|
gfx_renderString("Copyright Guus Sliepen, Astrid S. de Wijn and others 2012",
|
2016-01-04 00:00:22 +01:00
|
|
|
5, screen->h - 40, FONT_WHITE, 0, gfx_background);
|
2017-01-25 16:48:29 +01:00
|
|
|
gfx_renderString("Copyright 2015-2017 Julie Marchant",
|
2016-01-04 00:00:22 +01:00
|
|
|
5, screen->h - 20, FONT_WHITE, 0, gfx_background);
|
|
|
|
gfx_renderString(buildVersion, screen->w - 6 - strlen(buildVersion) * 9,
|
|
|
|
screen->h - 20, FONT_WHITE, 0, gfx_background);
|
2017-02-05 00:29:44 +01:00
|
|
|
screen_addBuffer(0, screen->h - 40, screen->w, 40);
|
2016-11-19 17:43:50 +01:00
|
|
|
skip = 1;
|
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;
|
2017-02-05 18:31:08 +01:00
|
|
|
selectedOption = 5;
|
2015-03-03 05:32:48 +01:00
|
|
|
}
|
2011-08-24 14:14:44 +02:00
|
|
|
else if (selectedOption == 5)
|
2016-11-25 23:23:23 +01:00
|
|
|
{
|
|
|
|
engine.done = 1;
|
|
|
|
}
|
|
|
|
else if (selectedOption == 6)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
2016-11-25 23:23:23 +01:00
|
|
|
else if (selectedOption == 7)
|
2011-08-24 14:14:44 +02:00
|
|
|
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))
|
2017-02-05 18:31:08 +01:00
|
|
|
{
|
2011-08-26 22:48:52 +02:00
|
|
|
engine.useSound = !engine.useSound;
|
2017-02-05 18:31:08 +01:00
|
|
|
selectedOption = listLength;
|
|
|
|
}
|
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
|
|
|
}
|
2017-02-05 18:31:08 +01:00
|
|
|
selectedOption = listLength;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
else if (selectedOption == 3)
|
|
|
|
{
|
2017-02-05 18:24:22 +01:00
|
|
|
engine.fullScreen = !engine.fullScreen;
|
|
|
|
SDL_SetWindowFullscreen(window,
|
2017-02-05 22:40:59 +01:00
|
|
|
(engine.fullScreen ? FULLSCREEN : 0));
|
2017-02-05 18:31:08 +01:00
|
|
|
selectedOption = listLength;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
2015-05-22 00:49:04 +02:00
|
|
|
else if (selectedOption == 4)
|
|
|
|
{
|
|
|
|
engine.autoPause = !engine.autoPause;
|
2017-02-05 18:31:08 +01:00
|
|
|
selectedOption = listLength;
|
2015-05-22 00:49:04 +02:00
|
|
|
}
|
2011-08-24 14:14:44 +02:00
|
|
|
else if (selectedOption == listLength)
|
2015-03-03 05:32:48 +01:00
|
|
|
{
|
|
|
|
menuType = MENU_MAIN;
|
2017-02-05 18:31:08 +01:00
|
|
|
selectedOption = 4;
|
2015-03-03 05:32:48 +01:00
|
|
|
}
|
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;
|
|
|
|
}
|
|
|
|
}
|
2017-02-05 18:24:22 +01:00
|
|
|
engine.keyState[KEY_FIRE] = 0;
|
|
|
|
engine.keyState[KEY_ALTFIRE] = 0;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2015-11-07 03:35:07 +01:00
|
|
|
game_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);
|
|
|
|
|
2017-02-05 18:24:22 +01:00
|
|
|
engine.keyState[KEY_FIRE] = 0;
|
|
|
|
engine.keyState[KEY_ALTFIRE] = 0;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2016-11-23 03:16:49 +01:00
|
|
|
engine_resetLists();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
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();
|
2016-11-17 01:43:03 +01:00
|
|
|
selectedOption = save_load(continueSaveSlot);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2016-11-25 23:23:23 +01:00
|
|
|
if (selectedOption == 5)
|
|
|
|
{
|
|
|
|
title_showCredits();
|
|
|
|
selectedOption = 0;
|
|
|
|
}
|
|
|
|
|
2011-08-24 14:14:44 +02:00
|
|
|
// Send back a negative number...
|
2016-11-25 23:23:23 +01:00
|
|
|
if (selectedOption > 5)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
selectedOption = -1;
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return selectedOption;
|
|
|
|
}
|
|
|
|
|
2016-11-25 23:10:08 +01:00
|
|
|
void title_showCredits()
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2016-11-25 18:50:32 +01:00
|
|
|
gfx_loadBackground("gfx/credits.jpg");
|
2015-11-02 23:53:05 +01:00
|
|
|
screen_flushBuffer();
|
2016-01-02 22:59:48 +01:00
|
|
|
gfx_free();
|
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
|
|
|
|
2016-11-26 00:35:25 +01:00
|
|
|
TextObject *credit;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-11-07 03:35:07 +01:00
|
|
|
screen_clear(black);
|
2015-10-27 01:07:31 +01:00
|
|
|
renderer_update();
|
2015-11-07 03:35:07 +01:00
|
|
|
screen_clear(black);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-11-07 01:43:34 +01:00
|
|
|
screen_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.
|
2016-11-26 00:35:25 +01:00
|
|
|
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++;
|
2015-12-31 16:47:27 +01:00
|
|
|
credit[lastCredit].image = gfx_createTextSurface(text, FONT_WHITE);
|
2015-02-27 23:59:25 +01:00
|
|
|
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;
|
2016-11-26 00:01:36 +01:00
|
|
|
player_flushInput();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2016-11-19 17:43:50 +01:00
|
|
|
while (1)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2015-10-27 01:07:31 +01:00
|
|
|
renderer_update();
|
2015-11-02 23:53:05 +01:00
|
|
|
screen_unBuffer();
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2016-11-26 00:01:36 +01:00
|
|
|
player_getInput();
|
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
|
|
|
}
|
|
|
|
|
2015-11-07 03:35:07 +01:00
|
|
|
game_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);
|
|
|
|
}
|
|
|
|
|