-
-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add member m_iGibDamageThreshold to control GIB damage threshold #904
Conversation
the flag |
The function "CBasePlayer::ShouldGibPlayer" should probably not be in "CSPlayer.h" (more on "player.h"), more due to the fact it is not only "API only feature", due to internal "REGAMEDLL_API" define. |
Thing is, I don't know why it doesn't compile when I put this inline function after the CSPlayer method declaration inside player.h - by the way, @s1lentq implemented the |
Maybe putting it inside the "#ifdef REGAMEDLL_API" on "player.h" line 953 could skip the compiler error, then a #else with duplicated function without the member. |
#ifdef REGAMEDLL_API
inline CCSPlayer *CBasePlayer::CSPlayer() const {
return reinterpret_cast<CCSPlayer *>(this->m_pEntity);
}
#endif
inline bool CBasePlayer::ShouldGibPlayer(int iGib)
{
#ifdef REGAMEDLL_API
int threshold = CSPlayer()->m_iGibDamageThreshold;
#else
int threshold = GIB_PLAYER_THRESHOLD;
#endif
return ((pev->health < threshold && iGib != GIB_NEVER) || iGib == GIB_ALWAYS);
} It wont compile 💀 am I forgetting something? |
I was thinking to something more like: #ifdef REGAMEDLL_API
inline CCSPlayer *CBasePlayer::CSPlayer() const {
return reinterpret_cast<CCSPlayer *>(this->m_pEntity);
}
inline bool CBasePlayer::ShouldGibPlayer(int iGib)
{
return ((pev->health < CSPlayer()->m_iGibDamageThreshold && iGib != GIB_NEVER) || iGib == GIB_ALWAYS);
}
#else
inline bool CBasePlayer::ShouldGibPlayer(int iGib)
{
return ((pev->health < GIB_PLAYER_THRESHOLD&& iGib != GIB_NEVER) || iGib == GIB_ALWAYS);
}
#endif But might not compile too! |
It wont recognize CSPlayer method, and I don't know why, it's getting defined above (lol). Some cpp coder may elaborate on this, I'm still a rookie :) |
… gibthreshold_member
The only way to "naturally" GIB on death for players is reaching -9000 health points. This PR adds a CCSPlayer member that controls that value individually per player. It defaults to -9000.