Implemented Tank Commander boss.
This commit is contained in:
parent
15d6ca5678
commit
ada4768efd
|
@ -38,15 +38,13 @@ static int brakingTimer;
|
|||
static Sprite *missileSprite[2];
|
||||
static Sprite *aimedSprite;
|
||||
|
||||
void initTankCommander(Entity *e)
|
||||
Entity *initTankCommander(void)
|
||||
{
|
||||
Boss *b;
|
||||
|
||||
initBoss(e);
|
||||
|
||||
b = (Boss*)e;
|
||||
b = initBoss();
|
||||
|
||||
STRNCPY(e->name, "Tank Commander", MAX_NAME_LENGTH);
|
||||
STRNCPY(b->name, "Tank Commander", MAX_NAME_LENGTH);
|
||||
|
||||
b->sprite[FACING_LEFT] = getSprite("TankCommanderLeft");
|
||||
b->sprite[FACING_RIGHT] = getSprite("TankCommanderRight");
|
||||
|
@ -54,9 +52,10 @@ void initTankCommander(Entity *e)
|
|||
|
||||
b->flags |= EF_EXPLODES;
|
||||
|
||||
b->health = e->healthMax = 400;
|
||||
b->health = b->healthMax = 400;
|
||||
|
||||
b->activate = activate;
|
||||
b->action = walk;
|
||||
b->walk = walk;
|
||||
b->tick = tick;
|
||||
b->die = die1;
|
||||
|
@ -69,7 +68,11 @@ void initTankCommander(Entity *e)
|
|||
missileSprite[0] = getSprite("MissileRight");
|
||||
missileSprite[1] = getSprite("MissileLeft");
|
||||
|
||||
initTankTrack(tankTrack);
|
||||
tankTrack = initTankTrack(b);
|
||||
|
||||
world.boss = b;
|
||||
|
||||
return (Entity*)b;
|
||||
}
|
||||
|
||||
static void activate(int activate)
|
||||
|
@ -86,7 +89,7 @@ static void activate(int activate)
|
|||
addTeleportStars(self);
|
||||
addTeleportStars(tankTrack);
|
||||
|
||||
playMusic("", 1);
|
||||
playMusic(1);
|
||||
}
|
||||
|
||||
static void tick(void)
|
||||
|
@ -136,7 +139,7 @@ static void lookForPlayer(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (rand() % 100 <15)
|
||||
if (rand() % 100 < 35)
|
||||
{
|
||||
selectWeapon();
|
||||
}
|
||||
|
@ -279,6 +282,8 @@ static void attackMissile(void)
|
|||
missile->sprite[1] = missileSprite[1];
|
||||
|
||||
b->reload = 15;
|
||||
|
||||
initMissile(missile);
|
||||
|
||||
playSound(SND_MISSILE, CH_WEAPON);
|
||||
}
|
||||
|
|
|
@ -20,9 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../../common.h"
|
||||
|
||||
extern void initBoss(Entity *e);
|
||||
extern Boss *initBoss(void);
|
||||
extern Sprite *getSprite(char *name);
|
||||
extern void playMusic(char *filename, int loop);
|
||||
extern void playMusic(int loop);
|
||||
extern void addTeleportStars(Entity *e);
|
||||
extern float limit(float i, float a, float b);
|
||||
extern int rrnd(int low, int high);
|
||||
|
@ -34,9 +34,10 @@ extern Bullet *createBaseBullet(Unit *owner);
|
|||
extern void getSlope(int x1, int y1, int x2, int y2, float *dx, float *dy);
|
||||
extern void addExplosion(float x, float y, int radius, Entity *owner);
|
||||
extern void addScorchDecal(int x, int y);
|
||||
extern void initTankTrack(Entity *e);
|
||||
extern Entity *initTankTrack(Boss *owner);
|
||||
extern void awardTrophy(char *id);
|
||||
extern void entityIdle(void);
|
||||
extern void initMissile(Bullet *b);
|
||||
|
||||
extern Entity *self;
|
||||
extern Game game;
|
||||
|
|
|
@ -20,31 +20,37 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "tankTrack.h"
|
||||
|
||||
static Entity *tankCommander;
|
||||
static Boss *tankCommander;
|
||||
static void tick(void);
|
||||
static void touch(Entity *other);
|
||||
static void animate(void);
|
||||
static void (*superAnimate)(void);
|
||||
static void applyDamage(int amount);
|
||||
|
||||
void initTankTrack(Entity *e, Entity *tank)
|
||||
Entity *initTankTrack(Boss *owner)
|
||||
{
|
||||
initBoss(e);
|
||||
Boss *b;
|
||||
|
||||
b = initBoss();
|
||||
|
||||
superAnimate = e->animate;
|
||||
superAnimate = b->animate;
|
||||
|
||||
e->flags |= EF_EXPLODES | EF_NO_CLIP | EF_WEIGHTLESS | EF_IMMUNE;
|
||||
b->flags |= EF_EXPLODES | EF_NO_CLIP | EF_WEIGHTLESS | EF_IMMUNE;
|
||||
|
||||
e->isMissionTarget = 0;
|
||||
b->isMissionTarget = 0;
|
||||
|
||||
e->sprite[FACING_LEFT] = getSprite("TankTrackLeft");
|
||||
e->sprite[FACING_RIGHT] = getSprite("TankTrackRight");
|
||||
e->sprite[FACING_DIE] = getSprite("TankTrackLeft");
|
||||
b->sprite[FACING_LEFT] = getSprite("TankTrackLeft");
|
||||
b->sprite[FACING_RIGHT] = getSprite("TankTrackRight");
|
||||
b->sprite[FACING_DIE] = getSprite("TankTrackLeft");
|
||||
|
||||
e->tick = tick;
|
||||
e->touch = touch;
|
||||
e->animate = animate;
|
||||
b->tick = tick;
|
||||
b->touch = touch;
|
||||
b->animate = animate;
|
||||
b->applyDamage = applyDamage;
|
||||
|
||||
tankCommander = tank;
|
||||
tankCommander = owner;
|
||||
|
||||
return (Entity*)b;
|
||||
}
|
||||
|
||||
static void tick(void)
|
||||
|
@ -86,6 +92,11 @@ static void touch(Entity *other)
|
|||
}
|
||||
}
|
||||
|
||||
static void applyDamage(int amount)
|
||||
{
|
||||
/* immune to all damage */
|
||||
}
|
||||
|
||||
static void animate(void)
|
||||
{
|
||||
if (tankCommander->dx != 0)
|
||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../../common.h"
|
||||
|
||||
extern void initBoss(Entity *e);
|
||||
extern Boss *initBoss(void);
|
||||
extern Sprite *getSprite(char *name);
|
||||
extern int rrnd(int low, int high);
|
||||
extern void playSound(int snd, int ch);
|
||||
|
|
|
@ -53,6 +53,7 @@ void initEntityFactory(void)
|
|||
addEntityDef("Blaze", initBlaze);
|
||||
addEntityDef("Frost", initFrost);
|
||||
addEntityDef("EyeDroidCommander", initEyeDroidCommander);
|
||||
addEntityDef("TankCommander", initTankCommander);
|
||||
|
||||
addEntityDef("Bob", initBob);
|
||||
addEntityDef("MIA", initMIA);
|
||||
|
|
|
@ -72,5 +72,6 @@ extern Entity *initWeaponPickup(void);
|
|||
extern Entity *initBlaze(void);
|
||||
extern Entity *initFrost(void);
|
||||
extern Entity *initEyeDroidCommander(void);
|
||||
extern Entity *initTankCommander(void);
|
||||
|
||||
extern World world;
|
||||
|
|
Loading…
Reference in New Issue