From ffe53746bc8948f8573e40f1d68cc5d0ac55724b Mon Sep 17 00:00:00 2001 From: Misa Date: Sun, 12 Sep 2021 21:02:15 -0700 Subject: [PATCH] Rename `textbox` to `textboxes` and textbox `line` to `lines` It's really dumb that these array names aren't plural when they should be, because they contain more than one thing. --- desktop_version/src/Game.cpp | 2 +- desktop_version/src/Graphics.cpp | 122 +++++++++++++++---------------- desktop_version/src/Graphics.h | 2 +- desktop_version/src/Input.cpp | 2 +- desktop_version/src/Script.cpp | 2 +- desktop_version/src/Textbox.cpp | 10 +-- desktop_version/src/Textbox.h | 2 +- 7 files changed, 71 insertions(+), 71 deletions(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index e244e5fe..64809cbd 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -6778,7 +6778,7 @@ void Game::returntoeditor(void) { gamestate = EDITORMODE; - graphics.textbox.clear(); + graphics.textboxes.clear(); hascontrol = true; advancetext = false; completestop = false; diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 92249f1b..6bfcf77b 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -960,58 +960,58 @@ void Graphics::drawgui(void) } //Draw all the textboxes to the screen - for (i = 0; i= 1.0; + opaque = textboxes[i].tl >= 1.0; if (!opaque) { continue; } - if (textbox[i].yp == 12 && textbox[i].r == 165) + if (textboxes[i].yp == 12 && textboxes[i].r == 165) { if (flipmode) { @@ -1022,7 +1022,7 @@ void Graphics::drawgui(void) drawimage(0, 0, 12, true); } } - else if (textbox[i].yp == 12 && textbox[i].g == 165) + else if (textboxes[i].yp == 12 && textboxes[i].g == 165) { if (flipmode) { @@ -1033,55 +1033,55 @@ void Graphics::drawgui(void) drawimage(4, 0, 12, true); } } - if (textbox[i].r == 175 && textbox[i].g == 175) + if (textboxes[i].r == 175 && textboxes[i].g == 175) { //purple guy - drawsprite(80 - 6, crew_yp, crew_sprite, 220- help.glow/4 - textbox[i].rand, 120- help.glow/4, 210 - help.glow/4); + drawsprite(80 - 6, crew_yp, crew_sprite, 220- help.glow/4 - textboxes[i].rand, 120- help.glow/4, 210 - help.glow/4); } - else if (textbox[i].r == 175 && textbox[i].b == 175) + else if (textboxes[i].r == 175 && textboxes[i].b == 175) { //red guy drawsprite(80 - 6, crew_yp, crew_sprite, 255 - help.glow/8, 70 - help.glow/4, 70 - help.glow / 4); } - else if (textbox[i].r == 175) + else if (textboxes[i].r == 175) { //green guy - drawsprite(80 - 6, crew_yp, crew_sprite, 120 - help.glow / 4 - textbox[i].rand, 220 - help.glow / 4, 120 - help.glow / 4); + drawsprite(80 - 6, crew_yp, crew_sprite, 120 - help.glow / 4 - textboxes[i].rand, 220 - help.glow / 4, 120 - help.glow / 4); } - else if (textbox[i].g == 175) + else if (textboxes[i].g == 175) { //yellow guy - drawsprite(80 - 6, crew_yp, crew_sprite, 220- help.glow/4 - textbox[i].rand, 210 - help.glow/4, 120- help.glow/4); + drawsprite(80 - 6, crew_yp, crew_sprite, 220- help.glow/4 - textboxes[i].rand, 210 - help.glow/4, 120- help.glow/4); } - else if (textbox[i].b == 175) + else if (textboxes[i].b == 175) { //blue guy - drawsprite(80 - 6, crew_yp, crew_sprite, 75, 75, 255- help.glow/4 - textbox[i].rand); + drawsprite(80 - 6, crew_yp, crew_sprite, 75, 75, 255- help.glow/4 - textboxes[i].rand); } } } void Graphics::updatetextboxes(void) { - for (size_t i = 0; i < textbox.size(); i++) + for (size_t i = 0; i < textboxes.size(); i++) { - textbox[i].update(); + textboxes[i].update(); - if (textbox[i].tm == 2 && textbox[i].tl <= 0.5) + if (textboxes[i].tm == 2 && textboxes[i].tl <= 0.5) { - textbox.erase(textbox.begin() + i); + textboxes.erase(textboxes.begin() + i); i--; continue; } - if (textbox[i].tl >= 1.0f - && ((textbox[i].r == 175 && textbox[i].g == 175) - || textbox[i].r == 175 - || textbox[i].g == 175 - || textbox[i].b == 175) - && (textbox[i].r != 175 || textbox[i].b != 175)) + if (textboxes[i].tl >= 1.0f + && ((textboxes[i].r == 175 && textboxes[i].g == 175) + || textboxes[i].r == 175 + || textboxes[i].g == 175 + || textboxes[i].b == 175) + && (textboxes[i].r != 175 || textboxes[i].b != 175)) { - textbox[i].rand = fRandom() * 20; + textboxes[i].rand = fRandom() * 20; } } } @@ -1327,61 +1327,61 @@ void Graphics::drawtextbox( void Graphics::textboxactive(void) { //Remove all but the most recent textbox - for (int i = 0; i < (int) textbox.size(); i++) + for (int i = 0; i < (int) textboxes.size(); i++) { - if (m != i) textbox[i].remove(); + if (m != i) textboxes[i].remove(); } } void Graphics::textboxremovefast(void) { //Remove all textboxes - for (size_t i = 0; i < textbox.size(); i++) + for (size_t i = 0; i < textboxes.size(); i++) { - textbox[i].removefast(); + textboxes[i].removefast(); } } void Graphics::textboxremove(void) { //Remove all textboxes - for (size_t i = 0; i < textbox.size(); i++) + for (size_t i = 0; i < textboxes.size(); i++) { - textbox[i].remove(); + textboxes[i].remove(); } } void Graphics::textboxtimer( int t ) { - if (!INBOUNDS_VEC(m, textbox)) + if (!INBOUNDS_VEC(m, textboxes)) { vlog_error("textboxtimer() out-of-bounds!"); return; } - textbox[m].timer=t; + textboxes[m].timer=t; } void Graphics::addline( const std::string& t ) { - if (!INBOUNDS_VEC(m, textbox)) + if (!INBOUNDS_VEC(m, textboxes)) { vlog_error("addline() out-of-bounds!"); return; } - textbox[m].addline(t); + textboxes[m].addline(t); } void Graphics::textboxadjust(void) { - if (!INBOUNDS_VEC(m, textbox)) + if (!INBOUNDS_VEC(m, textboxes)) { vlog_error("textboxadjust() out-of-bounds!"); return; } - textbox[m].adjust(); + textboxes[m].adjust(); } @@ -1394,12 +1394,12 @@ void Graphics::createtextboxreal( int b, bool flipme ) { - m = textbox.size(); + m = textboxes.size(); if(m<20) { textboxclass text; - text.line.push_back(t); + text.lines.push_back(t); text.xp = xp; int length = utf8::unchecked::distance(t.begin(), t.end()); if (xp == -1) text.xp = 160 - (((length / 2) + 1) * 8); @@ -1407,7 +1407,7 @@ void Graphics::createtextboxreal( text.initcol(r, g, b); text.flipme = flipme; text.resize(); - textbox.push_back(text); + textboxes.push_back(text); } } @@ -3050,46 +3050,46 @@ void Graphics::setwarprect( int a, int b, int c, int d ) void Graphics::textboxcenterx(void) { - if (!INBOUNDS_VEC(m, textbox)) + if (!INBOUNDS_VEC(m, textboxes)) { vlog_error("textboxcenterx() out-of-bounds!"); return; } - textbox[m].centerx(); + textboxes[m].centerx(); } int Graphics::textboxwidth(void) { - if (!INBOUNDS_VEC(m, textbox)) + if (!INBOUNDS_VEC(m, textboxes)) { vlog_error("textboxwidth() out-of-bounds!"); return 0; } - return textbox[m].w; + return textboxes[m].w; } void Graphics::textboxmoveto(int xo) { - if (!INBOUNDS_VEC(m, textbox)) + if (!INBOUNDS_VEC(m, textboxes)) { vlog_error("textboxmoveto() out-of-bounds!"); return; } - textbox[m].xp = xo; + textboxes[m].xp = xo; } void Graphics::textboxcentery(void) { - if (!INBOUNDS_VEC(m, textbox)) + if (!INBOUNDS_VEC(m, textboxes)) { vlog_error("textboxcentery() out-of-bounds!"); return; } - textbox[m].centery(); + textboxes[m].centery(); } int Graphics::crewcolour(const int t) diff --git a/desktop_version/src/Graphics.h b/desktop_version/src/Graphics.h index 693bcf5b..c0e9d81a 100644 --- a/desktop_version/src/Graphics.h +++ b/desktop_version/src/Graphics.h @@ -300,7 +300,7 @@ public: bool trinketcolset; int trinketr, trinketg, trinketb; - std::vector textbox; + std::vector textboxes; bool showcutscenebars; int cutscenebarspos; diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index d4d7599c..f3d9dc66 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -2415,7 +2415,7 @@ void mapinput(void) { // Produces more glitchiness! Necessary for credits warp to work. script.running = false; - graphics.textbox.clear(); + graphics.textboxes.clear(); game.state = 80; game.statedelay = 0; diff --git a/desktop_version/src/Script.cpp b/desktop_version/src/Script.cpp index aba1da93..36946da9 100644 --- a/desktop_version/src/Script.cpp +++ b/desktop_version/src/Script.cpp @@ -3190,7 +3190,7 @@ void scriptclass::hardreset(void) //dwgraphicsclass graphics.backgrounddrawn = false; - graphics.textbox.clear(); + graphics.textboxes.clear(); graphics.flipmode = false; //This will be reset if needs be elsewhere graphics.showcutscenebars = false; graphics.setbars(0); diff --git a/desktop_version/src/Textbox.cpp b/desktop_version/src/Textbox.cpp index 73e7f0c5..166449e0 100644 --- a/desktop_version/src/Textbox.cpp +++ b/desktop_version/src/Textbox.cpp @@ -97,19 +97,19 @@ void textboxclass::resize(void) { //Set the width and height to the correct sizes int max = 0; - for (size_t iter = 0; iter < line.size(); iter++) + for (size_t iter = 0; iter < lines.size(); iter++) { - unsigned int len = utf8::unchecked::distance(line[iter].begin(), line[iter].end()); + unsigned int len = utf8::unchecked::distance(lines[iter].begin(), lines[iter].end()); if (len > (unsigned int)max) max = len; } w = (max +2) * 8; - h = (line.size() + 2) * 8; + h = (lines.size() + 2) * 8; } void textboxclass::addline(const std::string& t) { - line.push_back(t); + lines.push_back(t); resize(); - if ((int) line.size() >= 12) line.clear(); + if ((int) lines.size() >= 12) lines.clear(); } diff --git a/desktop_version/src/Textbox.h b/desktop_version/src/Textbox.h index e9ad48ed..c2934958 100644 --- a/desktop_version/src/Textbox.h +++ b/desktop_version/src/Textbox.h @@ -28,7 +28,7 @@ public: void addline(const std::string& t); public: //Fundamentals - std::vector line; + std::vector lines; int xp, yp, w, h; int r,g,b; int timer;