Added Grenade Blob and Grenade Droid.
This commit is contained in:
parent
0335b7e837
commit
b00b9dcdb4
|
@ -36,7 +36,7 @@ OBJS += camera.o cannon.o cardReader.o cell.o cherry.o combat.o controls.o consu
|
|||
OBJS += debris.o destructable.o door.o draw.o
|
||||
OBJS += effects.o ending.o entities.o entity.o entityFactory.o exit.o explosions.o eyeDroid.o eyeDroidCommander.o evilBlob.o
|
||||
OBJS += fleshChunk.o frost.o
|
||||
OBJS += game.o grenade.o
|
||||
OBJS += game.o grenade.o grenadeBlob.o grenadeDroid.o
|
||||
OBJS += heart.o horizontalDoor.o horizontalLaserTrap.o hub.o hud.o
|
||||
OBJS += i18n.o init.o infoPoint.o input.o io.o item.o items.o itemPad.o
|
||||
OBJS += cJSON.o
|
||||
|
|
|
@ -38,6 +38,8 @@ void initEntityFactory(void)
|
|||
addEntityDef("GenericEvilBlob", initGenericEvilBlob);
|
||||
addEntityDef("GenericEyeDroid", initGenericEyeDroid);
|
||||
addEntityDef("MachineGunBlob", initMachineGunBlob);
|
||||
addEntityDef("GrenadeBlob", initGrenadeBlob);
|
||||
addEntityDef("GrenadeEyeDroid", initGrenadeDroid);
|
||||
|
||||
addEntityDef("Bob", initBob);
|
||||
addEntityDef("MIA", initMIA);
|
||||
|
|
|
@ -24,6 +24,8 @@ extern Entity *initAquaBlob(void);
|
|||
extern Entity *initMachineGunBlob(void);
|
||||
extern Entity *initPistolBlob(void);
|
||||
extern Entity *initPistolDroid(void);
|
||||
extern Entity *initGrenadeDroid(void);
|
||||
extern Entity *initGrenadeBlob(void);
|
||||
extern Entity *initBob(void);
|
||||
extern Entity *initExit(void);
|
||||
extern Entity *initPowerPool(void);
|
||||
|
|
|
@ -20,26 +20,41 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "grenadeBlob.h"
|
||||
|
||||
static void preFire2(void);
|
||||
static void (*superPreFire)(void);
|
||||
static void preFire(void);
|
||||
static int canFire(Entity *target);
|
||||
|
||||
void initGrenadeBlob(Unit *u)
|
||||
Entity *initGrenadeBlob(void)
|
||||
{
|
||||
Unit *u;
|
||||
|
||||
u = createUnit();
|
||||
|
||||
initEvilBlob(u);
|
||||
|
||||
u->unitType = "GrenadeBlob";
|
||||
|
||||
u->sprite[FACING_LEFT] = getSprite("GrenadeBlobLeft");
|
||||
u->sprite[FACING_RIGHT] = getSprite("GrenadeBlobRight");
|
||||
u->sprite[FACING_DIE] = getSprite("GrenadeBlobSpin");
|
||||
|
||||
u->weaponType = WPN_GRENADES;
|
||||
|
||||
u->preFire = preFire2;
|
||||
superPreFire = u->preFire;
|
||||
|
||||
u->preFire = preFire;
|
||||
u->canFire = canFire;
|
||||
|
||||
return (Entity*)u;
|
||||
}
|
||||
|
||||
static void preFire2(void)
|
||||
static void preFire(void)
|
||||
{
|
||||
preFire(this);
|
||||
Unit *u;
|
||||
|
||||
u = (Unit*)self;
|
||||
|
||||
superPreFire();
|
||||
|
||||
if (u->shotsToFire == 0)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
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 Unit *createUnit(void);
|
||||
extern void initEvilBlob(Unit *u);
|
||||
extern Sprite *getSprite(char *name);
|
||||
|
||||
extern Entity *self;
|
|
@ -20,7 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "grenadeDroid.h"
|
||||
|
||||
static void preFire2(void);
|
||||
static void (*superPreFire)(void);
|
||||
static void preFire(void);
|
||||
static int canFire(Entity *target);
|
||||
|
||||
void initGrenadeDroid(Unit *u)
|
||||
|
@ -33,17 +34,19 @@ void initGrenadeDroid(Unit *u)
|
|||
|
||||
u->weaponType = WPN_GRENADES;
|
||||
|
||||
u->preFire = preFire2;
|
||||
superPreFire = u->preFire;
|
||||
|
||||
u->preFire = preFire;
|
||||
u->canFire = canFire;
|
||||
}
|
||||
|
||||
static void preFire2(void)
|
||||
static void preFire(void)
|
||||
{
|
||||
Unit *u;
|
||||
|
||||
u = (Unit*)self;
|
||||
|
||||
preFire(self);
|
||||
superPreFire();
|
||||
|
||||
if (u->shotsToFire == 0)
|
||||
{
|
||||
|
@ -60,5 +63,5 @@ static void preFire2(void)
|
|||
|
||||
static int canFire(Entity *target)
|
||||
{
|
||||
return abs(target->y - y) <= MAP_TILE_SIZE * 2;
|
||||
return abs(target->y - self->y) <= MAP_TILE_SIZE * 2;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
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 Unit *createUnit(void);
|
||||
extern void initEyeDroid(Unit *u);
|
||||
extern Sprite *getSprite(char *name);
|
||||
|
||||
extern Entity *self;
|
Loading…
Reference in New Issue