Browse Source

Fix weapons. Remove useless events.

eftd
Night Owl 7 years ago
parent
commit
054fd34cd6
  1. 746
      cl_dll/ev_hldm.cpp
  2. 16
      cl_dll/hl/hl_events.cpp
  3. 16
      cl_dll/hl/hl_objects.cpp
  4. 6
      cl_dll/hud_msg.cpp
  5. 2
      dlls/crossbow.cpp
  6. 20
      dlls/eftd/ak47.cpp
  7. 24
      dlls/eftd/mac10.cpp
  8. 16
      dlls/glock.cpp
  9. 15
      dlls/mp5.cpp
  10. 18
      dlls/shotgun.cpp
  11. 31
      dlls/weapons.h

746
cl_dll/ev_hldm.cpp

@ -51,21 +51,13 @@ extern "C" @@ -51,21 +51,13 @@ extern "C"
{
// HLDM
void EV_FireGlock1( struct event_args_s *args );
void EV_FireGlock2( struct event_args_s *args );
void EV_FireShotGunSingle( struct event_args_s *args );
void EV_FireShotGunDouble( struct event_args_s *args );
void EV_FireMP5( struct event_args_s *args );
void EV_FireMP52( struct event_args_s *args );
void EV_FirePython( struct event_args_s *args );
void EV_FireGauss( struct event_args_s *args );
void EV_SpinGauss( struct event_args_s *args );
void EV_Crowbar( struct event_args_s *args );
void EV_FireCrossbow( struct event_args_s *args );
void EV_FireCrossbow2( struct event_args_s *args );
void EV_FireRpg( struct event_args_s *args );
void EV_EgonFire( struct event_args_s *args );
void EV_EgonStop( struct event_args_s *args );
void EV_HornetGunFire( struct event_args_s *args );
void EV_TripmineFire( struct event_args_s *args );
void EV_SnarkFire( struct event_args_s *args );
@ -540,7 +532,8 @@ void EV_FireGlock1( event_args_t *args ) @@ -540,7 +532,8 @@ void EV_FireGlock1( event_args_t *args )
EV_MuzzleFlash();
gEngfuncs.pEventAPI->EV_WeaponAnimation( empty ? GLOCK_SHOOT_EMPTY : GLOCK_SHOOT, 2 );
V_PunchAxis( 0, -2.0 );
V_PunchAxis( 0, -2.6 );
V_PunchAxis( 1, gEngfuncs.pfnRandomFloat( -0.7, 0.7 ) );
}
EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20, -12, 4 );
@ -555,52 +548,6 @@ void EV_FireGlock1( event_args_t *args ) @@ -555,52 +548,6 @@ void EV_FireGlock1( event_args_t *args )
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_9MM, 0, 0, args->fparam1, args->fparam2 );
}
void EV_FireGlock2( event_args_t *args )
{
int idx;
vec3_t origin;
vec3_t angles;
vec3_t velocity;
vec3_t ShellVelocity;
vec3_t ShellOrigin;
int shell;
vec3_t vecSrc, vecAiming;
vec3_t vecSpread;
vec3_t up, right, forward;
idx = args->entindex;
VectorCopy( args->origin, origin );
VectorCopy( args->angles, angles );
VectorCopy( args->velocity, velocity );
int empty = args->bparam1;
AngleVectors( angles, forward, right, up );
shell = gEngfuncs.pEventAPI->EV_FindModelIndex( "models/shell.mdl" );// brass shell
if( EV_IsLocal( idx ) )
{
// Add muzzle flash to current weapon model
EV_MuzzleFlash();
gEngfuncs.pEventAPI->EV_WeaponAnimation( empty ? GLOCK_SHOOT_EMPTY : GLOCK_SHOOT, 2 );
V_PunchAxis( 0, -2.0 );
}
EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20, -12, 4 );
EV_EjectBrass ( ShellOrigin, ShellVelocity, angles[YAW], shell, TE_BOUNCE_SHELL );
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/pl_gun3.wav", gEngfuncs.pfnRandomFloat( 0.92, 1.0 ), ATTN_NORM, 0, 98 + gEngfuncs.pfnRandomLong( 0, 3 ) );
EV_GetGunPosition( args, vecSrc, origin );
VectorCopy( forward, vecAiming );
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_9MM, 0, &g_tracerCount[idx - 1], args->fparam1, args->fparam2 );
}
//======================
// GLOCK END
//======================
@ -608,61 +555,6 @@ void EV_FireGlock2( event_args_t *args ) @@ -608,61 +555,6 @@ void EV_FireGlock2( event_args_t *args )
//======================
// SHOTGUN START
//======================
void EV_FireShotGunDouble( event_args_t *args )
{
int idx;
vec3_t origin;
vec3_t angles;
vec3_t velocity;
int j;
vec3_t ShellVelocity;
vec3_t ShellOrigin;
int shell;
vec3_t vecSrc, vecAiming;
vec3_t vecSpread;
vec3_t up, right, forward;
//float flSpread = 0.01;
idx = args->entindex;
VectorCopy( args->origin, origin );
VectorCopy( args->angles, angles );
VectorCopy( args->velocity, velocity );
AngleVectors( angles, forward, right, up );
shell = gEngfuncs.pEventAPI->EV_FindModelIndex("models/shotgunshell.mdl");// brass shell
if( EV_IsLocal( idx ) )
{
// Add muzzle flash to current weapon model
EV_MuzzleFlash();
gEngfuncs.pEventAPI->EV_WeaponAnimation( SHOTGUN_FIRE2, 2 );
V_PunchAxis( 0, -10.0 );
}
for( j = 0; j < 2; j++ )
{
EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 32, -12, 6 );
EV_EjectBrass( ShellOrigin, ShellVelocity, angles[ YAW ], shell, TE_BOUNCE_SHOTSHELL );
}
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/dbarrel1.wav", gEngfuncs.pfnRandomFloat( 0.98, 1.0 ), ATTN_NORM, 0, 85 + gEngfuncs.pfnRandomLong( 0, 0x1f ) );
EV_GetGunPosition( args, vecSrc, origin );
VectorCopy( forward, vecAiming );
if( gEngfuncs.GetMaxClients() > 1 )
{
EV_HLDM_FireBullets( idx, forward, right, up, 8, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &g_tracerCount[idx - 1], 0.17365, 0.04362 );
}
else
{
EV_HLDM_FireBullets( idx, forward, right, up, 12, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &g_tracerCount[idx - 1], 0.08716, 0.08716 );
}
}
void EV_FireShotGunSingle( event_args_t *args )
{
int idx;
@ -693,26 +585,20 @@ void EV_FireShotGunSingle( event_args_t *args ) @@ -693,26 +585,20 @@ void EV_FireShotGunSingle( event_args_t *args )
EV_MuzzleFlash();
gEngfuncs.pEventAPI->EV_WeaponAnimation( SHOTGUN_FIRE, 2 );
V_PunchAxis( 0, -5.0 );
V_PunchAxis( 0, -6.0 );
V_PunchAxis( 1, gEngfuncs.pfnRandomFloat( -2, 2 ) );
}
EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 32, -12, 6 );
EV_EjectBrass ( ShellOrigin, ShellVelocity, angles[YAW], shell, TE_BOUNCE_SHOTSHELL );
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/sbarrel1.wav", gEngfuncs.pfnRandomFloat( 0.95, 1.0 ), ATTN_NORM, 0, 93 + gEngfuncs.pfnRandomLong( 0, 0x1f ) );
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/sbarrel1.wav", gEngfuncs.pfnRandomFloat( 0.95, 1.0 ), ATTN_NORM, 0, 85 + gEngfuncs.pfnRandomLong( 0, 31 ) );
EV_GetGunPosition( args, vecSrc, origin );
VectorCopy( forward, vecAiming );
if( gEngfuncs.GetMaxClients() > 1 )
{
EV_HLDM_FireBullets( idx, forward, right, up, 4, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &g_tracerCount[idx - 1], 0.08716, 0.04362 );
}
else
{
EV_HLDM_FireBullets( idx, forward, right, up, 6, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &g_tracerCount[idx - 1], 0.08716, 0.08716 );
}
EV_HLDM_FireBullets( idx, forward, right, up, 16, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &g_tracerCount[idx - 1], 0.08716, 0.04362 );
}
//======================
// SHOTGUN END
@ -750,7 +636,8 @@ void EV_FireMP5( event_args_t *args ) @@ -750,7 +636,8 @@ void EV_FireMP5( event_args_t *args )
EV_MuzzleFlash();
gEngfuncs.pEventAPI->EV_WeaponAnimation( MP5_FIRE1 + gEngfuncs.pfnRandomLong( 0, 2 ), 2 );
V_PunchAxis( 0, gEngfuncs.pfnRandomFloat( -2, 2 ) );
V_PunchAxis( 0, gEngfuncs.pfnRandomFloat( -1.7, -2.3 ) );
V_PunchAxis( 1, gEngfuncs.pfnRandomFloat( -1, 1 ) );
}
EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20, -12, 4 );
@ -770,14 +657,7 @@ void EV_FireMP5( event_args_t *args ) @@ -770,14 +657,7 @@ void EV_FireMP5( event_args_t *args )
EV_GetGunPosition( args, vecSrc, origin );
VectorCopy( forward, vecAiming );
if( gEngfuncs.GetMaxClients() > 1 )
{
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_MP5, 2, &g_tracerCount[idx - 1], args->fparam1, args->fparam2 );
}
else
{
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_MP5, 2, &g_tracerCount[idx - 1], args->fparam1, args->fparam2 );
}
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_MP5, 0, &g_tracerCount[idx - 1], args->fparam1, args->fparam2 );
}
// We only predict the animation and sound
@ -793,7 +673,7 @@ void EV_FireMP52( event_args_t *args ) @@ -793,7 +673,7 @@ void EV_FireMP52( event_args_t *args )
if( EV_IsLocal( idx ) )
{
gEngfuncs.pEventAPI->EV_WeaponAnimation( MP5_LAUNCH, 2 );
V_PunchAxis( 0, -10 );
V_PunchAxis( 0, -8 );
}
switch( gEngfuncs.pfnRandomLong( 0, 1 ) )
@ -810,374 +690,6 @@ void EV_FireMP52( event_args_t *args ) @@ -810,374 +690,6 @@ void EV_FireMP52( event_args_t *args )
// MP5 END
//======================
//======================
// PHYTON START
// ( .357 )
//======================
void EV_FirePython( event_args_t *args )
{
int idx;
vec3_t origin;
vec3_t angles;
vec3_t velocity;
vec3_t vecSrc, vecAiming;
vec3_t up, right, forward;
//float flSpread = 0.01;
idx = args->entindex;
VectorCopy( args->origin, origin );
VectorCopy( args->angles, angles );
VectorCopy( args->velocity, velocity );
AngleVectors( angles, forward, right, up );
if( EV_IsLocal( idx ) )
{
// Python uses different body in multiplayer versus single player
int multiplayer = gEngfuncs.GetMaxClients() == 1 ? 0 : 1;
// Add muzzle flash to current weapon model
EV_MuzzleFlash();
gEngfuncs.pEventAPI->EV_WeaponAnimation( PYTHON_FIRE1, multiplayer ? 1 : 0 );
V_PunchAxis( 0, -10.0 );
}
switch( gEngfuncs.pfnRandomLong( 0, 1 ) )
{
case 0:
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/357_shot1.wav", gEngfuncs.pfnRandomFloat( 0.8, 0.9 ), ATTN_NORM, 0, PITCH_NORM );
break;
case 1:
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/357_shot2.wav", gEngfuncs.pfnRandomFloat( 0.8, 0.9 ), ATTN_NORM, 0, PITCH_NORM );
break;
}
EV_GetGunPosition( args, vecSrc, origin );
VectorCopy( forward, vecAiming );
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_357, 0, 0, args->fparam1, args->fparam2 );
}
//======================
// PHYTON END
// ( .357 )
//======================
//======================
// GAUSS START
//======================
#define SND_CHANGE_PITCH (1 << 7) // duplicated in protocol.h change sound pitch
void EV_SpinGauss( event_args_t *args )
{
int idx;
vec3_t origin;
vec3_t angles;
vec3_t velocity;
int iSoundState = 0;
int pitch;
idx = args->entindex;
VectorCopy( args->origin, origin );
VectorCopy( args->angles, angles );
VectorCopy( args->velocity, velocity );
pitch = args->iparam1;
iSoundState = args->bparam1 ? SND_CHANGE_PITCH : 0;
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "ambience/pulsemachine.wav", 1.0, ATTN_NORM, iSoundState, pitch );
}
/*
==============================
EV_StopPreviousGauss
==============================
*/
void EV_StopPreviousGauss( int idx )
{
// Make sure we don't have a gauss spin event in the queue for this guy
gEngfuncs.pEventAPI->EV_KillEvents( idx, "events/gaussspin.sc" );
gEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_WEAPON, "ambience/pulsemachine.wav" );
}
extern float g_flApplyVel;
void EV_FireGauss( event_args_t *args )
{
int idx;
vec3_t origin;
vec3_t angles;
vec3_t velocity;
float flDamage = args->fparam1;
//int primaryfire = args->bparam1;
int m_fPrimaryFire = args->bparam1;
//int m_iWeaponVolume = GAUSS_PRIMARY_FIRE_VOLUME;
vec3_t vecSrc;
vec3_t vecDest;
//edict_t *pentIgnore;
pmtrace_t tr, beam_tr;
float flMaxFrac = 1.0;
//int nTotal = 0;
int fHasPunched = 0;
int fFirstBeam = 1;
int nMaxHits = 10;
physent_t *pEntity;
int m_iBeam, m_iGlow, m_iBalls;
vec3_t up, right, forward;
idx = args->entindex;
VectorCopy( args->origin, origin );
VectorCopy( args->angles, angles );
VectorCopy( args->velocity, velocity );
if( args->bparam2 )
{
EV_StopPreviousGauss( idx );
return;
}
//Con_Printf( "Firing gauss with %f\n", flDamage );
EV_GetGunPosition( args, vecSrc, origin );
m_iBeam = gEngfuncs.pEventAPI->EV_FindModelIndex( "sprites/smoke.spr" );
m_iBalls = m_iGlow = gEngfuncs.pEventAPI->EV_FindModelIndex( "sprites/hotglow.spr" );
AngleVectors( angles, forward, right, up );
VectorMA( vecSrc, 8192, forward, vecDest );
if( EV_IsLocal( idx ) )
{
V_PunchAxis( 0, -2.0 );
gEngfuncs.pEventAPI->EV_WeaponAnimation( GAUSS_FIRE2, 2 );
if( m_fPrimaryFire == false )
g_flApplyVel = flDamage;
}
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/gauss2.wav", 0.5 + flDamage * ( 1.0 / 400.0 ), ATTN_NORM, 0, 85 + gEngfuncs.pfnRandomLong( 0, 0x1f ) );
while( flDamage > 10 && nMaxHits > 0 )
{
nMaxHits--;
gEngfuncs.pEventAPI->EV_SetUpPlayerPrediction( false, true );
// Store off the old count
gEngfuncs.pEventAPI->EV_PushPMStates();
// Now add in all of the players.
gEngfuncs.pEventAPI->EV_SetSolidPlayers( idx - 1 );
gEngfuncs.pEventAPI->EV_SetTraceHull( 2 );
gEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecDest, PM_STUDIO_BOX, -1, &tr );
gEngfuncs.pEventAPI->EV_PopPMStates();
if( tr.allsolid )
break;
if( fFirstBeam )
{
if( EV_IsLocal( idx ) )
{
// Add muzzle flash to current weapon model
EV_MuzzleFlash();
}
fFirstBeam = 0;
gEngfuncs.pEfxAPI->R_BeamEntPoint(
idx | 0x1000,
tr.endpos,
m_iBeam,
0.1,
m_fPrimaryFire ? 1.0 : 2.5,
0.0,
m_fPrimaryFire ? 128.0 : flDamage,
0,
0,
0,
m_fPrimaryFire ? 255 : 255,
m_fPrimaryFire ? 128 : 255,
m_fPrimaryFire ? 0 : 255
);
}
else
{
gEngfuncs.pEfxAPI->R_BeamPoints( vecSrc,
tr.endpos,
m_iBeam,
0.1,
m_fPrimaryFire ? 1.0 : 2.5,
0.0,
m_fPrimaryFire ? 128.0 : flDamage,
0,
0,
0,
m_fPrimaryFire ? 255 : 255,
m_fPrimaryFire ? 128 : 255,
m_fPrimaryFire ? 0 : 255
);
}
pEntity = gEngfuncs.pEventAPI->EV_GetPhysent( tr.ent );
if( pEntity == NULL )
break;
if( pEntity->solid == SOLID_BSP )
{
float n;
//pentIgnore = NULL;
n = -DotProduct( tr.plane.normal, forward );
if( n < 0.5 ) // 60 degrees
{
// ALERT( at_console, "reflect %f\n", n );
// reflect
vec3_t r;
VectorMA( forward, 2.0 * n, tr.plane.normal, r );
flMaxFrac = flMaxFrac - tr.fraction;
VectorCopy( r, forward );
VectorMA( tr.endpos, 8.0, forward, vecSrc );
VectorMA( vecSrc, 8192.0, forward, vecDest );
gEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 0.2, m_iGlow, kRenderGlow, kRenderFxNoDissipation, flDamage * n / 255.0, flDamage * n * 0.5 * 0.1, FTENT_FADEOUT );
vec3_t fwd;
VectorAdd( tr.endpos, tr.plane.normal, fwd );
gEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, tr.endpos, fwd, m_iBalls, 3, 0.1, gEngfuncs.pfnRandomFloat( 10, 20 ) / 100.0, 100,
255, 100 );
// lose energy
if( n == 0 )
{
n = 0.1;
}
flDamage = flDamage * ( 1 - n );
}
else
{
// tunnel
EV_HLDM_DecalGunshot( &tr, BULLET_MONSTER_12MM );
gEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 1.0, m_iGlow, kRenderGlow, kRenderFxNoDissipation, flDamage / 255.0, 6.0, FTENT_FADEOUT );
// limit it to one hole punch
if( fHasPunched )
{
break;
}
fHasPunched = 1;
// try punching through wall if secondary attack (primary is incapable of breaking through)
if( !m_fPrimaryFire )
{
vec3_t start;
VectorMA( tr.endpos, 8.0, forward, start );
// Store off the old count
gEngfuncs.pEventAPI->EV_PushPMStates();
// Now add in all of the players.
gEngfuncs.pEventAPI->EV_SetSolidPlayers ( idx - 1 );
gEngfuncs.pEventAPI->EV_SetTraceHull( 2 );
gEngfuncs.pEventAPI->EV_PlayerTrace( start, vecDest, PM_STUDIO_BOX, -1, &beam_tr );
if( !beam_tr.allsolid )
{
vec3_t delta;
// trace backwards to find exit point
gEngfuncs.pEventAPI->EV_PlayerTrace( beam_tr.endpos, tr.endpos, PM_STUDIO_BOX, -1, &beam_tr );
VectorSubtract( beam_tr.endpos, tr.endpos, delta );
n = Length( delta );
if( n < flDamage )
{
if( n == 0 )
n = 1;
flDamage -= n;
// absorption balls
{
vec3_t fwd;
VectorSubtract( tr.endpos, forward, fwd );
gEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, tr.endpos, fwd, m_iBalls, 3, 0.1, gEngfuncs.pfnRandomFloat( 10, 20 ) / 100.0, 100,
255, 100 );
}
//////////////////////////////////// WHAT TO DO HERE
// CSoundEnt::InsertSound( bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3.0 );
EV_HLDM_DecalGunshot( &beam_tr, BULLET_MONSTER_12MM );
gEngfuncs.pEfxAPI->R_TempSprite( beam_tr.endpos, vec3_origin, 0.1, m_iGlow, kRenderGlow, kRenderFxNoDissipation, flDamage / 255.0, 6.0, FTENT_FADEOUT );
// balls
{
vec3_t fwd;
VectorSubtract( beam_tr.endpos, forward, fwd );
gEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, beam_tr.endpos, fwd, m_iBalls, (int)( flDamage * 0.3 ), 0.1, gEngfuncs.pfnRandomFloat( 10, 20 ) / 100.0, 200,
255, 40 );
}
VectorAdd( beam_tr.endpos, forward, vecSrc );
}
}
else
{
flDamage = 0;
}
gEngfuncs.pEventAPI->EV_PopPMStates();
}
else
{
if( m_fPrimaryFire )
{
// slug doesn't punch through ever with primary
// fire, so leave a little glowy bit and make some balls
gEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 0.2, m_iGlow, kRenderGlow, kRenderFxNoDissipation, 200.0 / 255.0, 0.3, FTENT_FADEOUT );
{
vec3_t fwd;
VectorAdd( tr.endpos, tr.plane.normal, fwd );
gEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, tr.endpos, fwd, m_iBalls, 8, 0.6, gEngfuncs.pfnRandomFloat( 10, 20 ) / 100.0, 100,
255, 200 );
}
}
flDamage = 0;
}
}
}
else
{
VectorAdd( tr.endpos, forward, vecSrc );
}
}
}
//======================
// GAUSS END
//======================
//======================
// CROWBAR START
//======================
@ -1439,218 +951,6 @@ void EV_FireRpg( event_args_t *args ) @@ -1439,218 +951,6 @@ void EV_FireRpg( event_args_t *args )
// RPG END
//======================
//======================
// EGON END
//======================
enum egon_e
{
EGON_IDLE1 = 0,
EGON_FIDGET1,
EGON_ALTFIREON,
EGON_ALTFIRECYCLE,
EGON_ALTFIREOFF,
EGON_FIRE1,
EGON_FIRE2,
EGON_FIRE3,
EGON_FIRE4,
EGON_DRAW,
EGON_HOLSTER
};
int g_fireAnims1[] = { EGON_FIRE1, EGON_FIRE2, EGON_FIRE3, EGON_FIRE4 };
int g_fireAnims2[] = { EGON_ALTFIRECYCLE };
enum EGON_FIRESTATE
{
FIRE_OFF,
FIRE_CHARGE
};
enum EGON_FIREMODE
{
FIRE_NARROW,
FIRE_WIDE
};
#define EGON_PRIMARY_VOLUME 450
#define EGON_BEAM_SPRITE "sprites/xbeam1.spr"
#define EGON_FLARE_SPRITE "sprites/XSpark1.spr"
#define EGON_SOUND_OFF "weapons/egon_off1.wav"
#define EGON_SOUND_RUN "weapons/egon_run3.wav"
#define EGON_SOUND_STARTUP "weapons/egon_windup2.wav"
#define ARRAYSIZE(p) ( sizeof(p) /sizeof(p[0]) )
BEAM *pBeam;
BEAM *pBeam2;
void EV_EgonFire( event_args_t *args )
{
int idx, /*iFireState,*/ iFireMode;
vec3_t origin;
idx = args->entindex;
VectorCopy( args->origin, origin );
//iFireState = args->iparam1;
iFireMode = args->iparam2;
int iStartup = args->bparam1;
if( iStartup )
{
if( iFireMode == FIRE_WIDE )
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, EGON_SOUND_STARTUP, 0.98, ATTN_NORM, 0, 125 );
else
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, EGON_SOUND_STARTUP, 0.9, ATTN_NORM, 0, 100 );
}
else
{
// If there is any sound playing already, kill it. - Solokiller
// This is necessary because multiple sounds can play on the same channel at the same time.
// In some cases, more than 1 run sound plays when the egon stops firing, in which case only the earliest entry in the list is stopped.
// This ensures no more than 1 of those is ever active at the same time.
gEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, EGON_SOUND_RUN );
if( iFireMode == FIRE_WIDE )
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_STATIC, EGON_SOUND_RUN, 0.98, ATTN_NORM, 0, 125 );
else
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_STATIC, EGON_SOUND_RUN, 0.9, ATTN_NORM, 0, 100 );
}
//Only play the weapon anims if I shot it.
if( EV_IsLocal( idx ) )
gEngfuncs.pEventAPI->EV_WeaponAnimation( g_fireAnims1[gEngfuncs.pfnRandomLong( 0, 3 )], 1 );
if( iStartup == 1 && EV_IsLocal( idx ) && !pBeam && !pBeam2 && cl_lw->value ) //Adrian: Added the cl_lw check for those lital people that hate weapon prediction.
{
vec3_t vecSrc, vecEnd, angles, forward, right, up;
pmtrace_t tr;
cl_entity_t *pl = gEngfuncs.GetEntityByIndex( idx );
if( pl )
{
VectorCopy( gHUD.m_vecAngles, angles );
AngleVectors( angles, forward, right, up );
EV_GetGunPosition( args, vecSrc, pl->origin );
VectorMA( vecSrc, 2048, forward, vecEnd );
gEngfuncs.pEventAPI->EV_SetUpPlayerPrediction( false, true );
// Store off the old count
gEngfuncs.pEventAPI->EV_PushPMStates();
// Now add in all of the players.
gEngfuncs.pEventAPI->EV_SetSolidPlayers( idx - 1 );
gEngfuncs.pEventAPI->EV_SetTraceHull( 2 );
gEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecEnd, PM_STUDIO_BOX, -1, &tr );
gEngfuncs.pEventAPI->EV_PopPMStates();
int iBeamModelIndex = gEngfuncs.pEventAPI->EV_FindModelIndex( EGON_BEAM_SPRITE );
float r = 50.0f;
float g = 50.0f;
float b = 125.0f;
if( IEngineStudio.IsHardware() )
{
r /= 100.0f;
g /= 100.0f;
}
pBeam = gEngfuncs.pEfxAPI->R_BeamEntPoint( idx | 0x1000, tr.endpos, iBeamModelIndex, 99999, 3.5, 0.2, 0.7, 55, 0, 0, r, g, b );
if( pBeam )
pBeam->flags |= ( FBEAM_SINENOISE );
pBeam2 = gEngfuncs.pEfxAPI->R_BeamEntPoint( idx | 0x1000, tr.endpos, iBeamModelIndex, 99999, 5.0, 0.08, 0.7, 25, 0, 0, r, g, b );
}
}
}
void EV_EgonStop( event_args_t *args )
{
int idx;
vec3_t origin;
idx = args->entindex;
VectorCopy( args->origin, origin );
gEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, EGON_SOUND_RUN );
if( args->iparam1 )
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, EGON_SOUND_OFF, 0.98, ATTN_NORM, 0, 100 );
if( EV_IsLocal( idx ) )
{
if( pBeam )
{
pBeam->die = 0.0;
pBeam = NULL;
}
if( pBeam2 )
{
pBeam2->die = 0.0;
pBeam2 = NULL;
}
}
}
//======================
// EGON END
//======================
//======================
// HORNET START
//======================
enum hgun_e
{
HGUN_IDLE1 = 0,
HGUN_FIDGETSWAY,
HGUN_FIDGETSHAKE,
HGUN_DOWN,
HGUN_UP,
HGUN_SHOOT
};
void EV_HornetGunFire( event_args_t *args )
{
int idx; //, iFireMode;
vec3_t origin, angles, vecSrc, forward, right, up;
idx = args->entindex;
VectorCopy( args->origin, origin );
VectorCopy( args->angles, angles );
//iFireMode = args->iparam1;
//Only play the weapon anims if I shot it.
if( EV_IsLocal( idx ) )
{
V_PunchAxis( 0, gEngfuncs.pfnRandomLong( 0, 2 ) );
gEngfuncs.pEventAPI->EV_WeaponAnimation( HGUN_SHOOT, 1 );
}
switch( gEngfuncs.pfnRandomLong( 0, 2 ) )
{
case 0:
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "agrunt/ag_fire1.wav", 1, ATTN_NORM, 0, 100 );
break;
case 1:
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "agrunt/ag_fire2.wav", 1, ATTN_NORM, 0, 100 );
break;
case 2:
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "agrunt/ag_fire3.wav", 1, ATTN_NORM, 0, 100 );
break;
}
}
//======================
// HORNET END
//======================
//======================
// TRIPMINE START
//======================
@ -1758,7 +1058,7 @@ void EV_SnarkFire( event_args_t *args ) @@ -1758,7 +1058,7 @@ void EV_SnarkFire( event_args_t *args )
//======================
// SQUEAK END
//======================
#define SND_CHANGE_PITCH (1 << 7) // duplicated in protocol.h change sound pitch
void EV_TrainPitchAdjust( event_args_t *args )
{
int idx;
@ -1867,7 +1167,8 @@ void EV_FireAK47( struct event_args_s *args ) @@ -1867,7 +1167,8 @@ void EV_FireAK47( struct event_args_s *args )
EV_MuzzleFlash();
gEngfuncs.pEventAPI->EV_WeaponAnimation( AK47_FIRE1 + gEngfuncs.pfnRandomLong( 0, 2 ), 2 );
V_PunchAxis(0, gEngfuncs.pfnRandomFloat( -2, 2 ) );
V_PunchAxis( 0, gEngfuncs.pfnRandomFloat( -2.5, -3.2 ) );
V_PunchAxis( 1, gEngfuncs.pfnRandomFloat( -1.5, 1.5 ) );
}
EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20, -12, 4 );
@ -1890,14 +1191,7 @@ void EV_FireAK47( struct event_args_s *args ) @@ -1890,14 +1191,7 @@ void EV_FireAK47( struct event_args_s *args )
EV_GetGunPosition( args, vecSrc, origin );
VectorCopy( forward, vecAiming );
if( gEngfuncs.GetMaxClients() > 1 )
{
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_AK47, 2, &g_tracerCount[idx - 1], args->fparam1, args->fparam2 );
}
else
{
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_AK47, 2, &g_tracerCount[idx - 1], args->fparam1, args->fparam2 );
}
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_AK47, 0, &g_tracerCount[idx - 1], args->fparam1, args->fparam2 );
}
//======================
// AK47 END
@ -1947,7 +1241,8 @@ void EV_FireMac10( struct event_args_s *args ) @@ -1947,7 +1241,8 @@ void EV_FireMac10( struct event_args_s *args )
EV_MuzzleFlash();
gEngfuncs.pEventAPI->EV_WeaponAnimation( MAC10_FIRE1 + gEngfuncs.pfnRandomLong( 0, 2 ), 2 );
V_PunchAxis( 0, gEngfuncs.pfnRandomFloat( -2, 2 ) );
V_PunchAxis( 0, gEngfuncs.pfnRandomFloat( -1.4, -2 ) );
V_PunchAxis( 1, gEngfuncs.pfnRandomFloat( -1.6, 1.6 ) );
}
EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20, -12, 4 );
@ -1970,14 +1265,7 @@ void EV_FireMac10( struct event_args_s *args ) @@ -1970,14 +1265,7 @@ void EV_FireMac10( struct event_args_s *args )
EV_GetGunPosition( args, vecSrc, origin );
VectorCopy( forward, vecAiming );
if( gEngfuncs.GetMaxClients() > 1 )
{
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_MAC10, 2, &g_tracerCount[idx - 1], args->fparam1, args->fparam2 );
}
else
{
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_MAC10, 2, &g_tracerCount[idx - 1], args->fparam1, args->fparam2 );
}
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_MAC10, 0, &g_tracerCount[idx - 1], args->fparam1, args->fparam2 );
}
//======================
// MAC10 END

16
cl_dll/hl/hl_events.cpp

@ -21,21 +21,13 @@ extern "C" @@ -21,21 +21,13 @@ extern "C"
{
// HLDM
void EV_FireGlock1( struct event_args_s *args );
void EV_FireGlock2( struct event_args_s *args );
void EV_FireShotGunSingle( struct event_args_s *args );
void EV_FireShotGunDouble( struct event_args_s *args );
void EV_FireMP5( struct event_args_s *args );
void EV_FireMP52( struct event_args_s *args );
void EV_FirePython( struct event_args_s *args );
void EV_FireGauss( struct event_args_s *args );
void EV_SpinGauss( struct event_args_s *args );
void EV_Crowbar( struct event_args_s *args );
void EV_FireCrossbow( struct event_args_s *args );
void EV_FireCrossbow2( struct event_args_s *args );
void EV_FireRpg( struct event_args_s *args );
void EV_EgonFire( struct event_args_s *args );
void EV_EgonStop( struct event_args_s *args );
void EV_HornetGunFire( struct event_args_s *args );
void EV_TripmineFire( struct event_args_s *args );
void EV_SnarkFire( struct event_args_s *args );
@ -61,22 +53,14 @@ That was what we were going to do, but we ran out of time...oh well. @@ -61,22 +53,14 @@ That was what we were going to do, but we ran out of time...oh well.
void Game_HookEvents( void )
{
gEngfuncs.pfnHookEvent( "events/glock1.sc", EV_FireGlock1 );
gEngfuncs.pfnHookEvent( "events/glock2.sc", EV_FireGlock2 );
gEngfuncs.pfnHookEvent( "events/shotgun1.sc", EV_FireShotGunSingle );
gEngfuncs.pfnHookEvent( "events/shotgun2.sc", EV_FireShotGunDouble );
gEngfuncs.pfnHookEvent( "events/mp5.sc", EV_FireMP5 );
gEngfuncs.pfnHookEvent( "events/mp52.sc", EV_FireMP52 );
gEngfuncs.pfnHookEvent( "events/python.sc", EV_FirePython );
gEngfuncs.pfnHookEvent( "events/gauss.sc", EV_FireGauss );
gEngfuncs.pfnHookEvent( "events/gaussspin.sc", EV_SpinGauss );
gEngfuncs.pfnHookEvent( "events/train.sc", EV_TrainPitchAdjust );
gEngfuncs.pfnHookEvent( "events/crowbar.sc", EV_Crowbar );
gEngfuncs.pfnHookEvent( "events/crossbow1.sc", EV_FireCrossbow );
gEngfuncs.pfnHookEvent( "events/crossbow2.sc", EV_FireCrossbow2 );
gEngfuncs.pfnHookEvent( "events/rpg.sc", EV_FireRpg );
gEngfuncs.pfnHookEvent( "events/egon_fire.sc", EV_EgonFire );
gEngfuncs.pfnHookEvent( "events/egon_stop.sc", EV_EgonStop );
gEngfuncs.pfnHookEvent( "events/firehornet.sc", EV_HornetGunFire );
gEngfuncs.pfnHookEvent( "events/tripfire.sc", EV_TripmineFire );
gEngfuncs.pfnHookEvent( "events/snarkfire.sc", EV_SnarkFire );
gEngfuncs.pfnHookEvent( "events/ak47.sc", EV_FireAK47 );

16
cl_dll/hl/hl_objects.cpp

@ -27,8 +27,6 @@ @@ -27,8 +27,6 @@
#include "entity_types.h"
#include "r_efx.h"
extern BEAM *pBeam;
extern BEAM *pBeam2;
void HUD_GetLastOrg( float *org );
void UpdateBeams( void )
@ -63,18 +61,6 @@ void UpdateBeams( void ) @@ -63,18 +61,6 @@ void UpdateBeams( void )
gEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecEnd, PM_STUDIO_BOX, -1, &tr );
gEngfuncs.pEventAPI->EV_PopPMStates();
if( pBeam )
{
pBeam->target = tr.endpos;
pBeam->die = gEngfuncs.GetClientTime() + 0.1; // We keep it alive just a little bit forward in the future, just in case.
}
if( pBeam2 )
{
pBeam2->target = tr.endpos;
pBeam2->die = gEngfuncs.GetClientTime() + 0.1; // We keep it alive just a little bit forward in the future, just in case.
}
}
/*
@ -86,6 +72,4 @@ Add game specific, client-side objects here @@ -86,6 +72,4 @@ Add game specific, client-side objects here
*/
void Game_AddObjects( void )
{
if( pBeam && pBeam2 )
UpdateBeams();
}

6
cl_dll/hud_msg.cpp

@ -23,9 +23,6 @@ @@ -23,9 +23,6 @@
#define MAX_CLIENTS 32
extern BEAM *pBeam;
extern BEAM *pBeam2;
/// USER-DEFINED SERVER MESSAGE HANDLERS
int CHud::MsgFunc_ResetHUD( const char *pszName, int iSize, void *pbuf )
@ -69,9 +66,6 @@ void CHud::MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf ) @@ -69,9 +66,6 @@ void CHud::MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
pList->p->InitHUDData();
pList = pList->pNext;
}
//Probably not a good place to put this.
pBeam = pBeam2 = NULL;
}
int CHud::MsgFunc_GameMode( const char *pszName, int iSize, void *pbuf )

2
dlls/crossbow.cpp

@ -476,7 +476,7 @@ void CCrossbow::Reload( void ) @@ -476,7 +476,7 @@ void CCrossbow::Reload( void )
SecondaryAttack();
}
if( DefaultReload( CROSSBOW_MAX_CLIP, CROSSBOW_RELOAD, 4.5 ) )
if( DefaultReload( CROSSBOW_MAX_CLIP, CROSSBOW_RELOAD, 2.8 ) )
{
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/xbow_reload1.wav", RANDOM_FLOAT( 0.95, 1.0 ), ATTN_NORM, 0, 93 + RANDOM_LONG( 0, 0xF ) );
}

20
dlls/eftd/ak47.cpp

@ -90,18 +90,22 @@ int CAK47::GetItemInfo(ItemInfo *p) @@ -90,18 +90,22 @@ int CAK47::GetItemInfo(ItemInfo *p)
return 1;
}
BOOL CAK47::Deploy()
BOOL CAK47::AddToPlayer( CBasePlayer *pPlayer )
{
BOOL bResult = DefaultDeploy("models/v_ak47.mdl", "models/p_9mmAR.mdl", AK47_DEPLOY, "ak47");
if (bResult)
if( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1;
MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
WRITE_BYTE( m_iId );
MESSAGE_END();
return TRUE;
}
return bResult;
return FALSE;
}
BOOL CAK47::Deploy()
{
return DefaultDeploy("models/v_ak47.mdl", "models/p_9mmAR.mdl", AK47_DEPLOY, "ak47");
}
void CAK47::PrimaryAttack()
{
@ -171,7 +175,7 @@ void CAK47::Reload(void) @@ -171,7 +175,7 @@ void CAK47::Reload(void)
if (m_pPlayer->ammo_ak47 <= 0)
return;
DefaultReload(AK47_MAX_CLIP, AK47_RELOAD, 2.8);
DefaultReload(AK47_MAX_CLIP, AK47_RELOAD, 2.0);
}

24
dlls/eftd/mac10.cpp

@ -90,18 +90,22 @@ int CMac10::GetItemInfo(ItemInfo *p) @@ -90,18 +90,22 @@ int CMac10::GetItemInfo(ItemInfo *p)
return 1;
}
BOOL CMac10::Deploy()
BOOL CMac10::AddToPlayer( CBasePlayer *pPlayer )
{
BOOL bResult = DefaultDeploy("models/v_mac10.mdl", "models/p_9mmAR.mdl", MAC10_DEPLOY, "mac10");
if ( bResult )
if( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.8;
MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
WRITE_BYTE( m_iId );
MESSAGE_END();
return TRUE;
}
return bResult;
return FALSE;
}
BOOL CMac10::Deploy()
{
return DefaultDeploy("models/v_mac10.mdl", "models/p_9mmAR.mdl", MAC10_DEPLOY, "mac10");
}
void CMac10::PrimaryAttack()
{
@ -158,10 +162,10 @@ void CMac10::PrimaryAttack() @@ -158,10 +162,10 @@ void CMac10::PrimaryAttack()
PLAYBACK_EVENT_FULL(flags, m_pPlayer->edict(), m_usMac10, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0);
m_flNextPrimaryAttack = GetNextAttackDelay(0.1);
m_flNextPrimaryAttack = GetNextAttackDelay(0.075);
if (m_flNextPrimaryAttack < UTIL_WeaponTimeBase())
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.075;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15);
}
@ -171,7 +175,7 @@ void CMac10::Reload(void) @@ -171,7 +175,7 @@ void CMac10::Reload(void)
if (m_pPlayer->ammo_mac10 <= 0)
return;
DefaultReload(MAC10_MAX_CLIP, MAC10_RELOAD, 2.7);
DefaultReload(MAC10_MAX_CLIP, MAC10_RELOAD, 3.2);
}

16
dlls/glock.cpp

@ -100,15 +100,7 @@ int CGlock::AddToPlayer( CBasePlayer *pPlayer ) @@ -100,15 +100,7 @@ int CGlock::AddToPlayer( CBasePlayer *pPlayer )
BOOL CGlock::Deploy()
{
BOOL bResult = DefaultDeploy( "models/v_9mmhandgun.mdl", "models/p_9mmhandgun.mdl", GLOCK_DRAW, "onehanded", /*UseDecrement() ? 1 : 0*/ 0 );
if( bResult )
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.85f;
m_fInAttack = 0;
}
return bResult;
return DefaultDeploy( "models/v_9mmhandgun.mdl", "models/p_9mmhandgun.mdl", GLOCK_DRAW, "onehanded", /*UseDecrement() ? 1 : 0*/ 0 );
}
void CGlock::Holster(int skiplocal /*= 0*/)
@ -139,7 +131,7 @@ void CGlock::PrimaryAttack( void ) @@ -139,7 +131,7 @@ void CGlock::PrimaryAttack( void )
flSpread = 0.03490;
}
GlockFire( flSpread, 0.2, TRUE );
GlockFire( flSpread, 0.18, TRUE );
}
void CGlock::GlockFire( float flSpread, float flCycleTime, BOOL fUseAutoAim )
@ -224,9 +216,9 @@ void CGlock::Reload( void ) @@ -224,9 +216,9 @@ void CGlock::Reload( void )
int iResult;
if( m_iClip == 0 )
iResult = DefaultReload( GLOCK_MAX_CLIP, GLOCK_RELOAD, 2.2 );
iResult = DefaultReload( GLOCK_MAX_CLIP, GLOCK_RELOAD, 2.0 );
else
iResult = DefaultReload( GLOCK_MAX_CLIP, GLOCK_RELOAD_NOT_EMPTY, 2.2 );
iResult = DefaultReload( GLOCK_MAX_CLIP, GLOCK_RELOAD_NOT_EMPTY, 2.0 );
if( iResult )
{

15
dlls/mp5.cpp

@ -123,14 +123,7 @@ int CMP5::AddToPlayer( CBasePlayer *pPlayer ) @@ -123,14 +123,7 @@ int CMP5::AddToPlayer( CBasePlayer *pPlayer )
BOOL CMP5::Deploy()
{
BOOL bResult = DefaultDeploy( "models/v_9mmAR.mdl", "models/p_9mmAR.mdl", MP5_DEPLOY, "mp5" );
if( bResult )
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1;
}
return bResult;
return DefaultDeploy( "models/v_9mmAR.mdl", "models/p_9mmAR.mdl", MP5_DEPLOY, "mp5" );
}
void CMP5::Holster( int skiplocal /*= 0*/ )
@ -321,6 +314,12 @@ void CMP5::WeaponIdle( void ) @@ -321,6 +314,12 @@ void CMP5::WeaponIdle( void )
m_flTimeWeaponIdle = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); // how long till we do this again.
}
BOOL CMP5::IsUseable()
{
//Can be used if the player has AR grenades. - Solokiller
return CBasePlayerWeapon::IsUseable() || m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] > 0;
}
void CMP5::UpdateSpot( void )
{
#ifndef CLIENT_DLL

18
dlls/shotgun.cpp

@ -150,21 +150,7 @@ void CShotgun::PrimaryAttack() @@ -150,21 +150,7 @@ void CShotgun::PrimaryAttack()
Vector vecSrc = m_pPlayer->GetGunPosition();
Vector vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES );
Vector vecDir;
#ifdef CLIENT_DLL
if( bIsMultiplayer() )
#else
if( g_pGameRules->IsMultiplayer() )
#endif
{
vecDir = m_pPlayer->FireBulletsPlayer( 4, vecSrc, vecAiming, VECTOR_CONE_DM_SHOTGUN, 2048, BULLET_PLAYER_BUCKSHOT, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed );
}
else
{
// regular old, untouched spread.
vecDir = m_pPlayer->FireBulletsPlayer( 6, vecSrc, vecAiming, VECTOR_CONE_10DEGREES, 2048, BULLET_PLAYER_BUCKSHOT, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed );
}
Vector vecDir = m_pPlayer->FireBulletsPlayer( 16, vecSrc, vecAiming, VECTOR_CONE_DM_SHOTGUN, 2048, BULLET_PLAYER_BUCKSHOT, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed );
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usSingleFire, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 );
@ -186,6 +172,7 @@ void CShotgun::PrimaryAttack() @@ -186,6 +172,7 @@ void CShotgun::PrimaryAttack()
void CShotgun::SecondaryAttack( void )
{
/*
// don't fire underwater
if( m_pPlayer->pev->waterlevel == 3 )
{
@ -254,6 +241,7 @@ void CShotgun::SecondaryAttack( void ) @@ -254,6 +241,7 @@ void CShotgun::SecondaryAttack( void )
m_flTimeWeaponIdle = 1.5;
m_fInSpecialReload = 0;
*/
}
void CShotgun::Reload( void )

31
dlls/weapons.h

@ -65,16 +65,16 @@ public: @@ -65,16 +65,16 @@ public:
#define WEAPON_NONE 0
#define WEAPON_CROWBAR 1
#define WEAPON_GLOCK 2
#define WEAPON_MP5 3
#define WEAPON_CROSSBOW 4
#define WEAPON_SHOTGUN 5
#define WEAPON_RPG 6
#define WEAPON_HANDGRENADE 7
#define WEAPON_TRIPMINE 8
#define WEAPON_SATCHEL 9
#define WEAPON_AK47 3
#define WEAPON_MP5 4
#define WEAPON_HANDGRENADE 5
#define WEAPON_CROSSBOW 6
#define WEAPON_SHOTGUN 7
#define WEAPON_RPG 8
#define WEAPON_MAC10 9
#define WEAPON_SNARK 10
#define WEAPON_MAC10 11
#define WEAPON_AK47 12
#define WEAPON_TRIPMINE 11
#define WEAPON_SATCHEL 12
#define WEAPON_ALLWEAPONS (~(1<<WEAPON_SUIT))
@ -100,7 +100,7 @@ public: @@ -100,7 +100,7 @@ public:
#define SATCHEL_WEIGHT -10
#define TRIPMINE_WEIGHT -10
#define MAC10_WEIGHT 10
#define AK47_WEIGHT 15
#define AK47_WEIGHT 17
// weapon clip/carry ammo capacities
#define _9MM_MAX_CARRY 210
@ -571,6 +571,7 @@ public: @@ -571,6 +571,7 @@ public:
BOOL Deploy( void );
void Reload( void );
void WeaponIdle( void );
BOOL IsUseable();
float m_flNextAnimTime;
int m_iShell;
@ -1017,37 +1018,39 @@ private: @@ -1017,37 +1018,39 @@ private:
unsigned short m_usSnarkFire;
};
class CAK47 : public CMP5
class CAK47 : public CBasePlayerWeapon
{
public:
void Spawn( void );
void Precache( void );
int GetItemInfo( ItemInfo *p );
BOOL AddToPlayer( CBasePlayer *pPlayer );
void PrimaryAttack( void );
void SecondaryAttack( void ) {}
BOOL Deploy( void );
void Reload( void );
void WeaponIdle( void );
private:
int m_iShell;
unsigned short m_usAK47;
};
class CMac10 : public CMP5
class CMac10 : public CBasePlayerWeapon
{
public:
void Spawn( void );
void Precache( void );
int GetItemInfo( ItemInfo *p );
BOOL AddToPlayer( CBasePlayer *pPlayer );
void PrimaryAttack( void );
void SecondaryAttack( void ) {}
BOOL Deploy( void );
void Reload( void );
void WeaponIdle( void );
private:
int m_iShell;
unsigned short m_usMac10;
};
#endif // WEAPONS_H

Loading…
Cancel
Save