mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- Added rollIntensity and rollWave to A_QuakeEx.
- Instead of moving the camera around, it rolls the camera. - This only has an effect in GZDoom.
This commit is contained in:
parent
660aff562d
commit
c972caa9f3
9 changed files with 44 additions and 17 deletions
|
@ -37,7 +37,8 @@ DEarthquake::DEarthquake()
|
|||
|
||||
DEarthquake::DEarthquake(AActor *center, int intensityX, int intensityY, int intensityZ, int duration,
|
||||
int damrad, int tremrad, FSoundID quakesound, int flags,
|
||||
double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint)
|
||||
double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint, int rollIntensity,
|
||||
double rollWave)
|
||||
: DThinker(STAT_EARTHQUAKE)
|
||||
{
|
||||
m_QuakeSFX = quakesound;
|
||||
|
@ -53,6 +54,8 @@ DEarthquake::DEarthquake(AActor *center, int intensityX, int intensityY, int int
|
|||
m_Falloff = falloff;
|
||||
m_Highpoint = highpoint;
|
||||
m_MiniCount = highpoint;
|
||||
m_RollIntensity = rollIntensity;
|
||||
m_RollWave = rollWave;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -68,7 +71,8 @@ void DEarthquake::Serialize (FArchive &arc)
|
|||
<< m_TremorRadius << m_DamageRadius
|
||||
<< m_QuakeSFX << m_Flags << m_CountdownStart
|
||||
<< m_WaveSpeed
|
||||
<< m_Falloff << m_Highpoint << m_MiniCount;
|
||||
<< m_Falloff << m_Highpoint << m_MiniCount
|
||||
<< m_RollIntensity;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -281,11 +285,12 @@ int DEarthquake::StaticGetQuakeIntensities(AActor *victim, FQuakeJiggers &jigger
|
|||
double x = quake->GetModIntensity(quake->m_Intensity.X);
|
||||
double y = quake->GetModIntensity(quake->m_Intensity.Y);
|
||||
double z = quake->GetModIntensity(quake->m_Intensity.Z);
|
||||
|
||||
double r = quake->GetModIntensity(quake->m_RollIntensity);
|
||||
|
||||
if (!(quake->m_Flags & QF_WAVE))
|
||||
{
|
||||
jiggers.Falloff = MAX(falloff, jiggers.Falloff);
|
||||
jiggers.RollIntensity = MAX(r, jiggers.RollIntensity);
|
||||
if (quake->m_Flags & QF_RELATIVE)
|
||||
{
|
||||
jiggers.RelIntensity.X = MAX(x, jiggers.RelIntensity.X);
|
||||
|
@ -302,9 +307,11 @@ int DEarthquake::StaticGetQuakeIntensities(AActor *victim, FQuakeJiggers &jigger
|
|||
else
|
||||
{
|
||||
jiggers.WFalloff = MAX(falloff, jiggers.WFalloff);
|
||||
double mr = r * quake->GetModWave(quake->m_RollWave);
|
||||
double mx = x * quake->GetModWave(quake->m_WaveSpeed.X);
|
||||
double my = y * quake->GetModWave(quake->m_WaveSpeed.Y);
|
||||
double mz = z * quake->GetModWave(quake->m_WaveSpeed.Z);
|
||||
jiggers.RollWave = r * quake->GetModWave(quake->m_RollWave);
|
||||
|
||||
// [RH] This only gives effect to the last sine quake. I would
|
||||
// prefer if some way was found to make multiples coexist
|
||||
|
@ -338,7 +345,8 @@ int DEarthquake::StaticGetQuakeIntensities(AActor *victim, FQuakeJiggers &jigger
|
|||
|
||||
bool P_StartQuakeXYZ(AActor *activator, int tid, int intensityX, int intensityY, int intensityZ, int duration,
|
||||
int damrad, int tremrad, FSoundID quakesfx, int flags,
|
||||
double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint)
|
||||
double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint,
|
||||
int rollIntensity, double rollWave)
|
||||
{
|
||||
AActor *center;
|
||||
bool res = false;
|
||||
|
@ -352,7 +360,7 @@ bool P_StartQuakeXYZ(AActor *activator, int tid, int intensityX, int intensityY,
|
|||
if (activator != NULL)
|
||||
{
|
||||
new DEarthquake(activator, intensityX, intensityY, intensityZ, duration, damrad, tremrad,
|
||||
quakesfx, flags, waveSpeedX, waveSpeedY, waveSpeedZ, falloff, highpoint);
|
||||
quakesfx, flags, waveSpeedX, waveSpeedY, waveSpeedZ, falloff, highpoint, rollIntensity, rollWave);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -363,7 +371,7 @@ bool P_StartQuakeXYZ(AActor *activator, int tid, int intensityX, int intensityY,
|
|||
{
|
||||
res = true;
|
||||
new DEarthquake(center, intensityX, intensityY, intensityZ, duration, damrad, tremrad,
|
||||
quakesfx, flags, waveSpeedX, waveSpeedY, waveSpeedZ, falloff, highpoint);
|
||||
quakesfx, flags, waveSpeedX, waveSpeedY, waveSpeedZ, falloff, highpoint, rollIntensity, rollWave);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -372,5 +380,5 @@ bool P_StartQuakeXYZ(AActor *activator, int tid, int intensityX, int intensityY,
|
|||
|
||||
bool P_StartQuake(AActor *activator, int tid, int 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(activator, tid, intensity, intensity, 0, duration, damrad, tremrad, quakesfx, 0, 0, 0, 0, 0, 0);
|
||||
return P_StartQuakeXYZ(activator, tid, intensity, intensity, 0, duration, damrad, tremrad, quakesfx, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
|
|
@ -153,8 +153,8 @@ struct FQuakeJiggers
|
|||
DVector3 RelIntensity;
|
||||
DVector3 Offset;
|
||||
DVector3 RelOffset;
|
||||
double Falloff;
|
||||
double WFalloff;
|
||||
double Falloff, WFalloff;
|
||||
double RollIntensity, RollWave;
|
||||
};
|
||||
|
||||
class DEarthquake : public DThinker
|
||||
|
@ -164,7 +164,7 @@ class DEarthquake : public DThinker
|
|||
public:
|
||||
DEarthquake(AActor *center, int intensityX, int intensityY, int intensityZ, int duration,
|
||||
int damrad, int tremrad, FSoundID quakesfx, int flags,
|
||||
double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint);
|
||||
double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint, int rollIntensity, double rollWave);
|
||||
|
||||
void Serialize (FArchive &arc);
|
||||
void Tick ();
|
||||
|
@ -178,6 +178,8 @@ public:
|
|||
DVector3 m_WaveSpeed;
|
||||
double m_Falloff;
|
||||
int m_Highpoint, m_MiniCount;
|
||||
double m_RollIntensity, m_RollWave;
|
||||
|
||||
|
||||
double GetModIntensity(double intensity) const;
|
||||
double GetModWave(double waveMultiplier) const;
|
||||
|
|
|
@ -5768,7 +5768,9 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
|||
argCount > 10 ? ACSToDouble(args[10]) : 1.0,
|
||||
argCount > 11 ? ACSToDouble(args[11]) : 1.0,
|
||||
argCount > 12 ? args[12] : 0,
|
||||
argCount > 13 ? args[13] : 0);
|
||||
argCount > 13 ? args[13] : 0,
|
||||
argCount > 14 ? args[14] : 0,
|
||||
argCount > 15 ? args[15] : 0);
|
||||
}
|
||||
|
||||
case ACSF_SetLineActivation:
|
||||
|
|
|
@ -238,6 +238,7 @@ void AActor::Serialize(FArchive &arc)
|
|||
<< Angles.Yaw
|
||||
<< Angles.Pitch
|
||||
<< Angles.Roll
|
||||
<< Angles.CamRoll
|
||||
<< frame
|
||||
<< Scale
|
||||
<< RenderStyle
|
||||
|
@ -4592,7 +4593,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
|
|||
}
|
||||
|
||||
mobj->Angles.Yaw = SpawnAngle;
|
||||
mobj->Angles.Pitch = mobj->Angles.Roll = 0.;
|
||||
mobj->Angles.Pitch = mobj->Angles.Roll = mobj->Angles.CamRoll = 0.;
|
||||
mobj->health = p->health;
|
||||
|
||||
// [RH] Set player sprite based on skin
|
||||
|
@ -5074,7 +5075,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
|
|||
if (mthing->pitch)
|
||||
mobj->Angles.Pitch = (double)mthing->pitch;
|
||||
if (mthing->roll)
|
||||
mobj->Angles.Roll = (double)mthing->roll;
|
||||
mobj->Angles.Roll = mobj->Angles.CamRoll = (double)mthing->roll;
|
||||
if (mthing->score)
|
||||
mobj->Score = mthing->score;
|
||||
if (mthing->fillcolor)
|
||||
|
|
|
@ -698,7 +698,7 @@ void P_DoDeferedScripts (void);
|
|||
//
|
||||
// [RH] p_quake.c
|
||||
//
|
||||
bool P_StartQuakeXYZ(AActor *activator, int tid, int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, FSoundID quakesfx, int flags, double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint);
|
||||
bool P_StartQuakeXYZ(AActor *activator, int tid, int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, FSoundID quakesfx, int flags, double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint, int rollIntensity, double rollWave);
|
||||
bool P_StartQuake(AActor *activator, int tid, int intensity, int duration, int damrad, int tremrad, FSoundID quakesfx);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -799,6 +799,7 @@ void R_SetupFrame (AActor *actor)
|
|||
P_AimCamera (camera, campos, camangle, viewsector, unlinked); // fixme: This needs to translate the angle, too.
|
||||
iview->New.Pos = campos;
|
||||
iview->New.Angles.Yaw = camangle;
|
||||
|
||||
r_showviewer = true;
|
||||
// Interpolating this is a very complicated thing because nothing keeps track of the aim camera's movement, so whenever we detect a portal transition
|
||||
// it's probably best to just reset the interpolation for this move.
|
||||
|
@ -868,6 +869,10 @@ void R_SetupFrame (AActor *actor)
|
|||
double quakefactor = r_quakeintensity;
|
||||
DAngle an;
|
||||
|
||||
if (jiggers.RollIntensity != 0 || jiggers.RollWave != 0)
|
||||
{
|
||||
camera->Angles.CamRoll = camera->Angles.Roll + QuakePower(quakefactor, jiggers.RollIntensity, jiggers.RollWave, jiggers.Falloff, jiggers.WFalloff);
|
||||
}
|
||||
if (jiggers.RelIntensity.X != 0 || jiggers.RelOffset.X != 0)
|
||||
{
|
||||
an = camera->Angles.Yaw;
|
||||
|
@ -898,6 +903,10 @@ void R_SetupFrame (AActor *actor)
|
|||
ViewPos.Z += QuakePower(quakefactor, jiggers.Intensity.Z, jiggers.Offset.Z, jiggers.Falloff, jiggers.WFalloff);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
camera->Angles.CamRoll = camera->Angles.Roll;
|
||||
}
|
||||
}
|
||||
|
||||
extralight = camera->player ? camera->player->extralight : 0;
|
||||
|
|
|
@ -2388,6 +2388,7 @@ static bool InitSpawnedItem(AActor *self, AActor *mo, int flags)
|
|||
if (flags & SIXF_TRANSFERROLL)
|
||||
{
|
||||
mo->Angles.Roll = self->Angles.Roll;
|
||||
mo->Angles.CamRoll = self->Angles.CamRoll;
|
||||
}
|
||||
|
||||
if (flags & SIXF_ISTARGET)
|
||||
|
@ -4985,7 +4986,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_QuakeEx)
|
|||
PARAM_FLOAT_OPT(mulWaveZ) { mulWaveZ = 1.; }
|
||||
PARAM_INT_OPT(falloff) { falloff = 0; }
|
||||
PARAM_INT_OPT(highpoint) { highpoint = 0; }
|
||||
P_StartQuakeXYZ(self, 0, intensityX, intensityY, intensityZ, duration, damrad, tremrad, sound, flags, mulWaveX, mulWaveY, mulWaveZ, falloff, highpoint);
|
||||
PARAM_INT_OPT(rollIntensity) { rollIntensity = 0; }
|
||||
PARAM_FLOAT_OPT(rollWave) { rollWave = 0.; }
|
||||
P_StartQuakeXYZ(self, 0, intensityX, intensityY, intensityZ, duration, damrad, tremrad, sound, flags, mulWaveX, mulWaveY, mulWaveZ, falloff, highpoint,
|
||||
rollIntensity, rollWave);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1135,7 +1135,8 @@ struct TRotator
|
|||
|
||||
Angle Pitch; // up/down
|
||||
Angle Yaw; // left/right
|
||||
Angle Roll; // rotation about the forward axis
|
||||
Angle Roll; // rotation about the forward axis.
|
||||
Angle CamRoll; // Roll specific to actor cameras. Used by quakes.
|
||||
|
||||
TRotator ()
|
||||
{
|
||||
|
|
|
@ -281,7 +281,7 @@ ACTOR Actor native //: Thinker
|
|||
native void A_SetUserArrayFloat(name varname, int index, float value);
|
||||
native void A_SetSpecial(int spec, int arg0 = 0, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0);
|
||||
native void A_Quake(int intensity, int duration, int damrad, int tremrad, sound sfx = "world/quake");
|
||||
native void A_QuakeEx(int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, sound sfx = "world/quake", int flags = 0, float mulWaveX = 1, float mulWaveY = 1, float mulWaveZ = 1, int falloff = 0, int highpoint = 0);
|
||||
native void A_QuakeEx(int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, sound sfx = "world/quake", int flags = 0, float mulWaveX = 1, float mulWaveY = 1, float mulWaveZ = 1, int falloff = 0, int highpoint = 0, int rollIntensity = 0, float rollWave = 0);
|
||||
action native A_SetTics(int tics);
|
||||
native void A_SetDamageType(name damagetype);
|
||||
native void A_DropItem(class<Actor> item, int dropamount = -1, int chance = 256);
|
||||
|
|
Loading…
Reference in a new issue