From 865ea984759f52fbbd2312e5eb20b6dc80748881 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Thu, 1 Aug 2019 04:45:00 +0300 Subject: [PATCH] Update desert eagle --- cl_dll/ev_hldm.cpp | 4 +++- cl_dll/ev_hldm.h | 2 ++ dlls/combat.cpp | 5 ++++- dlls/gearbox/eagle.cpp | 36 +++++++++++++++++++----------------- dlls/gearbox/massn.cpp | 2 +- dlls/weapons.cpp | 1 + dlls/weapons.h | 2 ++ 7 files changed, 32 insertions(+), 20 deletions(-) diff --git a/cl_dll/ev_hldm.cpp b/cl_dll/ev_hldm.cpp index f703cf2d..3cce6fe7 100644 --- a/cl_dll/ev_hldm.cpp +++ b/cl_dll/ev_hldm.cpp @@ -327,6 +327,7 @@ void EV_HLDM_DecalGunshot( pmtrace_t *pTrace, int iBulletType ) case BULLET_MONSTER_MP5: case BULLET_PLAYER_BUCKSHOT: case BULLET_PLAYER_357: + case BULLET_PLAYER_EAGLE: case BULLET_MONSTER_357: case BULLET_PLAYER_556: case BULLET_MONSTER_556: @@ -467,6 +468,7 @@ void EV_HLDM_FireBullets( int idx, float *forward, float *right, float *up, int EV_HLDM_DecalGunshot( &tr, iBulletType ); break; case BULLET_PLAYER_357: + case BULLET_PLAYER_EAGLE: EV_HLDM_PlayTextureSound( idx, &tr, vecSrc, vecEnd, iBulletType ); EV_HLDM_DecalGunshot( &tr, iBulletType ); break; @@ -1903,7 +1905,7 @@ void EV_FireEagle( event_args_t *args ) VectorCopy( forward, vecAiming ); - EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_357, 0, 0, args->fparam1, args->fparam2 ); + EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_EAGLE, 0, 0, args->fparam1, args->fparam2 ); } //====================== // DESERT EAGLE END diff --git a/cl_dll/ev_hldm.h b/cl_dll/ev_hldm.h index 2e8c6c44..75163965 100644 --- a/cl_dll/ev_hldm.h +++ b/cl_dll/ev_hldm.h @@ -20,6 +20,8 @@ typedef enum BULLET_PLAYER_CROWBAR, // crowbar swipe BULLET_PLAYER_556, BULLET_PLAYER_762, + BULLET_PLAYER_EAGLE, + BULLET_MONSTER_9MM, BULLET_MONSTER_MP5, BULLET_MONSTER_12MM, diff --git a/dlls/combat.cpp b/dlls/combat.cpp index dd3c5763..541aa128 100644 --- a/dlls/combat.cpp +++ b/dlls/combat.cpp @@ -1453,7 +1453,7 @@ void CBaseEntity::FireBullets( ULONG cShots, Vector vecSrc, Vector vecDirShootin } break; case BULLET_MONSTER_357: - pEntity->TraceAttack( pevAttacker, gSkillData.plrDmg357, vecDir, &tr, DMG_BULLET ); + pEntity->TraceAttack( pevAttacker, gSkillData.plrDmgEagle, vecDir, &tr, DMG_BULLET ); TEXTURETYPE_PlaySound( &tr, vecSrc, vecEnd, iBulletType ); DecalGunshot( &tr, iBulletType ); break; @@ -1553,6 +1553,9 @@ Vector CBaseEntity::FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDi case BULLET_PLAYER_357: pEntity->TraceAttack( pevAttacker, gSkillData.plrDmg357, vecDir, &tr, DMG_BULLET ); break; + case BULLET_PLAYER_EAGLE: + pEntity->TraceAttack( pevAttacker, gSkillData.plrDmgEagle, vecDir, &tr, DMG_BULLET ); + break; case BULLET_PLAYER_556: pEntity->TraceAttack( pevAttacker, gSkillData.plrDmg556, vecDir, &tr, DMG_BULLET ); break; diff --git a/dlls/gearbox/eagle.cpp b/dlls/gearbox/eagle.cpp index 723758f2..69c5c0c3 100644 --- a/dlls/gearbox/eagle.cpp +++ b/dlls/gearbox/eagle.cpp @@ -35,13 +35,13 @@ LINK_ENTITY_TO_CLASS( eagle_laser, CLaserSpot ) void CEagle::Spawn( void ) { - - 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"); m_iDefaultAmmo = EAGLE_DEFAULT_GIVE; + m_fEagleLaserActive = 0; + m_pEagleLaser = 0; FallInit();// get ready to fall down. } @@ -102,16 +102,18 @@ void CEagle::SecondaryAttack() { bool wasActive = m_fEagleLaserActive; m_fEagleLaserActive = !m_fEagleLaserActive; + m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5; if (wasActive) { +#ifndef CLIENT_DLL if (m_pEagleLaser) { 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 } - m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5; } void CEagle::PrimaryAttack() @@ -144,7 +146,6 @@ void CEagle::PrimaryAttack() m_pPlayer->pev->effects = (int)(m_pPlayer->pev->effects) | EF_MUZZLEFLASH; int flags; - BOOL m_fLaserOn; #if defined( CLIENT_WEAPONS ) flags = FEV_NOTHOST; @@ -158,32 +159,29 @@ void CEagle::PrimaryAttack() m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH; Vector vecSrc = m_pPlayer->GetGunPosition( ); - Vector vecAiming; - vecAiming = gpGlobals->v_forward; + Vector vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_10DEGREES ); Vector vecDir; if (m_fEagleLaserActive) { - vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, Vector( flSpread, flSpread, flSpread ), 8192, BULLET_PLAYER_357, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); + vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, Vector( flSpread, flSpread, flSpread ), 8192, BULLET_PLAYER_EAGLE, 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 { flSpread = 0.1; - vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, Vector(flSpread, flSpread, flSpread), 8192, BULLET_PLAYER_357, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); + vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, Vector(flSpread, flSpread, flSpread), 8192, BULLET_PLAYER_EAGLE, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); m_flNextPrimaryAttack = UTIL_WeaponTimeBase()+ 0.22; - m_fLaserOn = FALSE; } - 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 ); + PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usEagle, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, 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_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0); m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); } @@ -192,7 +190,10 @@ void CEagle::PrimaryAttack() void CEagle::Reload( void ) { if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == EAGLE_MAX_CLIP) - return; + { + UpdateSpot(); + return; + } if ( m_pEagleLaser && m_fEagleLaserActive ) { @@ -245,11 +246,12 @@ void CEagle::WeaponIdle( void ) { UpdateSpot( ); - if (m_flTimeWeaponIdle < UTIL_WeaponTimeBase() ) - { - ResetEmptySound( ); - m_pPlayer->GetAutoaimVector( AUTOAIM_10DEGREES ); + ResetEmptySound( ); + m_pPlayer->GetAutoaimVector( AUTOAIM_10DEGREES ); + + if (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase() ) + { // only idle if the slid isn't back if (m_iClip != 0) { diff --git a/dlls/gearbox/massn.cpp b/dlls/gearbox/massn.cpp index 1f14fd8c..2758ffae 100644 --- a/dlls/gearbox/massn.cpp +++ b/dlls/gearbox/massn.cpp @@ -127,7 +127,7 @@ void CMassn::Sniperrifle(void) Vector vecShellVelocity = gpGlobals->v_right * RANDOM_FLOAT(40, 90) + gpGlobals->v_up * RANDOM_FLOAT(75, 200) + gpGlobals->v_forward * RANDOM_FLOAT(-40, 40); EjectBrass(vecShootOrigin - vecShootDir * 24, vecShellVelocity, pev->angles.y, m_iBrassShell, TE_BOUNCE_SHELL); - FireBullets(1, vecShootOrigin, vecShootDir, VECTOR_CONE_1DEGREES, 2048, BULLET_PLAYER_357, 0); // shoot +-7.5 degrees + FireBullets(1, vecShootOrigin, vecShootDir, VECTOR_CONE_1DEGREES, 2048, BULLET_MONSTER_762, 0); // shoot +-7.5 degrees pev->effects |= EF_MUZZLEFLASH; diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index dd8fea57..ee337917 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -177,6 +177,7 @@ void DecalGunshot( TraceResult *pTrace, int iBulletType ) case BULLET_MONSTER_MP5: case BULLET_PLAYER_BUCKSHOT: case BULLET_PLAYER_357: + case BULLET_PLAYER_EAGLE: case BULLET_MONSTER_357: case BULLET_PLAYER_556: case BULLET_MONSTER_556: diff --git a/dlls/weapons.h b/dlls/weapons.h index bc45452c..65172f56 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -219,6 +219,8 @@ typedef enum BULLET_PLAYER_CROWBAR, // crowbar swipe BULLET_PLAYER_556, // m249 BULLET_PLAYER_762, // sniperrifle + BULLET_PLAYER_EAGLE, // desert eagle + BULLET_MONSTER_9MM, BULLET_MONSTER_MP5, BULLET_MONSTER_12MM,