Added large explosions, for capital ships.

This commit is contained in:
Steve 2016-03-14 08:30:19 +00:00
parent ad96a70b0a
commit 35e23e8450
3 changed files with 39 additions and 2 deletions

View File

@ -297,13 +297,15 @@ static void die(void)
self->alive = ALIVE_DEAD;
addDebris(self->x, self->y, 50);
addLargeExplosion();
addDebris(self->x, self->y, 12);
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
{
if (e->owner == self)
{
e->health = 0;
e->alive = ALIVE_DEAD;
}
}

View File

@ -48,6 +48,7 @@ extern void updateObjective(char *name, int type);
extern char **getFileList(char *dir, int *count);
extern int getJSONValue(cJSON *node, char *name, int defValue);
extern char *getTranslatedString(char *string);
extern void addLargeExplosion(void);
extern Battle battle;
extern Entity *self;

View File

@ -284,6 +284,40 @@ void addSmallExplosion(void)
}
}
void addLargeExplosion(void)
{
int i;
Effect *e;
for (i = 0 ; i < 64 ; i++)
{
e = malloc(sizeof(Effect));
memset(e, 0, sizeof(Effect));
battle.effectTail->next = e;
battle.effectTail = e;
e->type = EFFECT_TEXTURE;
e->x = self->x + rand() % 255 - rand() % 255;
e->y = self->y + rand() % 255 - rand() % 255;
e->dx = (rand() % 25) - (rand() % 25);
e->dx *= 0.01;
e->dy = (rand() % 25) - (rand() % 25);
e->dy *= 0.01;
e->texture = explosionTexture;
e->size = 128 + (rand() % 512);
e->r = 255;
setRandomFlameHue(e);
e->a = 128 + (rand() % 128);
e->health = e->a;
e->x -= e->size / 2;
e->y -= e->size / 2;
}
}
void addMissileExplosion(Bullet *b)
{
int i;