First take at serialization

This commit is contained in:
ZZYZX 2017-01-24 00:17:12 +02:00
commit 3e093a20ff
8 changed files with 128 additions and 43 deletions

View file

@ -407,6 +407,10 @@ void G_InitNew (const char *mapname, bool bTitleLevel)
bool wantFast;
int i;
// did we have any level before?
if (level.info != nullptr)
E_WorldUnloadingUnsafe();
if (!savegamerestore)
{
G_ClearHubInfo();
@ -656,7 +660,10 @@ void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill
// [RH] Give scripts a chance to do something
unloading = true;
FBehavior::StaticStartTypedScripts (SCRIPT_Unloading, NULL, false, 0, true);
E_MapUnloading();
// [ZZ] safe world unload
E_WorldUnloading();
// [ZZ] unsafe world unload (changemap != map)
E_WorldUnloadingUnsafe();
unloading = false;
STAT_ChangeLevel(nextlevel);
@ -1068,8 +1075,8 @@ void G_DoLoadLevel (int position, bool autosave)
StatusBar->AttachToPlayer (&players[consoleplayer]);
// [ZZ] init per-map static handlers
E_InitStaticHandlers(true);
// call map load hook
E_MapLoaded();
// unsafe world load
E_WorldLoadedUnsafe();
P_DoDeferedScripts (); // [RH] Do script actions that were triggered on another map.
if (demoplayback || oldgs == GS_STARTUP || oldgs == GS_TITLELEVEL)