mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-27 22:33:17 +00:00
- floatified MaxTargetRange and MeleeThreshold.
This commit is contained in:
parent
c66ff5939d
commit
e077510773
5 changed files with 19 additions and 19 deletions
|
@ -590,7 +590,7 @@ public:
|
||||||
DDropItem *GetDropItems() const;
|
DDropItem *GetDropItems() const;
|
||||||
|
|
||||||
// Return true if the monster should use a missile attack, false for melee
|
// Return true if the monster should use a missile attack, false for melee
|
||||||
bool SuggestMissileAttack (fixed_t dist);
|
bool SuggestMissileAttack (double dist);
|
||||||
|
|
||||||
// Adjusts the angle for deflection/reflection of incoming missiles
|
// Adjusts the angle for deflection/reflection of incoming missiles
|
||||||
// Returns true if the missile should be allowed to explode anyway
|
// Returns true if the missile should be allowed to explode anyway
|
||||||
|
@ -1236,10 +1236,10 @@ public:
|
||||||
ActorBounceFlags BounceFlags; // which bouncing type?
|
ActorBounceFlags BounceFlags; // which bouncing type?
|
||||||
DWORD SpawnFlags; // Increased to DWORD because of Doom 64
|
DWORD SpawnFlags; // Increased to DWORD because of Doom 64
|
||||||
fixed_t meleerange; // specifies how far a melee attack reaches.
|
fixed_t meleerange; // specifies how far a melee attack reaches.
|
||||||
fixed_t meleethreshold; // Distance below which a monster doesn't try to shoot missiles anynore
|
double meleethreshold; // Distance below which a monster doesn't try to shoot missiles anynore
|
||||||
// but instead tries to come closer for a melee attack.
|
// but instead tries to come closer for a melee attack.
|
||||||
// This is not the same as meleerange
|
// This is not the same as meleerange
|
||||||
fixed_t maxtargetrange; // any target farther away cannot be attacked
|
double maxtargetrange; // any target farther away cannot be attacked
|
||||||
double bouncefactor; // Strife's grenades use 50%, Hexen's Flechettes 70.
|
double bouncefactor; // Strife's grenades use 50%, Hexen's Flechettes 70.
|
||||||
double wallbouncefactor; // The bounce factor for walls can be different.
|
double wallbouncefactor; // The bounce factor for walls can be different.
|
||||||
int bouncecount; // Strife's grenades only bounce twice before exploding
|
int bouncecount; // Strife's grenades only bounce twice before exploding
|
||||||
|
|
|
@ -348,7 +348,7 @@ bool P_CheckMeleeRange2 (AActor *actor)
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
bool P_CheckMissileRange (AActor *actor)
|
bool P_CheckMissileRange (AActor *actor)
|
||||||
{
|
{
|
||||||
fixed_t dist;
|
double dist;
|
||||||
|
|
||||||
if (!P_CheckSight (actor, actor->target, SF_SEEPASTBLOCKEVERYTHING))
|
if (!P_CheckSight (actor, actor->target, SF_SEEPASTBLOCKEVERYTHING))
|
||||||
return false;
|
return false;
|
||||||
|
@ -387,15 +387,15 @@ bool P_CheckMissileRange (AActor *actor)
|
||||||
|
|
||||||
// OPTIMIZE: get this from a global checksight
|
// OPTIMIZE: get this from a global checksight
|
||||||
// [RH] What?
|
// [RH] What?
|
||||||
dist = actor->AproxDistance (actor->target) - 64*FRACUNIT;
|
dist = actor->Distance2D (actor->target) - 64;
|
||||||
|
|
||||||
if (actor->MeleeState == NULL)
|
if (actor->MeleeState == NULL)
|
||||||
dist -= 128*FRACUNIT; // no melee attack, so fire more
|
dist -= 128; // no melee attack, so fire more
|
||||||
|
|
||||||
return actor->SuggestMissileAttack (dist);
|
return actor->SuggestMissileAttack (dist);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AActor::SuggestMissileAttack (fixed_t dist)
|
bool AActor::SuggestMissileAttack (double dist)
|
||||||
{
|
{
|
||||||
// new version encapsulates the different behavior in flags instead of virtual functions
|
// new version encapsulates the different behavior in flags instead of virtual functions
|
||||||
// The advantage is that this allows inheriting the missile attack attributes from the
|
// The advantage is that this allows inheriting the missile attack attributes from the
|
||||||
|
@ -407,11 +407,11 @@ bool AActor::SuggestMissileAttack (fixed_t dist)
|
||||||
if (MeleeState != NULL && dist < meleethreshold)
|
if (MeleeState != NULL && dist < meleethreshold)
|
||||||
return false; // From the Revenant: close enough for fist attack
|
return false; // From the Revenant: close enough for fist attack
|
||||||
|
|
||||||
if (flags4 & MF4_MISSILEMORE) dist >>= 1;
|
if (flags4 & MF4_MISSILEMORE) dist *= 0.5;
|
||||||
if (flags4 & MF4_MISSILEEVENMORE) dist >>= 3;
|
if (flags4 & MF4_MISSILEEVENMORE) dist *= 0.125;
|
||||||
|
|
||||||
int mmc = int(MinMissileChance * G_SkillProperty(SKILLP_Aggressiveness));
|
int mmc = int(MinMissileChance * G_SkillProperty(SKILLP_Aggressiveness));
|
||||||
return pr_checkmissilerange() >= MIN<int> (dist >> FRACBITS, mmc);
|
return pr_checkmissilerange() >= MIN<int> (int(dist), mmc);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
|
@ -6144,7 +6144,7 @@ AActor *P_SpawnPlayerMissile (AActor *source, double x, double y, double z,
|
||||||
// [XA] If MaxTargetRange is defined in the spawned projectile, use this as the
|
// [XA] If MaxTargetRange is defined in the spawned projectile, use this as the
|
||||||
// maximum range for the P_AimLineAttack call later; this allows MaxTargetRange
|
// maximum range for the P_AimLineAttack call later; this allows MaxTargetRange
|
||||||
// to function as a "maximum tracer-acquisition range" for seeker missiles.
|
// to function as a "maximum tracer-acquisition range" for seeker missiles.
|
||||||
double linetargetrange = defaultobject->maxtargetrange > 0 ? FIXED2DBL(defaultobject->maxtargetrange*64) : 16*64.;
|
double linetargetrange = defaultobject->maxtargetrange > 0 ? defaultobject->maxtargetrange*64 : 16*64.;
|
||||||
|
|
||||||
int i = 2;
|
int i = 2;
|
||||||
do
|
do
|
||||||
|
|
|
@ -205,7 +205,7 @@ public:
|
||||||
|
|
||||||
int GetScaledWidth () { int foo = (Width << 17) / xScale; return (foo >> 1) + (foo & 1); }
|
int GetScaledWidth () { int foo = (Width << 17) / xScale; return (foo >> 1) + (foo & 1); }
|
||||||
int GetScaledHeight () { int foo = (Height << 17) / yScale; return (foo >> 1) + (foo & 1); }
|
int GetScaledHeight () { int foo = (Height << 17) / yScale; return (foo >> 1) + (foo & 1); }
|
||||||
int GetScaledHeight(double scale) { return GetScaledHeight(FLOAT2FIXED(scale)); }
|
int GetScaledHeight(double scale) { int foo = (Height << 17) / FLOAT2FIXED(scale); return (foo >> 1) + (foo & 1); }
|
||||||
double GetScaledWidthDouble () { return (Width * 65536.) / xScale; }
|
double GetScaledWidthDouble () { return (Width * 65536.) / xScale; }
|
||||||
double GetScaledHeightDouble () { return (Height * 65536.) / yScale; }
|
double GetScaledHeightDouble () { return (Height * 65536.) / yScale; }
|
||||||
double GetScaleY() const { return FIXED2DBL(yScale); }
|
double GetScaleY() const { return FIXED2DBL(yScale); }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
** thingdef-properties.cpp
|
** thingdef-properties.cpp
|
||||||
**
|
**
|
||||||
** Actor definitions - properties and flags handling
|
** Actor denitions - properties and flags handling
|
||||||
**
|
**
|
||||||
**---------------------------------------------------------------------------
|
**---------------------------------------------------------------------------
|
||||||
** Copyright 2002-2007 Christoph Oelckers
|
** Copyright 2002-2007 Christoph Oelckers
|
||||||
|
@ -245,10 +245,10 @@ void HandleDeprecatedFlags(AActor *defaults, PClassActor *info, bool set, int in
|
||||||
defaults->Gravity = set ? 1. / 8 : 1.;
|
defaults->Gravity = set ? 1. / 8 : 1.;
|
||||||
break;
|
break;
|
||||||
case DEPF_SHORTMISSILERANGE:
|
case DEPF_SHORTMISSILERANGE:
|
||||||
defaults->maxtargetrange = set? 896*FRACUNIT : 0;
|
defaults->maxtargetrange = set? 896. : 0.;
|
||||||
break;
|
break;
|
||||||
case DEPF_LONGMELEERANGE:
|
case DEPF_LONGMELEERANGE:
|
||||||
defaults->meleethreshold = set? 196*FRACUNIT : 0;
|
defaults->meleethreshold = set? 196. : 0.;
|
||||||
break;
|
break;
|
||||||
case DEPF_QUARTERGRAVITY:
|
case DEPF_QUARTERGRAVITY:
|
||||||
defaults->Gravity = set ? 1. / 4 : 1.;
|
defaults->Gravity = set ? 1. / 4 : 1.;
|
||||||
|
@ -314,9 +314,9 @@ bool CheckDeprecatedFlags(const AActor *actor, PClassActor *info, int index)
|
||||||
case DEPF_LOWGRAVITY:
|
case DEPF_LOWGRAVITY:
|
||||||
return actor->Gravity == 1./8;
|
return actor->Gravity == 1./8;
|
||||||
case DEPF_SHORTMISSILERANGE:
|
case DEPF_SHORTMISSILERANGE:
|
||||||
return actor->maxtargetrange == 896*FRACUNIT;
|
return actor->maxtargetrange == 896.;
|
||||||
case DEPF_LONGMELEERANGE:
|
case DEPF_LONGMELEERANGE:
|
||||||
return actor->meleethreshold == 196*FRACUNIT;
|
return actor->meleethreshold == 196.;
|
||||||
case DEPF_QUARTERGRAVITY:
|
case DEPF_QUARTERGRAVITY:
|
||||||
return actor->Gravity == 1./4;
|
return actor->Gravity == 1./4;
|
||||||
case DEPF_FIRERESIST:
|
case DEPF_FIRERESIST:
|
||||||
|
@ -936,7 +936,7 @@ DEFINE_PROPERTY(burnheight, F, Actor)
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
DEFINE_PROPERTY(maxtargetrange, F, Actor)
|
DEFINE_PROPERTY(maxtargetrange, F, Actor)
|
||||||
{
|
{
|
||||||
PROP_FIXED_PARM(id, 0);
|
PROP_DOUBLE_PARM(id, 0);
|
||||||
defaults->maxtargetrange = id;
|
defaults->maxtargetrange = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -945,7 +945,7 @@ DEFINE_PROPERTY(maxtargetrange, F, Actor)
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
DEFINE_PROPERTY(meleethreshold, F, Actor)
|
DEFINE_PROPERTY(meleethreshold, F, Actor)
|
||||||
{
|
{
|
||||||
PROP_FIXED_PARM(id, 0);
|
PROP_DOUBLE_PARM(id, 0);
|
||||||
defaults->meleethreshold = id;
|
defaults->meleethreshold = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue