diff --git a/cl_dll/ev_hldm.cpp b/cl_dll/ev_hldm.cpp index 52e32e5a..6795507f 100644 --- a/cl_dll/ev_hldm.cpp +++ b/cl_dll/ev_hldm.cpp @@ -1951,7 +1951,7 @@ void EV_FireEagle( event_args_t *args ) EV_MuzzleFlash(); gEngfuncs.pEventAPI->EV_WeaponAnimation( EAGLE_SHOOT, 1 ); - V_PunchAxis( 0, -10.0 ); + V_PunchAxis( 0, -4.0 ); } // Play fire sound. diff --git a/dlls/gearbox/eagle.cpp b/dlls/gearbox/eagle.cpp index 00db36ee..c861243c 100644 --- a/dlls/gearbox/eagle.cpp +++ b/dlls/gearbox/eagle.cpp @@ -1,17 +1,10 @@ -/*** -* -* Copyright (c) 1996-2001, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. -* All Rights Reserved. -* -* Use, distribution, and modification of this source code and/or resulting -* object code is restricted to non-commercial enhancements to products from -* Valve LLC. All other use, distribution, or modification is prohibited -* without written permission from Valve LLC. -* -****/ +//========= Copyright © 2004-2008, Raven City Team, All rights reserved. ============// +// // +// Purpose: // +// // +// $NoKeywords: $ // +//===================================================================================// +//Modifided by Lost_Gamer_ #include "extdll.h" #include "util.h" @@ -21,26 +14,30 @@ #include "nodes.h" #include "player.h" -enum eagle_e { - EAGLE_IDLE1 = 0, - EAGLE_IDLE2, - EAGLE_IDLE3, - EAGLE_IDLE4, - EAGLE_IDLE5, - EAGLE_SHOOT, - EAGLE_SHOOT_EMPTY, - EAGLE_RELOAD, - EAGLE_RELOAD_NOT_EMPTY, - EAGLE_DRAW, - EAGLE_HOLSTER, +enum deagle_e { + DEAGLE_IDLE1 = 0, + DEAGLE_IDLE2, + DEAGLE_IDLE3, + DEAGLE_IDLE4, + DEAGLE_IDLE5, + DEAGLE_SHOOT, + DEAGLE_SHOOT_EMPTY, + DEAGLE_RELOAD, + DEAGLE_RELOAD_NOT_EMPTY, + DEAGLE_DRAW, + DEAGLE_HOLSTER }; +LINK_ENTITY_TO_CLASS( weapon_eagle, CEagle ) -LINK_ENTITY_TO_CLASS(weapon_eagle, CEagle); - +#ifndef CLIENT_DLL +LINK_ENTITY_TO_CLASS( eagle_laser, CLaserSpot ) +#endif -void CEagle::Spawn() +void CEagle::Spawn( void ) { - Precache(); + + pev->classname = MAKE_STRING("weapon_eagle"); // hack to allow for old names + Precache( ); m_iId = WEAPON_EAGLE; SET_MODEL(ENT(pev), "models/w_desert_eagle.mdl"); @@ -50,20 +47,20 @@ void CEagle::Spawn() } -void CEagle::Precache(void) +void CEagle::Precache( void ) { + UTIL_PrecacheOther( "eagle_laser" ); PRECACHE_MODEL("models/v_desert_eagle.mdl"); PRECACHE_MODEL("models/w_desert_eagle.mdl"); PRECACHE_MODEL("models/p_desert_eagle.mdl"); + m_iShell = PRECACHE_MODEL ("models/shell.mdl");// brass shell - m_iShell = PRECACHE_MODEL("models/shell.mdl");// brass shell - - PRECACHE_SOUND("weapons/desert_eagle_fire.wav"); - PRECACHE_SOUND("weapons/desert_eagle_reload.wav"); - PRECACHE_SOUND("weapons/desert_eagle_sight.wav"); - PRECACHE_SOUND("weapons/desert_eagle_sight2.wav"); + PRECACHE_SOUND ("weapons/desert_eagle_reload.wav"); + PRECACHE_SOUND ("weapons/desert_eagle_fire.wav"); + PRECACHE_SOUND ("weapons/desert_eagle_sight.wav"); + PRECACHE_SOUND ("weapons/desert_eagle_sight2.wav"); - m_usFireEagle = PRECACHE_EVENT(1, "events/eagle.sc"); + m_usEagle = PRECACHE_EVENT( 1, "events/eagle.sc" ); } int CEagle::GetItemInfo(ItemInfo *p) @@ -83,68 +80,71 @@ int CEagle::GetItemInfo(ItemInfo *p) return 1; } -BOOL CEagle::Deploy() +BOOL CEagle::Deploy( ) { - return DefaultDeploy("models/v_desert_eagle.mdl", "models/p_desert_eagle.mdl", EAGLE_DRAW, "eagle", UseDecrement()); + return DefaultDeploy( "models/v_desert_eagle.mdl", "models/p_desert_eagle.mdl", DEAGLE_DRAW, "onehanded", 0 ); } - -void CEagle::Holster(int skiplocal /* = 0 */) +void CEagle::Holster( int skiplocal /* = 0 */ ) { m_fInReload = FALSE;// cancel any reload in progress. - m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5; + SendWeaponAnim( DEAGLE_HOLSTER ); - SendWeaponAnim(EAGLE_HOLSTER); - -#ifndef CLIENT_DLL - if (m_pSpot) + if (m_pEagleLaser) { - m_pSpot->Killed(NULL, GIB_NEVER); - m_pSpot = NULL; + m_pEagleLaser->Killed( NULL, GIB_NEVER ); + m_pEagleLaser = NULL; } -#endif - } -void CEagle::SecondaryAttack(void) +void CEagle::SecondaryAttack() { - m_fSpotActive = !m_fSpotActive; - -#ifndef CLIENT_DLL - if (!m_fSpotActive && m_pSpot) + m_fEagleLaserActive = ! m_fEagleLaserActive; + if (!m_fEagleLaserActive && m_pEagleLaser) { - m_pSpot->Killed(NULL, GIB_NORMAL); - m_pSpot = NULL; + EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/desert_eagle_sight2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM); + m_pEagleLaser->Killed( NULL, GIB_NORMAL ); + m_pEagleLaser = NULL; } -#endif - - if (m_fSpotActive) - EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/desert_eagle_sight.wav", 1, ATTN_NORM); else - EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/desert_eagle_sight2.wav", 1, ATTN_NORM); - - m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.2; + { + EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/desert_eagle_sight.wav", 1.0, ATTN_NORM, 0, PITCH_NORM); + } + m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5; } -void CEagle::PrimaryAttack(void) +void CEagle::PrimaryAttack() { if (m_iClip <= 0) { if (m_fFireOnEmpty) { PlayEmptySound(); - m_flNextPrimaryAttack = GetNextAttackDelay(0.2); + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.2; } + return; + } + // don't fire underwater + if (m_pPlayer->pev->waterlevel == 3) + { + UpdateSpot( ); + PlayEmptySound( ); + m_flNextPrimaryAttack = UTIL_WeaponTimeBase()+ 0.15; return; } + UpdateSpot( ); + + float flSpread = 0.01; + m_iClip--; m_pPlayer->pev->effects = (int)(m_pPlayer->pev->effects) | EF_MUZZLEFLASH; int flags; + BOOL m_fLaserOn; #if defined( CLIENT_WEAPONS ) flags = FEV_NOTHOST; @@ -153,136 +153,147 @@ void CEagle::PrimaryAttack(void) #endif // player "shoot" animation - m_pPlayer->SetAnimation(PLAYER_ATTACK1); - + m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH; - Vector vecSrc = m_pPlayer->GetGunPosition(); + Vector vecSrc = m_pPlayer->GetGunPosition( ); Vector vecAiming; - const Vector& vecSpread = VECTOR_CONE_2DEGREES; + vecAiming = gpGlobals->v_forward; - float flCycleTime; - - if (!m_fSpotActive) + Vector vecDir; + if (m_pEagleLaser) { - vecAiming = m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES); - flCycleTime = 0.25f; + vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, Vector( flSpread, flSpread, flSpread ), 8192, BULLET_PLAYER_357, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); + m_flNextPrimaryAttack = UTIL_WeaponTimeBase()+ 0.5; +#ifndef CLIENT_DLL + m_pEagleLaser->Suspend( 0.6 ); +#endif + m_fLaserOn = TRUE; } else { - vecAiming = gpGlobals->v_forward; - flCycleTime = 0.5f; + flSpread = 0.1; + vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, VECTOR_CONE_10DEGREES, 8192, BULLET_PLAYER_357, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); + m_flNextPrimaryAttack = UTIL_WeaponTimeBase()+ 0.22; + m_fLaserOn = FALSE; } - Vector vecDir; - vecDir = m_pPlayer->FireBulletsPlayer(1, vecSrc, vecAiming, (m_fSpotActive) ? VECTOR_CONE_1DEGREES : VECTOR_CONE_10DEGREES, 8192, BULLET_PLAYER_357, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed); - - PLAYBACK_EVENT_FULL(flags, m_pPlayer->edict(), m_usFireEagle, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, (m_iClip == 0) ? 1 : 0, 0); - - m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); + PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usEagle, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, flSpread, flSpread, ( m_iClip == 0 ) ? 1 : 0, 0 ); if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) - // HEV suit - indicate out of ammo condition - m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0); - - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15); + // HEV suit - indicate out of ammo condition + m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0); - UpdateSpot(); + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); } -void CEagle::Reload(void) + +void CEagle::Reload( void ) { - if (m_pPlayer->ammo_357 <= 0) - return; + if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == EAGLE_MAX_CLIP) + return; - if (m_fSpotActive) + if ( m_pEagleLaser && m_fEagleLaserActive ) { - SecondaryAttack(); +#ifndef CLIENT_DLL + m_pEagleLaser->Suspend( 1.6 ); +#endif + m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.5; } int iResult; if (m_iClip == 0) - iResult = DefaultReload(EAGLE_MAX_CLIP, EAGLE_RELOAD, 1.5); + iResult = DefaultReload( EAGLE_MAX_CLIP, DEAGLE_RELOAD, 1.5 ); else - iResult = DefaultReload(EAGLE_MAX_CLIP, EAGLE_RELOAD_NOT_EMPTY, 1.5); + iResult = DefaultReload( EAGLE_MAX_CLIP, DEAGLE_RELOAD_NOT_EMPTY, 1.5 ); if (iResult) { - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15); + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); } } - - -void CEagle::WeaponIdle(void) +void CEagle::UpdateSpot( void ) { - UpdateSpot(); - - ResetEmptySound(); - - m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES); - - if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase()) - return; - - // only idle if the slid isn't back - if (m_iClip != 0) +#ifndef CLIENT_DLL + if (m_fEagleLaserActive) { - int iAnim; - float flRand = UTIL_SharedRandomFloat(m_pPlayer->random_seed, 0.0, 1.0); - - if (flRand <= 0.2) - { - iAnim = EAGLE_IDLE1; - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.5f; - } - else if (flRand <= 0.4) - { - iAnim = EAGLE_IDLE2; - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.5f; - } - else if (flRand <= 0.6) - { - iAnim = EAGLE_IDLE3; - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.6f; - } - else if (flRand <= 0.8) + if (!m_pEagleLaser) { - iAnim = EAGLE_IDLE4; - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.5f; + m_pEagleLaser = CLaserSpot::CreateSpot(); + m_pEagleLaser->pev->classname = MAKE_STRING("eagle_laser"); + m_pEagleLaser->pev->scale = 0.5; } - else + + UTIL_MakeVectors( m_pPlayer->pev->v_angle ); + Vector vecSrc = m_pPlayer->GetGunPosition( );; + Vector vecAiming = gpGlobals->v_forward; + + TraceResult tr; + UTIL_TraceLine ( vecSrc, vecSrc + vecAiming * 8192, dont_ignore_monsters, ENT(m_pPlayer->pev), &tr ); + + UTIL_SetOrigin( m_pEagleLaser->pev, tr.vecEndPos ); + + if ( UTIL_PointContents(tr.vecEndPos) == CONTENT_SKY ) { - iAnim = EAGLE_IDLE5; - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0; + UTIL_Remove( m_pEagleLaser ); + m_pEagleLaser = FALSE; } - SendWeaponAnim(iAnim, 1); + } +#endif } -void CEagle::UpdateSpot(void) +void CEagle::WeaponIdle( void ) { + UpdateSpot( ); -#ifndef CLIENT_DLL - if (m_fSpotActive) + if (m_flTimeWeaponIdle < UTIL_WeaponTimeBase() ) { - if (!m_pSpot) + ResetEmptySound( ); + m_pPlayer->GetAutoaimVector( AUTOAIM_10DEGREES ); + + // only idle if the slid isn't back + if (m_iClip != 0) { - m_pSpot = CLaserSpot::CreateSpot(); + int iAnim; + float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0.0, 1.0 ); + + if (m_pEagleLaser) + { + if (flRand > 0.5 ) + { + iAnim = DEAGLE_IDLE5;//Done + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f; + } + else + { + iAnim = DEAGLE_IDLE4;//Done + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.5f; + } + } + else + { + if (flRand <= 0.3 ) + { + iAnim = DEAGLE_IDLE1;//Done + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.5f; + } + else if (flRand <= 0.6 ) + { + iAnim = DEAGLE_IDLE2; + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.5f; + } + else + { + iAnim = DEAGLE_IDLE3;//Done + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.63f; + } + } + SendWeaponAnim( iAnim, UseDecrement() ? 1 : 0 ); } - - UTIL_MakeVectors(m_pPlayer->pev->v_angle); - Vector vecSrc = m_pPlayer->GetGunPosition(); - Vector vecAiming = gpGlobals->v_forward; - - TraceResult tr; - UTIL_TraceLine(vecSrc, vecSrc + vecAiming * 8192, dont_ignore_monsters, ENT(m_pPlayer->pev), &tr); - - UTIL_SetOrigin(m_pSpot->pev, tr.vecEndPos); } -#endif - -} \ No newline at end of file +} diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index 865b4f68..0fa21815 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -1617,10 +1617,11 @@ TYPEDESCRIPTION CDisplacer::m_SaveData[] = }; IMPLEMENT_SAVERESTORE( CDisplacer, CBasePlayerWeapon ) -TYPEDESCRIPTION CEagle::m_SaveData[] = +TYPEDESCRIPTION CEagle::m_SaveData[] = { - DEFINE_FIELD( CEagle, m_fSpotActive, FIELD_INTEGER ), + DEFINE_FIELD( CEagle, m_fEagleLaserActive, FIELD_INTEGER ), }; + IMPLEMENT_SAVERESTORE( CEagle, CBasePlayerWeapon ) TYPEDESCRIPTION CGrapple::m_SaveData[] = @@ -1641,7 +1642,6 @@ TYPEDESCRIPTION CM249::m_SaveData[] = }; IMPLEMENT_SAVERESTORE( CM249, CBasePlayerWeapon ) - TYPEDESCRIPTION CPipeWrench::m_SaveData[] = { DEFINE_FIELD( CPipeWrench, m_iFirestate, FIELD_INTEGER ), diff --git a/dlls/weapons.h b/dlls/weapons.h index fc341714..73515c5f 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -1107,30 +1107,27 @@ private: class CEagle : public CBasePlayerWeapon { public: - #ifndef CLIENT_DLL - int Save(CSave &save); - int Restore(CRestore &restore); - static TYPEDESCRIPTION m_SaveData[]; + int Save( CSave &save ); + int Restore( CRestore &restore ); + static TYPEDESCRIPTION m_SaveData[]; #endif + void Spawn( void ); + void Precache( void ); + int iItemSlot( void ) { return 2; } + int GetItemInfo( ItemInfo *p ); - void Spawn(void); - void Precache(void); - int iItemSlot(void) { return 2; } - int GetItemInfo(ItemInfo *p); - - void PrimaryAttack(void); - void SecondaryAttack(void); - BOOL Deploy(void); - void Holster(int skiplocal = 0); - - void Reload(void); - void WeaponIdle(void); - - void UpdateSpot(void); - BOOL ShouldWeaponIdle(void) { return TRUE; }; + void PrimaryAttack( void ); + void SecondaryAttack( void ); + BOOL Deploy( void ); + void Holster( int skiplocal = 0 ); + void Reload( void ); + void WeaponIdle( void ); - virtual BOOL UseDecrement(void) + void UpdateSpot( void ); + CLaserSpot *m_pEagleLaser; + int m_fEagleLaserActive; + virtual BOOL UseDecrement( void ) { #if defined( CLIENT_WEAPONS ) return TRUE; @@ -1139,13 +1136,10 @@ public: #endif } - CLaserSpot *m_pSpot; - int m_fSpotActive; - private: int m_iShell; - unsigned short m_usFireEagle; + unsigned short m_usEagle; }; class CGrappleTonguetip;