Boss updates.
This commit is contained in:
parent
258afd624d
commit
0d08f6096f
|
@ -20,13 +20,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "blaze.h"
|
#include "blaze.h"
|
||||||
|
|
||||||
void initBlaze(Entity *e)
|
Entity *initBlaze(void)
|
||||||
{
|
{
|
||||||
Boss *b;
|
Boss *b;
|
||||||
|
|
||||||
b = (Boss*)e;
|
b = initBlobBoss();
|
||||||
|
|
||||||
initBlobBoss(b);
|
|
||||||
|
|
||||||
b->weakAgainst = ENV_WATER;
|
b->weakAgainst = ENV_WATER;
|
||||||
|
|
||||||
|
@ -35,4 +33,6 @@ void initBlaze(Entity *e)
|
||||||
b->sprite[FACING_LEFT] = getSprite("BlazeLeft");
|
b->sprite[FACING_LEFT] = getSprite("BlazeLeft");
|
||||||
b->sprite[FACING_RIGHT] = getSprite("BlazeRight");
|
b->sprite[FACING_RIGHT] = getSprite("BlazeRight");
|
||||||
b->sprite[FACING_DIE] = getSprite("BlazeSpin");
|
b->sprite[FACING_DIE] = getSprite("BlazeSpin");
|
||||||
|
|
||||||
|
return (Entity*)b;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,5 +20,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "../../common.h"
|
#include "../../common.h"
|
||||||
|
|
||||||
extern void initBlobBoss(Boss *b);
|
extern Boss *initBlobBoss(void);
|
||||||
extern Sprite *getSprite(char *name);
|
extern Sprite *getSprite(char *name);
|
||||||
|
|
|
@ -37,13 +37,11 @@ static void (*superAnimate)(void);
|
||||||
|
|
||||||
static Sprite *aimedSprite;
|
static Sprite *aimedSprite;
|
||||||
|
|
||||||
void initBlobBoss(Entity *e)
|
Boss *initBlobBoss(void)
|
||||||
{
|
{
|
||||||
Boss *b;
|
Boss *b;
|
||||||
|
|
||||||
initBoss(e);
|
b = initBoss();
|
||||||
|
|
||||||
b = (Boss*)e;
|
|
||||||
|
|
||||||
b->flags |= EF_HALT_AT_EDGE;
|
b->flags |= EF_HALT_AT_EDGE;
|
||||||
|
|
||||||
|
@ -54,6 +52,7 @@ void initBlobBoss(Entity *e)
|
||||||
superAnimate = b->animate;
|
superAnimate = b->animate;
|
||||||
|
|
||||||
b->activate = activate;
|
b->activate = activate;
|
||||||
|
b->action = walk;
|
||||||
b->walk = walk;
|
b->walk = walk;
|
||||||
b->tick = tick;
|
b->tick = tick;
|
||||||
b->changeEnvironment = changeEnvironment;
|
b->changeEnvironment = changeEnvironment;
|
||||||
|
@ -63,6 +62,8 @@ void initBlobBoss(Entity *e)
|
||||||
b->die = die1;
|
b->die = die1;
|
||||||
|
|
||||||
aimedSprite = getSprite("AimedShot");
|
aimedSprite = getSprite("AimedShot");
|
||||||
|
|
||||||
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void activate(int activate)
|
static void activate(int activate)
|
||||||
|
@ -94,6 +95,11 @@ static void tick(void)
|
||||||
b->health -= 2;
|
b->health -= 2;
|
||||||
|
|
||||||
world.boss = b;
|
world.boss = b;
|
||||||
|
|
||||||
|
if (b->stunTimer == 0)
|
||||||
|
{
|
||||||
|
teleport();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->stunTimer == 0)
|
if (b->stunTimer == 0)
|
||||||
|
@ -177,15 +183,18 @@ static void die1(void)
|
||||||
static SDL_Rect *getCurrentSprite(void)
|
static SDL_Rect *getCurrentSprite(void)
|
||||||
{
|
{
|
||||||
Boss *b;
|
Boss *b;
|
||||||
|
Sprite *s;
|
||||||
|
|
||||||
b = (Boss*)self;
|
b = (Boss*)self;
|
||||||
|
|
||||||
if (b->stunTimer > 0 || b->health <= 0)
|
s = (b->stunTimer > 0 || b->health <= 0) ? b->sprite[FACING_DIE] : b->sprite[b->facing];
|
||||||
|
|
||||||
|
if (self->spriteFrame >= s->numFrames)
|
||||||
{
|
{
|
||||||
return &b->sprite[FACING_DIE]->frames[self->spriteFrame]->rect;
|
self->spriteFrame = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return &b->sprite[b->facing]->frames[self->spriteFrame]->rect;
|
return &s->frames[self->spriteFrame]->rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void animate(void)
|
static void animate(void)
|
||||||
|
@ -194,7 +203,13 @@ static void animate(void)
|
||||||
|
|
||||||
b = (Boss*)self;
|
b = (Boss*)self;
|
||||||
|
|
||||||
if (b->dx != 0 || b->health <= 0 || b->stunTimer > 0)
|
if (b->alive != ALIVE_ALIVE || b->stunTimer > 0)
|
||||||
|
{
|
||||||
|
b->facing = FACING_DIE;
|
||||||
|
|
||||||
|
superAnimate();
|
||||||
|
}
|
||||||
|
else if (b->dx != 0)
|
||||||
{
|
{
|
||||||
superAnimate();
|
superAnimate();
|
||||||
}
|
}
|
||||||
|
@ -255,7 +270,7 @@ static void moveTowardsPlayer(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->stunTimer == 0 && b->teleportTimer == 0)
|
if (rand() % 10 == 0 && b->stunTimer == 0 && b->teleportTimer == 0)
|
||||||
{
|
{
|
||||||
teleport();
|
teleport();
|
||||||
|
|
||||||
|
@ -359,11 +374,14 @@ static void applyDamage(int amount)
|
||||||
|
|
||||||
static void teleport(void)
|
static void teleport(void)
|
||||||
{
|
{
|
||||||
self->action = reappear;
|
if (self->health > 0)
|
||||||
self->flags |= EF_GONE;
|
{
|
||||||
self->thinkTime = FPS * rrnd(3, 6);
|
self->action = reappear;
|
||||||
addTeleportStars(self);
|
self->flags |= EF_GONE;
|
||||||
playSound(SND_APPEAR, CH_ANY);
|
self->thinkTime = FPS * rrnd(3, 6);
|
||||||
|
addTeleportStars(self);
|
||||||
|
playSound(SND_APPEAR, CH_ANY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void die2(void)
|
static void die2(void)
|
||||||
|
@ -380,7 +398,8 @@ static void die2(void)
|
||||||
|
|
||||||
playSound(SND_APPEAR, CH_ANY);
|
playSound(SND_APPEAR, CH_ANY);
|
||||||
|
|
||||||
b->alive = ALIVE_DEAD;
|
/* don't die! */
|
||||||
|
b->flags |= EF_GONE;
|
||||||
|
|
||||||
updateObjective(b->name);
|
updateObjective(b->name);
|
||||||
|
|
||||||
|
@ -392,5 +411,7 @@ static void die2(void)
|
||||||
{
|
{
|
||||||
awardTrophy("BLAZE_FROST");
|
awardTrophy("BLAZE_FROST");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
b->action = entityIdle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 int rrnd(int low, int high);
|
extern int rrnd(int low, int high);
|
||||||
extern void addTeleportStars(Entity *e);
|
extern void addTeleportStars(Entity *e);
|
||||||
extern void playMusic(char *filename, int loop);
|
extern void playMusic(char *filename, int loop);
|
||||||
|
@ -35,6 +35,7 @@ extern void getSlope(int x1, int y1, int x2, int y2, float *dx, float *dy);
|
||||||
extern int enemyCanSeePlayer(Entity *e);
|
extern int enemyCanSeePlayer(Entity *e);
|
||||||
extern void updateObjective(char *targetName);
|
extern void updateObjective(char *targetName);
|
||||||
extern void awardTrophy(char *id);
|
extern void awardTrophy(char *id);
|
||||||
|
extern void entityIdle(void);
|
||||||
|
|
||||||
extern Entity *self;
|
extern Entity *self;
|
||||||
extern Game game;
|
extern Game game;
|
||||||
|
|
|
@ -20,15 +20,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "boss.h"
|
#include "boss.h"
|
||||||
|
|
||||||
static void lookForPlayer(void);
|
static void load(cJSON *root);
|
||||||
|
static void save(cJSON *root);
|
||||||
|
static void init(void);
|
||||||
|
|
||||||
void initBoss(Entity *e)
|
Boss *initBoss(void)
|
||||||
{
|
{
|
||||||
Boss *b;
|
Boss *b;
|
||||||
|
|
||||||
initEntity(e);
|
b = malloc(sizeof(Boss));
|
||||||
|
memset(b, 0, sizeof(Boss));
|
||||||
|
|
||||||
b = (Boss*)e;
|
initEntity((Entity*)b);
|
||||||
|
|
||||||
b->type = ET_BOSS;
|
b->type = ET_BOSS;
|
||||||
|
|
||||||
|
@ -36,16 +39,32 @@ void initBoss(Entity *e)
|
||||||
|
|
||||||
b->isMissionTarget = 1;
|
b->isMissionTarget = 1;
|
||||||
|
|
||||||
b->action = lookForPlayer;
|
|
||||||
|
|
||||||
b->spriteFrame = 0;
|
b->spriteFrame = 0;
|
||||||
b->spriteTime = 0;
|
b->spriteTime = 0;
|
||||||
|
|
||||||
world.boss = b;
|
world.boss = b;
|
||||||
|
|
||||||
b->flags |= EF_ALWAYS_PROCESS | EF_BOMB_SHIELD | EF_GONE;
|
b->flags |= EF_ALWAYS_PROCESS | EF_BOMB_SHIELD | EF_GONE;
|
||||||
|
|
||||||
|
b->init = init;
|
||||||
|
b->load = load;
|
||||||
|
b->save = save;
|
||||||
|
|
||||||
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lookForPlayer(void)
|
void bossIdle(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void init(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void load(cJSON *root)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void save(cJSON *root)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -372,7 +372,8 @@ static void die2()
|
||||||
|
|
||||||
playSound(SND_APPEAR, CH_ANY);
|
playSound(SND_APPEAR, CH_ANY);
|
||||||
|
|
||||||
b->alive = ALIVE_DEAD;
|
/* don't die! */
|
||||||
|
b->flags |= EF_GONE;
|
||||||
|
|
||||||
updateObjective(b->name);
|
updateObjective(b->name);
|
||||||
|
|
||||||
|
@ -381,15 +382,21 @@ static void die2()
|
||||||
awardTrophy("EYEDROID_COMMANDER");
|
awardTrophy("EYEDROID_COMMANDER");
|
||||||
|
|
||||||
game.stats[STAT_ENEMIES_KILLED]++;
|
game.stats[STAT_ENEMIES_KILLED]++;
|
||||||
|
|
||||||
|
b->action = entityIdle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDL_Rect *getCurrentSprite(void)
|
static SDL_Rect *getCurrentSprite(void)
|
||||||
{
|
{
|
||||||
if (self->health <= 0)
|
Sprite *s;
|
||||||
|
|
||||||
|
s = (self->alive == ALIVE_ALIVE) ? self->sprite[self->facing] : self->sprite[FACING_DIE];
|
||||||
|
|
||||||
|
if (self->spriteFrame >= s->numFrames)
|
||||||
{
|
{
|
||||||
return &self->sprite[FACING_DIE]->frames[self->spriteFrame]->rect;
|
self->spriteFrame = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return &self->sprite[self->facing]->frames[self->spriteFrame]->rect;
|
return &s->frames[self->spriteFrame]->rect;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ 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 awardTrophy(char *id);
|
extern void awardTrophy(char *id);
|
||||||
|
extern void entityIdle(void);
|
||||||
|
|
||||||
extern Entity *self;
|
extern Entity *self;
|
||||||
extern Game game;
|
extern Game game;
|
||||||
|
|
|
@ -20,13 +20,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "frost.h"
|
#include "frost.h"
|
||||||
|
|
||||||
void initFrost(Entity *e)
|
Entity *initFrost(void)
|
||||||
{
|
{
|
||||||
Boss *b;
|
Boss *b;
|
||||||
|
|
||||||
initBlobBoss(e);
|
b = initBlobBoss();
|
||||||
|
|
||||||
b = (Boss*)e;
|
|
||||||
|
|
||||||
b->weakAgainst = ENV_LAVA;
|
b->weakAgainst = ENV_LAVA;
|
||||||
|
|
||||||
|
@ -35,4 +33,6 @@ void initFrost(Entity *e)
|
||||||
b->sprite[FACING_LEFT] = getSprite("FrostLeft");
|
b->sprite[FACING_LEFT] = getSprite("FrostLeft");
|
||||||
b->sprite[FACING_RIGHT] = getSprite("FrostRight");
|
b->sprite[FACING_RIGHT] = getSprite("FrostRight");
|
||||||
b->sprite[FACING_DIE] = getSprite("FrostSpin");
|
b->sprite[FACING_DIE] = getSprite("FrostSpin");
|
||||||
|
|
||||||
|
return (Entity*)b;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,5 +20,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "../../common.h"
|
#include "../../common.h"
|
||||||
|
|
||||||
extern void initBlobBoss(Entity *e);
|
extern Boss *initBlobBoss(void);
|
||||||
extern Sprite *getSprite(char *name);
|
extern Sprite *getSprite(char *name);
|
||||||
|
|
|
@ -64,8 +64,6 @@ void initTankCommander(Entity *e)
|
||||||
|
|
||||||
brakingTimer = 0;
|
brakingTimer = 0;
|
||||||
|
|
||||||
world.boss = b;
|
|
||||||
|
|
||||||
aimedSprite = getSprite("AimedShot");
|
aimedSprite = getSprite("AimedShot");
|
||||||
|
|
||||||
missileSprite[0] = getSprite("MissileRight");
|
missileSprite[0] = getSprite("MissileRight");
|
||||||
|
@ -326,7 +324,9 @@ static void die2(void)
|
||||||
|
|
||||||
playSound(SND_APPEAR, CH_ANY);
|
playSound(SND_APPEAR, CH_ANY);
|
||||||
|
|
||||||
b->alive = tankTrack->alive = ALIVE_DEAD;
|
/* don't die! */
|
||||||
|
b->flags |= EF_GONE;
|
||||||
|
tankTrack->alive |= EF_GONE;
|
||||||
|
|
||||||
updateObjective(b->name);
|
updateObjective(b->name);
|
||||||
|
|
||||||
|
@ -335,6 +335,8 @@ static void die2(void)
|
||||||
awardTrophy("TANK_COMMANDER");
|
awardTrophy("TANK_COMMANDER");
|
||||||
|
|
||||||
game.stats[STAT_ENEMIES_KILLED]++;
|
game.stats[STAT_ENEMIES_KILLED]++;
|
||||||
|
|
||||||
|
b->action = entityIdle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ 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 void initTankTrack(Entity *e);
|
||||||
extern void awardTrophy(char *id);
|
extern void awardTrophy(char *id);
|
||||||
|
extern void entityIdle(void);
|
||||||
|
|
||||||
extern Entity *self;
|
extern Entity *self;
|
||||||
extern Game game;
|
extern Game game;
|
||||||
|
|
|
@ -50,6 +50,8 @@ void initEntityFactory(void)
|
||||||
addEntityDef("PlasmaEyeDroid", initPlasmaDroid);
|
addEntityDef("PlasmaEyeDroid", initPlasmaDroid);
|
||||||
addEntityDef("PlasmaBlob", initPlasmaBlob);
|
addEntityDef("PlasmaBlob", initPlasmaBlob);
|
||||||
addEntityDef("Cannon", initCannon);
|
addEntityDef("Cannon", initCannon);
|
||||||
|
addEntityDef("Blaze", initBlaze);
|
||||||
|
addEntityDef("Frost", initFrost);
|
||||||
|
|
||||||
addEntityDef("Bob", initBob);
|
addEntityDef("Bob", initBob);
|
||||||
addEntityDef("MIA", initMIA);
|
addEntityDef("MIA", initMIA);
|
||||||
|
@ -64,6 +66,7 @@ void initEntityFactory(void)
|
||||||
addEntityDef("RedKeycard", initRedKeycard);
|
addEntityDef("RedKeycard", initRedKeycard);
|
||||||
addEntityDef("YellowKeycard", initYellowKeycard);
|
addEntityDef("YellowKeycard", initYellowKeycard);
|
||||||
addEntityDef("WhiteKeycard", initWhiteKeycard);
|
addEntityDef("WhiteKeycard", initWhiteKeycard);
|
||||||
|
addEntityDef("WeaponPickup", initWeaponPickup);
|
||||||
|
|
||||||
addEntityDef("Cell", initCell);
|
addEntityDef("Cell", initCell);
|
||||||
addEntityDef("Heart", initHeart);
|
addEntityDef("Heart", initHeart);
|
||||||
|
|
|
@ -68,5 +68,8 @@ extern Entity *initTeeka(void);
|
||||||
extern Entity *initDestructable(void);
|
extern Entity *initDestructable(void);
|
||||||
extern Entity *initCannon(void);
|
extern Entity *initCannon(void);
|
||||||
extern Entity *initItemPad(void);
|
extern Entity *initItemPad(void);
|
||||||
|
extern Entity *initWeaponPickup(void);
|
||||||
|
extern Entity *initBlaze(void);
|
||||||
|
extern Entity *initFrost(void);
|
||||||
|
|
||||||
extern World world;
|
extern World world;
|
||||||
|
|
Loading…
Reference in New Issue