Fixed merge conflicts.

This commit is contained in:
MajorCooke 2016-02-02 18:26:20 -06:00
commit a1c1de9edb
11 changed files with 59 additions and 8 deletions

View file

@ -1048,6 +1048,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)

View file

@ -85,7 +85,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

View file

@ -298,6 +298,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)

View file

@ -1516,7 +1516,7 @@ dopain:
{ {
if (source == target->target) 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) if (target->state == target->SpawnState && target->SeeState != NULL)
{ {
target->SetState (target->SeeState); target->SetState (target->SeeState);
@ -1537,7 +1537,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);

View file

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

View file

@ -348,6 +348,10 @@ void AActor::Serialize (FArchive &arc)
<< RipLevelMin << RipLevelMin
<< RipLevelMax; << RipLevelMax;
} }
if (SaveVersion >= 4531)
{
arc << DefThreshold;
}
{ {
FString tagstr; FString tagstr;

View file

@ -6028,6 +6028,33 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMax)
self->RipLevelMax = max; 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_CheckProximity(jump, classname, distance, count, flags, ptr) // A_CheckProximity(jump, classname, distance, count, flags, ptr)

View file

@ -90,7 +90,8 @@ DEFINE_MEMBER_VARIABLE(reactiontime, AActor)
DEFINE_MEMBER_VARIABLE(meleerange, AActor) DEFINE_MEMBER_VARIABLE(meleerange, AActor)
DEFINE_MEMBER_VARIABLE(Speed, AActor) DEFINE_MEMBER_VARIABLE(Speed, AActor)
DEFINE_MEMBER_VARIABLE(roll, AActor) DEFINE_MEMBER_VARIABLE(roll, AActor)
DEFINE_MEMBER_VARIABLE(threshold, AActor)
DEFINE_MEMBER_VARIABLE(DefThreshold, AActor)
//========================================================================== //==========================================================================
// //

View file

@ -532,6 +532,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;
}
//========================================================================== //==========================================================================
// //
//========================================================================== //==========================================================================

View file

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

View file

@ -31,6 +31,7 @@ ACTOR Actor native //: Thinker
RipperLevel 0 RipperLevel 0
RipLevelMin 0 RipLevelMin 0
RipLevelMax 0 RipLevelMax 0
ChaseThreshold 100
// Variables for the expression evaluator // Variables for the expression evaluator
// NOTE: fixed_t and angle_t are only used here to ensure proper conversion // 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 meleerange;
native fixed_t speed; native fixed_t speed;
native angle_t roll; native angle_t roll;
native int threshold;
native int DefThreshold;
// 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);
@ -339,6 +342,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);