diff --git a/src/g_level.cpp b/src/g_level.cpp index 1a3d1d073..ecde760f3 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1028,7 +1028,10 @@ void G_DoLoadLevel (int position, bool autosave) { players[ii].camera = players[ii].mo; } - E_PlayerEntered(ii, finishstate == FINISH_SameHub); + if (!savegamerestore) + { + E_PlayerEntered(ii, finishstate == FINISH_SameHub); + } // ENTER scripts are being handled when the player gets spawned, this cannot be changed due to its effect on voodoo dolls. if (level.FromSnapshot && !savegamerestore) FBehavior::StaticStartTypedScripts(SCRIPT_Return, players[ii].mo, true); } diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index a0794f1d6..055274d3d 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -654,6 +654,36 @@ DEFINE_ACTION_FUNCTION(AActor, GetCVar) return 0; } +//========================================================================== +// +// GetCVar +// +// NON-ACTION function that works like ACS's GetCVar. +// +//========================================================================== + +DEFINE_ACTION_FUNCTION(AActor, GetCVarString) +{ + if (numret > 0) + { + assert(ret != nullptr); + PARAM_SELF_PROLOGUE(AActor); + PARAM_STRING(cvarname); + + FBaseCVar *cvar = GetCVar(self, cvarname); + if (cvar == nullptr) + { + ret->SetString(""); + } + else + { + ret->SetString(cvar->GetGenericRep(CVAR_String).String); + } + return 1; + } + return 0; +} + //========================================================================== // // GetPlayerInput diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index aae7d6aeb..daac2f23d 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -671,6 +671,7 @@ class Actor : Thinker native native clearscope int GetSpawnHealth() const; native double GetCrouchFactor(int ptr = AAPTR_PLAYER1); native double GetCVar(string cvar); + native double GetCVarString(string cvar); native int GetPlayerInput(int inputnum, int ptr = AAPTR_DEFAULT); native int CountProximity(class classname, double distance, int flags = 0, int ptr = AAPTR_DEFAULT); native double GetSpriteAngle(int ptr = AAPTR_DEFAULT);