1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-01 18:43:33 +02:00

Move analogue mode filter update logic to fixed-timestep loop

Otherwise if the analogue filter is scrolling, it'll scroll by REALLY
fast.
This commit is contained in:
Misa 2020-05-02 20:27:47 -07:00 committed by Ethan Lee
parent 995f0f126f
commit 97b8e062ff
3 changed files with 14 additions and 4 deletions

View File

@ -315,11 +315,9 @@ void BlitSurfaceColoured(
int scrollamount = 0;
bool isscrolling = 0;
SDL_Surface* ApplyFilter( SDL_Surface* _src )
{
SDL_Surface* _ret = SDL_CreateRGBSurface(_src->flags, _src->w, _src->h, 32,
_src->format->Rmask, _src->format->Gmask, _src->format->Bmask, _src->format->Amask);
void UpdateFilter()
{
if (rand() % 4000 < 8)
{
isscrolling = true;
@ -334,6 +332,12 @@ SDL_Surface* ApplyFilter( SDL_Surface* _src )
isscrolling = false;
}
}
}
SDL_Surface* ApplyFilter( SDL_Surface* _src )
{
SDL_Surface* _ret = SDL_CreateRGBSurface(_src->flags, _src->w, _src->h, 32,
_src->format->Rmask, _src->format->Gmask, _src->format->Bmask, _src->format->Amask);
int redOffset = rand() % 4;

View File

@ -46,6 +46,7 @@ void ScrollSurface(SDL_Surface* _src, int pX, int py);
SDL_Surface * FlipSurfaceHorizontal(SDL_Surface* _src);
SDL_Surface * FlipSurfaceVerticle(SDL_Surface* _src);
SDL_Surface * ScaleSurfaceSlow( SDL_Surface *_surface, int Width, int Height );
void UpdateFilter();
SDL_Surface* ApplyFilter( SDL_Surface* _src );
#endif /* GRAPHICSUTIL_H */

View File

@ -486,6 +486,11 @@ int main(int argc, char *argv[])
graphics.updatescreenshake();
}
if (graphics.screenbuffer->badSignalEffect)
{
UpdateFilter();
}
//We did editorinput, now it's safe to turn this off
key.linealreadyemptykludge = false;