diff --git a/src/entities/evilBlobs/aquaBlob.c b/src/entities/evilBlobs/aquaBlob.c index 604b1d5..1ae7baf 100644 --- a/src/entities/evilBlobs/aquaBlob.c +++ b/src/entities/evilBlobs/aquaBlob.c @@ -26,9 +26,7 @@ Entity *initAquaBlob(void) { Unit *u; - u = createUnit(); - - initEvilBlob(u); + u = createEvilBlob(); u->sprite[FACING_LEFT] = getSprite("AquaBlobLeft"); u->sprite[FACING_RIGHT] = getSprite("AquaBlobRight"); diff --git a/src/entities/evilBlobs/aquaBlob.h b/src/entities/evilBlobs/aquaBlob.h index de1b0d2..cc1431d 100644 --- a/src/entities/evilBlobs/aquaBlob.h +++ b/src/entities/evilBlobs/aquaBlob.h @@ -20,6 +20,7 @@ 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 Unit *createEvilBlob(void); extern Sprite *getSprite(char *name); + +extern Entity *self; diff --git a/src/entities/evilBlobs/evilBlob.c b/src/entities/evilBlobs/evilBlob.c index 10c7cbc..3b72353 100644 --- a/src/entities/evilBlobs/evilBlob.c +++ b/src/entities/evilBlobs/evilBlob.c @@ -27,8 +27,12 @@ static void returnToStart(void); static void lookForPlayer(void); static void animate(void); -void initEvilBlob(Unit *u) +Unit *createEvilBlob(void) { + Unit *u; + + u = createUnit(); + u->reload = 0; u->returnToStartTimer = 0; @@ -41,6 +45,8 @@ void initEvilBlob(Unit *u) u->walk = lookForPlayer; u->animate = animate; u->die = die; + + return u; } static void die2(void) diff --git a/src/entities/evilBlobs/evilBlob.h b/src/entities/evilBlobs/evilBlob.h index ad9f06f..ea6e159 100644 --- a/src/entities/evilBlobs/evilBlob.h +++ b/src/entities/evilBlobs/evilBlob.h @@ -34,6 +34,7 @@ extern void addDefeatedTarget(char *name); extern void fireTriggers(char *name); extern void addRandomItems(float x, float y); extern int rrnd(int low, int high); +extern Unit *createUnit(void); extern Dev dev; extern Entity *self; diff --git a/src/entities/evilBlobs/grenadeBlob.c b/src/entities/evilBlobs/grenadeBlob.c index 3f6f011..d7eea4b 100644 --- a/src/entities/evilBlobs/grenadeBlob.c +++ b/src/entities/evilBlobs/grenadeBlob.c @@ -28,9 +28,7 @@ Entity *initGrenadeBlob(void) { Unit *u; - u = createUnit(); - - initEvilBlob(u); + u = createEvilBlob(); u->unitType = "GrenadeBlob"; diff --git a/src/entities/evilBlobs/grenadeBlob.h b/src/entities/evilBlobs/grenadeBlob.h index 87bb9bc..cc1431d 100644 --- a/src/entities/evilBlobs/grenadeBlob.h +++ b/src/entities/evilBlobs/grenadeBlob.h @@ -20,8 +20,7 @@ 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 Unit *createEvilBlob(void); extern Sprite *getSprite(char *name); extern Entity *self; diff --git a/src/entities/evilBlobs/laserBlob.c b/src/entities/evilBlobs/laserBlob.c index e983aa9..5dd76ed 100644 --- a/src/entities/evilBlobs/laserBlob.c +++ b/src/entities/evilBlobs/laserBlob.c @@ -26,9 +26,7 @@ Entity *initLaserBlob(void) { Unit *u; - u = createUnit(); - - initEvilBlob(u); + u = createEvilBlob(); u->unitType = "LaserBlob"; diff --git a/src/entities/evilBlobs/laserBlob.h b/src/entities/evilBlobs/laserBlob.h index 87bb9bc..cc1431d 100644 --- a/src/entities/evilBlobs/laserBlob.h +++ b/src/entities/evilBlobs/laserBlob.h @@ -20,8 +20,7 @@ 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 Unit *createEvilBlob(void); extern Sprite *getSprite(char *name); extern Entity *self; diff --git a/src/entities/evilBlobs/machineGunBlob.c b/src/entities/evilBlobs/machineGunBlob.c index cb52e26..8f77d90 100644 --- a/src/entities/evilBlobs/machineGunBlob.c +++ b/src/entities/evilBlobs/machineGunBlob.c @@ -26,9 +26,7 @@ Entity *initMachineGunBlob(void) { Unit *u; - u = createUnit(); - - initEvilBlob(u); + u = createEvilBlob(); u->unitType = "MachineGunBlob"; diff --git a/src/entities/evilBlobs/machineGunBlob.h b/src/entities/evilBlobs/machineGunBlob.h index 87bb9bc..cc1431d 100644 --- a/src/entities/evilBlobs/machineGunBlob.h +++ b/src/entities/evilBlobs/machineGunBlob.h @@ -20,8 +20,7 @@ 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 Unit *createEvilBlob(void); extern Sprite *getSprite(char *name); extern Entity *self; diff --git a/src/entities/evilBlobs/pistolBlob.c b/src/entities/evilBlobs/pistolBlob.c index dbb35a4..996d17a 100644 --- a/src/entities/evilBlobs/pistolBlob.c +++ b/src/entities/evilBlobs/pistolBlob.c @@ -26,9 +26,7 @@ Entity *initPistolBlob(void) { Unit *u; - u = createUnit(); - - initEvilBlob(u); + u = createEvilBlob(); u->unitType = "PistolBlob"; diff --git a/src/entities/evilBlobs/pistolBlob.h b/src/entities/evilBlobs/pistolBlob.h index aa4290f..cc1431d 100644 --- a/src/entities/evilBlobs/pistolBlob.h +++ b/src/entities/evilBlobs/pistolBlob.h @@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "../../common.h" -#include "../../json/cJSON.h" -extern Unit *createUnit(void); -extern void initEvilBlob(Unit *u); +extern Unit *createEvilBlob(void); extern Sprite *getSprite(char *name); + +extern Entity *self; diff --git a/src/entities/evilBlobs/plasmaBlob.c b/src/entities/evilBlobs/plasmaBlob.c index 4219d0d..bda4083 100644 --- a/src/entities/evilBlobs/plasmaBlob.c +++ b/src/entities/evilBlobs/plasmaBlob.c @@ -26,9 +26,7 @@ Entity *initPlasmaBlob(void) { Unit *u; - u = createUnit(); - - initEvilBlob(u); + u = createEvilBlob(); u->unitType = "PlasmaBlob"; diff --git a/src/entities/evilBlobs/plasmaBlob.h b/src/entities/evilBlobs/plasmaBlob.h index 87bb9bc..cc1431d 100644 --- a/src/entities/evilBlobs/plasmaBlob.h +++ b/src/entities/evilBlobs/plasmaBlob.h @@ -20,8 +20,7 @@ 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 Unit *createEvilBlob(void); extern Sprite *getSprite(char *name); extern Entity *self; diff --git a/src/entities/evilBlobs/shotgunBlob.c b/src/entities/evilBlobs/shotgunBlob.c index 605ca03..2996747 100644 --- a/src/entities/evilBlobs/shotgunBlob.c +++ b/src/entities/evilBlobs/shotgunBlob.c @@ -26,9 +26,7 @@ Entity *initShotgunBlob(void) { Unit *u; - u = createUnit(); - - initEvilBlob(u); + u = createEvilBlob(); u->unitType = "ShotgunBlob"; diff --git a/src/entities/evilBlobs/shotgunBlob.h b/src/entities/evilBlobs/shotgunBlob.h index 641499f..cc1431d 100644 --- a/src/entities/evilBlobs/shotgunBlob.h +++ b/src/entities/evilBlobs/shotgunBlob.h @@ -20,7 +20,7 @@ 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 Unit *createEvilBlob(void); extern Sprite *getSprite(char *name); +extern Entity *self; diff --git a/src/entities/evilBlobs/spreadGunBlob.c b/src/entities/evilBlobs/spreadGunBlob.c index 1f88246..71d160d 100644 --- a/src/entities/evilBlobs/spreadGunBlob.c +++ b/src/entities/evilBlobs/spreadGunBlob.c @@ -26,9 +26,7 @@ Entity *initSpreadGunBlob(void) { Unit *u; - u = createUnit(); - - initEvilBlob(u); + u = createEvilBlob(); u->unitType = "SpreadGunBlob"; diff --git a/src/entities/evilBlobs/spreadGunBlob.h b/src/entities/evilBlobs/spreadGunBlob.h index 87bb9bc..cc1431d 100644 --- a/src/entities/evilBlobs/spreadGunBlob.h +++ b/src/entities/evilBlobs/spreadGunBlob.h @@ -20,8 +20,7 @@ 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 Unit *createEvilBlob(void); extern Sprite *getSprite(char *name); extern Entity *self; diff --git a/src/entities/eyeDroids/eyeDroid.c b/src/entities/eyeDroids/eyeDroid.c index 347627f..a3086ad 100644 --- a/src/entities/eyeDroids/eyeDroid.c +++ b/src/entities/eyeDroids/eyeDroid.c @@ -27,8 +27,12 @@ static void touch(Entity *other); static void (*superTick)(void); static void (*superTouch)(Entity *other); -void initEyeDroid(Unit *u) +Unit *createEyeDroid(void) { + Unit *u; + + u = createUnit(); + u->flags |= EF_WEIGHTLESS | EF_HALT_AT_EDGE | EF_EXPLODES; superTick = u->tick; @@ -39,6 +43,8 @@ void initEyeDroid(Unit *u) u->tick = tick; u->touch = touch; u->die = die; + + return u; } static void tick(void) diff --git a/src/entities/eyeDroids/eyeDroid.h b/src/entities/eyeDroids/eyeDroid.h index e4a8bcd..b378011 100644 --- a/src/entities/eyeDroids/eyeDroid.h +++ b/src/entities/eyeDroids/eyeDroid.h @@ -36,6 +36,7 @@ extern void addExplosion(float x, float y, int radius, Entity *owner); extern void throwDebris(float x, float y, int amount); extern void addSmokeParticles(float x, float y); extern void addScorchDecal(int x, int y); +extern Unit *createUnit(void); extern Dev dev; extern Entity *self; diff --git a/src/entities/eyeDroids/grenadeDroid.c b/src/entities/eyeDroids/grenadeDroid.c index d277fbb..900d306 100644 --- a/src/entities/eyeDroids/grenadeDroid.c +++ b/src/entities/eyeDroids/grenadeDroid.c @@ -28,9 +28,7 @@ Entity *initGrenadeDroid(void) { Unit *u; - u = createUnit(); - - initEyeDroid(u); + u = createEyeDroid(); u->unitType = "GrenadeEyeDroid"; diff --git a/src/entities/eyeDroids/grenadeDroid.h b/src/entities/eyeDroids/grenadeDroid.h index b83685e..34975f9 100644 --- a/src/entities/eyeDroids/grenadeDroid.h +++ b/src/entities/eyeDroids/grenadeDroid.h @@ -20,8 +20,7 @@ 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 Unit *createEyeDroid(void); extern Sprite *getSprite(char *name); extern Entity *self; diff --git a/src/entities/eyeDroids/laserDroid.c b/src/entities/eyeDroids/laserDroid.c index 35b426a..7513f77 100644 --- a/src/entities/eyeDroids/laserDroid.c +++ b/src/entities/eyeDroids/laserDroid.c @@ -26,9 +26,7 @@ Entity *initLaserDroid(void) { Unit *u; - u = createUnit(); - - initEyeDroid(u); + u = createEyeDroid(); u->unitType = "LaserEyeDroid"; diff --git a/src/entities/eyeDroids/laserDroid.h b/src/entities/eyeDroids/laserDroid.h index b83685e..34975f9 100644 --- a/src/entities/eyeDroids/laserDroid.h +++ b/src/entities/eyeDroids/laserDroid.h @@ -20,8 +20,7 @@ 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 Unit *createEyeDroid(void); extern Sprite *getSprite(char *name); extern Entity *self; diff --git a/src/entities/eyeDroids/machineGunDroid.c b/src/entities/eyeDroids/machineGunDroid.c index bc98244..bcf0592 100644 --- a/src/entities/eyeDroids/machineGunDroid.c +++ b/src/entities/eyeDroids/machineGunDroid.c @@ -26,9 +26,7 @@ Entity *initMachineGunDroid(void) { Unit *u; - u = createUnit(); - - initEyeDroid(u); + u = createEyeDroid(); u->unitType = "MachineGunEyeDroid"; diff --git a/src/entities/eyeDroids/machineGunDroid.h b/src/entities/eyeDroids/machineGunDroid.h index b83685e..34975f9 100644 --- a/src/entities/eyeDroids/machineGunDroid.h +++ b/src/entities/eyeDroids/machineGunDroid.h @@ -20,8 +20,7 @@ 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 Unit *createEyeDroid(void); extern Sprite *getSprite(char *name); extern Entity *self; diff --git a/src/entities/eyeDroids/pistolDroid.c b/src/entities/eyeDroids/pistolDroid.c index 4a1cb4b..61b2f7d 100644 --- a/src/entities/eyeDroids/pistolDroid.c +++ b/src/entities/eyeDroids/pistolDroid.c @@ -26,9 +26,7 @@ Entity *initPistolDroid(void) { Unit *u; - u = createUnit(); - - initEyeDroid(u); + u = createEyeDroid(); u->unitType = "PistolEyeDroid"; diff --git a/src/entities/eyeDroids/pistolDroid.h b/src/entities/eyeDroids/pistolDroid.h index ad19b31..34975f9 100644 --- a/src/entities/eyeDroids/pistolDroid.h +++ b/src/entities/eyeDroids/pistolDroid.h @@ -20,6 +20,7 @@ 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 Unit *createEyeDroid(void); extern Sprite *getSprite(char *name); + +extern Entity *self; diff --git a/src/entities/eyeDroids/plasmaDroid.c b/src/entities/eyeDroids/plasmaDroid.c index f83ab54..07b48ee 100644 --- a/src/entities/eyeDroids/plasmaDroid.c +++ b/src/entities/eyeDroids/plasmaDroid.c @@ -26,9 +26,7 @@ Entity *initPlasmaDroid(void) { Unit *u; - u = createUnit(); - - initEyeDroid(u); + u = createEyeDroid(); u->unitType = "PlasmaEyeDroid"; diff --git a/src/entities/eyeDroids/plasmaDroid.h b/src/entities/eyeDroids/plasmaDroid.h index b83685e..34975f9 100644 --- a/src/entities/eyeDroids/plasmaDroid.h +++ b/src/entities/eyeDroids/plasmaDroid.h @@ -20,8 +20,7 @@ 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 Unit *createEyeDroid(void); extern Sprite *getSprite(char *name); extern Entity *self; diff --git a/src/entities/eyeDroids/shotgunDroid.c b/src/entities/eyeDroids/shotgunDroid.c index 27c69cf..c714b26 100644 --- a/src/entities/eyeDroids/shotgunDroid.c +++ b/src/entities/eyeDroids/shotgunDroid.c @@ -26,9 +26,7 @@ Entity *initShotgunDroid(void) { Unit *u; - u = createUnit(); - - initEyeDroid(u); + u = createEyeDroid(); u->unitType = "ShotgunEyeDroid"; diff --git a/src/entities/eyeDroids/shotgunDroid.h b/src/entities/eyeDroids/shotgunDroid.h index ad19b31..34975f9 100644 --- a/src/entities/eyeDroids/shotgunDroid.h +++ b/src/entities/eyeDroids/shotgunDroid.h @@ -20,6 +20,7 @@ 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 Unit *createEyeDroid(void); extern Sprite *getSprite(char *name); + +extern Entity *self; diff --git a/src/entities/eyeDroids/spreadGunDroid.c b/src/entities/eyeDroids/spreadGunDroid.c index 0629806..594d6bc 100644 --- a/src/entities/eyeDroids/spreadGunDroid.c +++ b/src/entities/eyeDroids/spreadGunDroid.c @@ -26,9 +26,7 @@ Entity *initSpreadGunDroid(void) { Unit *u; - u = createUnit(); - - initEyeDroid(u); + u = createEyeDroid(); u->unitType = "SpreadGunEyeDroid"; diff --git a/src/entities/eyeDroids/spreadGunDroid.h b/src/entities/eyeDroids/spreadGunDroid.h index b83685e..34975f9 100644 --- a/src/entities/eyeDroids/spreadGunDroid.h +++ b/src/entities/eyeDroids/spreadGunDroid.h @@ -20,8 +20,7 @@ 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 Unit *createEyeDroid(void); extern Sprite *getSprite(char *name); extern Entity *self;