mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 06:53:58 +00:00
Updated for scripting branch merge.
This commit is contained in:
commit
35b7a5ccc1
11 changed files with 61 additions and 10 deletions
|
@ -1041,6 +1041,7 @@ public:
|
||||||
SDWORD reactiontime; // if non 0, don't attack yet; used by
|
SDWORD reactiontime; // if non 0, don't attack yet; used by
|
||||||
// player to freeze a bit after teleporting
|
// player to freeze a bit after teleporting
|
||||||
SDWORD threshold; // if > 0, the target will be chased
|
SDWORD threshold; // if > 0, the target will be chased
|
||||||
|
SDWORD DefThreshold; // [MC] Default threshold which the actor will reset its threshold to after switching targets
|
||||||
// no matter what (even if shot)
|
// no matter what (even if shot)
|
||||||
player_t *player; // only valid if type of APlayerPawn
|
player_t *player; // only valid if type of APlayerPawn
|
||||||
TObjPtr<AActor> LastLookActor; // Actor last looked for (if TIDtoHate != 0)
|
TObjPtr<AActor> LastLookActor; // Actor last looked for (if TIDtoHate != 0)
|
||||||
|
|
|
@ -90,7 +90,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Beacon)
|
||||||
self->flags &= ~MF_SPECIAL;
|
self->flags &= ~MF_SPECIAL;
|
||||||
static_cast<AInventory *>(self)->DropTime = 0;
|
static_cast<AInventory *>(self)->DropTime = 0;
|
||||||
// Set up the new rebel.
|
// Set up the new rebel.
|
||||||
rebel->threshold = BASETHRESHOLD;
|
rebel->threshold = rebel->DefThreshold;
|
||||||
rebel->target = NULL;
|
rebel->target = NULL;
|
||||||
rebel->flags4 |= MF4_INCOMBAT;
|
rebel->flags4 |= MF4_INCOMBAT;
|
||||||
rebel->LastHeard = owner; // Make sure the rebels look for targets
|
rebel->LastHeard = owner; // Make sure the rebels look for targets
|
||||||
|
|
|
@ -300,6 +300,8 @@ xx(Z)
|
||||||
xx(MomX)
|
xx(MomX)
|
||||||
xx(MomY)
|
xx(MomY)
|
||||||
xx(MomZ)
|
xx(MomZ)
|
||||||
|
xx(Threshold)
|
||||||
|
xx(DefThreshold)
|
||||||
xx(Abs)
|
xx(Abs)
|
||||||
xx(ACS_NamedExecuteWithResult)
|
xx(ACS_NamedExecuteWithResult)
|
||||||
xx(CallACS)
|
xx(CallACS)
|
||||||
|
|
|
@ -1511,7 +1511,7 @@ dopain:
|
||||||
{
|
{
|
||||||
if (source == target->target)
|
if (source == target->target)
|
||||||
{
|
{
|
||||||
target->threshold = BASETHRESHOLD;
|
target->threshold = target->DefThreshold;
|
||||||
if (target->state == target->SpawnState && target->SeeState != NULL)
|
if (target->state == target->SpawnState && target->SeeState != NULL)
|
||||||
{
|
{
|
||||||
target->SetState (target->SeeState);
|
target->SetState (target->SeeState);
|
||||||
|
@ -1532,7 +1532,7 @@ dopain:
|
||||||
target->lastenemy = target->target; // remember last enemy - killough
|
target->lastenemy = target->target; // remember last enemy - killough
|
||||||
}
|
}
|
||||||
target->target = source;
|
target->target = source;
|
||||||
target->threshold = BASETHRESHOLD;
|
target->threshold = target->DefThreshold;
|
||||||
if (target->state == target->SpawnState && target->SeeState != NULL)
|
if (target->state == target->SpawnState && target->SeeState != NULL)
|
||||||
{
|
{
|
||||||
target->SetState (target->SeeState);
|
target->SetState (target->SeeState);
|
||||||
|
|
|
@ -87,7 +87,8 @@ inline int GetSafeBlockY(long long blocky)
|
||||||
#define PLAYERMISSILERANGE (8192*FRACUNIT) // [RH] New MISSILERANGE for players
|
#define PLAYERMISSILERANGE (8192*FRACUNIT) // [RH] New MISSILERANGE for players
|
||||||
|
|
||||||
// follow a player exlusively for 3 seconds
|
// follow a player exlusively for 3 seconds
|
||||||
#define BASETHRESHOLD 100
|
// No longer used.
|
||||||
|
// #define BASETHRESHOLD 100
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -433,6 +433,10 @@ void AActor::Serialize (FArchive &arc)
|
||||||
<< RipLevelMin
|
<< RipLevelMin
|
||||||
<< RipLevelMax;
|
<< RipLevelMax;
|
||||||
}
|
}
|
||||||
|
if (SaveVersion >= 4531)
|
||||||
|
{
|
||||||
|
arc << DefThreshold;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
FString tagstr;
|
FString tagstr;
|
||||||
|
|
|
@ -6360,6 +6360,35 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMax)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// 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)
|
||||||
|
{
|
||||||
|
PARAM_ACTION_PROLOGUE;
|
||||||
|
PARAM_INT(threshold);
|
||||||
|
PARAM_BOOL_OPT(def) { def = false; }
|
||||||
|
PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; }
|
||||||
|
|
||||||
|
|
||||||
|
AActor *mobj = COPY_AAPTR(self, ptr);
|
||||||
|
if (!mobj)
|
||||||
|
{
|
||||||
|
ACTION_SET_RESULT(false);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (def)
|
||||||
|
mobj->DefThreshold = (threshold >= 0) ? threshold : 0;
|
||||||
|
else
|
||||||
|
mobj->threshold = (threshold >= 0) ? threshold : 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// A_CheckProximity(jump, classname, distance, count, flags, ptr)
|
// A_CheckProximity(jump, classname, distance, count, flags, ptr)
|
||||||
|
|
|
@ -651,4 +651,6 @@ void InitThingdef()
|
||||||
symt.AddSymbol(new PField(NAME_ReactionTime,TypeSInt32, VARF_Native, myoffsetof(AActor,reactiontime)));
|
symt.AddSymbol(new PField(NAME_ReactionTime,TypeSInt32, VARF_Native, myoffsetof(AActor,reactiontime)));
|
||||||
symt.AddSymbol(new PField(NAME_MeleeRange, TypeFixed, VARF_Native, myoffsetof(AActor,meleerange)));
|
symt.AddSymbol(new PField(NAME_MeleeRange, TypeFixed, VARF_Native, myoffsetof(AActor,meleerange)));
|
||||||
symt.AddSymbol(new PField(NAME_Speed, TypeFixed, VARF_Native, myoffsetof(AActor,Speed)));
|
symt.AddSymbol(new PField(NAME_Speed, TypeFixed, VARF_Native, myoffsetof(AActor,Speed)));
|
||||||
|
symt.AddSymbol(new PField(NAME_Threshold, TypeFixed, VARF_Native, myoffsetof(AActor,threshold)));
|
||||||
|
symt.AddSymbol(new PField(NAME_DefThreshold,TypeFixed, VARF_Native, myoffsetof(AActor,DefThreshold)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -544,6 +544,17 @@ DEFINE_PROPERTY(painthreshold, I, Actor)
|
||||||
defaults->PainThreshold = id;
|
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
|
// Use 4500 as the base git save version, since it's higher than the
|
||||||
// SVN revision ever got.
|
// SVN revision ever got.
|
||||||
#define SAVEVER 4531
|
#define SAVEVER 4532
|
||||||
|
|
||||||
#define SAVEVERSTRINGIFY2(x) #x
|
#define SAVEVERSTRINGIFY2(x) #x
|
||||||
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)
|
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)
|
||||||
|
|
|
@ -31,13 +31,13 @@ ACTOR Actor native //: Thinker
|
||||||
RipperLevel 0
|
RipperLevel 0
|
||||||
RipLevelMin 0
|
RipLevelMin 0
|
||||||
RipLevelMax 0
|
RipLevelMax 0
|
||||||
|
ChaseThreshold 100
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
native bool CheckClass(class<Actor> checkclass, int ptr_select = AAPTR_DEFAULT, bool match_superclass = false);
|
native bool CheckClass(class<Actor> checkclass, int ptr_select = AAPTR_DEFAULT, bool match_superclass = false);
|
||||||
native bool IsPointerEqual(int ptr_select1, int ptr_select2);
|
native bool IsPointerEqual(int ptr_select1, int ptr_select2);
|
||||||
|
|
||||||
// Action functions
|
// Action functions
|
||||||
|
|
||||||
// Meh, MBF redundant functions. Only for DeHackEd support.
|
// Meh, MBF redundant functions. Only for DeHackEd support.
|
||||||
action native A_Turn(float angle = 0);
|
action native A_Turn(float angle = 0);
|
||||||
action native A_LineEffect(int boomspecial = 0, int tag = 0);
|
action native A_LineEffect(int boomspecial = 0, int tag = 0);
|
||||||
|
@ -307,6 +307,7 @@ ACTOR Actor native //: Thinker
|
||||||
action native A_SetRipperLevel(int level);
|
action native A_SetRipperLevel(int level);
|
||||||
action native A_SetRipMin(int min);
|
action native A_SetRipMin(int min);
|
||||||
action native A_SetRipMax(int max);
|
action native A_SetRipMax(int max);
|
||||||
|
action native A_SetChaseThreshold(int threshold, bool def = false, int ptr = AAPTR_DEFAULT);
|
||||||
action native A_CheckProximity(state jump, class<Actor> classname, float distance, int count = 1, int flags = 0, int ptr = AAPTR_DEFAULT);
|
action native A_CheckProximity(state jump, class<Actor> classname, float distance, int count = 1, int flags = 0, int ptr = AAPTR_DEFAULT);
|
||||||
action native A_CheckBlock(state block, int flags = 0, 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_CheckSightOrRange(float distance, state label, bool two_dimension = false);
|
||||||
|
|
Loading…
Reference in a new issue