mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-03-24 11:42:19 +00:00
Added damage and thrust multipliers to quakes.
These properties allow for scaling the amount of damage an earthquake does and how much it pushes actors around.
This commit is contained in:
parent
8d95138735
commit
a38b151940
6 changed files with 24 additions and 15 deletions
src/playsim
wadsrc/static/zscript/actors
|
@ -135,8 +135,8 @@ class DEarthquake : public DThinker
|
|||
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);
|
||||
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);
|
||||
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
@ -151,6 +151,7 @@ public:
|
|||
double m_Falloff;
|
||||
int m_Highpoint, m_MiniCount;
|
||||
double m_RollIntensity, m_RollWave;
|
||||
double m_DamageMultiplier, m_ThrustMultiplier;
|
||||
|
||||
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 rollIntensity, double rollWave, double damageMultiplier, double thrustMultiplier)
|
||||
{
|
||||
m_QuakeSFX = quakesound;
|
||||
m_Spot = center;
|
||||
|
@ -69,6 +69,8 @@ void DEarthquake::Construct(AActor *center, double intensityX, double intensityY
|
|||
m_MiniCount = highpoint;
|
||||
m_RollIntensity = rollIntensity;
|
||||
m_RollWave = rollWave;
|
||||
m_DamageMultiplier = damageMultiplier;
|
||||
m_ThrustMultiplier = thrustMultiplier;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -94,13 +96,15 @@ void DEarthquake::Serialize(FSerializer &arc)
|
|||
("minicount", m_MiniCount)
|
||||
("rollintensity", m_RollIntensity)
|
||||
("rollwave", m_RollWave);
|
||||
("damagemultiplier", m_DamageMultiplier);
|
||||
("thrustmultiplier", m_ThrustMultiplier);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// DEarthquake :: Tick
|
||||
//
|
||||
// Deals damage to any players near the earthquake and makes sure it's
|
||||
// Deals damage to any actors near the earthquake and makes sure it's
|
||||
// making noise.
|
||||
//
|
||||
//==========================================================================
|
||||
|
@ -186,7 +190,7 @@ 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) : pr_quake.HitDice(1);
|
||||
damage = falloff ? pr_quake.HitDice(1) * GetFalloff(dist, m_DamageRadius) * m_DamageMultiplier : pr_quake.HitDice(1) * 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);
|
||||
|
@ -195,8 +199,8 @@ void DEarthquake::DoQuakeDamage(DEarthquake *quake, AActor *victim, bool falloff
|
|||
if (!(victim->flags7 & MF7_DONTTHRUST))
|
||||
{
|
||||
DAngle an = victim->Angles.Yaw + DAngle::fromDeg(pr_quake());
|
||||
victim->Vel.X += m_Intensity.X * an.Cos() * 0.5 * thrustfalloff;
|
||||
victim->Vel.Y += m_Intensity.Y * an.Sin() * 0.5 * thrustfalloff;
|
||||
victim->Vel.X += m_Intensity.X * an.Cos() * m_ThrustMultiplier * thrustfalloff;
|
||||
victim->Vel.Y += m_Intensity.Y * an.Sin() * m_ThrustMultiplier * thrustfalloff;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -420,7 +424,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 rollIntensity, double rollWave, double damageMultiplier, double thrustMultiplier)
|
||||
{
|
||||
AActor *center;
|
||||
bool res = false;
|
||||
|
@ -434,7 +438,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);
|
||||
quakesfx, flags, waveSpeedX, waveSpeedY, waveSpeedZ, falloff, highpoint, rollIntensity, rollWave, damageMultiplier, thrustMultiplier);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -445,7 +449,7 @@ 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);
|
||||
quakesfx, flags, waveSpeedX, waveSpeedY, waveSpeedZ, falloff, highpoint, rollIntensity, rollWave, damageMultiplier, thrustMultiplier);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -454,5 +458,5 @@ bool P_StartQuakeXYZ(FLevelLocals *Level, AActor *activator, int tid, double int
|
|||
|
||||
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);
|
||||
return P_StartQuakeXYZ(Level, activator, tid, intensity, intensity, 0, duration, damrad, tremrad, quakesfx, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
|
|
@ -6243,7 +6243,9 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
|||
argCount > 12 ? args[12] : 0,
|
||||
argCount > 13 ? args[13] : 0,
|
||||
argCount > 14 ? ACSToDouble(args[14]) : 0,
|
||||
argCount > 15 ? ACSToDouble(args[15]) : 0);
|
||||
argCount > 15 ? ACSToDouble(args[15]) : 0,
|
||||
argCount > 16 ? ACSToDouble(args[16]) : 0,
|
||||
argCount > 17 ? ACSToDouble(args[17]) : 0);
|
||||
}
|
||||
|
||||
case ACSF_SetLineActivation:
|
||||
|
|
|
@ -3369,8 +3369,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_QuakeEx)
|
|||
PARAM_INT(highpoint);
|
||||
PARAM_FLOAT(rollIntensity);
|
||||
PARAM_FLOAT(rollWave);
|
||||
PARAM_FLOAT(damageMultiplier);
|
||||
PARAM_FLOAT(thrustMultiplier);
|
||||
P_StartQuakeXYZ(self->Level, self, 0, intensityX, intensityY, intensityZ, duration, damrad, tremrad, sound, flags, mulWaveX, mulWaveY, mulWaveZ, falloff, highpoint,
|
||||
rollIntensity, rollWave);
|
||||
rollIntensity, rollWave, damageMultiplier, thrustMultiplier);
|
||||
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);
|
||||
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_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);
|
||||
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);
|
||||
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