Gave the knife some attention when it comes to sounds

This commit is contained in:
Marco Cawthorne 2017-01-08 16:12:02 +01:00
parent 98792c9d95
commit 1530866829
7 changed files with 22 additions and 18 deletions

View file

@ -125,7 +125,7 @@ float OpenCSGunBase_PrimaryFire( void );
float OpenCSGunBase_Reload( void );
void BaseMelee_Draw( void );
void BaseMelee_Attack( void );
int BaseMelee_Attack( void );
float Player_GetMaxSpeed( float fWeapon );

View file

@ -26,7 +26,7 @@ void BaseMelee_Draw( void ) {
Client_SendEvent( self, EV_WEAPON_DRAW );
}
void BaseMelee_Attack( void ) {
int BaseMelee_Attack( void ) {
vector vSource;
vector vOrigin;
@ -35,20 +35,20 @@ void BaseMelee_Attack( void ) {
traceline( vSource, vSource + ( v_forward * 64 ), MOVE_HITMODEL, self );
if ( trace_fraction == 1.0 )
return;
return FALSE;
vOrigin = trace_endpos - v_forward * 2;
if ( trace_ent.takedamage ) {
Damage_Apply( trace_ent, self, wptTable[ self.weapon ].iDamage, trace_endpos );
return;
} else {
if ( trace_ent.iBleeds == TRUE ) {
if ( trace_ent.iBleeds == TRUE ) {
Effect_Impact( IMPACT_FLESH, trace_endpos, trace_plane_normal );
} else {
Effect_Impact( IMPACT_MELEE, trace_endpos, trace_plane_normal );
}
Damage_Apply( trace_ent, self, wptTable[ self.weapon ].iDamage, trace_endpos );
} else {
Effect_Impact( IMPACT_MELEE, trace_endpos, trace_plane_normal );
}
return TRUE;
}
void BaseMelee_Delayed( float fDelay ) {

View file

@ -94,6 +94,9 @@ void Effect_Impact( int iType, vector vPos, vector vNormal ) {
case IMPACT_METAL:
pointsound( vPos, sprintf( "weapons/ric_metal-%d.wav", floor( ( random() * 2 ) + 1 ) ), 1, ATTN_STATIC );
break;
case IMPACT_FLESH:
pointsound( vPos, sprintf( "weapons/knife_hit%d.wav", floor( ( random() * 4 ) + 1 ) ), 1, ATTN_STATIC );
break;
default:
pointsound( vPos, sprintf( "weapons/ric%d.wav", floor( ( random() * 5 ) + 1 ) ), 1, ATTN_STATIC );
break;

View file

@ -66,8 +66,17 @@ void WeaponKNIFE_Draw( void ) {
void WeaponKNIFE_PrimaryFire( void ) {
#ifdef SSQC
BaseMelee_Attack();
Client_SendEvent( self, EV_WEAPON_PRIMARYATTACK );
if ( BaseMelee_Attack() == FALSE ) {
if ( random() <= 0.5 ) {
sound( self, CHAN_WEAPON, "weapons/knife_slash1.wav", 1, ATTN_IDLE );
} else {
sound( self, CHAN_WEAPON, "weapons/knife_slash2.wav", 1, ATTN_IDLE );
}
}
self.fAttackFinished = time + wptKNIFE.fAttackFinished;
#else
if ( random() <= 0.5 ) {

Binary file not shown.

View file

@ -1,8 +0,0 @@
sv_maxspeed 240
seta mp_startmoney "800"
seta mp_buytime 90
seta mp_freezetime 6
seta mp_c4timer 45
seta mp_roundtime 5
hostname "OpenCS Server"

Binary file not shown.