diff options
author | Tim Angus <tim@ngus.net> | 2004-01-30 22:59:23 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2004-01-30 22:59:23 +0000 |
commit | 5051ea08659f37593a9b6c4fe331d7ce49b2c55b (patch) | |
tree | 05e349eda0588707cf605651bf0221de10805536 | |
parent | 98efc09fa64329bfaba46c446b089ec7424eed10 (diff) |
* Rethought custom footsteps a bit -- now includes clunk sounds
* Hydra can no longer grab someone with a battlesuit
-rw-r--r-- | src/cgame/cg_event.c | 8 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 1 | ||||
-rw-r--r-- | src/cgame/cg_players.c | 27 | ||||
-rw-r--r-- | src/game/g_weapon.c | 7 |
4 files changed, 30 insertions, 13 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index 6edcf942..e586777b 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -384,8 +384,12 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) DEBUGNAME( "EV_FOOTSTEP_METAL" ); if( cg_footsteps.integer && ci->footsteps != FOOTSTEP_NONE ) { - trap_S_StartSound( NULL, es->number, CHAN_BODY, - cgs.media.footsteps[ FOOTSTEP_METAL ][ rand( ) & 3 ] ); + if( ci->footsteps == FOOTSTEP_CUSTOM ) + trap_S_StartSound( NULL, es->number, CHAN_BODY, + ci->customMetalFootsteps[ rand( ) & 3 ] ); + else + trap_S_StartSound( NULL, es->number, CHAN_BODY, + cgs.media.footsteps[ FOOTSTEP_METAL ][ rand( ) & 3 ] ); } break; diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index b2d8aabe..c987dd56 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -670,6 +670,7 @@ typedef struct sfxHandle_t sounds[ MAX_CUSTOM_SOUNDS ]; sfxHandle_t customFootsteps[ 4 ]; + sfxHandle_t customMetalFootsteps[ 4 ]; } clientInfo_t; diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index 648b2d04..ce288e52 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -150,18 +150,7 @@ static qboolean CG_ParseAnimationFile( const char *filename, clientInfo_t *ci ) 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 ); @@ -572,6 +561,20 @@ static void CG_LoadClientInfo( clientInfo_t *ci ) ci->sounds[ i ] = trap_S_RegisterSound( va( "sound/player/%s/%s", fallback, s + 1 ), qfalse ); } + if( ci->footsteps == FOOTSTEP_CUSTOM ) + { + for( i = 0; i < 4; i++ ) + { + ci->customFootsteps[ i ] = trap_S_RegisterSound( va( "sound/player/%s/step%d.wav", dir, i + 1 ), qfalse ); + if( !ci->customFootsteps[ i ] ) + ci->customFootsteps[ i ] = trap_S_RegisterSound( va( "sound/player/footsteps/step%d.wav", i + 1 ), qfalse ); + + ci->customMetalFootsteps[ i ] = trap_S_RegisterSound( va( "sound/player/%s/clank%d.wav", dir, i + 1 ), qfalse ); + if( !ci->customMetalFootsteps[ i ] ) + ci->customMetalFootsteps[ i ] = trap_S_RegisterSound( va( "sound/player/footsteps/clank%d.wav", i + 1 ), qfalse ); + } + } + // reset any existing players and bodies, because they might be in bad // frames for this new model clientNum = ci - cgs.clientinfo; @@ -607,6 +610,8 @@ static void CG_CopyClientInfoModel( clientInfo_t *from, clientInfo_t *to ) memcpy( to->animations, from->animations, sizeof( to->animations ) ); memcpy( to->sounds, from->sounds, sizeof( to->sounds ) ); + memcpy( to->customFootsteps, from->customFootsteps, sizeof( to->customFootsteps ) ); + memcpy( to->customMetalFootsteps, from->customMetalFootsteps, sizeof( to->customMetalFootsteps ) ); } diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index e5130a43..cadaab49 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -725,12 +725,19 @@ void CheckGrabAttack( gentity_t *ent ) if( !traceEnt->takedamage ) return; + if( !traceEnt->client ) return; + if( traceEnt->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) return; + if( traceEnt->client->ps.stats[ STAT_HEALTH ] <= 0 ) return; + + //can't grab a player with the battlesuit + if( BG_gotItem( UP_BATTLESUIT, traceEnt->client->ps.stats ) ) + return; if( !( traceEnt->client->ps.stats[ STAT_STATE ] & SS_GRABBED ) ) { |