From 35e23e84505d65b13944df96603c4e8a7606e79a Mon Sep 17 00:00:00 2001 From: Steve Date: Mon, 14 Mar 2016 08:30:19 +0000 Subject: [PATCH] Added large explosions, for capital ships. --- src/battle/capitalShips.c | 6 ++++-- src/battle/capitalShips.h | 1 + src/battle/effects.c | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/battle/capitalShips.c b/src/battle/capitalShips.c index 12f0aed..7e351e9 100644 --- a/src/battle/capitalShips.c +++ b/src/battle/capitalShips.c @@ -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; } } diff --git a/src/battle/capitalShips.h b/src/battle/capitalShips.h index 88fd79a..61102e1 100644 --- a/src/battle/capitalShips.h +++ b/src/battle/capitalShips.h @@ -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; diff --git a/src/battle/effects.c b/src/battle/effects.c index 8c67054..9fb123b 100644 --- a/src/battle/effects.c +++ b/src/battle/effects.c @@ -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;