Loading some entities.
This commit is contained in:
parent
21e50e51e7
commit
917753aefe
|
@ -10,6 +10,7 @@ SEARCHPATH += src/entities/boss
|
||||||
SEARCHPATH += src/entities/cannons
|
SEARCHPATH += src/entities/cannons
|
||||||
SEARCHPATH += src/entities/decoration
|
SEARCHPATH += src/entities/decoration
|
||||||
SEARCHPATH += src/entities/evilBlobs
|
SEARCHPATH += src/entities/evilBlobs
|
||||||
|
SEARCHPATH += src/entities/eyeDroids
|
||||||
SEARCHPATH += src/entities/items
|
SEARCHPATH += src/entities/items
|
||||||
SEARCHPATH += src/entities/misc
|
SEARCHPATH += src/entities/misc
|
||||||
SEARCHPATH += src/entities/structures
|
SEARCHPATH += src/entities/structures
|
||||||
|
@ -32,7 +33,7 @@ OBJS += atlas.o atlasTest.o aquaBlob.o
|
||||||
OBJS += battery.o blaze.o bob.o boss.o blobBoss.o
|
OBJS += battery.o blaze.o bob.o boss.o blobBoss.o
|
||||||
OBJS += camera.o cannon.o cardReader.o cell.o cherry.o combat.o consumable.o
|
OBJS += camera.o cannon.o cardReader.o cell.o cherry.o combat.o consumable.o
|
||||||
OBJS += debris.o destructable.o door.o draw.o
|
OBJS += debris.o destructable.o door.o draw.o
|
||||||
OBJS += effects.o entities.o entityFactory.o exit.o explosions.o eyeDroidCommander.o evilBlob.o
|
OBJS += effects.o entities.o entityFactory.o exit.o explosions.o eyeDroid.o eyeDroidCommander.o evilBlob.o
|
||||||
OBJS += fleshChunk.o frost.o
|
OBJS += fleshChunk.o frost.o
|
||||||
OBJS += game.o grenade.o
|
OBJS += game.o grenade.o
|
||||||
OBJS += heart.o horizontalDoor.o horizontalLaserTrap.o hub.o hud.o
|
OBJS += heart.o horizontalDoor.o horizontalLaserTrap.o hub.o hud.o
|
||||||
|
@ -42,7 +43,7 @@ OBJS += key.o keycard.o
|
||||||
OBJS += laser.o laserTrap.o lift.o lookup.o
|
OBJS += laser.o laserTrap.o lift.o lookup.o
|
||||||
OBJS += main.o map.o maths.o mia.o missile.o
|
OBJS += main.o map.o maths.o mia.o missile.o
|
||||||
OBJS += objectives.o
|
OBJS += objectives.o
|
||||||
OBJS += particles.o player.o powerPoint.o powerPool.o pressurePlate.o pushBlock.o
|
OBJS += particles.o player.o pistolBlob.o pistolDroid.o powerPoint.o powerPool.o pressurePlate.o pushBlock.o
|
||||||
OBJS += quadtree.o
|
OBJS += quadtree.o
|
||||||
OBJS += sound.o sprites.o structures.o
|
OBJS += sound.o sprites.o structures.o
|
||||||
OBJS += tankCommander.o tankTrack.o teeka.o teleporter.o text.o textures.o title.o triggers.o
|
OBJS += tankCommander.o tankTrack.o teeka.o teleporter.o text.o textures.o title.o triggers.o
|
||||||
|
|
|
@ -26,13 +26,15 @@ static void touch(Entity *other);
|
||||||
static void preTeleport(void);
|
static void preTeleport(void);
|
||||||
static void teleport(void);
|
static void teleport(void);
|
||||||
|
|
||||||
void initMIA(void)
|
Entity *initMIA(void)
|
||||||
{
|
{
|
||||||
MIA *m;
|
MIA *m;
|
||||||
|
|
||||||
m = malloc(sizeof(MIA));
|
m = malloc(sizeof(MIA));
|
||||||
memset(m, 0, sizeof(MIA));
|
memset(m, 0, sizeof(MIA));
|
||||||
|
|
||||||
|
initEntity((Entity*)m);
|
||||||
|
|
||||||
m->type = ET_MIA;
|
m->type = ET_MIA;
|
||||||
|
|
||||||
m->tx = m->ty = -1;
|
m->tx = m->ty = -1;
|
||||||
|
@ -53,6 +55,8 @@ void initMIA(void)
|
||||||
m->touch = touch;
|
m->touch = touch;
|
||||||
|
|
||||||
m->isMissionTarget = 1;
|
m->isMissionTarget = 1;
|
||||||
|
|
||||||
|
return (Entity*)m;
|
||||||
}
|
}
|
||||||
|
|
||||||
void reinitMIA(Entity *e)
|
void reinitMIA(Entity *e)
|
||||||
|
|
|
@ -28,6 +28,7 @@ extern void setGameplayMessage(int type, char *format, ...);
|
||||||
extern void playSound(int snd, int ch);
|
extern void playSound(int snd, int ch);
|
||||||
extern void updateObjective(char *targetName);
|
extern void updateObjective(char *targetName);
|
||||||
extern void addRescuedMIA(char *name);
|
extern void addRescuedMIA(char *name);
|
||||||
|
extern void initEntity(Entity *e);
|
||||||
|
|
||||||
extern Entity *self;
|
extern Entity *self;
|
||||||
extern World world;
|
extern World world;
|
||||||
|
|
|
@ -20,7 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "entityFactory.h"
|
#include "entityFactory.h"
|
||||||
|
|
||||||
static void addEntityDef(char *name, int type, Entity *(*initFunc)(void));
|
static void addEntityDef(char *name, Entity *(*initFunc)(void));
|
||||||
|
static Entity *initGenericEvilBlob(void);
|
||||||
|
static Entity *initGenericEyeDroid(void);
|
||||||
|
|
||||||
static EntityDef head;
|
static EntityDef head;
|
||||||
static EntityDef *tail;
|
static EntityDef *tail;
|
||||||
|
@ -30,11 +32,33 @@ void initEntityFactory(void)
|
||||||
memset(&head, 0, sizeof(EntityDef));
|
memset(&head, 0, sizeof(EntityDef));
|
||||||
tail = &head;
|
tail = &head;
|
||||||
|
|
||||||
addEntityDef("AquaBlob", ET_ENEMY, initAquaBlob);
|
addEntityDef("AquaBlob", initAquaBlob);
|
||||||
|
addEntityDef("PistolBlob", initPistolBlob);
|
||||||
|
addEntityDef("PistolEyeDroid", initPistolDroid);
|
||||||
|
addEntityDef("GenericEvilBlob", initGenericEvilBlob);
|
||||||
|
addEntityDef("GenericEyeDroid", initGenericEyeDroid);
|
||||||
|
|
||||||
addEntityDef("Bob", ET_BOB, initBob);
|
addEntityDef("Bob", initBob);
|
||||||
|
addEntityDef("MIA", initMIA);
|
||||||
|
|
||||||
addEntityDef("Exit", ET_EXIT, initExit);
|
addEntityDef("Item", initItem);
|
||||||
|
addEntityDef("BronzeKey", initBronzeKey);
|
||||||
|
addEntityDef("SilverKey", initSilverKey);
|
||||||
|
addEntityDef("GoldKey", initGoldKey);
|
||||||
|
|
||||||
|
addEntityDef("Exit", initExit);
|
||||||
|
addEntityDef("PowerPool", initPowerPool);
|
||||||
|
addEntityDef("Teleporter", initTeleporter);
|
||||||
|
addEntityDef("PressurePlate", initPressurePlate);
|
||||||
|
addEntityDef("InfoPoint", initInfoPoint);
|
||||||
|
addEntityDef("PowerPoint", initPowerPoint);
|
||||||
|
addEntityDef("PushBlock", initPushBlock);
|
||||||
|
addEntityDef("Lift", initLift);
|
||||||
|
addEntityDef("Door", initDoor);
|
||||||
|
addEntityDef("BronzeDoor", initBronzeDoor);
|
||||||
|
addEntityDef("SilverDoor", initSilverDoor);
|
||||||
|
addEntityDef("GoldDoor", initGoldDoor);
|
||||||
|
addEntityDef("HorizontalDoor", initHorizontalDoor);
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity *createEntity(char *name)
|
Entity *createEntity(char *name)
|
||||||
|
@ -55,7 +79,7 @@ Entity *createEntity(char *name)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addEntityDef(char *name, int type, Entity *(*initFunc)(void))
|
static void addEntityDef(char *name, Entity *(*initFunc)(void))
|
||||||
{
|
{
|
||||||
EntityDef *def;
|
EntityDef *def;
|
||||||
|
|
||||||
|
@ -65,6 +89,31 @@ static void addEntityDef(char *name, int type, Entity *(*initFunc)(void))
|
||||||
tail = def;
|
tail = def;
|
||||||
|
|
||||||
STRNCPY(def->name, name, MAX_NAME_LENGTH);
|
STRNCPY(def->name, name, MAX_NAME_LENGTH);
|
||||||
def->type = type;
|
|
||||||
def->initFunc = initFunc;
|
def->initFunc = initFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Entity *initGenericEvilBlob(void)
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
char name[MAX_NAME_LENGTH];
|
||||||
|
strcpy(name, "");
|
||||||
|
|
||||||
|
r = rand() % world.numEnemyTypes;
|
||||||
|
|
||||||
|
sprintf(name, "%sBlob", world.enemyTypes[r]);
|
||||||
|
|
||||||
|
return createEntity(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Entity *initGenericEyeDroid(void)
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
char name[MAX_NAME_LENGTH];
|
||||||
|
strcpy(name, "");
|
||||||
|
|
||||||
|
r = rand() % world.numEnemyTypes;
|
||||||
|
|
||||||
|
sprintf(name, "%sEyeDroid", world.enemyTypes[r]);
|
||||||
|
|
||||||
|
return createEntity(name);
|
||||||
|
}
|
||||||
|
|
|
@ -21,5 +21,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "../common.h"
|
#include "../common.h"
|
||||||
|
|
||||||
extern Entity *initAquaBlob(void);
|
extern Entity *initAquaBlob(void);
|
||||||
|
extern Entity *initPistolBlob(void);
|
||||||
|
extern Entity *initPistolDroid(void);
|
||||||
extern Entity *initBob(void);
|
extern Entity *initBob(void);
|
||||||
extern Entity *initExit(void);
|
extern Entity *initExit(void);
|
||||||
|
extern Entity *initPowerPool(void);
|
||||||
|
extern Entity *initTeleporter(void);
|
||||||
|
extern Entity *initPressurePlate(void);
|
||||||
|
extern Entity *initInfoPoint(void);
|
||||||
|
extern Entity *initPowerPoint(void);
|
||||||
|
extern Entity *initPushBlock(void);
|
||||||
|
extern Entity *initLift(void);
|
||||||
|
extern Entity *initDoor(void);
|
||||||
|
extern Entity *initBronzeDoor(void);
|
||||||
|
extern Entity *initSilverDoor(void);
|
||||||
|
extern Entity *initGoldDoor(void);
|
||||||
|
extern Entity *initHorizontalDoor(void);
|
||||||
|
extern Entity *initMIA(void);
|
||||||
|
extern Entity *initItem(void);
|
||||||
|
extern Entity *initBronzeKey(void);
|
||||||
|
extern Entity *initSilverKey(void);
|
||||||
|
extern Entity *initGoldKey(void);
|
||||||
|
|
||||||
|
extern World world;
|
||||||
|
|
|
@ -22,8 +22,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
static int canFire(Entity *target);
|
static int canFire(Entity *target);
|
||||||
|
|
||||||
void initPistolBlob(Unit *u)
|
Entity *initPistolBlob(void)
|
||||||
{
|
{
|
||||||
|
Unit *u;
|
||||||
|
|
||||||
|
u = createUnit();
|
||||||
|
|
||||||
initEvilBlob(u);
|
initEvilBlob(u);
|
||||||
|
|
||||||
u->sprite[FACING_LEFT] = getSprite("PistolBlobLeft");
|
u->sprite[FACING_LEFT] = getSprite("PistolBlobLeft");
|
||||||
|
@ -35,9 +39,11 @@ void initPistolBlob(Unit *u)
|
||||||
u->maxShotsToFire = 3;
|
u->maxShotsToFire = 3;
|
||||||
|
|
||||||
u->canFire = canFire;
|
u->canFire = canFire;
|
||||||
|
|
||||||
|
return (Entity*)u;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int canFire(Entity *target)
|
static int canFire(Entity *target)
|
||||||
{
|
{
|
||||||
return true;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
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);
|
|
@ -20,20 +20,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "eyeDroid.h"
|
#include "eyeDroid.h"
|
||||||
|
|
||||||
|
static void walk(void);
|
||||||
|
static void die(void);
|
||||||
static void tick(void);
|
static void tick(void);
|
||||||
static void superTick(void);
|
static void touch(Entity *other);
|
||||||
static void touch(void);
|
static void (*superTick)(void);
|
||||||
static void superTouch(void);
|
static void (*superTouch)(Entity *other);
|
||||||
|
|
||||||
void initEyeDroid(void)
|
void initEyeDroid(Unit *u)
|
||||||
{
|
{
|
||||||
u->flags |= FL_WEIGHTLESS | FL_HALT_AT_EDGE | FL_EXPLODES;
|
u->flags |= EF_WEIGHTLESS | EF_HALT_AT_EDGE | EF_EXPLODES;
|
||||||
|
|
||||||
superTick = u->tick;
|
superTick = u->tick;
|
||||||
superTouch = u->touch;
|
superTouch = u->touch;
|
||||||
|
|
||||||
|
u->walk = walk;
|
||||||
u->tick = tick;
|
u->tick = tick;
|
||||||
u->touch = touch;
|
u->touch = touch;
|
||||||
|
u->die = die;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tick(void)
|
static void tick(void)
|
||||||
|
@ -57,7 +61,7 @@ static void touch(Entity *other)
|
||||||
|
|
||||||
u = (Unit*)self;
|
u = (Unit*)self;
|
||||||
|
|
||||||
superTouch();
|
superTouch(other);
|
||||||
|
|
||||||
if (u->alive == ALIVE_DYING && (other == NULL || other->isSolid))
|
if (u->alive == ALIVE_DYING && (other == NULL || other->isSolid))
|
||||||
{
|
{
|
||||||
|
@ -76,7 +80,9 @@ static void touch(Entity *other)
|
||||||
|
|
||||||
addRandomItems((int) u->x, (int) u->y);
|
addRandomItems((int) u->x, (int) u->y);
|
||||||
|
|
||||||
updateObjectives();
|
updateObjective(u->name);
|
||||||
|
updateObjective("ENEMY");
|
||||||
|
fireTriggers(u->name);
|
||||||
|
|
||||||
if (u->isMissionTarget)
|
if (u->isMissionTarget)
|
||||||
{
|
{
|
||||||
|
@ -94,7 +100,7 @@ static void touch(Entity *other)
|
||||||
|
|
||||||
static void unitDie(void)
|
static void unitDie(void)
|
||||||
{
|
{
|
||||||
if (self->environment != Environment.AIR)
|
if (self->environment != ENV_AIR)
|
||||||
{
|
{
|
||||||
touch(NULL);
|
touch(NULL);
|
||||||
}
|
}
|
||||||
|
@ -106,7 +112,7 @@ static void die(void)
|
||||||
|
|
||||||
u = (Unit*)self;
|
u = (Unit*)self;
|
||||||
|
|
||||||
u->dx = (fRand() - fRand()) * 3;
|
u->dx = (randF() - randF()) * 3;
|
||||||
|
|
||||||
u->spriteTime = 0;
|
u->spriteTime = 0;
|
||||||
u->spriteFrame = 0;
|
u->spriteFrame = 0;
|
||||||
|
@ -187,7 +193,7 @@ static void lookForPlayer(void)
|
||||||
|
|
||||||
u->thinkTime = rrnd(FPS / 2, FPS);
|
u->thinkTime = rrnd(FPS / 2, FPS);
|
||||||
|
|
||||||
if (world.state != WS_IN_PROGRESS || game.cheatBlind)
|
if (world.state != WS_IN_PROGRESS || dev.cheatBlind)
|
||||||
{
|
{
|
||||||
patrol();
|
patrol();
|
||||||
return;
|
return;
|
||||||
|
@ -207,23 +213,23 @@ static void lookForPlayer(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = fRand();
|
r = randF();
|
||||||
if (u->isMissionTarget)
|
if (u->isMissionTarget)
|
||||||
{
|
{
|
||||||
r = fRand() * 0.3;
|
r = randF() * 0.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r < 0.125)
|
if (r < 0.125)
|
||||||
{
|
{
|
||||||
chase();
|
chase();
|
||||||
u->shotsToFire = rrnd(1, u->maxShotsToFire);
|
u->shotsToFire = rrnd(1, u->maxShotsToFire);
|
||||||
u->action = preFire;
|
u->action = u->preFire;
|
||||||
}
|
}
|
||||||
else if (r < 0.25)
|
else if (r < 0.25)
|
||||||
{
|
{
|
||||||
u->dx = 0;
|
u->dx = 0;
|
||||||
u->shotsToFire = rrnd(1, u->maxShotsToFire);
|
u->shotsToFire = rrnd(1, u->maxShotsToFire);
|
||||||
u->action = preFire;
|
u->action = u->preFire;
|
||||||
}
|
}
|
||||||
else if (r < 0.5)
|
else if (r < 0.5)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
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 void dropCarriedItem(void);
|
||||||
|
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||||
|
extern double randF(void);
|
||||||
|
extern void throwFleshChunks(float x, float y, int amount);
|
||||||
|
extern void addRandomWeapon(float x, float y);
|
||||||
|
extern float limit(float i, float a, float b);
|
||||||
|
extern void playSound(int snd, int ch);
|
||||||
|
extern void addBloodDecal(int x, int y);
|
||||||
|
extern void updateObjective(char *targetName);
|
||||||
|
extern int enemyCanSeePlayer(Entity *e);
|
||||||
|
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 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 Dev dev;
|
||||||
|
extern Entity *self;
|
||||||
|
extern Game game;
|
||||||
|
extern World world;
|
|
@ -22,8 +22,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
static int canFire(Entity *target);
|
static int canFire(Entity *target);
|
||||||
|
|
||||||
void initPistolDroid(Unit *u)
|
Entity *initPistolDroid(void)
|
||||||
{
|
{
|
||||||
|
Unit *u;
|
||||||
|
|
||||||
|
u = createUnit();
|
||||||
|
|
||||||
|
initEyeDroid(u);
|
||||||
|
|
||||||
u->sprite[FACING_LEFT] = getSprite("PistolDroidLeft");
|
u->sprite[FACING_LEFT] = getSprite("PistolDroidLeft");
|
||||||
u->sprite[FACING_RIGHT] = getSprite("PistolDroidRight");
|
u->sprite[FACING_RIGHT] = getSprite("PistolDroidRight");
|
||||||
u->sprite[FACING_DIE] = getSprite("PistolDroidDie");
|
u->sprite[FACING_DIE] = getSprite("PistolDroidDie");
|
||||||
|
@ -33,9 +39,11 @@ void initPistolDroid(Unit *u)
|
||||||
u->maxShotsToFire = 3;
|
u->maxShotsToFire = 3;
|
||||||
|
|
||||||
u->canFire = canFire;
|
u->canFire = canFire;
|
||||||
|
|
||||||
|
return (Entity*)u;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int canFire(Entity *target)
|
static int canFire(Entity *target)
|
||||||
{
|
{
|
||||||
return true;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
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);
|
|
@ -22,13 +22,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
static void touch(Entity *other);
|
static void touch(Entity *other);
|
||||||
|
|
||||||
void initCell(Entity *e)
|
Entity *initCell(void)
|
||||||
{
|
{
|
||||||
Item *i;
|
Item *i;
|
||||||
|
|
||||||
initItem(e);
|
i = (Item*)createItem();
|
||||||
|
|
||||||
i = (Item*)self;
|
|
||||||
|
|
||||||
i->type = ET_HEART_CELL;
|
i->type = ET_HEART_CELL;
|
||||||
|
|
||||||
|
@ -42,6 +40,8 @@ void initCell(Entity *e)
|
||||||
i->spriteTime = -1;
|
i->spriteTime = -1;
|
||||||
|
|
||||||
i->touch = touch;
|
i->touch = touch;
|
||||||
|
|
||||||
|
return (Entity*)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void touch(Entity *other)
|
static void touch(Entity *other)
|
||||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "../../common.h"
|
#include "../../common.h"
|
||||||
|
|
||||||
extern void initItem(Entity *e);
|
extern Entity *createItem(void);
|
||||||
extern Sprite *getSprite(char *name);
|
extern Sprite *getSprite(char *name);
|
||||||
extern void setGameplayMessage(int type, char *format, ...);
|
extern void setGameplayMessage(int type, char *format, ...);
|
||||||
extern void playSound(int snd, int ch);
|
extern void playSound(int snd, int ch);
|
||||||
|
|
|
@ -23,13 +23,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
static void action(void);
|
static void action(void);
|
||||||
static void touch(Entity *other);
|
static void touch(Entity *other);
|
||||||
|
|
||||||
void initHeart(Entity *e)
|
Entity *initHeart(Entity *e)
|
||||||
{
|
{
|
||||||
Item *i;
|
Item *i;
|
||||||
|
|
||||||
initItem(e);
|
i = (Item*)createItem();
|
||||||
|
|
||||||
i = (Item*)e;
|
|
||||||
|
|
||||||
i->type = ET_HEART_CELL;
|
i->type = ET_HEART_CELL;
|
||||||
|
|
||||||
|
@ -44,6 +42,8 @@ void initHeart(Entity *e)
|
||||||
|
|
||||||
i->action = action;
|
i->action = action;
|
||||||
i->touch = touch;
|
i->touch = touch;
|
||||||
|
|
||||||
|
return (Entity*)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void action(void)
|
static void action(void)
|
||||||
|
|
|
@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
extern void playSound(int snd, int ch);
|
extern void playSound(int snd, int ch);
|
||||||
extern void setGameplayMessage(int type, char *format, ...);
|
extern void setGameplayMessage(int type, char *format, ...);
|
||||||
extern void initItem(Entity *e);
|
extern Entity *createItem(void);
|
||||||
extern Sprite *getSprite(char *name);
|
extern Sprite *getSprite(char *name);
|
||||||
extern void updateObjective(char *targetName);
|
extern void updateObjective(char *targetName);
|
||||||
extern int rrnd(int low, int high);
|
extern int rrnd(int low, int high);
|
||||||
|
|
|
@ -29,13 +29,16 @@ static void destructablePickupItem(Structure *s);
|
||||||
static void enemyPickupItem(Unit *u);
|
static void enemyPickupItem(Unit *u);
|
||||||
static void bobPickupItem(void);
|
static void bobPickupItem(void);
|
||||||
|
|
||||||
void initItem(Entity *e)
|
Entity *createItem(void)
|
||||||
{
|
{
|
||||||
Item *i;
|
Item *i;
|
||||||
|
|
||||||
initEntity(e);
|
i = malloc(sizeof(Item));
|
||||||
|
memset(i, 0, sizeof(Item));
|
||||||
|
world.entityTail->next = (Entity*)i;
|
||||||
|
world.entityTail = (Entity*)i;
|
||||||
|
|
||||||
i = (Item*)e;
|
initEntity((Entity*)i);
|
||||||
|
|
||||||
i->type = ET_ITEM;
|
i->type = ET_ITEM;
|
||||||
|
|
||||||
|
@ -55,6 +58,13 @@ void initItem(Entity *e)
|
||||||
i->changeEnvironment = changeEnvironment;
|
i->changeEnvironment = changeEnvironment;
|
||||||
i->reset = reset;
|
i->reset = reset;
|
||||||
i->die = die;
|
i->die = die;
|
||||||
|
|
||||||
|
return (Entity*)i;
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity *initItem(void)
|
||||||
|
{
|
||||||
|
return createItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void reset(void)
|
static void reset(void)
|
||||||
|
|
|
@ -20,44 +20,44 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "key.h"
|
#include "key.h"
|
||||||
|
|
||||||
void initBronzeKey(Entity *e)
|
Entity *initBronzeKey(Entity *e)
|
||||||
{
|
{
|
||||||
Item *i;
|
Item *i;
|
||||||
|
|
||||||
initItem(e);
|
i = (Item*)createItem();
|
||||||
|
|
||||||
i = (Item*)e;
|
|
||||||
|
|
||||||
i->type = ET_KEY;
|
i->type = ET_KEY;
|
||||||
|
|
||||||
STRNCPY(i->name, "Bronze Key", MAX_NAME_LENGTH);
|
STRNCPY(i->name, "Bronze Key", MAX_NAME_LENGTH);
|
||||||
STRNCPY(i->spriteName, "BronzeKey", MAX_NAME_LENGTH);
|
STRNCPY(i->spriteName, "BronzeKey", MAX_NAME_LENGTH);
|
||||||
|
|
||||||
|
return (Entity*)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initSilverKey(Entity *e)
|
Entity *initSilverKey(Entity *e)
|
||||||
{
|
{
|
||||||
Item *i;
|
Item *i;
|
||||||
|
|
||||||
initItem(e);
|
i = (Item*)createItem();
|
||||||
|
|
||||||
i = (Item*)e;
|
|
||||||
|
|
||||||
i->type = ET_KEY;
|
i->type = ET_KEY;
|
||||||
|
|
||||||
STRNCPY(i->name, "Silver Key", MAX_NAME_LENGTH);
|
STRNCPY(i->name, "Silver Key", MAX_NAME_LENGTH);
|
||||||
STRNCPY(i->spriteName, "SilverKey", MAX_NAME_LENGTH);
|
STRNCPY(i->spriteName, "SilverKey", MAX_NAME_LENGTH);
|
||||||
|
|
||||||
|
return (Entity*)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initGoldKey(Entity *e)
|
Entity *initGoldKey(Entity *e)
|
||||||
{
|
{
|
||||||
Item *i;
|
Item *i;
|
||||||
|
|
||||||
initItem(e);
|
i = (Item*)createItem();
|
||||||
|
|
||||||
i = (Item*)e;
|
|
||||||
|
|
||||||
i->type = ET_KEY;
|
i->type = ET_KEY;
|
||||||
|
|
||||||
STRNCPY(i->name, "Gold Key", MAX_NAME_LENGTH);
|
STRNCPY(i->name, "Gold Key", MAX_NAME_LENGTH);
|
||||||
STRNCPY(i->spriteName, "GoldKey", MAX_NAME_LENGTH);
|
STRNCPY(i->spriteName, "GoldKey", MAX_NAME_LENGTH);
|
||||||
|
|
||||||
|
return (Entity*)i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,4 +20,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "../../common.h"
|
#include "../../common.h"
|
||||||
|
|
||||||
extern void initItem(Entity *e);
|
extern Entity *createItem(void);
|
||||||
|
|
|
@ -23,69 +23,67 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
static void (*itemTouch)(Entity *other);
|
static void (*itemTouch)(Entity *other);
|
||||||
static void touchWhiteKeycard(Entity *other);
|
static void touchWhiteKeycard(Entity *other);
|
||||||
|
|
||||||
void initRedKeycard(Entity *e)
|
Entity *initRedKeycard(void)
|
||||||
{
|
{
|
||||||
Item *i;
|
Item *i;
|
||||||
|
|
||||||
initItem(e);
|
i = (Item*)createItem();
|
||||||
|
|
||||||
i = (Item*)e;
|
|
||||||
|
|
||||||
i->type = ET_KEY;
|
i->type = ET_KEY;
|
||||||
|
|
||||||
STRNCPY(i->name, "Red Keycard", MAX_NAME_LENGTH);
|
STRNCPY(i->name, "Red Keycard", MAX_NAME_LENGTH);
|
||||||
STRNCPY(i->spriteName, "RedKeycard", MAX_NAME_LENGTH);
|
STRNCPY(i->spriteName, "RedKeycard", MAX_NAME_LENGTH);
|
||||||
|
|
||||||
|
return (Entity*)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initBlueKeycard(Entity *e)
|
Entity *initBlueKeycard(void)
|
||||||
{
|
{
|
||||||
Item *i;
|
Item *i;
|
||||||
|
|
||||||
initItem(e);
|
i = (Item*)createItem();
|
||||||
|
|
||||||
i = (Item*)e;
|
|
||||||
|
|
||||||
i->type = ET_KEY;
|
i->type = ET_KEY;
|
||||||
|
|
||||||
STRNCPY(i->name, "Blue Keycard", MAX_NAME_LENGTH);
|
STRNCPY(i->name, "Blue Keycard", MAX_NAME_LENGTH);
|
||||||
STRNCPY(i->spriteName, "BlueKeycard", MAX_NAME_LENGTH);
|
STRNCPY(i->spriteName, "BlueKeycard", MAX_NAME_LENGTH);
|
||||||
|
|
||||||
|
return (Entity*)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initGreenKeycard(Entity *e)
|
Entity *initGreenKeycard(void)
|
||||||
{
|
{
|
||||||
Item *i;
|
Item *i;
|
||||||
|
|
||||||
initItem(e);
|
i = (Item*)createItem();
|
||||||
|
|
||||||
i = (Item*)e;
|
|
||||||
|
|
||||||
i->type = ET_KEY;
|
i->type = ET_KEY;
|
||||||
|
|
||||||
STRNCPY(i->name, "Green Keycard", MAX_NAME_LENGTH);
|
STRNCPY(i->name, "Green Keycard", MAX_NAME_LENGTH);
|
||||||
STRNCPY(i->spriteName, "GreenKeycard", MAX_NAME_LENGTH);
|
STRNCPY(i->spriteName, "GreenKeycard", MAX_NAME_LENGTH);
|
||||||
|
|
||||||
|
return (Entity*)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initYellowKeycard(Entity *e)
|
Entity *initYellowKeycard(void)
|
||||||
{
|
{
|
||||||
Item *i;
|
Item *i;
|
||||||
|
|
||||||
initItem(e);
|
i = (Item*)createItem();
|
||||||
|
|
||||||
i = (Item*)e;
|
|
||||||
|
|
||||||
i->type = ET_KEY;
|
i->type = ET_KEY;
|
||||||
|
|
||||||
STRNCPY(i->name, "Yellow Keycard", MAX_NAME_LENGTH);
|
STRNCPY(i->name, "Yellow Keycard", MAX_NAME_LENGTH);
|
||||||
STRNCPY(i->spriteName, "YellowKeycard", MAX_NAME_LENGTH);
|
STRNCPY(i->spriteName, "YellowKeycard", MAX_NAME_LENGTH);
|
||||||
|
|
||||||
|
return (Entity*)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initWhiteKeycard(Entity *e)
|
Entity *initWhiteKeycard(void)
|
||||||
{
|
{
|
||||||
Item *i;
|
Item *i;
|
||||||
|
|
||||||
initItem(e);
|
i = (Item*)createItem();
|
||||||
|
|
||||||
i = (Item*)e;
|
|
||||||
|
|
||||||
i->type = ET_KEY;
|
i->type = ET_KEY;
|
||||||
|
|
||||||
|
@ -95,6 +93,8 @@ void initWhiteKeycard(Entity *e)
|
||||||
itemTouch = i->touch;
|
itemTouch = i->touch;
|
||||||
|
|
||||||
i->touch = touchWhiteKeycard;
|
i->touch = touchWhiteKeycard;
|
||||||
|
|
||||||
|
return (Entity*)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void touchWhiteKeycard(Entity *other)
|
static void touchWhiteKeycard(Entity *other)
|
||||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "../../common.h"
|
#include "../../common.h"
|
||||||
|
|
||||||
extern void initItem(Entity *e);
|
extern Entity *createItem(void);
|
||||||
extern void updateObjective(char *targetName);
|
extern void updateObjective(char *targetName);
|
||||||
extern void teekaExitMission(void);
|
extern void teekaExitMission(void);
|
||||||
|
|
||||||
|
|
|
@ -23,13 +23,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
static void tick(void);
|
static void tick(void);
|
||||||
static void touch(Entity *other);
|
static void touch(Entity *other);
|
||||||
|
|
||||||
void initInfoPoint(Entity *e)
|
Entity *initInfoPoint(void)
|
||||||
{
|
{
|
||||||
Structure *s;
|
Structure *s;
|
||||||
|
|
||||||
initEntity(e);
|
s = createStructure();
|
||||||
|
|
||||||
s = (Structure*)e;
|
|
||||||
|
|
||||||
s->type = ET_INFO_POINT;
|
s->type = ET_INFO_POINT;
|
||||||
|
|
||||||
|
@ -43,6 +41,8 @@ void initInfoPoint(Entity *e)
|
||||||
|
|
||||||
s->tick = tick;
|
s->tick = tick;
|
||||||
s->touch = touch;
|
s->touch = touch;
|
||||||
|
|
||||||
|
return (Entity*)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tick(void)
|
static void tick(void)
|
||||||
|
|
|
@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "../../common.h"
|
#include "../../common.h"
|
||||||
|
|
||||||
extern Sprite *getSprite(char *name);
|
extern Sprite *getSprite(char *name);
|
||||||
extern void initEntity(Entity *e);
|
|
||||||
extern void showInfoMessage(char *message);
|
extern void showInfoMessage(char *message);
|
||||||
|
extern Structure *createStructure(void);
|
||||||
|
|
||||||
extern Entity *self;
|
extern Entity *self;
|
||||||
extern World world;
|
extern World world;
|
||||||
|
|
|
@ -27,13 +27,11 @@ static int isClosed(void);
|
||||||
static int isOpening(void);
|
static int isOpening(void);
|
||||||
static int isClosing(void);
|
static int isClosing(void);
|
||||||
|
|
||||||
void initDoor(Entity *e)
|
Entity *initDoor(void)
|
||||||
{
|
{
|
||||||
Structure *s;
|
Structure *s;
|
||||||
|
|
||||||
initEntity(e);
|
s = createStructure();
|
||||||
|
|
||||||
s = (Structure*)e;
|
|
||||||
|
|
||||||
s->type = ET_DOOR;
|
s->type = ET_DOOR;
|
||||||
|
|
||||||
|
@ -59,51 +57,53 @@ void initDoor(Entity *e)
|
||||||
|
|
||||||
s->tick = tick;
|
s->tick = tick;
|
||||||
s->touch = touch;
|
s->touch = touch;
|
||||||
|
|
||||||
|
return (Entity*)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initBronzeDoor(Entity *e)
|
Entity *initBronzeDoor(void)
|
||||||
{
|
{
|
||||||
Structure *s;
|
Structure *s;
|
||||||
|
|
||||||
initDoor(e);
|
s = (Structure*)initDoor();
|
||||||
|
|
||||||
s = (Structure*)e;
|
|
||||||
|
|
||||||
STRNCPY(s->requiredItem, "Bronze Key", MAX_NAME_LENGTH);
|
STRNCPY(s->requiredItem, "Bronze Key", MAX_NAME_LENGTH);
|
||||||
|
|
||||||
s->speed = 2;
|
s->speed = 2;
|
||||||
|
|
||||||
s->sprite[0] = s->sprite[1] = s->sprite[2] = getSprite("BronzeDoor");
|
s->sprite[0] = s->sprite[1] = s->sprite[2] = getSprite("BronzeDoor");
|
||||||
|
|
||||||
|
return (Entity*)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initSilverDoor(Entity *e)
|
Entity *initSilverDoor(void)
|
||||||
{
|
{
|
||||||
Structure *s;
|
Structure *s;
|
||||||
|
|
||||||
initDoor(e);
|
s = (Structure*)initDoor();
|
||||||
|
|
||||||
s = (Structure*)e;
|
|
||||||
|
|
||||||
STRNCPY(s->requiredItem, "Silver Key", MAX_NAME_LENGTH);
|
STRNCPY(s->requiredItem, "Silver Key", MAX_NAME_LENGTH);
|
||||||
|
|
||||||
s->speed = 2;
|
s->speed = 2;
|
||||||
|
|
||||||
s->sprite[0] = s->sprite[1] = s->sprite[2] = getSprite("SilverDoor");
|
s->sprite[0] = s->sprite[1] = s->sprite[2] = getSprite("SilverDoor");
|
||||||
|
|
||||||
|
return (Entity*)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initGoldDoor(Entity *e)
|
Entity *initGoldDoor(void)
|
||||||
{
|
{
|
||||||
Structure *s;
|
Structure *s;
|
||||||
|
|
||||||
initDoor(e);
|
s = (Structure*)initDoor();
|
||||||
|
|
||||||
s = (Structure*)e;
|
|
||||||
|
|
||||||
STRNCPY(s->requiredItem, "Gold Key", MAX_NAME_LENGTH);
|
STRNCPY(s->requiredItem, "Gold Key", MAX_NAME_LENGTH);
|
||||||
|
|
||||||
s->speed = 2;
|
s->speed = 2;
|
||||||
|
|
||||||
s->sprite[0] = s->sprite[1] = e->sprite[2] = getSprite("GoldDoor");
|
s->sprite[0] = s->sprite[1] = s->sprite[2] = getSprite("GoldDoor");
|
||||||
|
|
||||||
|
return (Entity*)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tick(void)
|
static void tick(void)
|
||||||
|
|
|
@ -27,6 +27,7 @@ extern void getSlope(int x1, int y1, int x2, int y2, float *dx, float *dy);
|
||||||
extern void setGameplayMessage(int type, char *format, ...);
|
extern void setGameplayMessage(int type, char *format, ...);
|
||||||
extern int hasItem(char *name);
|
extern int hasItem(char *name);
|
||||||
extern void removeItem(char *name);
|
extern void removeItem(char *name);
|
||||||
|
extern Structure *createStructure(void);
|
||||||
|
|
||||||
extern Entity *self;
|
extern Entity *self;
|
||||||
extern Dev dev;
|
extern Dev dev;
|
||||||
|
|
|
@ -25,7 +25,7 @@ static void action(void);
|
||||||
static void touch(Entity *other);
|
static void touch(Entity *other);
|
||||||
static SDL_Rect *getBounds(void);
|
static SDL_Rect *getBounds(void);
|
||||||
|
|
||||||
void initExit(void)
|
Entity *initExit(void)
|
||||||
{
|
{
|
||||||
Structure *s;
|
Structure *s;
|
||||||
|
|
||||||
|
@ -56,6 +56,8 @@ void initExit(void)
|
||||||
s->action = action;
|
s->action = action;
|
||||||
s->touch = touch;
|
s->touch = touch;
|
||||||
s->getBounds = getBounds;
|
s->getBounds = getBounds;
|
||||||
|
|
||||||
|
return (Entity*)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tick(void)
|
static void tick(void)
|
||||||
|
|
|
@ -20,32 +20,48 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "horizontalDoor.h"
|
#include "horizontalDoor.h"
|
||||||
|
|
||||||
void initHorizontalDoor(Entity *e)
|
Entity *initHorizontalDoor(void)
|
||||||
{
|
{
|
||||||
initDoor(e);
|
Structure *s;
|
||||||
|
|
||||||
e->type = ET_DOOR;
|
s = createStructure();
|
||||||
|
|
||||||
e->sprite[0] = e->sprite[1] = e->sprite[2] = getSprite("HorizonalDoor");
|
s->type = ET_DOOR;
|
||||||
|
|
||||||
|
s->sprite[0] = s->sprite[1] = s->sprite[2] = getSprite("HorizonalDoor");
|
||||||
|
|
||||||
|
return (Entity*)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initBronzeHorizontalDoor(Entity *e)
|
Entity *initBronzeHorizontalDoor(void)
|
||||||
{
|
{
|
||||||
initHorizontalDoor(e);
|
Structure *s;
|
||||||
|
|
||||||
STRNCPY(((Structure*)e)->requiredItem, "Bronze Key", MAX_NAME_LENGTH);
|
s = (Structure*)initHorizontalDoor();
|
||||||
|
|
||||||
|
STRNCPY(s->requiredItem, "Bronze Key", MAX_NAME_LENGTH);
|
||||||
|
|
||||||
|
return (Entity*)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initSilverHorizontalDoor(Entity *e)
|
Entity *initSilverHorizontalDoor(void)
|
||||||
{
|
{
|
||||||
initHorizontalDoor(e);
|
Structure *s;
|
||||||
|
|
||||||
STRNCPY(((Structure*)e)->requiredItem, "Silver Key", MAX_NAME_LENGTH);
|
s = (Structure*)initHorizontalDoor();
|
||||||
|
|
||||||
|
STRNCPY(s->requiredItem, "Silver Key", MAX_NAME_LENGTH);
|
||||||
|
|
||||||
|
return (Entity*)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initGoldHorizontalDoor(Entity *e)
|
Entity *initGoldHorizontalDoor(void)
|
||||||
{
|
{
|
||||||
initHorizontalDoor(e);
|
Structure *s;
|
||||||
|
|
||||||
STRNCPY(((Structure*)e)->requiredItem, "Gold Key", MAX_NAME_LENGTH);
|
s = (Structure*)initHorizontalDoor();
|
||||||
|
|
||||||
|
STRNCPY(s->requiredItem, "Gold Key", MAX_NAME_LENGTH);
|
||||||
|
|
||||||
|
return (Entity*)s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,3 +22,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
extern void initDoor(Entity *e);
|
extern void initDoor(Entity *e);
|
||||||
extern Sprite *getSprite(char *name);
|
extern Sprite *getSprite(char *name);
|
||||||
|
extern Structure *createStructure(void);
|
||||||
|
|
|
@ -23,13 +23,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
static void action(void);
|
static void action(void);
|
||||||
static void activate(int active);
|
static void activate(int active);
|
||||||
|
|
||||||
void initLift(Entity *e)
|
Entity *initLift(Entity *e)
|
||||||
{
|
{
|
||||||
Structure *s;
|
Structure *s;
|
||||||
|
|
||||||
initEntity(e);
|
s = createStructure();
|
||||||
|
|
||||||
s = (Structure*)e;
|
|
||||||
|
|
||||||
s->type = ET_LIFT;
|
s->type = ET_LIFT;
|
||||||
|
|
||||||
|
@ -49,6 +47,8 @@ void initLift(Entity *e)
|
||||||
|
|
||||||
s->action = action;
|
s->action = action;
|
||||||
s->activate = activate;
|
s->activate = activate;
|
||||||
|
|
||||||
|
return (Entity*)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void action(void)
|
static void action(void)
|
||||||
|
|
|
@ -20,11 +20,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "../../common.h"
|
#include "../../common.h"
|
||||||
|
|
||||||
extern void initEntity(Entity *e);
|
|
||||||
extern Sprite *getSprite(char *name);
|
extern Sprite *getSprite(char *name);
|
||||||
extern void getSlope(int x1, int y1, int x2, int y2, float *dx, float *dy);
|
extern void getSlope(int x1, int y1, int x2, int y2, float *dx, float *dy);
|
||||||
extern void observeActivation(Entity *e);
|
extern void observeActivation(Entity *e);
|
||||||
extern int isOnScreen(Entity *e);
|
extern int isOnScreen(Entity *e);
|
||||||
extern void setGameplayMessage(int type, char *format, ...);
|
extern void setGameplayMessage(int type, char *format, ...);
|
||||||
|
extern Structure *createStructure(void);
|
||||||
|
|
||||||
extern Entity *self;
|
extern Entity *self;
|
||||||
|
|
|
@ -24,13 +24,11 @@ static void tick(void);
|
||||||
static void action(void);
|
static void action(void);
|
||||||
static void touch(Entity *other);
|
static void touch(Entity *other);
|
||||||
|
|
||||||
void initPowerPoint(Entity *e)
|
Entity *initPowerPoint(void)
|
||||||
{
|
{
|
||||||
Structure *s;
|
Structure *s;
|
||||||
|
|
||||||
initEntity(e);
|
s = createStructure();
|
||||||
|
|
||||||
s = (Structure*)e;
|
|
||||||
|
|
||||||
s->type = ET_POWER_POINT;
|
s->type = ET_POWER_POINT;
|
||||||
|
|
||||||
|
@ -45,6 +43,8 @@ void initPowerPoint(Entity *e)
|
||||||
s->tick = tick;
|
s->tick = tick;
|
||||||
s->action = action;
|
s->action = action;
|
||||||
s->touch = touch;
|
s->touch = touch;
|
||||||
|
|
||||||
|
return (Entity*)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tick(void)
|
static void tick(void)
|
||||||
|
|
|
@ -20,10 +20,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "../../common.h"
|
#include "../../common.h"
|
||||||
|
|
||||||
extern void initEntity(Entity *e);
|
|
||||||
extern Sprite *getSprite(char *name);
|
extern Sprite *getSprite(char *name);
|
||||||
extern void activateEntities(char *names, int activate);
|
extern void activateEntities(char *names, int activate);
|
||||||
extern void setGameplayMessage(int type, char *format, ...);
|
extern void setGameplayMessage(int type, char *format, ...);
|
||||||
|
extern Structure *createStructure(void);
|
||||||
|
|
||||||
extern Dev dev;
|
extern Dev dev;
|
||||||
extern Entity *self;
|
extern Entity *self;
|
||||||
|
|
|
@ -24,13 +24,11 @@ static void tick(void);
|
||||||
static void action(void);
|
static void action(void);
|
||||||
static void touch(Entity *other);
|
static void touch(Entity *other);
|
||||||
|
|
||||||
void initPowerPool(Entity *e)
|
Entity *initPowerPool(void)
|
||||||
{
|
{
|
||||||
Structure *s;
|
Structure *s;
|
||||||
|
|
||||||
initEntity(e);
|
s = createStructure();
|
||||||
|
|
||||||
s = (Structure*)e;
|
|
||||||
|
|
||||||
s->type = ET_POOL;
|
s->type = ET_POOL;
|
||||||
|
|
||||||
|
@ -45,6 +43,8 @@ void initPowerPool(Entity *e)
|
||||||
s->tick = tick;
|
s->tick = tick;
|
||||||
s->action = action;
|
s->action = action;
|
||||||
s->touch = touch;
|
s->touch = touch;
|
||||||
|
|
||||||
|
return (Entity*)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tick(void)
|
static void tick(void)
|
||||||
|
|
|
@ -20,8 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "../../common.h"
|
#include "../../common.h"
|
||||||
|
|
||||||
|
extern Structure *createStructure(void);
|
||||||
extern Sprite *getSprite(char *name);
|
extern Sprite *getSprite(char *name);
|
||||||
extern void initEntity(Entity *e);
|
|
||||||
|
|
||||||
extern Entity *self;
|
extern Entity *self;
|
||||||
extern World world;
|
extern World world;
|
||||||
|
|
|
@ -23,13 +23,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
static void tick(void);
|
static void tick(void);
|
||||||
static void touch(Entity *other);
|
static void touch(Entity *other);
|
||||||
|
|
||||||
void initPressurePlate(Entity *e)
|
Entity *initPressurePlate(void)
|
||||||
{
|
{
|
||||||
Structure *s;
|
Structure *s;
|
||||||
|
|
||||||
initEntity(e);
|
s = createStructure();
|
||||||
|
|
||||||
s = (Structure*)e;
|
|
||||||
|
|
||||||
s->type = ET_PRESSURE_PLATE;
|
s->type = ET_PRESSURE_PLATE;
|
||||||
|
|
||||||
|
@ -43,6 +41,8 @@ void initPressurePlate(Entity *e)
|
||||||
|
|
||||||
s->tick = tick;
|
s->tick = tick;
|
||||||
s->touch = touch;
|
s->touch = touch;
|
||||||
|
|
||||||
|
return (Entity*)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tick(void)
|
static void tick(void)
|
||||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "../../common.h"
|
#include "../../common.h"
|
||||||
|
|
||||||
extern void initEntity(Entity *e);
|
extern Structure *createStructure(void);
|
||||||
extern Sprite *getSprite(char *name);
|
extern Sprite *getSprite(char *name);
|
||||||
extern void activateEntities(char *names, int activate);
|
extern void activateEntities(char *names, int activate);
|
||||||
extern void playSound(int snd, int ch);
|
extern void playSound(int snd, int ch);
|
||||||
|
|
|
@ -22,13 +22,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
static void activate(int active);
|
static void activate(int active);
|
||||||
|
|
||||||
void initPushBlock(Entity *e)
|
Entity *initPushBlock(void)
|
||||||
{
|
{
|
||||||
Structure *s;
|
Structure *s;
|
||||||
|
|
||||||
initEntity(e);
|
s = createStructure();
|
||||||
|
|
||||||
s = (Structure*)e;
|
|
||||||
|
|
||||||
s->type = ET_PUSHBLOCK;
|
s->type = ET_PUSHBLOCK;
|
||||||
|
|
||||||
|
@ -39,6 +37,8 @@ void initPushBlock(Entity *e)
|
||||||
s->flags |= EF_EXPLODES | EF_ALWAYS_PROCESS;
|
s->flags |= EF_EXPLODES | EF_ALWAYS_PROCESS;
|
||||||
|
|
||||||
s->activate = activate;
|
s->activate = activate;
|
||||||
|
|
||||||
|
return (Entity*)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void activate(int active)
|
static void activate(int active)
|
||||||
|
|
|
@ -20,8 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "../../common.h"
|
#include "../../common.h"
|
||||||
|
|
||||||
extern void initEntity(Entity *e);
|
|
||||||
extern void playSound(int snd, int ch);
|
extern void playSound(int snd, int ch);
|
||||||
extern void addTeleportStars(Entity *e);
|
extern void addTeleportStars(Entity *e);
|
||||||
|
extern Structure *createStructure(void);
|
||||||
|
|
||||||
extern Entity *self;
|
extern Entity *self;
|
||||||
|
|
|
@ -29,5 +29,7 @@ Structure *createStructure(void)
|
||||||
world.entityTail->next = (Entity*)s;
|
world.entityTail->next = (Entity*)s;
|
||||||
world.entityTail = (Entity*)s;
|
world.entityTail = (Entity*)s;
|
||||||
|
|
||||||
|
initEntity((Entity*)s);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "../../common.h"
|
#include "../../common.h"
|
||||||
|
|
||||||
extern Structure *createStructure(void);
|
extern void initEntity(Entity *e);
|
||||||
|
|
||||||
extern World world;
|
extern World world;
|
||||||
|
|
|
@ -24,23 +24,27 @@ static void action(void);
|
||||||
static void touch(Entity *other);
|
static void touch(Entity *other);
|
||||||
static void activate(int active);
|
static void activate(int active);
|
||||||
|
|
||||||
void initTeleporter(Entity *e)
|
Entity *initTeleporter(void)
|
||||||
{
|
{
|
||||||
initEntity(e);
|
Structure *s;
|
||||||
|
|
||||||
e->type = ET_TELEPORTER;
|
s = createStructure();
|
||||||
|
|
||||||
e->flags |= EF_WEIGHTLESS | EF_NO_CLIP | EF_IGNORE_BULLETS | EF_NO_TELEPORT;
|
s->type = ET_TELEPORTER;
|
||||||
|
|
||||||
e->plane = PLANE_FOREGROUND;
|
|
||||||
|
|
||||||
e->isStatic = 1;
|
|
||||||
|
|
||||||
e->active = 1;
|
|
||||||
|
|
||||||
e->action = action;
|
s->flags |= EF_WEIGHTLESS | EF_NO_CLIP | EF_IGNORE_BULLETS | EF_NO_TELEPORT;
|
||||||
e->touch = touch;
|
|
||||||
e->activate = activate;
|
s->plane = PLANE_FOREGROUND;
|
||||||
|
|
||||||
|
s->isStatic = 1;
|
||||||
|
|
||||||
|
s->active = 1;
|
||||||
|
|
||||||
|
s->action = action;
|
||||||
|
s->touch = touch;
|
||||||
|
s->activate = activate;
|
||||||
|
|
||||||
|
return (Entity*)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void action(void)
|
static void action(void)
|
||||||
|
|
|
@ -20,12 +20,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "../../common.h"
|
#include "../../common.h"
|
||||||
|
|
||||||
extern void initEntity(Entity *e);
|
|
||||||
extern void playSound(int snd, int ch);
|
extern void playSound(int snd, int ch);
|
||||||
extern void addTeleporterEffect(float x, float y);
|
extern void addTeleporterEffect(float x, float y);
|
||||||
extern void teleportEntity(Entity *e, float tx, float ty);
|
extern void teleportEntity(Entity *e, float tx, float ty);
|
||||||
extern void observeActivation(Entity *e);
|
extern void observeActivation(Entity *e);
|
||||||
extern int isOnScreen(Entity *e);
|
extern int isOnScreen(Entity *e);
|
||||||
extern void setGameplayMessage(int type, char *format, ...);
|
extern void setGameplayMessage(int type, char *format, ...);
|
||||||
|
extern Structure *createStructure(void);
|
||||||
|
|
||||||
extern Entity *self;
|
extern Entity *self;
|
||||||
|
|
|
@ -95,7 +95,6 @@ struct Lookup {
|
||||||
|
|
||||||
struct EntityDef {
|
struct EntityDef {
|
||||||
char name[MAX_NAME_LENGTH];
|
char name[MAX_NAME_LENGTH];
|
||||||
int type;
|
|
||||||
Entity *(*initFunc)(void);
|
Entity *(*initFunc)(void);
|
||||||
EntityDef *next;
|
EntityDef *next;
|
||||||
};
|
};
|
||||||
|
|
|
@ -40,7 +40,7 @@ void initAtlasTest(void)
|
||||||
|
|
||||||
loadMapData("data/maps/raw/beachApproach.raw");
|
loadMapData("data/maps/raw/beachApproach.raw");
|
||||||
|
|
||||||
loadWorld("data/maps/underground2.json");
|
loadWorld("data/maps/beachApproach.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void logic(void)
|
static void logic(void)
|
||||||
|
|
|
@ -75,3 +75,8 @@ void throwFleshChunks(float x, float y, int amount)
|
||||||
chunk->sprite[0] = chunk->sprite[1] = chunk->sprite[2] = fleshChunk[i % 3];
|
chunk->sprite[0] = chunk->sprite[1] = chunk->sprite[2] = fleshChunk[i % 3];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void throwDebris(float x, float y, int amount)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "../common.h"
|
#include "../common.h"
|
||||||
|
|
||||||
extern Sprite *getSprite(char *name);
|
extern Sprite *getSprite(char *name);
|
||||||
extern float wrap(float value, float low, float high);
|
|
||||||
extern int rrnd(int low, int high);
|
extern int rrnd(int low, int high);
|
||||||
extern double randF(void);
|
extern double randF(void);
|
||||||
extern int getDistance(int x1, int y1, int x2, int y2);
|
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||||
|
|
Loading…
Reference in New Issue