- added a distancecheck property to AActor that allows a given CVAR to be used as maximum display distance for actors of this type.

This is for WolfenDoom: BOA, which has some scripted sprite distance checks that very negatively affected performance.
This commit is contained in:
Christoph Oelckers 2016-04-12 19:44:12 +02:00
commit 3f0ed5d252
4 changed files with 43 additions and 2 deletions

View file

@ -1523,6 +1523,28 @@ DEFINE_PROPERTY(riplevelmax, I, Actor)
defaults->RipLevelMax = id;
}
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(distancecheck, S, Actor)
{
PROP_STRING_PARM(cvar, 0);
FBaseCVar *scratch;
FBaseCVar *cv = FindCVar(cvar, &scratch);
if (cv == NULL)
{
I_Error("CVar %s not defined", cvar);
}
else if (cv->GetRealType() == CVAR_Int)
{
static_cast<PClassActor*>(info)->distancecheck = static_cast<FIntCVar *>(cv);
}
else
{
I_Error("CVar %s must of type Int", cvar);
}
}
//==========================================================================
//
// Special inventory properties