mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-30 13:20:52 +00:00
Allow passing sound volume to PlayBounceSound in ZScript
This commit is contained in:
parent
f239025f8e
commit
27b6cb2f72
5 changed files with 13 additions and 11 deletions
|
@ -863,7 +863,7 @@ public:
|
|||
void Howl ();
|
||||
|
||||
// plays bouncing sound
|
||||
void PlayBounceSound(bool onfloor);
|
||||
void PlayBounceSound(bool onfloor, double volume);
|
||||
|
||||
// plays pushing sound
|
||||
void PlayPushSound();
|
||||
|
|
|
@ -3753,7 +3753,7 @@ bool P_BounceActor(AActor *mo, AActor *BlockingMobj, bool ontop)
|
|||
if (fabs(speed) < EQUAL_EPSILON) speed = 0;
|
||||
mo->Angles.Yaw = angle;
|
||||
mo->VelFromAngle(speed);
|
||||
mo->PlayBounceSound(true);
|
||||
mo->PlayBounceSound(true, 1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3781,7 +3781,7 @@ bool P_BounceActor(AActor *mo, AActor *BlockingMobj, bool ontop)
|
|||
mo->Vel *= mo->bouncefactor;
|
||||
}
|
||||
|
||||
mo->PlayBounceSound(true);
|
||||
mo->PlayBounceSound(true, 1.0);
|
||||
if (mo->BounceFlags & BOUNCE_MBF) // Bring it to rest below a certain speed
|
||||
{
|
||||
if (fabs(mo->Vel.Z) < mo->Mass * mo->GetGravity() / 64)
|
||||
|
|
|
@ -1708,7 +1708,7 @@ DEFINE_ACTION_FUNCTION(AActor, ExplodeMissile)
|
|||
}
|
||||
|
||||
|
||||
void AActor::PlayBounceSound(bool onfloor)
|
||||
void AActor::PlayBounceSound(bool onfloor, double volume)
|
||||
{
|
||||
if (!onfloor && (BounceFlags & BOUNCE_NoWallSound))
|
||||
{
|
||||
|
@ -1717,17 +1717,18 @@ void AActor::PlayBounceSound(bool onfloor)
|
|||
|
||||
if (!(BounceFlags & BOUNCE_Quiet))
|
||||
{
|
||||
volume = clamp(volume, 0.0, 1.0);
|
||||
if (BounceFlags & BOUNCE_UseSeeSound)
|
||||
{
|
||||
S_Sound (this, CHAN_VOICE, 0, SeeSound, 1, ATTN_IDLE);
|
||||
S_Sound (this, CHAN_VOICE, 0, SeeSound, (float)volume, ATTN_IDLE);
|
||||
}
|
||||
else if (onfloor || !WallBounceSound.isvalid())
|
||||
{
|
||||
S_Sound (this, CHAN_VOICE, 0, BounceSound, 1, ATTN_IDLE);
|
||||
S_Sound (this, CHAN_VOICE, 0, BounceSound, (float)volume, ATTN_IDLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
S_Sound (this, CHAN_VOICE, 0, WallBounceSound, 1, ATTN_IDLE);
|
||||
S_Sound (this, CHAN_VOICE, 0, WallBounceSound, (float)volume, ATTN_IDLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1841,7 +1842,7 @@ bool AActor::FloorBounceMissile (secplane_t &plane, bool is3DFloor)
|
|||
AngleFromVel();
|
||||
}
|
||||
|
||||
PlayBounceSound(true);
|
||||
PlayBounceSound(true, 1.0);
|
||||
|
||||
// Set bounce state
|
||||
if (BounceFlags & BOUNCE_UseBounceState)
|
||||
|
@ -2321,7 +2322,7 @@ static double P_XYMovement (AActor *mo, DVector2 scroll)
|
|||
// Struck a wall
|
||||
if (P_BounceWall (mo))
|
||||
{
|
||||
mo->PlayBounceSound(false);
|
||||
mo->PlayBounceSound(false, 1.0);
|
||||
return Oldfloorz;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1860,8 +1860,9 @@ DEFINE_ACTION_FUNCTION(AActor, PlayBounceSound)
|
|||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_BOOL(onFloor);
|
||||
PARAM_FLOAT(volume);
|
||||
|
||||
self->PlayBounceSound(onFloor);
|
||||
self->PlayBounceSound(onFloor, volume);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -871,7 +871,7 @@ class Actor : Thinker native
|
|||
native bool BounceActor(Actor blocking, bool onTop);
|
||||
native bool BounceWall(Line l = null);
|
||||
native bool BouncePlane(readonly<SecPlane> plane, bool is3DFloor = false);
|
||||
native void PlayBounceSound(bool onFloor);
|
||||
native void PlayBounceSound(bool onFloor, double volume = 1.0);
|
||||
native bool ReflectOffActor(Actor blocking);
|
||||
|
||||
clearscope double PitchTo(Actor target, double zOfs = 0, double targZOfs = 0, bool absolute = false) const
|
||||
|
|
Loading…
Reference in a new issue