Updated keyboard controls.

This commit is contained in:
Steve 2015-11-26 09:53:49 +00:00
parent 416b50d7eb
commit 10b85b9fd5
2 changed files with 21 additions and 12 deletions

View File

@ -70,6 +70,8 @@ void initPlayer(void)
game.stats[STAT_EPIC_KILL_STREAK] = MAX(game.stats[STAT_EPIC_KILL_STREAK], battle.stats[STAT_EPIC_KILL_STREAK]);
battle.stats[STAT_EPIC_KILL_STREAK] = 0;
setMouse(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2);
}
void doPlayer(void)
@ -123,27 +125,32 @@ static void handleKeyboard(void)
{
if (battle.status == MS_IN_PROGRESS)
{
if (app.keyboard[SDL_SCANCODE_W])
{
cycleRadarZoom();
app.keyboard[SDL_SCANCODE_W] = 0;
}
if (app.keyboard[SDL_SCANCODE_D] && battle.boostTimer == BOOST_RECHARGE_TIME)
if (app.keyboard[SDL_SCANCODE_W] && battle.boostTimer == BOOST_RECHARGE_TIME)
{
playSound(SND_BOOST);
activateBoost();
app.keyboard[SDL_SCANCODE_W] = 0;
}
if (app.keyboard[SDL_SCANCODE_A])
{
selectTarget();
app.keyboard[SDL_SCANCODE_A] = 0;
}
if (app.keyboard[SDL_SCANCODE_D])
{
activateECM();
app.keyboard[SDL_SCANCODE_D] = 0;
}
if (app.keyboard[SDL_SCANCODE_S] && battle.ecmTimer == ECM_RECHARGE_TIME)
{
activateECM();
app.keyboard[SDL_SCANCODE_S] = 0;
applyFighterBrakes();
}
}
}
@ -190,7 +197,7 @@ static void handleMouse(void)
if (app.mouse.button[SDL_BUTTON_X2])
{
selectTarget();
cycleRadarZoom();
app.mouse.button[SDL_BUTTON_X2] = 0;
}

View File

@ -29,6 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern void fireGuns(Entity *owner);
extern void fireMissile(Entity *owner);
extern void applyFighterThrust(void);
extern void applyFighterBrakes(void);
extern int getDistance(int x1, int y1, int x2, int y2);
extern void addHudMessage(SDL_Color c, char *format, ...);
extern int mod(int n, int x);
@ -36,6 +37,7 @@ extern void playSound(int id);
extern void failMission(void);
extern float getAngle(int x1, int y1, int x2, int y2);
extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2);
extern void setMouse(int x, int y);
extern App app;
extern Battle battle;