2
0
mirror of https://github.com/rehlds/reapi.git synced 2025-01-13 15:18:02 +03:00

Add new hookschain's: BuyGunAmmo, BuyWeaponByWeaponID,

CBasePlayer::DropShield, CBasePlayer::OnSpawnEquip,
CBasePlayer::Radio, CBasePlayer::Disappear, CBasePlayer::MakeVIP,
CBasePlayer::MakeBomber, CBasePlayer::StartObserver, CBasePlayer::GetIntoGame

Bump minor version
This commit is contained in:
s1lentq 2017-01-15 21:56:39 +07:00
parent 71d670541b
commit 001d26c359
7 changed files with 226 additions and 6 deletions

2
.gitignore vendored
View File

@ -9,7 +9,7 @@
**/msvc/*.user
**/msvc/*.suo
**/msvc/*.aps
**/msvc/start*.bat
**/msvc/START*.bat
**/msvc/ipch
**/PublishPath*.txt
**/*.log

View File

@ -1,3 +1,3 @@
majorVersion=5
minorVersion=0
minorVersion=1
maintenanceVersion=0

View File

@ -210,7 +210,21 @@ enum GamedllFunc
* Description: -
* Params: (const index, VGUIMenu:menuType, const bitsSlots, szOldMenu[], bool:bForceOldMenu)
*/
RG_ShowVGUIMenu
RG_ShowVGUIMenu,
/*
* Description: The player buys ammo.
* Return type: bool
* Params: (const index, const weapon_entity, const bool:blinkMoney)
*/
RG_BuyGunAmmo,
/*
* Description: -
* Return type: CBaseEntity * (Entity index of weapon)
* Params: (const index, const WeaponIdType:weaponID)
*/
RG_BuyWeaponByWeaponID
};
enum GamedllFunc_CBaseAnimating
@ -394,6 +408,7 @@ enum GamedllFunc_CBasePlayer
/*
* Description: -
* Return type: CBaseEntity * (Entity index of item)
* Params: (const this, const pszName[])
*/
RG_CBasePlayer_GiveNamedItem,
@ -420,7 +435,58 @@ enum GamedllFunc_CBasePlayer
* Description: -
* Params: (const this, ItemID:item, ItemRestType:type)
*/
RG_CBasePlayer_HasRestrictItem
RG_CBasePlayer_HasRestrictItem,
/*
* Description: It is called when a player threw the shield to the ground.
* Params: (const this, bool:deploy)
*/
RG_CBasePlayer_DropShield,
/*
* Description: It is called on the spawn, the attempt to equip player.
* Params: (const this, bool addDefault, bool equipGame)
*/
RG_CBasePlayer_OnSpawnEquip,
/*
* Description: The player uses a radio message.
* It is called self-uses radio or throw grenades or on freeze the period end.
* Params: (const this, const msg_id[], const char msg_verbose[], pitch, bool:showIcon)
*/
RG_CBasePlayer_Radio,
/*
* Description: VIP player got to the point of rescue.
* Params: (const this)
*/
RG_CBasePlayer_Disappear,
/*
* Description: Makes a random player the VIP.
* Params: (const this)
*/
RG_CBasePlayer_MakeVIP,
/*
* Description: Makes a random player the bomber.
* Return type: bool
* Params: (const this)
*/
RG_CBasePlayer_MakeBomber,
/*
* Description: The player goes into observer mode.
* Params: (const this, Float:vecPosition[3], Float:vecViewAngle[3])
*/
RG_CBasePlayer_StartObserver,
/*
* Description: It is called when a player enters the game.
* Return type: bool
* Params: (const this)
*/
RG_CBasePlayer_GetIntoGame
};
@ -558,7 +624,13 @@ enum GamedllFunc_CSGameRules
* Description: -
* Params: ()
*/
RG_CSGameRules_BalanceTeams
RG_CSGameRules_BalanceTeams,
/*
* Description: It's called on freeze the period end.
* Params: ()
*/
RG_CSGameRules_OnRoundFreezeEnd
};
// CSGameRules

View File

@ -371,6 +371,88 @@ void CBasePlayer_DropPlayerItem(IReGameHook_CBasePlayer_DropPlayerItem *chain, C
callVoidForward(RG_CBasePlayer_DropPlayerItem, original, indexOfEdict(pthis->pev), pszItemName);
}
void CBasePlayer_DropShield(IReGameHook_CBasePlayer_DropShield *chain, CBasePlayer *pthis, bool bDeploy)
{
auto original = [chain](int _pthis, bool _bDeploy)
{
chain->callNext(getPrivate<CBasePlayer>(_pthis), _bDeploy);
};
callVoidForward(RG_CBasePlayer_DropShield, original, indexOfEdict(pthis->pev), bDeploy);
}
void CBasePlayer_OnSpawnEquip(IReGameHook_CBasePlayer_OnSpawnEquip *chain, CBasePlayer *pthis, bool addDefault, bool equipGame)
{
auto original = [chain](int _pthis, bool _addDefault, bool _equipGame)
{
chain->callNext(getPrivate<CBasePlayer>(_pthis), _addDefault, _equipGame);
};
callVoidForward(RG_CBasePlayer_OnSpawnEquip, original, indexOfEdict(pthis->pev), addDefault, equipGame);
}
void CBasePlayer_Radio(IReGameHook_CBasePlayer_Radio *chain, CBasePlayer *pthis, const char *msg_id, const char *msg_verbose, short pitch, bool showIcon)
{
auto original = [chain](int _pthis, const char *_msg_id, const char *_msg_verbose, short _pitch, bool _showIcon)
{
chain->callNext(getPrivate<CBasePlayer>(_pthis), _msg_id, _msg_verbose, _pitch, _showIcon);
};
callVoidForward(RG_CBasePlayer_Radio, original, indexOfEdict(pthis->pev), msg_id, msg_verbose, pitch, showIcon);
}
void CBasePlayer_Disappear(IReGameHook_CBasePlayer_Disappear *chain, CBasePlayer *pthis)
{
auto original = [chain](int _pthis)
{
chain->callNext(getPrivate<CBasePlayer>(_pthis));
};
callVoidForward(RG_CBasePlayer_Disappear, original, indexOfEdict(pthis->pev));
}
void CBasePlayer_MakeVIP(IReGameHook_CBasePlayer_MakeVIP *chain, CBasePlayer *pthis)
{
auto original = [chain](int _pthis)
{
chain->callNext(getPrivate<CBasePlayer>(_pthis));
};
callVoidForward(RG_CBasePlayer_MakeVIP, original, indexOfEdict(pthis->pev));
}
bool CBasePlayer_MakeBomber(IReGameHook_CBasePlayer_MakeBomber *chain, CBasePlayer *pthis)
{
auto original = [chain](int _pthis)
{
return chain->callNext(getPrivate<CBasePlayer>(_pthis));
};
return callForward<bool>(RG_CBasePlayer_MakeBomber, original, indexOfEdict(pthis->pev));
}
void CBasePlayer_StartObserver(IReGameHook_CBasePlayer_StartObserver *chain, CBasePlayer *pthis, Vector &vecPosition, Vector &vecViewAngle)
{
Vector vecPositionCopy(vecPosition), vecViewAngleCopy(vecViewAngle);
auto original = [chain, &vecPositionCopy, &vecViewAngleCopy](int _pthis, cell _vecPosition, cell _vecViewAngle)
{
chain->callNext(getPrivate<CBasePlayer>(_pthis), vecPositionCopy, vecViewAngleCopy);
};
callVoidForward(RG_CBasePlayer_StartObserver, original, indexOfEdict(pthis->pev), g_amxxapi.PrepareCellArrayA(reinterpret_cast<cell *>(&vecPosition), 3, true), g_amxxapi.PrepareCellArrayA(reinterpret_cast<cell *>(&vecViewAngle), 3, true));
}
bool CBasePlayer_GetIntoGame(IReGameHook_CBasePlayer_GetIntoGame *chain, CBasePlayer *pthis)
{
auto original = [chain](int _pthis)
{
return chain->callNext(getPrivate<CBasePlayer>(_pthis));
};
return callForward<bool>(RG_CBasePlayer_GetIntoGame, original, indexOfEdict(pthis->pev));
}
void CBaseAnimating_ResetSequenceInfo(IReGameHook_CBaseAnimating_ResetSequenceInfo *chain, CBaseAnimating *pthis)
{
auto original = [chain](int _pthis)
@ -665,6 +747,16 @@ void CSGameRules_BalanceTeams(IReGameHook_CSGameRules_BalanceTeams *chain)
callVoidForward(RG_CSGameRules_BalanceTeams, original);
}
void CSGameRules_OnRoundFreezeEnd(IReGameHook_CSGameRules_OnRoundFreezeEnd *chain)
{
auto original = [chain]()
{
chain->callNext();
};
callVoidForward(RG_CSGameRules_OnRoundFreezeEnd, original);
}
void HandleMenu_ChooseAppearance(IReGameHook_HandleMenu_ChooseAppearance *chain, CBasePlayer *pPlayer, int slot)
{
auto original = [chain](int _pPlayer, int _slot)
@ -705,6 +797,26 @@ void ShowVGUIMenu(IReGameHook_ShowVGUIMenu *chain, CBasePlayer *pPlayer, int Men
callVoidForward(RG_ShowVGUIMenu, original, indexOfEdict(pPlayer->pev), MenuType, BitMask, szOldMenu);
}
bool BuyGunAmmo(IReGameHook_BuyGunAmmo *chain, CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney)
{
auto original = [chain](int _player, int _weapon, bool _bBlinkMoney)
{
return chain->callNext(getPrivate<CBasePlayer>(_player), getPrivate<CBasePlayerItem>(_weapon), _bBlinkMoney);
};
return callForward<bool>(RG_BuyGunAmmo, original, indexOfEdict(player->pev), indexOfEdict(weapon->pev), bBlinkMoney);
}
CBaseEntity *BuyWeaponByWeaponID(IReGameHook_BuyWeaponByWeaponID *chain, CBasePlayer *pPlayer, WeaponIdType weaponID)
{
auto original = [chain](int _pPlayer, WeaponIdType _weaponID)
{
return indexOfPDataAmx(chain->callNext(getPrivate<CBasePlayer>(_pPlayer), _weaponID));
};
return getPrivate<CBaseEntity>(callForward<size_t>(RG_BuyWeaponByWeaponID, original, indexOfEdict(pPlayer->pev), weaponID));
}
int g_iClientStartSpeak, g_iClientStopSpeak;
void OnClientStartSpeak(size_t clientIndex)

View File

@ -292,6 +292,8 @@ void HandleMenu_ChooseAppearance(IReGameHook_HandleMenu_ChooseAppearance *chain,
BOOL HandleMenu_ChooseTeam(IReGameHook_HandleMenu_ChooseTeam *chain, CBasePlayer *pPlayer, int slot);
void ShowMenu(IReGameHook_ShowMenu *chain, CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText);
void ShowVGUIMenu(IReGameHook_ShowVGUIMenu *chain, CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu);
bool BuyGunAmmo(IReGameHook_BuyGunAmmo *chain, CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney);
CBaseEntity *BuyWeaponByWeaponID(IReGameHook_BuyWeaponByWeaponID *chain, CBasePlayer *pPlayer, WeaponIdType weaponID);
// regamedll functions - player
void CBasePlayer_Spawn(IReGameHook_CBasePlayer_Spawn *chain, CBasePlayer *pthis);
@ -327,6 +329,14 @@ void CBasePlayer_SetClientUserInfoModel(IReGameHook_CBasePlayer_SetClientUserInf
bool CBasePlayer_SetClientUserInfoName(IReGameHook_CBasePlayer_SetClientUserInfoName *chain, CBasePlayer *pthis, char *infobuffer, char *szNewName);
bool CBasePlayer_HasRestrictItem(IReGameHook_CBasePlayer_HasRestrictItem *chain, CBasePlayer *pthis, ItemID item, ItemRestType type);
void CBasePlayer_DropPlayerItem(IReGameHook_CBasePlayer_DropPlayerItem *chain, CBasePlayer *pthis, const char *pszItemName);
void CBasePlayer_DropShield(IReGameHook_CBasePlayer_DropShield *chain, CBasePlayer *pthis, bool bDeploy);
void CBasePlayer_OnSpawnEquip(IReGameHook_CBasePlayer_OnSpawnEquip *chain, CBasePlayer *pthis, bool addDefault, bool equipGame);
void CBasePlayer_Radio(IReGameHook_CBasePlayer_Radio *chain, CBasePlayer *pthis, const char *msg_id, const char *msg_verbose, short pitch, bool showIcon);
void CBasePlayer_Disappear(IReGameHook_CBasePlayer_Disappear *chain, CBasePlayer *pthis);
void CBasePlayer_MakeVIP(IReGameHook_CBasePlayer_MakeVIP *chain, CBasePlayer *pthis);
bool CBasePlayer_MakeBomber(IReGameHook_CBasePlayer_MakeBomber *chain, CBasePlayer *pthis);
void CBasePlayer_StartObserver(IReGameHook_CBasePlayer_StartObserver *chain, CBasePlayer *pthis, Vector &vecPosition, Vector &vecViewAngle);
bool CBasePlayer_GetIntoGame(IReGameHook_CBasePlayer_GetIntoGame *chain, CBasePlayer *pthis);
void CBaseAnimating_ResetSequenceInfo(IReGameHook_CBaseAnimating_ResetSequenceInfo *chain, CBaseAnimating *pthis);
@ -352,6 +362,7 @@ void CSGameRules_GiveC4(IReGameHook_CSGameRules_GiveC4 *chain);
void CSGameRules_ChangeLevel(IReGameHook_CSGameRules_ChangeLevel *chain);
void CSGameRules_GoToIntermission(IReGameHook_CSGameRules_GoToIntermission *chain);
void CSGameRules_BalanceTeams(IReGameHook_CSGameRules_BalanceTeams *chain);
void CSGameRules_OnRoundFreezeEnd(IReGameHook_CSGameRules_OnRoundFreezeEnd *chain);
extern int g_iClientStartSpeak;
extern int g_iClientStopSpeak;

View File

@ -1,9 +1,11 @@
#include "precompiled.h"
inline size_t getFwdParamType(void(*)(int)) { return FP_CELL; }
inline size_t getFwdParamType(void(*)(short)) { return FP_CELL; }
inline size_t getFwdParamType(void(*)(bool)) { return FP_CELL; }
inline size_t getFwdParamType(void(*)(Vector&)) { return FP_ARRAY; }
inline size_t getFwdParamType(void(*)(PLAYER_ANIM)) { return FP_CELL; }
inline size_t getFwdParamType(void(*)(WeaponIdType)) { return FP_CELL; }
inline size_t getFwdParamType(void(*)(RewardType)) { return FP_CELL; }
inline size_t getFwdParamType(void(*)(ScenarioEventEndRound)) { return FP_CELL; }
inline size_t getFwdParamType(void(*)(ItemID)) { return FP_CELL; }
@ -84,6 +86,8 @@ hook_t hooklist_gamedll[] = {
DLL(HandleMenu_ChooseTeam),
DLL(ShowMenu),
DLL(ShowVGUIMenu),
DLL(BuyGunAmmo),
DLL(BuyWeaponByWeaponID),
};
hook_t hooklist_animating[] = {
@ -124,6 +128,14 @@ hook_t hooklist_player[] = {
DLL(CBasePlayer_GiveShield),
DLL(CBasePlayer_DropPlayerItem),
DLL(CBasePlayer_HasRestrictItem),
DLL(CBasePlayer_DropShield),
DLL(CBasePlayer_OnSpawnEquip),
DLL(CBasePlayer_Radio),
DLL(CBasePlayer_Disappear),
DLL(CBasePlayer_MakeVIP),
DLL(CBasePlayer_MakeBomber),
DLL(CBasePlayer_StartObserver),
DLL(CBasePlayer_GetIntoGame),
};
hook_t hooklist_gamerules[] = {
@ -149,6 +161,7 @@ hook_t hooklist_gamerules[] = {
DLL(CSGameRules_ChangeLevel),
DLL(CSGameRules_GoToIntermission),
DLL(CSGameRules_BalanceTeams),
DLL(CSGameRules_OnRoundFreezeEnd),
};
hook_t* hooklist_t::getHookSafe(size_t hook)

View File

@ -95,6 +95,9 @@ enum GamedllFunc
RG_ShowMenu,
RG_ShowVGUIMenu,
RG_BuyGunAmmo,
RG_BuyWeaponByWeaponID,
// [...]
};
@ -142,6 +145,15 @@ enum GamedllFunc_CBasePlayer
RG_CBasePlayer_DropPlayerItem,
RG_CBasePlayer_HasRestrictItem,
RG_CBasePlayer_DropShield,
RG_CBasePlayer_OnSpawnEquip,
RG_CBasePlayer_Radio,
RG_CBasePlayer_Disappear,
RG_CBasePlayer_MakeVIP,
RG_CBasePlayer_MakeBomber,
RG_CBasePlayer_StartObserver,
RG_CBasePlayer_GetIntoGame,
// [...]
};
@ -169,8 +181,8 @@ enum GamedllFunc_CSGameRules
RG_CSGameRules_GiveC4,
RG_CSGameRules_ChangeLevel,
RG_CSGameRules_GoToIntermission,
RG_CSGameRules_BalanceTeams,
RG_CSGameRules_OnRoundFreezeEnd,
// [...]
};