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

Rename edlevelclass to RoomProperty

That's what edlevelclass is... so that's what it should be named. (Also
removes that "ed", too, making this less coupled to the in-game editor.)

Unfortunately, for compatibility reasons, the name of the XML element
will still remain the same.
This commit is contained in:
Misa 2021-02-20 15:45:48 -08:00 committed by Misa Elizabeth Kai
parent 86b47878f9
commit d549a535e0
7 changed files with 40 additions and 39 deletions

View file

@ -35,7 +35,7 @@
#include <inttypes.h> #include <inttypes.h>
#endif #endif
edlevelclass::edlevelclass(void) RoomProperty::RoomProperty(void)
{ {
tileset=0; tileset=0;
tilecol=0; tilecol=0;
@ -464,7 +464,7 @@ int customlevelclass::getenemycol(int t)
int customlevelclass::getwarpbackground(int rx, int ry) int customlevelclass::getwarpbackground(int rx, int ry)
{ {
const edlevelclass* const room = getroomprop(rx, ry); const RoomProperty* const room = getroomprop(rx, ry);
switch(room->tileset) switch(room->tileset)
{ {
case 0: //Space Station case 0: //Space Station
@ -786,7 +786,7 @@ int customlevelclass::getroompropidx(const int rx, const int ry)
return rx + ry*maxwidth; return rx + ry*maxwidth;
} }
const edlevelclass* customlevelclass::getroomprop(const int rx, const int ry) const RoomProperty* customlevelclass::getroomprop(const int rx, const int ry)
{ {
const int idx = getroompropidx(rx, ry); const int idx = getroompropidx(rx, ry);
@ -795,7 +795,7 @@ const edlevelclass* customlevelclass::getroomprop(const int rx, const int ry)
return &level[idx]; return &level[idx];
} }
static edlevelclass blank; static RoomProperty blank;
blank.tileset = 1; blank.tileset = 1;
blank.directmode = 1; blank.directmode = 1;
blank.roomname.clear(); blank.roomname.clear();
@ -1400,24 +1400,24 @@ bool customlevelclass::save(std::string& _path)
for(size_t i = 0; i < SDL_arraysize(level); i++) for(size_t i = 0; i < SDL_arraysize(level); i++)
{ {
tinyxml2::XMLElement *edlevelclassElement = doc.NewElement( "edLevelClass" ); tinyxml2::XMLElement *roompropertyElement = doc.NewElement( "edLevelClass" );
edlevelclassElement->SetAttribute( "tileset", level[i].tileset); roompropertyElement->SetAttribute( "tileset", level[i].tileset);
edlevelclassElement->SetAttribute( "tilecol", level[i].tilecol); roompropertyElement->SetAttribute( "tilecol", level[i].tilecol);
edlevelclassElement->SetAttribute( "platx1", level[i].platx1); roompropertyElement->SetAttribute( "platx1", level[i].platx1);
edlevelclassElement->SetAttribute( "platy1", level[i].platy1); roompropertyElement->SetAttribute( "platy1", level[i].platy1);
edlevelclassElement->SetAttribute( "platx2", level[i].platx2); roompropertyElement->SetAttribute( "platx2", level[i].platx2);
edlevelclassElement->SetAttribute( "platy2", level[i].platy2); roompropertyElement->SetAttribute( "platy2", level[i].platy2);
edlevelclassElement->SetAttribute( "platv", temp_platv[i]); roompropertyElement->SetAttribute( "platv", temp_platv[i]);
edlevelclassElement->SetAttribute( "enemyx1", level[i].enemyx1); roompropertyElement->SetAttribute( "enemyx1", level[i].enemyx1);
edlevelclassElement->SetAttribute( "enemyy1", level[i].enemyy1); roompropertyElement->SetAttribute( "enemyy1", level[i].enemyy1);
edlevelclassElement->SetAttribute( "enemyx2", level[i].enemyx2); roompropertyElement->SetAttribute( "enemyx2", level[i].enemyx2);
edlevelclassElement->SetAttribute( "enemyy2", level[i].enemyy2); roompropertyElement->SetAttribute( "enemyy2", level[i].enemyy2);
edlevelclassElement->SetAttribute( "enemytype", level[i].enemytype); roompropertyElement->SetAttribute( "enemytype", level[i].enemytype);
edlevelclassElement->SetAttribute( "directmode", level[i].directmode); roompropertyElement->SetAttribute( "directmode", level[i].directmode);
edlevelclassElement->SetAttribute( "warpdir", level[i].warpdir); roompropertyElement->SetAttribute( "warpdir", level[i].warpdir);
edlevelclassElement->LinkEndChild( doc.NewText( level[i].roomname.c_str() )) ; roompropertyElement->LinkEndChild( doc.NewText( level[i].roomname.c_str() )) ;
msg->LinkEndChild( edlevelclassElement ); msg->LinkEndChild( roompropertyElement );
} }
std::string scriptString; std::string scriptString;
@ -1569,7 +1569,7 @@ void customlevelclass::generatecustomminimap(void)
// Much kudos to Dav999 for saving me a lot of work, because I stole these colors from const.lua in Ved! -Info Teddy // Much kudos to Dav999 for saving me a lot of work, because I stole these colors from const.lua in Ved! -Info Teddy
Uint32 customlevelclass::getonewaycol(const int rx, const int ry) Uint32 customlevelclass::getonewaycol(const int rx, const int ry)
{ {
const edlevelclass* const room = getroomprop(rx, ry); const RoomProperty* const room = getroomprop(rx, ry);
switch (room->tileset) { switch (room->tileset) {
case 0: // Space Station case 0: // Space Station

View file

@ -33,9 +33,10 @@ public:
FOREACH_PROP(enemytype, int) \ FOREACH_PROP(enemytype, int) \
FOREACH_PROP(directmode, int) FOREACH_PROP(directmode, int)
class edlevelclass{ class RoomProperty
{
public: public:
edlevelclass(void); RoomProperty(void);
#define FOREACH_PROP(NAME, TYPE) TYPE NAME; #define FOREACH_PROP(NAME, TYPE) TYPE NAME;
ROOM_PROPERTIES ROOM_PROPERTIES
#undef FOREACH_PROP #undef FOREACH_PROP
@ -119,7 +120,7 @@ public:
int getabstile(const int x, const int y); int getabstile(const int x, const int y);
int getroompropidx(const int rx, const int ry); int getroompropidx(const int rx, const int ry);
const edlevelclass* getroomprop(const int rx, const int ry); const RoomProperty* getroomprop(const int rx, const int ry);
#define FOREACH_PROP(NAME, TYPE) \ #define FOREACH_PROP(NAME, TYPE) \
void setroom##NAME(const int rx, const int ry, const TYPE NAME); void setroom##NAME(const int rx, const int ry, const TYPE NAME);
ROOM_PROPERTIES ROOM_PROPERTIES
@ -149,8 +150,8 @@ public:
int vmult[30 * maxheight]; int vmult[30 * maxheight];
int numtrinkets(void); int numtrinkets(void);
int numcrewmates(void); int numcrewmates(void);
edlevelclass level[numrooms]; //Maxwidth*maxheight RoomProperty level[numrooms]; //Maxwidth*maxheight
int levmusic; int levmusic;
int mapwidth, mapheight; //Actual width and height of stage int mapwidth, mapheight; //Actual width and height of stage

View file

@ -474,7 +474,7 @@ static void editormenurender(int tr, int tg, int tb)
void editorrender(void) void editorrender(void)
{ {
extern editorclass ed; extern editorclass ed;
const edlevelclass* const room = cl.getroomprop(ed.levx, ed.levy); const RoomProperty* const room = cl.getroomprop(ed.levx, ed.levy);
//Draw grid //Draw grid
@ -1545,7 +1545,7 @@ void editorrender(void)
void editorrenderfixed(void) void editorrenderfixed(void)
{ {
extern editorclass ed; extern editorclass ed;
const edlevelclass* const room = cl.getroomprop(ed.levx, ed.levy); const RoomProperty* const room = cl.getroomprop(ed.levx, ed.levy);
graphics.updatetitlecolours(); graphics.updatetitlecolours();
game.customcol=cl.getlevelcol(room->tileset, room->tilecol)+1; game.customcol=cl.getlevelcol(room->tileset, room->tilecol)+1;
@ -3716,7 +3716,7 @@ void editorclass::placetilelocal( int x, int y, int t )
int editorclass::base( int x, int y ) int editorclass::base( int x, int y )
{ {
//Return the base tile for the given tileset and colour //Return the base tile for the given tileset and colour
const edlevelclass* const room = cl.getroomprop(x, y); const RoomProperty* const room = cl.getroomprop(x, y);
if(room->tileset==0) //Space Station if(room->tileset==0) //Space Station
{ {
if(room->tilecol>=22) if(room->tilecol>=22)
@ -3754,7 +3754,7 @@ int editorclass::base( int x, int y )
int editorclass::backbase( int x, int y ) int editorclass::backbase( int x, int y )
{ {
//Return the base tile for the background of the given tileset and colour //Return the base tile for the background of the given tileset and colour
const edlevelclass* const room = cl.getroomprop(x, y); const RoomProperty* const room = cl.getroomprop(x, y);
if(room->tileset==0) //Space Station if(room->tileset==0) //Space Station
{ {
//Pick depending on tilecol //Pick depending on tilecol
@ -4212,7 +4212,7 @@ void editorclass::switch_tilecol(const bool reversed)
void editorclass::clamp_tilecol(const int rx, const int ry, const bool wrap) void editorclass::clamp_tilecol(const int rx, const int ry, const bool wrap)
{ {
const edlevelclass* const room = cl.getroomprop(rx, ry); const RoomProperty* const room = cl.getroomprop(rx, ry);
const int tileset = room->tileset; const int tileset = room->tileset;
int tilecol = room->tilecol; int tilecol = room->tilecol;
@ -4256,7 +4256,7 @@ void editorclass::clamp_tilecol(const int rx, const int ry, const bool wrap)
void editorclass::switch_enemy(const bool reversed) void editorclass::switch_enemy(const bool reversed)
{ {
const edlevelclass* const room = cl.getroomprop(levx, levy); const RoomProperty* const room = cl.getroomprop(levx, levy);
int enemy = room->enemytype; int enemy = room->enemytype;
@ -4280,7 +4280,7 @@ void editorclass::switch_enemy(const bool reversed)
void editorclass::switch_warpdir(const bool reversed) void editorclass::switch_warpdir(const bool reversed)
{ {
static const int modulus = 4; static const int modulus = 4;
const edlevelclass* const room = cl.getroomprop(levx, levy); const RoomProperty* const room = cl.getroomprop(levx, levy);
int warpdir = room->warpdir; int warpdir = room->warpdir;

View file

@ -1257,7 +1257,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
#if !defined(NO_CUSTOM_LEVELS) #if !defined(NO_CUSTOM_LEVELS)
// Special case for gray Warp Zone tileset! // Special case for gray Warp Zone tileset!
const edlevelclass* const room = cl.getroomprop(game.roomx - 100, game.roomy - 100); const RoomProperty* const room = cl.getroomprop(game.roomx - 100, game.roomy - 100);
bool custom_gray = room->tileset == 3 && room->tilecol == 6; bool custom_gray = room->tileset == 3 && room->tilecol == 6;
#else #else
bool custom_gray = false; bool custom_gray = false;

View file

@ -1896,7 +1896,7 @@ void Graphics::drawentity(const int i, const int yoff)
#if !defined(NO_CUSTOM_LEVELS) #if !defined(NO_CUSTOM_LEVELS)
// Special case for gray Warp Zone tileset! // Special case for gray Warp Zone tileset!
const edlevelclass* const room = cl.getroomprop(game.roomx - 100, game.roomy - 100); const RoomProperty* const room = cl.getroomprop(game.roomx - 100, game.roomy - 100);
const bool custom_gray = room->tileset == 3 && room->tilecol == 6; const bool custom_gray = room->tileset == 3 && room->tilecol == 6;
#else #else
const bool custom_gray = false; const bool custom_gray = false;

View file

@ -1562,7 +1562,7 @@ void mapclass::loadlevel(int rx, int ry)
#if !defined(NO_CUSTOM_LEVELS) #if !defined(NO_CUSTOM_LEVELS)
case 12: //Custom level case 12: //Custom level
{ {
const edlevelclass* const room = cl.getroomprop(rx - 100, ry - 100); const RoomProperty* const room = cl.getroomprop(rx - 100, ry - 100);
game.customcol = cl.getlevelcol(room->tileset, room->tilecol) + 1; game.customcol = cl.getlevelcol(room->tileset, room->tilecol) + 1;
obj.customplatformtile = game.customcol * 12; obj.customplatformtile = game.customcol * 12;

View file

@ -159,7 +159,7 @@ void scriptclass::run(void)
{ {
int temprx=ss_toi(words[1])-1; int temprx=ss_toi(words[1])-1;
int tempry=ss_toi(words[2])-1; int tempry=ss_toi(words[2])-1;
const edlevelclass* room; const RoomProperty* room;
cl.setroomwarpdir(temprx, tempry, ss_toi(words[3])); cl.setroomwarpdir(temprx, tempry, ss_toi(words[3]));
room = cl.getroomprop(temprx, tempry); room = cl.getroomprop(temprx, tempry);
@ -197,7 +197,7 @@ void scriptclass::run(void)
} }
if (words[0] == "ifwarp") if (words[0] == "ifwarp")
{ {
const edlevelclass* const room = cl.getroomprop(ss_toi(words[1])-1, ss_toi(words[2])-1); const RoomProperty* const room = cl.getroomprop(ss_toi(words[1])-1, ss_toi(words[2])-1);
if (room->warpdir == ss_toi(words[3])) if (room->warpdir == ss_toi(words[3]))
{ {
load("custom_"+words[4]); load("custom_"+words[4]);