1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-11-04 18:29:41 +01:00

Fix background smearing pushing tower camera with invincibility

If you have invincibility enabled and push the camera, the background
would smear. This is because the game doesn't calculate the proper
bscroll and bypos of the tower background, and also doesn't end up
redrawing it.

We do both these things now, so this is fixed.
This commit is contained in:
Misa 2021-03-28 12:53:08 -07:00 committed by Ethan Lee
parent 7c55b449e0
commit 5c3fbd0022

View file

@ -896,17 +896,25 @@ void gamelogic(void)
} }
else if (INBOUNDS_VEC(player, obj.entities)) else if (INBOUNDS_VEC(player, obj.entities))
{ {
if (obj.entities[player].yp-map.ypos <= 0) const bool above_screen = obj.entities[player].yp-map.ypos <= 8;
const bool below_screen = obj.entities[player].yp-map.ypos >= 200;
if (above_screen)
{ {
map.ypos-=10; map.ypos-=10;
graphics.towerbg.bypos = map.ypos / 2;
graphics.towerbg.bscroll = 0;
} }
else if (obj.entities[player].yp-map.ypos >= 208) else if (below_screen)
{ {
map.ypos+=2; map.ypos+=2;
}
if (above_screen || below_screen)
{
graphics.towerbg.bypos = map.ypos / 2; graphics.towerbg.bypos = map.ypos / 2;
graphics.towerbg.bscroll = 0; graphics.towerbg.bscroll = (map.ypos - map.oldypos) / 2;
/* The buffer isn't big enough; we have to redraw */
graphics.towerbg.tdrawback = true;
} }
} }