mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-31 13:50:48 +00:00
Added damage property to earthquakes.
When this property is set to any value above 0. The earthquake does the exact amount of damage specified, instead of a random amount.
This commit is contained in:
parent
a38b151940
commit
a7f76fe8b9
6 changed files with 26 additions and 17 deletions
|
@ -136,7 +136,7 @@ public:
|
|||
static const int DEFAULT_STAT = STAT_EARTHQUAKE;
|
||||
void Construct(AActor *center, double intensityX, double intensityY, double intensityZ, int duration,
|
||||
int damrad, int tremrad, FSoundID quakesfx, int flags,
|
||||
double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint, double rollIntensity, double rollWave, double damageMultiplier, double thrustMultiplier);
|
||||
double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint, double rollIntensity, double rollWave, double damageMultiplier, double thrustMultiplier, int damage);
|
||||
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
@ -152,6 +152,7 @@ public:
|
|||
int m_Highpoint, m_MiniCount;
|
||||
double m_RollIntensity, m_RollWave;
|
||||
double m_DamageMultiplier, m_ThrustMultiplier;
|
||||
int m_Damage;
|
||||
|
||||
double GetModIntensity(double intensity, bool fake = false) const;
|
||||
double GetModWave(double ticFrac, double waveMultiplier) const;
|
||||
|
|
|
@ -52,7 +52,7 @@ IMPLEMENT_POINTERS_END
|
|||
void DEarthquake::Construct(AActor *center, double intensityX, double intensityY, double intensityZ, int duration,
|
||||
int damrad, int tremrad, FSoundID quakesound, int flags,
|
||||
double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint,
|
||||
double rollIntensity, double rollWave, double damageMultiplier, double thrustMultiplier)
|
||||
double rollIntensity, double rollWave, double damageMultiplier, double thrustMultiplier, int damage)
|
||||
{
|
||||
m_QuakeSFX = quakesound;
|
||||
m_Spot = center;
|
||||
|
@ -71,6 +71,7 @@ void DEarthquake::Construct(AActor *center, double intensityX, double intensityY
|
|||
m_RollWave = rollWave;
|
||||
m_DamageMultiplier = damageMultiplier;
|
||||
m_ThrustMultiplier = thrustMultiplier;
|
||||
m_Damage = damage;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -98,6 +99,7 @@ void DEarthquake::Serialize(FSerializer &arc)
|
|||
("rollwave", m_RollWave);
|
||||
("damagemultiplier", m_DamageMultiplier);
|
||||
("thrustmultiplier", m_ThrustMultiplier);
|
||||
("damage", m_Damage);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -174,12 +176,11 @@ void DEarthquake::Tick ()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
//[inkoalawetrust] Todo: Add a damage multiplier variable to DEarthquake ? Could be useful for making stronger earthquakes more damaging and stuff.
|
||||
void DEarthquake::DoQuakeDamage(DEarthquake *quake, AActor *victim, bool falloff) const
|
||||
{
|
||||
double dist;
|
||||
double thrustfalloff = 0.f;
|
||||
int damage = 0;
|
||||
double thrustfalloff;
|
||||
int damage;
|
||||
|
||||
if (!quake || !victim) return;
|
||||
|
||||
|
@ -190,13 +191,18 @@ void DEarthquake::DoQuakeDamage(DEarthquake *quake, AActor *victim, bool falloff
|
|||
{
|
||||
if (!(quake->m_Flags & QF_SHAKEONLY) && pr_quake() < 50)
|
||||
{
|
||||
damage = falloff ? pr_quake.HitDice(1) * GetFalloff(dist, m_DamageRadius) * m_DamageMultiplier : pr_quake.HitDice(1) * m_DamageMultiplier;
|
||||
if (m_Damage < 1)
|
||||
damage = falloff ? (int)(pr_quake.HitDice(1) * GetFalloff(dist, m_DamageRadius) * m_DamageMultiplier) : (int)(pr_quake.HitDice(1) * m_DamageMultiplier);
|
||||
//[inkoalawetrust] Do the exact specified damage.
|
||||
else
|
||||
damage = falloff ? (int)(m_Damage * GetFalloff(dist, m_DamageRadius) * m_DamageMultiplier) : (int)(m_Damage * m_DamageMultiplier);
|
||||
|
||||
damage = damage < 1 ? 1 : damage; //Do at least a tiny bit of damage when in radius.
|
||||
|
||||
P_DamageMobj(victim, NULL, NULL, damage, NAME_Quake);
|
||||
}
|
||||
// Thrust pushable actor around
|
||||
if (!(victim->flags7 & MF7_DONTTHRUST))
|
||||
if (!(victim->flags7 & MF7_DONTTHRUST) && m_ThrustMultiplier > 0)
|
||||
{
|
||||
DAngle an = victim->Angles.Yaw + DAngle::fromDeg(pr_quake());
|
||||
victim->Vel.X += m_Intensity.X * an.Cos() * m_ThrustMultiplier * thrustfalloff;
|
||||
|
@ -424,7 +430,7 @@ int DEarthquake::StaticGetQuakeIntensities(double ticFrac, AActor *victim, FQuak
|
|||
bool P_StartQuakeXYZ(FLevelLocals *Level, AActor *activator, int tid, double intensityX, double intensityY, double intensityZ, int duration,
|
||||
int damrad, int tremrad, FSoundID quakesfx, int flags,
|
||||
double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint,
|
||||
double rollIntensity, double rollWave, double damageMultiplier, double thrustMultiplier)
|
||||
double rollIntensity, double rollWave, double damageMultiplier, double thrustMultiplier, int damage)
|
||||
{
|
||||
AActor *center;
|
||||
bool res = false;
|
||||
|
@ -438,7 +444,7 @@ bool P_StartQuakeXYZ(FLevelLocals *Level, AActor *activator, int tid, double int
|
|||
if (activator != NULL)
|
||||
{
|
||||
Level->CreateThinker<DEarthquake>(activator, intensityX, intensityY, intensityZ, duration, damrad, tremrad,
|
||||
quakesfx, flags, waveSpeedX, waveSpeedY, waveSpeedZ, falloff, highpoint, rollIntensity, rollWave, damageMultiplier, thrustMultiplier);
|
||||
quakesfx, flags, waveSpeedX, waveSpeedY, waveSpeedZ, falloff, highpoint, rollIntensity, rollWave, damageMultiplier, thrustMultiplier, damage);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -449,14 +455,14 @@ bool P_StartQuakeXYZ(FLevelLocals *Level, AActor *activator, int tid, double int
|
|||
{
|
||||
res = true;
|
||||
Level->CreateThinker<DEarthquake>(center, intensityX, intensityY, intensityZ, duration, damrad, tremrad,
|
||||
quakesfx, flags, waveSpeedX, waveSpeedY, waveSpeedZ, falloff, highpoint, rollIntensity, rollWave, damageMultiplier, thrustMultiplier);
|
||||
quakesfx, flags, waveSpeedX, waveSpeedY, waveSpeedZ, falloff, highpoint, rollIntensity, rollWave, damageMultiplier, thrustMultiplier, damage);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool P_StartQuake(FLevelLocals *Level, AActor *activator, int tid, double intensity, int duration, int damrad, int tremrad, FSoundID quakesfx)
|
||||
bool P_StartQuake(FLevelLocals * Level, AActor * activator, int tid, double intensity, int duration, int damrad, int tremrad, FSoundID quakesfx)
|
||||
{ //Maintains original behavior by passing 0 to intensityZ, flags, and everything else after QSFX.
|
||||
return P_StartQuakeXYZ(Level, activator, tid, intensity, intensity, 0, duration, damrad, tremrad, quakesfx, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
return P_StartQuakeXYZ(Level, activator, tid, intensity, intensity, 0, duration, damrad, tremrad, quakesfx, 0, 0, 0, 0, 0, 0, 0, 0, 1.0, 0.5, 0);
|
||||
}
|
||||
|
|
|
@ -6244,8 +6244,9 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
|||
argCount > 13 ? args[13] : 0,
|
||||
argCount > 14 ? ACSToDouble(args[14]) : 0,
|
||||
argCount > 15 ? ACSToDouble(args[15]) : 0,
|
||||
argCount > 16 ? ACSToDouble(args[16]) : 0,
|
||||
argCount > 17 ? ACSToDouble(args[17]) : 0);
|
||||
argCount > 16 ? ACSToDouble(args[16]) : 1.0,
|
||||
argCount > 17 ? ACSToDouble(args[17]) : 0.5,
|
||||
argCount > 18 ? args[18] : 0);
|
||||
}
|
||||
|
||||
case ACSF_SetLineActivation:
|
||||
|
|
|
@ -3371,8 +3371,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_QuakeEx)
|
|||
PARAM_FLOAT(rollWave);
|
||||
PARAM_FLOAT(damageMultiplier);
|
||||
PARAM_FLOAT(thrustMultiplier);
|
||||
PARAM_INT(damage);
|
||||
P_StartQuakeXYZ(self->Level, self, 0, intensityX, intensityY, intensityZ, duration, damrad, tremrad, sound, flags, mulWaveX, mulWaveY, mulWaveZ, falloff, highpoint,
|
||||
rollIntensity, rollWave, damageMultiplier, thrustMultiplier);
|
||||
rollIntensity, rollWave, damageMultiplier, thrustMultiplier, damage);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ void P_TerminateScript (FLevelLocals *Level, int script, const char *map);
|
|||
//
|
||||
// [RH] p_quake.c
|
||||
//
|
||||
bool P_StartQuakeXYZ(FLevelLocals *Level, AActor *activator, int tid, double intensityX, double intensityY, double intensityZ, int duration, int damrad, int tremrad, FSoundID quakesfx, int flags, double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint, double rollIntensity, double rollWave, double damageMultiplier, double thrustMultiplier);
|
||||
bool P_StartQuakeXYZ(FLevelLocals *Level, AActor *activator, int tid, double intensityX, double intensityY, double intensityZ, int duration, int damrad, int tremrad, FSoundID quakesfx, int flags, double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint, double rollIntensity, double rollWave, double damageMultiplier, double thrustMultiplier, int damage);
|
||||
bool P_StartQuake(FLevelLocals *Level, AActor *activator, int tid, double intensity, int duration, int damrad, int tremrad, FSoundID quakesfx);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1209,7 +1209,7 @@ class Actor : Thinker native
|
|||
deprecated("2.3", "User variables are deprecated in ZScript. Actor variables are directly accessible") native void A_SetUserVarFloat(name varname, double value);
|
||||
deprecated("2.3", "User variables are deprecated in ZScript. Actor variables are directly accessible") native void A_SetUserArrayFloat(name varname, int index, double value);
|
||||
native void A_Quake(double intensity, int duration, int damrad, int tremrad, sound sfx = "world/quake");
|
||||
native void A_QuakeEx(double intensityX, double intensityY, double intensityZ, int duration, int damrad, int tremrad, sound sfx = "world/quake", int flags = 0, double mulWaveX = 1, double mulWaveY = 1, double mulWaveZ = 1, int falloff = 0, int highpoint = 0, double rollIntensity = 0, double rollWave = 0, double damageMultiplier = 1, double thrustMultiplier = 0.5);
|
||||
native void A_QuakeEx(double intensityX, double intensityY, double intensityZ, int duration, int damrad, int tremrad, sound sfx = "world/quake", int flags = 0, double mulWaveX = 1, double mulWaveY = 1, double mulWaveZ = 1, int falloff = 0, int highpoint = 0, double rollIntensity = 0, double rollWave = 0, double damageMultiplier = 1, double thrustMultiplier = 0.5, int damage = 0);
|
||||
action native void A_SetTics(int tics);
|
||||
native void A_DamageSelf(int amount, name damagetype = "none", int flags = 0, class<Actor> filter = null, name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT);
|
||||
native void A_DamageTarget(int amount, name damagetype = "none", int flags = 0, class<Actor> filter = null, name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT);
|
||||
|
|
Loading…
Reference in a new issue