From bab333d4926163b84241a03e70de0f6201da3b76 Mon Sep 17 00:00:00 2001 From: Steve Date: Sat, 10 Feb 2018 07:56:28 +0000 Subject: [PATCH] Added Teeka, LaserBlob, LaserDroid, PlasmaBlob, PlasmaDroid, SpreadGunBlob, and SpreadGunDroid. --- common.mk | 6 +++--- src/entities/blobs/teeka.c | 4 +++- src/entities/entityFactory.c | 8 ++++++++ src/entities/entityFactory.h | 8 ++++++++ src/entities/evilBlobs/laserBlob.c | 10 ++++++++- src/entities/evilBlobs/laserBlob.h | 27 +++++++++++++++++++++++++ src/entities/evilBlobs/plasmaBlob.c | 10 ++++++++- src/entities/evilBlobs/plasmaBlob.h | 27 +++++++++++++++++++++++++ src/entities/evilBlobs/spreadGunBlob.c | 12 +++++++++-- src/entities/evilBlobs/spreadGunBlob.h | 27 +++++++++++++++++++++++++ src/entities/eyeDroids/laserDroid.c | 10 ++++++++- src/entities/eyeDroids/laserDroid.h | 27 +++++++++++++++++++++++++ src/entities/eyeDroids/plasmaDroid.c | 10 ++++++++- src/entities/eyeDroids/plasmaDroid.h | 27 +++++++++++++++++++++++++ src/entities/eyeDroids/spreadGunDroid.c | 10 ++++++++- src/entities/eyeDroids/spreadGunDroid.h | 27 +++++++++++++++++++++++++ 16 files changed, 239 insertions(+), 11 deletions(-) create mode 100644 src/entities/evilBlobs/laserBlob.h create mode 100644 src/entities/evilBlobs/plasmaBlob.h create mode 100644 src/entities/evilBlobs/spreadGunBlob.h create mode 100644 src/entities/eyeDroids/laserDroid.h create mode 100644 src/entities/eyeDroids/plasmaDroid.h create mode 100644 src/entities/eyeDroids/spreadGunDroid.h diff --git a/common.mk b/common.mk index 241ce13..ee90431 100644 --- a/common.mk +++ b/common.mk @@ -41,12 +41,12 @@ _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 _OBJS += key.o keycard.o -_OBJS += laser.o laserTrap.o lift.o lookup.o +_OBJS += laser.o laserBlob.o laserDroid.o laserTrap.o lift.o lookup.o _OBJS += machineGunBlob.o machineGunDroid.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 += particles.o player.o plasmaBlob.o plasmaDroid.o pistolBlob.o pistolDroid.o powerPoint.o powerPool.o pressurePlate.o pushBlock.o _OBJS += quadtree.o -_OBJS += shotgunBlob.o shotgunDroid.o sound.o sprites.o structures.o +_OBJS += shotgunBlob.o shotgunDroid.o sound.o spreadGunBlob.o spreadGunDroid.o sprites.o structures.o _OBJS += tankCommander.o tankTrack.o teeka.o teleporter.o text.o textures.o title.o triggers.o _OBJS += unit.o util.o _OBJS += weapons.o weaponPickup.o widgets.o world.o worldLoader.o diff --git a/src/entities/blobs/teeka.c b/src/entities/blobs/teeka.c index be706eb..df8109b 100644 --- a/src/entities/blobs/teeka.c +++ b/src/entities/blobs/teeka.c @@ -30,7 +30,7 @@ static Entity *target; static Sprite *aimedSprite; static int exitMission; -void initTeeka(void) +Entity *initTeeka(void) { Unit *u; @@ -55,6 +55,8 @@ void initTeeka(void) u->tick = tick; aimedSprite = getSprite("AimedShot"); + + return (Entity*)u; } static void tick(void) diff --git a/src/entities/entityFactory.c b/src/entities/entityFactory.c index 0de8678..0dd34c7 100644 --- a/src/entities/entityFactory.c +++ b/src/entities/entityFactory.c @@ -43,9 +43,16 @@ void initEntityFactory(void) addEntityDef("GrenadeEyeDroid", initGrenadeDroid); addEntityDef("ShotgunBlob", initShotgunBlob); addEntityDef("ShotgunEyeDroid", initShotgunDroid); + addEntityDef("LaserBlob", initLaserBlob); + addEntityDef("LaserEyeDroid", initLaserDroid); + addEntityDef("SpreadGunBlob", initSpreadGunBlob); + addEntityDef("SpreadGunEyeDroid", initSpreadGunDroid); + addEntityDef("PlasmaEyeDroid", initPlasmaDroid); + addEntityDef("PlasmaBlob", initPlasmaBlob); addEntityDef("Bob", initBob); addEntityDef("MIA", initMIA); + addEntityDef("Teeka", initTeeka); addEntityDef("Item", initItem); addEntityDef("BronzeKey", initBronzeKey); @@ -55,6 +62,7 @@ void initEntityFactory(void) addEntityDef("BlueKeycard", initBlueKeycard); addEntityDef("RedKeycard", initRedKeycard); addEntityDef("YellowKeycard", initYellowKeycard); + addEntityDef("WhiteKeycard", initWhiteKeycard); addEntityDef("Cell", initCell); addEntityDef("Heart", initHeart); diff --git a/src/entities/entityFactory.h b/src/entities/entityFactory.h index 7f368f8..da535b8 100644 --- a/src/entities/entityFactory.h +++ b/src/entities/entityFactory.h @@ -54,8 +54,16 @@ extern Entity *initCardReader(void); extern Entity *initBlueKeycard(void); extern Entity *initRedKeycard(void); extern Entity *initYellowKeycard(void); +extern Entity *initWhiteKeycard(void); extern Entity *initLaserTrap(void); extern Entity *initHorizontalLaserTrap(void); extern Entity *initMachineGunDroid(void); +extern Entity *initLaserDroid(void); +extern Entity *initLaserBlob(void); +extern Entity *initSpreadGunBlob(void); +extern Entity *initSpreadGunDroid(void); +extern Entity *initPlasmaDroid(void); +extern Entity *initPlasmaBlob(void); +extern Entity *initTeeka(void); extern World world; diff --git a/src/entities/evilBlobs/laserBlob.c b/src/entities/evilBlobs/laserBlob.c index 12eeb48..e983aa9 100644 --- a/src/entities/evilBlobs/laserBlob.c +++ b/src/entities/evilBlobs/laserBlob.c @@ -22,9 +22,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static int canFire(Entity *target); -void initLaserBlob(Unit *u) +Entity *initLaserBlob(void) { + Unit *u; + + u = createUnit(); + initEvilBlob(u); + + u->unitType = "LaserBlob"; u->sprite[FACING_LEFT] = getSprite("LaserBlobLeft"); u->sprite[FACING_RIGHT] = getSprite("LaserBlobRight"); @@ -35,6 +41,8 @@ void initLaserBlob(Unit *u) u->maxShotsToFire = 1; u->canFire = canFire; + + return (Entity*)u; } static int canFire(Entity *target) diff --git a/src/entities/evilBlobs/laserBlob.h b/src/entities/evilBlobs/laserBlob.h new file mode 100644 index 0000000..87bb9bc --- /dev/null +++ b/src/entities/evilBlobs/laserBlob.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/entities/evilBlobs/plasmaBlob.c b/src/entities/evilBlobs/plasmaBlob.c index a223b59..4219d0d 100644 --- a/src/entities/evilBlobs/plasmaBlob.c +++ b/src/entities/evilBlobs/plasmaBlob.c @@ -22,10 +22,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static int canFire(Entity *target); -void initPlasmaBlob(Unit *u) +Entity *initPlasmaBlob(void) { + Unit *u; + + u = createUnit(); + initEvilBlob(u); + u->unitType = "PlasmaBlob"; + u->sprite[FACING_LEFT] = getSprite("PlasmaBlobLeft"); u->sprite[FACING_RIGHT] = getSprite("PlasmaBlobRight"); u->sprite[FACING_DIE] = getSprite("PlasmaBlobSpin"); @@ -35,6 +41,8 @@ void initPlasmaBlob(Unit *u) u->maxShotsToFire = 6; u->canFire = canFire; + + return (Entity*)u; } static int canFire(Entity *target) diff --git a/src/entities/evilBlobs/plasmaBlob.h b/src/entities/evilBlobs/plasmaBlob.h new file mode 100644 index 0000000..87bb9bc --- /dev/null +++ b/src/entities/evilBlobs/plasmaBlob.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/entities/evilBlobs/spreadGunBlob.c b/src/entities/evilBlobs/spreadGunBlob.c index a8f9e56..1f88246 100644 --- a/src/entities/evilBlobs/spreadGunBlob.c +++ b/src/entities/evilBlobs/spreadGunBlob.c @@ -22,9 +22,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static int canFire(Entity *target); -void initSpreadGunBlob(Unit *u) +Entity *initSpreadGunBlob(void) { + Unit *u; + + u = createUnit(); + initEvilBlob(u); + + u->unitType = "SpreadGunBlob"; u->sprite[FACING_LEFT] = getSprite("SpreadGunBlobLeft"); u->sprite[FACING_RIGHT] = getSprite("SpreadGunBlobRight"); @@ -35,9 +41,11 @@ void initSpreadGunBlob(Unit *u) u->maxShotsToFire = 3; u->canFire = canFire; + + return (Entity*)u; } static int canFire(Entity *target) { - return abs(target->y - u->y) <= MAP_TILE_SIZE * 5; + return abs(target->y - self->y) <= MAP_TILE_SIZE * 5; } diff --git a/src/entities/evilBlobs/spreadGunBlob.h b/src/entities/evilBlobs/spreadGunBlob.h new file mode 100644 index 0000000..87bb9bc --- /dev/null +++ b/src/entities/evilBlobs/spreadGunBlob.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/entities/eyeDroids/laserDroid.c b/src/entities/eyeDroids/laserDroid.c index c1a3187..35b426a 100644 --- a/src/entities/eyeDroids/laserDroid.c +++ b/src/entities/eyeDroids/laserDroid.c @@ -22,9 +22,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static int canFire(Entity *target); -void initLaserDroid(Unit *u) +Entity *initLaserDroid(void) { + Unit *u; + + u = createUnit(); + initEyeDroid(u); + + u->unitType = "LaserEyeDroid"; u->sprite[FACING_LEFT] = getSprite("LaserDroidLeft"); u->sprite[FACING_RIGHT] = getSprite("LaserDroidRight"); @@ -35,6 +41,8 @@ void initLaserDroid(Unit *u) u->maxShotsToFire = 1; u->canFire = canFire; + + return (Entity*)u; } static int canFire(Entity *target) diff --git a/src/entities/eyeDroids/laserDroid.h b/src/entities/eyeDroids/laserDroid.h new file mode 100644 index 0000000..b83685e --- /dev/null +++ b/src/entities/eyeDroids/laserDroid.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 initEyeDroid(Unit *u); +extern Sprite *getSprite(char *name); + +extern Entity *self; diff --git a/src/entities/eyeDroids/plasmaDroid.c b/src/entities/eyeDroids/plasmaDroid.c index 402ef6f..f83ab54 100644 --- a/src/entities/eyeDroids/plasmaDroid.c +++ b/src/entities/eyeDroids/plasmaDroid.c @@ -22,9 +22,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static int canFire(Entity *target); -void initPlasmaDroid(Unit *u) +Entity *initPlasmaDroid(void) { + Unit *u; + + u = createUnit(); + initEyeDroid(u); + + u->unitType = "PlasmaEyeDroid"; u->sprite[FACING_LEFT] = getSprite("PlasmaDroidLeft"); u->sprite[FACING_RIGHT] = getSprite("PlasmaDroidRight"); @@ -35,6 +41,8 @@ void initPlasmaDroid(Unit *u) u->maxShotsToFire = 6; u->canFire = canFire; + + return (Entity*)u; } static int canFire(Entity *target) diff --git a/src/entities/eyeDroids/plasmaDroid.h b/src/entities/eyeDroids/plasmaDroid.h new file mode 100644 index 0000000..b83685e --- /dev/null +++ b/src/entities/eyeDroids/plasmaDroid.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 initEyeDroid(Unit *u); +extern Sprite *getSprite(char *name); + +extern Entity *self; diff --git a/src/entities/eyeDroids/spreadGunDroid.c b/src/entities/eyeDroids/spreadGunDroid.c index 4c62ada..0629806 100644 --- a/src/entities/eyeDroids/spreadGunDroid.c +++ b/src/entities/eyeDroids/spreadGunDroid.c @@ -22,9 +22,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static int canFire(Entity *target); -void initSpreadGunDroid(Unit *u) +Entity *initSpreadGunDroid(void) { + Unit *u; + + u = createUnit(); + initEyeDroid(u); + + u->unitType = "SpreadGunEyeDroid"; u->sprite[FACING_LEFT] = getSprite("SpreadGunDroidLeft"); u->sprite[FACING_RIGHT] = getSprite("SpreadGunDroidRight"); @@ -35,6 +41,8 @@ void initSpreadGunDroid(Unit *u) u->maxShotsToFire = 3; u->canFire = canFire; + + return (Entity*)u; } static int canFire(Entity *target) diff --git a/src/entities/eyeDroids/spreadGunDroid.h b/src/entities/eyeDroids/spreadGunDroid.h new file mode 100644 index 0000000..b83685e --- /dev/null +++ b/src/entities/eyeDroids/spreadGunDroid.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 initEyeDroid(Unit *u); +extern Sprite *getSprite(char *name); + +extern Entity *self;