mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 05:51:20 +00:00
- virtualize player landing on thing sound
This commit is contained in:
parent
238952da35
commit
add4ff12ac
4 changed files with 39 additions and 21 deletions
|
@ -1499,6 +1499,8 @@ public:
|
|||
bool isFrozen() const;
|
||||
|
||||
bool hasmodel;
|
||||
|
||||
void PlayerLandedMakeGruntSound(AActor* onmobj);
|
||||
};
|
||||
|
||||
class FActorIterator
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
bool grunted;
|
||||
|
||||
if (!mo->player)
|
||||
return;
|
||||
|
||||
|
@ -2795,24 +2802,8 @@ static void PlayerLandedOnThing (AActor *mo, AActor *onmobj)
|
|||
|
||||
P_FallingDamage (mo);
|
||||
|
||||
// [RH] only make noise if alive
|
||||
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->PlayerLandedMakeGruntSound(onmobj);
|
||||
|
||||
// mo->player->centering = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ struct ExtraUniformCVARData
|
|||
FString Shader;
|
||||
FString Uniform;
|
||||
double* vec4 = nullptr;
|
||||
ExtraUniformCVARData* Next;
|
||||
ExtraUniformCVARData* Next = nullptr;
|
||||
};
|
||||
|
||||
static void do_uniform_set(float value, ExtraUniformCVARData* data)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue