Skip to content

Commit

Permalink
Implement wood & snow footsteps serverside
Browse files Browse the repository at this point in the history
  • Loading branch information
sabianroberts committed Nov 20, 2024
1 parent 708799c commit c0f8289
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions SourceCode/dlls/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
7 changes: 7 additions & 0 deletions SourceCode/dlls/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
13 changes: 13 additions & 0 deletions SourceCode/pm_shared/pm_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit c0f8289

Please sign in to comment.