From c0f8289414a964705454f9a1bc473ec5347a4450 Mon Sep 17 00:00:00 2001 From: Sabian Roberts <31491602+sabianroberts@users.noreply.github.com> Date: Wed, 20 Nov 2024 17:12:25 +0000 Subject: [PATCH] Implement wood & snow footsteps serverside --- SourceCode/dlls/client.cpp | 10 ++++++++++ SourceCode/dlls/sound.cpp | 7 +++++++ SourceCode/pm_shared/pm_shared.cpp | 13 +++++++++++++ 3 files changed, 30 insertions(+) diff --git a/SourceCode/dlls/client.cpp b/SourceCode/dlls/client.cpp index 79f8eeb1..05f19824 100644 --- a/SourceCode/dlls/client.cpp +++ b/SourceCode/dlls/client.cpp @@ -842,6 +842,16 @@ void ClientPrecache( void ) PRECACHE_SOUND("player/pl_wade3.wav"); PRECACHE_SOUND("player/pl_wade4.wav"); + PRECACHE_SOUND("player/pl_wood1.wav"); // walk on wood + PRECACHE_SOUND("player/pl_wood2.wav"); + PRECACHE_SOUND("player/pl_wood3.wav"); + PRECACHE_SOUND("player/pl_wood4.wav"); + + PRECACHE_SOUND("player/pl_snow1.wav"); // walk on snow + PRECACHE_SOUND("player/pl_snow2.wav"); + PRECACHE_SOUND("player/pl_snow3.wav"); + PRECACHE_SOUND("player/pl_snow4.wav"); + PRECACHE_SOUND("debris/wood1.wav"); // hit wood texture PRECACHE_SOUND("debris/wood2.wav"); PRECACHE_SOUND("debris/wood3.wav"); diff --git a/SourceCode/dlls/sound.cpp b/SourceCode/dlls/sound.cpp index 41af5a80..9b5d9e81 100644 --- a/SourceCode/dlls/sound.cpp +++ b/SourceCode/dlls/sound.cpp @@ -1733,6 +1733,13 @@ float TEXTURETYPE_PlaySound(TraceResult *ptr, Vector vecSrc, Vector vecEnd, int rgsz[2] = "debris/wood3.wav"; cnt = 3; break; + case CHAR_TEX_SNOW: fvol = 0.9; fvolbar = 0.2; + rgsz[0] = "player/pl_snow1.wav"; + rgsz[1] = "player/pl_snow2.wav"; + rgsz[2] = "player/pl_snow3.wav"; + rgsz[3] = "player/pl_snow4.wav"; + cnt = 3; + break; case CHAR_TEX_GLASS: case CHAR_TEX_COMPUTER: fvol = 0.8; fvolbar = 0.2; diff --git a/SourceCode/pm_shared/pm_shared.cpp b/SourceCode/pm_shared/pm_shared.cpp index de83fa42..94f56cd9 100644 --- a/SourceCode/pm_shared/pm_shared.cpp +++ b/SourceCode/pm_shared/pm_shared.cpp @@ -102,6 +102,7 @@ typedef struct hull_s #define CHAR_TEX_COMPUTER 'P' #define CHAR_TEX_GLASS 'Y' #define CHAR_TEX_FLESH 'F' +#define CHAR_TEX_SNOW 'N' #define STEP_CONCRETE 0 // default step sound #define STEP_METAL 1 // metal floor @@ -112,6 +113,8 @@ typedef struct hull_s #define STEP_SLOSH 6 // shallow liquid puddle #define STEP_WADE 7 // wading in liquid #define STEP_LADDER 8 // climbing ladder +#define STEP_WOOD 9 // wood +#define STEP_SNOW 10 // snow #define PLAYER_FATAL_FALL_SPEED 1024// approx 60 feet #define PLAYER_MAX_SAFE_FALL_SPEED 580// approx 20 feet @@ -452,6 +455,8 @@ int PM_MapTextureTypeStepType(char chTextureType) case CHAR_TEX_GRATE: return STEP_GRATE; case CHAR_TEX_TILE: return STEP_TILE; case CHAR_TEX_SLOSH: return STEP_SLOSH; + case CHAR_TEX_WOOD: return STEP_WOOD; + case CHAR_TEX_SNOW: return STEP_SNOW; } } @@ -619,6 +624,14 @@ void PM_UpdateStepSound( void ) fvol = fWalking ? 0.2 : 0.5; pmove->flTimeStepSound = fWalking ? 400 : 300; break; + case CHAR_TEX_WOOD: + fvol = fWalking ? 0.2 : 0.5; + pmove->flTimeStepSound = fWalking ? 400 : 300; + break; + case CHAR_TEX_SNOW: + fvol = fWalking ? 0.2 : 0.5; + pmove->flTimeStepSound = fWalking ? 400 : 300; + break; } }