diff --git a/desktop_version/src/Map.cpp b/desktop_version/src/Map.cpp index a52c9f9f..016a934a 100644 --- a/desktop_version/src/Map.cpp +++ b/desktop_version/src/Map.cpp @@ -90,17 +90,6 @@ mapclass::mapclass() } resetnames(); - //roomtext - - for (int i = 0; i < 100; i++) - { - roomtextx[i]=0; - roomtexty[i]=0; - roomtext.push_back(std::string()); - } - roomtexton = false; - roomtextnumlines = 0; - //Areamap starts at 100,100 and extends 20x20 std::vector tmap; tmap.push_back("1,2,2,2,2,2,2,2,0,3,0,0,0,4,4,4,4,4,4,4"); @@ -1201,7 +1190,7 @@ void mapclass::loadlevel(int rx, int ry, Graphics& dwgfx, Game& game, entityclas roomtexton = false; - roomtextnumlines = 0; + roomtext.clear(); obj.platformtile = 0; obj.customplatformtile=0; @@ -1336,13 +1325,7 @@ void mapclass::loadlevel(int rx, int ry, Graphics& dwgfx, Game& game, entityclas if (otherlevel.roomtexton) { roomtexton = true; - roomtextx[0] = otherlevel.roomtextx; - roomtexty[0] = otherlevel.roomtexty; - roomtextnumlines = otherlevel.roomtextnumlines; - for (int i = 0; i < roomtextnumlines; i++) - { - roomtext[i] = otherlevel.roomtext[i]; - } + roomtext = std::vector(otherlevel.roomtext); } break; case 2: //The Lab @@ -1652,7 +1635,7 @@ void mapclass::loadlevel(int rx, int ry, Graphics& dwgfx, Game& game, entityclas roomtexton = false; - roomtextnumlines=0; + roomtext.clear(); for (int edj = 0; edj < 30; edj++){ for(int edi = 0; edi < 40; edi++){ @@ -1726,12 +1709,15 @@ void mapclass::loadlevel(int rx, int ry, Graphics& dwgfx, Game& game, entityclas obj.createentity(game, (edentity[edi].x*8)- ((rx-100)*40*8)-4,(edentity[edi].y*8)- ((ry-100)*30*8)+1, 55, ed.findcrewmate(edi), edentity[edi].p1, edentity[edi].p2); break; case 17: //Roomtext! + { roomtexton = true; - roomtextx[roomtextnumlines] = edentity[edi].x - ((rx-100)*40); - roomtexty[roomtextnumlines] = edentity[edi].y - ((ry-100)*30); - roomtext[roomtextnumlines] = edentity[edi].scriptname; - roomtextnumlines++; + Roomtext text; + text.x = edentity[edi].x - ((rx-100)*40); + text.y = edentity[edi].y - ((ry-100)*30); + text.text = edentity[edi].scriptname; + roomtext.push_back(text); break; + } case 18: //Terminals obj.customscript=edentity[edi].scriptname; obj.createentity(game, (edentity[edi].x*8)- ((rx-100)*40*8),(edentity[edi].y*8)- ((ry-100)*30*8)+8, 20, 1); @@ -1763,19 +1749,6 @@ void mapclass::loadlevel(int rx, int ry, Graphics& dwgfx, Game& game, entityclas customcrewmates=ed.numcrewmates; //do the appear/remove roomname here - /* - - if (otherlevel.roomtexton) - { - roomtexton = true; - roomtextx[0] = otherlevel.roomtextx; - roomtexty[0] = otherlevel.roomtexty; - roomtextnumlines = otherlevel.roomtextnumlines; - for (int i = 0; i < roomtextnumlines; i++) - { - roomtext[i] = otherlevel.roomtext[i]; - } - }*/ break; #endif } diff --git a/desktop_version/src/Map.h b/desktop_version/src/Map.h index 9f4935b1..03ef0e3b 100644 --- a/desktop_version/src/Map.h +++ b/desktop_version/src/Map.h @@ -160,10 +160,8 @@ public: bool showteleporters, showtargets, showtrinkets; //Roomtext - int roomtextx[100], roomtexty[100]; bool roomtexton; - std::vector roomtext; - int roomtextnumlines; + std::vector roomtext; //Levels otherlevelclass otherlevel; diff --git a/desktop_version/src/Otherlevel.cpp b/desktop_version/src/Otherlevel.cpp index d25e5ae3..ae941cd4 100644 --- a/desktop_version/src/Otherlevel.cpp +++ b/desktop_version/src/Otherlevel.cpp @@ -2,18 +2,13 @@ #include "MakeAndPlay.h" -otherlevelclass::otherlevelclass() -{ - for (i = 0; i < 50; i++) - { - roomtext.push_back(std::string()); - } -} - void otherlevelclass::addline(std::string t) { - roomtext[roomtextnumlines] = t; - roomtextnumlines++; + Roomtext text; + text.x = 0; + text.y = 0; + text.text = t; + roomtext.push_back(text); } std::vector otherlevelclass::loadlevel(int rx, int ry , Game& game, entityclass& obj) @@ -27,9 +22,7 @@ std::vector otherlevelclass::loadlevel(int rx, int ry , Game& game, std::vector tmap; roomname = ""; - roomtextnumlines = 0; - roomtextx = 0; - roomtexty = 0; + roomtext.clear(); roomtexton = false; switch(t) diff --git a/desktop_version/src/Otherlevel.h b/desktop_version/src/Otherlevel.h index f1083e1e..c834734c 100644 --- a/desktop_version/src/Otherlevel.h +++ b/desktop_version/src/Otherlevel.h @@ -7,6 +7,12 @@ #include #include +struct Roomtext +{ + int x, y; + std::string text; +}; + class otherlevelclass { public: @@ -20,7 +26,6 @@ public: ACTIVITY }; - otherlevelclass(); void addline(std::string t); std::vector loadlevel(int rx, int ry , Game& game, entityclass& obj); @@ -31,8 +36,7 @@ public: // roomtext thing in other level bool roomtexton; - int roomtextx, roomtexty, roomtextnumlines; - std::vector roomtext; + std::vector roomtext; }; #endif /* OTHERLEVEL_H */ diff --git a/desktop_version/src/titlerender.cpp b/desktop_version/src/titlerender.cpp index 472efa1d..9c79cbcd 100644 --- a/desktop_version/src/titlerender.cpp +++ b/desktop_version/src/titlerender.cpp @@ -1556,9 +1556,9 @@ void gamerender(Graphics& dwgfx, mapclass& map, Game& game, entityclass& obj, Ut if (map.roomtexton) { //Draw room text! - for (int i = 0; i < map.roomtextnumlines; i++) + for (size_t i = 0; i < map.roomtext.size(); i++) { - dwgfx.Print(map.roomtextx[i]*8, (map.roomtexty[i]*8), map.roomtext[i], 196, 196, 255 - help.glow); + dwgfx.Print(map.roomtext[i].x*8, (map.roomtext[i].y*8), map.roomtext[i].text, 196, 196, 255 - help.glow); } }