Start of extra blood / explosions.

This commit is contained in:
Steve 2018-02-27 21:55:15 +00:00
parent d2bc37eebf
commit 18fa11d278
11 changed files with 31 additions and 12 deletions

View File

@ -110,7 +110,7 @@ static void tick(void)
} }
else else
{ {
addSmokeParticles(b->x + (b->w / 2), b->y); addSmokeParticles(b->x + (b->w / 2), b->y, 0);
} }
} }

View File

@ -25,7 +25,7 @@ extern Sprite *getSprite(char *name);
extern void playMusic(int loop); extern void playMusic(int loop);
extern void addTeleportStars(Entity *e); extern void addTeleportStars(Entity *e);
extern float limit(float i, float a, float b); extern float limit(float i, float a, float b);
extern void addSmokeParticles(float x, float y); extern void addSmokeParticles(float x, float y, int rising);
extern int rrnd(int low, int high); extern int rrnd(int low, int high);
extern int getDistance(int x1, int y1, int x2, int y2); extern int getDistance(int x1, int y1, int x2, int y2);
extern int enemyCanSeePlayer(Entity *e); extern int enemyCanSeePlayer(Entity *e);

View File

@ -54,11 +54,11 @@ static void action(void)
if (d->effectType == 0) if (d->effectType == 0)
{ {
addFlameParticles(d->x + (rand() % d->w), d->y + (rand() % d->h)); addFlameParticles(d->x + (rand() % d->w), d->y + (rand() % d->h), d->isOnGround);
} }
else else
{ {
addSmokeParticles(d->x + (rand() % d->w), d->y + (rand() % d->h)); addSmokeParticles(d->x + (rand() % d->w), d->y + (rand() % d->h), d->isOnGround);
} }
self->thinkTime = 1; self->thinkTime = 1;

View File

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

View File

@ -57,7 +57,7 @@ static void action(void)
d = (Decoration*)self; d = (Decoration*)self;
if (d->bleedTime > 0) if (d->bleedTime > 0 || app.config.blood == 2)
{ {
addBlood(d->x + (rand() % d->w), d->y + (rand() % d->h)); addBlood(d->x + (rand() % d->w), d->y + (rand() % d->h));
} }

View File

@ -23,4 +23,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern void initEntity(Entity *e); extern void initEntity(Entity *e);
extern void addBlood(float x, float y); extern void addBlood(float x, float y);
extern App app;
extern Entity *self; extern Entity *self;

View File

@ -57,7 +57,7 @@ static void tick(void)
if (u->alive == ALIVE_DYING) if (u->alive == ALIVE_DYING)
{ {
addSmokeParticles(u->x + (u->w / 2), u->y); addSmokeParticles(u->x + (u->w / 2), u->y, 0);
} }
} }

View File

@ -33,7 +33,7 @@ extern void addRandomItems(int x, int y);
extern int rrnd(int low, int high); extern int rrnd(int low, int high);
extern void addExplosion(float x, float y, int radius, Entity *owner); extern void addExplosion(float x, float y, int radius, Entity *owner);
extern void throwDebris(float x, float y, int amount); extern void throwDebris(float x, float y, int amount);
extern void addSmokeParticles(float x, float y); extern void addSmokeParticles(float x, float y, int rising);
extern void addScorchDecal(int x, int y); extern void addScorchDecal(int x, int y);
extern Unit *createUnit(void); extern Unit *createUnit(void);
extern void playBattleSound(int snd, int ch, int x, int y); extern void playBattleSound(int snd, int ch, int x, int y);

View File

@ -46,6 +46,11 @@ void addSmallFleshChunk(float x, float y)
chunk->y = y; chunk->y = y;
chunk->health = FPS / 4; chunk->health = FPS / 4;
chunk->sprite[0] = chunk->sprite[1] = chunk->sprite[2] = fleshChunk[0]; chunk->sprite[0] = chunk->sprite[1] = chunk->sprite[2] = fleshChunk[0];
if (app.config.blood == 2)
{
chunk->health = FPS * rrnd(2, 4);
}
} }
void throwFleshChunks(float x, float y, int amount) void throwFleshChunks(float x, float y, int amount)
@ -53,6 +58,8 @@ void throwFleshChunks(float x, float y, int amount)
int i; int i;
Decoration *chunk; Decoration *chunk;
amount *= app.config.blood;
for (i = 0; i < amount; i++) for (i = 0; i < amount; i++)
{ {
chunk = malloc(sizeof(Decoration)); chunk = malloc(sizeof(Decoration));
@ -66,6 +73,11 @@ void throwFleshChunks(float x, float y, int amount)
chunk->dy = -rrnd(10, 15); chunk->dy = -rrnd(10, 15);
chunk->health = FPS * rrnd(3, 12); chunk->health = FPS * rrnd(3, 12);
chunk->sprite[0] = chunk->sprite[1] = chunk->sprite[2] = fleshChunk[i % 3]; chunk->sprite[0] = chunk->sprite[1] = chunk->sprite[2] = fleshChunk[i % 3];
if (app.config.blood == 2)
{
chunk->health = FPS * rrnd(FPS, FPS * 5);
}
} }
} }
@ -85,7 +97,12 @@ void throwDebris(float x, float y, int amount)
piece->dx = rrnd(-20, 20); piece->dx = rrnd(-20, 20);
piece->dx /= 10; piece->dx /= 10;
piece->dy = -rrnd(10, 15); piece->dy = -rrnd(10, 15);
piece->health = FPS * (rand() % 3); piece->health = FPS * rrnd(1, 3);
piece->sprite[0] = piece->sprite[1] = piece->sprite[2] = debris[i % 3]; piece->sprite[0] = piece->sprite[1] = piece->sprite[2] = debris[i % 3];
if (app.config.blood == 2)
{
piece->health = FPS * rrnd(FPS / 2, FPS);
}
} }
} }

View File

@ -25,3 +25,4 @@ extern Sprite *getSprite(char *name);
extern void initFleshChunk(Decoration *d); extern void initFleshChunk(Decoration *d);
extern void initDebris(Decoration *d); extern void initDebris(Decoration *d);
extern App app;

View File

@ -146,7 +146,7 @@ void addSparkParticles(float x, float y)
} }
} }
void addSmokeParticles(float x, float y) void addSmokeParticles(float x, float y, int rising)
{ {
Particle *p; Particle *p;
@ -162,7 +162,7 @@ void addSmokeParticles(float x, float y)
p->destroyAfterAnim = 1; p->destroyAfterAnim = 1;
} }
void addFlameParticles(float x, float y) void addFlameParticles(float x, float y, int rising)
{ {
Particle *p; Particle *p;