Move all editor-specific attributes to a new editorclass

This is a pretty hefty commit! But essentially, I made a new editorclass
object, and moved all functions and variables that only get used in the
in-game level editor to that class. This cleanly demarcates which things
are in the editor and which things are just general custom level stuff.

Then I fixed up all the callers. I also fixed up some NO_CUSTOM_LEVELS
and NO_EDITOR ifdefs, too, in several places.
This commit is contained in:
Misa
2021-02-20 15:40:11 -08:00
committed by Misa Elizabeth Kai
parent 987ae88909
commit a23014350f
13 changed files with 1336 additions and 1268 deletions

View File

@@ -31,9 +31,12 @@
scriptclass script;
#if !defined(NO_CUSTOM_LEVELS)
#ifndef NO_CUSTOM_LEVELS
std::vector<edentities> edentity;
customlevelclass cl;
# ifndef NO_EDITOR
editorclass ed;
# endif
#endif
UtilityClass help;
@@ -620,14 +623,14 @@ int main(int argc, char *argv[])
game.menustart = true;
LevelMetaData meta;
if (ed.getLevelMetaData(playtestname, meta)) {
ed.ListOfMetaData.clear();
ed.ListOfMetaData.push_back(meta);
if (cl.getLevelMetaData(playtestname, meta)) {
cl.ListOfMetaData.clear();
cl.ListOfMetaData.push_back(meta);
} else {
ed.loadZips();
if (ed.getLevelMetaData(playtestname, meta)) {
ed.ListOfMetaData.clear();
ed.ListOfMetaData.push_back(meta);
cl.loadZips();
if (cl.getLevelMetaData(playtestname, meta)) {
cl.ListOfMetaData.clear();
cl.ListOfMetaData.push_back(meta);
} else {
vlog_error("Level not found");
VVV_exit(1);
@@ -635,8 +638,8 @@ int main(int argc, char *argv[])
}
game.loadcustomlevelstats();
game.customleveltitle=ed.ListOfMetaData[game.playcustomlevel].title;
game.customlevelfilename=ed.ListOfMetaData[game.playcustomlevel].filename;
game.customleveltitle=cl.ListOfMetaData[game.playcustomlevel].title;
game.customlevelfilename=cl.ListOfMetaData[game.playcustomlevel].filename;
if (savefileplaytest) {
game.playx = savex;
game.playy = savey;