diff options
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_event.c | 20 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 4 | ||||
-rw-r--r-- | src/cgame/cg_players.c | 15 | ||||
-rw-r--r-- | src/cgame/cg_view.c | 2 |
4 files changed, 32 insertions, 9 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index 4833346d..0df4ea5c 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -369,16 +369,20 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) // case EV_FOOTSTEP: DEBUGNAME( "EV_FOOTSTEP" ); - if( cg_footsteps.integer ) + if( cg_footsteps.integer && ci->footsteps != FOOTSTEP_NONE ) { - trap_S_StartSound( NULL, es->number, CHAN_BODY, - cgs.media.footsteps[ ci->footsteps ][ rand( ) & 3 ] ); + if( ci->footsteps == FOOTSTEP_CUSTOM ) + trap_S_StartSound( NULL, es->number, CHAN_BODY, + ci->customFootsteps[ rand( ) & 3 ] ); + else + trap_S_StartSound( NULL, es->number, CHAN_BODY, + cgs.media.footsteps[ ci->footsteps ][ rand( ) & 3 ] ); } break; case EV_FOOTSTEP_METAL: DEBUGNAME( "EV_FOOTSTEP_METAL" ); - if( cg_footsteps.integer ) + if( cg_footsteps.integer && ci->footsteps != FOOTSTEP_NONE ) { trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.footsteps[ FOOTSTEP_METAL ][ rand( ) & 3 ] ); @@ -387,7 +391,7 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) case EV_FOOTSTEP_SQUELCH: DEBUGNAME( "EV_FOOTSTEP_SQUELCH" ); - if( cg_footsteps.integer ) + if( cg_footsteps.integer && ci->footsteps != FOOTSTEP_NONE ) { trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.footsteps[ FOOTSTEP_FLESH ][ rand( ) & 3 ] ); @@ -396,7 +400,7 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) case EV_FOOTSPLASH: DEBUGNAME( "EV_FOOTSPLASH" ); - if( cg_footsteps.integer ) + if( cg_footsteps.integer && ci->footsteps != FOOTSTEP_NONE ) { trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.footsteps[ FOOTSTEP_SPLASH ][ rand( ) & 3 ] ); @@ -405,7 +409,7 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) case EV_FOOTWADE: DEBUGNAME( "EV_FOOTWADE" ); - if( cg_footsteps.integer ) + if( cg_footsteps.integer && ci->footsteps != FOOTSTEP_NONE ) { trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.footsteps[ FOOTSTEP_SPLASH ][ rand( ) & 3 ] ); @@ -414,7 +418,7 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) case EV_SWIM: DEBUGNAME( "EV_SWIM" ); - if( cg_footsteps.integer ) + if( cg_footsteps.integer && ci->footsteps != FOOTSTEP_NONE ) { trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.footsteps[ FOOTSTEP_SPLASH ][ rand( ) & 3 ] ); diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 2dd28bf2..8a660c4a 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -103,6 +103,8 @@ typedef enum FOOTSTEP_ENERGY, FOOTSTEP_METAL, FOOTSTEP_SPLASH, + FOOTSTEP_CUSTOM, + FOOTSTEP_NONE, FOOTSTEP_TOTAL } footstep_t; @@ -650,6 +652,8 @@ typedef struct animation_t animations[ MAX_PLAYER_TOTALANIMATIONS ]; sfxHandle_t sounds[ MAX_CUSTOM_SOUNDS ]; + + sfxHandle_t customFootsteps[ 4 ]; } clientInfo_t; diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index 5357b589..037a71a2 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -147,6 +147,21 @@ static qboolean CG_ParseAnimationFile( const char *filename, clientInfo_t *ci ) ci->footsteps = FOOTSTEP_MECH; else if( !Q_stricmp( token, "energy" ) ) ci->footsteps = FOOTSTEP_ENERGY; + else if( !Q_stricmp( token, "none" ) ) + ci->footsteps = FOOTSTEP_NONE; + else if( !Q_stricmp( token, "custom" ) ) + { + ci->footsteps = FOOTSTEP_CUSTOM; + + for( i = 0; i < 4; i++ ) + { + token = COM_Parse( &text_p ); + if( !token ) + break; + + ci->customFootsteps[ i ] = trap_S_RegisterSound( token, qfalse ); + } + } else CG_Printf( "Bad footsteps parm in %s: %s\n", filename, token ); diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index 70e4f900..863dc776 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -623,7 +623,7 @@ static void CG_OffsetFirstPersonView( void ) } // add bob height - bob = cg.bobfracsin * cg.xyspeed * cg_bobup.value; + bob = cg.bobfracsin * cg.xyspeed * bob2; if( bob > 6 ) bob = 6; |