mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
Added QF_SHAKEONLY
The QF_SHAKEONLY flag changes the behavior of earthquakes with a damage radius, so that they only shake actors around, without also harming them.
This commit is contained in:
parent
457ad97553
commit
29421e6975
2 changed files with 9 additions and 6 deletions
|
@ -115,6 +115,7 @@ enum
|
|||
QF_3D = 1 << 6,
|
||||
QF_GROUNDONLY = 1 << 7,
|
||||
QF_AFFECTACTORS = 1 << 8,
|
||||
QF_SHAKEONLY = 1 << 9,
|
||||
};
|
||||
|
||||
struct FQuakeJiggers
|
||||
|
@ -153,7 +154,7 @@ public:
|
|||
double GetModIntensity(double intensity, bool fake = false) const;
|
||||
double GetModWave(double ticFrac, double waveMultiplier) const;
|
||||
double GetFalloff(double dist) const;
|
||||
void DoQuakeDamage(AActor *m_Spot, AActor *victim) const;
|
||||
void DoQuakeDamage(DEarthquake *quake, AActor *victim) const;
|
||||
|
||||
static int StaticGetQuakeIntensities(double ticFrac, AActor *viewer, FQuakeJiggers &jiggers);
|
||||
};
|
||||
|
|
|
@ -132,7 +132,7 @@ void DEarthquake::Tick ()
|
|||
continue;
|
||||
|
||||
|
||||
DoQuakeDamage(m_Spot, mo);
|
||||
DoQuakeDamage(this, mo);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -142,7 +142,7 @@ void DEarthquake::Tick ()
|
|||
if (Level->PlayerInGame(i) && !(Level->Players[i]->cheats & CF_NOCLIP))
|
||||
{
|
||||
AActor* victim = Level->Players[i]->mo;
|
||||
DoQuakeDamage(m_Spot, victim);
|
||||
DoQuakeDamage(this, victim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -168,15 +168,17 @@ void DEarthquake::Tick ()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void DEarthquake::DoQuakeDamage(AActor *m_Spot, AActor *victim) const
|
||||
void DEarthquake::DoQuakeDamage(DEarthquake *quake, AActor *victim) const
|
||||
{
|
||||
double dist;
|
||||
|
||||
dist = m_Spot->Distance2D(victim, true);
|
||||
if (!quake || !victim) return;
|
||||
|
||||
dist = quake->m_Spot->Distance2D(victim, true);
|
||||
// Check if in damage radius
|
||||
if (dist < m_DamageRadius && victim->Z() <= victim->floorz)
|
||||
{
|
||||
if (pr_quake() < 50)
|
||||
if (!(quake->m_Flags & QF_SHAKEONLY) && pr_quake() < 50)
|
||||
{
|
||||
P_DamageMobj(victim, NULL, NULL, pr_quake.HitDice(1), NAME_Quake);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue