diff --git a/Makefile b/Makefile index 601e9a1..84ea8f9 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ CXXFLAGS ?= -O2 -Wall -g CXXFLAGS += `pkg-config --cflags sdl2 SDL2_image SDL2_mixer` LIBS = `pkg-config --libs sdl2 SDL2_image SDL2_mixer` -OBJS = alien.o audio.o bullet.o cargo.o collectable.o events.o explosions.o game.o globals.o graphics.o init.o intermission.o loadSave.o messages.o misc.o missions.o player.o resources.o script.o ship.o shop.o Starfighter.o title.o weapons.o +OBJS = alien.o audio.o bullet.o cargo.o collectable.o explosions.o game.o globals.o graphics.o init.o intermission.o loadSave.o messages.o misc.o missions.o player.o resources.o script.o ship.o shop.o Starfighter.o title.o weapons.o VERSION = 1.3.2-dev PROG = starfighter diff --git a/src/Starfighter.h b/src/Starfighter.h index e7d4f0f..128506e 100644 --- a/src/Starfighter.h +++ b/src/Starfighter.h @@ -40,7 +40,6 @@ along with this program. If not, see . #include "bullet.h" #include "cargo.h" #include "collectable.h" -#include "events.h" #include "explosions.h" #include "game.h" #include "globals.h" diff --git a/src/defs.h b/src/defs.h index 1cc879e..df70309 100644 --- a/src/defs.h +++ b/src/defs.h @@ -422,7 +422,7 @@ extern const char *systemNames[]; extern const char *systemBackground[]; -const char rate2reload[6] = {15, 15, 13, 11, 9, 7}; +const int rate2reload[6] = {15, 15, 13, 11, 9, 7}; const int screenWidth = 800; const int screenHeight = 600; const int xViewBorder = 100; diff --git a/src/events.cpp b/src/events.cpp deleted file mode 100644 index 5bd9783..0000000 --- a/src/events.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright (C) 2003 Parallel Realities -Copyright (C) 2011, 2013 Guus Sliepen - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 3 -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 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include "Starfighter.h" - -/* -Checked during the main game loop. When the game is paused -it goes into a constant loop checking this routine. If escape is -pressed, the game automatically ends and goes back to the title screen -*/ -bool checkPauseRequest() -{ - getPlayerInput(); - - if (engine.keyState[KEY_ESCAPE]) - { - engine.paused = false; - engine.done = 1; - player.shield = 0; - return true; - } - - if (engine.keyState[KEY_PAUSE]) - { - engine.paused = false; - engine.keyState[KEY_PAUSE] = 0; - } - - return false; -} diff --git a/src/events.h b/src/events.h deleted file mode 100644 index 0a59c23..0000000 --- a/src/events.h +++ /dev/null @@ -1,25 +0,0 @@ -/* -Copyright (C) 2003 Parallel Realities -Copyright (C) 2011 Guus Sliepen -Copyright (C) 2015 Julian Marchant - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 3 -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 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#ifndef EVENTS_H -#define EVENTS_H - -extern bool checkPauseRequest(); - -#endif diff --git a/src/game.cpp b/src/game.cpp index c958ee6..6bce150 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1433,6 +1433,32 @@ static void game_doDebris() } } +/* +Checked during the main game loop. When the game is paused +it goes into a constant loop checking this routine. If escape is +pressed, the game automatically ends and goes back to the title screen +*/ +static bool game_checkPauseRequest() +{ + getPlayerInput(); + + if (engine.keyState[KEY_ESCAPE]) + { + engine.paused = false; + engine.done = 1; + player.shield = 0; + return true; + } + + if (engine.keyState[KEY_PAUSE]) + { + engine.paused = false; + engine.keyState[KEY_PAUSE] = 0; + } + + return false; +} + int mainGameLoop() { resetLists(); @@ -1722,7 +1748,7 @@ int mainGameLoop() while (engine.paused) { - engine.done = checkPauseRequest(); + engine.done = game_checkPauseRequest(); delayFrame(); } }