Created capital ship engine effect.
This commit is contained in:
parent
5416debc21
commit
247c9f79e3
|
@ -24,6 +24,7 @@ static void think(void);
|
|||
static void gunThink(void);
|
||||
static void gunDie(void);
|
||||
static void componentDie(void);
|
||||
static void engineThink(void);
|
||||
static void engineDie(void);
|
||||
static void loadCapitalShipDef(char *filename);
|
||||
static void loadComponents(Entity *parent, cJSON *components);
|
||||
|
@ -120,6 +121,11 @@ static void gunDie(void)
|
|||
playBattleSound(SND_EXPLOSION_1 + rand() % 4, self->x, self->y);
|
||||
}
|
||||
|
||||
static void engineThink(void)
|
||||
{
|
||||
addLargeEngineEffect();
|
||||
}
|
||||
|
||||
static void engineDie(void)
|
||||
{
|
||||
Entity *e;
|
||||
|
@ -360,6 +366,7 @@ static void loadEngines(Entity *parent, cJSON *engines)
|
|||
|
||||
e->systemPower = 100;
|
||||
|
||||
e->action = engineThink;
|
||||
e->die = engineDie;
|
||||
|
||||
e->owner = parent;
|
||||
|
|
|
@ -37,6 +37,7 @@ extern void doAI(void);
|
|||
extern float getAngle(int x1, int y1, int x2, int y2);
|
||||
extern float mod(float n, float x);
|
||||
extern void applyFighterThrust(void);
|
||||
extern void addLargeEngineEffect(void);
|
||||
|
||||
extern Battle battle;
|
||||
extern Entity *self;
|
||||
|
|
|
@ -282,6 +282,38 @@ void addEngineEffect(void)
|
|||
e->y -= e->size / 2;
|
||||
}
|
||||
|
||||
void addLargeEngineEffect(void)
|
||||
{
|
||||
Effect *e;
|
||||
|
||||
e = malloc(sizeof(Effect));
|
||||
memset(e, 0, sizeof(Effect));
|
||||
battle.effectTail->next = e;
|
||||
battle.effectTail = e;
|
||||
|
||||
e->type = EFFECT_TEXTURE;
|
||||
|
||||
e->x = self->x;
|
||||
e->y = self->y;
|
||||
|
||||
e->x -= sin(TO_RAIDANS(self->angle)) * 16;
|
||||
e->y -= -cos(TO_RAIDANS(self->angle)) * 16;
|
||||
|
||||
e->x += rand() % 4;
|
||||
e->x -= rand() % 4;
|
||||
|
||||
e->texture = explosionTexture;
|
||||
e->health = 0;
|
||||
e->size = 64;
|
||||
e->r = 128;
|
||||
e->g = 128;
|
||||
e->b = 255;
|
||||
e->a = 64;
|
||||
|
||||
e->x -= e->size / 2;
|
||||
e->y -= e->size / 2;
|
||||
}
|
||||
|
||||
void addMissileEngineEffect(Bullet *b)
|
||||
{
|
||||
Effect *e;
|
||||
|
|
Loading…
Reference in New Issue