2018-01-22 08:23:23 +01:00
|
|
|
/*
|
|
|
|
Copyright (C) 2018 Parallel Realities
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "effects.h"
|
|
|
|
|
2018-01-30 00:00:14 +01:00
|
|
|
static Sprite *fleshChunk[3];
|
|
|
|
static Sprite *debris[3];
|
2018-01-22 08:23:23 +01:00
|
|
|
|
|
|
|
void initEffects(void)
|
|
|
|
{
|
2018-01-30 00:00:14 +01:00
|
|
|
fleshChunk[0] = getSprite("FleshChunk1");
|
|
|
|
fleshChunk[1] = getSprite("FleshChunk2");
|
|
|
|
fleshChunk[2] = getSprite("FleshChunk3");
|
2018-01-22 08:23:23 +01:00
|
|
|
|
2018-01-30 00:00:14 +01:00
|
|
|
debris[0] = getSprite("Debris1");
|
|
|
|
debris[1] = getSprite("Debris2");
|
|
|
|
debris[2] = getSprite("Debris3");
|
2018-01-22 08:23:23 +01:00
|
|
|
}
|
|
|
|
|
2018-01-30 00:00:14 +01:00
|
|
|
void addSmallFleshChunk(float x, float y)
|
2018-01-22 08:23:23 +01:00
|
|
|
{
|
2018-01-28 09:30:53 +01:00
|
|
|
Decoration *chunk;
|
2018-01-22 08:23:23 +01:00
|
|
|
|
2018-03-16 23:26:42 +01:00
|
|
|
if (app.config.blood)
|
2018-02-27 22:55:15 +01:00
|
|
|
{
|
2018-03-16 23:26:42 +01:00
|
|
|
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);
|
|
|
|
}
|
2018-02-27 22:55:15 +01:00
|
|
|
}
|
2018-01-22 08:23:23 +01:00
|
|
|
}
|
|
|
|
|
2018-01-30 00:00:14 +01:00
|
|
|
void throwFleshChunks(float x, float y, int amount)
|
2018-01-22 08:23:23 +01:00
|
|
|
{
|
|
|
|
int i;
|
2018-01-28 09:30:53 +01:00
|
|
|
Decoration *chunk;
|
2018-02-27 22:55:15 +01:00
|
|
|
|
|
|
|
amount *= app.config.blood;
|
2018-01-22 08:23:23 +01:00
|
|
|
|
|
|
|
for (i = 0; i < amount; i++)
|
|
|
|
{
|
2018-01-28 09:30:53 +01:00
|
|
|
chunk = malloc(sizeof(Decoration));
|
|
|
|
memset(chunk, 0, sizeof(Decoration));
|
2018-02-05 09:37:54 +01:00
|
|
|
initFleshChunk(chunk);
|
2018-01-22 08:23:23 +01:00
|
|
|
|
|
|
|
chunk->x = x;
|
|
|
|
chunk->y = y;
|
2018-02-25 18:32:15 +01:00
|
|
|
chunk->dx = rrnd(-20, 20);
|
|
|
|
chunk->dx /= 10;
|
2018-01-22 08:23:23 +01:00
|
|
|
chunk->dy = -rrnd(10, 15);
|
|
|
|
chunk->health = FPS * rrnd(3, 12);
|
|
|
|
chunk->sprite[0] = chunk->sprite[1] = chunk->sprite[2] = fleshChunk[i % 3];
|
2018-02-27 22:55:15 +01:00
|
|
|
|
|
|
|
if (app.config.blood == 2)
|
|
|
|
{
|
|
|
|
chunk->health = FPS * rrnd(FPS, FPS * 5);
|
|
|
|
}
|
2018-01-22 08:23:23 +01:00
|
|
|
}
|
|
|
|
}
|
2018-01-30 09:29:09 +01:00
|
|
|
|
|
|
|
void throwDebris(float x, float y, int amount)
|
|
|
|
{
|
2018-02-05 23:06:53 +01:00
|
|
|
int i;
|
|
|
|
Decoration *piece;
|
|
|
|
|
|
|
|
for (i = 0; i < amount; i++)
|
|
|
|
{
|
|
|
|
piece = malloc(sizeof(Decoration));
|
|
|
|
memset(piece, 0, sizeof(Decoration));
|
|
|
|
initDebris(piece);
|
|
|
|
|
|
|
|
piece->x = x;
|
|
|
|
piece->y = y;
|
2018-02-25 18:32:15 +01:00
|
|
|
piece->dx = rrnd(-20, 20);
|
|
|
|
piece->dx /= 10;
|
2018-02-05 23:06:53 +01:00
|
|
|
piece->dy = -rrnd(10, 15);
|
2018-02-27 22:55:15 +01:00
|
|
|
piece->health = FPS * rrnd(1, 3);
|
2018-02-05 23:06:53 +01:00
|
|
|
piece->sprite[0] = piece->sprite[1] = piece->sprite[2] = debris[i % 3];
|
2018-02-27 22:55:15 +01:00
|
|
|
|
|
|
|
if (app.config.blood == 2)
|
|
|
|
{
|
|
|
|
piece->health = FPS * rrnd(FPS / 2, FPS);
|
|
|
|
}
|
2018-02-05 23:06:53 +01:00
|
|
|
}
|
2018-01-30 09:29:09 +01:00
|
|
|
}
|