Don't show blood if blood is off.

This commit is contained in:
Steve 2018-03-16 22:26:42 +00:00
parent 5bc3747198
commit 0f768f593e
5 changed files with 30 additions and 22 deletions

View File

@ -293,19 +293,22 @@ static void die(void)
u->dx = (randF() - randF()) * 5;
switch (rand() % 3)
if (app.config.blood)
{
case 0:
playBattleSound(SND_DEATH_1, u->uniqueId % MAX_SND_CHANNELS, u->x, u->y);
break;
switch (rand() % 3)
{
case 0:
playBattleSound(SND_DEATH_1, u->uniqueId % MAX_SND_CHANNELS, u->x, u->y);
break;
case 1:
playBattleSound(SND_DEATH_2, u->uniqueId % MAX_SND_CHANNELS, u->x, u->y);
break;
case 1:
playBattleSound(SND_DEATH_2, u->uniqueId % MAX_SND_CHANNELS, u->x, u->y);
break;
case 2:
playBattleSound(SND_DEATH_3, u->uniqueId % MAX_SND_CHANNELS, u->x, u->y);
break;
case 2:
playBattleSound(SND_DEATH_3, u->uniqueId % MAX_SND_CHANNELS, u->x, u->y);
break;
}
}
}

View File

@ -35,6 +35,7 @@ extern int rrnd(int low, int high);
extern void throwFleshChunks(float x, float y, int amount);
extern void updateObjective(char *targetName);
extern App app;
extern Dev dev;
extern Entity *self;
extern Game game;

View File

@ -38,18 +38,21 @@ void addSmallFleshChunk(float x, float y)
{
Decoration *chunk;
chunk = malloc(sizeof(Decoration));
memset(chunk, 0, sizeof(Decoration));
initFleshChunk(chunk);
chunk->x = x;
chunk->y = y;
chunk->health = FPS / 4;
chunk->sprite[0] = chunk->sprite[1] = chunk->sprite[2] = fleshChunk[0];
if (app.config.blood == 2)
if (app.config.blood)
{
chunk->health = FPS * rrnd(2, 4);
chunk = malloc(sizeof(Decoration));
memset(chunk, 0, sizeof(Decoration));
initFleshChunk(chunk);
chunk->x = x;
chunk->y = y;
chunk->health = FPS / 4;
chunk->sprite[0] = chunk->sprite[1] = chunk->sprite[2] = fleshChunk[0];
if (app.config.blood == 2)
{
chunk->health = FPS * rrnd(2, 4);
}
}
}

View File

@ -144,7 +144,7 @@ int isSolid(int x, int y)
void addBloodDecal(int x, int y)
{
if (isSolid(x, y) && world.map.decal[x][y] == 0)
if (app.config.blood && isSolid(x, y) && world.map.decal[x][y] == 0)
{
world.map.decal[x][y] = (int) rrnd(1, 4);
}

View File

@ -27,6 +27,7 @@ extern float limit(float i, float a, float b);
extern char *readCompressedFile(const char *filename);
extern int rrnd(int low, int high);
extern App app;
extern Camera camera;
extern World world;