From 3697487f47c3c4d5cae01c7a5b7e8c4c2212e3c6 Mon Sep 17 00:00:00 2001 From: Fredrik Ljungdahl Date: Sat, 25 Jan 2020 19:20:37 +0100 Subject: [PATCH] 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. --- desktop_version/src/Map.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/desktop_version/src/Map.cpp b/desktop_version/src/Map.cpp index 57d73063..27505aae 100644 --- a/desktop_version/src/Map.cpp +++ b/desktop_version/src/Map.cpp @@ -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!