Allow AI to fire rockets.
This commit is contained in:
parent
bbd61bf8ba
commit
f304e8ca5b
|
@ -371,6 +371,8 @@ static int hasClearShot(void)
|
||||||
static void preAttack(void)
|
static void preAttack(void)
|
||||||
{
|
{
|
||||||
if (!self->reload)
|
if (!self->reload)
|
||||||
|
{
|
||||||
|
if (!(self->aiFlags & AIF_MISSILE_BOAT))
|
||||||
{
|
{
|
||||||
/* force weapon selection, otherwise we'll keep using lasers / mag */
|
/* force weapon selection, otherwise we'll keep using lasers / mag */
|
||||||
canAttack(self->target);
|
canAttack(self->target);
|
||||||
|
@ -384,6 +386,19 @@ static void preAttack(void)
|
||||||
fireMissile(self);
|
fireMissile(self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fireRocket(self);
|
||||||
|
|
||||||
|
self->reload = FPS;
|
||||||
|
|
||||||
|
/* don't constantly fire rockets like normal guns */
|
||||||
|
if (rand() % 5)
|
||||||
|
{
|
||||||
|
self->action = doAI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void flyStraight(void)
|
static void flyStraight(void)
|
||||||
|
|
|
@ -36,6 +36,7 @@ extern int mod(int n, int x);
|
||||||
extern int getDistance(int x1, int y1, int x2, int y2);
|
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||||
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 float getAngle(int x1, int y1, int x2, int y2);
|
extern float getAngle(int x1, int y1, int x2, int y2);
|
||||||
extern void applyFighterThrust(void);
|
extern void applyFighterThrust(void);
|
||||||
extern void applyFighterBrakes(void);
|
extern void applyFighterBrakes(void);
|
||||||
|
|
Loading…
Reference in New Issue