mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-01-27 14:08:00 +03:00
Invisible shield fix (#422)
* add constants for entvar "gamestate" magic number * invisible shield (https://github.com/s1lentq/ReGameDLL_CS/projects/1#card-26566008)
This commit is contained in:
parent
c2f62eb98a
commit
a386ef41ea
@ -2031,7 +2031,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Killed)(entvars_t *pevAttacker, int iGib)
|
||||
pev->movetype = MOVETYPE_TOSS;
|
||||
pev->takedamage = DAMAGE_NO;
|
||||
|
||||
pev->gamestate = 1;
|
||||
pev->gamestate = HITGROUP_SHIELD_DISABLED;
|
||||
m_bShieldDrawn = false;
|
||||
|
||||
pev->flags &= ~FL_ONGROUND;
|
||||
@ -2997,6 +2997,10 @@ void EXT_FUNC CBasePlayer::__API_HOOK(GiveShield)(bool bDeploy)
|
||||
m_bOwnsShield = true;
|
||||
m_bHasPrimary = true;
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
pev->gamestate = HITGROUP_SHIELD_ENABLED;
|
||||
#endif
|
||||
|
||||
if (m_pActiveItem)
|
||||
{
|
||||
CBasePlayerWeapon *pWeapon = static_cast<CBasePlayerWeapon *>(m_pActiveItem);
|
||||
@ -3011,7 +3015,10 @@ void EXT_FUNC CBasePlayer::__API_HOOK(GiveShield)(bool bDeploy)
|
||||
}
|
||||
}
|
||||
|
||||
pev->gamestate = 0;
|
||||
#ifndef REGAMEDLL_FIXES
|
||||
// NOTE: Moved above, because CC4::Deploy can reset hitbox of shield
|
||||
pev->gamestate = HITGROUP_SHIELD_ENABLED;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CBasePlayer::RemoveShield()
|
||||
@ -3021,7 +3028,7 @@ void CBasePlayer::RemoveShield()
|
||||
m_bOwnsShield = false;
|
||||
m_bHasPrimary = false;
|
||||
m_bShieldDrawn = false;
|
||||
pev->gamestate = 1;
|
||||
pev->gamestate = HITGROUP_SHIELD_DISABLED;
|
||||
|
||||
UpdateShieldCrosshair(true);
|
||||
}
|
||||
@ -5210,9 +5217,9 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Spawn)()
|
||||
m_pentCurBombTarget = nullptr;
|
||||
|
||||
if (m_bOwnsShield)
|
||||
pev->gamestate = 0;
|
||||
pev->gamestate = HITGROUP_SHIELD_ENABLED;
|
||||
else
|
||||
pev->gamestate = 1;
|
||||
pev->gamestate = HITGROUP_SHIELD_DISABLED;
|
||||
|
||||
ResetStamina();
|
||||
pev->friction = 1;
|
||||
@ -6501,7 +6508,7 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(AddPlayerItem)(CBasePlayerItem *pItem)
|
||||
m_rgpPlayerItems[pItem->iItemSlot()] = pItem;
|
||||
|
||||
if (HasShield())
|
||||
pev->gamestate = 0;
|
||||
pev->gamestate = HITGROUP_SHIELD_ENABLED;
|
||||
|
||||
// should we switch to this item?
|
||||
if (g_pGameRules->FShouldSwitchWeapon(this, pItem))
|
||||
|
@ -112,6 +112,10 @@ const int MONEY_BLINK_AMOUNT = 30;
|
||||
#define PFLAG_USING BIT(4) // Using a continuous entity
|
||||
#define PFLAG_OBSERVER BIT(5) // Player is locked in stationary cam mode. Spectators can move, observers can't.
|
||||
|
||||
// Player gamestate flags
|
||||
#define HITGROUP_SHIELD_ENABLED 0
|
||||
#define HITGROUP_SHIELD_DISABLED 1
|
||||
|
||||
#define TRAIN_OFF 0x00
|
||||
#define TRAIN_NEUTRAL 0x01
|
||||
#define TRAIN_SLOW 0x02
|
||||
|
@ -67,7 +67,7 @@ BOOL CC4::Deploy()
|
||||
if (m_pPlayer->HasShield())
|
||||
{
|
||||
m_bHasShield = true;
|
||||
m_pPlayer->pev->gamestate = 1;
|
||||
m_pPlayer->pev->gamestate = HITGROUP_SHIELD_DISABLED;
|
||||
}
|
||||
|
||||
return DefaultDeploy("models/v_c4.mdl", "models/p_c4.mdl", C4_DRAW, "c4", UseDecrement() != FALSE);
|
||||
@ -94,7 +94,7 @@ void CC4::Holster(int skiplocal)
|
||||
|
||||
if (m_bHasShield)
|
||||
{
|
||||
m_pPlayer->pev->gamestate = 0;
|
||||
m_pPlayer->pev->gamestate = HITGROUP_SHIELD_ENABLED;
|
||||
m_bHasShield = false;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user