Use createEvilBlob and createEyeDroid functions.

This commit is contained in:
Steve 2018-02-12 18:26:18 +00:00
parent dff8dee815
commit ff74e19f12
34 changed files with 55 additions and 78 deletions

View File

@ -26,9 +26,7 @@ Entity *initAquaBlob(void)
{ {
Unit *u; Unit *u;
u = createUnit(); u = createEvilBlob();
initEvilBlob(u);
u->sprite[FACING_LEFT] = getSprite("AquaBlobLeft"); u->sprite[FACING_LEFT] = getSprite("AquaBlobLeft");
u->sprite[FACING_RIGHT] = getSprite("AquaBlobRight"); u->sprite[FACING_RIGHT] = getSprite("AquaBlobRight");

View File

@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../common.h" #include "../../common.h"
extern Unit *createUnit(void); extern Unit *createEvilBlob(void);
extern void initEvilBlob(Unit *u);
extern Sprite *getSprite(char *name); extern Sprite *getSprite(char *name);
extern Entity *self;

View File

@ -27,8 +27,12 @@ static void returnToStart(void);
static void lookForPlayer(void); static void lookForPlayer(void);
static void animate(void); static void animate(void);
void initEvilBlob(Unit *u) Unit *createEvilBlob(void)
{ {
Unit *u;
u = createUnit();
u->reload = 0; u->reload = 0;
u->returnToStartTimer = 0; u->returnToStartTimer = 0;
@ -41,6 +45,8 @@ void initEvilBlob(Unit *u)
u->walk = lookForPlayer; u->walk = lookForPlayer;
u->animate = animate; u->animate = animate;
u->die = die; u->die = die;
return u;
} }
static void die2(void) static void die2(void)

View File

@ -34,6 +34,7 @@ extern void addDefeatedTarget(char *name);
extern void fireTriggers(char *name); extern void fireTriggers(char *name);
extern void addRandomItems(float x, float y); extern void addRandomItems(float x, float y);
extern int rrnd(int low, int high); extern int rrnd(int low, int high);
extern Unit *createUnit(void);
extern Dev dev; extern Dev dev;
extern Entity *self; extern Entity *self;

View File

@ -28,9 +28,7 @@ Entity *initGrenadeBlob(void)
{ {
Unit *u; Unit *u;
u = createUnit(); u = createEvilBlob();
initEvilBlob(u);
u->unitType = "GrenadeBlob"; u->unitType = "GrenadeBlob";

View File

@ -20,8 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../common.h" #include "../../common.h"
extern Unit *createUnit(void); extern Unit *createEvilBlob(void);
extern void initEvilBlob(Unit *u);
extern Sprite *getSprite(char *name); extern Sprite *getSprite(char *name);
extern Entity *self; extern Entity *self;

View File

@ -26,9 +26,7 @@ Entity *initLaserBlob(void)
{ {
Unit *u; Unit *u;
u = createUnit(); u = createEvilBlob();
initEvilBlob(u);
u->unitType = "LaserBlob"; u->unitType = "LaserBlob";

View File

@ -20,8 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../common.h" #include "../../common.h"
extern Unit *createUnit(void); extern Unit *createEvilBlob(void);
extern void initEvilBlob(Unit *u);
extern Sprite *getSprite(char *name); extern Sprite *getSprite(char *name);
extern Entity *self; extern Entity *self;

View File

@ -26,9 +26,7 @@ Entity *initMachineGunBlob(void)
{ {
Unit *u; Unit *u;
u = createUnit(); u = createEvilBlob();
initEvilBlob(u);
u->unitType = "MachineGunBlob"; u->unitType = "MachineGunBlob";

View File

@ -20,8 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../common.h" #include "../../common.h"
extern Unit *createUnit(void); extern Unit *createEvilBlob(void);
extern void initEvilBlob(Unit *u);
extern Sprite *getSprite(char *name); extern Sprite *getSprite(char *name);
extern Entity *self; extern Entity *self;

View File

@ -26,9 +26,7 @@ Entity *initPistolBlob(void)
{ {
Unit *u; Unit *u;
u = createUnit(); u = createEvilBlob();
initEvilBlob(u);
u->unitType = "PistolBlob"; u->unitType = "PistolBlob";

View File

@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include "../../common.h" #include "../../common.h"
#include "../../json/cJSON.h"
extern Unit *createUnit(void); extern Unit *createEvilBlob(void);
extern void initEvilBlob(Unit *u);
extern Sprite *getSprite(char *name); extern Sprite *getSprite(char *name);
extern Entity *self;

View File

@ -26,9 +26,7 @@ Entity *initPlasmaBlob(void)
{ {
Unit *u; Unit *u;
u = createUnit(); u = createEvilBlob();
initEvilBlob(u);
u->unitType = "PlasmaBlob"; u->unitType = "PlasmaBlob";

View File

@ -20,8 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../common.h" #include "../../common.h"
extern Unit *createUnit(void); extern Unit *createEvilBlob(void);
extern void initEvilBlob(Unit *u);
extern Sprite *getSprite(char *name); extern Sprite *getSprite(char *name);
extern Entity *self; extern Entity *self;

View File

@ -26,9 +26,7 @@ Entity *initShotgunBlob(void)
{ {
Unit *u; Unit *u;
u = createUnit(); u = createEvilBlob();
initEvilBlob(u);
u->unitType = "ShotgunBlob"; u->unitType = "ShotgunBlob";

View File

@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../common.h" #include "../../common.h"
extern Unit *createUnit(void); extern Unit *createEvilBlob(void);
extern void initEvilBlob(Unit *u);
extern Sprite *getSprite(char *name); extern Sprite *getSprite(char *name);
extern Entity *self;

View File

@ -26,9 +26,7 @@ Entity *initSpreadGunBlob(void)
{ {
Unit *u; Unit *u;
u = createUnit(); u = createEvilBlob();
initEvilBlob(u);
u->unitType = "SpreadGunBlob"; u->unitType = "SpreadGunBlob";

View File

@ -20,8 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../common.h" #include "../../common.h"
extern Unit *createUnit(void); extern Unit *createEvilBlob(void);
extern void initEvilBlob(Unit *u);
extern Sprite *getSprite(char *name); extern Sprite *getSprite(char *name);
extern Entity *self; extern Entity *self;

View File

@ -27,8 +27,12 @@ static void touch(Entity *other);
static void (*superTick)(void); static void (*superTick)(void);
static void (*superTouch)(Entity *other); 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; u->flags |= EF_WEIGHTLESS | EF_HALT_AT_EDGE | EF_EXPLODES;
superTick = u->tick; superTick = u->tick;
@ -39,6 +43,8 @@ void initEyeDroid(Unit *u)
u->tick = tick; u->tick = tick;
u->touch = touch; u->touch = touch;
u->die = die; u->die = die;
return u;
} }
static void tick(void) static void tick(void)

View File

@ -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 throwDebris(float x, float y, int amount);
extern void addSmokeParticles(float x, float y); extern void addSmokeParticles(float x, float y);
extern void addScorchDecal(int x, int y); extern void addScorchDecal(int x, int y);
extern Unit *createUnit(void);
extern Dev dev; extern Dev dev;
extern Entity *self; extern Entity *self;

View File

@ -28,9 +28,7 @@ Entity *initGrenadeDroid(void)
{ {
Unit *u; Unit *u;
u = createUnit(); u = createEyeDroid();
initEyeDroid(u);
u->unitType = "GrenadeEyeDroid"; u->unitType = "GrenadeEyeDroid";

View File

@ -20,8 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../common.h" #include "../../common.h"
extern Unit *createUnit(void); extern Unit *createEyeDroid(void);
extern void initEyeDroid(Unit *u);
extern Sprite *getSprite(char *name); extern Sprite *getSprite(char *name);
extern Entity *self; extern Entity *self;

View File

@ -26,9 +26,7 @@ Entity *initLaserDroid(void)
{ {
Unit *u; Unit *u;
u = createUnit(); u = createEyeDroid();
initEyeDroid(u);
u->unitType = "LaserEyeDroid"; u->unitType = "LaserEyeDroid";

View File

@ -20,8 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../common.h" #include "../../common.h"
extern Unit *createUnit(void); extern Unit *createEyeDroid(void);
extern void initEyeDroid(Unit *u);
extern Sprite *getSprite(char *name); extern Sprite *getSprite(char *name);
extern Entity *self; extern Entity *self;

View File

@ -26,9 +26,7 @@ Entity *initMachineGunDroid(void)
{ {
Unit *u; Unit *u;
u = createUnit(); u = createEyeDroid();
initEyeDroid(u);
u->unitType = "MachineGunEyeDroid"; u->unitType = "MachineGunEyeDroid";

View File

@ -20,8 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../common.h" #include "../../common.h"
extern Unit *createUnit(void); extern Unit *createEyeDroid(void);
extern void initEyeDroid(Unit *u);
extern Sprite *getSprite(char *name); extern Sprite *getSprite(char *name);
extern Entity *self; extern Entity *self;

View File

@ -26,9 +26,7 @@ Entity *initPistolDroid(void)
{ {
Unit *u; Unit *u;
u = createUnit(); u = createEyeDroid();
initEyeDroid(u);
u->unitType = "PistolEyeDroid"; u->unitType = "PistolEyeDroid";

View File

@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../common.h" #include "../../common.h"
extern Unit *createUnit(void); extern Unit *createEyeDroid(void);
extern void initEyeDroid(Unit *u);
extern Sprite *getSprite(char *name); extern Sprite *getSprite(char *name);
extern Entity *self;

View File

@ -26,9 +26,7 @@ Entity *initPlasmaDroid(void)
{ {
Unit *u; Unit *u;
u = createUnit(); u = createEyeDroid();
initEyeDroid(u);
u->unitType = "PlasmaEyeDroid"; u->unitType = "PlasmaEyeDroid";

View File

@ -20,8 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../common.h" #include "../../common.h"
extern Unit *createUnit(void); extern Unit *createEyeDroid(void);
extern void initEyeDroid(Unit *u);
extern Sprite *getSprite(char *name); extern Sprite *getSprite(char *name);
extern Entity *self; extern Entity *self;

View File

@ -26,9 +26,7 @@ Entity *initShotgunDroid(void)
{ {
Unit *u; Unit *u;
u = createUnit(); u = createEyeDroid();
initEyeDroid(u);
u->unitType = "ShotgunEyeDroid"; u->unitType = "ShotgunEyeDroid";

View File

@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../common.h" #include "../../common.h"
extern Unit *createUnit(void); extern Unit *createEyeDroid(void);
extern void initEyeDroid(Unit *u);
extern Sprite *getSprite(char *name); extern Sprite *getSprite(char *name);
extern Entity *self;

View File

@ -26,9 +26,7 @@ Entity *initSpreadGunDroid(void)
{ {
Unit *u; Unit *u;
u = createUnit(); u = createEyeDroid();
initEyeDroid(u);
u->unitType = "SpreadGunEyeDroid"; u->unitType = "SpreadGunEyeDroid";

View File

@ -20,8 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../common.h" #include "../../common.h"
extern Unit *createUnit(void); extern Unit *createEyeDroid(void);
extern void initEyeDroid(Unit *u);
extern Sprite *getSprite(char *name); extern Sprite *getSprite(char *name);
extern Entity *self; extern Entity *self;