mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 10:09:43 +01:00
Interpolate scrolling in Analogue Mode filter
I can't really make the filter update only every timestep, because it's per-pixel and operates on deltaframes too, so it TECHNICALLY runs faster in over-30-FPS mode than not. That said, it's not really noticeable, the filter doesn't look bad for updating more often or anything. However, I can at least interpolate the scrolling, so it's smooth in over-30-FPS mode.
This commit is contained in:
parent
65a5dbe3a3
commit
1a2dd787f3
1 changed files with 4 additions and 1 deletions
|
@ -316,6 +316,7 @@ void BlitSurfaceTinted(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int oldscrollamount = 0;
|
||||||
int scrollamount = 0;
|
int scrollamount = 0;
|
||||||
bool isscrolling = 0;
|
bool isscrolling = 0;
|
||||||
|
|
||||||
|
@ -326,12 +327,14 @@ void UpdateFilter()
|
||||||
isscrolling = true;
|
isscrolling = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
oldscrollamount = scrollamount;
|
||||||
if(isscrolling == true)
|
if(isscrolling == true)
|
||||||
{
|
{
|
||||||
scrollamount += 20;
|
scrollamount += 20;
|
||||||
if(scrollamount > 240)
|
if(scrollamount > 240)
|
||||||
{
|
{
|
||||||
scrollamount = 0;
|
scrollamount = 0;
|
||||||
|
oldscrollamount = 0;
|
||||||
isscrolling = false;
|
isscrolling = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -348,7 +351,7 @@ SDL_Surface* ApplyFilter( SDL_Surface* _src )
|
||||||
{
|
{
|
||||||
for(int y = 0; y < _src->h; y++)
|
for(int y = 0; y < _src->h; y++)
|
||||||
{
|
{
|
||||||
int sampley = (y + scrollamount )% 240;
|
int sampley = (y + (int) graphics.lerp(oldscrollamount, scrollamount) )% 240;
|
||||||
|
|
||||||
Uint32 pixel = ReadPixel(_src, x,sampley);
|
Uint32 pixel = ReadPixel(_src, x,sampley);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue