- Added QF_FULLINTENSITY.

- When using both scaling flags, by default, the effect only reaches half peak going either way. This forces it to go all the way to the top (or bottom if using QF_MAX) before scaling back to its original height..
This commit is contained in:
MajorCooke 2015-02-20 11:06:41 -06:00
parent aa3c3d6546
commit fb9231a38d
4 changed files with 12 additions and 9 deletions

View file

@ -166,7 +166,7 @@ int DEarthquake::StaticGetQuakeIntensities(AActor *victim, quakeInfo &qprop)
{
return 0;
}
qprop.isScalingDown = qprop.isScalingUp = false, qprop.preferMaximum = false;
qprop.isScalingDown = qprop.isScalingUp = qprop.preferMaximum = qprop.fullIntensity = false;
qprop.intensityX = qprop.intensityY = qprop.intensityZ = qprop.relIntensityX = qprop.relIntensityY = qprop.relIntensityZ = 0;
TThinkerIterator<DEarthquake> iterator(STAT_EARTHQUAKE);
@ -201,6 +201,7 @@ int DEarthquake::StaticGetQuakeIntensities(AActor *victim, quakeInfo &qprop)
qprop.isScalingDown = (quake->m_Flags & QF_SCALEDOWN) ? true : false;
qprop.isScalingUp = (quake->m_Flags & QF_SCALEUP) ? true : false;
qprop.preferMaximum = (quake->m_Flags & QF_MAX) ? true : false;
qprop.fullIntensity = (quake->m_Flags & QF_FULLINTENSITY) ? true : false;
}
else
{

View file

@ -133,17 +133,18 @@ protected:
enum
{
QF_RELATIVE = 1,
QF_SCALEDOWN = 1 << 1,
QF_SCALEUP = 1 << 2,
QF_MAX = 1 << 3,
QF_RELATIVE = 1,
QF_SCALEDOWN = 1 << 1,
QF_SCALEUP = 1 << 2,
QF_MAX = 1 << 3,
QF_FULLINTENSITY = 1 << 4,
};
struct quakeInfo
{
int intensityX, intensityY, intensityZ, relIntensityX, relIntensityY, relIntensityZ;
double scaleDown, scaleDownStart;
bool isScalingDown, isScalingUp, preferMaximum;
bool isScalingDown, isScalingUp, preferMaximum, fullIntensity;
};
class DEarthquake : public DThinker

View file

@ -781,7 +781,7 @@ static fixed_t QuakePower(double factor, int intensity, quakeInfo quake)
else
{
double ss = (double)((pr_torchflicker() % (intensity << 2)) - (intensity << 1));
double mtp = (quake.fullIntensity) ? 2.0 : 1.0;
if (quake.isScalingDown || quake.isScalingUp)
{
fixed_t result;
@ -790,9 +790,9 @@ static fixed_t QuakePower(double factor, int intensity, quakeInfo quake)
if (quake.isScalingDown && quake.isScalingUp)
{
if (quake.preferMaximum)
result = FLOAT2FIXED((factor * ss) * MAX((scaleDown / scaleDownStart), (scaleDownStart - scaleDown) / scaleDownStart));
result = FLOAT2FIXED((factor * ss) * MAX(((scaleDown*mtp) / scaleDownStart), ((scaleDownStart - scaleDown)*mtp) / scaleDownStart));
else
result = FLOAT2FIXED((factor * ss) * MIN(((scaleDown*2) / scaleDownStart), ((scaleDownStart - scaleDown)*2) / scaleDownStart));
result = FLOAT2FIXED((factor * ss) * MIN(((scaleDown*mtp) / scaleDownStart), ((scaleDownStart - scaleDown)*mtp) / scaleDownStart));
}
else if (quake.isScalingDown)
result = FLOAT2FIXED((factor * ss) * (scaleDown / scaleDownStart));

View file

@ -465,6 +465,7 @@ enum
QF_SCALEDOWN = 1 << 1,
QF_SCALEUP = 1 << 2,
QF_MAX = 1 << 3,
QF_FULLINTENSITY = 1 << 4,
};
// This is only here to provide one global variable for testing.