1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-18 10:38:31 +02:00

Fix minor issue with respawning into a tower

When the game enter towermode, it adjusts player amd camera x/y depending
on what screen the player entered it from (The Tower) or the loadlevel
mode ("minitowers"; Panic Room and The Final Challenge). This code didn't
account for respawning to checkpoints. This is unlikely to matter in most
circumstances, but can cause problems in some corner cases, or with R abuse.
This could cause a player to die, respawn outside camera edges and then
immediately die again due to the edge spikes, repositioning the camera
properly. Invincibility would cause further issues, but that's Invincibility
Mode for you -- if this was the only problem I wouldn't bother.

I added a check that repositions the tower camera appropriately if a player
enter a tower as part of the respawn process.
This commit is contained in:
Fredrik Ljungdahl 2020-01-25 19:20:37 +01:00 committed by Ethan Lee
parent b79f0daa5f
commit 3697487f47

View File

@ -826,6 +826,7 @@ void mapclass::showship()
void mapclass::resetplayer(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music)
{
bool was_in_tower = towermode;
if (game.roomx != game.saverx || game.roomy != game.savery)
{
gotoroom(game.saverx, game.savery, dwgfx, game, obj, music);
@ -845,6 +846,17 @@ void mapclass::resetplayer(Graphics& dwgfx, Game& game, entityclass& obj, musicc
obj.entities[i].colour = 0;
game.lifeseq = 10;
obj.entities[i].invis = true;
// If we entered a tower as part of respawn, reposition camera
if (!was_in_tower && towermode)
{
ypos = obj.entities[i].yp - 120;
if (ypos < 0)
{
ypos = 0;
}
bypos = ypos / 2;
}
}
game.scmhurt = false; //Just in case the supercrewmate is fucking this up!