From 1d40bbdbc7a4fdf33905e35cd2f9741c1cdccd79 Mon Sep 17 00:00:00 2001 From: Misa Date: Wed, 9 Sep 2020 16:10:16 -0700 Subject: [PATCH] Restore pre-2.1 warp bypass glitch in glitchrunner mode So, I was staring at VVVVVV code one day, as I usually do, and I noticed that warp lines had this curious code in entityclass::updateentities() that set their statedelay to 2, and I thought, hm, maybe the pre-2.1 warp line bypass is caused by this statedelay. And, it doesn't seem like this is the primary code used to detect if the player collides with warp lines, the actual code is commented with "Rewritten system for mobile update" and bolted-on in gamelogic() instead of properly being in entityclass::entitycollisioncheck(). So, after getting tripped up on the misleading indentation of that "Rewritten system" block, I removed the rewritten system, re-added collision detection for rule 7 (horizontal warp lines), and after checking the resulting behavior, it appears to be nearly identical to that of warp lines in 2.0. You see, if you use warp lines to flip up from the top of the screen onto the bottom of the screen, close to the edge of the bottom of the screen, Viridian's head will display on the top of the screen in 2.0. In 2.1 and later, this doesn't happen, confirming that my theory is correct. I also performed warp line bypass multiple times in 2.0 and with my restored code, and it is pretty much the exact same behavior. So now, the pre-2.1 warp line bypass glitch has been re-enabled in glitchrunner mode. --- desktop_version/src/Entity.cpp | 12 +++++++++++- desktop_version/src/Logic.cpp | 20 +++++++++++--------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/desktop_version/src/Entity.cpp b/desktop_version/src/Entity.cpp index 1292d8ee..27bb6d5f 100644 --- a/desktop_version/src/Entity.cpp +++ b/desktop_version/src/Entity.cpp @@ -4728,7 +4728,7 @@ void entityclass::entitycollisioncheck() } } } - if (entities[j].rule == 5) //Player vs vertical line! + if (entities[j].rule == 5) //Player vs vertical gravity/warp line! { if(game.deathseq==-1) { @@ -4758,6 +4758,16 @@ void entityclass::entitycollisioncheck() } } } + if (entities[j].rule == 7) // Player versus horizontal warp line, pre-2.1 + { + if (game.glitchrunnermode + && game.deathseq == -1 + && entities[j].onentity > 0 + && entityhlinecollide(i, j)) + { + entities[j].state = entities[j].onentity; + } + } } } } diff --git a/desktop_version/src/Logic.cpp b/desktop_version/src/Logic.cpp index 62daf06b..f6a5e6d5 100644 --- a/desktop_version/src/Logic.cpp +++ b/desktop_version/src/Logic.cpp @@ -1022,16 +1022,18 @@ void gamelogic() //Using warplines? if (obj.customwarpmode) { - //Rewritten system for mobile update: basically, the new logic is to - //check if the player is leaving the map, and if so do a special check against - //warp lines for collision - obj.customwarpmodehon = false; - obj.customwarpmodevon = false; + if (!game.glitchrunnermode) { + //Rewritten system for mobile update: basically, the new logic is to + //check if the player is leaving the map, and if so do a special check against + //warp lines for collision + obj.customwarpmodehon = false; + obj.customwarpmodevon = false; - int i = obj.getplayer(); - if (i > -1 && ((game.door_down > -2 && obj.entities[i].yp >= 226-16) || (game.door_up > -2 && obj.entities[i].yp < -2+16) || (game.door_left > -2 && obj.entities[i].xp < -14+16) || (game.door_right > -2 && obj.entities[i].xp >= 308-16))){ - //Player is leaving room - obj.customwarplinecheck(i); + int i = obj.getplayer(); + if (i > -1 && ((game.door_down > -2 && obj.entities[i].yp >= 226-16) || (game.door_up > -2 && obj.entities[i].yp < -2+16) || (game.door_left > -2 && obj.entities[i].xp < -14+16) || (game.door_right > -2 && obj.entities[i].xp >= 308-16))){ + //Player is leaving room + obj.customwarplinecheck(i); + } } if(obj.customwarpmodehon){ map.warpy=true;