mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-11-14 06:59:42 +01:00
De-duplicate Flip Mode text printing
Since the only difference in Flip Mode is the positiveness/negativeness of the iterator variable, plus the starting y-offset, I've removed the copy-pasted code and did this instead. The diff might look a bit ugly due to the unindentation.
This commit is contained in:
parent
f6ecf83190
commit
52a7d42672
1 changed files with 24 additions and 24 deletions
|
@ -813,28 +813,38 @@ void Graphics::drawtowertile3( int x, int y, int t, TowerBG& bg_obj )
|
||||||
|
|
||||||
void Graphics::drawgui(void)
|
void Graphics::drawgui(void)
|
||||||
{
|
{
|
||||||
|
int text_sign;
|
||||||
|
if (flipmode)
|
||||||
|
{
|
||||||
|
text_sign = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
text_sign = 1;
|
||||||
|
}
|
||||||
|
|
||||||
//Draw all the textboxes to the screen
|
//Draw all the textboxes to the screen
|
||||||
for (size_t i = 0; i<textbox.size(); i++)
|
for (size_t i = 0; i<textbox.size(); i++)
|
||||||
{
|
{
|
||||||
|
int text_yoff;
|
||||||
|
if (flipmode)
|
||||||
|
{
|
||||||
|
text_yoff = textbox[i].line.size() * 8;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
text_yoff = 8;
|
||||||
|
}
|
||||||
|
|
||||||
//This routine also updates textbox colors
|
//This routine also updates textbox colors
|
||||||
float tl_lerp = lerp(textbox[i].prev_tl, textbox[i].tl);
|
float tl_lerp = lerp(textbox[i].prev_tl, textbox[i].tl);
|
||||||
textbox[i].setcol(textbox[i].tr * tl_lerp, textbox[i].tg * tl_lerp, textbox[i].tb * tl_lerp);
|
textbox[i].setcol(textbox[i].tr * tl_lerp, textbox[i].tg * tl_lerp, textbox[i].tb * tl_lerp);
|
||||||
|
|
||||||
if (textbox[i].r == 0 && textbox[i].g == 0 && textbox[i].b == 0)
|
if (textbox[i].r == 0 && textbox[i].g == 0 && textbox[i].b == 0)
|
||||||
{
|
|
||||||
if(flipmode)
|
|
||||||
{
|
{
|
||||||
for (size_t j = 0; j < textbox[i].line.size(); j++)
|
for (size_t j = 0; j < textbox[i].line.size(); j++)
|
||||||
{
|
{
|
||||||
Print(textbox[i].xp + 8, textbox[i].yp + (textbox[i].line.size()*8) - (j * 8), textbox[i].line[j], 196, 196, 255 - help.glow);
|
Print(textbox[i].xp + 8, textbox[i].yp + text_yoff + text_sign * (j * 8), textbox[i].line[j], 196, 196, 255 - help.glow);
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (size_t j = 0; j < textbox[i].line.size(); j++)
|
|
||||||
{
|
|
||||||
Print(textbox[i].xp + 8, textbox[i].yp + 8 + (j * 8), textbox[i].line[j], 196, 196, 255 - help.glow);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -857,19 +867,9 @@ void Graphics::drawgui(void)
|
||||||
drawcoloredtile(textbox[i].xp + textbox[i].w-8, textbox[i].yp + 8 + (k * 8), 44, textbox[i].r, textbox[i].g, textbox[i].b);
|
drawcoloredtile(textbox[i].xp + textbox[i].w-8, textbox[i].yp + 8 + (k * 8), 44, textbox[i].r, textbox[i].g, textbox[i].b);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(flipmode)
|
|
||||||
{
|
|
||||||
for (size_t j = 0; j < textbox[i].line.size(); j++)
|
for (size_t j = 0; j < textbox[i].line.size(); j++)
|
||||||
{
|
{
|
||||||
Print(textbox[i].xp + 8, textbox[i].yp + (textbox[i].line.size()*8) - (j * 8), textbox[i].line[j], textbox[i].r, textbox[i].g, textbox[i].b);
|
Print(textbox[i].xp + 8, textbox[i].yp + text_yoff + text_sign * (j * 8), textbox[i].line[j], textbox[i].r, textbox[i].g, textbox[i].b);
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (size_t j = 0; j < textbox[i].line.size(); j++)
|
|
||||||
{
|
|
||||||
Print(textbox[i].xp + 8, textbox[i].yp +8 + (j * 8), textbox[i].line[j], textbox[i].r, textbox[i].g, textbox[i].b);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue