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);
|
fireRocket(self);
|
||||||
|
|
||||||
self->reload = FPS;
|
|
||||||
|
|
||||||
/* don't constantly fire rockets like normal guns */
|
/* don't constantly fire rockets like normal guns */
|
||||||
if (rand() % 3)
|
if (rand() % 3)
|
||||||
{
|
{
|
||||||
|
|
|
@ -155,7 +155,14 @@ static void checkCollisions(Bullet *b)
|
||||||
}
|
}
|
||||||
else if (b->owner == player)
|
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))
|
if (!(e->flags & EF_IMMORTAL))
|
||||||
|
@ -339,6 +346,13 @@ void fireRocket(Entity *owner)
|
||||||
b = createBullet(BT_ROCKET, owner->x, owner->y, owner);
|
b = createBullet(BT_ROCKET, owner->x, owner->y, owner);
|
||||||
|
|
||||||
playBattleSound(b->sound, owner->x, owner->y);
|
playBattleSound(b->sound, owner->x, owner->y);
|
||||||
|
|
||||||
|
owner->reload = FPS;
|
||||||
|
|
||||||
|
if (owner == player)
|
||||||
|
{
|
||||||
|
battle.stats[STAT_ROCKETS_FIRED]++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fireMissile(Entity *owner)
|
void fireMissile(Entity *owner)
|
||||||
|
|
|
@ -40,7 +40,7 @@ static SDL_Texture *smallFighter;
|
||||||
static SDL_Texture *arrowLeft;
|
static SDL_Texture *arrowLeft;
|
||||||
static SDL_Texture *arrowRight;
|
static SDL_Texture *arrowRight;
|
||||||
static int numMessages;
|
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)
|
void initHud(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -197,7 +197,14 @@ static void handleMouse(void)
|
||||||
{
|
{
|
||||||
if (app.mouse.button[SDL_BUTTON_LEFT] && !player->reload && player->guns[0].type)
|
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])
|
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 fireGuns(Entity *owner);
|
||||||
extern void fireMissile(Entity *owner);
|
extern void fireMissile(Entity *owner);
|
||||||
|
extern void fireRocket(Entity *owner);
|
||||||
extern void applyFighterThrust(void);
|
extern void applyFighterThrust(void);
|
||||||
extern void applyFighterBrakes(void);
|
extern void applyFighterBrakes(void);
|
||||||
extern int getDistance(int x1, int y1, int x2, int y2);
|
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||||
|
|
|
@ -160,7 +160,6 @@ enum
|
||||||
BT_MAG,
|
BT_MAG,
|
||||||
BT_ROCKET,
|
BT_ROCKET,
|
||||||
BT_MISSILE,
|
BT_MISSILE,
|
||||||
BT_FF,
|
|
||||||
BT_MAX
|
BT_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -251,6 +250,8 @@ enum
|
||||||
STAT_MISSIONS_COMPLETED,
|
STAT_MISSIONS_COMPLETED,
|
||||||
STAT_SHOTS_FIRED,
|
STAT_SHOTS_FIRED,
|
||||||
STAT_SHOTS_HIT,
|
STAT_SHOTS_HIT,
|
||||||
|
STAT_ROCKETS_FIRED,
|
||||||
|
STAT_ROCKETS_HIT,
|
||||||
STAT_MISSILES_FIRED,
|
STAT_MISSILES_FIRED,
|
||||||
STAT_MISSILES_HIT,
|
STAT_MISSILES_HIT,
|
||||||
STAT_ENEMIES_KILLED,
|
STAT_ENEMIES_KILLED,
|
||||||
|
|
|
@ -28,6 +28,8 @@ static char *statDescription[] = {
|
||||||
"Missons Completed",
|
"Missons Completed",
|
||||||
"Shots Fired",
|
"Shots Fired",
|
||||||
"Shots Hit",
|
"Shots Hit",
|
||||||
|
"Rockets Fired",
|
||||||
|
"Rockets Hit",
|
||||||
"Missiles Fired",
|
"Missiles Fired",
|
||||||
"Missiles Hit",
|
"Missiles Hit",
|
||||||
"Enemies Killed",
|
"Enemies Killed",
|
||||||
|
|
Loading…
Reference in New Issue