- had to fix a few things.

This commit is contained in:
Christoph Oelckers 2019-02-02 17:29:13 +01:00
parent 1dbbb56a1b
commit 9f7fe203fc
7 changed files with 39 additions and 22 deletions

View File

@ -1486,12 +1486,32 @@ int FLevelLocals::FinishTravel ()
//
//==========================================================================
FLevelLocals::FLevelLocals() : Behaviors(this), tagManager(this)
{
// Make sure that these point to the right data all the time.
// This will be needed for as long as it takes to completely separate global UI state from per-level play state.
for (int i = 0; i < MAXPLAYERS; i++)
{
Players[i] = &players[i];
}
localEventManager = new EventManager;
}
FLevelLocals::~FLevelLocals()
{
if (localEventManager) delete localEventManager;
}
//==========================================================================
//
//
//==========================================================================
void FLevelLocals::Init()
{
P_InitParticles(this);
P_ClearParticles(this);
BaseBlendA = 0.0f; // Remove underwater blend effect, if any
localEventManager = new EventManager;
gravity = sv_gravity * 35/TICRATE;
aircontrol = sv_aircontrol;
@ -2129,8 +2149,11 @@ void FLevelLocals::Mark()
GC::Mark(BotInfo.firstthing);
GC::Mark(BotInfo.body1);
GC::Mark(BotInfo.body2);
GC::Mark(localEventManager->FirstEventHandler);
GC::Mark(localEventManager->LastEventHandler);
if (localEventManager)
{
GC::Mark(localEventManager->FirstEventHandler);
GC::Mark(localEventManager->LastEventHandler);
}
Thinkers.MarkRoots();
canvasTextureInfo.Mark();
for (auto &c : CorpseQueue)

View File

@ -106,15 +106,8 @@ struct FLevelLocals
{
void *level;
void *Level; // bug catchers.
FLevelLocals() : Behaviors(this), tagManager(this)
{
// Make sure that these point to the right data all the time.
// This will be needed for as long as it takes to completely separate global UI state from per-level play state.
for (int i = 0; i < MAXPLAYERS; i++)
{
Players[i] = &players[i];
}
}
FLevelLocals();
~FLevelLocals();
friend class MapLoader;

View File

@ -536,9 +536,11 @@ PClassActor *PClassActor::GetReplacement(FLevelLocals *Level, bool lookskill)
lookskill = false; skillrepname = NAME_None;
}
}
// [MK] ZScript replacement through Event Handlers, has priority over others
// [MK] ZScript replacement through Event Handlers, has priority over others.
PClassActor *Replacement = ActorInfo()->Replacement;
if (Level->localEventManager->CheckReplacement(this,&Replacement) )
// Level can be null when initializing dynamic lights.
// Since they only want to check for DehackedPickups this code should be skipped for them.
if (Level && Level->localEventManager->CheckReplacement(this,&Replacement) )
{
// [MK] the replacement is final, so don't continue with the chain
return Replacement ? Replacement : this;
@ -561,7 +563,7 @@ PClassActor *PClassActor::GetReplacement(FLevelLocals *Level, bool lookskill)
}
// Now handle DECORATE replacement chain
// Skill replacements are not recursive, contrarily to DECORATE replacements
rep = rep->GetReplacement(false);
rep = rep->GetReplacement(Level, false);
// Reset the temporarily NULLed field
ActorInfo()->Replacement = oldrep;
return rep;
@ -615,7 +617,7 @@ PClassActor *PClassActor::GetReplacee(FLevelLocals *Level, bool lookskill)
{
rep = PClass::FindActor(skillrepname);
}
rep = rep->GetReplacee(false);
rep = rep->GetReplacee(Level, false);
ActorInfo()->Replacee = savedrep;
return rep;
}

View File

@ -338,8 +338,7 @@ void FLevelLocals::ClearLevelData()
Scrolls.Clear();
if (automap) automap->Destroy();
Behaviors.UnloadModules();
delete localEventManager;
localEventManager = nullptr;
localEventManager->Shutdown();
}
//==========================================================================

View File

@ -46,7 +46,7 @@
inline PClassActor * GetRealType(PClassActor * ti)
{
PClassActor *rep = ti->GetReplacement(false);
PClassActor *rep = ti->GetReplacement(nullptr, false);
if (rep != ti && rep != NULL && rep->IsDescendantOf(NAME_DehackedPickup))
{
return rep;

View File

@ -2846,7 +2846,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_AltHUD, GetLatency, Net_GetLatency)
//
//
//==========================================================================
DEFINE_GLOBAL(currentVMLevel, level);
DEFINE_GLOBAL_NAMED(currentVMLevel, level)
DEFINE_FIELD(FLevelLocals, sectors)
DEFINE_FIELD(FLevelLocals, lines)
DEFINE_FIELD(FLevelLocals, sides)

View File

@ -87,11 +87,11 @@ const char *GetVersionString();
#define SAVEGAME_EXT "zds"
// MINSAVEVER is the minimum level snapshot version that can be loaded.
#define MINSAVEVER 4555
#define MINSAVEVER 4556
// Use 4500 as the base git save version, since it's higher than the
// SVN revision ever got.
#define SAVEVER 4555
#define SAVEVER 4556
// This is so that derivates can use the same savegame versions without worrying about engine compatibility
#define GAMESIG "GZDOOM"