1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Rename size to render_type, turn magic numbers into enum

This commit is contained in:
AllyTally 2023-09-02 18:18:08 -03:00 committed by NyakoFox
parent f926ebd080
commit 4bf2d23b34
9 changed files with 107 additions and 90 deletions

View file

@ -13,7 +13,7 @@ void entclass::clear(void)
{ {
invis = false; invis = false;
type = EntityType_PLAYER; type = EntityType_PLAYER;
size = 0; render_type = EntityRenderType_SPRITE;
tile = 0; tile = 0;
rule = 0; rule = 0;
state = 0; state = 0;
@ -377,22 +377,22 @@ void entclass::settreadmillcolour( int rx, int ry )
void entclass::updatecolour(void) void entclass::updatecolour(void)
{ {
switch (size) switch (render_type)
{ {
case 0: // Sprites case EntityRenderType_SPRITE: // Sprites
case 7: // Teleporter case EntityRenderType_TELEPORTER: // Teleporter
case 9: // Really Big Sprite! (2x2) case EntityRenderType_SPRITE_2x2: // Really Big Sprite! (2x2)
case 10: // 2x1 Sprite case EntityRenderType_SPRITE_2x1: // 2x1 Sprite
case 13: // Special for epilogue: huge hero! case EntityRenderType_SPRITE_6x: // Special for epilogue: huge hero!
realcol = graphics.getcol(colour); realcol = graphics.getcol(colour);
break; break;
case 3: // Big chunky pixels! case EntityRenderType_PARTICLE: // Big chunky pixels!
realcol = graphics.bigchunkygetcol(colour); realcol = graphics.bigchunkygetcol(colour);
break; break;
case 4: // Small pickups case EntityRenderType_COIN: // Small pickups
realcol = graphics.huetilegetcol(); realcol = graphics.huetilegetcol();
break; break;
case 11: // The fucking elephant case EntityRenderType_ELEPHANT: // The fucking elephant
if (game.noflashingmode) if (game.noflashingmode)
{ {
realcol = graphics.getcol(22); realcol = graphics.getcol(22);
@ -402,7 +402,7 @@ void entclass::updatecolour(void)
realcol = graphics.getcol(colour); realcol = graphics.getcol(colour);
} }
break; break;
case 12: // Regular sprites that don't wrap case EntityRenderType_SPRITE_NO_WRAP: // Regular sprites that don't wrap
// if we're outside the screen, we need to draw indicators // if we're outside the screen, we need to draw indicators
if ((xp < -20 && vx > 0) || (xp > 340 && vx < 0)) if ((xp < -20 && vx > 0) || (xp > 340 && vx < 0))
{ {

View file

@ -33,6 +33,25 @@ enum EntityType
EntityType_TELEPORTER = 100 EntityType_TELEPORTER = 100
}; };
enum EntityRenderType
{
EntityRenderType_INVALID = -1,
EntityRenderType_SPRITE,
EntityRenderType_TILE,
EntityRenderType_PLATFORM,
EntityRenderType_PARTICLE,
EntityRenderType_COIN,
EntityRenderType_HORIZONTAL_LINE,
EntityRenderType_VERTICAL_LINE,
EntityRenderType_TELEPORTER,
EntityRenderType_PLATFORM_LONG,
EntityRenderType_SPRITE_2x2,
EntityRenderType_SPRITE_2x1,
EntityRenderType_ELEPHANT,
EntityRenderType_SPRITE_NO_WRAP,
EntityRenderType_SPRITE_6x
};
class entclass class entclass
{ {
public: public:
@ -55,7 +74,8 @@ public:
//Fundamentals //Fundamentals
bool invis; bool invis;
EntityType type; EntityType type;
int size, tile, rule; EntityRenderType render_type;
int tile, rule;
int state, statedelay; int state, statedelay;
int behave, animate; int behave, animate;
float para; float para;

View file

@ -118,7 +118,7 @@ EnemyType* entityclass::create_type(const char* type, int tile, int colour, int
enemy_type.corner_y = 0; enemy_type.corner_y = 0;
enemy_type.x_offset = 0; enemy_type.x_offset = 0;
enemy_type.y_offset = 0; enemy_type.y_offset = 0;
enemy_type.size = 0; enemy_type.render_type = EntityRenderType_SPRITE;
enemy_type.override_behave = false; enemy_type.override_behave = false;
enemy_type.override_para = false; enemy_type.override_para = false;
enemy_type.override_x1 = false; enemy_type.override_x1 = false;
@ -177,9 +177,9 @@ void entityclass::add_default_types(void)
type = create_type("soldier", 82, 8, 5, 28, 32); // Brass Sent Us Under The Top type = create_type("soldier", 82, 8, 5, 28, 32); // Brass Sent Us Under The Top
type->corner_x = 4; type->corner_x = 4;
type = create_type("truth", 64, 7, 100, 44, 10); // Boldly To Go type = create_type("truth", 64, 7, 100, 44, 10); // Boldly To Go
type->size = 10; type->render_type = EntityRenderType_SPRITE_2x1;
type = create_type("bus", 96, 6, 4, 64, 44); // B-B-B-Busted type = create_type("bus", 96, 6, 4, 64, 44); // B-B-B-Busted
type->size = 9; type->render_type = EntityRenderType_SPRITE_2x2;
type = create_type("transmitter", 104, 4, 7, 16, 16); // Comms Relay type = create_type("transmitter", 104, 4, 7, 16, 16); // Comms Relay
type->harmful = false; type->harmful = false;
@ -191,15 +191,15 @@ void entityclass::add_default_types(void)
type->x_offset = -4; type->x_offset = -4;
type->y_offset = -32; type->y_offset = -32;
type->corner_x = 4; type->corner_x = 4;
type->size = 9; type->render_type = EntityRenderType_SPRITE_2x2;
create_type("edgegames_left", 160, 8, 1, 16, 16); // Edge Games create_type("edgegames_left", 160, 8, 1, 16, 16); // Edge Games
create_type("edgegames_right", 156, 8, 1, 16, 16); // Edge Games create_type("edgegames_right", 156, 8, 1, 16, 16); // Edge Games
type = create_type("centipede_right", 66, 12, 100, 60, 16); // Sweeney's Maze type = create_type("centipede_right", 66, 12, 100, 60, 16); // Sweeney's Maze
type->size = 10; type->render_type = EntityRenderType_SPRITE_2x1;
type = create_type("centipede_left", 54, 12, 100, 60, 16); // Sweeney's Maze type = create_type("centipede_left", 54, 12, 100, 60, 16); // Sweeney's Maze
type->size = 10; type->render_type = EntityRenderType_SPRITE_2x1;
// LIES // LIES
type = create_type("lies_emitter", 60, 6, 2, 32, 32); type = create_type("lies_emitter", 60, 6, 2, 32, 32);
@ -226,7 +226,7 @@ void entityclass::add_default_types(void)
// Factory // Factory
type = create_type("factory_emitter", 72, 6, 3, 64, 40); type = create_type("factory_emitter", 72, 6, 3, 64, 40);
type->corner_y = 24; type->corner_y = 24;
type->size = 9; type->render_type = EntityRenderType_SPRITE_2x2;
type->behave = 12; type->behave = 12;
type->override_behave = true; type->override_behave = true;
type = create_type("factory_clouds", 76, 6, 100, 32, 12); type = create_type("factory_clouds", 76, 6, 100, 32, 12);
@ -245,7 +245,7 @@ void entityclass::add_default_types(void)
// Elephant // Elephant
type = create_type("elephant", 0, 102, 0, 464, 320); type = create_type("elephant", 0, 102, 0, 464, 320);
type->size = 11; type->render_type = EntityRenderType_ELEPHANT;
type->harmful = false; type->harmful = false;
} }
@ -270,7 +270,7 @@ void entityclass::set_enemy_type(entclass* entity, const char* type)
entity->lerpoldxp += enemyType->x_offset; entity->lerpoldxp += enemyType->x_offset;
entity->yp += enemyType->y_offset; entity->yp += enemyType->y_offset;
entity->lerpoldyp += enemyType->y_offset; entity->lerpoldyp += enemyType->y_offset;
entity->size = enemyType->size; entity->render_type = enemyType->render_type;
if (enemyType->colour != -1) if (enemyType->colour != -1)
{ {
@ -1507,7 +1507,7 @@ bool entityclass::disableentity(int t)
} }
entities[t].invis = true; entities[t].invis = true;
entities[t].size = -1; entities[t].render_type = EntityRenderType_INVALID;
entities[t].type = EntityType_INVALID; entities[t].type = EntityType_INVALID;
entities[t].rule = -1; entities[t].rule = -1;
entities[t].isplatform = false; entities[t].isplatform = false;
@ -1617,7 +1617,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
for (size_t i = 0; i < entities.size(); ++i) for (size_t i = 0; i < entities.size(); ++i)
{ {
if (entities[i].invis if (entities[i].invis
&& entities[i].size == -1 && entities[i].render_type == EntityRenderType_INVALID
&& entities[i].type == EntityType_INVALID && entities[i].type == EntityType_INVALID
&& entities[i].rule == -1 && entities[i].rule == -1
&& !entities[i].isplatform) && !entities[i].isplatform)
@ -1637,20 +1637,20 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
entptr->clear(); entptr->clear();
} }
//Size 0 is a sprite // Size 0 is a sprite
//Size 1 is a tile // Size 1 is a tile
//Beyond that are special cases (to do) // Beyond that are special cases (to do)
//Size 2 is a moving platform of width 4 (32) // Size 2 is a moving platform of width 4 (32)
//Size 3 is apparently a "bug chunky pixel" // Size 3 is apparently a "bug chunky pixel"
//Size 4 is a coin/small pickup // Size 4 is a coin/small pickup
//Size 5 is a horizontal line, 6 is vertical // Size 5 is a horizontal line, 6 is vertical
//Rule 0 is the playable character // Rule 0 is the playable character
//Rule 1 is anything harmful // Rule 1 is anything harmful
//Rule 2 is anything decorative (no collisions) // Rule 2 is anything decorative (no collisions)
//Rule 3 is anything that results in an entity to entity collision and state change // Rule 3 is anything that results in an entity to entity collision and state change
//Rule 4 is a horizontal line, 5 is vertical // Rule 4 is a horizontal line, 5 is vertical
//Rule 6 is a crew member // Rule 6 is a crew member
entclass& entity = *entptr; entclass& entity = *entptr;
entity.xp = xp; entity.xp = xp;
@ -1716,7 +1716,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
case 2: //A moving platform case 2: //A moving platform
entity.rule = 2; entity.rule = 2;
entity.type = EntityType_MOVING; entity.type = EntityType_MOVING;
entity.size = 2; entity.render_type = EntityRenderType_PLATFORM;
entity.tile = 1; entity.tile = 1;
if (customplatformtile > 0){ if (customplatformtile > 0){
@ -1747,7 +1747,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
entity.w = 64; entity.w = 64;
entity.h = 8; entity.h = 8;
meta1 -= 2; meta1 -= 2;
entity.size = 8; entity.render_type = EntityRenderType_PLATFORM_LONG;
} }
entity.behave = meta1; entity.behave = meta1;
@ -1784,7 +1784,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
case 3: //Disappearing platforms case 3: //Disappearing platforms
entity.rule = 3; entity.rule = 3;
entity.type = EntityType_DISAPPEARING_PLATFORM; entity.type = EntityType_DISAPPEARING_PLATFORM;
entity.size = 2; entity.render_type = EntityRenderType_PLATFORM;
entity.tile = 2; entity.tile = 2;
//appearance again depends on location //appearance again depends on location
if(customplatformtile>0) if(customplatformtile>0)
@ -1814,7 +1814,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
case 4: //Breakable blocks case 4: //Breakable blocks
entity.rule = 6; entity.rule = 6;
entity.type = EntityType_QUICKSAND; entity.type = EntityType_QUICKSAND;
entity.size = 1; entity.render_type = EntityRenderType_TILE;
entity.tile = 10; entity.tile = 10;
entity.cy = -1; entity.cy = -1;
entity.w = 8; entity.w = 8;
@ -1829,7 +1829,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
case 5: //Gravity Tokens case 5: //Gravity Tokens
entity.rule = 3; entity.rule = 3;
entity.type = EntityType_GRAVITY_TOKEN; entity.type = EntityType_GRAVITY_TOKEN;
entity.size = 0; entity.render_type = EntityRenderType_SPRITE;
entity.tile = 11; entity.tile = 11;
entity.w = 16; entity.w = 16;
entity.h = 16; entity.h = 16;
@ -1842,7 +1842,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
entity.rule = 2; entity.rule = 2;
entity.type = EntityType_PARTICLE; //Particles entity.type = EntityType_PARTICLE; //Particles
entity.colour = 1; entity.colour = 1;
entity.size = 3; entity.render_type = EntityRenderType_PARTICLE;
entity.vx = meta1; entity.vx = meta1;
entity.vy = meta2; entity.vy = meta2;
@ -1852,7 +1852,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
entity.rule = 2; entity.rule = 2;
entity.type = EntityType_PARTICLE; //Particles entity.type = EntityType_PARTICLE; //Particles
entity.colour = 2; entity.colour = 2;
entity.size = 3; entity.render_type = EntityRenderType_PARTICLE;
entity.vx = meta1; entity.vx = meta1;
entity.vy = meta2; entity.vy = meta2;
@ -1861,7 +1861,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
case 8: //Small collectibles case 8: //Small collectibles
entity.rule = 3; entity.rule = 3;
entity.type = EntityType_COIN; entity.type = EntityType_COIN;
entity.size = 4; entity.render_type = EntityRenderType_COIN;
entity.tile = 48; entity.tile = 48;
entity.w = 8; entity.w = 8;
entity.h = 8; entity.h = 8;
@ -1875,7 +1875,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
case 9: //Something Shiny case 9: //Something Shiny
entity.rule = 3; entity.rule = 3;
entity.type = EntityType_TRINKET; entity.type = EntityType_TRINKET;
entity.size = 0; entity.render_type = EntityRenderType_SPRITE;
entity.tile = 22; entity.tile = 22;
entity.w = 16; entity.w = 16;
entity.h = 16; entity.h = 16;
@ -1890,7 +1890,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
case 10: //Savepoint case 10: //Savepoint
entity.rule = 3; entity.rule = 3;
entity.type = EntityType_CHECKPOINT; entity.type = EntityType_CHECKPOINT;
entity.size = 0; entity.render_type = EntityRenderType_SPRITE;
entity.tile = 20 + meta1; entity.tile = 20 + meta1;
entity.w = 16; entity.w = 16;
entity.h = 16; entity.h = 16;
@ -1913,7 +1913,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
case 11: //Horizontal Gravity Line case 11: //Horizontal Gravity Line
entity.rule = 4; entity.rule = 4;
entity.type = EntityType_HORIZONTAL_GRAVITY_LINE; entity.type = EntityType_HORIZONTAL_GRAVITY_LINE;
entity.size = 5; entity.render_type = EntityRenderType_HORIZONTAL_LINE;
entity.life = 0; entity.life = 0;
entity.w = meta1; entity.w = meta1;
entity.h = 1; entity.h = 1;
@ -1922,7 +1922,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
case 12: //Vertical Gravity Line case 12: //Vertical Gravity Line
entity.rule = 5; entity.rule = 5;
entity.type = EntityType_VERTICAL_GRAVITY_LINE; entity.type = EntityType_VERTICAL_GRAVITY_LINE;
entity.size = 6; entity.render_type = EntityRenderType_VERTICAL_LINE;
entity.life = 0; entity.life = 0;
entity.w = 1; entity.w = 1;
entity.h = meta1; entity.h = meta1;
@ -1932,7 +1932,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
case 13: //Warp token case 13: //Warp token
entity.rule = 3; entity.rule = 3;
entity.type = EntityType_WARP_TOKEN; entity.type = EntityType_WARP_TOKEN;
entity.size = 0; entity.render_type = EntityRenderType_SPRITE;
entity.tile = 18; entity.tile = 18;
entity.w = 16; entity.w = 16;
entity.h = 16; entity.h = 16;
@ -1946,7 +1946,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
case 14: // Teleporter case 14: // Teleporter
entity.rule = 3; entity.rule = 3;
entity.type = EntityType_TELEPORTER; entity.type = EntityType_TELEPORTER;
entity.size = 7; entity.render_type = EntityRenderType_TELEPORTER;
entity.tile = 1; //inactive entity.tile = 1; //inactive
entity.w = 96; entity.w = 96;
entity.h = 96; entity.h = 96;
@ -2047,7 +2047,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
case 20: //Terminal case 20: //Terminal
entity.rule = 3; entity.rule = 3;
entity.type = EntityType_TERMINAL; entity.type = EntityType_TERMINAL;
entity.size = 0; entity.render_type = EntityRenderType_SPRITE;
entity.tile = 16 + meta1; entity.tile = 16 + meta1;
entity.w = 16; entity.w = 16;
entity.h = 16; entity.h = 16;
@ -2059,7 +2059,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
case 21: //as above, except doesn't highlight case 21: //as above, except doesn't highlight
entity.rule = 3; entity.rule = 3;
entity.type = EntityType_TERMINAL; entity.type = EntityType_TERMINAL;
entity.size = 0; entity.render_type = EntityRenderType_SPRITE;
entity.tile = 16 + meta1; entity.tile = 16 + meta1;
entity.w = 16; entity.w = 16;
entity.h = 16; entity.h = 16;
@ -2071,7 +2071,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
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 = EntityType_TRINKET; entity.type = EntityType_TRINKET;
entity.size = 0; entity.render_type = EntityRenderType_SPRITE;
entity.tile = 22; entity.tile = 22;
entity.w = 16; entity.w = 16;
entity.h = 16; entity.h = 16;
@ -2102,7 +2102,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
entity.harmful = true; entity.harmful = true;
//initilise tiles here based on behavior //initilise tiles here based on behavior
entity.size = 12; //don't wrap around entity.render_type = EntityRenderType_SPRITE_NO_WRAP; //don't wrap around
entity.colour = 21; entity.colour = 21;
entity.tile = 78; //default case entity.tile = 78; //default case
entity.animate = 1; entity.animate = 1;
@ -2158,7 +2158,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
case 25: //Trophies case 25: //Trophies
entity.rule = 3; entity.rule = 3;
entity.type = EntityType_TROPHY; entity.type = EntityType_TROPHY;
entity.size = 0; entity.render_type = EntityRenderType_SPRITE;
entity.w = 16; entity.w = 16;
entity.h = 16; entity.h = 16;
entity.colour = 4; entity.colour = 4;
@ -2321,7 +2321,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
{ {
entity.tile = 3; entity.tile = 3;
entity.colour = 102; entity.colour = 102;
entity.size = 13; entity.render_type = EntityRenderType_SPRITE_6x;
entity.xp -= 64; entity.xp -= 64;
entity.yp -= 128; entity.yp -= 128;
} }
@ -2333,7 +2333,6 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
case 26: //Epilogue super warp token case 26: //Epilogue super warp token
entity.rule = 3; entity.rule = 3;
entity.type = EntityType_WARP_TOKEN; entity.type = EntityType_WARP_TOKEN;
entity.size = 0;
entity.tile = 18; entity.tile = 18;
entity.w = 16; entity.w = 16;
entity.h = 16; entity.h = 16;
@ -2341,7 +2340,7 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
entity.onentity = 0; entity.onentity = 0;
entity.animate = 100; entity.animate = 100;
entity.para = meta2; entity.para = meta2;
entity.size = 13; entity.render_type = EntityRenderType_SPRITE_6x;
break; break;
/* Warp lines */ /* Warp lines */
@ -2374,14 +2373,14 @@ entclass* entityclass::createentity(int xp, int yp, int t, int meta1, int meta2,
case 51: case 51:
case 52: case 52:
entity.rule = 5; entity.rule = 5;
entity.size = 6; entity.render_type = EntityRenderType_VERTICAL_LINE;
entity.w = 1; entity.w = 1;
entity.h = meta1; entity.h = meta1;
break; break;
case 53: case 53:
case 54: case 54:
entity.rule = 7; entity.rule = 7;
entity.size = 5; entity.render_type = EntityRenderType_HORIZONTAL_LINE;
entity.w = meta1; entity.w = meta1;
entity.h = 1; entity.h = 1;
break; break;
@ -4256,7 +4255,7 @@ int entityclass::getlineat( int t )
//Get the entity which is a horizontal line at height t (for SWN game) //Get the entity which is a horizontal line at height t (for SWN game)
for (size_t i = 0; i < entities.size(); i++) for (size_t i = 0; i < entities.size(); i++)
{ {
if (entities[i].size == 5) if (entities[i].render_type == EntityRenderType_HORIZONTAL_LINE)
{ {
if (entities[i].yp == t) if (entities[i].yp == t)
{ {
@ -5101,7 +5100,7 @@ void entityclass::collisioncheck(int i, int j, bool scm /*= false*/)
//person i hits enemy or enemy bullet j //person i hits enemy or enemy bullet j
if (entitycollide(i, j) && !map.invincibility) if (entitycollide(i, j) && !map.invincibility)
{ {
if (entities[i].size == 0 && (entities[j].size == 0 || entities[j].size == 12)) if (entities[i].render_type == EntityRenderType_SPRITE && (entities[j].render_type == EntityRenderType_SPRITE || entities[j].render_type == EntityRenderType_SPRITE_NO_WRAP))
{ {
//They're both sprites, so do a per pixel collision //They're both sprites, so do a per pixel collision
SDL_Point colpoint1; SDL_Point colpoint1;

View file

@ -45,7 +45,7 @@ struct EnemyType
int corner_y; int corner_y;
int x_offset; int x_offset;
int y_offset; int y_offset;
int size; EntityRenderType render_type;
int behave; int behave;
bool override_behave; bool override_behave;
int para; int para;

View file

@ -2091,9 +2091,9 @@ void Graphics::drawentity(const int i, const int yoff)
const int xp = lerp(obj.entities[i].lerpoldxp, obj.entities[i].xp); const int xp = lerp(obj.entities[i].lerpoldxp, obj.entities[i].xp);
const int yp = lerp(obj.entities[i].lerpoldyp, obj.entities[i].yp); const int yp = lerp(obj.entities[i].lerpoldyp, obj.entities[i].yp);
switch (obj.entities[i].size) switch (obj.entities[i].render_type)
{ {
case 0: case EntityRenderType_SPRITE:
{ {
// Sprites // Sprites
tpoint.x = xp; tpoint.x = xp;
@ -2159,7 +2159,7 @@ void Graphics::drawentity(const int i, const int yoff)
} }
break; break;
} }
case 1: case EntityRenderType_TILE:
// Tiles // Tiles
tpoint.x = xp; tpoint.x = xp;
tpoint.y = yp - yoff; tpoint.y = yp - yoff;
@ -2169,15 +2169,15 @@ void Graphics::drawentity(const int i, const int yoff)
draw_grid_tile(grphx.im_tiles, obj.entities[i].drawframe, drawRect.x, drawRect.y, 8, 8); draw_grid_tile(grphx.im_tiles, obj.entities[i].drawframe, drawRect.x, drawRect.y, 8, 8);
break; break;
case 2: case EntityRenderType_PLATFORM:
case 8: case EntityRenderType_PLATFORM_LONG:
{ {
// Special: Moving platform, 4 tiles or 8 tiles // Special: Moving platform, 4 tiles or 8 tiles
tpoint.x = xp; tpoint.x = xp;
tpoint.y = yp - yoff; tpoint.y = yp - yoff;
int thiswidth = 4; int thiswidth = 4;
if (obj.entities[i].size == 8) if (obj.entities[i].render_type == EntityRenderType_PLATFORM_LONG)
{ {
thiswidth = 8; thiswidth = 8;
} }
@ -2198,16 +2198,16 @@ void Graphics::drawentity(const int i, const int yoff)
} }
break; break;
} }
case 3: // Big chunky pixels! case EntityRenderType_PARTICLE: // Big chunky pixels!
fill_rect(xp, yp - yoff, 4, 4, obj.entities[i].realcol); fill_rect(xp, yp - yoff, 4, 4, obj.entities[i].realcol);
break; break;
case 4: // Small pickups case EntityRenderType_COIN: // Small pickups
{ {
const SDL_Color color = obj.entities[i].realcol; const SDL_Color color = obj.entities[i].realcol;
drawcoloredtile(xp, yp - yoff, obj.entities[i].tile, color.r, color.g, color.b); drawcoloredtile(xp, yp - yoff, obj.entities[i].tile, color.r, color.g, color.b);
break; break;
} }
case 5: // Horizontal Line case EntityRenderType_HORIZONTAL_LINE: // Horizontal Line
{ {
int oldw = obj.entities[i].w; int oldw = obj.entities[i].w;
if ((game.swngame == SWN_START_GRAVITRON_STEP_2 || kludgeswnlinewidth) if ((game.swngame == SWN_START_GRAVITRON_STEP_2 || kludgeswnlinewidth)
@ -2218,16 +2218,13 @@ void Graphics::drawentity(const int i, const int yoff)
drawgravityline(i, xp, yp - yoff, lerp(oldw, obj.entities[i].w) - 1, 0); drawgravityline(i, xp, yp - yoff, lerp(oldw, obj.entities[i].w) - 1, 0);
break; break;
} }
case 6: // Vertical Line case EntityRenderType_VERTICAL_LINE: // Vertical Line
drawgravityline(i, xp, yp - yoff, 0, obj.entities[i].h - 1); drawgravityline(i, xp, yp - yoff, 0, obj.entities[i].h - 1);
break; break;
case 7: // Teleporter case EntityRenderType_TELEPORTER: // Teleporter
drawtele(xp, yp - yoff, obj.entities[i].drawframe, obj.entities[i].realcol); drawtele(xp, yp - yoff, obj.entities[i].drawframe, obj.entities[i].realcol);
break; break;
// case 8: // Special: Moving platform, 8 tiles case EntityRenderType_SPRITE_2x2: // Really Big Sprite! (2x2)
// Note: This code is in the 4-tile code
break;
case 9: // Really Big Sprite! (2x2)
{ {
const SDL_Color ct = obj.entities[i].realcol; const SDL_Color ct = obj.entities[i].realcol;
@ -2268,7 +2265,7 @@ void Graphics::drawentity(const int i, const int yoff)
draw_grid_tile(sprites, obj.entities[i].drawframe + 13, drawRect.x, drawRect.y, 32, 32, ct); draw_grid_tile(sprites, obj.entities[i].drawframe + 13, drawRect.x, drawRect.y, 32, 32, ct);
break; break;
} }
case 10: // 2x1 Sprite case EntityRenderType_SPRITE_2x1: // 2x1 Sprite
{ {
const SDL_Color ct = obj.entities[i].realcol; const SDL_Color ct = obj.entities[i].realcol;
@ -2291,10 +2288,10 @@ void Graphics::drawentity(const int i, const int yoff)
draw_grid_tile(sprites, obj.entities[i].drawframe + 1, drawRect.x, drawRect.y, 32, 32, ct); draw_grid_tile(sprites, obj.entities[i].drawframe + 1, drawRect.x, drawRect.y, 32, 32, ct);
break; break;
} }
case 11: // The fucking elephant case EntityRenderType_ELEPHANT: // The fucking elephant
drawimagecol(IMAGE_ELEPHANT, xp, yp - yoff, obj.entities[i].realcol); drawimagecol(IMAGE_ELEPHANT, xp, yp - yoff, obj.entities[i].realcol);
break; break;
case 12: // Regular sprites that don't wrap case EntityRenderType_SPRITE_NO_WRAP: // Regular sprites that don't wrap
{ {
tpoint.x = xp; tpoint.x = xp;
tpoint.y = yp - yoff; tpoint.y = yp - yoff;
@ -2350,7 +2347,7 @@ void Graphics::drawentity(const int i, const int yoff)
} }
break; break;
} }
case 13: case EntityRenderType_SPRITE_6x:
{ {
// Special for epilogue: huge hero! // Special for epilogue: huge hero!
draw_grid_tile(grphx.im_sprites, obj.entities[i].drawframe, xp, yp - yoff, sprites_rect.w, sprites_rect.h, obj.entities[i].realcol, 6, 6); draw_grid_tile(grphx.im_sprites, obj.entities[i].drawframe, xp, yp - yoff, sprites_rect.w, sprites_rect.h, obj.entities[i].realcol, 6, 6);

View file

@ -382,7 +382,7 @@ namespace level_debugger
line++; line++;
render_info(line++, "Tile", help.String(entity->tile)); render_info(line++, "Tile", help.String(entity->tile));
render_info(line++, "Draw Frame", help.String(entity->drawframe)); render_info(line++, "Draw Frame", help.String(entity->drawframe));
render_info(line++, "Size", help.String(entity->size)); //render_info(line++, "Size", help.String(entity->size));
render_info(line++, "Direction", help.String(entity->dir)); render_info(line++, "Direction", help.String(entity->dir));
line++; line++;

View file

@ -1040,7 +1040,7 @@ void gamelogic(void)
|| obj.entities[i].type == EntityType_WARP_LINE_RIGHT || obj.entities[i].type == EntityType_WARP_LINE_RIGHT
|| obj.entities[i].type == EntityType_WARP_LINE_TOP || obj.entities[i].type == EntityType_WARP_LINE_TOP
|| obj.entities[i].type == EntityType_WARP_LINE_BOTTOM /* Don't warp warp lines */ || 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].render_type == EntityRenderType_SPRITE_NO_WRAP) /* Don't warp gravitron squares */
{ {
continue; continue;
} }

View file

@ -818,7 +818,7 @@ void mapclass::resetplayer(const bool player_died)
} }
if (!GlitchrunnerMode_less_than_or_equal(Glitchrunner2_2)) if (!GlitchrunnerMode_less_than_or_equal(Glitchrunner2_2))
{ {
obj.entities[i].size = 0; obj.entities[i].render_type = EntityRenderType_SPRITE;
obj.entities[i].cx = 6; obj.entities[i].cx = 6;
obj.entities[i].cy = 2; obj.entities[i].cy = 2;
obj.entities[i].w = 12; obj.entities[i].w = 12;

View file

@ -8,6 +8,7 @@
#include "Constants.h" #include "Constants.h"
#include "CustomLevels.h" #include "CustomLevels.h"
#include "Editor.h" #include "Editor.h"
#include "Ent.h"
#include "Entity.h" #include "Entity.h"
#include "Enums.h" #include "Enums.h"
#include "Exit.h" #include "Exit.h"
@ -909,7 +910,7 @@ void scriptclass::run(void)
obj.entities[i].yp = 46; obj.entities[i].yp = 46;
obj.entities[i].lerpoldxp = obj.entities[i].xp; obj.entities[i].lerpoldxp = obj.entities[i].xp;
obj.entities[i].lerpoldyp = obj.entities[i].yp; obj.entities[i].lerpoldyp = obj.entities[i].yp;
obj.entities[i].size = 13; obj.entities[i].render_type = EntityRenderType_SPRITE_6x;
obj.entities[i].colour = 23; obj.entities[i].colour = 23;
obj.entities[i].cx = 36;// 6; obj.entities[i].cx = 36;// 6;
obj.entities[i].cy = 12+80;// 2; obj.entities[i].cy = 12+80;// 2;
@ -924,7 +925,7 @@ void scriptclass::run(void)
{ {
obj.entities[i].xp = 100; obj.entities[i].xp = 100;
obj.entities[i].lerpoldxp = obj.entities[i].xp; obj.entities[i].lerpoldxp = obj.entities[i].xp;
obj.entities[i].size = 0; obj.entities[i].render_type = EntityRenderType_SPRITE;
obj.entities[i].colour = 0; obj.entities[i].colour = 0;
obj.entities[i].cx = 6; obj.entities[i].cx = 6;
obj.entities[i].cy = 2; obj.entities[i].cy = 2;
@ -2627,7 +2628,7 @@ void scriptclass::startgamemode(const enum StartMode mode)
struct struct
{ {
bool initialized; bool initialized;
int size; EntityRenderType render_type;
int cx; int cx;
int cy; int cy;
int w; int w;
@ -2644,7 +2645,7 @@ void scriptclass::startgamemode(const enum StartMode mode)
{ {
const entclass* player = &obj.entities[player_idx]; const entclass* player = &obj.entities[player_idx];
player_hitbox.initialized = true; player_hitbox.initialized = true;
player_hitbox.size = player->size; player_hitbox.render_type = player->render_type;
player_hitbox.cx = player->cx; player_hitbox.cx = player->cx;
player_hitbox.cy = player->cy; player_hitbox.cy = player->cy;
player_hitbox.w = player->w; player_hitbox.w = player->w;
@ -2997,7 +2998,7 @@ void scriptclass::startgamemode(const enum StartMode mode)
if (INBOUNDS_VEC(player_idx, obj.entities)) if (INBOUNDS_VEC(player_idx, obj.entities))
{ {
entclass* player = &obj.entities[player_idx]; entclass* player = &obj.entities[player_idx];
player->size = player_hitbox.size; player->render_type = player_hitbox.render_type;
player->cx = player_hitbox.cx; player->cx = player_hitbox.cx;
player->cy = player_hitbox.cy; player->cy = player_hitbox.cy;
player->w = player_hitbox.w; player->w = player_hitbox.w;