mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 09:39:43 +01:00
Convert entity type
s to an enum (#1007)
In an effort to remove magic numbers, I've given every entity type a name. Hopefully I didn't miss anywhere. Also, add `createentity` case 100 for backwards compatibility. Co-authored-by: NyakoFox <nyakowofox@gmail.com> Co-authored-by: Dav999 <dav999.tolp@gmail.com>
This commit is contained in:
parent
9c45dfb845
commit
63880169e6
7 changed files with 181 additions and 120 deletions
|
@ -11,7 +11,7 @@ entclass::entclass(void)
|
||||||
void entclass::clear(void)
|
void entclass::clear(void)
|
||||||
{
|
{
|
||||||
invis = false;
|
invis = false;
|
||||||
type = 0;
|
type = EntityType_PLAYER;
|
||||||
size = 0;
|
size = 0;
|
||||||
tile = 0;
|
tile = 0;
|
||||||
rule = 0;
|
rule = 0;
|
||||||
|
@ -650,8 +650,8 @@ void entclass::updatecolour(void)
|
||||||
|
|
||||||
bool entclass::ishumanoid(void)
|
bool entclass::ishumanoid(void)
|
||||||
{
|
{
|
||||||
return type == 0
|
return type == EntityType_PLAYER
|
||||||
|| type == 12
|
|| type == EntityType_CREWMATE
|
||||||
|| type == 14
|
|| type == EntityType_SUPERCREWMATE
|
||||||
|| type == 55;
|
|| type == EntityType_COLLECTABLE_CREWMATE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,34 @@
|
||||||
|
|
||||||
#define rn( rx, ry) ((rx) + ((ry) * 100))
|
#define rn( rx, ry) ((rx) + ((ry) * 100))
|
||||||
|
|
||||||
|
enum EntityType
|
||||||
|
{
|
||||||
|
EntityType_INVALID = -1,
|
||||||
|
EntityType_PLAYER,
|
||||||
|
EntityType_MOVING,
|
||||||
|
EntityType_DISAPPEARING_PLATFORM,
|
||||||
|
EntityType_QUICKSAND,
|
||||||
|
EntityType_GRAVITY_TOKEN,
|
||||||
|
EntityType_PARTICLE,
|
||||||
|
EntityType_COIN,
|
||||||
|
EntityType_TRINKET,
|
||||||
|
EntityType_CHECKPOINT,
|
||||||
|
EntityType_HORIZONTAL_GRAVITY_LINE,
|
||||||
|
EntityType_VERTICAL_GRAVITY_LINE,
|
||||||
|
EntityType_WARP_TOKEN,
|
||||||
|
EntityType_CREWMATE,
|
||||||
|
EntityType_TERMINAL,
|
||||||
|
EntityType_SUPERCREWMATE,
|
||||||
|
EntityType_TROPHY,
|
||||||
|
EntityType_GRAVITRON_ENEMY = 23,
|
||||||
|
EntityType_WARP_LINE_LEFT = 51,
|
||||||
|
EntityType_WARP_LINE_RIGHT = 52,
|
||||||
|
EntityType_WARP_LINE_TOP = 53,
|
||||||
|
EntityType_WARP_LINE_BOTTOM = 54,
|
||||||
|
EntityType_COLLECTABLE_CREWMATE = 55,
|
||||||
|
EntityType_TELEPORTER = 100
|
||||||
|
};
|
||||||
|
|
||||||
class entclass
|
class entclass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -26,7 +54,8 @@ public:
|
||||||
public:
|
public:
|
||||||
//Fundamentals
|
//Fundamentals
|
||||||
bool invis;
|
bool invis;
|
||||||
int type, size, tile, rule;
|
EntityType type;
|
||||||
|
int size, tile, rule;
|
||||||
int state, statedelay;
|
int state, statedelay;
|
||||||
int behave, animate;
|
int behave, animate;
|
||||||
float para;
|
float para;
|
||||||
|
|
|
@ -123,7 +123,7 @@ void entityclass::swnenemiescol( int t )
|
||||||
//change the colour of all SWN enemies to the current one
|
//change the colour of all SWN enemies to the current one
|
||||||
for (size_t i = 0; i < entities.size(); i++)
|
for (size_t i = 0; i < entities.size(); i++)
|
||||||
{
|
{
|
||||||
if (entities[i].type == 23)
|
if (entities[i].type == EntityType_GRAVITRON_ENEMY)
|
||||||
{
|
{
|
||||||
entities[i].colour = swncolour(t);
|
entities[i].colour = swncolour(t);
|
||||||
}
|
}
|
||||||
|
@ -1133,7 +1133,7 @@ bool entityclass::disableentity(int t)
|
||||||
|
|
||||||
entities[t].invis = true;
|
entities[t].invis = true;
|
||||||
entities[t].size = -1;
|
entities[t].size = -1;
|
||||||
entities[t].type = -1;
|
entities[t].type = EntityType_INVALID;
|
||||||
entities[t].rule = -1;
|
entities[t].rule = -1;
|
||||||
entities[t].isplatform = false;
|
entities[t].isplatform = false;
|
||||||
|
|
||||||
|
@ -1269,7 +1269,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
{
|
{
|
||||||
if (entities[i].invis
|
if (entities[i].invis
|
||||||
&& entities[i].size == -1
|
&& entities[i].size == -1
|
||||||
&& entities[i].type == -1
|
&& entities[i].type == EntityType_INVALID
|
||||||
&& entities[i].rule == -1
|
&& entities[i].rule == -1
|
||||||
&& !entities[i].isplatform)
|
&& !entities[i].isplatform)
|
||||||
{
|
{
|
||||||
|
@ -1318,7 +1318,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
entclass& entity = *entptr;
|
entclass& entity = *entptr;
|
||||||
entity.xp = xp;
|
entity.xp = xp;
|
||||||
entity.yp = yp;
|
entity.yp = yp;
|
||||||
entity.type = t;
|
entity.type = EntityType_INVALID;
|
||||||
switch(t)
|
switch(t)
|
||||||
{
|
{
|
||||||
case 0: //Player
|
case 0: //Player
|
||||||
|
@ -1330,6 +1330,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
entity.w = 12;
|
entity.w = 12;
|
||||||
entity.h = 21;
|
entity.h = 21;
|
||||||
entity.dir = 1;
|
entity.dir = 1;
|
||||||
|
entity.type = EntityType_PLAYER;
|
||||||
|
|
||||||
/* Fix wrong y-position if spawning in on conveyor */
|
/* Fix wrong y-position if spawning in on conveyor */
|
||||||
entity.newxp = xp;
|
entity.newxp = xp;
|
||||||
|
@ -1358,6 +1359,8 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
entity.animate = 0;
|
entity.animate = 0;
|
||||||
entity.colour = 8;
|
entity.colour = 8;
|
||||||
|
|
||||||
|
entity.type = EntityType_MOVING;
|
||||||
|
|
||||||
if (game.roomy == 111 && (game.roomx >= 113 && game.roomx <= 117))
|
if (game.roomy == 111 && (game.roomx >= 113 && game.roomx <= 117))
|
||||||
{
|
{
|
||||||
entity.setenemy(0);
|
entity.setenemy(0);
|
||||||
|
@ -1386,7 +1389,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 2: //A moving platform
|
case 2: //A moving platform
|
||||||
entity.rule = 2;
|
entity.rule = 2;
|
||||||
entity.type = 1;
|
entity.type = EntityType_MOVING;
|
||||||
entity.size = 2;
|
entity.size = 2;
|
||||||
entity.tile = 1;
|
entity.tile = 1;
|
||||||
|
|
||||||
|
@ -1454,7 +1457,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 3: //Disappearing platforms
|
case 3: //Disappearing platforms
|
||||||
entity.rule = 3;
|
entity.rule = 3;
|
||||||
entity.type = 2;
|
entity.type = EntityType_DISAPPEARING_PLATFORM;
|
||||||
entity.size = 2;
|
entity.size = 2;
|
||||||
entity.tile = 2;
|
entity.tile = 2;
|
||||||
//appearance again depends on location
|
//appearance again depends on location
|
||||||
|
@ -1484,7 +1487,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 4: //Breakable blocks
|
case 4: //Breakable blocks
|
||||||
entity.rule = 6;
|
entity.rule = 6;
|
||||||
entity.type = 3;
|
entity.type = EntityType_QUICKSAND;
|
||||||
entity.size = 1;
|
entity.size = 1;
|
||||||
entity.tile = 10;
|
entity.tile = 10;
|
||||||
entity.cy = -1;
|
entity.cy = -1;
|
||||||
|
@ -1499,7 +1502,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 5: //Gravity Tokens
|
case 5: //Gravity Tokens
|
||||||
entity.rule = 3;
|
entity.rule = 3;
|
||||||
entity.type = 4;
|
entity.type = EntityType_GRAVITY_TOKEN;
|
||||||
entity.size = 0;
|
entity.size = 0;
|
||||||
entity.tile = 11;
|
entity.tile = 11;
|
||||||
entity.w = 16;
|
entity.w = 16;
|
||||||
|
@ -1511,7 +1514,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 6: //Decorative particles
|
case 6: //Decorative particles
|
||||||
entity.rule = 2;
|
entity.rule = 2;
|
||||||
entity.type = 5; //Particles
|
entity.type = EntityType_PARTICLE; //Particles
|
||||||
entity.colour = 1;
|
entity.colour = 1;
|
||||||
entity.size = 3;
|
entity.size = 3;
|
||||||
entity.vx = meta1;
|
entity.vx = meta1;
|
||||||
|
@ -1521,7 +1524,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 7: //Decorative particles
|
case 7: //Decorative particles
|
||||||
entity.rule = 2;
|
entity.rule = 2;
|
||||||
entity.type = 5; //Particles
|
entity.type = EntityType_PARTICLE; //Particles
|
||||||
entity.colour = 2;
|
entity.colour = 2;
|
||||||
entity.size = 3;
|
entity.size = 3;
|
||||||
entity.vx = meta1;
|
entity.vx = meta1;
|
||||||
|
@ -1531,7 +1534,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 8: //Small collectibles
|
case 8: //Small collectibles
|
||||||
entity.rule = 3;
|
entity.rule = 3;
|
||||||
entity.type = 6;
|
entity.type = EntityType_COIN;
|
||||||
entity.size = 4;
|
entity.size = 4;
|
||||||
entity.tile = 48;
|
entity.tile = 48;
|
||||||
entity.w = 8;
|
entity.w = 8;
|
||||||
|
@ -1545,7 +1548,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 9: //Something Shiny
|
case 9: //Something Shiny
|
||||||
entity.rule = 3;
|
entity.rule = 3;
|
||||||
entity.type = 7;
|
entity.type = EntityType_TRINKET;
|
||||||
entity.size = 0;
|
entity.size = 0;
|
||||||
entity.tile = 22;
|
entity.tile = 22;
|
||||||
entity.w = 16;
|
entity.w = 16;
|
||||||
|
@ -1560,7 +1563,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 10: //Savepoint
|
case 10: //Savepoint
|
||||||
entity.rule = 3;
|
entity.rule = 3;
|
||||||
entity.type = 8;
|
entity.type = EntityType_CHECKPOINT;
|
||||||
entity.size = 0;
|
entity.size = 0;
|
||||||
entity.tile = 20 + meta1;
|
entity.tile = 20 + meta1;
|
||||||
entity.w = 16;
|
entity.w = 16;
|
||||||
|
@ -1583,7 +1586,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 11: //Horizontal Gravity Line
|
case 11: //Horizontal Gravity Line
|
||||||
entity.rule = 4;
|
entity.rule = 4;
|
||||||
entity.type = 9;
|
entity.type = EntityType_HORIZONTAL_GRAVITY_LINE;
|
||||||
entity.size = 5;
|
entity.size = 5;
|
||||||
entity.life = 0;
|
entity.life = 0;
|
||||||
entity.w = meta1;
|
entity.w = meta1;
|
||||||
|
@ -1592,7 +1595,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 12: //Vertical Gravity Line
|
case 12: //Vertical Gravity Line
|
||||||
entity.rule = 5;
|
entity.rule = 5;
|
||||||
entity.type = 10;
|
entity.type = EntityType_VERTICAL_GRAVITY_LINE;
|
||||||
entity.size = 6;
|
entity.size = 6;
|
||||||
entity.life = 0;
|
entity.life = 0;
|
||||||
entity.w = 1;
|
entity.w = 1;
|
||||||
|
@ -1602,7 +1605,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 13: //Warp token
|
case 13: //Warp token
|
||||||
entity.rule = 3;
|
entity.rule = 3;
|
||||||
entity.type = 11;
|
entity.type = EntityType_WARP_TOKEN;
|
||||||
entity.size = 0;
|
entity.size = 0;
|
||||||
entity.tile = 18;
|
entity.tile = 18;
|
||||||
entity.w = 16;
|
entity.w = 16;
|
||||||
|
@ -1616,7 +1619,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 14: // Teleporter
|
case 14: // Teleporter
|
||||||
entity.rule = 3;
|
entity.rule = 3;
|
||||||
entity.type = 100;
|
entity.type = EntityType_TELEPORTER;
|
||||||
entity.size = 7;
|
entity.size = 7;
|
||||||
entity.tile = 1; //inactive
|
entity.tile = 1; //inactive
|
||||||
entity.w = 96;
|
entity.w = 96;
|
||||||
|
@ -1628,7 +1631,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 15: // Crew Member (warp zone)
|
case 15: // Crew Member (warp zone)
|
||||||
entity.rule = 6;
|
entity.rule = 6;
|
||||||
entity.type = 12; //A special case!
|
entity.type = EntityType_CREWMATE; //A special case!
|
||||||
entity.tile = 144;
|
entity.tile = 144;
|
||||||
entity.colour = 13; //144 for sad :(
|
entity.colour = 13; //144 for sad :(
|
||||||
entity.cx = 6;
|
entity.cx = 6;
|
||||||
|
@ -1643,7 +1646,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 16: // Crew Member, upside down (space station)
|
case 16: // Crew Member, upside down (space station)
|
||||||
entity.rule = 7;
|
entity.rule = 7;
|
||||||
entity.type = 12; //A special case!
|
entity.type = EntityType_CREWMATE; //A special case!
|
||||||
entity.tile = 144+6;
|
entity.tile = 144+6;
|
||||||
entity.colour = 14; //144 for sad (upside down+12):(
|
entity.colour = 14; //144 for sad (upside down+12):(
|
||||||
entity.cx = 6;
|
entity.cx = 6;
|
||||||
|
@ -1658,7 +1661,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 17: // Crew Member (Lab)
|
case 17: // Crew Member (Lab)
|
||||||
entity.rule = 6;
|
entity.rule = 6;
|
||||||
entity.type = 12; //A special case!
|
entity.type = EntityType_CREWMATE; //A special case!
|
||||||
entity.tile = 144;
|
entity.tile = 144;
|
||||||
entity.colour = 16; //144 for sad :(
|
entity.colour = 16; //144 for sad :(
|
||||||
entity.cx = 6;
|
entity.cx = 6;
|
||||||
|
@ -1674,7 +1677,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
case 18: // Crew Member (Ship)
|
case 18: // Crew Member (Ship)
|
||||||
//This is the scriping crewmember
|
//This is the scriping crewmember
|
||||||
entity.rule = 6;
|
entity.rule = 6;
|
||||||
entity.type = 12; //A special case!
|
entity.type = EntityType_CREWMATE; //A special case!
|
||||||
entity.colour = meta1;
|
entity.colour = meta1;
|
||||||
if (meta2 == 0)
|
if (meta2 == 0)
|
||||||
{
|
{
|
||||||
|
@ -1702,7 +1705,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 19: // Crew Member (Ship) More tests!
|
case 19: // Crew Member (Ship) More tests!
|
||||||
entity.rule = 6;
|
entity.rule = 6;
|
||||||
entity.type = 12; //A special case!
|
entity.type = EntityType_CREWMATE; //A special case!
|
||||||
entity.tile = 0;
|
entity.tile = 0;
|
||||||
entity.colour = 6; //54 for sad :(
|
entity.colour = 6; //54 for sad :(
|
||||||
entity.cx = 6;
|
entity.cx = 6;
|
||||||
|
@ -1717,7 +1720,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 20: //Terminal
|
case 20: //Terminal
|
||||||
entity.rule = 3;
|
entity.rule = 3;
|
||||||
entity.type = 13;
|
entity.type = EntityType_TERMINAL;
|
||||||
entity.size = 0;
|
entity.size = 0;
|
||||||
entity.tile = 16 + meta1;
|
entity.tile = 16 + meta1;
|
||||||
entity.w = 16;
|
entity.w = 16;
|
||||||
|
@ -1729,7 +1732,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 21: //as above, except doesn't highlight
|
case 21: //as above, except doesn't highlight
|
||||||
entity.rule = 3;
|
entity.rule = 3;
|
||||||
entity.type = 13;
|
entity.type = EntityType_TERMINAL;
|
||||||
entity.size = 0;
|
entity.size = 0;
|
||||||
entity.tile = 16 + meta1;
|
entity.tile = 16 + meta1;
|
||||||
entity.w = 16;
|
entity.w = 16;
|
||||||
|
@ -1741,7 +1744,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 22: //Fake trinkets, only appear if you've collected them
|
case 22: //Fake trinkets, only appear if you've collected them
|
||||||
entity.rule = 3;
|
entity.rule = 3;
|
||||||
entity.type = 7;
|
entity.type = EntityType_TRINKET;
|
||||||
entity.size = 0;
|
entity.size = 0;
|
||||||
entity.tile = 22;
|
entity.tile = 22;
|
||||||
entity.w = 16;
|
entity.w = 16;
|
||||||
|
@ -1757,7 +1760,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
case 23: //SWN Enemies
|
case 23: //SWN Enemies
|
||||||
//Given a different behavior, these enemies are especially for SWN mode and disappear outside the screen.
|
//Given a different behavior, these enemies are especially for SWN mode and disappear outside the screen.
|
||||||
entity.rule = 1;
|
entity.rule = 1;
|
||||||
entity.type = 23;
|
entity.type = EntityType_GRAVITRON_ENEMY;
|
||||||
entity.behave = meta1;
|
entity.behave = meta1;
|
||||||
entity.para = meta2;
|
entity.para = meta2;
|
||||||
entity.w = 16;
|
entity.w = 16;
|
||||||
|
@ -1786,7 +1789,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
case 24: // Super Crew Member
|
case 24: // Super Crew Member
|
||||||
//This special crewmember is way more advanced than the usual kind, and can interact with game objects
|
//This special crewmember is way more advanced than the usual kind, and can interact with game objects
|
||||||
entity.rule = 6;
|
entity.rule = 6;
|
||||||
entity.type = 14; //A special case!
|
entity.type = EntityType_SUPERCREWMATE; //A special case!
|
||||||
entity.colour = meta1;
|
entity.colour = meta1;
|
||||||
if (meta1 == 16)
|
if (meta1 == 16)
|
||||||
{
|
{
|
||||||
|
@ -1828,7 +1831,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 25: //Trophies
|
case 25: //Trophies
|
||||||
entity.rule = 3;
|
entity.rule = 3;
|
||||||
entity.type = 15;
|
entity.type = EntityType_TROPHY;
|
||||||
entity.size = 0;
|
entity.size = 0;
|
||||||
entity.w = 16;
|
entity.w = 16;
|
||||||
entity.h = 16;
|
entity.h = 16;
|
||||||
|
@ -2003,7 +2006,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 26: //Epilogue super warp token
|
case 26: //Epilogue super warp token
|
||||||
entity.rule = 3;
|
entity.rule = 3;
|
||||||
entity.type = 11;
|
entity.type = EntityType_WARP_TOKEN;
|
||||||
entity.size = 0;
|
entity.size = 0;
|
||||||
entity.tile = 18;
|
entity.tile = 18;
|
||||||
entity.w = 16;
|
entity.w = 16;
|
||||||
|
@ -2020,7 +2023,23 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
case 52: /* Vertical */
|
case 52: /* Vertical */
|
||||||
case 53: /* Horizontal */
|
case 53: /* Horizontal */
|
||||||
case 54: /* Horizontal */
|
case 54: /* Horizontal */
|
||||||
entity.type = t;
|
if (t == 51)
|
||||||
|
{
|
||||||
|
entity.type = EntityType_WARP_LINE_LEFT;
|
||||||
|
}
|
||||||
|
else if (t == 52)
|
||||||
|
{
|
||||||
|
entity.type = EntityType_WARP_LINE_RIGHT;
|
||||||
|
}
|
||||||
|
else if (t == 53)
|
||||||
|
{
|
||||||
|
entity.type = EntityType_WARP_LINE_TOP;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entity.type = EntityType_WARP_LINE_BOTTOM;
|
||||||
|
}
|
||||||
|
|
||||||
entity.onentity = 1;
|
entity.onentity = 1;
|
||||||
entity.invis = true;
|
entity.invis = true;
|
||||||
entity.life = 0;
|
entity.life = 0;
|
||||||
|
@ -2052,7 +2071,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
//1 - position in array
|
//1 - position in array
|
||||||
//2 - colour
|
//2 - colour
|
||||||
entity.rule = 3;
|
entity.rule = 3;
|
||||||
entity.type = 55;
|
entity.type = EntityType_COLLECTABLE_CREWMATE;
|
||||||
if(INBOUNDS_ARR(meta2, customcrewmoods)
|
if(INBOUNDS_ARR(meta2, customcrewmoods)
|
||||||
&& customcrewmoods[meta2]==1){
|
&& customcrewmoods[meta2]==1){
|
||||||
entity.tile = 144;
|
entity.tile = 144;
|
||||||
|
@ -2078,7 +2097,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
break;
|
break;
|
||||||
case 56: //Custom enemy
|
case 56: //Custom enemy
|
||||||
entity.rule = 1;
|
entity.rule = 1;
|
||||||
entity.type = 1;
|
entity.type = EntityType_MOVING;
|
||||||
entity.behave = meta1;
|
entity.behave = meta1;
|
||||||
entity.para = meta2;
|
entity.para = meta2;
|
||||||
entity.w = 16;
|
entity.w = 16;
|
||||||
|
@ -2154,6 +2173,9 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
|
|
||||||
entityclonefix(&entity);
|
entityclonefix(&entity);
|
||||||
break;
|
break;
|
||||||
|
case 100: // Invalid enemy, but gets treated as a teleporter
|
||||||
|
entity.type = EntityType_TELEPORTER;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.lerpoldxp = entity.xp;
|
entity.lerpoldxp = entity.xp;
|
||||||
|
@ -2169,7 +2191,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
|
||||||
* This is a bit kludge-y but it's better than copy-pasting
|
* This is a bit kludge-y but it's better than copy-pasting
|
||||||
* and is okay to do because entity 12 does not change state on its own
|
* and is okay to do because entity 12 does not change state on its own
|
||||||
*/
|
*/
|
||||||
if (entity.type == 12)
|
if (entity.type == EntityType_CREWMATE)
|
||||||
{
|
{
|
||||||
size_t indice;
|
size_t indice;
|
||||||
if (reuse)
|
if (reuse)
|
||||||
|
@ -2222,9 +2244,9 @@ bool entityclass::updateentities( int i )
|
||||||
{
|
{
|
||||||
switch(entities[i].type)
|
switch(entities[i].type)
|
||||||
{
|
{
|
||||||
case 0: //Player
|
case EntityType_PLAYER: //Player
|
||||||
break;
|
break;
|
||||||
case 1: //Movement behaviors
|
case EntityType_MOVING: //Movement behaviors
|
||||||
//Enemies can have a number of different behaviors:
|
//Enemies can have a number of different behaviors:
|
||||||
switch(entities[i].behave)
|
switch(entities[i].behave)
|
||||||
{
|
{
|
||||||
|
@ -2454,7 +2476,7 @@ bool entityclass::updateentities( int i )
|
||||||
{
|
{
|
||||||
for (size_t j = 0; j < entities.size(); j++)
|
for (size_t j = 0; j < entities.size(); j++)
|
||||||
{
|
{
|
||||||
if (entities[j].type == 2 && entities[j].state== 3 && entities[j].xp == (entities[i].xp-32) )
|
if (entities[j].type == EntityType_DISAPPEARING_PLATFORM && entities[j].state== 3 && entities[j].xp == (entities[i].xp-32) )
|
||||||
{
|
{
|
||||||
entities[i].state = 3;
|
entities[i].state = 3;
|
||||||
bool entitygone = updateentities(i);
|
bool entitygone = updateentities(i);
|
||||||
|
@ -2484,7 +2506,7 @@ bool entityclass::updateentities( int i )
|
||||||
{
|
{
|
||||||
for (size_t j = 0; j < entities.size(); j++)
|
for (size_t j = 0; j < entities.size(); j++)
|
||||||
{
|
{
|
||||||
if (entities[j].type == 2 && entities[j].state==3 && entities[j].xp==entities[i].xp+32)
|
if (entities[j].type == EntityType_DISAPPEARING_PLATFORM && entities[j].state==3 && entities[j].xp==entities[i].xp+32)
|
||||||
{
|
{
|
||||||
entities[i].state = 3;
|
entities[i].state = 3;
|
||||||
bool entitygone = updateentities(i);
|
bool entitygone = updateentities(i);
|
||||||
|
@ -2582,7 +2604,7 @@ bool entityclass::updateentities( int i )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: //Disappearing platforms
|
case EntityType_DISAPPEARING_PLATFORM: //Disappearing platforms
|
||||||
//wait for collision
|
//wait for collision
|
||||||
if (entities[i].state == 1)
|
if (entities[i].state == 1)
|
||||||
{
|
{
|
||||||
|
@ -2629,7 +2651,7 @@ bool entityclass::updateentities( int i )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3: //Breakable blocks
|
case EntityType_QUICKSAND: //Breakable blocks
|
||||||
//Only counts if vy of player entity is non zero
|
//Only counts if vy of player entity is non zero
|
||||||
if (entities[i].state == 1)
|
if (entities[i].state == 1)
|
||||||
{
|
{
|
||||||
|
@ -2649,7 +2671,7 @@ bool entityclass::updateentities( int i )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4: //Gravity token
|
case EntityType_GRAVITY_TOKEN: //Gravity token
|
||||||
//wait for collision
|
//wait for collision
|
||||||
if (entities[i].state == 1)
|
if (entities[i].state == 1)
|
||||||
{
|
{
|
||||||
|
@ -2659,7 +2681,7 @@ bool entityclass::updateentities( int i )
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5: //Particle sprays
|
case EntityType_PARTICLE: //Particle sprays
|
||||||
if (entities[i].state == 0)
|
if (entities[i].state == 0)
|
||||||
{
|
{
|
||||||
entities[i].life--;
|
entities[i].life--;
|
||||||
|
@ -2669,7 +2691,7 @@ bool entityclass::updateentities( int i )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 6: //Small pickup
|
case EntityType_COIN: //Small pickup
|
||||||
//wait for collision
|
//wait for collision
|
||||||
if (entities[i].state == 1)
|
if (entities[i].state == 1)
|
||||||
{
|
{
|
||||||
|
@ -2682,7 +2704,7 @@ bool entityclass::updateentities( int i )
|
||||||
return disableentity(i);
|
return disableentity(i);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 7: //Found a trinket
|
case EntityType_TRINKET: //Found a trinket
|
||||||
//wait for collision
|
//wait for collision
|
||||||
if (entities[i].state == 1)
|
if (entities[i].state == 1)
|
||||||
{
|
{
|
||||||
|
@ -2710,14 +2732,14 @@ bool entityclass::updateentities( int i )
|
||||||
return disableentity(i);
|
return disableentity(i);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 8: //Savepoints
|
case EntityType_CHECKPOINT: //Savepoints
|
||||||
//wait for collision
|
//wait for collision
|
||||||
if (entities[i].state == 1)
|
if (entities[i].state == 1)
|
||||||
{
|
{
|
||||||
//First, deactivate all other savepoints
|
//First, deactivate all other savepoints
|
||||||
for (size_t j = 0; j < entities.size(); j++)
|
for (size_t j = 0; j < entities.size(); j++)
|
||||||
{
|
{
|
||||||
if (entities[j].type == 8)
|
if (entities[j].type == EntityType_CHECKPOINT)
|
||||||
{
|
{
|
||||||
entities[j].colour = 4;
|
entities[j].colour = 4;
|
||||||
entities[j].onentity = 1;
|
entities[j].onentity = 1;
|
||||||
|
@ -2753,7 +2775,7 @@ bool entityclass::updateentities( int i )
|
||||||
game.checkpoint_save();
|
game.checkpoint_save();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 9: //Gravity Lines
|
case EntityType_HORIZONTAL_GRAVITY_LINE: //Gravity Lines
|
||||||
if (entities[i].state == 1)
|
if (entities[i].state == 1)
|
||||||
{
|
{
|
||||||
entities[i].life--;
|
entities[i].life--;
|
||||||
|
@ -2766,7 +2788,7 @@ bool entityclass::updateentities( int i )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 10: //Vertical gravity Lines
|
case EntityType_VERTICAL_GRAVITY_LINE: //Vertical gravity Lines
|
||||||
if (entities[i].state == 1)
|
if (entities[i].state == 1)
|
||||||
{
|
{
|
||||||
entities[i].onentity = 3;
|
entities[i].onentity = 3;
|
||||||
|
@ -2808,7 +2830,7 @@ bool entityclass::updateentities( int i )
|
||||||
entities[i].state = 2;
|
entities[i].state = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 11: //Warp point
|
case EntityType_WARP_TOKEN: //Warp point
|
||||||
//wait for collision
|
//wait for collision
|
||||||
if (entities[i].state == 1)
|
if (entities[i].state == 1)
|
||||||
{
|
{
|
||||||
|
@ -2826,7 +2848,7 @@ bool entityclass::updateentities( int i )
|
||||||
if (int(entities[i].xp) == 21*8) game.teleportxpos = 4;
|
if (int(entities[i].xp) == 21*8) game.teleportxpos = 4;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 12: //Crew member
|
case EntityType_CREWMATE: //Crew member
|
||||||
//Somewhat complex AI: exactly what they do depends on room, location, state etc
|
//Somewhat complex AI: exactly what they do depends on room, location, state etc
|
||||||
//At state 0, do nothing at all.
|
//At state 0, do nothing at all.
|
||||||
if (entities[i].state == 1)
|
if (entities[i].state == 1)
|
||||||
|
@ -3161,7 +3183,7 @@ bool entityclass::updateentities( int i )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 13: //Terminals (very similar to savepoints)
|
case EntityType_TERMINAL: //Terminals (very similar to savepoints)
|
||||||
//wait for collision
|
//wait for collision
|
||||||
if (entities[i].state == 1)
|
if (entities[i].state == 1)
|
||||||
{
|
{
|
||||||
|
@ -3172,7 +3194,7 @@ bool entityclass::updateentities( int i )
|
||||||
entities[i].state = 0;
|
entities[i].state = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 14: //Super Crew member
|
case EntityType_SUPERCREWMATE: //Super Crew member
|
||||||
//Actually needs less complex AI than the scripting crewmember
|
//Actually needs less complex AI than the scripting crewmember
|
||||||
if (entities[i].state == 0)
|
if (entities[i].state == 0)
|
||||||
{
|
{
|
||||||
|
@ -3228,7 +3250,7 @@ bool entityclass::updateentities( int i )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 15: //Trophy
|
case EntityType_TROPHY: //Trophy
|
||||||
//wait for collision
|
//wait for collision
|
||||||
if (entities[i].state == 1)
|
if (entities[i].state == 1)
|
||||||
{
|
{
|
||||||
|
@ -3239,7 +3261,7 @@ bool entityclass::updateentities( int i )
|
||||||
entities[i].state = 0;
|
entities[i].state = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 23:
|
case EntityType_GRAVITRON_ENEMY:
|
||||||
//swn game!
|
//swn game!
|
||||||
switch(entities[i].behave)
|
switch(entities[i].behave)
|
||||||
{
|
{
|
||||||
|
@ -3266,7 +3288,7 @@ bool entityclass::updateentities( int i )
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 51: //Vertical warp line
|
case EntityType_WARP_LINE_LEFT: //Vertical warp line
|
||||||
if (entities[i].state == 2){
|
if (entities[i].state == 2){
|
||||||
int j=getplayer();
|
int j=getplayer();
|
||||||
if(INBOUNDS_VEC(j, entities) && entities[j].xp<=307){
|
if(INBOUNDS_VEC(j, entities) && entities[j].xp<=307){
|
||||||
|
@ -3281,7 +3303,7 @@ bool entityclass::updateentities( int i )
|
||||||
customwarpmodevon=true;
|
customwarpmodevon=true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 52: //Vertical warp line
|
case EntityType_WARP_LINE_RIGHT: //Vertical warp line
|
||||||
if (entities[i].state == 2){
|
if (entities[i].state == 2){
|
||||||
int j=getplayer();
|
int j=getplayer();
|
||||||
if(INBOUNDS_VEC(j, entities) && entities[j].xp<=307){
|
if(INBOUNDS_VEC(j, entities) && entities[j].xp<=307){
|
||||||
|
@ -3296,7 +3318,7 @@ bool entityclass::updateentities( int i )
|
||||||
customwarpmodevon=true;
|
customwarpmodevon=true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 53: //Warp lines Horizonal
|
case EntityType_WARP_LINE_TOP: //Warp lines Horizonal
|
||||||
if (entities[i].state == 2){
|
if (entities[i].state == 2){
|
||||||
customwarpmodehon=false;
|
customwarpmodehon=false;
|
||||||
entities[i].state = 0;
|
entities[i].state = 0;
|
||||||
|
@ -3308,7 +3330,7 @@ bool entityclass::updateentities( int i )
|
||||||
customwarpmodehon=true;
|
customwarpmodehon=true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 54: //Warp lines Horizonal
|
case EntityType_WARP_LINE_BOTTOM: //Warp lines Horizonal
|
||||||
if (entities[i].state == 2){
|
if (entities[i].state == 2){
|
||||||
customwarpmodehon=false;
|
customwarpmodehon=false;
|
||||||
entities[i].state = 0;
|
entities[i].state = 0;
|
||||||
|
@ -3320,7 +3342,7 @@ bool entityclass::updateentities( int i )
|
||||||
customwarpmodehon=true;
|
customwarpmodehon=true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 55: //Collectable crewmate
|
case EntityType_COLLECTABLE_CREWMATE: //Collectable crewmate
|
||||||
//wait for collision
|
//wait for collision
|
||||||
if (entities[i].state == 0)
|
if (entities[i].state == 0)
|
||||||
{
|
{
|
||||||
|
@ -3357,7 +3379,7 @@ bool entityclass::updateentities( int i )
|
||||||
return disableentity(i);
|
return disableentity(i);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 100: //The teleporter
|
case EntityType_TELEPORTER: //The teleporter
|
||||||
if (entities[i].state == 1)
|
if (entities[i].state == 1)
|
||||||
{
|
{
|
||||||
//if inactive, activate!
|
//if inactive, activate!
|
||||||
|
@ -3383,7 +3405,7 @@ bool entityclass::updateentities( int i )
|
||||||
//First, deactivate all other savepoints
|
//First, deactivate all other savepoints
|
||||||
for (size_t j = 0; j < entities.size(); j++)
|
for (size_t j = 0; j < entities.size(); j++)
|
||||||
{
|
{
|
||||||
if (entities[j].type == 8)
|
if (entities[j].type == EntityType_CHECKPOINT)
|
||||||
{
|
{
|
||||||
entities[j].colour = 4;
|
entities[j].colour = 4;
|
||||||
entities[j].onentity = 1;
|
entities[j].onentity = 1;
|
||||||
|
@ -3422,6 +3444,8 @@ bool entityclass::updateentities( int i )
|
||||||
entities[i].state = 0;
|
entities[i].state = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case EntityType_INVALID: // Invalid entity, do nothing!
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3448,7 +3472,7 @@ void entityclass::animateentities( int _i )
|
||||||
{
|
{
|
||||||
switch(entities[_i].type)
|
switch(entities[_i].type)
|
||||||
{
|
{
|
||||||
case 0:
|
case EntityType_PLAYER:
|
||||||
entities[_i].framedelay--;
|
entities[_i].framedelay--;
|
||||||
if(entities[_i].dir==1)
|
if(entities[_i].dir==1)
|
||||||
{
|
{
|
||||||
|
@ -3497,8 +3521,8 @@ void entityclass::animateentities( int _i )
|
||||||
if (game.gravitycontrol == 1) entities[_i].drawframe += 2;
|
if (game.gravitycontrol == 1) entities[_i].drawframe += 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case EntityType_MOVING:
|
||||||
case 23:
|
case EntityType_GRAVITRON_ENEMY:
|
||||||
//Variable animation
|
//Variable animation
|
||||||
switch(entities[_i].animate)
|
switch(entities[_i].animate)
|
||||||
{
|
{
|
||||||
|
@ -3686,10 +3710,10 @@ void entityclass::animateentities( int _i )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: //Disappearing platforms
|
case EntityType_DISAPPEARING_PLATFORM: //Disappearing platforms
|
||||||
entities[_i].drawframe = entities[_i].tile + entities[_i].walkingframe;
|
entities[_i].drawframe = entities[_i].tile + entities[_i].walkingframe;
|
||||||
break;
|
break;
|
||||||
case 11:
|
case EntityType_WARP_TOKEN:
|
||||||
entities[_i].drawframe = entities[_i].tile;
|
entities[_i].drawframe = entities[_i].tile;
|
||||||
if(entities[_i].animate==2)
|
if(entities[_i].animate==2)
|
||||||
{
|
{
|
||||||
|
@ -3709,9 +3733,9 @@ void entityclass::animateentities( int _i )
|
||||||
entities[_i].drawframe += entities[_i].walkingframe;
|
entities[_i].drawframe += entities[_i].walkingframe;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 12:
|
case EntityType_CREWMATE:
|
||||||
case 55:
|
case EntityType_COLLECTABLE_CREWMATE:
|
||||||
case 14: //Crew member! Very similar to hero
|
case EntityType_SUPERCREWMATE: //Crew member! Very similar to hero
|
||||||
entities[_i].framedelay--;
|
entities[_i].framedelay--;
|
||||||
if(entities[_i].dir==1)
|
if(entities[_i].dir==1)
|
||||||
{
|
{
|
||||||
|
@ -3754,7 +3778,7 @@ void entityclass::animateentities( int _i )
|
||||||
//if (game.gravitycontrol == 1) entities[_i].drawframe += 2;
|
//if (game.gravitycontrol == 1) entities[_i].drawframe += 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 100: //the teleporter!
|
case EntityType_TELEPORTER: //the teleporter!
|
||||||
if (entities[_i].tile == 1 || game.noflashingmode)
|
if (entities[_i].tile == 1 || game.noflashingmode)
|
||||||
{
|
{
|
||||||
//it's inactive
|
//it's inactive
|
||||||
|
@ -3880,7 +3904,7 @@ void entityclass::animatehumanoidcollision(const int i)
|
||||||
{
|
{
|
||||||
++entity->collisiondrawframe;
|
++entity->collisiondrawframe;
|
||||||
|
|
||||||
if (entity->type == 0 && game.gravitycontrol == 1)
|
if (entity->type == EntityType_PLAYER && game.gravitycontrol == 1)
|
||||||
{
|
{
|
||||||
entity->collisiondrawframe += 6;
|
entity->collisiondrawframe += 6;
|
||||||
}
|
}
|
||||||
|
@ -3896,8 +3920,8 @@ void entityclass::animatehumanoidcollision(const int i)
|
||||||
entity->collisiondrawframe = 12;
|
entity->collisiondrawframe = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((entity->type == 0 && game.gravitycontrol == 1)
|
if ((entity->type == EntityType_PLAYER && game.gravitycontrol == 1)
|
||||||
|| (entity->type != 0 && entity->rule == 7))
|
|| (entity->type != EntityType_PLAYER && entity->rule == 7))
|
||||||
{
|
{
|
||||||
entity->collisiondrawframe += 2;
|
entity->collisiondrawframe += 2;
|
||||||
}
|
}
|
||||||
|
@ -3927,7 +3951,7 @@ int entityclass::getplayer(void)
|
||||||
//Returns the index of the first player entity
|
//Returns the index of the first player entity
|
||||||
for (size_t i = 0; i < entities.size(); i++)
|
for (size_t i = 0; i < entities.size(); i++)
|
||||||
{
|
{
|
||||||
if(entities[i].type==0)
|
if (entities[i].type == EntityType_PLAYER)
|
||||||
{
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -3941,7 +3965,7 @@ int entityclass::getscm(void)
|
||||||
//Returns the supercrewmate
|
//Returns the supercrewmate
|
||||||
for (size_t i = 0; i < entities.size(); i++)
|
for (size_t i = 0; i < entities.size(); i++)
|
||||||
{
|
{
|
||||||
if(entities[i].type==14)
|
if (entities[i].type == EntityType_SUPERCREWMATE)
|
||||||
{
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -3973,7 +3997,7 @@ int entityclass::getcrewman( int t, int fallback /*= 0*/ )
|
||||||
|
|
||||||
for (size_t i = 0; i < entities.size(); i++)
|
for (size_t i = 0; i < entities.size(); i++)
|
||||||
{
|
{
|
||||||
if ((entities[i].type == 12 || entities[i].type == 14)
|
if ((entities[i].type == EntityType_CREWMATE || entities[i].type == EntityType_SUPERCREWMATE)
|
||||||
&& (entities[i].rule == 6 || entities[i].rule == 7))
|
&& (entities[i].rule == 6 || entities[i].rule == 7))
|
||||||
{
|
{
|
||||||
if(entities[i].colour==t)
|
if(entities[i].colour==t)
|
||||||
|
@ -3998,9 +4022,9 @@ int entityclass::getcustomcrewman( int t )
|
||||||
|
|
||||||
for (size_t i = 0; i < entities.size(); i++)
|
for (size_t i = 0; i < entities.size(); i++)
|
||||||
{
|
{
|
||||||
if (entities[i].type == 55)
|
if (entities[i].type == EntityType_COLLECTABLE_CREWMATE)
|
||||||
{
|
{
|
||||||
if(entities[i].colour==t)
|
if (entities[i].colour == t)
|
||||||
{
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -4014,7 +4038,7 @@ int entityclass::getteleporter(void)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < entities.size(); i++)
|
for (size_t i = 0; i < entities.size(); i++)
|
||||||
{
|
{
|
||||||
if(entities[i].type==100)
|
if (entities[i].type == EntityType_TELEPORTER)
|
||||||
{
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -4053,7 +4077,7 @@ bool entityclass::checkdamage(bool scm /*= false*/)
|
||||||
//Returns true if player (or supercrewmate) collides with a damagepoint
|
//Returns true if player (or supercrewmate) collides with a damagepoint
|
||||||
for(size_t i=0; i < entities.size(); i++)
|
for(size_t i=0; i < entities.size(); i++)
|
||||||
{
|
{
|
||||||
if((scm && entities[i].type == 14) || (!scm && entities[i].rule == 0))
|
if((scm && entities[i].type == EntityType_SUPERCREWMATE) || (!scm && entities[i].rule == 0))
|
||||||
{
|
{
|
||||||
SDL_Rect temprect;
|
SDL_Rect temprect;
|
||||||
temprect.x = entities[i].xp + entities[i].cx;
|
temprect.x = entities[i].xp + entities[i].cx;
|
||||||
|
@ -4468,7 +4492,7 @@ bool entityclass::testwallsx( int t, int tx, int ty, const bool skipdirblocks )
|
||||||
temprect.w = entities[t].w;
|
temprect.w = entities[t].w;
|
||||||
temprect.h = entities[t].h;
|
temprect.h = entities[t].h;
|
||||||
|
|
||||||
bool skipblocks = entities[t].rule < 2 || entities[t].type == 14;
|
bool skipblocks = entities[t].rule < 2 || entities[t].type == EntityType_SUPERCREWMATE;
|
||||||
float dx = 0;
|
float dx = 0;
|
||||||
float dy = 0;
|
float dy = 0;
|
||||||
if (entities[t].rule == 0) dx = entities[t].vx;
|
if (entities[t].rule == 0) dx = entities[t].vx;
|
||||||
|
@ -4514,7 +4538,7 @@ bool entityclass::testwallsy( int t, int tx, int ty )
|
||||||
temprect.w = entities[t].w;
|
temprect.w = entities[t].w;
|
||||||
temprect.h = entities[t].h;
|
temprect.h = entities[t].h;
|
||||||
|
|
||||||
bool skipblocks = entities[t].rule < 2 || entities[t].type == 14;
|
bool skipblocks = entities[t].rule < 2 || entities[t].type == EntityType_SUPERCREWMATE;
|
||||||
|
|
||||||
float dx = 0;
|
float dx = 0;
|
||||||
float dy = 0;
|
float dy = 0;
|
||||||
|
@ -4696,13 +4720,13 @@ void entityclass::customwarplinecheck(int i) {
|
||||||
for (int j = 0; j < (int) entities.size(); j++) {
|
for (int j = 0; j < (int) entities.size(); j++) {
|
||||||
if (i != j) {
|
if (i != j) {
|
||||||
if (entities[i].rule == 0 && entities[j].rule == 5 //Player vs vertical line!
|
if (entities[i].rule == 0 && entities[j].rule == 5 //Player vs vertical line!
|
||||||
&& (entities[j].type == 51 || entities[j].type == 52)
|
&& (entities[j].type == EntityType_WARP_LINE_LEFT || entities[j].type == EntityType_WARP_LINE_RIGHT)
|
||||||
&& entitywarpvlinecollide(i, j)) {
|
&& entitywarpvlinecollide(i, j)) {
|
||||||
customwarpmodevon = true;
|
customwarpmodevon = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entities[i].rule == 0 && entities[j].rule == 7 //Player vs horizontal WARP line
|
if (entities[i].rule == 0 && entities[j].rule == 7 //Player vs horizontal WARP line
|
||||||
&& (entities[j].type == 53 || entities[j].type == 54)
|
&& (entities[j].type == EntityType_WARP_LINE_TOP || entities[j].type == EntityType_WARP_LINE_BOTTOM)
|
||||||
&& entitywarphlinecollide(i, j)) {
|
&& entitywarphlinecollide(i, j)) {
|
||||||
customwarpmodehon = true;
|
customwarpmodehon = true;
|
||||||
}
|
}
|
||||||
|
@ -4715,7 +4739,7 @@ void entityclass::entitycollisioncheck(void)
|
||||||
for (size_t i = 0; i < entities.size(); i++)
|
for (size_t i = 0; i < entities.size(); i++)
|
||||||
{
|
{
|
||||||
bool player = entities[i].rule == 0;
|
bool player = entities[i].rule == 0;
|
||||||
bool scm = game.supercrewmate && entities[i].type == 14;
|
bool scm = game.supercrewmate && entities[i].type == EntityType_SUPERCREWMATE;
|
||||||
if (!player && !scm)
|
if (!player && !scm)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -282,11 +282,11 @@ namespace level_debugger
|
||||||
graphics.draw_rect(bounding_box.x, bounding_box.y, bounding_box.w, bounding_box.h, graphics.getRGB(15, 90, 90));
|
graphics.draw_rect(bounding_box.x, bounding_box.y, bounding_box.w, bounding_box.h, graphics.getRGB(15, 90, 90));
|
||||||
|
|
||||||
// For gravity lines, show the true hitbox.
|
// For gravity lines, show the true hitbox.
|
||||||
if (obj.entities[i].type == 9)
|
if (obj.entities[i].type == EntityType_HORIZONTAL_GRAVITY_LINE)
|
||||||
{
|
{
|
||||||
graphics.draw_rect(bounding_box.x - 1, bounding_box.y + 1, bounding_box.w + 2, bounding_box.h, graphics.getRGB(90, 90, 15));
|
graphics.draw_rect(bounding_box.x - 1, bounding_box.y + 1, bounding_box.w + 2, bounding_box.h, graphics.getRGB(90, 90, 15));
|
||||||
}
|
}
|
||||||
else if (obj.entities[i].type == 10)
|
else if (obj.entities[i].type == EntityType_VERTICAL_GRAVITY_LINE)
|
||||||
{
|
{
|
||||||
graphics.fill_rect(bounding_box.x - 2, bounding_box.y - 1, bounding_box.w + 1, bounding_box.h + 2, graphics.getRGB(90, 90, 15));
|
graphics.fill_rect(bounding_box.x - 2, bounding_box.y - 1, bounding_box.w + 1, bounding_box.h + 2, graphics.getRGB(90, 90, 15));
|
||||||
}
|
}
|
||||||
|
@ -390,33 +390,35 @@ namespace level_debugger
|
||||||
// Mostly contains duplicates, but for ease of use
|
// Mostly contains duplicates, but for ease of use
|
||||||
switch (entity->type)
|
switch (entity->type)
|
||||||
{
|
{
|
||||||
case 0:
|
case EntityType_PLAYER:
|
||||||
// Player
|
// Player
|
||||||
render_info(line++, "Gravity", help.String(game.gravitycontrol));
|
render_info(line++, "Gravity", help.String(game.gravitycontrol));
|
||||||
render_info(line++, "Checkpoint", help.String(game.savepoint));
|
render_info(line++, "Checkpoint", help.String(game.savepoint));
|
||||||
break;
|
break;
|
||||||
case 1:
|
case EntityType_MOVING:
|
||||||
// Moving platforms and enemies
|
// Moving platforms and enemies
|
||||||
render_info(line++, "Speed", help.String(entity->para));
|
render_info(line++, "Speed", help.String(entity->para));
|
||||||
render_info(line++, "Movement type", help.String(entity->behave));
|
render_info(line++, "Movement type", help.String(entity->behave));
|
||||||
break;
|
break;
|
||||||
case 7:
|
case EntityType_TRINKET:
|
||||||
// Trinkets
|
// Trinkets
|
||||||
render_info(line++, "ID", help.String(entity->para));
|
render_info(line++, "ID", help.String(entity->para));
|
||||||
break;
|
break;
|
||||||
case 8:
|
case EntityType_CHECKPOINT:
|
||||||
// Checkpoints
|
// Checkpoints
|
||||||
render_info(line++, "ID", help.String(entity->para));
|
render_info(line++, "ID", help.String(entity->para));
|
||||||
render_info(line++, "Active", game.savepoint == entity->para ? "True" : "False");
|
render_info(line++, "Active", game.savepoint == entity->para ? "True" : "False");
|
||||||
break;
|
break;
|
||||||
case 9:
|
case EntityType_HORIZONTAL_GRAVITY_LINE:
|
||||||
// Horizontal gravity lines
|
// Horizontal gravity lines
|
||||||
render_info(line++, "Horizontal");
|
render_info(line++, "Horizontal");
|
||||||
break;
|
break;
|
||||||
case 10:
|
case EntityType_VERTICAL_GRAVITY_LINE:
|
||||||
// Vertical gravity lines
|
// Vertical gravity lines
|
||||||
render_info(line++, "Vertical");
|
render_info(line++, "Vertical");
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -373,7 +373,7 @@ void gamelogic(void)
|
||||||
{
|
{
|
||||||
if (game.roomx == 111 && game.roomy == 107 && !map.custommode)
|
if (game.roomx == 111 && game.roomy == 107 && !map.custommode)
|
||||||
{
|
{
|
||||||
if (obj.entities[i].type == 1)
|
if (obj.entities[i].type == EntityType_MOVING)
|
||||||
{
|
{
|
||||||
if (obj.entities[i].xp < 152)
|
if (obj.entities[i].xp < 152)
|
||||||
{
|
{
|
||||||
|
@ -391,7 +391,7 @@ void gamelogic(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (obj.entities[i].type == 2 && obj.entities[i].state == 3)
|
if (obj.entities[i].type == EntityType_DISAPPEARING_PLATFORM && obj.entities[i].state == 3)
|
||||||
{
|
{
|
||||||
//Ok! super magical exception for the room with the intention death for the shiny trinket
|
//Ok! super magical exception for the room with the intention death for the shiny trinket
|
||||||
//fix this when the maps are finalised
|
//fix this when the maps are finalised
|
||||||
|
@ -405,7 +405,7 @@ void gamelogic(void)
|
||||||
map.settile(18, 9, 59);
|
map.settile(18, 9, 59);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (obj.entities[i].type == 2 && obj.entities[i].state == 2)
|
else if (obj.entities[i].type == EntityType_DISAPPEARING_PLATFORM && obj.entities[i].state == 2)
|
||||||
{
|
{
|
||||||
//ok, unfortunate case where the disappearing platform hasn't fully disappeared. Accept a little
|
//ok, unfortunate case where the disappearing platform hasn't fully disappeared. Accept a little
|
||||||
//graphical uglyness to avoid breaking the room!
|
//graphical uglyness to avoid breaking the room!
|
||||||
|
@ -421,7 +421,7 @@ void gamelogic(void)
|
||||||
}
|
}
|
||||||
if (!entitygone) obj.entities[i].state = 4;
|
if (!entitygone) obj.entities[i].state = 4;
|
||||||
}
|
}
|
||||||
else if (obj.entities[i].type == 23 && game.swnmode && game.deathseq<15)
|
else if (obj.entities[i].type == EntityType_GRAVITRON_ENEMY && game.swnmode && game.deathseq<15)
|
||||||
{
|
{
|
||||||
//if playing SWN, get the enemies offscreen.
|
//if playing SWN, get the enemies offscreen.
|
||||||
obj.entities[i].xp += obj.entities[i].vx*5;
|
obj.entities[i].xp += obj.entities[i].vx*5;
|
||||||
|
@ -730,7 +730,7 @@ void gamelogic(void)
|
||||||
bool square_onscreen = false;
|
bool square_onscreen = false;
|
||||||
for (size_t i = 0; i < obj.entities.size(); i++)
|
for (size_t i = 0; i < obj.entities.size(); i++)
|
||||||
{
|
{
|
||||||
if (obj.entities[i].type == 23)
|
if (obj.entities[i].type == EntityType_GRAVITRON_ENEMY)
|
||||||
{
|
{
|
||||||
square_onscreen = true;
|
square_onscreen = true;
|
||||||
break;
|
break;
|
||||||
|
@ -1036,8 +1036,10 @@ void gamelogic(void)
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < obj.entities.size(); ++i)
|
for (i = 0; i < obj.entities.size(); ++i)
|
||||||
{
|
{
|
||||||
if ((obj.entities[i].type >= 51
|
if (obj.entities[i].type == EntityType_WARP_LINE_LEFT
|
||||||
&& obj.entities[i].type <= 54) /* Don't warp warp lines */
|
|| obj.entities[i].type == EntityType_WARP_LINE_RIGHT
|
||||||
|
|| obj.entities[i].type == EntityType_WARP_LINE_TOP
|
||||||
|
|| obj.entities[i].type == EntityType_WARP_LINE_BOTTOM /* Don't warp warp lines */
|
||||||
|| obj.entities[i].size == 12) /* Don't warp gravitron squares */
|
|| obj.entities[i].size == 12) /* Don't warp gravitron squares */
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -1094,8 +1096,10 @@ void gamelogic(void)
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < obj.entities.size(); ++i)
|
for (i = 0; i < obj.entities.size(); ++i)
|
||||||
{
|
{
|
||||||
if (obj.entities[i].type >= 51
|
if (obj.entities[i].type == EntityType_WARP_LINE_LEFT
|
||||||
&& obj.entities[i].type <= 54) /* Don't warp warp lines */
|
|| obj.entities[i].type == EntityType_WARP_LINE_RIGHT
|
||||||
|
|| obj.entities[i].type == EntityType_WARP_LINE_TOP
|
||||||
|
|| obj.entities[i].type == EntityType_WARP_LINE_BOTTOM) /* Don't warp warp lines */
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1126,8 +1130,10 @@ void gamelogic(void)
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < obj.entities.size(); ++i)
|
for (i = 0; i < obj.entities.size(); ++i)
|
||||||
{
|
{
|
||||||
if ((obj.entities[i].type >= 51
|
if ((obj.entities[i].type == EntityType_WARP_LINE_LEFT
|
||||||
&& obj.entities[i].type <= 54) /* Don't warp warp lines */
|
|| obj.entities[i].type == EntityType_WARP_LINE_RIGHT
|
||||||
|
|| obj.entities[i].type == EntityType_WARP_LINE_TOP
|
||||||
|
|| obj.entities[i].type == EntityType_WARP_LINE_BOTTOM) /* Don't warp warp lines */
|
||||||
|| obj.entities[i].rule == 0) /* Don't warp the player */
|
|| obj.entities[i].rule == 0) /* Don't warp the player */
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -519,7 +519,7 @@ void mapclass::changefinalcol(int t)
|
||||||
//Next, entities
|
//Next, entities
|
||||||
for (size_t i = 0; i < obj.entities.size(); i++)
|
for (size_t i = 0; i < obj.entities.size(); i++)
|
||||||
{
|
{
|
||||||
if (obj.entities[i].type == 1) //something with a movement behavior
|
if (obj.entities[i].type == EntityType_MOVING)
|
||||||
{
|
{
|
||||||
if (obj.entities[i].animate == 10 || obj.entities[i].animate == 11) //treadmill
|
if (obj.entities[i].animate == 10 || obj.entities[i].animate == 11) //treadmill
|
||||||
{
|
{
|
||||||
|
@ -542,7 +542,7 @@ void mapclass::changefinalcol(int t)
|
||||||
obj.entities[i].colour = maptiletoenemycol(temp);
|
obj.entities[i].colour = maptiletoenemycol(temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (obj.entities[i].type == 2) //disappearing platforms
|
else if (obj.entities[i].type == EntityType_DISAPPEARING_PLATFORM)
|
||||||
{
|
{
|
||||||
obj.entities[i].tile = 915+(temp*40);
|
obj.entities[i].tile = 915+(temp*40);
|
||||||
}
|
}
|
||||||
|
@ -892,7 +892,7 @@ void mapclass::gotoroom(int rx, int ry)
|
||||||
//Ok, let's save the position of all lines on the screen
|
//Ok, let's save the position of all lines on the screen
|
||||||
for (size_t i = 0; i < obj.entities.size(); i++)
|
for (size_t i = 0; i < obj.entities.size(); i++)
|
||||||
{
|
{
|
||||||
if (obj.entities[i].type == 9)
|
if (obj.entities[i].type == EntityType_HORIZONTAL_GRAVITY_LINE)
|
||||||
{
|
{
|
||||||
//It's a horizontal line
|
//It's a horizontal line
|
||||||
if (obj.entities[i].xp <= 0 || (obj.entities[i].xp + obj.entities[i].w) >= 312)
|
if (obj.entities[i].xp <= 0 || (obj.entities[i].xp + obj.entities[i].w) >= 312)
|
||||||
|
@ -1030,7 +1030,7 @@ void mapclass::gotoroom(int rx, int ry)
|
||||||
|
|
||||||
for (size_t i = 0; i < obj.entities.size(); i++)
|
for (size_t i = 0; i < obj.entities.size(); i++)
|
||||||
{
|
{
|
||||||
if (obj.entities[i].type == 9)
|
if (obj.entities[i].type == EntityType_HORIZONTAL_GRAVITY_LINE)
|
||||||
{
|
{
|
||||||
//It's a horizontal line
|
//It's a horizontal line
|
||||||
if (obj.entities[i].xp <= 0 || obj.entities[i].xp + obj.entities[i].w >= 312)
|
if (obj.entities[i].xp <= 0 || obj.entities[i].xp + obj.entities[i].w >= 312)
|
||||||
|
@ -2058,7 +2058,7 @@ void mapclass::loadlevel(int rx, int ry)
|
||||||
|
|
||||||
for (size_t i = 0; i < obj.entities.size(); i++)
|
for (size_t i = 0; i < obj.entities.size(); i++)
|
||||||
{
|
{
|
||||||
if (obj.entities[i].type == 1 && obj.entities[i].behave >= 8 && obj.entities[i].behave < 10)
|
if (obj.entities[i].type == EntityType_MOVING && obj.entities[i].behave >= 8 && obj.entities[i].behave < 10)
|
||||||
{
|
{
|
||||||
//put a block underneath
|
//put a block underneath
|
||||||
int temp = obj.entities[i].xp / 8.0f;
|
int temp = obj.entities[i].xp / 8.0f;
|
||||||
|
|
|
@ -295,7 +295,7 @@ void scriptclass::run(void)
|
||||||
{
|
{
|
||||||
for (size_t edi = 0; edi < obj.entities.size(); edi++)
|
for (size_t edi = 0; edi < obj.entities.size(); edi++)
|
||||||
{
|
{
|
||||||
if (obj.entities[edi].type == 9 || obj.entities[edi].type == 10)
|
if (obj.entities[edi].type == EntityType_HORIZONTAL_GRAVITY_LINE || obj.entities[edi].type == EntityType_VERTICAL_GRAVITY_LINE)
|
||||||
{
|
{
|
||||||
obj.disableentity(edi);
|
obj.disableentity(edi);
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ void scriptclass::run(void)
|
||||||
{
|
{
|
||||||
for (size_t edi = 0; edi < obj.entities.size(); edi++)
|
for (size_t edi = 0; edi < obj.entities.size(); edi++)
|
||||||
{
|
{
|
||||||
if (obj.entities[edi].type == 11)
|
if (obj.entities[edi].type == EntityType_WARP_TOKEN)
|
||||||
{
|
{
|
||||||
obj.disableentity(edi);
|
obj.disableentity(edi);
|
||||||
}
|
}
|
||||||
|
@ -332,7 +332,7 @@ void scriptclass::run(void)
|
||||||
for (size_t edi = 0; edi < obj.entities.size(); edi++)
|
for (size_t edi = 0; edi < obj.entities.size(); edi++)
|
||||||
{
|
{
|
||||||
obj.disableblockat(obj.entities[edi].xp, obj.entities[edi].yp);
|
obj.disableblockat(obj.entities[edi].xp, obj.entities[edi].yp);
|
||||||
if (obj.entities[edi].type == 2 && obj.entities[edi].rule == 3)
|
if (obj.entities[edi].type == EntityType_DISAPPEARING_PLATFORM && obj.entities[edi].rule == 3)
|
||||||
{
|
{
|
||||||
obj.disableentity(edi);
|
obj.disableentity(edi);
|
||||||
}
|
}
|
||||||
|
@ -1648,7 +1648,7 @@ void scriptclass::run(void)
|
||||||
{
|
{
|
||||||
for (j = 0; j < (int) obj.entities.size(); j++)
|
for (j = 0; j < (int) obj.entities.size(); j++)
|
||||||
{
|
{
|
||||||
if (obj.entities[j].type == 13)
|
if (obj.entities[j].type == EntityType_TERMINAL)
|
||||||
{
|
{
|
||||||
obj.entities[j].colour = 4;
|
obj.entities[j].colour = 4;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue