More cleanup.
It looks like I'm finally almost done with this! The only thing left is gradually replacing "Starfighter.h" imports with imports of what actually is needed.
This commit is contained in:
parent
65e8142959
commit
60ed5cbd65
|
@ -17,8 +17,28 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Starfighter.h"
|
||||
#include <math.h>
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
#include "defs.h"
|
||||
#include "structs.h"
|
||||
|
||||
#include "alien.h"
|
||||
#include "audio.h"
|
||||
#include "bullet.h"
|
||||
#include "cargo.h"
|
||||
#include "collectable.h"
|
||||
#include "engine.h"
|
||||
#include "game.h"
|
||||
#include "gfx.h"
|
||||
#include "info.h"
|
||||
#include "mission.h"
|
||||
#include "player.h"
|
||||
#include "radio.h"
|
||||
#include "screen.h"
|
||||
#include "ship.h"
|
||||
#include "weapons.h"
|
||||
|
||||
Object alien_defs[CD_MAX];
|
||||
Object aliens[ALIEN_MAX];
|
||||
|
|
|
@ -17,7 +17,17 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Starfighter.h"
|
||||
#include <math.h>
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_mixer.h"
|
||||
|
||||
#include "defs.h"
|
||||
#include "structs.h"
|
||||
|
||||
#include "game.h"
|
||||
#include "engine.h"
|
||||
#include "screen.h"
|
||||
|
||||
static Mix_Chunk *sound[SFX_MAX];
|
||||
static Mix_Music *music = NULL;
|
||||
|
|
|
@ -17,7 +17,18 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Starfighter.h"
|
||||
#include <math.h>
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
#include "defs.h"
|
||||
#include "structs.h"
|
||||
|
||||
#include "alien.h"
|
||||
#include "engine.h"
|
||||
#include "game.h"
|
||||
#include "gfx.h"
|
||||
#include "player.h"
|
||||
|
||||
void bullet_add(Object *theWeapon, Object *attacker, int y, int dy)
|
||||
{
|
||||
|
|
|
@ -373,13 +373,13 @@ void cutscene_init(int scene)
|
|||
|
||||
SDL_Surface *face;
|
||||
|
||||
flushInput();
|
||||
player_flushInput();
|
||||
|
||||
while (1)
|
||||
{
|
||||
renderer_update();
|
||||
screen_unBuffer();
|
||||
getPlayerInput();
|
||||
player_getInput();
|
||||
game_doStars();
|
||||
game_doExplosions();
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ void engine_showError(int errorId, const char *name)
|
|||
|
||||
while (!engine.keyState[KEY_ALTFIRE])
|
||||
{
|
||||
getPlayerInput();
|
||||
player_getInput();
|
||||
game_delayFrame();
|
||||
}
|
||||
|
||||
|
|
18
src/game.cpp
18
src/game.cpp
|
@ -2038,7 +2038,7 @@ pressed, the game automatically ends and goes back to the title screen
|
|||
*/
|
||||
static int game_checkPauseRequest()
|
||||
{
|
||||
getPlayerInput();
|
||||
player_getInput();
|
||||
|
||||
if (engine.keyState[KEY_ESCAPE])
|
||||
{
|
||||
|
@ -2094,12 +2094,12 @@ static void game_showGameOver()
|
|||
|
||||
renderer_update();
|
||||
|
||||
flushInput();
|
||||
player_flushInput();
|
||||
engine.keyState[KEY_FIRE] = engine.keyState[KEY_ALTFIRE] = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
getPlayerInput();
|
||||
player_getInput();
|
||||
|
||||
if (engine.keyState[KEY_FIRE] || engine.keyState[KEY_ALTFIRE])
|
||||
break;
|
||||
|
@ -2127,7 +2127,7 @@ int game_mainLoop()
|
|||
mission_showStartScreen();
|
||||
|
||||
cargo_init();
|
||||
initPlayer();
|
||||
player_init();
|
||||
aliens_init();
|
||||
|
||||
// specific for Phoebe being captured!
|
||||
|
@ -2294,7 +2294,7 @@ int game_mainLoop()
|
|||
|
||||
engine.keyState[KEY_FIRE] = 0;
|
||||
engine.keyState[KEY_ALTFIRE] = 0;
|
||||
flushInput();
|
||||
player_flushInput();
|
||||
|
||||
while (engine.done != 1)
|
||||
{
|
||||
|
@ -2320,7 +2320,7 @@ int game_mainLoop()
|
|||
{
|
||||
if ((!mission_checkFailed()) && (game.area != MISN_VENUS))
|
||||
{
|
||||
leaveSector();
|
||||
player_leaveSector();
|
||||
if ((engine.done == 2) &&
|
||||
(game.area != MISN_DORIM) &&
|
||||
(game.area != MISN_SIVEDI))
|
||||
|
@ -2369,7 +2369,7 @@ int game_mainLoop()
|
|||
}
|
||||
else
|
||||
{
|
||||
getPlayerInput();
|
||||
player_getInput();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2384,7 +2384,7 @@ int game_mainLoop()
|
|||
}
|
||||
else
|
||||
{
|
||||
getPlayerInput();
|
||||
player_getInput();
|
||||
}
|
||||
|
||||
screen_unBuffer();
|
||||
|
@ -2509,7 +2509,7 @@ int game_mainLoop()
|
|||
rtn = 0;
|
||||
}
|
||||
|
||||
exitPlayer();
|
||||
player_exit();
|
||||
|
||||
return rtn;
|
||||
}
|
||||
|
|
|
@ -199,7 +199,7 @@ Drives the cursor. Is used by some other screens too
|
|||
*/
|
||||
static void intermission_doCursor()
|
||||
{
|
||||
getPlayerInput();
|
||||
player_getInput();
|
||||
|
||||
LIMIT(engine.cursor_x, 10, screen->w - 10 - gfx_sprites[SP_CURSOR]->w);
|
||||
LIMIT(engine.cursor_y, 10, screen->h - 10 - gfx_sprites[SP_CURSOR]->h);
|
||||
|
@ -1346,7 +1346,7 @@ int intermission()
|
|||
engine.ssy = 0;
|
||||
|
||||
intermission_setStatusLines();
|
||||
initShop();
|
||||
shop_init();
|
||||
intermission_setPlanets();
|
||||
|
||||
SDL_Surface *statsSurface = gfx_createAlphaRect(600, 330, 0x00, 0x00, 0x99);
|
||||
|
@ -1428,7 +1428,7 @@ int intermission()
|
|||
else
|
||||
player.shield = player.maxShield;
|
||||
|
||||
flushInput();
|
||||
player_flushInput();
|
||||
engine.keyState[KEY_FIRE] = engine.keyState[KEY_ALTFIRE] = 0;
|
||||
engine.done = 0;
|
||||
|
||||
|
@ -1548,7 +1548,7 @@ int intermission()
|
|||
break;
|
||||
|
||||
case 4:
|
||||
showShop();
|
||||
shop_show();
|
||||
break;
|
||||
|
||||
case 5:
|
||||
|
|
|
@ -1092,7 +1092,7 @@ void mission_showStartScreen()
|
|||
|
||||
renderer_update();
|
||||
|
||||
flushInput();
|
||||
player_flushInput();
|
||||
engine.done = 0;
|
||||
engine.keyState[KEY_FIRE] = 0;
|
||||
engine.keyState[KEY_ALTFIRE] = 0;
|
||||
|
@ -1101,7 +1101,7 @@ void mission_showStartScreen()
|
|||
while (1)
|
||||
{
|
||||
game_delayFrame();
|
||||
getPlayerInput();
|
||||
player_getInput();
|
||||
if ((engine.keyState[KEY_FIRE]) || (engine.keyState[KEY_ALTFIRE]) ||
|
||||
(engine.keyState[KEY_ESCAPE]))
|
||||
break;
|
||||
|
@ -1200,14 +1200,14 @@ void mission_showFinishedScreen()
|
|||
|
||||
renderer_update();
|
||||
|
||||
flushInput();
|
||||
player_flushInput();
|
||||
engine.done = 0;
|
||||
engine.keyState[KEY_FIRE] = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
game_delayFrame();
|
||||
getPlayerInput();
|
||||
player_getInput();
|
||||
if ((engine.keyState[KEY_FIRE]))
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ int player_chargerFired = 0;
|
|||
/*
|
||||
Initialises the player for a new game.
|
||||
*/
|
||||
void initPlayer()
|
||||
void player_init()
|
||||
{
|
||||
player.active = 1;
|
||||
player.x = screen->w / 2;
|
||||
|
@ -93,7 +93,7 @@ void player_checkShockDamage(float x, float y)
|
|||
}
|
||||
}
|
||||
|
||||
void exitPlayer()
|
||||
void player_exit()
|
||||
{
|
||||
player_chargerFired = 0;
|
||||
|
||||
|
@ -101,7 +101,7 @@ void exitPlayer()
|
|||
player.ammo[1] = 0;
|
||||
}
|
||||
|
||||
void flushInput()
|
||||
void player_flushInput()
|
||||
{
|
||||
for (int i = 0; i < KEY_LAST; i++)
|
||||
engine.keyState[i] = 0;
|
||||
|
@ -166,7 +166,7 @@ static enum keys mapkey(uint32_t code) {
|
|||
}
|
||||
}
|
||||
|
||||
void getPlayerInput()
|
||||
void player_getInput()
|
||||
{
|
||||
while (SDL_PollEvent(&engine.event))
|
||||
{
|
||||
|
@ -292,7 +292,7 @@ void getPlayerInput()
|
|||
|
||||
}
|
||||
|
||||
void leaveSector()
|
||||
void player_leaveSector()
|
||||
{
|
||||
engine.keyState[KEY_UP] = 0;
|
||||
engine.keyState[KEY_DOWN] = 0;
|
||||
|
|
10
src/player.h
10
src/player.h
|
@ -23,12 +23,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
extern Object player;
|
||||
extern int player_chargerFired;
|
||||
|
||||
extern void initPlayer();
|
||||
void player_init();
|
||||
void player_setTarget(int index);
|
||||
void player_checkShockDamage(float x, float y);
|
||||
extern void exitPlayer();
|
||||
extern void flushInput();
|
||||
extern void getPlayerInput();
|
||||
extern void leaveSector();
|
||||
void player_exit();
|
||||
void player_flushInput();
|
||||
void player_getInput();
|
||||
void player_leaveSector();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -311,7 +311,7 @@ static void drawShop()
|
|||
}
|
||||
}
|
||||
|
||||
void initShop()
|
||||
void shop_init()
|
||||
{
|
||||
/* ----------- Temporary Items ----------- */
|
||||
|
||||
|
@ -1010,7 +1010,7 @@ static void sell(int i)
|
|||
save(0);
|
||||
}
|
||||
|
||||
void showShop()
|
||||
void shop_show()
|
||||
{
|
||||
int icons = SHOP_MAX;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#ifndef SHOP_H
|
||||
#define SHOP_H
|
||||
|
||||
extern void initShop();
|
||||
extern void showShop();
|
||||
void shop_init();
|
||||
void shop_show();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -306,7 +306,7 @@ int title_show()
|
|||
screen_drawBackground();
|
||||
|
||||
engine.done = 0;
|
||||
flushInput();
|
||||
player_flushInput();
|
||||
engine.keyState[KEY_FIRE] = engine.keyState[KEY_ALTFIRE] = 0;
|
||||
|
||||
audio_playMusic("music/walking_among_androids.ogg", 1);
|
||||
|
@ -419,7 +419,7 @@ int title_show()
|
|||
}
|
||||
}
|
||||
|
||||
getPlayerInput();
|
||||
player_getInput();
|
||||
|
||||
if ((engine.keyState[KEY_FIRE] || engine.keyState[KEY_ALTFIRE]))
|
||||
{
|
||||
|
@ -654,14 +654,14 @@ void title_showCredits()
|
|||
engine.keyState[KEY_ESCAPE] = 0;
|
||||
engine.keyState[KEY_FIRE] = 0;
|
||||
engine.keyState[KEY_ALTFIRE] = 0;
|
||||
flushInput();
|
||||
player_flushInput();
|
||||
|
||||
while (1)
|
||||
{
|
||||
renderer_update();
|
||||
screen_unBuffer();
|
||||
|
||||
getPlayerInput();
|
||||
player_getInput();
|
||||
if (engine.keyState[KEY_ESCAPE] || engine.keyState[KEY_FIRE] ||
|
||||
engine.keyState[KEY_ALTFIRE])
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue