Add extra blood when extra blood is turned on.

This commit is contained in:
Steve 2018-03-21 08:14:50 +00:00
parent 39573010b7
commit a91cb02b5a
2 changed files with 19 additions and 3 deletions

View File

@ -30,9 +30,14 @@ void initFleshChunk(Decoration *d)
d->type = ET_DECORATION; d->type = ET_DECORATION;
d->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_NO_TELEPORT | EF_CRUSHABLE; d->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_NO_TELEPORT | EF_CRUSHABLE;
d->bleedTime = FPS * 3; if (app.config.blood != 2)
{
d->flags |= EF_KILL_OFFSCREEN;
}
d->bleedTime = (app.config.blood != 2) ? FPS * 3 : FPS * 15;
d->spriteFrame = 0; d->spriteFrame = 0;
@ -48,6 +53,7 @@ static void tick(void)
d = (Decoration*)self; d = (Decoration*)self;
d->health--; d->health--;
d->bleedTime--; d->bleedTime--;
} }
@ -57,7 +63,7 @@ static void action(void)
d = (Decoration*)self; d = (Decoration*)self;
if (d->bleedTime > 0 || app.config.blood == 2) if (d->bleedTime > 0)
{ {
addBlood(d->x + (rand() % d->w), d->y + (rand() % d->h)); addBlood(d->x + (rand() % d->w), d->y + (rand() % d->h));
} }
@ -67,8 +73,17 @@ static void action(void)
static void touch(Entity *other) static void touch(Entity *other)
{ {
int mx, my;
if (other == NULL) if (other == NULL)
{ {
self->dx *= 0.9; self->dx *= 0.9;
if (app.config.blood == 2)
{
mx = (int) ((self->x + (self->w / 2)) / MAP_TILE_SIZE);
my = (int) (self->y / MAP_TILE_SIZE) + 1;
addBloodDecal(mx, my);
}
} }
} }

View File

@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../common.h" #include "../../common.h"
extern void addBlood(float x, float y); extern void addBlood(float x, float y);
extern void addBloodDecal(int x, int y);
extern void initEntity(Entity *e); extern void initEntity(Entity *e);
extern App app; extern App app;