1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Fix tower camera invincibility inconsistencies

If you have invincibility enabled, the tower camera behavior is
inconsistent.

In ascending towers, you can "push" the camera upwards; however you
cannot push it downwards; at least it stays still when it comes up to
you if you stay still. In descending towers, the camera moves quicker
when you're at the bottom of the screen, but it's slower than your
falling speed and quickly loses sight of you; the camera can be pushed
upwards; unfortunately it also does a "bumping" motion if you're
standing still when the camera reaches you, which gets real annoying and
isn't particularly pleasant to look at.

There are two problems, so this does two fixes:

1. Pushing the camera now applies the appropriate counter-offset
   depending on the direction of the tower. You can now push the camera
   downwards in ascending towers.

2. To fix the "bumping" when the camera reaches you if you stand still,
   there are now a 8-pixel-high "gray areas" at the top and bottom of
   the screen where the camera simply won't move if you're in them.

Doing these camera offsets instead of simply canceling the movement if
the player is offscreen is a bit ugly... but it works for now.
This commit is contained in:
Misa 2021-03-28 12:53:08 -07:00
parent 330162d1cb
commit bc382a4985

View file

@ -892,11 +892,53 @@ void gamelogic(void)
if (above_screen)
{
map.ypos-=10;
if (obj.entities[player].yp - map.ypos <= 0)
{
if (graphics.towerbg.scrolldir == 1)
{
/* Descending tower:
* Counteract 10 pixels of terminal velocity
* + 2 pixels of camera movement */
map.ypos -= 12;
}
else
{
/* Ascending tower:
* Move 8 out of 10 pixels of terminal velocity
* Camera movement will move 2 pixels for us */
map.ypos -= 8;
}
}
else
{
/* Counter 2 pixels of camera movement */
map.ypos -= 2;
}
}
else if (below_screen)
{
map.ypos+=2;
if (obj.entities[player].yp - map.ypos >= 208)
{
if (graphics.towerbg.scrolldir == 0)
{
/* Ascending tower:
* Counteract 10 pixels of terminal velocity
* + 2 pixels of camera movement */
map.ypos += 12;
}
else
{
/* Descending tower:
* Move 8 out of 10 pixels of terminal velocity
* Camera movement will move 2 pixels for us */
map.ypos += 8;
}
}
else
{
/* Counter 2 pixels of camera movement */
map.ypos += 2;
}
}
if (above_screen || below_screen)