Minor refactoring API functions

This commit is contained in:
s1lentq 2023-12-12 18:59:13 +07:00
parent d98e8f8b60
commit 34e56f61f2
5 changed files with 22 additions and 32 deletions

View File

@ -63,6 +63,10 @@ NEW_DLL_FUNCTIONS gNewDLLFunctions =
nullptr
};
#ifndef REGAMEDLL_API
entvars_t *g_pevLastInflictor = nullptr;
#endif
CMemoryPool hashItemMemPool(sizeof(hash_item_t), 64);
int CaseInsensitiveHash(const char *string, int iBounds)

View File

@ -341,7 +341,20 @@ inline CCSEntity *CBaseEntity::CSEntity() const
{
return m_pEntity;
}
#endif
#else // !REGAMEDLL_API
extern entvars_t *g_pevLastInflictor;
inline void CBaseEntity::SetDmgPenetrationLevel(int iPenetrationLevel) {}
inline void CBaseEntity::ResetDmgPenetrationLevel() {}
inline int CBaseEntity::GetDmgPenetrationLevel() const { return 0; }
inline entvars_t *CBaseEntity::GetLastInflictor() { return g_pevLastInflictor; }
inline void CBaseEntity::KilledInflicted(entvars_t *pevInflictor, entvars_t *pevAttacker, int iGib)
{
g_pevLastInflictor = pevInflictor;
Killed(pevAttacker, iGib);
g_pevLastInflictor = nullptr;
}
#endif // !REGAMEDLL_API
class CPointEntity: public CBaseEntity {
public:

View File

@ -82,10 +82,6 @@ const char *CDeadHEV::m_szPoses[] =
"deadtable"
};
#ifndef REGAMEDLL_API
entvars_t *g_pevLastInflictor;
#endif
LINK_ENTITY_TO_CLASS(player, CBasePlayer, CCSPlayer)
#ifdef REGAMEDLL_API

View File

@ -976,9 +976,6 @@ inline CBasePlayer *UTIL_PlayerByIndexSafe(int playerIndex)
return pPlayer;
}
#ifndef REGAMEDLL_API
extern entvars_t *g_pevLastInflictor;
#endif
extern CBaseEntity *g_pLastSpawn;
extern CBaseEntity *g_pLastCTSpawn;
extern CBaseEntity *g_pLastTerroristSpawn;

View File

@ -98,54 +98,34 @@ inline CBaseEntity *CCSEntity::BaseEntity() const
return this->m_pContainingEntity;
}
#ifdef REGAMEDLL_API
inline void CBaseEntity::SetDmgPenetrationLevel(int iPenetrationLevel)
{
#ifdef REGAMEDLL_API
CSEntity()->m_ucDmgPenetrationLevel = iPenetrationLevel;
#endif
}
inline void CBaseEntity::ResetDmgPenetrationLevel()
{
#ifdef REGAMEDLL_API
CSEntity()->m_ucDmgPenetrationLevel = 0;
#endif
}
inline int CBaseEntity::GetDmgPenetrationLevel() const
{
#ifdef REGAMEDLL_API
return CSEntity()->m_ucDmgPenetrationLevel;
#else
return 0;
#endif
}
inline void CBaseEntity::KilledInflicted(entvars_t* pevInflictor, entvars_t *pevAttacker, int iGib)
inline void CBaseEntity::KilledInflicted(entvars_t *pevInflictor, entvars_t *pevAttacker, int iGib)
{
#ifdef REGAMEDLL_API
CSEntity()->m_pevLastInflictor = pevInflictor;
#else
g_pevLastInflictor = pevInflictor;
#endif
Killed(pevAttacker, iGib);
#ifdef REGAMEDLL_API
CSEntity()->m_pevLastInflictor = nullptr;
#else
g_pevLastInflictor = nullptr;
#endif
}
inline entvars_t* CBaseEntity::GetLastInflictor()
inline entvars_t *CBaseEntity::GetLastInflictor()
{
#ifdef REGAMEDLL_API
return CSEntity()->m_pevLastInflictor;
#else
return g_pevLastInflictor;
#endif
}
#endif
class CCSDelay: public CCSEntity
{