[HL25] Backport changes to Gauss

This commit is contained in:
Joël Troch 2024-08-28 13:34:30 +02:00
parent 9b9d6c3b0b
commit 8c5d4abd96
2 changed files with 17 additions and 1 deletions

View file

@ -142,6 +142,10 @@ void CGauss::PrimaryAttack()
void CGauss::SecondaryAttack()
{
// JoshA: Sanitize this so it's not total garbage on level transition
// and we end up ear blasting the player!
m_pPlayer->m_flStartCharge = V_min(m_pPlayer->m_flStartCharge, gpGlobals->time);
// don't fire underwater
if (m_pPlayer->pev->waterlevel == 3)
{
@ -287,6 +291,10 @@ void CGauss::StartFire()
{
float flDamage;
// JoshA: Sanitize this so it's not total garbage on level transition
// and we end up ear blasting the player!
m_pPlayer->m_flStartCharge = V_min(m_pPlayer->m_flStartCharge, gpGlobals->time);
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
Vector vecAiming = gpGlobals->v_forward;
Vector vecSrc = m_pPlayer->GetGunPosition(); // + gpGlobals->v_up * -8 + gpGlobals->v_right * 8;
@ -353,7 +361,7 @@ void CGauss::Fire(Vector vecOrigSrc, Vector vecDir, float flDamage)
bool fFirstBeam = true;
int nMaxHits = 10;
pentIgnore = ENT(m_pPlayer->pev);
pentIgnore = m_pPlayer->edict();
#ifdef CLIENT_DLL
if (m_fPrimaryFire == false)
@ -400,6 +408,13 @@ void CGauss::Fire(Vector vecOrigSrc, Vector vecDir, float flDamage)
if (0 != pEntity->pev->takedamage)
{
ClearMultiDamage();
// if you hurt yourself clear the headshot bit
if (m_pPlayer->pev == pEntity->pev)
{
tr.iHitgroup = 0;
}
pEntity->TraceAttack(m_pPlayer->pev, flDamage, vecDir, &tr, DMG_BULLET);
ApplyMultiDamage(m_pPlayer->pev, m_pPlayer->pev);
}

View file

@ -2793,6 +2793,7 @@ ReturnSpot:
void CBasePlayer::Spawn()
{
m_flStartCharge = gpGlobals->time;
m_bIsSpawning = true;
//Make sure this gets reset even if somebody adds an early return or throws an exception.