diff --git a/src/defs.h b/src/defs.h index 5164ce1..c9e7418 100644 --- a/src/defs.h +++ b/src/defs.h @@ -87,6 +87,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. enum { + ET_NONE, ET_EFFECT, ET_TRAP, ET_BOB, diff --git a/src/world/entities/blobs/bob.c b/src/world/entities/blobs/bob.c index 633a2b2..0a14cf6 100644 --- a/src/world/entities/blobs/bob.c +++ b/src/world/entities/blobs/bob.c @@ -20,6 +20,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "bob.h" +void initBob(Entity *e) +{ + e->type = ET_BOB; +} + void addBobItem(Item *i) { diff --git a/src/world/entities/blobs/mia.c b/src/world/entities/blobs/mia.c index 77be9b5..3a03b82 100644 --- a/src/world/entities/blobs/mia.c +++ b/src/world/entities/blobs/mia.c @@ -34,6 +34,8 @@ void initMIA(Entity *e) m = (MIA*)e; + m->type = ET_MIA; + m->tx = m->ty = -1; m->sprite[FACING_LEFT] = getSpriteIndex("MIA"); diff --git a/src/world/entities/boss/boss.c b/src/world/entities/boss/boss.c index 8df2d28..6453ffb 100644 --- a/src/world/entities/boss/boss.c +++ b/src/world/entities/boss/boss.c @@ -28,6 +28,8 @@ void initBoss(Entity *e) b = (Boss*)e; + b->type = ET_BOSS; + b->sprite[FACING_LEFT] = b->sprite[FACING_RIGHT] = b->sprite[FACING_DIE] = getSpriteIndex("Boss"); b->isMissionTarget = 1; diff --git a/src/world/entities/cannons/cannon.c b/src/world/entities/cannons/cannon.c index f4798da..22319ef 100644 --- a/src/world/entities/cannons/cannon.c +++ b/src/world/entities/cannons/cannon.c @@ -35,6 +35,8 @@ void initCannon(Entity *e) initUnit(e); u = (Unit*)self; + + u->type = ET_ENEMY; u->sprite[FACING_LEFT] = getSpriteIndex("CannonLeft"); u->sprite[FACING_RIGHT] = getSpriteIndex("CannonRight"); diff --git a/src/world/entities/decoration/debris.c b/src/world/entities/decoration/debris.c index 47ba65a..4c23be9 100644 --- a/src/world/entities/decoration/debris.c +++ b/src/world/entities/decoration/debris.c @@ -32,6 +32,8 @@ void initDebris(Entity *e) d = (Decoration*)self; + d->type = ET_DECORATION; + d->effectType = rand() % 2; d->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_NO_TELEPORT; diff --git a/src/world/entities/decoration/fleshChunk.c b/src/world/entities/decoration/fleshChunk.c index 93860b3..b57d4bc 100644 --- a/src/world/entities/decoration/fleshChunk.c +++ b/src/world/entities/decoration/fleshChunk.c @@ -31,6 +31,8 @@ void initFleshChunk(Entity *e) initEntity(e); d = (Decoration*)e; + + d->type = ET_DECORATION; d->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_NO_TELEPORT; diff --git a/src/world/entities/items/cell.c b/src/world/entities/items/cell.c index 84f75a9..2e6a85f 100644 --- a/src/world/entities/items/cell.c +++ b/src/world/entities/items/cell.c @@ -29,6 +29,8 @@ void initCell(Entity *e) initItem(e); i = (Item*)self; + + i->type = ET_HEART_CELL; i->isMissionTarget = 1; diff --git a/src/world/entities/items/consumable.c b/src/world/entities/items/consumable.c index 0c8b086..dcd3590 100644 --- a/src/world/entities/items/consumable.c +++ b/src/world/entities/items/consumable.c @@ -25,6 +25,10 @@ static void die(void); void initConsumable(Entity *e) { + initEntity(e); + + e->type = ET_CONSUMABLE; + e->flags |= EF_IGNORE_BULLETS; e->health = FPS * 10; diff --git a/src/world/entities/items/consumable.h b/src/world/entities/items/consumable.h index b3d6e4f..6047b3b 100644 --- a/src/world/entities/items/consumable.h +++ b/src/world/entities/items/consumable.h @@ -20,4 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../../../common.h" +extern void initEntity(Entity *e); + extern Entity *self; diff --git a/src/world/entities/items/heart.c b/src/world/entities/items/heart.c index 413f84a..09d78fa 100644 --- a/src/world/entities/items/heart.c +++ b/src/world/entities/items/heart.c @@ -30,6 +30,8 @@ void initHeart(Entity *e) initItem(e); i = (Item*)e; + + i->type = ET_HEART_CELL; i->isMissionTarget = 1; diff --git a/src/world/entities/items/item.c b/src/world/entities/items/item.c index fe387f4..68719b5 100644 --- a/src/world/entities/items/item.c +++ b/src/world/entities/items/item.c @@ -36,6 +36,8 @@ void initItem(Entity *e) initEntity(e); i = (Item*)e; + + i->type = ET_ITEM; STRNCPY(i->spriteName, "Weapon", MAX_NAME_LENGTH); diff --git a/src/world/entities/items/key.c b/src/world/entities/items/key.c index 7bc4cbe..01c5d33 100644 --- a/src/world/entities/items/key.c +++ b/src/world/entities/items/key.c @@ -27,6 +27,8 @@ void initBronzeKey(Entity *e) initItem(e); i = (Item*)e; + + i->type = ET_KEY; STRNCPY(i->name, "Bronze Key", MAX_NAME_LENGTH); STRNCPY(i->spriteName, "BronzeKey", MAX_NAME_LENGTH); @@ -39,6 +41,8 @@ void initSilverKey(Entity *e) initItem(e); i = (Item*)e; + + i->type = ET_KEY; STRNCPY(i->name, "Silver Key", MAX_NAME_LENGTH); STRNCPY(i->spriteName, "SilverKey", MAX_NAME_LENGTH); @@ -51,6 +55,8 @@ void initGoldKey(Entity *e) initItem(e); i = (Item*)e; + + i->type = ET_KEY; STRNCPY(i->name, "Gold Key", MAX_NAME_LENGTH); STRNCPY(i->spriteName, "GoldKey", MAX_NAME_LENGTH); diff --git a/src/world/entities/items/keycard.c b/src/world/entities/items/keycard.c index fa19c49..081ad13 100644 --- a/src/world/entities/items/keycard.c +++ b/src/world/entities/items/keycard.c @@ -30,6 +30,8 @@ void initRedKeycard(Entity *e) initItem(e); i = (Item*)e; + + i->type = ET_KEY; STRNCPY(i->name, "Red Keycard", MAX_NAME_LENGTH); STRNCPY(i->spriteName, "RedKeycard", MAX_NAME_LENGTH); @@ -42,6 +44,8 @@ void initBlueKeycard(Entity *e) initItem(e); i = (Item*)e; + + i->type = ET_KEY; STRNCPY(i->name, "Blue Keycard", MAX_NAME_LENGTH); STRNCPY(i->spriteName, "BlueKeycard", MAX_NAME_LENGTH); @@ -54,6 +58,8 @@ void initGreenKeycard(Entity *e) initItem(e); i = (Item*)e; + + i->type = ET_KEY; STRNCPY(i->name, "Green Keycard", MAX_NAME_LENGTH); STRNCPY(i->spriteName, "GreenKeycard", MAX_NAME_LENGTH); @@ -66,6 +72,8 @@ void initYellowKeycard(Entity *e) initItem(e); i = (Item*)e; + + i->type = ET_KEY; STRNCPY(i->name, "Yellow Keycard", MAX_NAME_LENGTH); STRNCPY(i->spriteName, "YellowKeycard", MAX_NAME_LENGTH); @@ -78,6 +86,8 @@ void initWhiteKeycard(Entity *e) initItem(e); i = (Item*)e; + + i->type = ET_KEY; STRNCPY(i->name, "White Keycard", MAX_NAME_LENGTH); STRNCPY(i->spriteName, "WhiteKeycard", MAX_NAME_LENGTH); diff --git a/src/world/entities/misc/destructable.c b/src/world/entities/misc/destructable.c index 64eb53d..79f5ef1 100644 --- a/src/world/entities/misc/destructable.c +++ b/src/world/entities/misc/destructable.c @@ -31,6 +31,8 @@ void initDestructable(Entity *e) s = (Structure*)e; + s->type = ET_DESTRUCTABLE; + s->isMissionTarget = 1; STRNCPY(s->spriteName, "Crate4", MAX_NAME_LENGTH); diff --git a/src/world/entities/misc/infoPoint.c b/src/world/entities/misc/infoPoint.c index b3b293f..7ab59e9 100644 --- a/src/world/entities/misc/infoPoint.c +++ b/src/world/entities/misc/infoPoint.c @@ -31,6 +31,8 @@ void initInfoPoint(Entity *e) s = (Structure*)e; + s->type = ET_INFO_POINT; + s->sprite[0] = s->sprite[1] = s->sprite[2] = getSpriteIndex("InfoPoint"); s->flags |= EF_WEIGHTLESS | EF_IGNORE_BULLETS | EF_NO_CLIP | EF_NO_ENVIRONMENT; diff --git a/src/world/entities/structures/cardReader.c b/src/world/entities/structures/cardReader.c index 4fe7065..215c975 100644 --- a/src/world/entities/structures/cardReader.c +++ b/src/world/entities/structures/cardReader.c @@ -31,6 +31,8 @@ void initCardReader(Entity *e) s = (Structure*)e; + s->type = ET_CARD_READER; + s->flags |= EF_WEIGHTLESS | EF_NO_CLIP | EF_NO_ENVIRONMENT | EF_IGNORE_BULLETS | EF_NO_TELEPORT; STRNCPY(s->requiredItem, "Black Keycard", MAX_NAME_LENGTH); diff --git a/src/world/entities/structures/door.c b/src/world/entities/structures/door.c index 34592d9..f46d779 100644 --- a/src/world/entities/structures/door.c +++ b/src/world/entities/structures/door.c @@ -35,6 +35,8 @@ void initDoor(Entity *e) s = (Structure*)e; + s->type = ET_DOOR; + s->isSolid = 1; s->flags |= EF_WEIGHTLESS | EF_NO_ENVIRONMENT | EF_NO_CLIP | EF_EXPLODES | EF_NO_TELEPORT; diff --git a/src/world/entities/structures/exit.c b/src/world/entities/structures/exit.c index 016ce22..744e03d 100644 --- a/src/world/entities/structures/exit.c +++ b/src/world/entities/structures/exit.c @@ -33,6 +33,8 @@ void initExit(Entity *e) s = (Structure*)e; + s->type = ET_EXIT; + s->sprite[FACING_LEFT] = s->sprite[FACING_RIGHT] = s->sprite[FACING_DIE] = getSpriteIndex("Exit"); s->flags |= EF_WEIGHTLESS | EF_NO_CLIP | EF_NO_ENVIRONMENT | EF_IGNORE_BULLETS; diff --git a/src/world/entities/structures/horizontalDoor.c b/src/world/entities/structures/horizontalDoor.c index 76cf1fb..9697a2b 100644 --- a/src/world/entities/structures/horizontalDoor.c +++ b/src/world/entities/structures/horizontalDoor.c @@ -22,7 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void initHorizontalDoor(Entity *e) { - initEntity(e); + initDoor(e); + + e->type = ET_DOOR; e->sprite[0] = e->sprite[1] = e->sprite[2] = getSpriteIndex("HorizonalDoor"); } diff --git a/src/world/entities/structures/horizontalDoor.h b/src/world/entities/structures/horizontalDoor.h index d3c19c9..88cf48c 100644 --- a/src/world/entities/structures/horizontalDoor.h +++ b/src/world/entities/structures/horizontalDoor.h @@ -20,5 +20,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../../../common.h" -extern void initEntity(Entity *e); +extern void initDoor(Entity *e); extern int getSpriteIndex(char *name); diff --git a/src/world/entities/structures/itemPad.c b/src/world/entities/structures/itemPad.c index 733193f..ae2380a 100644 --- a/src/world/entities/structures/itemPad.c +++ b/src/world/entities/structures/itemPad.c @@ -27,6 +27,8 @@ void initItemPad(Entity *e) { initEntity(e); + e->type = ET_ITEM_PAD; + e->flags |= EF_WEIGHTLESS | EF_NO_CLIP | EF_NO_ENVIRONMENT | EF_IGNORE_BULLETS; e->plane = PLANE_FOREGROUND; diff --git a/src/world/entities/structures/lift.c b/src/world/entities/structures/lift.c index 42561d1..8ae00e2 100644 --- a/src/world/entities/structures/lift.c +++ b/src/world/entities/structures/lift.c @@ -31,6 +31,8 @@ void initLift(Entity *e) s = (Structure*)e; + s->type = ET_LIFT; + s->state = LIFT_GOTO_FINISH; s->flags |= EF_WEIGHTLESS | EF_NO_ENVIRONMENT | EF_EXPLODES | EF_NO_CLIP | EF_ALWAYS_PROCESS | EF_NO_TELEPORT; diff --git a/src/world/entities/structures/powerPoint.c b/src/world/entities/structures/powerPoint.c index f70fbe7..b1c6b34 100644 --- a/src/world/entities/structures/powerPoint.c +++ b/src/world/entities/structures/powerPoint.c @@ -31,6 +31,8 @@ void initPowerPoint(Entity *e) initEntity(e); s = (Structure*)e; + + s->type = ET_POWER_POINT; s->sprite[FACING_LEFT] = s->sprite[FACING_RIGHT] = s->sprite[FACING_DIE] = getSpriteIndex("PowerPoint"); diff --git a/src/world/entities/structures/powerPool.c b/src/world/entities/structures/powerPool.c index 7ac8621..4148d62 100644 --- a/src/world/entities/structures/powerPool.c +++ b/src/world/entities/structures/powerPool.c @@ -32,6 +32,8 @@ void initPowerPool(Entity *e) s = (Structure*)e; + s->type = ET_POOL; + s->sprite[FACING_LEFT] = s->sprite[FACING_RIGHT] = s->sprite[FACING_DIE] = getSpriteIndex("PowerPool"); s->flags |= EF_WEIGHTLESS | EF_NO_CLIP | EF_IGNORE_BULLETS; diff --git a/src/world/entities/structures/pressurePlate.c b/src/world/entities/structures/pressurePlate.c index 3cc9e68..19d5cd0 100644 --- a/src/world/entities/structures/pressurePlate.c +++ b/src/world/entities/structures/pressurePlate.c @@ -31,6 +31,8 @@ void initPressurePlate(Entity *e) s = (Structure*)e; + s->type = ET_PRESSURE_PLATE; + s->sprite[FACING_LEFT] = s->sprite[FACING_RIGHT] = s->sprite[FACING_DIE] = getSpriteIndex("PressurePlate"); s->flags |= EF_WEIGHTLESS | EF_NO_CLIP | EF_NO_ENVIRONMENT | EF_IGNORE_BULLETS; diff --git a/src/world/entities/structures/pushBlock.c b/src/world/entities/structures/pushBlock.c index f5ae40b..38c5f89 100644 --- a/src/world/entities/structures/pushBlock.c +++ b/src/world/entities/structures/pushBlock.c @@ -30,6 +30,8 @@ void initPushBlock(Entity *e) s = (Structure*)e; + s->type = ET_PUSHBLOCK; + s->isSolid = 1; s->startX = s->startY = -1; diff --git a/src/world/entities/structures/teleporter.c b/src/world/entities/structures/teleporter.c index 3d55975..413a288 100644 --- a/src/world/entities/structures/teleporter.c +++ b/src/world/entities/structures/teleporter.c @@ -28,6 +28,8 @@ void initTeleporter(Entity *e) { initEntity(e); + e->type = ET_TELEPORTER; + e->flags |= EF_WEIGHTLESS | EF_NO_CLIP | EF_IGNORE_BULLETS | EF_NO_TELEPORT; e->plane = PLANE_FOREGROUND; diff --git a/src/world/entities/traps/horizontalLaserTrap.c b/src/world/entities/traps/horizontalLaserTrap.c index d80327b..ca6812c 100644 --- a/src/world/entities/traps/horizontalLaserTrap.c +++ b/src/world/entities/traps/horizontalLaserTrap.c @@ -24,5 +24,7 @@ void initHorizontalLaserTrap(Entity *e) { initLaserTrap(e); + e->type = ET_TRAP; + e->sprite[0] = e->sprite[1] = e->sprite[2] = getSpriteIndex("HorizontalLaserTrap"); } diff --git a/src/world/entities/traps/laserTrap.c b/src/world/entities/traps/laserTrap.c index 17789e0..f3d4cc9 100644 --- a/src/world/entities/traps/laserTrap.c +++ b/src/world/entities/traps/laserTrap.c @@ -34,6 +34,8 @@ void initLaserTrap(Entity *e) t = (Trap*)e; + t->type = ET_TRAP; + t->flags |= EF_WEIGHTLESS | EF_IGNORE_BULLETS | EF_NO_ENVIRONMENT | EF_NO_CLIP | EF_ALWAYS_PROCESS; t->onTime = FPS * 2;