From 100391507e7e2b4a6c9b66877062ae873110655e Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 14 Aug 2012 03:24:59 +0000 Subject: [PATCH] - Added two new PlayerPawn properties: * GruntSpeed: The minimum speed a player must be falling at the time of landing to play *grunt. * FallingScreamSpeed: When a player is falling within this range of speeds, they will play *falling. SVN r3829 (trunk) --- src/d_player.h | 2 ++ src/p_mobj.cpp | 2 +- src/p_user.cpp | 14 ++++++++++++-- src/thingdef/thingdef_properties.cpp | 20 ++++++++++++++++++++ wadsrc/static/actors/shared/player.txt | 2 ++ 5 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index d8fb75eae..e5307fd28 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -130,6 +130,8 @@ public: // [GRB] Player class properties fixed_t JumpZ; + fixed_t GruntSpeed; + fixed_t FallingScreamMinSpeed, FallingScreamMaxSpeed; fixed_t ViewHeight; fixed_t ForwardMove1, ForwardMove2; fixed_t SideMove1, SideMove2; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index f26f0978a..f0788bb31 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -2476,7 +2476,7 @@ static void PlayerLandedOnThing (AActor *mo, AActor *onmobj) { grunted = false; // Why should this number vary by gravity? - if (mo->velz < (fixed_t)(800.f /*level.gravity * mo->Sector->gravity*/ * -983.04f) && mo->health > 0) + if (mo->health > 0 && mo->velz < -mo->player->mo->GruntSpeed) { S_Sound (mo, CHAN_VOICE, "*grunt", 1, ATTN_NORM); grunted = true; diff --git a/src/p_user.cpp b/src/p_user.cpp index 6b853e8b8..f3cab9236 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -463,6 +463,16 @@ void APlayerPawn::Serialize (FArchive &arc) << DamageFade << PlayerFlags << FlechetteType; + if (SaveVersion < 3829) + { + GruntSpeed = 12*FRACUNIT; + FallingScreamMinSpeed = 35*FRACUNIT; + FallingScreamMaxSpeed = 40*FRACUNIT; + } + else + { + arc << GruntSpeed << FallingScreamMinSpeed << FallingScreamMaxSpeed; + } } //=========================================================================== @@ -2383,8 +2393,8 @@ void P_PlayerThink (player_t *player) P_PlayerInSpecialSector (player); } P_PlayerOnSpecialFlat (player, P_GetThingFloorType (player->mo)); - if (player->mo->velz <= -35*FRACUNIT && - player->mo->velz >= -40*FRACUNIT && !player->morphTics && + if (player->mo->velz <= -player->mo->FallingScreamMinSpeed && + player->mo->velz >= -player->mo->FallingScreamMaxSpeed && !player->morphTics && player->mo->waterlevel == 0) { int id = S_FindSkinnedSound (player->mo, "*falling"); diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index eb11972f1..f5dc0d91f 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -2237,6 +2237,26 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, jumpz, F, PlayerPawn) defaults->JumpZ = z; } +//========================================================================== +// +//========================================================================== +DEFINE_CLASS_PROPERTY_PREFIX(player, GruntSpeed, F, PlayerPawn) +{ + PROP_FIXED_PARM(z, 0); + defaults->GruntSpeed = z; +} + +//========================================================================== +// +//========================================================================== +DEFINE_CLASS_PROPERTY_PREFIX(player, FallingScreamSpeed, FF, PlayerPawn) +{ + PROP_FIXED_PARM(minz, 0); + PROP_FIXED_PARM(maxz, 0); + defaults->FallingScreamMinSpeed = minz; + defaults->FallingScreamMaxSpeed = maxz; +} + //========================================================================== // //========================================================================== diff --git a/wadsrc/static/actors/shared/player.txt b/wadsrc/static/actors/shared/player.txt index 3edb7aa40..05fb998c3 100644 --- a/wadsrc/static/actors/shared/player.txt +++ b/wadsrc/static/actors/shared/player.txt @@ -21,6 +21,8 @@ Actor PlayerPawn : Actor native +NOBLOCKMONST Player.AttackZOffset 8 Player.JumpZ 8 + Player.GruntSpeed 12 + Player.FallingScreamSpeed 35,40 Player.ViewHeight 41 Player.ForwardMove 1,1 Player.SideMove 1,1