mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2024-12-27 07:05:38 +03:00
Add FreeGameRules hook, util api functions, player api functions (#808)
This commit is contained in:
parent
8ff30b4c3e
commit
eb91f9280d
@ -71,7 +71,11 @@ ReGameFuncs_t g_ReGameApiFuncs = {
|
|||||||
PlantBomb_api,
|
PlantBomb_api,
|
||||||
|
|
||||||
SpawnHeadGib_api,
|
SpawnHeadGib_api,
|
||||||
SpawnRandomGibs_api
|
SpawnRandomGibs_api,
|
||||||
|
|
||||||
|
UTIL_RestartOther_api,
|
||||||
|
UTIL_ResetEntities_api,
|
||||||
|
UTIL_RemoveOther_api,
|
||||||
};
|
};
|
||||||
|
|
||||||
GAMEHOOK_REGISTRY(CBasePlayer_Spawn);
|
GAMEHOOK_REGISTRY(CBasePlayer_Spawn);
|
||||||
@ -204,6 +208,8 @@ GAMEHOOK_REGISTRY(CBasePlayer_Pain);
|
|||||||
GAMEHOOK_REGISTRY(CBasePlayer_DeathSound);
|
GAMEHOOK_REGISTRY(CBasePlayer_DeathSound);
|
||||||
GAMEHOOK_REGISTRY(CBasePlayer_JoiningThink);
|
GAMEHOOK_REGISTRY(CBasePlayer_JoiningThink);
|
||||||
|
|
||||||
|
GAMEHOOK_REGISTRY(FreeGameRules);
|
||||||
|
|
||||||
int CReGameApi::GetMajorVersion() {
|
int CReGameApi::GetMajorVersion() {
|
||||||
return REGAMEDLL_API_VERSION_MAJOR;
|
return REGAMEDLL_API_VERSION_MAJOR;
|
||||||
}
|
}
|
||||||
@ -296,4 +302,17 @@ EXT_FUNC void AddMultiDamage_api(entvars_t *pevInflictor, CBaseEntity *pEntity,
|
|||||||
AddMultiDamage(pevInflictor, pEntity, flDamage, bitsDamageType);
|
AddMultiDamage(pevInflictor, pEntity, flDamage, bitsDamageType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EXT_FUNC void UTIL_RestartOther_api(const char *szClassname) {
|
||||||
|
UTIL_RestartOther(szClassname);
|
||||||
|
}
|
||||||
|
|
||||||
|
EXT_FUNC void UTIL_ResetEntities_api() {
|
||||||
|
UTIL_ResetEntities();
|
||||||
|
}
|
||||||
|
|
||||||
|
EXT_FUNC void UTIL_RemoveOther_api(const char *szClassname, int nCount)
|
||||||
|
{
|
||||||
|
UTIL_RemoveOther(szClassname, nCount);
|
||||||
|
}
|
||||||
|
|
||||||
EXPOSE_SINGLE_INTERFACE(CReGameApi, IReGameApi, VRE_GAMEDLL_API_VERSION);
|
EXPOSE_SINGLE_INTERFACE(CReGameApi, IReGameApi, VRE_GAMEDLL_API_VERSION);
|
||||||
|
@ -641,6 +641,10 @@ typedef IHookChainRegistryClassImpl<void, CBasePlayer> CReGameHookRegistry_CBase
|
|||||||
typedef IHookChainClassImpl<void, CBasePlayer> CReGameHook_CBasePlayer_JoiningThink;
|
typedef IHookChainClassImpl<void, CBasePlayer> CReGameHook_CBasePlayer_JoiningThink;
|
||||||
typedef IHookChainRegistryClassImpl<void, CBasePlayer> CReGameHookRegistry_CBasePlayer_JoiningThink;
|
typedef IHookChainRegistryClassImpl<void, CBasePlayer> CReGameHookRegistry_CBasePlayer_JoiningThink;
|
||||||
|
|
||||||
|
// FreeGameRules hook
|
||||||
|
typedef IHookChainImpl<void, CGameRules **> CReGameHook_FreeGameRules;
|
||||||
|
typedef IHookChainRegistryImpl<void, CGameRules **> CReGameHookRegistry_FreeGameRules;
|
||||||
|
|
||||||
class CReGameHookchains: public IReGameHookchains {
|
class CReGameHookchains: public IReGameHookchains {
|
||||||
public:
|
public:
|
||||||
// CBasePlayer virtual
|
// CBasePlayer virtual
|
||||||
@ -774,6 +778,8 @@ public:
|
|||||||
CReGameHookRegistry_CBasePlayer_DeathSound m_CBasePlayer_DeathSound;
|
CReGameHookRegistry_CBasePlayer_DeathSound m_CBasePlayer_DeathSound;
|
||||||
CReGameHookRegistry_CBasePlayer_JoiningThink m_CBasePlayer_JoiningThink;
|
CReGameHookRegistry_CBasePlayer_JoiningThink m_CBasePlayer_JoiningThink;
|
||||||
|
|
||||||
|
CReGameHookRegistry_FreeGameRules m_FreeGameRules;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual IReGameHookRegistry_CBasePlayer_Spawn *CBasePlayer_Spawn();
|
virtual IReGameHookRegistry_CBasePlayer_Spawn *CBasePlayer_Spawn();
|
||||||
virtual IReGameHookRegistry_CBasePlayer_Precache *CBasePlayer_Precache();
|
virtual IReGameHookRegistry_CBasePlayer_Precache *CBasePlayer_Precache();
|
||||||
@ -904,6 +910,8 @@ public:
|
|||||||
virtual IReGameHookRegistry_CBasePlayer_Pain *CBasePlayer_Pain();
|
virtual IReGameHookRegistry_CBasePlayer_Pain *CBasePlayer_Pain();
|
||||||
virtual IReGameHookRegistry_CBasePlayer_DeathSound *CBasePlayer_DeathSound();
|
virtual IReGameHookRegistry_CBasePlayer_DeathSound *CBasePlayer_DeathSound();
|
||||||
virtual IReGameHookRegistry_CBasePlayer_JoiningThink *CBasePlayer_JoiningThink();
|
virtual IReGameHookRegistry_CBasePlayer_JoiningThink *CBasePlayer_JoiningThink();
|
||||||
|
|
||||||
|
virtual IReGameHookRegistry_FreeGameRules *FreeGameRules();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CReGameHookchains g_ReGameHookchains;
|
extern CReGameHookchains g_ReGameHookchains;
|
||||||
@ -937,3 +945,7 @@ void RadiusDamage_api(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAtta
|
|||||||
void ClearMultiDamage_api();
|
void ClearMultiDamage_api();
|
||||||
void ApplyMultiDamage_api(entvars_t *pevInflictor, entvars_t *pevAttacker);
|
void ApplyMultiDamage_api(entvars_t *pevInflictor, entvars_t *pevAttacker);
|
||||||
void AddMultiDamage_api(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType);
|
void AddMultiDamage_api(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType);
|
||||||
|
|
||||||
|
void UTIL_RestartOther_api(const char *szClassname);
|
||||||
|
void UTIL_ResetEntities_api();
|
||||||
|
void UTIL_RemoveOther_api(const char *szClassname, int nCount = 0);
|
||||||
|
@ -516,6 +516,21 @@ EXT_FUNC bool CCSPlayer::HintMessageEx(const char *pMessage, float duration, boo
|
|||||||
return BasePlayer()->HintMessageEx(pMessage, duration, bDisplayIfPlayerDead, bOverride);
|
return BasePlayer()->HintMessageEx(pMessage, duration, bDisplayIfPlayerDead, bOverride);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EXT_FUNC void CCSPlayer::Reset()
|
||||||
|
{
|
||||||
|
BasePlayer()->Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
EXT_FUNC void CCSPlayer::OnSpawnEquip(bool addDefault, bool equipGame)
|
||||||
|
{
|
||||||
|
BasePlayer()->OnSpawnEquip(addDefault, equipGame);
|
||||||
|
}
|
||||||
|
|
||||||
|
EXT_FUNC void CCSPlayer::SetScoreboardAttributes(CBasePlayer *destination)
|
||||||
|
{
|
||||||
|
BasePlayer()->SetScoreboardAttributes(destination);
|
||||||
|
}
|
||||||
|
|
||||||
EXT_FUNC bool CCSPlayer::CheckActivityInGame()
|
EXT_FUNC bool CCSPlayer::CheckActivityInGame()
|
||||||
{
|
{
|
||||||
const CBasePlayer* pPlayer = BasePlayer();
|
const CBasePlayer* pPlayer = BasePlayer();
|
||||||
@ -528,7 +543,7 @@ EXT_FUNC bool CCSPlayer::CheckActivityInGame()
|
|||||||
return (fabs(deltaYaw) >= 0.1f && fabs(deltaPitch) >= 0.1f);
|
return (fabs(deltaYaw) >= 0.1f && fabs(deltaPitch) >= 0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCSPlayer::Reset()
|
void CCSPlayer::ResetVars()
|
||||||
{
|
{
|
||||||
m_szModel[0] = '\0';
|
m_szModel[0] = '\0';
|
||||||
|
|
||||||
|
@ -727,7 +727,7 @@ void EXT_FUNC ClientPutInServer(edict_t *pEntity)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef REGAMEDLL_API
|
#ifdef REGAMEDLL_API
|
||||||
pPlayer->CSPlayer()->Reset();
|
pPlayer->CSPlayer()->ResetVars();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UTIL_ClientPrintAll(HUD_PRINTNOTIFY, "#Game_connected", (sName[0] != '\0') ? sName : "<unconnected>");
|
UTIL_ClientPrintAll(HUD_PRINTNOTIFY, "#Game_connected", (sName[0] != '\0') ? sName : "<unconnected>");
|
||||||
|
@ -141,3 +141,13 @@ CGameRules *EXT_FUNC __API_HOOK(InstallGameRules)()
|
|||||||
|
|
||||||
return new CHalfLifeMultiplay;
|
return new CHalfLifeMultiplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LINK_HOOK_VOID_CHAIN(FreeGameRules, (CGameRules **pGameRules), pGameRules)
|
||||||
|
|
||||||
|
void EXT_FUNC __API_HOOK(FreeGameRules)(CGameRules **pGameRules)
|
||||||
|
{
|
||||||
|
if (!pGameRules || !(*pGameRules))
|
||||||
|
return;
|
||||||
|
|
||||||
|
delete (*pGameRules);
|
||||||
|
}
|
||||||
|
@ -831,9 +831,11 @@ extern CGameRules DLLEXPORT *g_pGameRules;
|
|||||||
|
|
||||||
#ifdef REGAMEDLL_API
|
#ifdef REGAMEDLL_API
|
||||||
CGameRules *InstallGameRules_OrigFunc();
|
CGameRules *InstallGameRules_OrigFunc();
|
||||||
|
void FreeGameRules_OrigFunc(CGameRules **pGameRules);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CGameRules *InstallGameRules();
|
CGameRules *InstallGameRules();
|
||||||
|
void FreeGameRules(CGameRules **pGameRules);
|
||||||
|
|
||||||
// Gets us at the CS game rules
|
// Gets us at the CS game rules
|
||||||
inline CHalfLifeMultiplay *CSGameRules()
|
inline CHalfLifeMultiplay *CSGameRules()
|
||||||
|
@ -288,11 +288,7 @@ void CWorld::Precache()
|
|||||||
CVAR_SET_STRING("room_type", "0");
|
CVAR_SET_STRING("room_type", "0");
|
||||||
|
|
||||||
// Set up game rules
|
// Set up game rules
|
||||||
if (g_pGameRules)
|
FreeGameRules(&g_pGameRules);
|
||||||
{
|
|
||||||
delete g_pGameRules;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_pGameRules = InstallGameRules();
|
g_pGameRules = InstallGameRules();
|
||||||
|
|
||||||
// NOTE: What is the essence of soundent in CS 1.6? I think this is for NPC monsters - s1lent
|
// NOTE: What is the essence of soundent in CS 1.6? I think this is for NPC monsters - s1lent
|
||||||
|
@ -100,8 +100,11 @@ public:
|
|||||||
virtual void SetSpawnProtection(float flProtectionTime);
|
virtual void SetSpawnProtection(float flProtectionTime);
|
||||||
virtual void RemoveSpawnProtection();
|
virtual void RemoveSpawnProtection();
|
||||||
virtual bool HintMessageEx(const char *pMessage, float duration = 6.0f, bool bDisplayIfPlayerDead = false, bool bOverride = false);
|
virtual bool HintMessageEx(const char *pMessage, float duration = 6.0f, bool bDisplayIfPlayerDead = false, bool bOverride = false);
|
||||||
|
virtual void Reset();
|
||||||
|
virtual void OnSpawnEquip(bool addDefault = true, bool equipGame = true);
|
||||||
|
virtual void SetScoreboardAttributes(CBasePlayer *destination = nullptr);
|
||||||
|
|
||||||
void Reset();
|
void ResetVars();
|
||||||
|
|
||||||
void OnSpawn();
|
void OnSpawn();
|
||||||
void OnKilled();
|
void OnKilled();
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include <API/CSInterfaces.h>
|
#include <API/CSInterfaces.h>
|
||||||
|
|
||||||
#define REGAMEDLL_API_VERSION_MAJOR 5
|
#define REGAMEDLL_API_VERSION_MAJOR 5
|
||||||
#define REGAMEDLL_API_VERSION_MINOR 21
|
#define REGAMEDLL_API_VERSION_MINOR 22
|
||||||
|
|
||||||
// CBasePlayer::Spawn hook
|
// CBasePlayer::Spawn hook
|
||||||
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_Spawn;
|
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_Spawn;
|
||||||
@ -520,6 +520,10 @@ typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBa
|
|||||||
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_JoiningThink;
|
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_JoiningThink;
|
||||||
typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBasePlayer_JoiningThink;
|
typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBasePlayer_JoiningThink;
|
||||||
|
|
||||||
|
// FreeGameRules hook
|
||||||
|
typedef IHookChain<void, class CGameRules **> IReGameHook_FreeGameRules;
|
||||||
|
typedef IHookChainRegistry<void, class CGameRules **> IReGameHookRegistry_FreeGameRules;
|
||||||
|
|
||||||
class IReGameHookchains {
|
class IReGameHookchains {
|
||||||
public:
|
public:
|
||||||
virtual ~IReGameHookchains() {}
|
virtual ~IReGameHookchains() {}
|
||||||
@ -653,6 +657,8 @@ public:
|
|||||||
virtual IReGameHookRegistry_CBasePlayer_Pain *CBasePlayer_Pain() = 0;
|
virtual IReGameHookRegistry_CBasePlayer_Pain *CBasePlayer_Pain() = 0;
|
||||||
virtual IReGameHookRegistry_CBasePlayer_DeathSound *CBasePlayer_DeathSound() = 0;
|
virtual IReGameHookRegistry_CBasePlayer_DeathSound *CBasePlayer_DeathSound() = 0;
|
||||||
virtual IReGameHookRegistry_CBasePlayer_JoiningThink *CBasePlayer_JoiningThink() = 0;
|
virtual IReGameHookRegistry_CBasePlayer_JoiningThink *CBasePlayer_JoiningThink() = 0;
|
||||||
|
|
||||||
|
virtual IReGameHookRegistry_FreeGameRules *FreeGameRules() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ReGameFuncs_t {
|
struct ReGameFuncs_t {
|
||||||
@ -670,6 +676,9 @@ struct ReGameFuncs_t {
|
|||||||
class CGrenade *(*PlantBomb)(entvars_t *pevOwner, Vector &vecStart, Vector &vecVelocity);
|
class CGrenade *(*PlantBomb)(entvars_t *pevOwner, Vector &vecStart, Vector &vecVelocity);
|
||||||
class CGib *(*SpawnHeadGib)(entvars_t* pevVictim);
|
class CGib *(*SpawnHeadGib)(entvars_t* pevVictim);
|
||||||
void (*SpawnRandomGibs)(entvars_t* pevVictim, int cGibs, int human);
|
void (*SpawnRandomGibs)(entvars_t* pevVictim, int cGibs, int human);
|
||||||
|
void (*UTIL_RestartOther)(const char *szClassname);
|
||||||
|
void (*UTIL_ResetEntities)();
|
||||||
|
void (*UTIL_RemoveOther)(const char *szClassname, int nCount);
|
||||||
};
|
};
|
||||||
|
|
||||||
class IReGameApi {
|
class IReGameApi {
|
||||||
|
@ -6,5 +6,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define VERSION_MAJOR 5
|
#define VERSION_MAJOR 5
|
||||||
#define VERSION_MINOR 21
|
#define VERSION_MINOR 22
|
||||||
#define VERSION_MAINTENANCE 0
|
#define VERSION_MAINTENANCE 0
|
||||||
|
Loading…
Reference in New Issue
Block a user