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

Allow a maximum of 26 lines, with L suffix

This commit is contained in:
AllyTally 2022-11-30 13:56:44 -04:00 committed by Misa Elizabeth Kai
parent 299ed90493
commit 1183083355
6 changed files with 38 additions and 6 deletions

View file

@ -1347,6 +1347,17 @@ void Graphics::addline( const std::string& t )
textboxes[m].addline(t);
}
void Graphics::setlarge(bool large)
{
if (!INBOUNDS_VEC(m, textboxes))
{
vlog_error("setlarge() out-of-bounds!");
return;
}
textboxes[m].large = large;
}
void Graphics::textboxadjust(void)
{
if (!INBOUNDS_VEC(m, textboxes))

View file

@ -117,6 +117,8 @@ public:
void addline(const std::string& t);
void setlarge(bool large);
void textboxtimer(int t);
void textboxremove(void);

View file

@ -48,6 +48,7 @@ scriptclass::scriptclass(void)
textpad_right = 0;
textpadtowidth = 0;
textcase = 1;
textlarge = false;
}
void scriptclass::clearcustom(void)
@ -519,9 +520,13 @@ void scriptclass::run(void)
textx = ss_toi(words[2]);
texty = ss_toi(words[3]);
// If words[4] ends with L, set large to true.
textlarge = (words[4].size() > 0 && words[4][words[4].size() - 1] == 'l');
int lines = ss_toi(words[4].substr(0, words[4].size() - (textlarge ? 1 : 0)));
//Number of lines for the textbox!
txt.clear();
for (int i = 0; i < ss_toi(words[4]); i++)
for (int i = 0; i < lines; i++)
{
position++;
if (INBOUNDS_VEC(position, commands))
@ -714,6 +719,10 @@ void scriptclass::run(void)
}
graphics.createtextboxreal(txt[0], textx, texty, r, g, b, textflipme);
textflipme = false;
graphics.setlarge(textlarge);
textlarge = false;
if ((int) txt.size() > 1)
{
for (i = 1; i < (int) txt.size(); i++)
@ -3514,11 +3523,13 @@ bool scriptclass::loadcustom(const std::string& t)
add("text(blue,0,0,"+words[1]+")");
break;
}
int ti=help.Int(words[1].c_str());
int nti = ti>=0 ? ti : 1;
for(int ti2=0; ti2<nti; ti2++){
int ti = ss_toi(words[1].c_str());
int nti = ti >= 0 ? ti : 1;
for (int ti2 = 0; ti2 < nti; ti2++)
{
i++;
if(INBOUNDS_VEC(i, lines)){
if (INBOUNDS_VEC(i, lines))
{
add(lines[i]);
}
}

View file

@ -111,6 +111,7 @@ public:
size_t textpad_right;
size_t textpadtowidth;
char textcase;
bool textlarge;
//Misc
int i, j, k;

View file

@ -24,6 +24,8 @@ textboxclass::textboxclass(void)
rand = 0;
large = false;
print_flags = PR_FONT_LEVEL;
}
@ -117,7 +119,10 @@ void textboxclass::addline(const std::string& t)
{
lines.push_back(t);
resize();
if ((int) lines.size() >= 12) lines.clear();
if ((int)lines.size() > (large ? 26 : 11))
{
lines.clear();
}
}
void textboxclass::pad(size_t left_pad, size_t right_pad)

View file

@ -49,6 +49,8 @@ public:
int rand;
bool large;
uint32_t print_flags;
};