[HL25] Backport changes to the hornet gun

This commit is contained in:
Joël Troch 2024-08-28 14:01:50 +02:00
parent ec569d4bf3
commit 37ed1d9b39
2 changed files with 23 additions and 4 deletions

View file

@ -23,6 +23,15 @@
#include "gamerules.h" #include "gamerules.h"
#include "UserMessages.h" #include "UserMessages.h"
static float GetRechargeTime()
{
if (gpGlobals->maxClients > 1)
{
return 0.3f;
}
return 0.5f;
}
enum firemode_e enum firemode_e
{ {
FIREMODE_TRACK = 0, 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()); 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; pHornet->pev->velocity = gpGlobals->v_forward * 300;
m_flRechargeTime = gpGlobals->time + 0.5; m_flRechargeTime = gpGlobals->time + GetRechargeTime();
#endif #endif
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--; m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
@ -154,6 +163,10 @@ void CHgun::PrimaryAttack()
{ {
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25; 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); m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15);
} }
@ -218,7 +231,7 @@ void CHgun::SecondaryAttack()
pHornet->SetThink(&CHornet::StartDart); pHornet->SetThink(&CHornet::StartDart);
m_flRechargeTime = gpGlobals->time + 0.5; m_flRechargeTime = gpGlobals->time + GetRechargeTime();
#endif #endif
int flags; int flags;
@ -239,6 +252,12 @@ void CHgun::SecondaryAttack()
m_pPlayer->SetAnimation(PLAYER_ATTACK1); m_pPlayer->SetAnimation(PLAYER_ATTACK1);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.1; 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); 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) while (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] < HORNET_MAX_CARRY && m_flRechargeTime < gpGlobals->time)
{ {
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]++; m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]++;
m_flRechargeTime += 0.5; m_flRechargeTime += GetRechargeTime();
} }
m_pPlayer->TabulateAmmo(); m_pPlayer->TabulateAmmo();

View file

@ -80,7 +80,7 @@ public:
#define RPG_WEIGHT 20 #define RPG_WEIGHT 20
#define GAUSS_WEIGHT 20 #define GAUSS_WEIGHT 20
#define EGON_WEIGHT 20 #define EGON_WEIGHT 20
#define HORNETGUN_WEIGHT 10 #define HORNETGUN_WEIGHT 15
#define HANDGRENADE_WEIGHT 5 #define HANDGRENADE_WEIGHT 5
#define SNARK_WEIGHT 5 #define SNARK_WEIGHT 5
#define SATCHEL_WEIGHT -10 #define SATCHEL_WEIGHT -10