diff --git a/src/entities/decoration/debris.c b/src/entities/decoration/debris.c index 4c23be9..0123950 100644 --- a/src/entities/decoration/debris.c +++ b/src/entities/decoration/debris.c @@ -24,11 +24,9 @@ static void tick(void); static void action(void); static void touch(Entity *other); -void initDebris(Entity *e) +void initDebris(Decoration *d) { - Decoration *d; - - initEntity(e); + initEntity((Entity*)d); d = (Decoration*)self; diff --git a/src/entities/decoration/fleshChunk.c b/src/entities/decoration/fleshChunk.c index b57d4bc..46921f9 100644 --- a/src/entities/decoration/fleshChunk.c +++ b/src/entities/decoration/fleshChunk.c @@ -24,13 +24,9 @@ static void tick(void); static void action(void); static void touch(Entity *other); -void initFleshChunk(Entity *e) +void initFleshChunk(Decoration *d) { - Decoration *d; - - initEntity(e); - - d = (Decoration*)e; + initEntity((Entity*)d); d->type = ET_DECORATION; diff --git a/src/world/effects.c b/src/world/effects.c index a58b46d..a5f3128 100644 --- a/src/world/effects.c +++ b/src/world/effects.c @@ -44,8 +44,7 @@ void addSmallFleshChunk(float x, float y) chunk = malloc(sizeof(Decoration)); memset(chunk, 0, sizeof(Decoration)); - world.entityTail->next = (Entity*)chunk; - world.entityTail = (Entity*)chunk; + initFleshChunk(chunk); chunk->x = x; chunk->y = y; @@ -53,6 +52,8 @@ void addSmallFleshChunk(float x, float y) 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) @@ -64,8 +65,7 @@ void throwFleshChunks(float x, float y, int amount) { chunk = malloc(sizeof(Decoration)); memset(chunk, 0, sizeof(Decoration)); - world.entityTail->next = (Entity*)chunk; - world.entityTail = (Entity*)chunk; + initFleshChunk(chunk); chunk->x = x; chunk->y = y; @@ -73,6 +73,8 @@ 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; } } diff --git a/src/world/effects.h b/src/world/effects.h index c5fb723..46236f3 100644 --- a/src/world/effects.h +++ b/src/world/effects.h @@ -22,5 +22,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 World world;