mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-31 04:20:34 +00:00
- Added Threshold Manipulation.
- Added 'threshold' and 'defthreshold' to DECORATE expression exposure. - ChaseThreshold sets the default threshold for how long a monster must chase one target before it can switch targets. Default is 100, must not be negative. - A_SetChaseThreshold can be used to alter the current or default threshold of an actor <pointer>. - Changing current threshold has no effect on what the default will be once it hits 0 and something makes it infight with another.
This commit is contained in:
parent
72445667e3
commit
75100d76fb
9 changed files with 54 additions and 4 deletions
|
@ -932,6 +932,7 @@ public:
|
|||
// player to freeze a bit after teleporting
|
||||
SDWORD threshold; // if > 0, the target will be chased
|
||||
// no matter what (even if shot)
|
||||
SDWORD DefThreshold; // [MC] Default threshold which the actor will reset its threshold to after switching targets
|
||||
player_t *player; // only valid if type of APlayerPawn
|
||||
TObjPtr<AActor> LastLookActor; // Actor last looked for (if TIDtoHate != 0)
|
||||
fixed_t SpawnPoint[3]; // For nightmare respawn
|
||||
|
|
|
@ -294,6 +294,8 @@ xx(Z)
|
|||
xx(MomX)
|
||||
xx(MomY)
|
||||
xx(MomZ)
|
||||
xx(Threshold)
|
||||
xx(DefThreshold)
|
||||
xx(Abs)
|
||||
xx(ACS_NamedExecuteWithResult)
|
||||
xx(CallACS)
|
||||
|
|
|
@ -1516,7 +1516,7 @@ dopain:
|
|||
{
|
||||
if (source == target->target)
|
||||
{
|
||||
target->threshold = BASETHRESHOLD;
|
||||
target->threshold = target->DefThreshold; //BASETHRESHOLD is no longer used here.
|
||||
if (target->state == target->SpawnState && target->SeeState != NULL)
|
||||
{
|
||||
target->SetState (target->SeeState);
|
||||
|
@ -1537,7 +1537,7 @@ dopain:
|
|||
target->lastenemy = target->target; // remember last enemy - killough
|
||||
}
|
||||
target->target = source;
|
||||
target->threshold = BASETHRESHOLD;
|
||||
target->threshold = target->DefThreshold;
|
||||
if (target->state == target->SpawnState && target->SeeState != NULL)
|
||||
{
|
||||
target->SetState (target->SeeState);
|
||||
|
|
|
@ -344,6 +344,10 @@ void AActor::Serialize (FArchive &arc)
|
|||
<< RipLevelMin
|
||||
<< RipLevelMax;
|
||||
}
|
||||
if (SaveVersion >= 4525)
|
||||
{
|
||||
arc << DefThreshold;
|
||||
}
|
||||
|
||||
{
|
||||
FString tagstr;
|
||||
|
|
|
@ -5870,6 +5870,33 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMax)
|
|||
self->RipLevelMax = max;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// A_SetChaseThreshold(int threshold, bool def, int ptr)
|
||||
//
|
||||
// Sets the current chase threshold of the actor (pointer). If def is true,
|
||||
// changes the default threshold which the actor resets to once it switches
|
||||
// targets and doesn't have the +QUICKTORETALIATE flag.
|
||||
//===========================================================================
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetChaseThreshold)
|
||||
{
|
||||
ACTION_PARAM_START(3);
|
||||
ACTION_PARAM_INT(threshold, 0);
|
||||
ACTION_PARAM_BOOL(def, 1);
|
||||
ACTION_PARAM_INT(ptr, 2);
|
||||
|
||||
AActor *mobj = COPY_AAPTR(self, ptr);
|
||||
if (!mobj)
|
||||
{
|
||||
ACTION_SET_RESULT(false);
|
||||
return;
|
||||
}
|
||||
if (def)
|
||||
mobj->DefThreshold = (threshold >= 0) ? threshold : 0;
|
||||
else
|
||||
mobj->threshold = (threshold >= 0) ? threshold : 0;
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
A_CheckBlock
|
||||
(state block, int flags, int ptr)
|
||||
|
|
|
@ -90,7 +90,8 @@ DEFINE_MEMBER_VARIABLE(reactiontime, AActor)
|
|||
DEFINE_MEMBER_VARIABLE(meleerange, AActor)
|
||||
DEFINE_MEMBER_VARIABLE(Speed, AActor)
|
||||
DEFINE_MEMBER_VARIABLE(roll, AActor)
|
||||
|
||||
DEFINE_MEMBER_VARIABLE(threshold, AActor)
|
||||
DEFINE_MEMBER_VARIABLE(DefThreshold, AActor)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
@ -532,6 +532,17 @@ DEFINE_PROPERTY(painthreshold, I, Actor)
|
|||
defaults->PainThreshold = id;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//==========================================================================
|
||||
DEFINE_PROPERTY(chasethreshold, I, Actor)
|
||||
{
|
||||
PROP_INT_PARM(id, 0);
|
||||
if (id < 0)
|
||||
I_Error("ChaseThreshold cannot be negative.");
|
||||
defaults->DefThreshold = id;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//==========================================================================
|
||||
|
|
|
@ -76,7 +76,7 @@ const char *GetVersionString();
|
|||
|
||||
// Use 4500 as the base git save version, since it's higher than the
|
||||
// SVN revision ever got.
|
||||
#define SAVEVER 4524
|
||||
#define SAVEVER 4525
|
||||
|
||||
#define SAVEVERSTRINGIFY2(x) #x
|
||||
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)
|
||||
|
|
|
@ -31,6 +31,7 @@ ACTOR Actor native //: Thinker
|
|||
RipperLevel 0
|
||||
RipLevelMin 0
|
||||
RipLevelMax 0
|
||||
ChaseThreshold 100
|
||||
|
||||
// Variables for the expression evaluator
|
||||
// NOTE: fixed_t and angle_t are only used here to ensure proper conversion
|
||||
|
@ -69,6 +70,8 @@ ACTOR Actor native //: Thinker
|
|||
native fixed_t meleerange;
|
||||
native fixed_t speed;
|
||||
native angle_t roll;
|
||||
native int threshold;
|
||||
native int DefThreshold;
|
||||
|
||||
// Meh, MBF redundant functions. Only for DeHackEd support.
|
||||
action native A_Turn(float angle = 0);
|
||||
|
@ -337,6 +340,7 @@ ACTOR Actor native //: Thinker
|
|||
action native A_SetRipperLevel(int level);
|
||||
action native A_SetRipMin(int min);
|
||||
action native A_SetRipMax(int max);
|
||||
action native A_SetChaseThreshold(int threshold, bool def = false, int ptr = AAPTR_DEFAULT);
|
||||
action native A_CheckBlock(state block, int flags = 0, int ptr = AAPTR_DEFAULT);
|
||||
action native A_CheckSightOrRange(float distance, state label, bool two_dimension = false);
|
||||
action native A_CheckRange(float distance, state label, bool two_dimension = false);
|
||||
|
|
Loading…
Reference in a new issue