Allow the player to select and fire rockets, when using a bomber.
This commit is contained in:
parent
38587b24f7
commit
c3785bcfce
|
@ -441,8 +441,6 @@ static void preAttack(void)
|
|||
{
|
||||
fireRocket(self);
|
||||
|
||||
self->reload = FPS;
|
||||
|
||||
/* don't constantly fire rockets like normal guns */
|
||||
if (rand() % 3)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -28,6 +28,8 @@ static char *statDescription[] = {
|
|||
"Missons Completed",
|
||||
"Shots Fired",
|
||||
"Shots Hit",
|
||||
"Rockets Fired",
|
||||
"Rockets Hit",
|
||||
"Missiles Fired",
|
||||
"Missiles Hit",
|
||||
"Enemies Killed",
|
||||
|
|
Loading…
Reference in New Issue