Files
VVVVVV/desktop_version/src/Ent.h
T
NyakoFox 0e9c4f98a6 Replace colour IDs with an enum
Entity colors are just integers. Their colour ID gets passed through a
big switch, returning different RGB values depending on the colour ID
(and can also get affected by randomness or other game state.)

But because of this, there's a bunch of random numbers floating around,
with no actual description on what they are other than comments which,
while most of the time are accurate, only exist in the switch.

To fix this, this commit adds a new enum which labels every colour.
While we can't use it as a type (as we need to allow colours outside of
what are defined, in case people want a "pure white", and scripting can
set any colour ID they want), colours have to stay as `int`.
2025-04-21 20:09:57 -04:00

91 lines
2.0 KiB
C++

#ifndef ENT_H
#define ENT_H
#include <SDL.h>
#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
{
public:
entclass(void);
void clear(void);
bool outside(void);
void setenemy(int t);
void setenemyroom(int rx, int ry);
void settreadmillcolour(int rx, int ry);
void updatecolour(void);
bool ishumanoid(void);
public:
//Fundamentals
bool invis;
EntityType type;
int size, tile, rule;
int state, statedelay;
int behave, animate;
float para;
int life;
int colour; // As out-of-bounds colours are allowed, this should be an int instead of an EnemyColour.
//Position and velocity
int oldxp, oldyp;
float ax, ay, vx, vy;
int cx, cy, w, h;
float newxp, newyp;
bool isplatform;
int x1,y1,x2,y2;
//Collision Rules
int onentity;
bool harmful;
int onwall, onxwall, onywall;
//Platforming specific
bool gravity;
int onground, onroof;
//Animation
int framedelay, drawframe, walkingframe, dir, actionframe;
int collisionframedelay, collisiondrawframe, collisionwalkingframe;
int visualonground, visualonroof;
int yp;int xp;
SDL_Color realcol;
int lerpoldxp, lerpoldyp;
};
#endif /* ENT_H */