Added Grenade Blob and Grenade Droid.

This commit is contained in:
Steve 2018-02-08 21:53:02 +00:00
parent 0335b7e837
commit b00b9dcdb4
7 changed files with 87 additions and 11 deletions

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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;
superPreFire = u->preFire;
u->preFire = preFire2;
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)
{

View File

@ -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;

View File

@ -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)
@ -32,18 +33,20 @@ void initGrenadeDroid(Unit *u)
u->sprite[FACING_DIE] = getSprite("GrenadeDroidDie");
u->weaponType = WPN_GRENADES;
superPreFire = u->preFire;
u->preFire = preFire2;
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;
}

View File

@ -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;