From 09e676d7134e497c3e2bb91faeac50a547d0823f Mon Sep 17 00:00:00 2001 From: Steve Date: Wed, 16 Mar 2016 06:53:07 +0000 Subject: [PATCH] Added simple die, to prevent swarmers spreading debris everywhere. --- data/fighters/swarmer.json | 4 +++- src/battle/fighters.c | 16 ++++++++++++++-- src/defs.h | 3 ++- src/system/lookup.c | 1 + 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/data/fighters/swarmer.json b/data/fighters/swarmer.json index 5979ef2..28ba13e 100644 --- a/data/fighters/swarmer.json +++ b/data/fighters/swarmer.json @@ -11,5 +11,7 @@ "y" : 0 } ], - "flags" : "EF_TAKES_DAMAGE" + "deathType" : "DT_SIMPLE", + "flags" : "EF_TAKES_DAMAGE", + "aiFlags" : "AIF_UNLIMITED_RANGE" } diff --git a/src/battle/fighters.c b/src/battle/fighters.c index 359183b..12eca9f 100644 --- a/src/battle/fighters.c +++ b/src/battle/fighters.c @@ -25,6 +25,7 @@ static void die(void); static void immediateDie(void); static void spinDie(void); static void straightDie(void); +static void simpleDie(void); static void randomizeDart(Entity *dart); static void randomizeDartGuns(Entity *dart); static void loadFighterDef(char *filename); @@ -495,6 +496,9 @@ static void die(void) case DT_INSTANT: n = 2; break; + case DT_SIMPLE: + n = 3; + break; } if (self == player && battle.isEpic) @@ -507,14 +511,15 @@ static void die(void) case 0: self->action = spinDie; break; - case 1: self->action = straightDie; break; - case 2: self->action = immediateDie; break; + case 3: + self->action = simpleDie; + break; } } @@ -572,6 +577,13 @@ static void straightDie(void) } } +static void simpleDie(void) +{ + self->alive = ALIVE_DEAD; + addSmallExplosion(); + playBattleSound(SND_EXPLOSION_1 + rand() % 4, self->x, self->y); +} + void retreatEnemies(void) { Entity *e; diff --git a/src/defs.h b/src/defs.h index 0006108..1ac1255 100644 --- a/src/defs.h +++ b/src/defs.h @@ -199,7 +199,8 @@ enum { DT_ANY, DT_NO_SPIN, - DT_INSTANT + DT_INSTANT, + DT_SIMPLE }; enum diff --git a/src/system/lookup.c b/src/system/lookup.c index c72bbcb..e818fd2 100644 --- a/src/system/lookup.c +++ b/src/system/lookup.c @@ -82,6 +82,7 @@ void initLookups(void) addLookup("DT_ANY", DT_ANY); addLookup("DT_NO_SPIN", DT_NO_SPIN); addLookup("DT_INSTANT", DT_INSTANT); + addLookup("DT_SIMPLE", DT_SIMPLE); addLookup("TT_DESTROY", TT_DESTROY); addLookup("TT_DISABLE", TT_DISABLE);