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
|
|
@ -2937,7 +2937,7 @@ void AActor::CallFallAndSink(double grav, double oldfloorz)
|
|||
}
|
||||
else
|
||||
{
|
||||
FallAndSink(grav, oldfloorz);
|
||||
FallAndSink(grav, oldfloorz);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4614,6 +4614,23 @@ void AActor::SplashCheck()
|
|||
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
|
||||
|
|
@ -4637,21 +4654,7 @@ bool AActor::UpdateWaterLevel(bool dosplash)
|
|||
|
||||
if (player != nullptr)
|
||||
{
|
||||
if (oldlevel < 3 && waterlevel == 3)
|
||||
{
|
||||
// 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.
|
||||
}
|
||||
PlayDiveOrSurfaceSounds(oldlevel);
|
||||
}
|
||||
|
||||
return false; // we did the splash ourselves
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue