Effects.
This commit is contained in:
parent
f3bf387d98
commit
821fa54110
|
@ -8,10 +8,9 @@ vpath %.h $(SEARCHPATH)
|
||||||
|
|
||||||
DEPS += defs.h structs.h
|
DEPS += defs.h structs.h
|
||||||
|
|
||||||
OBJS += camera.o
|
OBJS += camera.o combat.o
|
||||||
OBJS += draw.o
|
OBJS += draw.o
|
||||||
OBJS += combat.o
|
OBJS += effects.o entities.o
|
||||||
OBJS += entities.o
|
|
||||||
OBJS += game.o
|
OBJS += game.o
|
||||||
OBJS += hud.o
|
OBJS += hud.o
|
||||||
OBJS += init.o input.o io.o
|
OBJS += init.o input.o io.o
|
||||||
|
@ -19,6 +18,7 @@ OBJS += lookup.o
|
||||||
OBJS += main.o map.o maths.o
|
OBJS += main.o map.o maths.o
|
||||||
OBJS += objectives.o
|
OBJS += objectives.o
|
||||||
OBJS += quadtree.o
|
OBJS += quadtree.o
|
||||||
|
OBJS += sprites.o
|
||||||
OBJS += text.o textures.o title.o triggers.o
|
OBJS += text.o textures.o title.o triggers.o
|
||||||
OBJS += util.o
|
OBJS += util.o
|
||||||
OBJS += widgets.o
|
OBJS += widgets.o
|
||||||
|
|
|
@ -81,6 +81,7 @@ struct Entity {
|
||||||
float y;
|
float y;
|
||||||
int w;
|
int w;
|
||||||
int h;
|
int h;
|
||||||
|
int health;
|
||||||
int alive;
|
int alive;
|
||||||
float dx;
|
float dx;
|
||||||
float dy;
|
float dy;
|
||||||
|
@ -91,6 +92,7 @@ struct Entity {
|
||||||
int isSolid;
|
int isSolid;
|
||||||
long flags;
|
long flags;
|
||||||
SDL_Rect bounds;
|
SDL_Rect bounds;
|
||||||
|
int sprite[3];
|
||||||
void (*walk)(void);
|
void (*walk)(void);
|
||||||
void (*attack)(void);
|
void (*attack)(void);
|
||||||
Entity *next;
|
Entity *next;
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
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 "sprites.h"
|
||||||
|
|
||||||
|
int getSpriteIndex(char *name)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
/*
|
||||||
|
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 "../common.h"
|
|
@ -0,0 +1,73 @@
|
||||||
|
/*
|
||||||
|
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"
|
||||||
|
|
||||||
|
static int fleshChunk[3];
|
||||||
|
static int debris[3];
|
||||||
|
|
||||||
|
void initEffects(void)
|
||||||
|
{
|
||||||
|
fleshChunk[0] = getSpriteIndex("FleshChunk1");
|
||||||
|
fleshChunk[1] = getSpriteIndex("FleshChunk2");
|
||||||
|
fleshChunk[2] = getSpriteIndex("FleshChunk3");
|
||||||
|
|
||||||
|
debris[0] = getSpriteIndex("Debris1");
|
||||||
|
debris[1] = getSpriteIndex("Debris2");
|
||||||
|
debris[2] = getSpriteIndex("Debris3");
|
||||||
|
}
|
||||||
|
|
||||||
|
void addSmallFleshChunk(double x, double y)
|
||||||
|
{
|
||||||
|
Entity *chunk;
|
||||||
|
|
||||||
|
chunk = malloc(sizeof(Entity));
|
||||||
|
memset(chunk, 0, sizeof(Entity));
|
||||||
|
world.entityTail->next = chunk;
|
||||||
|
world.entityTail = chunk;
|
||||||
|
|
||||||
|
chunk->x = x;
|
||||||
|
chunk->y = y;
|
||||||
|
chunk->dx = 0;
|
||||||
|
chunk->dy = 0;
|
||||||
|
chunk->health = FPS / 4;
|
||||||
|
chunk->sprite[0] = chunk->sprite[1] = chunk->sprite[2] = fleshChunk[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
void throwFleshChunks(double x, double y, int amount)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
Entity *chunk;
|
||||||
|
|
||||||
|
for (i = 0; i < amount; i++)
|
||||||
|
{
|
||||||
|
chunk = malloc(sizeof(Entity));
|
||||||
|
memset(chunk, 0, sizeof(Entity));
|
||||||
|
world.entityTail->next = chunk;
|
||||||
|
world.entityTail = chunk;
|
||||||
|
|
||||||
|
chunk->x = x;
|
||||||
|
chunk->y = y;
|
||||||
|
chunk->dx = rrnd(-2, 2);
|
||||||
|
chunk->dy = -rrnd(10, 15);
|
||||||
|
chunk->health = FPS * rrnd(3, 12);
|
||||||
|
chunk->sprite[0] = chunk->sprite[1] = chunk->sprite[2] = fleshChunk[i % 3];
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
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 "../common.h"
|
||||||
|
|
||||||
|
extern int rrnd(int low, int high);
|
||||||
|
extern int getSpriteIndex(char *name);
|
||||||
|
|
||||||
|
extern World world;
|
Loading…
Reference in New Issue