mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-08 18:09:45 +01:00
Fix filter/screenshake/flash update order
In 2.2, at render time, the game rendered screenshakes and flashes if their timers were above 0, and then decremented them afterwards. The game would also update the analogue filter right before rendering it, too. In 2.3, this was changed so the flash and screenshake timers were unified, and also done at the end of the frame - right before rendering happened. This resulted in 1-frame flashes and screenshakes not rendering at all. The other changes in this patchset don't fix this either. The analogue filter was also in the wrong order, but that is less of an issue than flashes and screenshakes. So, what I've done is made the flash and screenshake timers update right before the loop switches over to rendering, and only decrements them when we switch back to fixed functions (after rendering). The analogue filter is also updated right before rendering as well. This restores 1-frame flashes and screenshakes, as well as restores the correct order of analogue filter updates.
This commit is contained in:
parent
094209bd12
commit
287061c768
3 changed files with 36 additions and 15 deletions
|
@ -8,6 +8,7 @@
|
|||
#include "Entity.h"
|
||||
#include "Exit.h"
|
||||
#include "FileSystemUtils.h"
|
||||
#include "GraphicsUtil.h"
|
||||
#include "Map.h"
|
||||
#include "Music.h"
|
||||
#include "Screen.h"
|
||||
|
@ -3069,6 +3070,32 @@ void Graphics::renderwithscreeneffects(void)
|
|||
}
|
||||
}
|
||||
|
||||
void Graphics::renderfixedpre(void)
|
||||
{
|
||||
if (game.screenshake > 0)
|
||||
{
|
||||
updatescreenshake();
|
||||
}
|
||||
|
||||
if (screenbuffer != NULL && screenbuffer->badSignalEffect)
|
||||
{
|
||||
UpdateFilter();
|
||||
}
|
||||
}
|
||||
|
||||
void Graphics::renderfixedpost(void)
|
||||
{
|
||||
/* Screen effects timers */
|
||||
if (game.flashlight > 0)
|
||||
{
|
||||
--game.flashlight;
|
||||
}
|
||||
if (game.screenshake > 0)
|
||||
{
|
||||
--game.screenshake;
|
||||
}
|
||||
}
|
||||
|
||||
void Graphics::bigrprint(int x, int y, std::string& t, int r, int g, int b, bool cen, float sc)
|
||||
{
|
||||
std::vector<SDL_Surface*>& font = flipmode ? flipbfont : bfont;
|
||||
|
|
|
@ -156,6 +156,8 @@ public:
|
|||
|
||||
void render(void);
|
||||
void renderwithscreeneffects(void);
|
||||
void renderfixedpre(void);
|
||||
void renderfixedpost(void);
|
||||
|
||||
bool Hitest(SDL_Surface* surface1, point p1, SDL_Surface* surface2, point p2);
|
||||
|
||||
|
|
|
@ -318,6 +318,9 @@ static enum LoopCode loop_run_active_funcs(void)
|
|||
}
|
||||
}
|
||||
|
||||
/* About to switch over to rendering... but call this first. */
|
||||
graphics.renderfixedpre();
|
||||
|
||||
return Loop_stop;
|
||||
}
|
||||
|
||||
|
@ -682,6 +685,9 @@ static void inline deltaloop(void)
|
|||
|
||||
accumulator = SDL_fmodf(accumulator, timesteplimit);
|
||||
|
||||
/* We are done rendering. */
|
||||
graphics.renderfixedpost();
|
||||
|
||||
fixedloop();
|
||||
}
|
||||
const float alpha = game.over30mode ? static_cast<float>(accumulator) / timesteplimit : 1.0f;
|
||||
|
@ -744,25 +750,11 @@ static void focused_begin(void)
|
|||
|
||||
static void focused_end(void)
|
||||
{
|
||||
//Screen effects timers
|
||||
if (game.flashlight > 0)
|
||||
{
|
||||
game.flashlight--;
|
||||
}
|
||||
if (game.screenshake > 0)
|
||||
{
|
||||
game.screenshake--;
|
||||
graphics.updatescreenshake();
|
||||
}
|
||||
/* no-op. */
|
||||
}
|
||||
|
||||
static enum LoopCode loop_end(void)
|
||||
{
|
||||
if (graphics.screenbuffer->badSignalEffect)
|
||||
{
|
||||
UpdateFilter();
|
||||
}
|
||||
|
||||
//We did editorinput, now it's safe to turn this off
|
||||
key.linealreadyemptykludge = false;
|
||||
|
||||
|
|
Loading…
Reference in a new issue