mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-30 01:48:15 +03:00
Fix colors updating too fast in TITLEMODE/MAPMODE/GAMECOMPLETEMODE
These colors were of the colors of each crewmate, the inactive crewmate color, and the color of the trinket and clock on the quicksave/summary screens. These colors all used fRandom() and so kept updating too quickly because they would be recalculated every time the delta-timestep render function got called, which isn't ideal. Thus, I've had to add attributes onto the Graphics class to store these colors and make sure they're only recalculated in logic functions instead. Thankfully, the color used for the sprites on the time trial results screen doesn't use fRandom(), so I don't have to worry about those. There's a new version of Graphics::drawsprite() that takes in a pre-made color already, instead of a color ID. As well, I've also added Graphics::updatetitlecolours() to update these colors on the title screen.
This commit is contained in:
@@ -17,6 +17,27 @@ void titlelogic()
|
||||
graphics.updatetowerbackground();
|
||||
}
|
||||
|
||||
if (!game.menustart)
|
||||
{
|
||||
graphics.col_tr = (int)(164 - (help.glow / 2) - int(fRandom() * 4));
|
||||
graphics.col_tg = 164 - (help.glow / 2) - int(fRandom() * 4);
|
||||
graphics.col_tb = 164 - (help.glow / 2) - int(fRandom() * 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.col_tr = map.r - (help.glow / 4) - int(fRandom() * 4);
|
||||
graphics.col_tg = map.g - (help.glow / 4) - int(fRandom() * 4);
|
||||
graphics.col_tb = map.b - (help.glow / 4) - int(fRandom() * 4);
|
||||
if (graphics.col_tr < 0) graphics.col_tr = 0;
|
||||
if(graphics.col_tr>255) graphics.col_tr=255;
|
||||
if (graphics.col_tg < 0) graphics.col_tg = 0;
|
||||
if(graphics.col_tg>255) graphics.col_tg=255;
|
||||
if (graphics.col_tb < 0) graphics.col_tb = 0;
|
||||
if(graphics.col_tb>255) graphics.col_tb=255;
|
||||
|
||||
graphics.updatetitlecolours();
|
||||
}
|
||||
|
||||
graphics.crewframedelay--;
|
||||
if (graphics.crewframedelay <= 0)
|
||||
{
|
||||
@@ -51,6 +72,7 @@ void maplogic()
|
||||
//Misc
|
||||
help.updateglow();
|
||||
graphics.updatetextboxes();
|
||||
graphics.updatetitlecolours();
|
||||
|
||||
graphics.crewframedelay--;
|
||||
if (graphics.crewframedelay <= 0)
|
||||
@@ -103,6 +125,17 @@ void gamecompletelogic()
|
||||
help.updateglow();
|
||||
graphics.crewframe = 0;
|
||||
map.scrolldir = 1;
|
||||
graphics.updatetitlecolours();
|
||||
|
||||
graphics.col_tr = map.r - (help.glow / 4) - fRandom() * 4;
|
||||
graphics.col_tg = map.g - (help.glow / 4) - fRandom() * 4;
|
||||
graphics.col_tb = map.b - (help.glow / 4) - fRandom() * 4;
|
||||
if (graphics.col_tr < 0) graphics.col_tr = 0;
|
||||
if(graphics.col_tr>255) graphics.col_tr=255;
|
||||
if (graphics.col_tg < 0) graphics.col_tg = 0;
|
||||
if(graphics.col_tg>255) graphics.col_tg=255;
|
||||
if (graphics.col_tb < 0) graphics.col_tb = 0;
|
||||
if(graphics.col_tb>255) graphics.col_tb=255;
|
||||
|
||||
game.creditposition--;
|
||||
if (game.creditposition <= -game.creditmaxposition)
|
||||
|
||||
Reference in New Issue
Block a user