|
|
@ -34,36 +34,7 @@ enum sniper_e { |
|
|
|
SNIPER_HOLSTER, |
|
|
|
SNIPER_HOLSTER, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
LINK_ENTITY_TO_CLASS(weapon_sniperrifle, CSniperrifle); |
|
|
|
LINK_ENTITY_TO_CLASS( weapon_sniperrifle, CSniperrifle ) |
|
|
|
|
|
|
|
|
|
|
|
int CSniperrifle::GetItemInfo(ItemInfo *p) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
p->pszName = STRING(pev->classname); |
|
|
|
|
|
|
|
p->pszAmmo1 = "762"; |
|
|
|
|
|
|
|
p->iMaxAmmo1 = _762_MAX_CARRY; |
|
|
|
|
|
|
|
p->pszAmmo2 = NULL; |
|
|
|
|
|
|
|
p->iMaxAmmo2 = -1; |
|
|
|
|
|
|
|
p->iMaxClip = SNIPERRIFLE_MAX_CLIP; |
|
|
|
|
|
|
|
p->iFlags = 0; |
|
|
|
|
|
|
|
p->iSlot = 5; |
|
|
|
|
|
|
|
p->iPosition = 2; |
|
|
|
|
|
|
|
p->iId = m_iId = WEAPON_SNIPERRIFLE; |
|
|
|
|
|
|
|
p->iWeight = SNIPERRIFLE_WEIGHT; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int CSniperrifle::AddToPlayer(CBasePlayer *pPlayer) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (CBasePlayerWeapon::AddToPlayer(pPlayer)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
MESSAGE_BEGIN(MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev); |
|
|
|
|
|
|
|
WRITE_BYTE(m_iId); |
|
|
|
|
|
|
|
MESSAGE_END(); |
|
|
|
|
|
|
|
return TRUE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return FALSE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CSniperrifle::Spawn( ) |
|
|
|
void CSniperrifle::Spawn( ) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -73,9 +44,6 @@ void CSniperrifle::Spawn() |
|
|
|
|
|
|
|
|
|
|
|
m_iDefaultAmmo = SNIPERRIFLE_DEFAULT_GIVE; |
|
|
|
m_iDefaultAmmo = SNIPERRIFLE_DEFAULT_GIVE; |
|
|
|
|
|
|
|
|
|
|
|
m_fNeedAjustBolt = FALSE; |
|
|
|
|
|
|
|
m_iBoltState = BOLTSTATE_FINE; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FallInit();// get ready to fall down.
|
|
|
|
FallInit();// get ready to fall down.
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -86,171 +54,165 @@ void CSniperrifle::Precache(void) |
|
|
|
PRECACHE_MODEL("models/w_m40a1.mdl"); |
|
|
|
PRECACHE_MODEL("models/w_m40a1.mdl"); |
|
|
|
PRECACHE_MODEL("models/p_m40a1.mdl"); |
|
|
|
PRECACHE_MODEL("models/p_m40a1.mdl"); |
|
|
|
|
|
|
|
|
|
|
|
PRECACHE_MODEL("models/w_m40a1clip.mdl"); |
|
|
|
|
|
|
|
PRECACHE_SOUND("items/9mmclip1.wav"); |
|
|
|
|
|
|
|
PRECACHE_SOUND("weapons/357_cock1.wav"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PRECACHE_SOUND ("weapons/sniper_bolt1.wav"); |
|
|
|
PRECACHE_SOUND ("weapons/sniper_bolt1.wav"); |
|
|
|
PRECACHE_SOUND ("weapons/sniper_bolt2.wav"); |
|
|
|
PRECACHE_SOUND ("weapons/sniper_bolt2.wav"); |
|
|
|
|
|
|
|
|
|
|
|
PRECACHE_SOUND ("weapons/sniper_fire.wav"); |
|
|
|
PRECACHE_SOUND ("weapons/sniper_fire.wav"); |
|
|
|
PRECACHE_SOUND("weapons/sniper_fire_last_round.wav"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PRECACHE_SOUND("weapons/sniper_miss.wav"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PRECACHE_SOUND ("weapons/sniper_reload_first_seq.wav"); |
|
|
|
PRECACHE_SOUND ("weapons/sniper_reload_first_seq.wav"); |
|
|
|
PRECACHE_SOUND ("weapons/sniper_reload_second_seq.wav"); |
|
|
|
PRECACHE_SOUND ("weapons/sniper_reload_second_seq.wav"); |
|
|
|
PRECACHE_SOUND ("weapons/sniper_reload3.wav"); |
|
|
|
PRECACHE_SOUND ("weapons/sniper_reload3.wav"); |
|
|
|
|
|
|
|
|
|
|
|
PRECACHE_SOUND ("weapons/sniper_zoom.wav"); |
|
|
|
PRECACHE_SOUND ("weapons/sniper_zoom.wav"); |
|
|
|
|
|
|
|
|
|
|
|
m_usSniper = PRECACHE_EVENT( 1, "events/sniper.sc" ); |
|
|
|
m_usSniper = PRECACHE_EVENT( 1, "events/sniper.sc" ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
BOOL CSniperrifle::Deploy() |
|
|
|
int CSniperrifle::GetItemInfo(ItemInfo *p) |
|
|
|
{ |
|
|
|
|
|
|
|
if (m_fNeedAjustBolt) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
m_iBoltState = BOLTSTATE_ADJUST; |
|
|
|
p->pszName = STRING(pev->classname); |
|
|
|
|
|
|
|
p->pszAmmo1 = "762"; |
|
|
|
|
|
|
|
p->iMaxAmmo1 = _762_MAX_CARRY; |
|
|
|
|
|
|
|
p->pszAmmo2 = NULL; |
|
|
|
|
|
|
|
p->iMaxAmmo2 = -1; |
|
|
|
|
|
|
|
p->iMaxClip = 5; |
|
|
|
|
|
|
|
p->iSlot = 5; |
|
|
|
|
|
|
|
p->iPosition = 2; |
|
|
|
|
|
|
|
p->iFlags = 0; |
|
|
|
|
|
|
|
p->iId = m_iId = WEAPON_SNIPERRIFLE; |
|
|
|
|
|
|
|
p->iWeight = 10; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return DefaultDeploy("models/v_m40a1.mdl", "models/p_m40a1.mdl", SNIPER_DRAW, "m40a1", UseDecrement()); |
|
|
|
BOOL CSniperrifle::Deploy( ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return DefaultDeploy( "models/v_m40a1.mdl", "models/p_m40a1.mdl", SNIPER_DRAW, "bow", 0 ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int CSniperrifle::AddToPlayer( CBasePlayer *pPlayer ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (CBasePlayerWeapon::AddToPlayer(pPlayer)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
MESSAGE_BEGIN(MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev); |
|
|
|
|
|
|
|
WRITE_BYTE(m_iId); |
|
|
|
|
|
|
|
MESSAGE_END(); |
|
|
|
|
|
|
|
return TRUE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return FALSE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void CSniperrifle::Holster(int skiplocal /* = 0 */) |
|
|
|
void CSniperrifle::Holster( int skiplocal ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_fInReload = FALSE;// cancel any reload in progress.
|
|
|
|
m_fInReload = FALSE;// cancel any reload in progress.
|
|
|
|
|
|
|
|
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0; |
|
|
|
|
|
|
|
SendWeaponAnim( SNIPER_HOLSTER ); |
|
|
|
|
|
|
|
|
|
|
|
if ( m_fInZoom ) |
|
|
|
if ( m_fInZoom ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
SecondaryAttack( ); |
|
|
|
SecondaryAttack( ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (m_fNeedAjustBolt) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
m_iBoltState = BOLTSTATE_ADJUST; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0; |
|
|
|
void CSniperrifle::SecondaryAttack() |
|
|
|
m_flTimeWeaponIdle = UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15); |
|
|
|
|
|
|
|
SendWeaponAnim(SNIPER_HOLSTER); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CSniperrifle::SecondaryAttack(void) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
if ( m_pPlayer->pev->fov != 0 ) |
|
|
|
if ( m_pPlayer->pev->fov != 0 ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_fInZoom = FALSE; |
|
|
|
|
|
|
|
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 0; // 0 means reset to default fov
|
|
|
|
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 0; // 0 means reset to default fov
|
|
|
|
|
|
|
|
m_fInZoom = FALSE; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (m_pPlayer->pev->fov != 18) |
|
|
|
else if ( m_pPlayer->pev->fov != 15 ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 15; |
|
|
|
m_fInZoom = TRUE; |
|
|
|
m_fInZoom = TRUE; |
|
|
|
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 18; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Play zoom sound.
|
|
|
|
EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/sniper_zoom.wav", 1.0, ATTN_NORM, 0, PITCH_NORM); |
|
|
|
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/sniper_zoom.wav", 1, ATTN_NORM); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_flNextSecondaryAttack = GetNextAttackDelay(0.5f); |
|
|
|
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void CSniperrifle::PrimaryAttack() |
|
|
|
void CSniperrifle::PrimaryAttack() |
|
|
|
{ |
|
|
|
{ |
|
|
|
// don't fire underwater
|
|
|
|
if ( m_fInSpecialReload ) |
|
|
|
if (m_pPlayer->pev->waterlevel == 3) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
PlayEmptySound(); |
|
|
|
|
|
|
|
m_flNextPrimaryAttack = 0.15; |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (m_iClip <= 0) |
|
|
|
if (m_iClip <= 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!m_fFireOnEmpty) |
|
|
|
if (m_fFireOnEmpty) |
|
|
|
Reload(); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/357_cock1.wav", 0.8, ATTN_NORM); |
|
|
|
PlayEmptySound(); |
|
|
|
m_flNextPrimaryAttack = 0.15; |
|
|
|
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.2; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
m_pPlayer->m_iWeaponVolume = LOUD_GUN_VOLUME; |
|
|
|
// don't fire underwater
|
|
|
|
m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH; |
|
|
|
if (m_pPlayer->pev->waterlevel == 3) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
PlayEmptySound( ); |
|
|
|
|
|
|
|
m_flNextPrimaryAttack = 0.15; |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float flSpread = 0.001; |
|
|
|
|
|
|
|
|
|
|
|
m_iClip--; |
|
|
|
m_iClip--; |
|
|
|
|
|
|
|
|
|
|
|
m_pPlayer->pev->effects = (int)(m_pPlayer->pev->effects) | EF_MUZZLEFLASH; |
|
|
|
m_pPlayer->pev->effects = (int)(m_pPlayer->pev->effects) | EF_MUZZLEFLASH; |
|
|
|
|
|
|
|
|
|
|
|
// player "shoot" animation
|
|
|
|
|
|
|
|
m_pPlayer->SetAnimation(PLAYER_ATTACK1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Vector vecSrc = m_pPlayer->GetGunPosition(); |
|
|
|
|
|
|
|
Vector vecAiming = m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Vector vecDir; |
|
|
|
|
|
|
|
vecDir = m_pPlayer->FireBulletsPlayer(1, vecSrc, vecAiming, Vector(0, 0, 0), 8192, BULLET_PLAYER_762, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int flags; |
|
|
|
int flags; |
|
|
|
|
|
|
|
|
|
|
|
#if defined( CLIENT_WEAPONS ) |
|
|
|
#if defined( CLIENT_WEAPONS ) |
|
|
|
flags = FEV_NOTHOST; |
|
|
|
flags = FEV_NOTHOST; |
|
|
|
#else |
|
|
|
#else |
|
|
|
flags = 0; |
|
|
|
flags = 0; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
m_fNeedAjustBolt = (m_iClip <= 0) ? 1 : 0; |
|
|
|
// player "shoot" animation
|
|
|
|
|
|
|
|
m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); |
|
|
|
|
|
|
|
m_pPlayer->m_iWeaponVolume = LOUD_GUN_VOLUME; |
|
|
|
|
|
|
|
m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Vector vecSrc = m_pPlayer->GetGunPosition( ); |
|
|
|
|
|
|
|
Vector vecAiming; |
|
|
|
|
|
|
|
vecAiming = gpGlobals->v_forward; |
|
|
|
|
|
|
|
|
|
|
|
// If this was the last round in the clip, make sure to schedule
|
|
|
|
Vector vecDir; |
|
|
|
// bolt adjustment.
|
|
|
|
|
|
|
|
if (m_fNeedAjustBolt) |
|
|
|
|
|
|
|
m_iBoltState = BOLTSTATE_ADJUST; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PLAYBACK_EVENT_FULL(flags, m_pPlayer->edict(), m_usSniper, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, m_fNeedAjustBolt, 0, 0, 0); |
|
|
|
vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, Vector( flSpread, flSpread, flSpread ), 8192, BULLET_PLAYER_762, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); |
|
|
|
|
|
|
|
m_flNextPrimaryAttack = 1.75; |
|
|
|
|
|
|
|
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usSniper, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, ( m_iClip == 0 ) ? 1 : 0, 0, 0, 0 ); |
|
|
|
|
|
|
|
|
|
|
|
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) |
|
|
|
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) |
|
|
|
// HEV suit - indicate out of ammo condition
|
|
|
|
// HEV suit - indicate out of ammo condition
|
|
|
|
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0); |
|
|
|
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0); |
|
|
|
|
|
|
|
|
|
|
|
m_flNextPrimaryAttack = GetNextAttackDelay(1.8f); |
|
|
|
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 68.0 / 38.0; |
|
|
|
m_flTimeWeaponIdle = UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CSniperrifle::Reload( void ) |
|
|
|
void CSniperrifle::Reload( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (m_pPlayer->ammo_762 <= 0) |
|
|
|
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == SNIPERRIFLE_MAX_CLIP) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int iResult; |
|
|
|
|
|
|
|
|
|
|
|
if ( m_pPlayer->pev->fov != 0 ) |
|
|
|
if ( m_pPlayer->pev->fov != 0 ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_fInZoom = FALSE; |
|
|
|
SecondaryAttack(); |
|
|
|
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 0; // 0 means reset to default fov
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int bUseScope = FALSE; |
|
|
|
if (m_iClip == 0) |
|
|
|
#ifdef CLIENT_DLL |
|
|
|
{ |
|
|
|
bUseScope = bIsMultiplayer(); |
|
|
|
iResult = DefaultReload( 5, SNIPER_RELOAD1, 80.0 / 34 ); |
|
|
|
#else |
|
|
|
m_fInSpecialReload = 1; |
|
|
|
bUseScope = g_pGameRules->IsMultiplayer(); |
|
|
|
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 2.25; |
|
|
|
#endif |
|
|
|
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.25; |
|
|
|
|
|
|
|
} |
|
|
|
// Select the appropriate sequence for reload.
|
|
|
|
else |
|
|
|
// One has bolt adjusted, the other does not.
|
|
|
|
{ |
|
|
|
int iReloadAnim = (m_iClip > 0) |
|
|
|
iResult = DefaultReload( SNIPERRIFLE_MAX_CLIP, SNIPER_RELOAD3, 2.25 ); |
|
|
|
? SNIPER_RELOAD3 // Regular reload.
|
|
|
|
} |
|
|
|
: SNIPER_RELOAD1; // No ammo in current clip.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DefaultReload(SNIPERRIFLE_MAX_CLIP, iReloadAnim, 2.3); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CSniperrifle::WeaponIdle( void ) |
|
|
|
void CSniperrifle::WeaponIdle( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ResetEmptySound( ); |
|
|
|
ResetEmptySound( ); |
|
|
@ -260,62 +222,28 @@ void CSniperrifle::WeaponIdle(void) |
|
|
|
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase() ) |
|
|
|
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase() ) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
// Select the appropriate sequence for idle.
|
|
|
|
if ( m_fInSpecialReload ) |
|
|
|
// One has bolt adjusted, the other does not.
|
|
|
|
|
|
|
|
int iIdleAnim = (m_iClip > 0) |
|
|
|
|
|
|
|
? SNIPER_SLOWIDLE // Clip has at least one bullet. (Bolt adjusted)
|
|
|
|
|
|
|
|
: SNIPER_SLOWIDLE2; // Clip is empty. (Bolt unadjusted)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SendWeaponAnim(iIdleAnim, UseDecrement()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CSniperrifle::ItemPostFrame(void) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
if ((m_fInReload) && (m_pPlayer->m_flNextAttack <= UTIL_WeaponTimeBase())) |
|
|
|
m_fInSpecialReload = 0; |
|
|
|
{ |
|
|
|
|
|
|
|
if (m_fNeedAjustBolt) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
switch (m_iBoltState) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case BOLTSTATE_ADJUST: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
m_iBoltState = BOLTSTATE_ADJUSTING; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Send the bolt 'adjustment' weapon anim.
|
|
|
|
|
|
|
|
SendWeaponAnim( SNIPER_RELOAD2 ); |
|
|
|
SendWeaponAnim( SNIPER_RELOAD2 ); |
|
|
|
|
|
|
|
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 49.0 / 27.0; |
|
|
|
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.8f; |
|
|
|
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 49.0 / 27.0; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
else |
|
|
|
|
|
|
|
|
|
|
|
case BOLTSTATE_ADJUSTING: |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
m_fNeedAjustBolt = FALSE; |
|
|
|
int iAnim; |
|
|
|
m_iBoltState = BOLTSTATE_FINE; |
|
|
|
if (m_iClip <= 0) |
|
|
|
} |
|
|
|
{ |
|
|
|
break; |
|
|
|
iAnim = SNIPER_SLOWIDLE2; |
|
|
|
default: ALERT(at_aiconsole, "Warning: Unknown bolt state!\n"); break; |
|
|
|
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 80.0 / 16.0; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
// complete the reload.
|
|
|
|
iAnim = SNIPER_SLOWIDLE; |
|
|
|
int j = Q_min(iMaxClip() - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]); |
|
|
|
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 67.5 / 16; |
|
|
|
|
|
|
|
|
|
|
|
// Add them to the clip
|
|
|
|
|
|
|
|
m_iClip += j; |
|
|
|
|
|
|
|
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= j; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef CLIENT_DLL |
|
|
|
|
|
|
|
m_pPlayer->TabulateAmmo(); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
m_fInReload = FALSE; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
SendWeaponAnim( iAnim, 1 ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
CBasePlayerWeapon::ItemPostFrame(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -342,6 +270,6 @@ class CSniperAmmo : public CBasePlayerAmmo |
|
|
|
return FALSE; |
|
|
|
return FALSE; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
LINK_ENTITY_TO_CLASS(ammo_762, CSniperAmmo); |
|
|
|
LINK_ENTITY_TO_CLASS(ammo_762, CSniperAmmo) |
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|