From d549a535e0ad547e370943f50409892a98b992d3 Mon Sep 17 00:00:00 2001
From: Misa <infoteddy@infoteddy.info>
Date: Sat, 20 Feb 2021 15:45:48 -0800
Subject: [PATCH] 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.
---
 desktop_version/src/CustomLevels.cpp | 44 ++++++++++++++--------------
 desktop_version/src/CustomLevels.h   | 11 +++----
 desktop_version/src/Editor.cpp       | 14 ++++-----
 desktop_version/src/Entity.cpp       |  2 +-
 desktop_version/src/Graphics.cpp     |  2 +-
 desktop_version/src/Map.cpp          |  2 +-
 desktop_version/src/Script.cpp       |  4 +--
 7 files changed, 40 insertions(+), 39 deletions(-)

diff --git a/desktop_version/src/CustomLevels.cpp b/desktop_version/src/CustomLevels.cpp
index 07c4c835..ed875f9e 100644
--- a/desktop_version/src/CustomLevels.cpp
+++ b/desktop_version/src/CustomLevels.cpp
@@ -35,7 +35,7 @@
 #include <inttypes.h>
 #endif
 
-edlevelclass::edlevelclass(void)
+RoomProperty::RoomProperty(void)
 {
     tileset=0;
     tilecol=0;
@@ -464,7 +464,7 @@ int customlevelclass::getenemycol(int t)
 
 int customlevelclass::getwarpbackground(int rx, int ry)
 {
-    const edlevelclass* const room = getroomprop(rx, ry);
+    const RoomProperty* const room = getroomprop(rx, ry);
     switch(room->tileset)
     {
     case 0: //Space Station
@@ -786,7 +786,7 @@ int customlevelclass::getroompropidx(const int rx, const int ry)
     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);
 
@@ -795,7 +795,7 @@ const edlevelclass* customlevelclass::getroomprop(const int rx, const int ry)
         return &level[idx];
     }
 
-    static edlevelclass blank;
+    static RoomProperty blank;
     blank.tileset = 1;
     blank.directmode = 1;
     blank.roomname.clear();
@@ -1400,24 +1400,24 @@ bool customlevelclass::save(std::string& _path)
 
     for(size_t i = 0; i < SDL_arraysize(level); i++)
     {
-        tinyxml2::XMLElement *edlevelclassElement = doc.NewElement( "edLevelClass" );
-        edlevelclassElement->SetAttribute( "tileset", level[i].tileset);
-        edlevelclassElement->SetAttribute(  "tilecol", level[i].tilecol);
-        edlevelclassElement->SetAttribute(  "platx1", level[i].platx1);
-        edlevelclassElement->SetAttribute(  "platy1", level[i].platy1);
-        edlevelclassElement->SetAttribute(  "platx2", level[i].platx2);
-        edlevelclassElement->SetAttribute( "platy2", level[i].platy2);
-        edlevelclassElement->SetAttribute( "platv", temp_platv[i]);
-        edlevelclassElement->SetAttribute(  "enemyx1", level[i].enemyx1);
-        edlevelclassElement->SetAttribute(  "enemyy1", level[i].enemyy1);
-        edlevelclassElement->SetAttribute(  "enemyx2", level[i].enemyx2);
-        edlevelclassElement->SetAttribute(  "enemyy2", level[i].enemyy2);
-        edlevelclassElement->SetAttribute(  "enemytype", level[i].enemytype);
-        edlevelclassElement->SetAttribute(  "directmode", level[i].directmode);
-        edlevelclassElement->SetAttribute(  "warpdir", level[i].warpdir);
+        tinyxml2::XMLElement *roompropertyElement = doc.NewElement( "edLevelClass" );
+        roompropertyElement->SetAttribute( "tileset", level[i].tileset);
+        roompropertyElement->SetAttribute(  "tilecol", level[i].tilecol);
+        roompropertyElement->SetAttribute(  "platx1", level[i].platx1);
+        roompropertyElement->SetAttribute(  "platy1", level[i].platy1);
+        roompropertyElement->SetAttribute(  "platx2", level[i].platx2);
+        roompropertyElement->SetAttribute( "platy2", level[i].platy2);
+        roompropertyElement->SetAttribute( "platv", temp_platv[i]);
+        roompropertyElement->SetAttribute(  "enemyx1", level[i].enemyx1);
+        roompropertyElement->SetAttribute(  "enemyy1", level[i].enemyy1);
+        roompropertyElement->SetAttribute(  "enemyx2", level[i].enemyx2);
+        roompropertyElement->SetAttribute(  "enemyy2", level[i].enemyy2);
+        roompropertyElement->SetAttribute(  "enemytype", level[i].enemytype);
+        roompropertyElement->SetAttribute(  "directmode", level[i].directmode);
+        roompropertyElement->SetAttribute(  "warpdir", level[i].warpdir);
 
-        edlevelclassElement->LinkEndChild( doc.NewText( level[i].roomname.c_str() )) ;
-        msg->LinkEndChild( edlevelclassElement );
+        roompropertyElement->LinkEndChild( doc.NewText( level[i].roomname.c_str() )) ;
+        msg->LinkEndChild( roompropertyElement );
     }
 
     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
 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) {
 
     case 0: // Space Station
diff --git a/desktop_version/src/CustomLevels.h b/desktop_version/src/CustomLevels.h
index 3fc9a0ec..480f6975 100644
--- a/desktop_version/src/CustomLevels.h
+++ b/desktop_version/src/CustomLevels.h
@@ -33,9 +33,10 @@ public:
     FOREACH_PROP(enemytype, int) \
     FOREACH_PROP(directmode, int)
 
-class edlevelclass{
+class RoomProperty
+{
 public:
-    edlevelclass(void);
+    RoomProperty(void);
 #define FOREACH_PROP(NAME, TYPE) TYPE NAME;
     ROOM_PROPERTIES
 #undef FOREACH_PROP
@@ -119,7 +120,7 @@ public:
     int getabstile(const int x, const int y);
   
     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) \
     void setroom##NAME(const int rx, const int ry, const TYPE NAME);
     ROOM_PROPERTIES
@@ -149,8 +150,8 @@ public:
     int vmult[30 * maxheight];
     int numtrinkets(void);
     int numcrewmates(void);
-    edlevelclass level[numrooms]; //Maxwidth*maxheight
-  
+    RoomProperty level[numrooms]; //Maxwidth*maxheight
+
     int levmusic;
     int mapwidth, mapheight; //Actual width and height of stage
   
diff --git a/desktop_version/src/Editor.cpp b/desktop_version/src/Editor.cpp
index 71cb2672..86cd5945 100644
--- a/desktop_version/src/Editor.cpp
+++ b/desktop_version/src/Editor.cpp
@@ -474,7 +474,7 @@ static void editormenurender(int tr, int tg, int tb)
 void editorrender(void)
 {
     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
 
@@ -1545,7 +1545,7 @@ void editorrender(void)
 void editorrenderfixed(void)
 {
     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();
 
     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 )
 {
     //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->tilecol>=22)
@@ -3754,7 +3754,7 @@ int editorclass::base( int x, int y )
 int editorclass::backbase( int x, int y )
 {
     //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
     {
         //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)
 {
-    const edlevelclass* const room = cl.getroomprop(rx, ry);
+    const RoomProperty* const room = cl.getroomprop(rx, ry);
     const int tileset = room->tileset;
     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)
 {
-    const edlevelclass* const room = cl.getroomprop(levx, levy);
+    const RoomProperty* const room = cl.getroomprop(levx, levy);
 
     int enemy = room->enemytype;
 
@@ -4280,7 +4280,7 @@ void editorclass::switch_enemy(const bool reversed)
 void editorclass::switch_warpdir(const bool reversed)
 {
     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;
 
diff --git a/desktop_version/src/Entity.cpp b/desktop_version/src/Entity.cpp
index 9af8683a..0e58e625 100644
--- a/desktop_version/src/Entity.cpp
+++ b/desktop_version/src/Entity.cpp
@@ -1257,7 +1257,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
 
 #if !defined(NO_CUSTOM_LEVELS)
     // 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;
 #else
     bool custom_gray = false;
diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp
index 48d39927..081e9151 100644
--- a/desktop_version/src/Graphics.cpp
+++ b/desktop_version/src/Graphics.cpp
@@ -1896,7 +1896,7 @@ void Graphics::drawentity(const int i, const int yoff)
 
 #if !defined(NO_CUSTOM_LEVELS)
     // 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;
 #else
     const bool custom_gray = false;
diff --git a/desktop_version/src/Map.cpp b/desktop_version/src/Map.cpp
index 3b6f402a..428b80bb 100644
--- a/desktop_version/src/Map.cpp
+++ b/desktop_version/src/Map.cpp
@@ -1562,7 +1562,7 @@ void mapclass::loadlevel(int rx, int ry)
 #if !defined(NO_CUSTOM_LEVELS)
 	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;
 		obj.customplatformtile = game.customcol * 12;
 
diff --git a/desktop_version/src/Script.cpp b/desktop_version/src/Script.cpp
index ea49d2e1..12ca2eda 100644
--- a/desktop_version/src/Script.cpp
+++ b/desktop_version/src/Script.cpp
@@ -159,7 +159,7 @@ void scriptclass::run(void)
 			{
 				int temprx=ss_toi(words[1])-1;
 				int tempry=ss_toi(words[2])-1;
-				const edlevelclass* room;
+				const RoomProperty* room;
 				cl.setroomwarpdir(temprx, tempry, ss_toi(words[3]));
 
 				room = cl.getroomprop(temprx, tempry);
@@ -197,7 +197,7 @@ void scriptclass::run(void)
 			}
 			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]))
 				{
 					load("custom_"+words[4]);