From 39573010b7c90d7edad873a7e50041bea404d2ba Mon Sep 17 00:00:00 2001 From: Steve Date: Wed, 21 Mar 2018 08:14:29 +0000 Subject: [PATCH] Add blood decal when Bob dies. --- src/entities/blobs/bob.c | 6 ++++++ src/entities/blobs/bob.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/entities/blobs/bob.c b/src/entities/blobs/bob.c index 4245224..e6c39ab 100644 --- a/src/entities/blobs/bob.c +++ b/src/entities/blobs/bob.c @@ -360,6 +360,8 @@ static void doBobInWater(void) static void doDying(void) { + int mx, my; + if (--world.bob->health <= -(FPS * 2)) { world.bob->flags |= EF_GONE; @@ -383,6 +385,10 @@ static void doDying(void) { playSound(SND_POP, world.bob->uniqueId % MAX_SND_CHANNELS); } + + mx = (int) ((world.bob->x + (world.bob->w / 2)) / MAP_TILE_SIZE); + my = (int) (world.bob->y / MAP_TILE_SIZE) + 1; + addBloodDecal(mx, my); game.stats[STAT_DEATHS]++; } diff --git a/src/entities/blobs/bob.h b/src/entities/blobs/bob.h index 5cb9601..af26a01 100644 --- a/src/entities/blobs/bob.h +++ b/src/entities/blobs/bob.h @@ -47,6 +47,7 @@ extern int rrnd(int low, int high); extern void setGameplayMessage(int type, char *format, ...); extern void throwFleshChunks(float x, float y, int amount); extern void addPopParticles(float x, float y); +extern void addBloodDecal(int x, int y); extern App app; extern Dev dev;