mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
Export PlayDiveOrSurfaceSounds to ZScript and made it virtual for mods to customize the diving and surfacing sounds
This commit is contained in:
parent
95b264bdb6
commit
8043370ef1
3 changed files with 39 additions and 16 deletions
|
@ -1411,6 +1411,7 @@ public:
|
||||||
bool IsMapActor();
|
bool IsMapActor();
|
||||||
bool SetState (FState *newstate, bool nofunction=false);
|
bool SetState (FState *newstate, bool nofunction=false);
|
||||||
void SplashCheck();
|
void SplashCheck();
|
||||||
|
void PlayDiveOrSurfaceSounds(int oldlevel = 0);
|
||||||
bool UpdateWaterLevel (bool splash=true);
|
bool UpdateWaterLevel (bool splash=true);
|
||||||
bool isFast();
|
bool isFast();
|
||||||
bool isSlow();
|
bool isSlow();
|
||||||
|
|
|
@ -2937,7 +2937,7 @@ void AActor::CallFallAndSink(double grav, double oldfloorz)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FallAndSink(grav, oldfloorz);
|
FallAndSink(grav, oldfloorz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4614,6 +4614,23 @@ void AActor::SplashCheck()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// AActor::PlayDiveOrSurfaceSounds
|
||||||
|
//
|
||||||
|
// Plays diving or surfacing sounds for the player
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void AActor::PlayDiveOrSurfaceSounds(int oldlevel)
|
||||||
|
{
|
||||||
|
IFVIRTUAL(AActor, PlayDiveOrSurfaceSounds)
|
||||||
|
{
|
||||||
|
VMValue params[2] = { (DObject *)this, oldlevel };
|
||||||
|
VMCall(func, params, 2, nullptr, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// AActor::UpdateWaterLevel
|
// AActor::UpdateWaterLevel
|
||||||
|
@ -4637,21 +4654,7 @@ bool AActor::UpdateWaterLevel(bool dosplash)
|
||||||
|
|
||||||
if (player != nullptr)
|
if (player != nullptr)
|
||||||
{
|
{
|
||||||
if (oldlevel < 3 && waterlevel == 3)
|
PlayDiveOrSurfaceSounds(oldlevel);
|
||||||
{
|
|
||||||
// Our head just went under.
|
|
||||||
S_Sound(this, CHAN_VOICE, 0, "*dive", 1, ATTN_NORM);
|
|
||||||
}
|
|
||||||
else if (oldlevel == 3 && waterlevel < 3)
|
|
||||||
{
|
|
||||||
// Our head just came up.
|
|
||||||
if (player->air_finished > Level->maptime)
|
|
||||||
{
|
|
||||||
// We hadn't run out of air yet.
|
|
||||||
S_Sound(this, CHAN_VOICE, 0, "*surface", 1, ATTN_NORM);
|
|
||||||
}
|
|
||||||
// If we were running out of air, then ResetAirSupply() will play *gasp.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false; // we did the splash ourselves
|
return false; // we did the splash ourselves
|
||||||
|
|
|
@ -1450,6 +1450,25 @@ class Actor : Thinker native
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void PlayDiveOrSurfaceSounds(int oldlevel)
|
||||||
|
{
|
||||||
|
if (oldlevel < 3 && WaterLevel == 3)
|
||||||
|
{
|
||||||
|
// Our head just went under.
|
||||||
|
A_StartSound("*dive", CHAN_VOICE, attenuation: ATTN_NORM);
|
||||||
|
}
|
||||||
|
else if (oldlevel == 3 && WaterLevel < 3)
|
||||||
|
{
|
||||||
|
// Our head just came up.
|
||||||
|
if (player.air_finished > Level.maptime)
|
||||||
|
{
|
||||||
|
// We hadn't run out of air yet.
|
||||||
|
A_StartSound("*surface", CHAN_VOICE, attenuation: ATTN_NORM);
|
||||||
|
}
|
||||||
|
// If we were running out of air, then ResetAirSupply() will play *gasp.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// PROC A_CheckSkullDone
|
// PROC A_CheckSkullDone
|
||||||
|
|
Loading…
Reference in a new issue