Allow the player to select and fire rockets, when using a bomber.

This commit is contained in:
Steve 2015-12-23 16:25:25 +00:00
parent 38587b24f7
commit c3785bcfce
7 changed files with 29 additions and 6 deletions

View File

@ -441,8 +441,6 @@ static void preAttack(void)
{
fireRocket(self);
self->reload = FPS;
/* don't constantly fire rockets like normal guns */
if (rand() % 3)
{

View File

@ -155,7 +155,14 @@ static void checkCollisions(Bullet *b)
}
else if (b->owner == player)
{
battle.stats[STAT_SHOTS_HIT]++;
if (b->type != BT_ROCKET)
{
battle.stats[STAT_SHOTS_HIT]++;
}
else
{
battle.stats[STAT_ROCKETS_HIT]++;
}
}
if (!(e->flags & EF_IMMORTAL))
@ -339,6 +346,13 @@ void fireRocket(Entity *owner)
b = createBullet(BT_ROCKET, owner->x, owner->y, owner);
playBattleSound(b->sound, owner->x, owner->y);
owner->reload = FPS;
if (owner == player)
{
battle.stats[STAT_ROCKETS_FIRED]++;
}
}
void fireMissile(Entity *owner)

View File

@ -40,7 +40,7 @@ static SDL_Texture *smallFighter;
static SDL_Texture *arrowLeft;
static SDL_Texture *arrowRight;
static int numMessages;
static char *gunName[] = {"", "Particle Cannon", "Plasma Cannon", "Laser Cannon", "Mag Cannon"};
static char *gunName[] = {"", "Particle Cannon", "Plasma Cannon", "Laser Cannon", "Mag Cannon", "Rockets"};
void initHud(void)
{

View File

@ -197,7 +197,14 @@ static void handleMouse(void)
{
if (app.mouse.button[SDL_BUTTON_LEFT] && !player->reload && player->guns[0].type)
{
fireGuns(player);
if (player->selectedGunType != BT_ROCKET)
{
fireGuns(player);
}
else
{
fireRocket(player);
}
}
if (app.mouse.button[SDL_BUTTON_RIGHT])

View File

@ -25,6 +25,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 fireRocket(Entity *owner);
extern void applyFighterThrust(void);
extern void applyFighterBrakes(void);
extern int getDistance(int x1, int y1, int x2, int y2);

View File

@ -160,7 +160,6 @@ enum
BT_MAG,
BT_ROCKET,
BT_MISSILE,
BT_FF,
BT_MAX
};
@ -251,6 +250,8 @@ enum
STAT_MISSIONS_COMPLETED,
STAT_SHOTS_FIRED,
STAT_SHOTS_HIT,
STAT_ROCKETS_FIRED,
STAT_ROCKETS_HIT,
STAT_MISSILES_FIRED,
STAT_MISSILES_HIT,
STAT_ENEMIES_KILLED,

View File

@ -28,6 +28,8 @@ static char *statDescription[] = {
"Missons Completed",
"Shots Fired",
"Shots Hit",
"Rockets Fired",
"Rockets Hit",
"Missiles Fired",
"Missiles Hit",
"Enemies Killed",