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 authored and Ethan Lee committed 2021-04-30 05:31:47 -04:00
1 parent 7c55b449e0
commit 5c3fbd0022
1 file changed
+13 -5
+13 -5
View File
@@ -896,17 +896,25 @@ void gamelogic(void)
}
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;
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;
}
if (above_screen || below_screen)
{
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;
}
}