mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Transfer adjust call to applyposition
This transfers the responsibility of the adjust() call to applyposition(). This is because cutscene text boxes (TEXTTRANSLATE_CUTSCENE) will have adjust() called, but all other text boxes won't. And I can't place the adjust() call inside applyposition(), because adjust() also calls applyposition(), and that leads to an infinite loop which leads to a stack overflow, so I had to remove the applyposition() call from adjust(), and replace the other existing call to Graphics::textboxadjust() with Graphics::textboxapplyposition(), and then remove Graphics::textboxadjust() function because it's no longer used.
This commit is contained in:
parent
3ef089ed3d
commit
28df0148b1
4 changed files with 5 additions and 15 deletions
|
@ -1506,17 +1506,6 @@ void Graphics::textboxapplyposition(void)
|
||||||
textboxes[m].applyposition();
|
textboxes[m].applyposition();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graphics::textboxadjust(void)
|
|
||||||
{
|
|
||||||
if (!INBOUNDS_VEC(m, textboxes))
|
|
||||||
{
|
|
||||||
vlog_error("textboxadjust() out-of-bounds!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
textboxes[m].adjust();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Graphics::setlinegap(int customvalue)
|
void Graphics::setlinegap(int customvalue)
|
||||||
{
|
{
|
||||||
if (!INBOUNDS_VEC(m, textboxes))
|
if (!INBOUNDS_VEC(m, textboxes))
|
||||||
|
|
|
@ -127,8 +127,6 @@ public:
|
||||||
|
|
||||||
void textboxapplyposition(void);
|
void textboxapplyposition(void);
|
||||||
|
|
||||||
void textboxadjust(void);
|
|
||||||
|
|
||||||
void addline(const std::string& t);
|
void addline(const std::string& t);
|
||||||
|
|
||||||
void setlarge(bool large);
|
void setlarge(bool large);
|
||||||
|
|
|
@ -766,7 +766,7 @@ void scriptclass::run(void)
|
||||||
}
|
}
|
||||||
graphics.textboxtranslate(TEXTTRANSLATE_CUTSCENE, NULL);
|
graphics.textboxtranslate(TEXTTRANSLATE_CUTSCENE, NULL);
|
||||||
|
|
||||||
graphics.textboxadjust();
|
graphics.textboxapplyposition();
|
||||||
if (words[0] == "speak_active")
|
if (words[0] == "speak_active")
|
||||||
{
|
{
|
||||||
graphics.textboxactive();
|
graphics.textboxactive();
|
||||||
|
|
|
@ -87,12 +87,15 @@ void textboxclass::applyposition(void)
|
||||||
{
|
{
|
||||||
centery();
|
centery();
|
||||||
}
|
}
|
||||||
|
if (translate == TEXTTRANSLATE_CUTSCENE)
|
||||||
|
{
|
||||||
|
adjust();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void textboxclass::adjust(void)
|
void textboxclass::adjust(void)
|
||||||
{
|
{
|
||||||
resize();
|
resize();
|
||||||
applyposition();
|
|
||||||
if (xp < 10) xp = 10;
|
if (xp < 10) xp = 10;
|
||||||
if (yp < 10) yp = 10;
|
if (yp < 10) yp = 10;
|
||||||
if (xp + w > 310) xp = 310 - w;
|
if (xp + w > 310) xp = 310 - w;
|
||||||
|
|
Loading…
Reference in a new issue