- virtualize player landing on thing sound

This commit is contained in:
Rachael Alexanderson 2022-02-13 23:15:18 -05:00 committed by Christoph Oelckers
parent 238952da35
commit add4ff12ac
4 changed files with 39 additions and 21 deletions

View File

@ -1499,6 +1499,8 @@ public:
bool isFrozen() const; bool isFrozen() const;
bool hasmodel; bool hasmodel;
void PlayerLandedMakeGruntSound(AActor* onmobj);
}; };
class FActorIterator class FActorIterator

View File

@ -2778,10 +2778,17 @@ DEFINE_ACTION_FUNCTION(AActor, CheckFakeFloorTriggers)
// //
//=========================================================================== //===========================================================================
void AActor::PlayerLandedMakeGruntSound(AActor *onmobj)
{
IFVIRTUAL(AActor, PlayerLandedMakeGruntSound)
{
VMValue params[2] = { (AActor*)this, (AActor*)onmobj };
VMCall(func, params, 2, nullptr, 0);
}
}
static void PlayerLandedOnThing (AActor *mo, AActor *onmobj) static void PlayerLandedOnThing (AActor *mo, AActor *onmobj)
{ {
bool grunted;
if (!mo->player) if (!mo->player)
return; return;
@ -2795,24 +2802,8 @@ static void PlayerLandedOnThing (AActor *mo, AActor *onmobj)
P_FallingDamage (mo); P_FallingDamage (mo);
// [RH] only make noise if alive mo->PlayerLandedMakeGruntSound(onmobj);
if (mo->health > 0 && !mo->player->morphTics)
{
grunted = false;
// Why should this number vary by gravity?
if (mo->Vel.Z < -mo->player->mo->FloatVar(NAME_GruntSpeed))
{
S_Sound (mo, CHAN_VOICE, 0, "*grunt", 1, ATTN_NORM);
grunted = true;
}
if (onmobj != NULL || !Terrains[P_GetThingFloorType (mo)].IsLiquid)
{
if (!grunted || !S_AreSoundsEquivalent (mo, "*grunt", "*land"))
{
S_Sound (mo, CHAN_AUTO, 0, "*land", 1, ATTN_NORM);
}
}
}
// mo->player->centering = true; // mo->player->centering = true;
} }

View File

@ -65,7 +65,7 @@ struct ExtraUniformCVARData
FString Shader; FString Shader;
FString Uniform; FString Uniform;
double* vec4 = nullptr; double* vec4 = nullptr;
ExtraUniformCVARData* Next; ExtraUniformCVARData* Next = nullptr;
}; };
static void do_uniform_set(float value, ExtraUniformCVARData* data) static void do_uniform_set(float value, ExtraUniformCVARData* data)

View File

@ -1286,6 +1286,31 @@ class Actor : Thinker native
} }
} }
virtual void PlayerLandedMakeGruntSound(actor onmobj)
{
bool grunted;
// [RH] only make noise if alive
if (self.health > 0 && !self.player.morphTics)
{
grunted = false;
// Why should this number vary by gravity?
if (self.Vel.Z < -self.player.mo.GruntSpeed)
{
A_StartSound("*grunt", CHAN_VOICE);
grunted = true;
}
bool isliquid = (pos.Z <= floorz) && HitFloor ();
if (onmobj != NULL || !isliquid)
{
if (!grunted)
{
A_StartSound("*land", CHAN_AUTO);
}
}
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// //
// PROC A_CheckSkullDone // PROC A_CheckSkullDone