mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2024-12-27 07:05:38 +03:00
Add member m_iGibDamageThreshold to control GIB damage threshold (#904)
* Add member m_iGibDamageThreshold to control GIB damage threshold
This commit is contained in:
parent
8c0b684046
commit
f63b154637
@ -2451,7 +2451,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Killed)(entvars_t *pevAttacker, int iGib)
|
||||
HintMessage("#Hint_cannot_play_because_tk", TRUE, TRUE);
|
||||
}
|
||||
|
||||
if ((pev->health < -9000 && iGib != GIB_NEVER) || iGib == GIB_ALWAYS)
|
||||
if (ShouldGibPlayer(iGib))
|
||||
{
|
||||
|
||||
#ifndef REGAMEDLL_FIXES
|
||||
|
@ -448,7 +448,7 @@ public:
|
||||
edict_t *EntSelectSpawnPoint_OrigFunc();
|
||||
void PlayerDeathThink_OrigFunc();
|
||||
void Observer_Think_OrigFunc();
|
||||
|
||||
|
||||
CCSPlayer *CSPlayer() const;
|
||||
#endif // REGAMEDLL_API
|
||||
|
||||
@ -641,6 +641,7 @@ public:
|
||||
bool ShouldToShowAccount(CBasePlayer *pReceiver) const;
|
||||
bool ShouldToShowHealthInfo(CBasePlayer *pReceiver) const;
|
||||
const char *GetKillerWeaponName(entvars_t *pevInflictor, entvars_t *pevKiller) const;
|
||||
bool ShouldGibPlayer(int iGib);
|
||||
|
||||
CBasePlayerItem *GetItemByName(const char *itemName);
|
||||
CBasePlayerItem *GetItemById(WeaponIdType weaponID);
|
||||
@ -954,7 +955,24 @@ inline bool CBasePlayer::HasTimePassedSinceDeath(float duration) const
|
||||
inline CCSPlayer *CBasePlayer::CSPlayer() const {
|
||||
return reinterpret_cast<CCSPlayer *>(this->m_pEntity);
|
||||
}
|
||||
#endif
|
||||
#else // !REGAMEDLL_API
|
||||
|
||||
// Determine whether player can be gibbed or not
|
||||
inline bool CBasePlayer::ShouldGibPlayer(int iGib)
|
||||
{
|
||||
// Always gib the player regardless of incoming damage
|
||||
if (iGib == GIB_ALWAYS)
|
||||
return true;
|
||||
|
||||
// Gib the player if health is below the gib damage threshold
|
||||
if (pev->health < GIB_PLAYER_THRESHOLD && iGib != GIB_NEVER)
|
||||
return true;
|
||||
|
||||
// do not gib the player
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // !REGAMEDLL_API
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
|
||||
|
@ -56,7 +56,8 @@ public:
|
||||
m_flLongJumpHeight(0),
|
||||
m_flLongJumpForce(0),
|
||||
m_flDuckSpeedMultiplier(0),
|
||||
m_iUserID(-1)
|
||||
m_iUserID(-1),
|
||||
m_iGibDamageThreshold(GIB_PLAYER_THRESHOLD)
|
||||
{
|
||||
m_szModel[0] = '\0';
|
||||
|
||||
@ -172,6 +173,8 @@ public:
|
||||
void RecordDamage(CBasePlayer *pAttacker, float flDamage, float flFlashDurationTime = -1);
|
||||
int m_iNumKilledByUnanswered[MAX_CLIENTS]; // [0-31] how many unanswered kills this player has been dealt by each other player
|
||||
bool m_bPlayerDominated[MAX_CLIENTS]; // [0-31] array of state per other player whether player is dominating other players
|
||||
|
||||
int m_iGibDamageThreshold; // negative health to reach to gib player
|
||||
};
|
||||
|
||||
// Inlines
|
||||
@ -210,3 +213,20 @@ inline void CCSPlayer::SetPlayerDominated(CBasePlayer *pPlayer, bool bDominated)
|
||||
Assert(iPlayerIndex > 0 && iPlayerIndex <= MAX_CLIENTS);
|
||||
m_bPlayerDominated[iPlayerIndex - 1] = bDominated;
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_API
|
||||
// Determine whether player can be gibbed or not
|
||||
inline bool CBasePlayer::ShouldGibPlayer(int iGib)
|
||||
{
|
||||
// Always gib the player regardless of incoming damage
|
||||
if (iGib == GIB_ALWAYS)
|
||||
return true;
|
||||
|
||||
// Gib the player if health is below the gib damage threshold
|
||||
if (pev->health < CSPlayer()->m_iGibDamageThreshold && iGib != GIB_NEVER)
|
||||
return true;
|
||||
|
||||
// do not gib the player
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -106,3 +106,4 @@
|
||||
#define GIB_NEVER 1 // Never gib, no matter how much death damage is done ( freezing, etc )
|
||||
#define GIB_ALWAYS 2 // Always gib ( Houndeye Shock, Barnacle Bite )
|
||||
#define GIB_HEALTH_VALUE -30
|
||||
#define GIB_PLAYER_THRESHOLD -9000
|
||||
|
Loading…
Reference in New Issue
Block a user