- added a GetCVarString ZScript/DECORATE function.

- fixed: loading a savegame triggered PlayerEntered events.
This commit is contained in:
Christoph Oelckers 2017-03-28 21:36:57 +02:00
parent 99d1581c27
commit 6870efe134
3 changed files with 35 additions and 1 deletions

View File

@ -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);
}

View File

@ -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

View File

@ -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<Actor> classname, double distance, int flags = 0, int ptr = AAPTR_DEFAULT);
native double GetSpriteAngle(int ptr = AAPTR_DEFAULT);