Added Blue, Red, and Yellow keycards. Added CardReader.
This commit is contained in:
parent
d8c9337a2e
commit
76dda670bf
|
@ -49,6 +49,9 @@ void initEntityFactory(void)
|
|||
addEntityDef("SilverKey", initSilverKey);
|
||||
addEntityDef("GoldKey", initGoldKey);
|
||||
addEntityDef("GreenKeycard", initGreenKeycard);
|
||||
addEntityDef("BlueKeycard", initBlueKeycard);
|
||||
addEntityDef("RedKeycard", initRedKeycard);
|
||||
addEntityDef("YellowKeycard", initYellowKeycard);
|
||||
|
||||
addEntityDef("Cell", initCell);
|
||||
addEntityDef("Heart", initHeart);
|
||||
|
@ -66,6 +69,7 @@ void initEntityFactory(void)
|
|||
addEntityDef("SilverDoor", initSilverDoor);
|
||||
addEntityDef("GoldDoor", initGoldDoor);
|
||||
addEntityDef("HorizontalDoor", initHorizontalDoor);
|
||||
addEntityDef("CardReader", initCardReader);
|
||||
}
|
||||
|
||||
Entity *createEntity(char *name)
|
||||
|
@ -76,6 +80,7 @@ Entity *createEntity(char *name)
|
|||
{
|
||||
if (strcmp(def->name, name) == 0)
|
||||
{
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "Creating '%s'", name);
|
||||
return def->initFunc();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,5 +48,9 @@ extern Entity *initGoldKey(void);
|
|||
extern Entity *initCell(void);
|
||||
extern Entity *initHeart(void);
|
||||
extern Entity *initGreenKeycard(void);
|
||||
extern Entity *initCardReader(void);
|
||||
extern Entity *initBlueKeycard(void);
|
||||
extern Entity *initRedKeycard(void);
|
||||
extern Entity *initYellowKeycard(void);
|
||||
|
||||
extern World world;
|
||||
|
|
|
@ -20,18 +20,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "cardReader.h"
|
||||
|
||||
static void init(void);
|
||||
static void tick(void);
|
||||
static void touch(Entity *other);
|
||||
static void load(cJSON *root);
|
||||
static void save(cJSON *root);
|
||||
|
||||
void initCardReader(Entity *e)
|
||||
Entity *initCardReader(void)
|
||||
{
|
||||
Structure *s;
|
||||
|
||||
initEntity(e);
|
||||
|
||||
s = (Structure*)e;
|
||||
s = createStructure();
|
||||
|
||||
s->type = ET_CARD_READER;
|
||||
|
||||
|
@ -41,6 +40,21 @@ void initCardReader(Entity *e)
|
|||
|
||||
s->isStatic = 1;
|
||||
|
||||
s->tick = tick;
|
||||
s->init = init;
|
||||
s->touch = touch;
|
||||
s->load = load;
|
||||
s->save = save;
|
||||
|
||||
return (Entity*)s;
|
||||
}
|
||||
|
||||
static void init(void)
|
||||
{
|
||||
Structure *s;
|
||||
|
||||
s = (Structure*)self;
|
||||
|
||||
if (!s->active)
|
||||
{
|
||||
s->sprite[FACING_LEFT] = s->sprite[FACING_RIGHT] = s->sprite[FACING_DIE] = getSprite("CardReaderIdle");
|
||||
|
@ -49,11 +63,6 @@ void initCardReader(Entity *e)
|
|||
{
|
||||
s->sprite[FACING_LEFT] = s->sprite[FACING_RIGHT] = s->sprite[FACING_DIE] = getSprite("CardReader");
|
||||
}
|
||||
|
||||
s->tick = tick;
|
||||
s->touch = touch;
|
||||
s->load = load;
|
||||
s->save = save;
|
||||
}
|
||||
|
||||
static void tick(void)
|
||||
|
|
|
@ -28,6 +28,7 @@ extern int hasItem(char *name);
|
|||
extern void setGameplayMessage(int type, char *format, ...);
|
||||
extern void activateEntities(char *names, int activate);
|
||||
extern void playSound(int snd, int ch);
|
||||
extern Structure *createStructure(void);
|
||||
|
||||
extern Dev dev;
|
||||
extern Entity *self;
|
||||
|
|
Loading…
Reference in New Issue