Added api hook CBasePlayer::DropPlayerItem

This commit is contained in:
s1lentq 2016-06-20 14:05:47 +07:00
parent f071682392
commit a1e7b9dae5
8 changed files with 25 additions and 3 deletions

View File

@ -7300,7 +7300,9 @@ void CBasePlayer::UpdateStatusBar()
}
}
void CBasePlayer::DropPlayerItem(const char *pszItemName)
LINK_HOOK_CLASS_VOID_CHAIN(CBasePlayer, DropPlayerItem, (const char *pszItemName), pszItemName);
void CBasePlayer::__API_HOOK(DropPlayerItem)(const char *pszItemName)
{
if (!Q_strlen(pszItemName))
{

View File

@ -493,6 +493,7 @@ public:
void StartObserver(Vector vecPosition, Vector vecViewAngle);
void HandleSignals();
void DropPlayerItem(const char *pszItemName);
void DropPlayerItem_(const char *pszItemName);
BOOL HasPlayerItem(CBasePlayerItem *pCheckItem);
BOOL HasNamedPlayerItem(const char *pszItemName);
BOOL HasWeapons();

View File

@ -93,6 +93,7 @@ extern globalvars_t *gpGlobals;
#define SND_CHANGE_VOL (1<<6) // duplicated in protocol.h change sound vol
#define SND_CHANGE_PITCH (1<<7) // duplicated in protocol.h change sound pitch
// All monsters need this data
#define DONT_BLEED -1
#define BLOOD_COLOR_RED (byte)247
#define BLOOD_COLOR_YELLOW (byte)195

View File

@ -32,6 +32,7 @@
#include "interface.h"
#include "player.h"
#include "gamerules.h"
#include "client.h"
#define REGAMEDLL_API_VERSION_MAJOR 3
#define REGAMEDLL_API_VERSION_MINOR 1
@ -124,7 +125,6 @@ typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBase
typedef IVoidHookChainClass<class CBasePlayer, float, float, float, int> IReGameHook_CBasePlayer_Blind;
typedef IVoidHookChainRegistryClass<class CBasePlayer, float, float, float, int> IReGameHookRegistry_CBasePlayer_Blind;
// CBasePlayer::Observer_IsValidTarget hook
typedef IHookChainClass<class CBasePlayer *, class CBasePlayer, int, bool> IReGameHook_CBasePlayer_Observer_IsValidTarget;
typedef IHookChainRegistryClass<class CBasePlayer *, class CBasePlayer, int, bool> IReGameHookRegistry_CBasePlayer_Observer_IsValidTarget;
@ -305,6 +305,10 @@ typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_BalanceTeams;
typedef IHookChain<bool, class CBasePlayer *, BuyItemID> IReGameHook_CanBuyThisItem;
typedef IHookChainRegistry<bool, class CBasePlayer *, BuyItemID> IReGameHookRegistry_CanBuyThisItem;
// CBasePlayer::DropPlayerItem hook
typedef IVoidHookChainClass<class CBasePlayer, const char *> IReGameHook_CBasePlayer_DropPlayerItem;
typedef IVoidHookChainRegistryClass<class CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_DropPlayerItem;
class IReGameHookchains {
public:
virtual ~IReGameHookchains() {}
@ -380,6 +384,7 @@ public:
virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams() = 0;
virtual IReGameHookRegistry_CanBuyThisItem* CanBuyThisItem() = 0;
virtual IReGameHookRegistry_CBasePlayer_DropPlayerItem* CBasePlayer_DropPlayerItem() = 0;
};
struct ReGameFuncs_t {

View File

@ -57,6 +57,7 @@ extern globalvars_t *gpGlobals;
#define SND_CHANGE_VOL (1<<6) // duplicated in protocol.h change sound vol
#define SND_CHANGE_PITCH (1<<7) // duplicated in protocol.h change sound pitch
// All monsters need this data
#define DONT_BLEED -1
#define BLOOD_COLOR_RED (byte)247
#define BLOOD_COLOR_YELLOW (byte)195

View File

@ -32,6 +32,7 @@
#include "interface.h"
#include "player.h"
#include "gamerules.h"
#include "client.h"
#define REGAMEDLL_API_VERSION_MAJOR 3
#define REGAMEDLL_API_VERSION_MINOR 1
@ -124,7 +125,6 @@ typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBase
typedef IVoidHookChainClass<class CBasePlayer, float, float, float, int> IReGameHook_CBasePlayer_Blind;
typedef IVoidHookChainRegistryClass<class CBasePlayer, float, float, float, int> IReGameHookRegistry_CBasePlayer_Blind;
// CBasePlayer::Observer_IsValidTarget hook
typedef IHookChainClass<class CBasePlayer *, class CBasePlayer, int, bool> IReGameHook_CBasePlayer_Observer_IsValidTarget;
typedef IHookChainRegistryClass<class CBasePlayer *, class CBasePlayer, int, bool> IReGameHookRegistry_CBasePlayer_Observer_IsValidTarget;
@ -305,6 +305,10 @@ typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_BalanceTeams;
typedef IHookChain<bool, class CBasePlayer *, BuyItemID> IReGameHook_CanBuyThisItem;
typedef IHookChainRegistry<bool, class CBasePlayer *, BuyItemID> IReGameHookRegistry_CanBuyThisItem;
// CBasePlayer::DropPlayerItem hook
typedef IVoidHookChainClass<class CBasePlayer, const char *> IReGameHook_CBasePlayer_DropPlayerItem;
typedef IVoidHookChainRegistryClass<class CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_DropPlayerItem;
class IReGameHookchains {
public:
virtual ~IReGameHookchains() {}
@ -380,6 +384,7 @@ public:
virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams() = 0;
virtual IReGameHookRegistry_CanBuyThisItem* CanBuyThisItem() = 0;
virtual IReGameHookRegistry_CBasePlayer_DropPlayerItem* CBasePlayer_DropPlayerItem() = 0;
};
struct ReGameFuncs_t {

View File

@ -115,6 +115,7 @@ IReGameHookRegistry_CSGameRules_GoToIntermission* CReGameHookchains::CSGameRules
IReGameHookRegistry_CSGameRules_BalanceTeams* CReGameHookchains::CSGameRules_BalanceTeams() { return &m_CSGameRules_BalanceTeams; }
IReGameHookRegistry_CanBuyThisItem* CReGameHookchains::CanBuyThisItem() { return &m_CanBuyThisItem; }
IReGameHookRegistry_CBasePlayer_DropPlayerItem* CReGameHookchains::CBasePlayer_DropPlayerItem() { return &m_CBasePlayer_DropPlayerItem; }
int CReGameApi::GetMajorVersion()
{

View File

@ -300,6 +300,10 @@ typedef IVoidHookChainRegistryClassEmptyImpl<class CHalfLifeMultiplay> CReGameHo
typedef IHookChainImpl<bool, class CBasePlayer *, BuyItemID> CReGameHook_CanBuyThisItem;
typedef IHookChainRegistryImpl<bool, class CBasePlayer *, BuyItemID> CReGameHookRegistry_CanBuyThisItem;
// CBasePlayer::DropPlayerItem hook
typedef IVoidHookChainClassImpl<CBasePlayer, const char *> CReGameHook_CBasePlayer_DropPlayerItem;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, const char *> CReGameHookRegistry_CBasePlayer_DropPlayerItem;
class CReGameHookchains: public IReGameHookchains {
public:
// CBasePlayer virtual
@ -374,6 +378,7 @@ public:
CReGameHookRegistry_CSGameRules_BalanceTeams m_CSGameRules_BalanceTeams;
CReGameHookRegistry_CanBuyThisItem m_CanBuyThisItem;
CReGameHookRegistry_CBasePlayer_DropPlayerItem m_CBasePlayer_DropPlayerItem;
public:
virtual IReGameHookRegistry_CBasePlayer_Spawn* CBasePlayer_Spawn();
@ -447,6 +452,7 @@ public:
virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams();
virtual IReGameHookRegistry_CanBuyThisItem* CanBuyThisItem();
virtual IReGameHookRegistry_CBasePlayer_DropPlayerItem* CBasePlayer_DropPlayerItem();
};
extern CReGameHookchains g_ReGameHookchains;