- scriptified P_CalcHeight.

This was the only code using the ViewBob member variable.
This also moves the range check for this variable to its application, because a badly behaved mod can just as easily change it at run time instead of just setting an absurdly large value in the class definition.
This commit is contained in:
Christoph Oelckers 2019-01-03 11:57:20 +01:00
commit 2bd72478ee
8 changed files with 170 additions and 175 deletions

View file

@ -1696,26 +1696,6 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, weaponslot, ISsssssssssssssssssssssssssssss
}
}
//==========================================================================
//
// [SP] Player.Viewbob
//
//==========================================================================
DEFINE_CLASS_PROPERTY_PREFIX(player, viewbob, F, PlayerPawn)
{
PROP_DOUBLE_PARM(z, 0);
// [SP] Hard limits. This is to prevent terrywads from making players sick.
// Remember - this messes with a user option who probably has it set a
// certain way for a reason. I think a 1.5 limit is pretty generous, but
// it may be safe to increase it. I really need opinions from people who
// could be affected by this.
if (z < 0.0 || z > 1.5)
{
I_Error("ViewBob must be between 0.0 and 1.5.");
}
defaults->ViewBob = z;
}
//==========================================================================
// (non-fatal with non-existent types only in DECORATE)
//==========================================================================

View file

@ -1651,7 +1651,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, CheckFor3DCeilingHit, CheckFor3DCeilingHit
//===========================================================================
//
// APlayerPawn :: MarkPlayerSounds
// APlayerPawn functions
//
//===========================================================================
@ -1662,6 +1662,19 @@ DEFINE_ACTION_FUNCTION_NATIVE(APlayerPawn, MarkPlayerSounds, S_MarkPlayerSounds)
return 0;
}
static void GetPrintableDisplayNameJit(PClassActor *cls, FString *result)
{
*result = cls->GetDisplayName();
}
DEFINE_ACTION_FUNCTION_NATIVE(APlayerPawn, GetPrintableDisplayName, GetPrintableDisplayNameJit)
{
PARAM_PROLOGUE;
PARAM_CLASS(type, AActor);
ACTION_RETURN_STRING(type->GetDisplayName());
}
DEFINE_FIELD(AActor, snext)
DEFINE_FIELD(AActor, player)