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