mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59:43 +01:00
Fix special text box images sometimes flashing
These special images are the crewmates, Level Complete, and Game Complete images. They flashed depending on if you were lucky and happened to got your delta-timesteps just right when text boxes were fading in and out. Honestly, I'm surprised text box fading in/out hasn't ran into this issue before. It's insane luck that this issue hasn't occurred before or anything. Well, anyways, to fix this, there's now an attribute `allowspecial` on text boxes, and an optional parameter of the same name for Graphics::createtextbox(). This attribute is the only thing that will let these special text box images render. And any createtextbox()es that utilize these special images have been updated accordingly.
This commit is contained in:
parent
27fe7ff8f9
commit
b3f7c174ea
5 changed files with 40 additions and 36 deletions
|
@ -2398,11 +2398,11 @@ void Game::updatestate()
|
|||
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox("", -1, 180, 165, 165, 255);
|
||||
graphics.createtextbox("", -1, 180, 165, 165, 255, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.createtextbox("", -1, 12, 165, 165, 255);
|
||||
graphics.createtextbox("", -1, 12, 165, 165, 255, true);
|
||||
}
|
||||
//graphics.addline(" Level Complete! ");
|
||||
graphics.addline(" ");
|
||||
|
@ -2422,11 +2422,11 @@ void Game::updatestate()
|
|||
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox("", -1, 104, 175,174,174);
|
||||
graphics.createtextbox("", -1, 104, 175,174,174, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.createtextbox("", -1, 64+8+16, 175,174,174);
|
||||
graphics.createtextbox("", -1, 64+8+16, 175,174,174, true);
|
||||
}
|
||||
graphics.addline(" You have rescued ");
|
||||
graphics.addline(" a crew member! ");
|
||||
|
@ -2515,11 +2515,11 @@ void Game::updatestate()
|
|||
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox("", -1, 180, 165, 165, 255);
|
||||
graphics.createtextbox("", -1, 180, 165, 165, 255, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.createtextbox("", -1, 12, 165, 165, 255);
|
||||
graphics.createtextbox("", -1, 12, 165, 165, 255, true);
|
||||
}
|
||||
//graphics.addline(" Level Complete! ");
|
||||
graphics.addline(" ");
|
||||
|
@ -2539,11 +2539,11 @@ void Game::updatestate()
|
|||
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox("", -1, 104, 174,175,174);
|
||||
graphics.createtextbox("", -1, 104, 174,175,174, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.createtextbox("", -1, 64+8+16, 174,175,174);
|
||||
graphics.createtextbox("", -1, 64+8+16, 174,175,174, true);
|
||||
}
|
||||
graphics.addline(" You have rescued ");
|
||||
graphics.addline(" a crew member! ");
|
||||
|
@ -2631,11 +2631,11 @@ void Game::updatestate()
|
|||
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox("", -1, 180, 165, 165, 255);
|
||||
graphics.createtextbox("", -1, 180, 165, 165, 255, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.createtextbox("", -1, 12, 165, 165, 255);
|
||||
graphics.createtextbox("", -1, 12, 165, 165, 255, true);
|
||||
}
|
||||
//graphics.addline(" Level Complete! ");
|
||||
graphics.addline(" ");
|
||||
|
@ -2655,11 +2655,11 @@ void Game::updatestate()
|
|||
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox("", -1, 104, 174,174,175);
|
||||
graphics.createtextbox("", -1, 104, 174,174,175, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.createtextbox("", -1, 64+8+16, 174,174,175);
|
||||
graphics.createtextbox("", -1, 64+8+16, 174,174,175, true);
|
||||
}
|
||||
graphics.addline(" You have rescued ");
|
||||
graphics.addline(" a crew member! ");
|
||||
|
@ -2748,11 +2748,11 @@ void Game::updatestate()
|
|||
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox("", -1, 180, 165, 165, 255);
|
||||
graphics.createtextbox("", -1, 180, 165, 165, 255, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.createtextbox("", -1, 12, 165, 165, 255);
|
||||
graphics.createtextbox("", -1, 12, 165, 165, 255, true);
|
||||
}
|
||||
//graphics.addline(" Level Complete! ");
|
||||
graphics.addline(" ");
|
||||
|
@ -2772,11 +2772,11 @@ void Game::updatestate()
|
|||
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox("", -1, 104, 175,175,174);
|
||||
graphics.createtextbox("", -1, 104, 175,175,174, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.createtextbox("", -1, 64+8+16, 175,175,174);
|
||||
graphics.createtextbox("", -1, 64+8+16, 175,175,174, true);
|
||||
}
|
||||
graphics.addline(" You have rescued ");
|
||||
graphics.addline(" a crew member! ");
|
||||
|
@ -2883,11 +2883,11 @@ void Game::updatestate()
|
|||
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox("", -1, 180, 165, 165, 255);
|
||||
graphics.createtextbox("", -1, 180, 165, 165, 255, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.createtextbox("", -1, 12, 165, 165, 255);
|
||||
graphics.createtextbox("", -1, 12, 165, 165, 255, true);
|
||||
}
|
||||
//graphics.addline(" Level Complete! ");
|
||||
graphics.addline(" ");
|
||||
|
@ -2907,11 +2907,11 @@ void Game::updatestate()
|
|||
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox("", -1, 104, 175,174,175);
|
||||
graphics.createtextbox("", -1, 104, 175,174,175, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.createtextbox("", -1, 64+8+16, 175,174,175);
|
||||
graphics.createtextbox("", -1, 64+8+16, 175,174,175, true);
|
||||
}
|
||||
graphics.addline(" You have rescued ");
|
||||
graphics.addline(" a crew member! ");
|
||||
|
@ -3179,11 +3179,11 @@ void Game::updatestate()
|
|||
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox("", -1, 180, 164, 165, 255);
|
||||
graphics.createtextbox("", -1, 180, 164, 165, 255, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.createtextbox("", -1, 12, 164, 165, 255);
|
||||
graphics.createtextbox("", -1, 12, 164, 165, 255, true);
|
||||
}
|
||||
graphics.addline(" ");
|
||||
graphics.addline("");
|
||||
|
|
|
@ -667,7 +667,7 @@ void Graphics::drawgui()
|
|||
}
|
||||
}
|
||||
|
||||
if ((textbox[i].yp == 12 || textbox[i].yp == 180) && textbox[i].r == 165)
|
||||
if ((textbox[i].yp == 12 || textbox[i].yp == 180) && textbox[i].r == 165 && textbox[i].allowspecial)
|
||||
{
|
||||
if (flipmode)
|
||||
{
|
||||
|
@ -678,7 +678,7 @@ void Graphics::drawgui()
|
|||
drawimage(0, 0, 12, true);
|
||||
}
|
||||
}
|
||||
else if ((textbox[i].yp == 12 || textbox[i].yp == 180) && textbox[i].g == 165)
|
||||
else if ((textbox[i].yp == 12 || textbox[i].yp == 180) && textbox[i].g == 165 && textbox[i].allowspecial)
|
||||
{
|
||||
if (flipmode)
|
||||
{
|
||||
|
@ -691,27 +691,27 @@ void Graphics::drawgui()
|
|||
}
|
||||
if (flipmode)
|
||||
{
|
||||
if (textbox[i].r == 175 && textbox[i].g == 175)
|
||||
if (textbox[i].r == 175 && textbox[i].g == 175 && textbox[i].allowspecial)
|
||||
{
|
||||
//purple guy
|
||||
drawsprite(80 - 6, 64 + 48 + 4, 6, 220- help.glow/4 - int(fRandom()*20), 120- help.glow/4, 210 - help.glow/4);
|
||||
}
|
||||
else if (textbox[i].r == 175 && textbox[i].b == 175)
|
||||
else if (textbox[i].r == 175 && textbox[i].b == 175 && textbox[i].allowspecial)
|
||||
{
|
||||
//red guy
|
||||
drawsprite(80 - 6, 64 + 48+ 4, 6, 255 - help.glow/8, 70 - help.glow/4, 70 - help.glow / 4);
|
||||
}
|
||||
else if (textbox[i].r == 175)
|
||||
else if (textbox[i].r == 175 && textbox[i].allowspecial)
|
||||
{
|
||||
//green guy
|
||||
drawsprite(80 - 6, 64 + 48 + 4, 6, 120 - help.glow / 4 - int(fRandom() * 20), 220 - help.glow / 4, 120 - help.glow / 4);
|
||||
}
|
||||
else if (textbox[i].g == 175)
|
||||
else if (textbox[i].g == 175 && textbox[i].allowspecial)
|
||||
{
|
||||
//yellow guy
|
||||
drawsprite(80 - 6, 64 + 48+ 4, 6, 220- help.glow/4 - int(fRandom()*20), 210 - help.glow/4, 120- help.glow/4);
|
||||
}
|
||||
else if (textbox[i].b == 175)
|
||||
else if (textbox[i].b == 175 && textbox[i].allowspecial)
|
||||
{
|
||||
//blue guy
|
||||
drawsprite(80 - 6, 64 + 48+ 4, 6, 75, 75, 255- help.glow/4 - int(fRandom()*20));
|
||||
|
@ -719,27 +719,27 @@ void Graphics::drawgui()
|
|||
}
|
||||
else
|
||||
{
|
||||
if (textbox[i].r == 175 && textbox[i].g == 175)
|
||||
if (textbox[i].r == 175 && textbox[i].g == 175 && textbox[i].allowspecial)
|
||||
{
|
||||
//purple guy
|
||||
drawsprite(80 - 6, 64 + 32 + 4, 0, 220- help.glow/4 - int(fRandom()*20), 120- help.glow/4, 210 - help.glow/4);
|
||||
}
|
||||
else if (textbox[i].r == 175 && textbox[i].b == 175)
|
||||
else if (textbox[i].r == 175 && textbox[i].b == 175 && textbox[i].allowspecial)
|
||||
{
|
||||
//red guy
|
||||
drawsprite(80 - 6, 64 + 32 + 4, 0, 255 - help.glow/8, 70 - help.glow/4, 70 - help.glow / 4);
|
||||
}
|
||||
else if (textbox[i].r == 175)
|
||||
else if (textbox[i].r == 175 && textbox[i].allowspecial)
|
||||
{
|
||||
//green guy
|
||||
drawsprite(80 - 6, 64 + 32 + 4, 0, 120 - help.glow / 4 - int(fRandom() * 20), 220 - help.glow / 4, 120 - help.glow / 4);
|
||||
}
|
||||
else if (textbox[i].g == 175)
|
||||
else if (textbox[i].g == 175 && textbox[i].allowspecial)
|
||||
{
|
||||
//yellow guy
|
||||
drawsprite(80 - 6, 64 + 32 + 4, 0, 220- help.glow/4 - int(fRandom()*20), 210 - help.glow/4, 120- help.glow/4);
|
||||
}
|
||||
else if (textbox[i].b == 175)
|
||||
else if (textbox[i].b == 175 && textbox[i].allowspecial)
|
||||
{
|
||||
//blue guy
|
||||
drawsprite(80 - 6, 64 + 32 + 4, 0, 75, 75, 255- help.glow/4 - int(fRandom()*20));
|
||||
|
@ -1065,7 +1065,7 @@ void Graphics::textboxadjust()
|
|||
}
|
||||
|
||||
|
||||
void Graphics::createtextbox( std::string t, int xp, int yp, int r/*= 255*/, int g/*= 255*/, int b /*= 255*/ )
|
||||
void Graphics::createtextbox( std::string t, int xp, int yp, int r/*= 255*/, int g/*= 255*/, int b /*= 255*/, bool allowspecial/*= false*/ )
|
||||
{
|
||||
m = textbox.size();
|
||||
|
||||
|
@ -1079,6 +1079,7 @@ void Graphics::createtextbox( std::string t, int xp, int yp, int r/*= 255*/, int
|
|||
text.yp = yp;
|
||||
text.initcol(r, g, b);
|
||||
text.resize();
|
||||
text.allowspecial = allowspecial;
|
||||
textbox.push_back(text);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
|
||||
void setwarprect(int a, int b, int c, int d);
|
||||
|
||||
void createtextbox(std::string t, int xp, int yp, int r= 255, int g= 255, int b = 255);
|
||||
void createtextbox(std::string t, int xp, int yp, int r= 255, int g= 255, int b = 255, bool allowspecial = false);
|
||||
|
||||
void textboxcenter();
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ textboxclass::textboxclass()
|
|||
prev_tl = 0;
|
||||
tm = 0;
|
||||
timer = 0;
|
||||
allowspecial = false;
|
||||
}
|
||||
|
||||
void textboxclass::centerx()
|
||||
|
|
|
@ -45,6 +45,8 @@ public:
|
|||
|
||||
int max;
|
||||
|
||||
bool allowspecial;
|
||||
|
||||
};
|
||||
|
||||
#endif /* TEXTBOX_H */
|
||||
|
|
Loading…
Reference in a new issue