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

Don't update crewmate colors in text boxes every deltaframe

Colors in over-30-FPS mode shouldn't be updating every deltaframe;
mostly to ensure determinism between switching 30-mode and over-30 mode.
I'm going to overhaul RNG in 2.4 anyway, but right now I'm going to fix
this because I missed it.

The RNG of each special text box is stored in a temporary variable on
the text box itself, and only updated if the color uses it (hence the
big if-statement). Lots of code duplication, but this is acceptable for
now.
This commit is contained in:
Misa 2021-03-23 14:29:32 -07:00 committed by Ethan Lee
parent d749e7e6e8
commit 92416cd910
3 changed files with 18 additions and 4 deletions

View file

@ -955,7 +955,7 @@ void Graphics::drawgui(void)
if (textbox[i].tr == 175 && textbox[i].tg == 175) if (textbox[i].tr == 175 && textbox[i].tg == 175)
{ {
//purple guy //purple guy
drawsprite(80 - 6, crew_yp, crew_sprite, 220- help.glow/4 - int(fRandom()*20), 120- help.glow/4, 210 - help.glow/4); drawsprite(80 - 6, crew_yp, crew_sprite, 220- help.glow/4 - textbox[i].rand, 120- help.glow/4, 210 - help.glow/4);
} }
else if (textbox[i].tr == 175 && textbox[i].tb == 175) else if (textbox[i].tr == 175 && textbox[i].tb == 175)
{ {
@ -965,17 +965,17 @@ void Graphics::drawgui(void)
else if (textbox[i].tr == 175) else if (textbox[i].tr == 175)
{ {
//green guy //green guy
drawsprite(80 - 6, crew_yp, crew_sprite, 120 - help.glow / 4 - int(fRandom() * 20), 220 - help.glow / 4, 120 - help.glow / 4); drawsprite(80 - 6, crew_yp, crew_sprite, 120 - help.glow / 4 - textbox[i].rand, 220 - help.glow / 4, 120 - help.glow / 4);
} }
else if (textbox[i].tg == 175) else if (textbox[i].tg == 175)
{ {
//yellow guy //yellow guy
drawsprite(80 - 6, crew_yp, crew_sprite, 220- help.glow/4 - int(fRandom()*20), 210 - help.glow/4, 120- help.glow/4); drawsprite(80 - 6, crew_yp, crew_sprite, 220- help.glow/4 - textbox[i].rand, 210 - help.glow/4, 120- help.glow/4);
} }
else if (textbox[i].tb == 175) else if (textbox[i].tb == 175)
{ {
//blue guy //blue guy
drawsprite(80 - 6, crew_yp, crew_sprite, 75, 75, 255- help.glow/4 - int(fRandom()*20)); drawsprite(80 - 6, crew_yp, crew_sprite, 75, 75, 255- help.glow/4 - textbox[i].rand);
} }
} }
} }
@ -992,6 +992,16 @@ void Graphics::updatetextboxes(void)
i--; i--;
continue; continue;
} }
if (textbox[i].tl >= 1.0f
&& ((textbox[i].tr == 175 && textbox[i].tg == 175)
|| textbox[i].tr == 175
|| textbox[i].tg == 175
|| textbox[i].tb == 175)
&& (textbox[i].tr != 175 || textbox[i].tb != 175))
{
textbox[i].rand = fRandom() * 20;
}
} }
} }

View file

@ -23,6 +23,8 @@ textboxclass::textboxclass(void)
max = 0; max = 0;
flipme = false; flipme = false;
rand = 0;
} }
void textboxclass::centerx(void) void textboxclass::centerx(void)

View file

@ -45,6 +45,8 @@ public:
/* Whether to flip text box y-position in Flip Mode. */ /* Whether to flip text box y-position in Flip Mode. */
bool flipme; bool flipme;
int rand;
}; };
#endif /* TEXTBOX_H */ #endif /* TEXTBOX_H */