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

Abstract returning-to-editor code to Game::returntoeditor()

This way I can easily move it around without moving around a bunch of
lines of code.
This commit is contained in:
Misa 2020-05-09 12:35:17 -07:00 committed by Ethan Lee
parent 915100b370
commit 51971fa84c
3 changed files with 32 additions and 21 deletions

View file

@ -7381,3 +7381,30 @@ void Game::returntolab()
music.play(11); music.play(11);
} }
#if !defined(NO_CUSTOM_LEVELS)
void Game::returntoeditor()
{
game.gamestate = EDITORMODE;
graphics.textboxremove();
game.hascontrol = true;
game.advancetext = false;
game.completestop = false;
game.state = 0;
graphics.showcutscenebars = false;
graphics.fademode = 0;
graphics.backgrounddrawn=false;
music.fadeout();
//If warpdir() is used during playtesting, we need to set it back after!
for (int j = 0; j < ed.maxheight; j++)
{
for (int i = 0; i < ed.maxwidth; i++)
{
ed.level[i+(j*ed.maxwidth)].warpdir=ed.kludgewarpdir[i+(j*ed.maxwidth)];
}
}
map.scrolldir = 0;
}
#endif

View file

@ -385,6 +385,10 @@ public:
int fadetomenudelay; int fadetomenudelay;
bool fadetolab; bool fadetolab;
int fadetolabdelay; int fadetolabdelay;
#if !defined(NO_CUSTOM_LEVELS)
void returntoeditor();
#endif
}; };
extern Game game; extern Game game;

View file

@ -1537,27 +1537,7 @@ void gameinput()
game.activeactivity = -1; game.activeactivity = -1;
} }
}else{ }else{
game.gamestate = EDITORMODE; game.returntoeditor();
graphics.textboxremove();
game.hascontrol = true;
game.advancetext = false;
game.completestop = false;
game.state = 0;
graphics.showcutscenebars = false;
graphics.fademode = 0;
graphics.backgrounddrawn=false;
music.fadeout();
//If warpdir() is used during playtesting, we need to set it back after!
for (int j = 0; j < ed.maxheight; j++)
{
for (int i = 0; i < ed.maxwidth; i++)
{
ed.level[i+(j*ed.maxwidth)].warpdir=ed.kludgewarpdir[i+(j*ed.maxwidth)];
}
}
map.scrolldir = 0;
} }
} }
} }