mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-09 18:39:45 +01:00
Interpolate activity zone prompt fading in and out
To make it real smooth, just in case it was noticeable that it only updated at 1000/34 FPS before (well, except in slowmode, it's really noticeable THERE). Also this removes the re-typing out of (game.act_fade/10.0f) for every single R, G, and B in gamerender().
This commit is contained in:
parent
c56df48d75
commit
f53ed222d3
4 changed files with 8 additions and 4 deletions
|
@ -150,6 +150,7 @@ void Game::init(void)
|
||||||
completestop = false;
|
completestop = false;
|
||||||
activeactivity = -1;
|
activeactivity = -1;
|
||||||
act_fade = 0;
|
act_fade = 0;
|
||||||
|
prev_act_fade = 0;
|
||||||
backgroundtext = false;
|
backgroundtext = false;
|
||||||
startscript = false;
|
startscript = false;
|
||||||
newscript = "";
|
newscript = "";
|
||||||
|
|
|
@ -327,6 +327,7 @@ public:
|
||||||
bool backgroundtext;
|
bool backgroundtext;
|
||||||
|
|
||||||
int activeactivity, act_fade;
|
int activeactivity, act_fade;
|
||||||
|
int prev_act_fade;
|
||||||
|
|
||||||
bool press_left, press_right, press_action, press_map;
|
bool press_left, press_right, press_action, press_map;
|
||||||
|
|
||||||
|
|
|
@ -1516,6 +1516,7 @@ void gamelogic()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
game.prev_act_fade = game.act_fade;
|
||||||
if (game.activeactivity > -1)
|
if (game.activeactivity > -1)
|
||||||
{
|
{
|
||||||
if (game.act_fade < 5)
|
if (game.act_fade < 5)
|
||||||
|
|
|
@ -1629,21 +1629,22 @@ void gamerender()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float act_alpha = graphics.lerp(game.prev_act_fade, game.act_fade) / 10.0f;
|
||||||
if (game.activeactivity > -1)
|
if (game.activeactivity > -1)
|
||||||
{
|
{
|
||||||
game.activity_lastprompt = obj.blocks[game.activeactivity].prompt;
|
game.activity_lastprompt = obj.blocks[game.activeactivity].prompt;
|
||||||
game.activity_r = obj.blocks[game.activeactivity].r;
|
game.activity_r = obj.blocks[game.activeactivity].r;
|
||||||
game.activity_g = obj.blocks[game.activeactivity].g;
|
game.activity_g = obj.blocks[game.activeactivity].g;
|
||||||
game.activity_b = obj.blocks[game.activeactivity].b;
|
game.activity_b = obj.blocks[game.activeactivity].b;
|
||||||
graphics.drawtextbox(16, 4, 36, 3, game.activity_r*(game.act_fade/10.0f), game.activity_g*(game.act_fade/10.0f), game.activity_b*(game.act_fade/10.0f));
|
graphics.drawtextbox(16, 4, 36, 3, game.activity_r*act_alpha, game.activity_g*act_alpha, game.activity_b*act_alpha);
|
||||||
graphics.Print(5, 12, game.activity_lastprompt, game.activity_r*(game.act_fade/10.0f), game.activity_g*(game.act_fade/10.0f), game.activity_b*(game.act_fade/10.0f), true);
|
graphics.Print(5, 12, game.activity_lastprompt, game.activity_r*act_alpha, game.activity_g*act_alpha, game.activity_b*act_alpha, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(game.act_fade>5)
|
if(game.act_fade>5)
|
||||||
{
|
{
|
||||||
graphics.drawtextbox(16, 4, 36, 3, game.activity_r*(game.act_fade/10.0f), game.activity_g*(game.act_fade/10.0f), game.activity_b*(game.act_fade/10.0f));
|
graphics.drawtextbox(16, 4, 36, 3, game.activity_r*act_alpha, game.activity_g*act_alpha, game.activity_b*act_alpha);
|
||||||
graphics.Print(5, 12, game.activity_lastprompt, game.activity_r*(game.act_fade/10.0f), game.activity_g*(game.act_fade/10.0f), game.activity_b*(game.act_fade/10.0f), true);
|
graphics.Print(5, 12, game.activity_lastprompt, game.activity_r*act_alpha, game.activity_g*act_alpha, game.activity_b*act_alpha, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue