Set entity types.

This commit is contained in:
Steve 2018-01-28 09:34:14 +00:00
parent 53c8c4984e
commit 7d6ca19c77
30 changed files with 76 additions and 2 deletions

View File

@ -87,6 +87,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
enum enum
{ {
ET_NONE,
ET_EFFECT, ET_EFFECT,
ET_TRAP, ET_TRAP,
ET_BOB, ET_BOB,

View File

@ -20,6 +20,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "bob.h" #include "bob.h"
void initBob(Entity *e)
{
e->type = ET_BOB;
}
void addBobItem(Item *i) void addBobItem(Item *i)
{ {

View File

@ -34,6 +34,8 @@ void initMIA(Entity *e)
m = (MIA*)e; m = (MIA*)e;
m->type = ET_MIA;
m->tx = m->ty = -1; m->tx = m->ty = -1;
m->sprite[FACING_LEFT] = getSpriteIndex("MIA"); m->sprite[FACING_LEFT] = getSpriteIndex("MIA");

View File

@ -28,6 +28,8 @@ void initBoss(Entity *e)
b = (Boss*)e; b = (Boss*)e;
b->type = ET_BOSS;
b->sprite[FACING_LEFT] = b->sprite[FACING_RIGHT] = b->sprite[FACING_DIE] = getSpriteIndex("Boss"); b->sprite[FACING_LEFT] = b->sprite[FACING_RIGHT] = b->sprite[FACING_DIE] = getSpriteIndex("Boss");
b->isMissionTarget = 1; b->isMissionTarget = 1;

View File

@ -36,6 +36,8 @@ void initCannon(Entity *e)
u = (Unit*)self; u = (Unit*)self;
u->type = ET_ENEMY;
u->sprite[FACING_LEFT] = getSpriteIndex("CannonLeft"); u->sprite[FACING_LEFT] = getSpriteIndex("CannonLeft");
u->sprite[FACING_RIGHT] = getSpriteIndex("CannonRight"); u->sprite[FACING_RIGHT] = getSpriteIndex("CannonRight");
u->sprite[FACING_DIE] = getSpriteIndex("CannonLeft"); u->sprite[FACING_DIE] = getSpriteIndex("CannonLeft");

View File

@ -32,6 +32,8 @@ void initDebris(Entity *e)
d = (Decoration*)self; d = (Decoration*)self;
d->type = ET_DECORATION;
d->effectType = rand() % 2; d->effectType = rand() % 2;
d->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_NO_TELEPORT; d->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_NO_TELEPORT;

View File

@ -32,6 +32,8 @@ void initFleshChunk(Entity *e)
d = (Decoration*)e; d = (Decoration*)e;
d->type = ET_DECORATION;
d->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_NO_TELEPORT; d->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_NO_TELEPORT;
d->bleedTime = FPS * 3; d->bleedTime = FPS * 3;

View File

@ -30,6 +30,8 @@ void initCell(Entity *e)
i = (Item*)self; i = (Item*)self;
i->type = ET_HEART_CELL;
i->isMissionTarget = 1; i->isMissionTarget = 1;
STRNCPY(i->spriteName, "Battery", MAX_NAME_LENGTH); STRNCPY(i->spriteName, "Battery", MAX_NAME_LENGTH);

View File

@ -25,6 +25,10 @@ static void die(void);
void initConsumable(Entity *e) void initConsumable(Entity *e)
{ {
initEntity(e);
e->type = ET_CONSUMABLE;
e->flags |= EF_IGNORE_BULLETS; e->flags |= EF_IGNORE_BULLETS;
e->health = FPS * 10; e->health = FPS * 10;

View File

@ -20,4 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../../common.h" #include "../../../common.h"
extern void initEntity(Entity *e);
extern Entity *self; extern Entity *self;

View File

@ -31,6 +31,8 @@ void initHeart(Entity *e)
i = (Item*)e; i = (Item*)e;
i->type = ET_HEART_CELL;
i->isMissionTarget = 1; i->isMissionTarget = 1;
STRNCPY(i->spriteName, "Heart", MAX_NAME_LENGTH); STRNCPY(i->spriteName, "Heart", MAX_NAME_LENGTH);

View File

@ -37,6 +37,8 @@ void initItem(Entity *e)
i = (Item*)e; i = (Item*)e;
i->type = ET_ITEM;
STRNCPY(i->spriteName, "Weapon", MAX_NAME_LENGTH); STRNCPY(i->spriteName, "Weapon", MAX_NAME_LENGTH);
i->flags |= EF_IGNORE_BULLETS; i->flags |= EF_IGNORE_BULLETS;

View File

@ -28,6 +28,8 @@ void initBronzeKey(Entity *e)
i = (Item*)e; i = (Item*)e;
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);
} }
@ -40,6 +42,8 @@ void initSilverKey(Entity *e)
i = (Item*)e; i = (Item*)e;
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);
} }
@ -52,6 +56,8 @@ void initGoldKey(Entity *e)
i = (Item*)e; i = (Item*)e;
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);
} }

View File

@ -31,6 +31,8 @@ void initRedKeycard(Entity *e)
i = (Item*)e; i = (Item*)e;
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);
} }
@ -43,6 +45,8 @@ void initBlueKeycard(Entity *e)
i = (Item*)e; i = (Item*)e;
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);
} }
@ -55,6 +59,8 @@ void initGreenKeycard(Entity *e)
i = (Item*)e; i = (Item*)e;
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);
} }
@ -67,6 +73,8 @@ void initYellowKeycard(Entity *e)
i = (Item*)e; i = (Item*)e;
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);
} }
@ -79,6 +87,8 @@ void initWhiteKeycard(Entity *e)
i = (Item*)e; i = (Item*)e;
i->type = ET_KEY;
STRNCPY(i->name, "White Keycard", MAX_NAME_LENGTH); STRNCPY(i->name, "White Keycard", MAX_NAME_LENGTH);
STRNCPY(i->spriteName, "WhiteKeycard", MAX_NAME_LENGTH); STRNCPY(i->spriteName, "WhiteKeycard", MAX_NAME_LENGTH);

View File

@ -31,6 +31,8 @@ void initDestructable(Entity *e)
s = (Structure*)e; s = (Structure*)e;
s->type = ET_DESTRUCTABLE;
s->isMissionTarget = 1; s->isMissionTarget = 1;
STRNCPY(s->spriteName, "Crate4", MAX_NAME_LENGTH); STRNCPY(s->spriteName, "Crate4", MAX_NAME_LENGTH);

View File

@ -31,6 +31,8 @@ void initInfoPoint(Entity *e)
s = (Structure*)e; s = (Structure*)e;
s->type = ET_INFO_POINT;
s->sprite[0] = s->sprite[1] = s->sprite[2] = getSpriteIndex("InfoPoint"); s->sprite[0] = s->sprite[1] = s->sprite[2] = getSpriteIndex("InfoPoint");
s->flags |= EF_WEIGHTLESS | EF_IGNORE_BULLETS | EF_NO_CLIP | EF_NO_ENVIRONMENT; s->flags |= EF_WEIGHTLESS | EF_IGNORE_BULLETS | EF_NO_CLIP | EF_NO_ENVIRONMENT;

View File

@ -31,6 +31,8 @@ void initCardReader(Entity *e)
s = (Structure*)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; s->flags |= EF_WEIGHTLESS | EF_NO_CLIP | EF_NO_ENVIRONMENT | EF_IGNORE_BULLETS | EF_NO_TELEPORT;
STRNCPY(s->requiredItem, "Black Keycard", MAX_NAME_LENGTH); STRNCPY(s->requiredItem, "Black Keycard", MAX_NAME_LENGTH);

View File

@ -35,6 +35,8 @@ void initDoor(Entity *e)
s = (Structure*)e; s = (Structure*)e;
s->type = ET_DOOR;
s->isSolid = 1; s->isSolid = 1;
s->flags |= EF_WEIGHTLESS | EF_NO_ENVIRONMENT | EF_NO_CLIP | EF_EXPLODES | EF_NO_TELEPORT; s->flags |= EF_WEIGHTLESS | EF_NO_ENVIRONMENT | EF_NO_CLIP | EF_EXPLODES | EF_NO_TELEPORT;

View File

@ -33,6 +33,8 @@ void initExit(Entity *e)
s = (Structure*)e; s = (Structure*)e;
s->type = ET_EXIT;
s->sprite[FACING_LEFT] = s->sprite[FACING_RIGHT] = s->sprite[FACING_DIE] = getSpriteIndex("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; s->flags |= EF_WEIGHTLESS | EF_NO_CLIP | EF_NO_ENVIRONMENT | EF_IGNORE_BULLETS;

View File

@ -22,7 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void initHorizontalDoor(Entity *e) void initHorizontalDoor(Entity *e)
{ {
initEntity(e); initDoor(e);
e->type = ET_DOOR;
e->sprite[0] = e->sprite[1] = e->sprite[2] = getSpriteIndex("HorizonalDoor"); e->sprite[0] = e->sprite[1] = e->sprite[2] = getSpriteIndex("HorizonalDoor");
} }

View File

@ -20,5 +20,5 @@ 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 initDoor(Entity *e);
extern int getSpriteIndex(char *name); extern int getSpriteIndex(char *name);

View File

@ -27,6 +27,8 @@ void initItemPad(Entity *e)
{ {
initEntity(e); initEntity(e);
e->type = ET_ITEM_PAD;
e->flags |= EF_WEIGHTLESS | EF_NO_CLIP | EF_NO_ENVIRONMENT | EF_IGNORE_BULLETS; e->flags |= EF_WEIGHTLESS | EF_NO_CLIP | EF_NO_ENVIRONMENT | EF_IGNORE_BULLETS;
e->plane = PLANE_FOREGROUND; e->plane = PLANE_FOREGROUND;

View File

@ -31,6 +31,8 @@ void initLift(Entity *e)
s = (Structure*)e; s = (Structure*)e;
s->type = ET_LIFT;
s->state = LIFT_GOTO_FINISH; s->state = LIFT_GOTO_FINISH;
s->flags |= EF_WEIGHTLESS | EF_NO_ENVIRONMENT | EF_EXPLODES | EF_NO_CLIP | EF_ALWAYS_PROCESS | EF_NO_TELEPORT; s->flags |= EF_WEIGHTLESS | EF_NO_ENVIRONMENT | EF_EXPLODES | EF_NO_CLIP | EF_ALWAYS_PROCESS | EF_NO_TELEPORT;

View File

@ -32,6 +32,8 @@ void initPowerPoint(Entity *e)
s = (Structure*)e; s = (Structure*)e;
s->type = ET_POWER_POINT;
s->sprite[FACING_LEFT] = s->sprite[FACING_RIGHT] = s->sprite[FACING_DIE] = getSpriteIndex("PowerPoint"); s->sprite[FACING_LEFT] = s->sprite[FACING_RIGHT] = s->sprite[FACING_DIE] = getSpriteIndex("PowerPoint");
s->flags |= EF_WEIGHTLESS | EF_NO_CLIP | EF_NO_ENVIRONMENT | EF_IGNORE_BULLETS; s->flags |= EF_WEIGHTLESS | EF_NO_CLIP | EF_NO_ENVIRONMENT | EF_IGNORE_BULLETS;

View File

@ -32,6 +32,8 @@ void initPowerPool(Entity *e)
s = (Structure*)e; s = (Structure*)e;
s->type = ET_POOL;
s->sprite[FACING_LEFT] = s->sprite[FACING_RIGHT] = s->sprite[FACING_DIE] = getSpriteIndex("PowerPool"); s->sprite[FACING_LEFT] = s->sprite[FACING_RIGHT] = s->sprite[FACING_DIE] = getSpriteIndex("PowerPool");
s->flags |= EF_WEIGHTLESS | EF_NO_CLIP | EF_IGNORE_BULLETS; s->flags |= EF_WEIGHTLESS | EF_NO_CLIP | EF_IGNORE_BULLETS;

View File

@ -31,6 +31,8 @@ void initPressurePlate(Entity *e)
s = (Structure*)e; s = (Structure*)e;
s->type = ET_PRESSURE_PLATE;
s->sprite[FACING_LEFT] = s->sprite[FACING_RIGHT] = s->sprite[FACING_DIE] = getSpriteIndex("PressurePlate"); 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; s->flags |= EF_WEIGHTLESS | EF_NO_CLIP | EF_NO_ENVIRONMENT | EF_IGNORE_BULLETS;

View File

@ -30,6 +30,8 @@ void initPushBlock(Entity *e)
s = (Structure*)e; s = (Structure*)e;
s->type = ET_PUSHBLOCK;
s->isSolid = 1; s->isSolid = 1;
s->startX = s->startY = -1; s->startX = s->startY = -1;

View File

@ -28,6 +28,8 @@ void initTeleporter(Entity *e)
{ {
initEntity(e); initEntity(e);
e->type = ET_TELEPORTER;
e->flags |= EF_WEIGHTLESS | EF_NO_CLIP | EF_IGNORE_BULLETS | EF_NO_TELEPORT; e->flags |= EF_WEIGHTLESS | EF_NO_CLIP | EF_IGNORE_BULLETS | EF_NO_TELEPORT;
e->plane = PLANE_FOREGROUND; e->plane = PLANE_FOREGROUND;

View File

@ -24,5 +24,7 @@ void initHorizontalLaserTrap(Entity *e)
{ {
initLaserTrap(e); initLaserTrap(e);
e->type = ET_TRAP;
e->sprite[0] = e->sprite[1] = e->sprite[2] = getSpriteIndex("HorizontalLaserTrap"); e->sprite[0] = e->sprite[1] = e->sprite[2] = getSpriteIndex("HorizontalLaserTrap");
} }

View File

@ -34,6 +34,8 @@ void initLaserTrap(Entity *e)
t = (Trap*)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->flags |= EF_WEIGHTLESS | EF_IGNORE_BULLETS | EF_NO_ENVIRONMENT | EF_NO_CLIP | EF_ALWAYS_PROCESS;
t->onTime = FPS * 2; t->onTime = FPS * 2;