- Removed QF_SCALEUP until I can figure out a proper way to implement it.

This commit is contained in:
MajorCooke 2015-02-20 01:33:30 -06:00
parent 0948b95e08
commit 9c5d90e4cb
3 changed files with 26 additions and 26 deletions

View file

@ -45,9 +45,8 @@ DEarthquake::DEarthquake (AActor *center, int intensityX, int intensityY, int in
m_IntensityX = intensityX; m_IntensityX = intensityX;
m_IntensityY = intensityY; m_IntensityY = intensityY;
m_IntensityZ = intensityZ; m_IntensityZ = intensityZ;
m_CountdownStart = (double)duration;
m_Countdown = duration; m_Countdown = duration;
m_Countup = 0;
m_ScaleDownStart = duration;
m_Flags = flags; m_Flags = flags;
} }
@ -133,7 +132,6 @@ void DEarthquake::Tick ()
} }
} }
} }
++m_Countup;
if (--m_Countdown == 0) if (--m_Countdown == 0)
{ {
if (S_IsActorPlayingSomething(m_Spot, CHAN_BODY, m_QuakeSFX)) if (S_IsActorPlayingSomething(m_Spot, CHAN_BODY, m_QuakeSFX))
@ -154,7 +152,7 @@ void DEarthquake::Tick ()
//========================================================================== //==========================================================================
int DEarthquake::StaticGetQuakeIntensities(AActor *victim, int DEarthquake::StaticGetQuakeIntensities(AActor *victim,
int &x, int &y, int &z, int &relx, int &rely, int &relz, double &scaleDown, double &scaleDownStart, double &scaleUp) int &x, int &y, int &z, int &relx, int &rely, int &relz, double &scaleDown, double &scaleDownStart)
{ {
if (victim->player != NULL && (victim->player->cheats & CF_NOCLIP)) if (victim->player != NULL && (victim->player->cheats & CF_NOCLIP))
{ {
@ -188,18 +186,15 @@ int DEarthquake::StaticGetQuakeIntensities(AActor *victim,
y = MAX(y, quake->m_IntensityY); y = MAX(y, quake->m_IntensityY);
z = MAX(z, quake->m_IntensityZ); z = MAX(z, quake->m_IntensityZ);
} }
scaleDownStart = scaleDown = scaleUp = 1;
if (quake->m_Flags & QF_SCALEDOWN) if (quake->m_Flags & QF_SCALEDOWN)
{ {
scaleDownStart = quake->m_CountdownStart;
scaleDown = (double)quake->m_Countdown; scaleDown = (double)quake->m_Countdown;
} }
else else
{ {
scaleDownStart = 0.0; scaleDownStart = scaleDown = 0.0;
scaleDown = 0.0;
} }
if (quake->m_Flags & QF_SCALEUP)
scaleUp = (double)quake->m_Countup;
} }
} }
} }

View file

@ -149,14 +149,14 @@ public:
void Tick (); void Tick ();
TObjPtr<AActor> m_Spot; TObjPtr<AActor> m_Spot;
fixed_t m_TremorRadius, m_DamageRadius; fixed_t m_TremorRadius, m_DamageRadius;
int m_ScaleDownStart;
int m_Countdown; int m_Countdown;
int m_Countup; double m_CountdownStart;
double m_Countup;
FSoundID m_QuakeSFX; FSoundID m_QuakeSFX;
int m_Flags; int m_Flags;
int m_IntensityX, m_IntensityY, m_IntensityZ; int m_IntensityX, m_IntensityY, m_IntensityZ;
static int StaticGetQuakeIntensities(AActor *viewer, int &x, int &y, int &z, int &relx, int &rely, int &relz, double &scaleDown, double &scaleDownStart, double &scaleUp); static int StaticGetQuakeIntensities(AActor *viewer, int &x, int &y, int &z, int &relx, int &rely, int &relz, double &scaleDown, double &scaleDownStart);
private: private:
DEarthquake (); DEarthquake ();

View file

@ -770,21 +770,26 @@ bool R_GetViewInterpolationStatus()
// //
//========================================================================== //==========================================================================
static double QuakePower(double factor, int intensity, double scaleDown, double scaleDownStart, double scaleUp) static double QuakePower(double factor, int intensity, double scaleDown, double scaleDownStart)
{ {
double ss = (double)((pr_torchflicker() % (intensity << 2)) - (intensity << 1));
if (intensity == 0) if (intensity == 0)
{ {
return 0; return 0;
} }
else if (!scaleDownStart) else
{
double ss = (double)((pr_torchflicker() % (intensity << 2)) - (intensity << 1));
if (scaleDownStart == 0)
{ {
return factor * ss; return factor * ss;
} }
else else
{ {
return ((factor * ss) * ((scaleDown / scaleDownStart) / 256.0f)); return ((factor * ss) * ((scaleDown / scaleDownStart)));
} }
}
} }
//========================================================================== //==========================================================================
@ -898,41 +903,41 @@ void R_SetupFrame (AActor *actor)
if (!paused) if (!paused)
{ {
int intensityX, intensityY, intensityZ, relIntensityX, relIntensityY, relIntensityZ; int intensityX, intensityY, intensityZ, relIntensityX, relIntensityY, relIntensityZ;
double scaleDown, scaleDownStart, scaleUp; double scaleDown, scaleDownStart;
//double sdown = (double)scaleDown; double sdownstart = (double)scaleDownStart; //double sdown = (double)scaleDown; double sdownstart = (double)scaleDownStart;
if (DEarthquake::StaticGetQuakeIntensities(camera, if (DEarthquake::StaticGetQuakeIntensities(camera,
intensityX, intensityY, intensityZ, intensityX, intensityY, intensityZ,
relIntensityX, relIntensityY, relIntensityZ, scaleDown, scaleDownStart, scaleUp) > 0) relIntensityX, relIntensityY, relIntensityZ, scaleDown, scaleDownStart) > 0)
{ {
double quakefactor = r_quakeintensity; double quakefactor = r_quakeintensity;
if (relIntensityX != 0) if (relIntensityX != 0)
{ {
int ang = (camera->angle) >> ANGLETOFINESHIFT; int ang = (camera->angle) >> ANGLETOFINESHIFT;
fixed_t power = FLOAT2FIXED(QuakePower(quakefactor, relIntensityX, scaleDown, scaleDownStart, scaleUp)); fixed_t power = FLOAT2FIXED(QuakePower(quakefactor, relIntensityX, scaleDown, scaleDownStart));
viewx += FixedMul(finecosine[ang], power); viewx += FixedMul(finecosine[ang], power);
viewy += FixedMul(finesine[ang], power); viewy += FixedMul(finesine[ang], power);
} }
if (relIntensityY != 0) if (relIntensityY != 0)
{ {
int ang = (camera->angle + ANG90) >> ANGLETOFINESHIFT; int ang = (camera->angle + ANG90) >> ANGLETOFINESHIFT;
fixed_t power = FLOAT2FIXED(QuakePower(quakefactor, relIntensityY, scaleDown, scaleDownStart, scaleUp)); fixed_t power = FLOAT2FIXED(QuakePower(quakefactor, relIntensityY, scaleDown, scaleDownStart));
viewx += FixedMul(finecosine[ang], power); viewx += FixedMul(finecosine[ang], power);
viewy += FixedMul(finesine[ang], power); viewy += FixedMul(finesine[ang], power);
} }
if (intensityX != 0) if (intensityX != 0)
{ {
viewx += FLOAT2FIXED(QuakePower(quakefactor, intensityX, scaleDown, scaleDownStart, scaleUp)); viewx += FLOAT2FIXED(QuakePower(quakefactor, intensityX, scaleDown, scaleDownStart));
} }
if (intensityY != 0) if (intensityY != 0)
{ {
viewy += FLOAT2FIXED(QuakePower(quakefactor, intensityY, scaleDown, scaleDownStart, scaleUp)); viewy += FLOAT2FIXED(QuakePower(quakefactor, intensityY, scaleDown, scaleDownStart));
} }
// FIXME: Relative Z is not relative // FIXME: Relative Z is not relative
intensityZ = MAX(intensityZ, relIntensityZ); intensityZ = MAX(intensityZ, relIntensityZ);
if (intensityZ != 0) if (intensityZ != 0)
{ {
viewz += FLOAT2FIXED(QuakePower(quakefactor, intensityZ, scaleDown, scaleDownStart, scaleUp)); viewz += FLOAT2FIXED(QuakePower(quakefactor, intensityZ, scaleDown, scaleDownStart));
} }
} }
} }