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

Fix tower quicksave bug (only appeared in some builds)

I ran the game through Valgrind to catch various issues.
One thing caught my attention -- map.resumedelay. This is
used by The Tower/etc to add a delay before the game is
resumed (probably for camera controls delaying it) for
spawning the player. This variable was uninitialized. Notably,
if I explicitly set it to 592851 or similar, it reproduces the
bug, even if I cannot reproduce it with my typical compilation
flags. So fixing this by initializing it to 0, alongside some
other Valgrind warnings, should fix the problem entirely.
This commit is contained in:
Fredrik Ljungdahl 2020-01-25 00:18:15 +01:00 committed by Ethan Lee
parent 2ec1106741
commit 9296547feb
2 changed files with 8 additions and 2 deletions

View file

@ -219,7 +219,7 @@ public:
std::vector<int> customcollect; std::vector<int> customcollect;
int nblocks; int nblocks;
bool skipblocks, skipdirblocks; bool skipblocks = false, skipdirblocks;
int platformtile; int platformtile;
bool vertplatforms, horplatforms; bool vertplatforms, horplatforms;

View file

@ -3425,6 +3425,8 @@ void scriptclass::hardreset( KeyPoll& key, Graphics& dwgfx, Game& game,mapclass&
game.teleport = false; game.teleport = false;
game.companion = 0; game.companion = 0;
game.roomchange = false; game.roomchange = false;
game.roomx = 0;
game.roomy = 0;
game.teleport_to_new_area = false; game.teleport_to_new_area = false;
game.teleport_to_x = 0; game.teleport_to_x = 0;
game.teleport_to_y = 0; game.teleport_to_y = 0;
@ -3460,6 +3462,8 @@ void scriptclass::hardreset( KeyPoll& key, Graphics& dwgfx, Game& game,mapclass&
game.savetime = "00:00"; game.savetime = "00:00";
game.savearea = "nowhere"; game.savearea = "nowhere";
game.savetrinkets = 0; game.savetrinkets = 0;
game.saverx = 0;
game.savery = 0;
game.intimetrial = false; game.intimetrial = false;
game.timetrialcountdown = 0; game.timetrialcountdown = 0;
@ -3534,7 +3538,9 @@ void scriptclass::hardreset( KeyPoll& key, Graphics& dwgfx, Game& game,mapclass&
map.resetnames(); map.resetnames();
map.custommode=false; map.custommode=false;
map.custommodeforreal=false; map.custommodeforreal=false;
map.towermode=false;
map.cameraseekframe = 0;
map.resumedelay = 0;
map.customshowmm=true; map.customshowmm=true;
for (j = 0; j < 20; j++) for (j = 0; j < 20; j++)