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

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.
This commit is contained in:
Misa 2021-09-12 21:02:15 -07:00
parent a50e8ecf48
commit ffe53746bc
7 changed files with 71 additions and 71 deletions

View file

@ -6778,7 +6778,7 @@ void Game::returntoeditor(void)
{ {
gamestate = EDITORMODE; gamestate = EDITORMODE;
graphics.textbox.clear(); graphics.textboxes.clear();
hascontrol = true; hascontrol = true;
advancetext = false; advancetext = false;
completestop = false; completestop = false;

View file

@ -960,58 +960,58 @@ void Graphics::drawgui(void)
} }
//Draw all the textboxes to the screen //Draw all the textboxes to the screen
for (i = 0; i<textbox.size(); i++) for (i = 0; i<textboxes.size(); i++)
{ {
int text_yoff; int text_yoff;
int yp; int yp;
bool opaque; bool opaque;
if (flipmode) if (flipmode)
{ {
text_yoff = textbox[i].line.size() * 8; text_yoff = textboxes[i].lines.size() * 8;
} }
else else
{ {
text_yoff = 8; text_yoff = 8;
} }
yp = textbox[i].yp; yp = textboxes[i].yp;
if (flipmode && textbox[i].flipme) if (flipmode && textboxes[i].flipme)
{ {
yp += 2 * (120 - yp) - 8 * (textbox[i].line.size() + 2); yp += 2 * (120 - yp) - 8 * (textboxes[i].lines.size() + 2);
} }
if (textbox[i].r == 0 && textbox[i].g == 0 && textbox[i].b == 0) if (textboxes[i].r == 0 && textboxes[i].g == 0 && textboxes[i].b == 0)
{ {
size_t j; size_t j;
for (j = 0; j < textbox[i].line.size(); j++) for (j = 0; j < textboxes[i].lines.size(); j++)
{ {
bprint(textbox[i].xp + 8, yp + text_yoff + text_sign * (j * 8), textbox[i].line[j], 196, 196, 255 - help.glow); bprint(textboxes[i].xp + 8, yp + text_yoff + text_sign * (j * 8), textboxes[i].lines[j], 196, 196, 255 - help.glow);
} }
} }
else else
{ {
const float tl_lerp = lerp(textbox[i].prev_tl, textbox[i].tl); const float tl_lerp = lerp(textboxes[i].prev_tl, textboxes[i].tl);
const int r = textbox[i].r * tl_lerp; const int r = textboxes[i].r * tl_lerp;
const int g = textbox[i].g * tl_lerp; const int g = textboxes[i].g * tl_lerp;
const int b = textbox[i].b * tl_lerp; const int b = textboxes[i].b * tl_lerp;
size_t j; size_t j;
drawtextbox(textbox[i].xp, yp, textbox[i].w/8, textbox[i].h/8, r, g, b); drawtextbox(textboxes[i].xp, yp, textboxes[i].w/8, textboxes[i].h/8, r, g, b);
for (j = 0; j < textbox[i].line.size(); j++) for (j = 0; j < textboxes[i].lines.size(); j++)
{ {
Print(textbox[i].xp + 8, yp + text_yoff + text_sign * (j * 8), textbox[i].line[j], r, g, b); Print(textboxes[i].xp + 8, yp + text_yoff + text_sign * (j * 8), textboxes[i].lines[j], r, g, b);
} }
} }
opaque = textbox[i].tl >= 1.0; opaque = textboxes[i].tl >= 1.0;
if (!opaque) if (!opaque)
{ {
continue; continue;
} }
if (textbox[i].yp == 12 && textbox[i].r == 165) if (textboxes[i].yp == 12 && textboxes[i].r == 165)
{ {
if (flipmode) if (flipmode)
{ {
@ -1022,7 +1022,7 @@ void Graphics::drawgui(void)
drawimage(0, 0, 12, true); 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) if (flipmode)
{ {
@ -1033,55 +1033,55 @@ void Graphics::drawgui(void)
drawimage(4, 0, 12, true); 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 //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 //red guy
drawsprite(80 - 6, crew_yp, crew_sprite, 255 - help.glow/8, 70 - help.glow/4, 70 - help.glow / 4); 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 //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 //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 //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) 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--; i--;
continue; continue;
} }
if (textbox[i].tl >= 1.0f if (textboxes[i].tl >= 1.0f
&& ((textbox[i].r == 175 && textbox[i].g == 175) && ((textboxes[i].r == 175 && textboxes[i].g == 175)
|| textbox[i].r == 175 || textboxes[i].r == 175
|| textbox[i].g == 175 || textboxes[i].g == 175
|| textbox[i].b == 175) || textboxes[i].b == 175)
&& (textbox[i].r != 175 || textbox[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) void Graphics::textboxactive(void)
{ {
//Remove all but the most recent textbox //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) void Graphics::textboxremovefast(void)
{ {
//Remove all textboxes //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) void Graphics::textboxremove(void)
{ {
//Remove all textboxes //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 ) void Graphics::textboxtimer( int t )
{ {
if (!INBOUNDS_VEC(m, textbox)) if (!INBOUNDS_VEC(m, textboxes))
{ {
vlog_error("textboxtimer() out-of-bounds!"); vlog_error("textboxtimer() out-of-bounds!");
return; return;
} }
textbox[m].timer=t; textboxes[m].timer=t;
} }
void Graphics::addline( const std::string& t ) void Graphics::addline( const std::string& t )
{ {
if (!INBOUNDS_VEC(m, textbox)) if (!INBOUNDS_VEC(m, textboxes))
{ {
vlog_error("addline() out-of-bounds!"); vlog_error("addline() out-of-bounds!");
return; return;
} }
textbox[m].addline(t); textboxes[m].addline(t);
} }
void Graphics::textboxadjust(void) void Graphics::textboxadjust(void)
{ {
if (!INBOUNDS_VEC(m, textbox)) if (!INBOUNDS_VEC(m, textboxes))
{ {
vlog_error("textboxadjust() out-of-bounds!"); vlog_error("textboxadjust() out-of-bounds!");
return; return;
} }
textbox[m].adjust(); textboxes[m].adjust();
} }
@ -1394,12 +1394,12 @@ void Graphics::createtextboxreal(
int b, int b,
bool flipme bool flipme
) { ) {
m = textbox.size(); m = textboxes.size();
if(m<20) if(m<20)
{ {
textboxclass text; textboxclass text;
text.line.push_back(t); text.lines.push_back(t);
text.xp = xp; text.xp = xp;
int length = utf8::unchecked::distance(t.begin(), t.end()); int length = utf8::unchecked::distance(t.begin(), t.end());
if (xp == -1) text.xp = 160 - (((length / 2) + 1) * 8); if (xp == -1) text.xp = 160 - (((length / 2) + 1) * 8);
@ -1407,7 +1407,7 @@ void Graphics::createtextboxreal(
text.initcol(r, g, b); text.initcol(r, g, b);
text.flipme = flipme; text.flipme = flipme;
text.resize(); 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) void Graphics::textboxcenterx(void)
{ {
if (!INBOUNDS_VEC(m, textbox)) if (!INBOUNDS_VEC(m, textboxes))
{ {
vlog_error("textboxcenterx() out-of-bounds!"); vlog_error("textboxcenterx() out-of-bounds!");
return; return;
} }
textbox[m].centerx(); textboxes[m].centerx();
} }
int Graphics::textboxwidth(void) int Graphics::textboxwidth(void)
{ {
if (!INBOUNDS_VEC(m, textbox)) if (!INBOUNDS_VEC(m, textboxes))
{ {
vlog_error("textboxwidth() out-of-bounds!"); vlog_error("textboxwidth() out-of-bounds!");
return 0; return 0;
} }
return textbox[m].w; return textboxes[m].w;
} }
void Graphics::textboxmoveto(int xo) void Graphics::textboxmoveto(int xo)
{ {
if (!INBOUNDS_VEC(m, textbox)) if (!INBOUNDS_VEC(m, textboxes))
{ {
vlog_error("textboxmoveto() out-of-bounds!"); vlog_error("textboxmoveto() out-of-bounds!");
return; return;
} }
textbox[m].xp = xo; textboxes[m].xp = xo;
} }
void Graphics::textboxcentery(void) void Graphics::textboxcentery(void)
{ {
if (!INBOUNDS_VEC(m, textbox)) if (!INBOUNDS_VEC(m, textboxes))
{ {
vlog_error("textboxcentery() out-of-bounds!"); vlog_error("textboxcentery() out-of-bounds!");
return; return;
} }
textbox[m].centery(); textboxes[m].centery();
} }
int Graphics::crewcolour(const int t) int Graphics::crewcolour(const int t)

View file

@ -300,7 +300,7 @@ public:
bool trinketcolset; bool trinketcolset;
int trinketr, trinketg, trinketb; int trinketr, trinketg, trinketb;
std::vector <textboxclass> textbox; std::vector <textboxclass> textboxes;
bool showcutscenebars; bool showcutscenebars;
int cutscenebarspos; int cutscenebarspos;

View file

@ -2415,7 +2415,7 @@ void mapinput(void)
{ {
// Produces more glitchiness! Necessary for credits warp to work. // Produces more glitchiness! Necessary for credits warp to work.
script.running = false; script.running = false;
graphics.textbox.clear(); graphics.textboxes.clear();
game.state = 80; game.state = 80;
game.statedelay = 0; game.statedelay = 0;

View file

@ -3190,7 +3190,7 @@ void scriptclass::hardreset(void)
//dwgraphicsclass //dwgraphicsclass
graphics.backgrounddrawn = false; graphics.backgrounddrawn = false;
graphics.textbox.clear(); graphics.textboxes.clear();
graphics.flipmode = false; //This will be reset if needs be elsewhere graphics.flipmode = false; //This will be reset if needs be elsewhere
graphics.showcutscenebars = false; graphics.showcutscenebars = false;
graphics.setbars(0); graphics.setbars(0);

View file

@ -97,19 +97,19 @@ void textboxclass::resize(void)
{ {
//Set the width and height to the correct sizes //Set the width and height to the correct sizes
int max = 0; 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; if (len > (unsigned int)max) max = len;
} }
w = (max +2) * 8; w = (max +2) * 8;
h = (line.size() + 2) * 8; h = (lines.size() + 2) * 8;
} }
void textboxclass::addline(const std::string& t) void textboxclass::addline(const std::string& t)
{ {
line.push_back(t); lines.push_back(t);
resize(); resize();
if ((int) line.size() >= 12) line.clear(); if ((int) lines.size() >= 12) lines.clear();
} }

View file

@ -28,7 +28,7 @@ public:
void addline(const std::string& t); void addline(const std::string& t);
public: public:
//Fundamentals //Fundamentals
std::vector<std::string> line; std::vector<std::string> lines;
int xp, yp, w, h; int xp, yp, w, h;
int r,g,b; int r,g,b;
int timer; int timer;