mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59:43 +01:00
Un-hardreset certain variables for glitchrunner mode
Ironically enough, resetting more variables in script.hardreset() makes the glitchy fadeout system even more glitchy. Resetting map.towermode, for example, makes it so that if you're in towers when you quit to the menu, script.hardreset() makes it so that the game thinks you're no longer inbounds (because it no longer thinks you're in a tower and thus considers coordinates in the space of 40x30 tiles to be inbounds instead of 40x700 or 40x100 tiles to be inbounds), calls map.gotoroom(), which resets the gamestate to 0. So if we're using the old system, it's better to reset only as much as needed. And furthermore, we shouldn't be relying on script.hardreset() to initialize variables for us. That should be done at the class constructor level. So I've gone ahead and initialized the variables in class constructors, too.
This commit is contained in:
parent
cb8540d7bd
commit
387ee4dc79
3 changed files with 28 additions and 5 deletions
|
@ -116,6 +116,13 @@ bool GetButtonFromString(const char *pText, SDL_GameControllerButton *button)
|
|||
|
||||
void Game::init(void)
|
||||
{
|
||||
roomx = 0;
|
||||
roomy = 0;
|
||||
prevroomx = 0;
|
||||
prevroomy = 0;
|
||||
saverx = 0;
|
||||
savery = 0;
|
||||
|
||||
mutebutton = 0;
|
||||
muted = false;
|
||||
musicmuted = false;
|
||||
|
|
|
@ -31,6 +31,10 @@ mapclass::mapclass()
|
|||
cursorstate = 0;
|
||||
cursordelay = 0;
|
||||
|
||||
towermode = false;
|
||||
cameraseekframe = 0;
|
||||
resumedelay = 0;
|
||||
|
||||
final_colormode = false;
|
||||
final_colorframe = 0;
|
||||
final_colorframedelay = 0;
|
||||
|
|
|
@ -3482,8 +3482,12 @@ void scriptclass::hardreset()
|
|||
game.teleport = false;
|
||||
game.companion = 0;
|
||||
game.roomchange = false;
|
||||
game.roomx = 0;
|
||||
game.roomy = 0;
|
||||
if (!game.glitchrunnermode)
|
||||
{
|
||||
// Ironically, resetting more variables makes the janky fadeout system in glitchrunnermode even more glitchy
|
||||
game.roomx = 0;
|
||||
game.roomy = 0;
|
||||
}
|
||||
game.prevroomx = 0;
|
||||
game.prevroomy = 0;
|
||||
game.teleport_to_new_area = false;
|
||||
|
@ -3521,8 +3525,12 @@ void scriptclass::hardreset()
|
|||
game.savetime = "00:00";
|
||||
game.savearea = "nowhere";
|
||||
game.savetrinkets = 0;
|
||||
game.saverx = 0;
|
||||
game.savery = 0;
|
||||
if (!game.glitchrunnermode)
|
||||
{
|
||||
// Ironically, resetting more variables makes the janky fadeout system in glitchrunnermode even more glitchy
|
||||
game.saverx = 0;
|
||||
game.savery = 0;
|
||||
}
|
||||
|
||||
game.intimetrial = false;
|
||||
game.timetrialcountdown = 0;
|
||||
|
@ -3606,7 +3614,11 @@ void scriptclass::hardreset()
|
|||
map.resetnames();
|
||||
map.custommode=false;
|
||||
map.custommodeforreal=false;
|
||||
map.towermode=false;
|
||||
if (!game.glitchrunnermode)
|
||||
{
|
||||
// Ironically, resetting more variables makes the janky fadeout system even more glitchy
|
||||
map.towermode=false;
|
||||
}
|
||||
map.cameraseekframe = 0;
|
||||
map.resumedelay = 0;
|
||||
map.scrolldir = 0;
|
||||
|
|
Loading…
Reference in a new issue