mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-01-16 00:28:15 +03:00
Refactoring ReGame-API
This commit is contained in:
parent
ab4a8437ce
commit
d75089461c
@ -268,7 +268,10 @@ public:
|
|||||||
virtual int GetMinorVersion() = 0;
|
virtual int GetMinorVersion() = 0;
|
||||||
virtual const ReGameFuncs_t* GetFuncs() = 0;
|
virtual const ReGameFuncs_t* GetFuncs() = 0;
|
||||||
virtual IReGameHookchains* GetHookchains() = 0;
|
virtual IReGameHookchains* GetHookchains() = 0;
|
||||||
virtual IReGameData* GetGameData() = 0;
|
|
||||||
|
virtual class CGameRules* GetGameRules() = 0;
|
||||||
|
virtual struct WeaponInfoStruct *GetWeaponInfo(int weaponID) = 0;
|
||||||
|
virtual struct playermove_s *GetPlayerMove() = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2071,12 +2071,3 @@ public:
|
|||||||
virtual void Spawn() = 0;
|
virtual void Spawn() = 0;
|
||||||
virtual void KeyValue(struct KeyValueData_s *pkvd) = 0;
|
virtual void KeyValue(struct KeyValueData_s *pkvd) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IReGameData {
|
|
||||||
public:
|
|
||||||
virtual ~IReGameData() {}
|
|
||||||
|
|
||||||
virtual class CGameRules* GetGameRules() = 0;
|
|
||||||
virtual struct WeaponInfoStruct *GetWeaponInfo(int weaponID) = 0;
|
|
||||||
virtual struct playermove_s *GetPlayerMove() = 0;
|
|
||||||
};
|
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include "precompiled.h"
|
#include "precompiled.h"
|
||||||
|
|
||||||
CReGameHookchains g_ReGameHookchains;
|
CReGameHookchains g_ReGameHookchains;
|
||||||
CReGameData g_ReGameData;
|
|
||||||
|
|
||||||
ReGameFuncs_t g_ReGameApiFuncs = {
|
ReGameFuncs_t g_ReGameApiFuncs = {
|
||||||
&UTIL_PlayerByIndex,
|
&UTIL_PlayerByIndex,
|
||||||
@ -113,9 +112,16 @@ IReGameHookchains *CReGameApi::GetHookchains()
|
|||||||
return &g_ReGameHookchains;
|
return &g_ReGameHookchains;
|
||||||
}
|
}
|
||||||
|
|
||||||
IReGameData *CReGameApi::GetGameData()
|
CGameRules* EXT_FUNC CReGameApi::GetGameRules() {
|
||||||
{
|
return g_pGameRules;
|
||||||
return &g_ReGameData;
|
}
|
||||||
|
|
||||||
|
WeaponInfoStruct* EXT_FUNC CReGameApi::GetWeaponInfo(int weaponID) {
|
||||||
|
return ::GetWeaponInfo(weaponID);
|
||||||
|
}
|
||||||
|
|
||||||
|
playermove_t* EXT_FUNC CReGameApi::GetPlayerMove() {
|
||||||
|
return pmove;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EXT_FUNC Regamedll_ChangeString_api(char *&dest, const char *source)
|
void EXT_FUNC Regamedll_ChangeString_api(char *&dest, const char *source)
|
||||||
|
@ -279,7 +279,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern CReGameHookchains g_ReGameHookchains;
|
extern CReGameHookchains g_ReGameHookchains;
|
||||||
extern CReGameData g_ReGameData;
|
|
||||||
extern ReGameFuncs_t g_ReGameApiFuncs;
|
extern ReGameFuncs_t g_ReGameApiFuncs;
|
||||||
|
|
||||||
class CReGameApi: public IReGameApi {
|
class CReGameApi: public IReGameApi {
|
||||||
@ -289,7 +288,10 @@ public:
|
|||||||
|
|
||||||
virtual const ReGameFuncs_t *GetFuncs();
|
virtual const ReGameFuncs_t *GetFuncs();
|
||||||
virtual IReGameHookchains *GetHookchains();
|
virtual IReGameHookchains *GetHookchains();
|
||||||
virtual IReGameData* GetGameData();
|
|
||||||
|
virtual CGameRules* GetGameRules();
|
||||||
|
virtual WeaponInfoStruct *GetWeaponInfo(int weaponID);
|
||||||
|
virtual playermove_t *GetPlayerMove();
|
||||||
};
|
};
|
||||||
|
|
||||||
void Regamedll_ChangeString_api(char *&dest, const char *source);
|
void Regamedll_ChangeString_api(char *&dest, const char *source);
|
||||||
|
@ -134,15 +134,3 @@ ICSEntity *EXT_FUNC INDEX_TO_CSENTITY(int iEntityIndex)
|
|||||||
CBaseEntity *pEntity = CBaseEntity::Instance(INDEXENT(iEntityIndex));
|
CBaseEntity *pEntity = CBaseEntity::Instance(INDEXENT(iEntityIndex));
|
||||||
return CBASE_TO_CSENTITY(pEntity);
|
return CBASE_TO_CSENTITY(pEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGameRules* EXT_FUNC CReGameData::GetGameRules() {
|
|
||||||
return g_pGameRules;
|
|
||||||
}
|
|
||||||
|
|
||||||
WeaponInfoStruct* EXT_FUNC CReGameData::GetWeaponInfo(int weaponID) {
|
|
||||||
return ::GetWeaponInfo(weaponID);
|
|
||||||
}
|
|
||||||
|
|
||||||
playermove_t* EXT_FUNC CReGameData::GetPlayerMove() {
|
|
||||||
return pmove;
|
|
||||||
}
|
|
||||||
|
@ -2520,13 +2520,6 @@ public:
|
|||||||
virtual void KeyValue(KeyValueData *pkvd) { m_pEntity->KeyValue(pkvd); }
|
virtual void KeyValue(KeyValueData *pkvd) { m_pEntity->KeyValue(pkvd); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class CReGameData: public IReGameData {
|
|
||||||
public:
|
|
||||||
virtual CGameRules* GetGameRules();
|
|
||||||
virtual WeaponInfoStruct *GetWeaponInfo(int weaponID);
|
|
||||||
virtual playermove_t *GetPlayerMove();
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T *Regamedll_InitializeEntities(CBaseEntity *a)
|
inline T *Regamedll_InitializeEntities(CBaseEntity *a)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user