From 37ed1d9b3973e595aacd4a9c30e4d4b2a760ae7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Troch?= Date: Wed, 28 Aug 2024 14:01:50 +0200 Subject: [PATCH] [HL25] Backport changes to the hornet gun --- dlls/hornetgun.cpp | 25 ++++++++++++++++++++++--- dlls/weapons.h | 2 +- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/dlls/hornetgun.cpp b/dlls/hornetgun.cpp index 1e7e33a..ebabbba 100644 --- a/dlls/hornetgun.cpp +++ b/dlls/hornetgun.cpp @@ -23,6 +23,15 @@ #include "gamerules.h" #include "UserMessages.h" +static float GetRechargeTime() +{ + if (gpGlobals->maxClients > 1) + { + return 0.3f; + } + return 0.5f; +} + enum firemode_e { FIREMODE_TRACK = 0, @@ -125,7 +134,7 @@ void CHgun::PrimaryAttack() CBaseEntity* pHornet = CBaseEntity::Create("hornet", m_pPlayer->GetGunPosition() + gpGlobals->v_forward * 16 + gpGlobals->v_right * 8 + gpGlobals->v_up * -12, m_pPlayer->pev->v_angle, m_pPlayer->edict()); pHornet->pev->velocity = gpGlobals->v_forward * 300; - m_flRechargeTime = gpGlobals->time + 0.5; + m_flRechargeTime = gpGlobals->time + GetRechargeTime(); #endif m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--; @@ -154,6 +163,10 @@ void CHgun::PrimaryAttack() { m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25; } + if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] == 0) + { + m_flNextPrimaryAttack += GetRechargeTime(); + } m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15); } @@ -218,7 +231,7 @@ void CHgun::SecondaryAttack() pHornet->SetThink(&CHornet::StartDart); - m_flRechargeTime = gpGlobals->time + 0.5; + m_flRechargeTime = gpGlobals->time + GetRechargeTime(); #endif int flags; @@ -239,6 +252,12 @@ void CHgun::SecondaryAttack() m_pPlayer->SetAnimation(PLAYER_ATTACK1); m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.1; + if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] == 0) + { + m_flRechargeTime = gpGlobals->time + 0.5; + m_flNextSecondaryAttack += 0.5; + m_flNextPrimaryAttack += 0.5; + } m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15); } @@ -252,7 +271,7 @@ void CHgun::Reload() while (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] < HORNET_MAX_CARRY && m_flRechargeTime < gpGlobals->time) { m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]++; - m_flRechargeTime += 0.5; + m_flRechargeTime += GetRechargeTime(); } m_pPlayer->TabulateAmmo(); diff --git a/dlls/weapons.h b/dlls/weapons.h index dc75007..cd34c5b 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -80,7 +80,7 @@ public: #define RPG_WEIGHT 20 #define GAUSS_WEIGHT 20 #define EGON_WEIGHT 20 -#define HORNETGUN_WEIGHT 10 +#define HORNETGUN_WEIGHT 15 #define HANDGRENADE_WEIGHT 5 #define SNARK_WEIGHT 5 #define SATCHEL_WEIGHT -10