diff --git a/src/entities/decoration/debris.c b/src/entities/decoration/debris.c index 0123950..64622e2 100644 --- a/src/entities/decoration/debris.c +++ b/src/entities/decoration/debris.c @@ -34,6 +34,8 @@ void initDebris(Decoration *d) d->effectType = rand() % 2; + d->spriteFrame = 0; + d->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_NO_TELEPORT; d->tick = tick; diff --git a/src/entities/decoration/fleshChunk.c b/src/entities/decoration/fleshChunk.c index 46921f9..85d19e2 100644 --- a/src/entities/decoration/fleshChunk.c +++ b/src/entities/decoration/fleshChunk.c @@ -34,6 +34,8 @@ void initFleshChunk(Decoration *d) d->bleedTime = FPS * 3; + d->spriteFrame = 0; + d->tick = tick; d->action = action; d->touch = touch; diff --git a/src/world/effects.c b/src/world/effects.c index a5f3128..032732e 100644 --- a/src/world/effects.c +++ b/src/world/effects.c @@ -34,10 +34,6 @@ void initEffects(void) debris[2] = getSprite("Debris3"); } -void addExplosionEffect(int x, int y, float dx, float dy) -{ -} - void addSmallFleshChunk(float x, float y) { Decoration *chunk; @@ -48,12 +44,8 @@ void addSmallFleshChunk(float x, float y) chunk->x = x; chunk->y = y; - chunk->dx = 0; - chunk->dy = 0; chunk->health = FPS / 4; chunk->sprite[0] = chunk->sprite[1] = chunk->sprite[2] = fleshChunk[0]; - - chunk->spriteFrame = 0; } void throwFleshChunks(float x, float y, int amount) @@ -73,12 +65,25 @@ void throwFleshChunks(float x, float y, int amount) chunk->dy = -rrnd(10, 15); chunk->health = FPS * rrnd(3, 12); chunk->sprite[0] = chunk->sprite[1] = chunk->sprite[2] = fleshChunk[i % 3]; - - chunk->spriteFrame = 0; } } void throwDebris(float x, float y, int amount) { - + int i; + Decoration *piece; + + for (i = 0; i < amount; i++) + { + piece = malloc(sizeof(Decoration)); + memset(piece, 0, sizeof(Decoration)); + initDebris(piece); + + piece->x = x; + piece->y = y; + piece->dx = rrnd(-2, 2); + piece->dy = -rrnd(10, 15); + piece->health = FPS * (rand() % 3); + piece->sprite[0] = piece->sprite[1] = piece->sprite[2] = debris[i % 3]; + } } diff --git a/src/world/effects.h b/src/world/effects.h index 46236f3..545aaf0 100644 --- a/src/world/effects.h +++ b/src/world/effects.h @@ -23,5 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern int rrnd(int low, int high); extern Sprite *getSprite(char *name); extern void initFleshChunk(Decoration *d); +extern void initDebris(Decoration *d); extern World world;