From 14b503eff23befb25feca7f4627ef81e3147c915 Mon Sep 17 00:00:00 2001 From: Steve Date: Thu, 8 Feb 2018 08:35:09 +0000 Subject: [PATCH] Added Machine Gun Blob. Load Cells and Hearts. --- common.mk | 2 +- src/entities/entityFactory.c | 5 +++++ src/entities/entityFactory.h | 4 ++++ src/entities/evilBlobs/machineGunBlob.c | 10 ++++++++- src/entities/evilBlobs/machineGunBlob.h | 27 +++++++++++++++++++++++++ src/test/atlasTest.c | 2 +- 6 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 src/entities/evilBlobs/machineGunBlob.h diff --git a/common.mk b/common.mk index d0fd0db..615e23b 100644 --- a/common.mk +++ b/common.mk @@ -42,7 +42,7 @@ OBJS += i18n.o init.o infoPoint.o input.o io.o item.o items.o itemPad.o OBJS += cJSON.o OBJS += key.o keycard.o OBJS += laser.o laserTrap.o lift.o lookup.o -OBJS += main.o map.o maths.o mia.o missile.o +OBJS += machineGunBlob.o main.o map.o maths.o mia.o missile.o OBJS += objectives.o OBJS += particles.o player.o pistolBlob.o pistolDroid.o powerPoint.o powerPool.o pressurePlate.o pushBlock.o OBJS += quadtree.o diff --git a/src/entities/entityFactory.c b/src/entities/entityFactory.c index ca69330..1596e99 100644 --- a/src/entities/entityFactory.c +++ b/src/entities/entityFactory.c @@ -37,6 +37,7 @@ void initEntityFactory(void) addEntityDef("PistolEyeDroid", initPistolDroid); addEntityDef("GenericEvilBlob", initGenericEvilBlob); addEntityDef("GenericEyeDroid", initGenericEyeDroid); + addEntityDef("MachineGunBlob", initMachineGunBlob); addEntityDef("Bob", initBob); addEntityDef("MIA", initMIA); @@ -45,6 +46,10 @@ void initEntityFactory(void) addEntityDef("BronzeKey", initBronzeKey); addEntityDef("SilverKey", initSilverKey); addEntityDef("GoldKey", initGoldKey); + addEntityDef("GreenKeycard", initGreenKeycard); + + addEntityDef("Cell", initCell); + addEntityDef("Heart", initHeart); addEntityDef("Exit", initExit); addEntityDef("PowerPool", initPowerPool); diff --git a/src/entities/entityFactory.h b/src/entities/entityFactory.h index d2d62e7..cb178e8 100644 --- a/src/entities/entityFactory.h +++ b/src/entities/entityFactory.h @@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../common.h" extern Entity *initAquaBlob(void); +extern Entity *initMachineGunBlob(void); extern Entity *initPistolBlob(void); extern Entity *initPistolDroid(void); extern Entity *initBob(void); @@ -42,5 +43,8 @@ extern Entity *initItem(void); extern Entity *initBronzeKey(void); extern Entity *initSilverKey(void); extern Entity *initGoldKey(void); +extern Entity *initCell(void); +extern Entity *initHeart(void); +extern Entity *initGreenKeycard(void); extern World world; diff --git a/src/entities/evilBlobs/machineGunBlob.c b/src/entities/evilBlobs/machineGunBlob.c index 0991b6a..cb52e26 100644 --- a/src/entities/evilBlobs/machineGunBlob.c +++ b/src/entities/evilBlobs/machineGunBlob.c @@ -22,10 +22,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static int canFire(Entity *target); -void initMachineGunBlob(Unit *u) +Entity *initMachineGunBlob(void) { + Unit *u; + + u = createUnit(); + initEvilBlob(u); + u->unitType = "MachineGunBlob"; + u->sprite[FACING_LEFT] = getSprite("MachineGunBlobLeft"); u->sprite[FACING_RIGHT] = getSprite("MachineGunBlobRight"); u->sprite[FACING_DIE] = getSprite("MachineGunBlobSpin"); @@ -35,6 +41,8 @@ void initMachineGunBlob(Unit *u) u->maxShotsToFire = 5; u->canFire = canFire; + + return (Entity*)u; } static int canFire(Entity *target) diff --git a/src/entities/evilBlobs/machineGunBlob.h b/src/entities/evilBlobs/machineGunBlob.h new file mode 100644 index 0000000..87bb9bc --- /dev/null +++ b/src/entities/evilBlobs/machineGunBlob.h @@ -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; diff --git a/src/test/atlasTest.c b/src/test/atlasTest.c index d60bac6..972051c 100644 --- a/src/test/atlasTest.c +++ b/src/test/atlasTest.c @@ -26,7 +26,7 @@ void initAtlasTest(void) initHub(); - loadWorld("data/maps/beachApproach.json"); + loadWorld("data/maps/beachFront1.json"); initWorld();