2
0
mirror of https://github.com/rehlds/reapi.git synced 2025-01-29 23:17:57 +03:00

Update regamedll API and implemented hookschain's CSGameRules::CanPlayerHearPlayer, CBasePlayer::SwitchTeam, CBasePlayer::CanSwitchTeam, CBasePlayer::ThrowGrenade, CWeaponBox::SetModel, CGrenade::DefuseBombStart, CGrenade::DefuseBombEnd, CGrenade::ExplodeHeGrenade, CGrenade::ExplodeFlashbang, CGrenade::ExplodeSmokeGrenade, CGrenade::ExplodeBomb, ThrowHeGrenade, ThrowFlashbang, ThrowSmokeGrenade

This commit is contained in:
s1lent 2018-01-27 23:34:12 +07:00
parent 59c8fca220
commit 2b1a7a5438
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
13 changed files with 513 additions and 35 deletions

View File

@ -20,7 +20,9 @@ enum hooks_tables_e
ht_animating,
ht_player,
ht_gamerules,
ht_rechecker
ht_rechecker,
ht_grenade,
ht_weaponbox
};
enum members_tables_e
@ -132,7 +134,7 @@ enum HookChain
*
* @return Returns a hook handle. Use EnableHookChain/DisableHookChain to toggle the forward on or off
*/
native HookChain:RegisterHookChain({EngineFunc, GamedllFunc, GamedllFunc_CBaseAnimating, GamedllFunc_CBasePlayer, GamedllFunc_CSGameRules, ReCheckerFunc}:function_id, const callback[], post = 0);
native HookChain:RegisterHookChain({EngineFunc, GamedllFunc, GamedllFunc_CBaseAnimating, GamedllFunc_CBasePlayer, GamedllFunc_CSGameRules, GamedllFunc_CGrenade, GamedllFunc_CWeaponBox, ReCheckerFunc}:function_id, const callback[], post = 0);
/*
* Stops a hook from triggering.

View File

@ -6,7 +6,7 @@
/**
* Returns true if round has ended by expired time
*
*
* @note Use this for hookchain RG_RoundEnd with the parameter ScenarioEventEndRound:event
*/
#define IsRoundExpireEvent(%0) (((1<<_:(%0) + ScenarioEventEndRound:0)) & ((1<<_:ROUND_TARGET_SAVED) | (1<<_:ROUND_HOSTAGE_NOT_RESCUED) | (1<<_:ROUND_TERRORISTS_NOT_ESCAPED) | (1<<_:ROUND_VIP_NOT_ESCAPED) | (1<<_:ROUND_GAME_OVER))) != 0)
@ -28,6 +28,7 @@
#define RG_CSGameRules_DeadPlayerWeapons RG_CSGameRules_DeadPlayerWpn
#define RG_CSGameRules_CheckMapConditions RG_CSGameRules_CheckMapCond
#define RG_CSGameRules_CheckWinConditions RG_CSGameRules_CheckWinCond
#define RG_CSGameRules_CanPlayerHearPlayer RG_CSGameRules_CanPlrHearPlr
#define RG_CBasePlayer_SetClientUserInfoModel RG_CBasePlayer_SetUserInfoModel
#define RG_CBasePlayer_SetClientUserInfoName RG_CBasePlayer_SetUserInfoName
#define m_Shield_hEntToIgnoreTouchesFrom m_Shield_EntToIgnoreTouchesFrom
@ -343,7 +344,35 @@ enum GamedllFunc
* Return type: CBaseEntity * (Entity index of weapon)
* Params: (const index, const WeaponIdType:weaponID)
*/
RG_BuyWeaponByWeaponID
RG_BuyWeaponByWeaponID,
/*
* Description: Called when a player throws the hegrenade.
* Return type: CGrenade * (Entity index of hegrenade)
* Params: (const index, Float:vecStart[3], Float:vecVelocity[3], Float:time, const team, const usEvent)
*/
RG_ThrowHeGrenade,
/*
* Description: Called when a player throws the flashbang.
* Return type: CGrenade * (Entity index of flashbang)
* Params: (const index, Float:vecStart[3], Float:vecVelocity[3], Float:time)
*/
RG_ThrowFlashbang,
/*
* Description: Called when a player throws the smokegrenade.
* Return type: CGrenade * (Entity index of smokegrenade)
* Params: (const index, Float:vecStart[3], Float:vecVelocity[3], Float:time, const usEvent)
*/
RG_ThrowSmokeGrenade,
/*
* Description: Called when a player plant's the bomb on the ground.
* Return type: CGrenade * (Entity index of bomb)
* Params: (const index, Float:vecStart[3], Float:vecVelocity[3])
*/
RG_PlantBomb
};
/**
@ -358,6 +387,60 @@ enum GamedllFunc_CBaseAnimating
RG_CBaseAnimating_ResetSequenceInfo = BEGIN_FUNC_REGION(animating)
};
/**
* GamedllFunc CGrenade
*/
enum GamedllFunc_CGrenade
{
/*
* Description: Called when a player goes to start defuse the bomb.
* Params: (const this, const player)
*/
RG_CGrenade_DefuseBombStart = BEGIN_FUNC_REGION(grenade),
/*
* Description: Called when a player has ended to defuses the bomb or when the previous defuser has taken off or been killed.
* Params: (const this, const player, bool:bDefused)
*/
RG_CGrenade_DefuseBombEnd,
/*
* Description: Called when a hegrenade detonates.
* Params: (const this, tracehandle, const bitsDamageType)
*/
RG_CGrenade_ExplodeHeGrenade,
/*
* Description: Called when a flashbang detonates.
* Params: (const this, tracehandle, const bitsDamageType)
*/
RG_CGrenade_ExplodeFlashbang,
/*
* Description: Called when a smokegrenade detonates.
* Params: (const this)
*/
RG_CGrenade_ExplodeSmokeGrenade,
/*
* Description: Called when a C4 goes to explodes.
* Params: (const this, tracehandle, const bitsDamageType)
*/
RG_CGrenade_ExplodeBomb,
};
/**
* GamedllFunc CWeaponBox
*/
enum GamedllFunc_CWeaponBox
{
/*
* Description: Called when a player dies to pack up the appropriate weapons and ammo items, and creates a weaponbox that falls to floor with sets specify the model or when a player drop the item.
* Params: (const this, const szModelName[])
*/
RG_CWeaponBox_SetModel = BEGIN_FUNC_REGION(weaponbox),
};
/**
* GamedllFunc CBasePlayer
*/
@ -619,7 +702,28 @@ enum GamedllFunc_CBasePlayer
* Description: Called when a player dying and goes into observer mode like StartObserver
* Params: (const this)
*/
RG_CBasePlayer_StartDeathCam
RG_CBasePlayer_StartDeathCam,
/*
* Description: Called when a player goes switch to opposite team after auto-teambalance or caused by 3rd-party things.
* @note This doesn't register the event when a player switched manually
* Params: (const this)
*/
RG_CBasePlayer_SwitchTeam,
/*
* Description: Can a player switch to team?
* Return type: bool
* Params: (const this, TeamName:teamToSwap)
*/
RG_CBasePlayer_CanSwitchTeam,
/*
* Description: Called when a player throws the grenade.
* Return type: CGrenade * (Entity index of hegrenade)
* Params: (const this, const grenade, Float:vecSrc[3], Float:vecThrow[3], Float:time, const usEvent)
*/
RG_CBasePlayer_ThrowGrenade,
};
/**
@ -629,24 +733,28 @@ enum GamedllFunc_CSGameRules
{
/*
* Description: Should the player switch to this weapon?
* Return type: BOOL
* Params: (const index, const weapon)
*/
RG_CSGameRules_FShouldSwitchWeapon = BEGIN_FUNC_REGION(gamerules),
/*
* Description: I can't use this weapon anymore, get me the next best one.
* Return type: BOOL
* Params: (const index, const currentWeapon)
*/
RG_CSGameRules_GetNextBestWeapon,
/*
* Description: -
* Return type: float
* Params: (const index)
*/
RG_CSGameRules_FlPlayerFallDamage,
/*
* Description: Can this player take damage from this attacker?
* Return type: float
* Params: (const index, const attacker)
*/
RG_CSGameRules_FPlayerCanTakeDamage,
@ -659,12 +767,14 @@ enum GamedllFunc_CSGameRules
/*
* Description: Is this player allowed to respawn now?
* Return type: BOOL
* Params: (const index)
*/
RG_CSGameRules_FPlayerCanRespawn,
/*
* Description: Place this player on his spawnspot and face him in the proper direction.
* Return type: edict_t * (Entity index of spawnspot)
* Params: (const index)
*/
RG_CSGameRules_GetPlayerSpawnSpot,
@ -689,12 +799,14 @@ enum GamedllFunc_CSGameRules
/*
* Description: The player is touching a CBasePlayerItem, do I give it to him?
* Return type: BOOL
* Params: (const index, const item)
*/
RG_CSGameRules_CanHavePlayerItem,
/*
* Description: What do I do with player's weapons when he's killed?
* Return type: int
* Params: (const index)
*/
RG_CSGameRules_DeadPlayerWeapons,
@ -765,7 +877,14 @@ enum GamedllFunc_CSGameRules
* Description: It's called when the freeze time ends.
* Params: ()
*/
RG_CSGameRules_OnRoundFreezeEnd
RG_CSGameRules_OnRoundFreezeEnd,
/*
* Description: It's called when a player hears another player.
* Return type: bool
* Params: (const listener, const sender)
*/
RG_CSGameRules_CanPlayerHearPlayer,
};
/**
@ -1444,7 +1563,32 @@ enum CSGameRules_Members
* Get params: Float:get_member_game(member);
* Set params: set_member_game(member, Float:value);
*/
m_flEscapeRatio
m_flEscapeRatio,
/*
* Description: -
* Member type: float
* Get params: Float:get_member_game(member);
* Set params: set_member_game(member, Float:value);
*/
m_flTimeLimit,
/*
* Description: Stores the start time of the game.
* @note The time resets when the game is restarting or the game commencing.
* Member type: float
* Get params: Float:get_member_game(member);
* Set params: set_member_game(member, Float:value);
*/
m_flGameStartTime,
/*
* Description: TRUE = goes balance team, otherwise FALSE
* Member type: bool
* Get params: get_member_game(member);
* Set params: set_member_game(member, bool:value);
*/
m_bTeamBalanced,
};
/**

View File

@ -648,6 +648,7 @@ public:
float m_flEscapeRatio;
float m_flTimeLimit;
float m_flGameStartTime;
bool m_bTeamBalanced;
};
typedef struct mapcycle_item_s

View File

@ -38,7 +38,7 @@
#include <API/CSInterfaces.h>
#define REGAMEDLL_API_VERSION_MAJOR 5
#define REGAMEDLL_API_VERSION_MINOR 4
#define REGAMEDLL_API_VERSION_MINOR 5
// CBasePlayer::Spawn hook
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_Spawn;
@ -356,6 +356,10 @@ typedef IHookChainRegistry<void> IReGameHookRegistry_CSGameRules_BalanceTeams;
typedef IHookChain<void> IReGameHook_CSGameRules_OnRoundFreezeEnd;
typedef IHookChainRegistry<void> IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd;
// CSGameRules::CanPlayerHearPlayer hook
typedef IHookChain<bool, class CBasePlayer *, class CBasePlayer *> IReGameHook_CSGameRules_CanPlayerHearPlayer;
typedef IHookChainRegistry<bool, class CBasePlayer *, class CBasePlayer *> IReGameHookRegistry_CSGameRules_CanPlayerHearPlayer;
// PM_UpdateStepSound hook
typedef IHookChain<void> IReGameHook_PM_UpdateStepSound;
typedef IHookChainRegistry<void> IReGameHookRegistry_PM_UpdateStepSound;
@ -364,6 +368,62 @@ typedef IHookChainRegistry<void> IReGameHookRegistry_PM_UpdateStepSound;
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_StartDeathCam;
typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBasePlayer_StartDeathCam;
// CBasePlayer::SwitchTeam hook
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_SwitchTeam;
typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBasePlayer_SwitchTeam;
// CBasePlayer::CanSwitchTeam hook
typedef IHookChainClass<bool, class CBasePlayer, TeamName> IReGameHook_CBasePlayer_CanSwitchTeam;
typedef IHookChainRegistryClass<bool, class CBasePlayer, TeamName> IReGameHookRegistry_CBasePlayer_CanSwitchTeam;
// CBasePlayer::ThrowGrenade hook
typedef IHookChainClass<class CGrenade *, class CBasePlayer, class CBasePlayerWeapon *, Vector &, Vector &, float, unsigned short> IReGameHook_CBasePlayer_ThrowGrenade;
typedef IHookChainRegistryClass<class CGrenade *, class CBasePlayer, class CBasePlayerWeapon *, Vector &, Vector &, float, unsigned short> IReGameHookRegistry_CBasePlayer_ThrowGrenade;
// CWeaponBox::SetModel hook
typedef IHookChainClass<void, class CWeaponBox, const char *> IReGameHook_CWeaponBox_SetModel;
typedef IHookChainRegistryClass<void, class CWeaponBox, const char *> IReGameHookRegistry_CWeaponBox_SetModel;
// CGrenade::DefuseBombStart hook
typedef IHookChainClass<void, class CGrenade, class CBasePlayer *> IReGameHook_CGrenade_DefuseBombStart;
typedef IHookChainRegistryClass<void, class CGrenade, class CBasePlayer *> IReGameHookRegistry_CGrenade_DefuseBombStart;
// CGrenade::DefuseBombEnd hook
typedef IHookChainClass<void, class CGrenade, class CBasePlayer *, bool> IReGameHook_CGrenade_DefuseBombEnd;
typedef IHookChainRegistryClass<void, class CGrenade, class CBasePlayer *, bool> IReGameHookRegistry_CGrenade_DefuseBombEnd;
// CGrenade::ExplodeHeGrenade hook
typedef IHookChainClass<void, class CGrenade, struct TraceResult *, int> IReGameHook_CGrenade_ExplodeHeGrenade;
typedef IHookChainRegistryClass<void, class CGrenade, struct TraceResult *, int> IReGameHookRegistry_CGrenade_ExplodeHeGrenade;
// CGrenade::ExplodeFlashbang hook
typedef IHookChainClass<void, class CGrenade, struct TraceResult *, int> IReGameHook_CGrenade_ExplodeFlashbang;
typedef IHookChainRegistryClass<void, class CGrenade, struct TraceResult *, int> IReGameHookRegistry_CGrenade_ExplodeFlashbang;
// CGrenade::ExplodeSmokeGrenade hook
typedef IHookChainClass<void, class CGrenade> IReGameHook_CGrenade_ExplodeSmokeGrenade;
typedef IHookChainRegistryClass<void, class CGrenade> IReGameHookRegistry_CGrenade_ExplodeSmokeGrenade;
// CGrenade::ExplodeBomb hook
typedef IHookChainClass<void, class CGrenade, struct TraceResult *, int> IReGameHook_CGrenade_ExplodeBomb;
typedef IHookChainRegistryClass<void, class CGrenade, struct TraceResult *, int> IReGameHookRegistry_CGrenade_ExplodeBomb;
// ThrowHeGrenade hook
typedef IHookChain<class CGrenade *, entvars_t *, Vector &, Vector &, float, int, unsigned short> IReGameHook_ThrowHeGrenade;
typedef IHookChainRegistry<class CGrenade *, entvars_t *, Vector &, Vector &, float, int, unsigned short> IReGameHookRegistry_ThrowHeGrenade;
// ThrowFlashbang hook
typedef IHookChain<class CGrenade *, entvars_t *, Vector &, Vector &, float> IReGameHook_ThrowFlashbang;
typedef IHookChainRegistry<class CGrenade *, entvars_t *, Vector &, Vector &, float> IReGameHookRegistry_ThrowFlashbang;
// ThrowSmokeGrenade hook
typedef IHookChain<class CGrenade *, entvars_t *, Vector &, Vector &, float, unsigned short> IReGameHook_ThrowSmokeGrenade;
typedef IHookChainRegistry<class CGrenade *, entvars_t *, Vector &, Vector &, float, unsigned short> IReGameHookRegistry_ThrowSmokeGrenade;
// PlantBomb hook
typedef IHookChain<class CGrenade *, entvars_t *, Vector &, Vector &> IReGameHook_PlantBomb;
typedef IHookChainRegistry<class CGrenade *, entvars_t *, Vector &, Vector &> IReGameHookRegistry_PlantBomb;
class IReGameHookchains {
public:
virtual ~IReGameHookchains() {}
@ -454,6 +514,21 @@ public:
virtual IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd *CSGameRules_OnRoundFreezeEnd() = 0;
virtual IReGameHookRegistry_PM_UpdateStepSound *PM_UpdateStepSound() = 0;
virtual IReGameHookRegistry_CBasePlayer_StartDeathCam *CBasePlayer_StartDeathCam() = 0;
virtual IReGameHookRegistry_CBasePlayer_SwitchTeam *CBasePlayer_SwitchTeam() = 0;
virtual IReGameHookRegistry_CBasePlayer_CanSwitchTeam *CBasePlayer_CanSwitchTeam() = 0;
virtual IReGameHookRegistry_CBasePlayer_ThrowGrenade *CBasePlayer_ThrowGrenade() = 0;
virtual IReGameHookRegistry_CSGameRules_CanPlayerHearPlayer *CSGameRules_CanPlayerHearPlayer() = 0;
virtual IReGameHookRegistry_CWeaponBox_SetModel *CWeaponBox_SetModel() = 0;
virtual IReGameHookRegistry_CGrenade_DefuseBombStart *CGrenade_DefuseBombStart() = 0;
virtual IReGameHookRegistry_CGrenade_DefuseBombEnd *CGrenade_DefuseBombEnd() = 0;
virtual IReGameHookRegistry_CGrenade_ExplodeHeGrenade *CGrenade_ExplodeHeGrenade() = 0;
virtual IReGameHookRegistry_CGrenade_ExplodeFlashbang *CGrenade_ExplodeFlashbang() = 0;
virtual IReGameHookRegistry_CGrenade_ExplodeSmokeGrenade *CGrenade_ExplodeSmokeGrenade() = 0;
virtual IReGameHookRegistry_CGrenade_ExplodeBomb *CGrenade_ExplodeBomb() = 0;
virtual IReGameHookRegistry_ThrowHeGrenade *ThrowHeGrenade() = 0;
virtual IReGameHookRegistry_ThrowFlashbang *ThrowFlashbang() = 0;
virtual IReGameHookRegistry_ThrowSmokeGrenade *ThrowSmokeGrenade() = 0;
virtual IReGameHookRegistry_PlantBomb *PlantBomb() = 0;
};
struct ReGameFuncs_t {

View File

@ -285,12 +285,15 @@
</ItemGroup>
<ItemGroup>
<None Include="..\extra\amxmodx\scripting\include\cssdk_const.inc" />
<None Include="..\extra\amxmodx\scripting\include\hlsdk_const.inc" />
<None Include="..\extra\amxmodx\scripting\include\reapi.inc" />
<None Include="..\extra\amxmodx\scripting\include\reapi_engine.inc" />
<None Include="..\extra\amxmodx\scripting\include\reapi_engine_const.inc" />
<None Include="..\extra\amxmodx\scripting\include\reapi_gamedll.inc" />
<None Include="..\extra\amxmodx\scripting\include\reapi_gamedll_const.inc" />
<None Include="..\extra\amxmodx\scripting\include\reapi_addons.inc" />
<None Include="..\extra\amxmodx\scripting\include\reapi_rechecker.inc" />
<None Include="..\extra\amxmodx\scripting\include\reapi_reunion.inc" />
<None Include="..\extra\amxmodx\scripting\include\reapi_vtc.inc" />
<None Include="..\extra\amxmodx\scripting\reapi_test.sma" />
<None Include="..\version\reapi_version.inc" />
<None Include="reapi.def" />

View File

@ -827,15 +827,24 @@
<None Include="..\extra\amxmodx\scripting\include\reapi_engine.inc">
<Filter>amxmodx\scripting\include</Filter>
</None>
<None Include="..\extra\amxmodx\scripting\include\reapi_addons.inc">
<Filter>amxmodx\scripting\include</Filter>
</None>
<None Include="..\extra\amxmodx\scripting\include\cssdk_const.inc">
<Filter>amxmodx\scripting\include</Filter>
</None>
<None Include="..\version\reapi_version.inc">
<Filter>version</Filter>
</None>
<None Include="..\extra\amxmodx\scripting\include\hlsdk_const.inc">
<Filter>amxmodx\scripting\include</Filter>
</None>
<None Include="..\extra\amxmodx\scripting\include\reapi_rechecker.inc">
<Filter>amxmodx\scripting\include</Filter>
</None>
<None Include="..\extra\amxmodx\scripting\include\reapi_reunion.inc">
<Filter>amxmodx\scripting\include</Filter>
</None>
<None Include="..\extra\amxmodx\scripting\include\reapi_vtc.inc">
<Filter>amxmodx\scripting\include</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="reapi.rc" />

View File

@ -264,44 +264,44 @@ typedef void * (*PFN_REQ_FNPTR)(const char *name);
// ***** Module funcs stuff *****
enum ForwardExecType
{
ET_IGNORE = 0, // Ignore return vaue
ET_IGNORE = 0, // Ignore return vaue
ET_STOP, // Stop on PLUGIN_HANDLED
ET_STOP2, // Stop on PLUGIN_HANDLED, continue on other values, return biggest return value
ET_CONTINUE, // Continue; return biggest return value
ET_CONTINUE, // Continue; return biggest return value
};
enum ForwardParam
{
FP_DONE = -1, // specify this as the last argument
FP_DONE = -1, // specify this as the last argument
// only tells the function that there are no more arguments
FP_CELL, // normal cell
FP_FLOAT, // float; used as normal cell though
FP_STRING, // string
FP_STRINGEX, // string; will be updated to the last function's value
FP_STRINGEX, // string; will be updated to the last function's value
FP_ARRAY, // array; use the return value of prepareArray.
};
enum PlayerProp
{
Player_Name, //String
Player_Ip, //String
Player_Team, //String
Player_Ingame, //bool
Player_Authorized, //bool
Player_Vgui, //bool
Player_Time, //float
Player_Playtime, //float
Player_MenuExpire, //float
Player_Weapons, //struct{int,int}[32]
Player_CurrentWeapon, //int
Player_TeamID, //int
Player_Deaths, //int
Player_Aiming, //int
Player_Menu, //int
Player_Keys, //int
Player_Flags, //int[32]
Player_Newmenu, //int
Player_NewmenuPage, //int
Player_Name, // String
Player_Ip, // String
Player_Team, // String
Player_Ingame, // bool
Player_Authorized, // bool
Player_Vgui, // bool
Player_Time, // float
Player_Playtime, // float
Player_MenuExpire, // float
Player_Weapons, // struct{int,int}[32]
Player_CurrentWeapon, // int
Player_TeamID, // int
Player_Deaths, // int
Player_Aiming, // int
Player_Menu, // int
Player_Keys, // int
Player_Flags, // int[32]
Player_Newmenu, // int
Player_NewmenuPage, // int
};
enum LibType

View File

@ -480,6 +480,38 @@ void CBasePlayer_StartDeathCam(IReGameHook_CBasePlayer_StartDeathCam *chain, CBa
callVoidForward(RG_CBasePlayer_StartDeathCam, original, indexOfEdict(pthis->pev));
}
void CBasePlayer_SwitchTeam(IReGameHook_CBasePlayer_SwitchTeam *chain, CBasePlayer *pthis)
{
auto original = [chain](int _pthis)
{
chain->callNext(getPrivate<CBasePlayer>(_pthis));
};
callVoidForward(RG_CBasePlayer_CanSwitchTeam, original, indexOfEdict(pthis->pev));
}
bool CBasePlayer_CanSwitchTeam(IReGameHook_CBasePlayer_CanSwitchTeam *chain, CBasePlayer *pthis, TeamName teamToSwap)
{
auto original = [chain](int _pthis, TeamName _teamToSwap)
{
return chain->callNext(getPrivate<CBasePlayer>(_pthis), _teamToSwap);
};
return callForward<bool>(RG_CBasePlayer_CanSwitchTeam, original, indexOfEdict(pthis->pev), teamToSwap);
}
CGrenade *CBasePlayer_ThrowGrenade(IReGameHook_CBasePlayer_ThrowGrenade *chain, CBasePlayer *pthis, CBasePlayerWeapon *pWeapon, Vector &vecSrc, Vector &vecThrow, float time, unsigned short usEvent)
{
Vector vecSrcCopy(vecSrc), vecThrowCopy(vecThrow);
auto original = [chain, &vecSrcCopy, &vecThrowCopy](int _pthis, int _pWeapon, cell _vecSrc, cell _vecThrow, float _time, unsigned short _usEvent)
{
return indexOfPDataAmx(chain->callNext(getPrivate<CBasePlayer>(_pthis), getPrivate<CBasePlayerWeapon>(_pWeapon), vecSrcCopy, vecThrowCopy, _time, _usEvent));
};
return getPrivate<CGrenade>(callForward<size_t>(RG_CBasePlayer_ThrowGrenade, original, indexOfEdict(pthis->pev), indexOfEdict(pWeapon->pev), g_amxxapi.PrepareCellArrayA(reinterpret_cast<cell *>(&vecSrcCopy), 3, true), g_amxxapi.PrepareCellArrayA(reinterpret_cast<cell *>(&vecThrowCopy), 3, true), time, usEvent));
}
void CBaseAnimating_ResetSequenceInfo(IReGameHook_CBaseAnimating_ResetSequenceInfo *chain, CBaseAnimating *pthis)
{
auto original = [chain](int _pthis)
@ -784,6 +816,86 @@ void CSGameRules_OnRoundFreezeEnd(IReGameHook_CSGameRules_OnRoundFreezeEnd *chai
callVoidForward(RG_CSGameRules_OnRoundFreezeEnd, original);
}
bool CSGameRules_CanPlayerHearPlayer(IReGameHook_CSGameRules_CanPlayerHearPlayer *chain, CBasePlayer *pListener, CBasePlayer *pSender)
{
auto original = [chain](int _pListener, int _pSender)
{
return chain->callNext(getPrivate<CBasePlayer>(_pListener), getPrivate<CBasePlayer>(_pSender));
};
return callForward<bool>(RG_CSGameRules_CanPlayerHearPlayer, original, indexOfEdict(pListener->pev), indexOfEdict(pSender->pev));
}
void CWeaponBox_SetModel(IReGameHook_CWeaponBox_SetModel *chain, CWeaponBox *pthis, const char *pszModelName)
{
auto original = [chain](int _pthis, const char *_pszModelName)
{
chain->callNext(getPrivate<CWeaponBox>(_pthis), _pszModelName);
};
callVoidForward(RG_CWeaponBox_SetModel, original, indexOfEdict(pthis->pev), pszModelName);
}
void CGrenade_DefuseBombStart(IReGameHook_CGrenade_DefuseBombStart *chain, CGrenade *pthis, CBasePlayer *pPlayer)
{
auto original = [chain](int _pthis, int _pPlayer)
{
chain->callNext(getPrivate<CGrenade>(_pthis), getPrivate<CBasePlayer>(_pPlayer));
};
callVoidForward(RG_CGrenade_DefuseBombStart, original, indexOfEdict(pthis->pev), indexOfEdict(pPlayer->pev));
}
void CGrenade_DefuseBombEnd(IReGameHook_CGrenade_DefuseBombEnd *chain, CGrenade *pthis, CBasePlayer *pPlayer, bool bDefused)
{
auto original = [chain](int _pthis, int _pPlayer, bool _bDefused)
{
chain->callNext(getPrivate<CGrenade>(_pthis), getPrivate<CBasePlayer>(_pPlayer), _bDefused);
};
callVoidForward(RG_CGrenade_DefuseBombEnd, original, indexOfEdict(pthis->pev), indexOfEdict(pPlayer->pev), bDefused);
}
void CGrenade_ExplodeHeGrenade(IReGameHook_CGrenade_ExplodeHeGrenade *chain, CGrenade *pthis, TraceResult *ptr, int bitsDamageType)
{
auto original = [chain](int _pthis, TraceResult *_ptr, int _bitsDamageType)
{
chain->callNext(getPrivate<CGrenade>(_pthis), _ptr, _bitsDamageType);
};
callVoidForward(RG_CGrenade_ExplodeHeGrenade, original, indexOfEdict(pthis->pev), ptr, bitsDamageType);
}
void CGrenade_ExplodeFlashbang(IReGameHook_CGrenade_ExplodeFlashbang *chain, CGrenade *pthis, TraceResult *ptr, int bitsDamageType)
{
auto original = [chain](int _pthis, TraceResult *_ptr, int _bitsDamageType)
{
chain->callNext(getPrivate<CGrenade>(_pthis), _ptr, _bitsDamageType);
};
callVoidForward(RG_CGrenade_ExplodeFlashbang, original, indexOfEdict(pthis->pev), ptr, bitsDamageType);
}
void CGrenade_ExplodeSmokeGrenade(IReGameHook_CGrenade_ExplodeSmokeGrenade *chain, CGrenade *pthis)
{
auto original = [chain](int _pthis)
{
chain->callNext(getPrivate<CGrenade>(_pthis));
};
callVoidForward(RG_CGrenade_ExplodeSmokeGrenade, original, indexOfEdict(pthis->pev));
}
void CGrenade_ExplodeBomb(IReGameHook_CGrenade_ExplodeBomb *chain, CGrenade *pthis, TraceResult *ptr, int bitsDamageType)
{
auto original = [chain](int _pthis, TraceResult *_ptr, int _bitsDamageType)
{
chain->callNext(getPrivate<CGrenade>(_pthis), _ptr, _bitsDamageType);
};
callVoidForward(RG_CGrenade_ExplodeBomb, original, indexOfEdict(pthis->pev), ptr, bitsDamageType);
}
void HandleMenu_ChooseAppearance(IReGameHook_HandleMenu_ChooseAppearance *chain, CBasePlayer *pPlayer, int slot)
{
auto original = [chain](int _pPlayer, int _slot)
@ -844,6 +956,54 @@ CBaseEntity *BuyWeaponByWeaponID(IReGameHook_BuyWeaponByWeaponID *chain, CBasePl
return getPrivate<CBaseEntity>(callForward<size_t>(RG_BuyWeaponByWeaponID, original, indexOfEdict(pPlayer->pev), weaponID));
}
CGrenade *ThrowHeGrenade(IReGameHook_ThrowHeGrenade *chain, entvars_t *pevOwner, Vector &vecStart, Vector &vecVelocity, float time, int iTeam, unsigned short usEvent)
{
Vector vecStartCopy(vecStart), vecVelocityCopy(vecVelocity);
auto original = [chain, &vecStartCopy, &vecVelocityCopy](int _pevOwner, cell _vecStart, cell _vecVelocity, float _time, int _iTeam, unsigned short _usEvent)
{
return indexOfPDataAmx(chain->callNext(PEV(_pevOwner), vecStartCopy, vecVelocityCopy, _time, _iTeam, _usEvent));
};
return getPrivate<CGrenade>(callForward<size_t>(RG_ThrowHeGrenade, original, indexOfEdict(pevOwner), g_amxxapi.PrepareCellArrayA(reinterpret_cast<cell *>(&vecStartCopy), 3, true), g_amxxapi.PrepareCellArrayA(reinterpret_cast<cell *>(&vecVelocityCopy), 3, true), time, iTeam, usEvent));
}
CGrenade *ThrowFlashbang(IReGameHook_ThrowFlashbang *chain, entvars_t *pevOwner, Vector &vecStart, Vector &vecVelocity, float time)
{
Vector vecStartCopy(vecStart), vecVelocityCopy(vecVelocity);
auto original = [chain, &vecStartCopy, &vecVelocityCopy](int _pevOwner, cell _vecStart, cell _vecVelocity, float _time)
{
return indexOfPDataAmx(chain->callNext(PEV(_pevOwner), vecStartCopy, vecVelocityCopy, _time));
};
return getPrivate<CGrenade>(callForward<size_t>(RG_ThrowHeGrenade, original, indexOfEdict(pevOwner), g_amxxapi.PrepareCellArrayA(reinterpret_cast<cell *>(&vecStartCopy), 3, true), g_amxxapi.PrepareCellArrayA(reinterpret_cast<cell *>(&vecVelocityCopy), 3, true), time));
}
CGrenade *ThrowSmokeGrenade(IReGameHook_ThrowSmokeGrenade *chain, entvars_t *pevOwner, Vector &vecStart, Vector &vecVelocity, float time, unsigned short usEvent)
{
Vector vecStartCopy(vecStart), vecVelocityCopy(vecVelocity);
auto original = [chain, &vecStartCopy, &vecVelocityCopy](int _pevOwner, cell _vecStart, cell _vecVelocity, float _time, unsigned short _usEvent)
{
return indexOfPDataAmx(chain->callNext(PEV(_pevOwner), vecStartCopy, vecVelocityCopy, _time, _usEvent));
};
return getPrivate<CGrenade>(callForward<size_t>(RG_ThrowSmokeGrenade, original, indexOfEdict(pevOwner), g_amxxapi.PrepareCellArrayA(reinterpret_cast<cell *>(&vecStartCopy), 3, true), g_amxxapi.PrepareCellArrayA(reinterpret_cast<cell *>(&vecVelocityCopy), 3, true), time, usEvent));
}
CGrenade *PlantBomb(IReGameHook_PlantBomb *chain, entvars_t *pevOwner, Vector &vecStart, Vector &vecVelocity)
{
Vector vecStartCopy(vecStart), vecVelocityCopy(vecVelocity);
auto original = [chain, &vecStartCopy, &vecVelocityCopy](int _pevOwner, cell _vecStart, cell _vecVelocity)
{
return indexOfPDataAmx(chain->callNext(PEV(_pevOwner), vecStartCopy, vecVelocityCopy));
};
return getPrivate<CGrenade>(callForward<size_t>(RG_PlantBomb, original, indexOfEdict(pevOwner), g_amxxapi.PrepareCellArrayA(reinterpret_cast<cell *>(&vecStartCopy), 3, true), g_amxxapi.PrepareCellArrayA(reinterpret_cast<cell *>(&vecVelocityCopy), 3, true)));
}
int g_iClientStartSpeak, g_iClientStopSpeak;
void OnClientStartSpeak(size_t clientIndex)

View File

@ -326,6 +326,10 @@ void ShowMenu(IReGameHook_ShowMenu *chain, CBasePlayer *pPlayer, int bitsValidSl
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);
CGrenade *ThrowHeGrenade(IReGameHook_ThrowHeGrenade *chain, entvars_t *pevOwner, Vector &vecStart, Vector &vecVelocity, float time, int iTeam, unsigned short usEvent);
CGrenade *ThrowFlashbang(IReGameHook_ThrowFlashbang *chain, entvars_t *pevOwner, Vector &vecStart, Vector &vecVelocity, float time);
CGrenade *ThrowSmokeGrenade(IReGameHook_ThrowSmokeGrenade *chain, entvars_t *pevOwner, Vector &vecStart, Vector &vecVelocity, float time, unsigned short usEvent);
CGrenade *PlantBomb(IReGameHook_PlantBomb *chain, entvars_t *pevOwner, Vector &vecStart, Vector &vecVelocity);
// regamedll functions - player
void CBasePlayer_Spawn(IReGameHook_CBasePlayer_Spawn *chain, CBasePlayer *pthis);
@ -370,6 +374,9 @@ bool CBasePlayer_MakeBomber(IReGameHook_CBasePlayer_MakeBomber *chain, CBasePlay
void CBasePlayer_StartObserver(IReGameHook_CBasePlayer_StartObserver *chain, CBasePlayer *pthis, Vector &vecPosition, Vector &vecViewAngle);
bool CBasePlayer_GetIntoGame(IReGameHook_CBasePlayer_GetIntoGame *chain, CBasePlayer *pthis);
void CBasePlayer_StartDeathCam(IReGameHook_CBasePlayer_StartDeathCam *chain, CBasePlayer *pthis);
void CBasePlayer_SwitchTeam(IReGameHook_CBasePlayer_SwitchTeam *chain, CBasePlayer *pthis);
bool CBasePlayer_CanSwitchTeam(IReGameHook_CBasePlayer_CanSwitchTeam *chain, CBasePlayer *pthis, TeamName teamToSwap);
CGrenade *CBasePlayer_ThrowGrenade(IReGameHook_CBasePlayer_ThrowGrenade *chain, CBasePlayer *pthis, CBasePlayerWeapon *pWeapon, Vector &vecSrc, Vector &vecThrow, float time, unsigned short usEvent);
void CBaseAnimating_ResetSequenceInfo(IReGameHook_CBaseAnimating_ResetSequenceInfo *chain, CBaseAnimating *pthis);
@ -396,6 +403,16 @@ 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);
bool CSGameRules_CanPlayerHearPlayer(IReGameHook_CSGameRules_CanPlayerHearPlayer *chain, CBasePlayer *pListener, CBasePlayer *pSender);
void CWeaponBox_SetModel(IReGameHook_CWeaponBox_SetModel *chain, CWeaponBox *pthis, const char *pszModelName);
void CGrenade_DefuseBombStart(IReGameHook_CGrenade_DefuseBombStart *chain, CGrenade *pthis, CBasePlayer *pPlayer);
void CGrenade_DefuseBombEnd(IReGameHook_CGrenade_DefuseBombEnd *chain, CGrenade *pthis, CBasePlayer *pPlayer, bool bDefused);
void CGrenade_ExplodeHeGrenade(IReGameHook_CGrenade_ExplodeHeGrenade *chain, CGrenade *pthis, TraceResult *ptr, int bitsDamageType);
void CGrenade_ExplodeFlashbang(IReGameHook_CGrenade_ExplodeFlashbang *chain, CGrenade *pthis, TraceResult *ptr, int bitsDamageType);
void CGrenade_ExplodeSmokeGrenade(IReGameHook_CGrenade_ExplodeSmokeGrenade *chain, CGrenade *pthis);
void CGrenade_ExplodeBomb(IReGameHook_CGrenade_ExplodeBomb *chain, CGrenade *pthis, TraceResult *ptr, int bitsDamageType);
extern int g_iClientStartSpeak;
extern int g_iClientStopSpeak;

View File

@ -3,8 +3,10 @@
inline size_t getFwdParamType(void(*)(int)) { return FP_CELL; }
inline size_t getFwdParamType(void(*)(size_t)) { return FP_CELL; }
inline size_t getFwdParamType(void(*)(short)) { return FP_CELL; }
inline size_t getFwdParamType(void(*)(unsigned 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(*)(TeamName)) { return FP_CELL; }
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; }
@ -92,6 +94,10 @@ hook_t hooklist_gamedll[] = {
DLL(ShowVGUIMenu),
DLL(BuyGunAmmo),
DLL(BuyWeaponByWeaponID),
DLL(ThrowHeGrenade),
DLL(ThrowFlashbang),
DLL(ThrowSmokeGrenade),
DLL(PlantBomb),
};
hook_t hooklist_animating[] = {
@ -141,6 +147,9 @@ hook_t hooklist_player[] = {
DLL(CBasePlayer_StartObserver),
DLL(CBasePlayer_GetIntoGame),
DLL(CBasePlayer_StartDeathCam),
DLL(CBasePlayer_SwitchTeam),
DLL(CBasePlayer_CanSwitchTeam),
DLL(CBasePlayer_ThrowGrenade),
};
hook_t hooklist_gamerules[] = {
@ -167,6 +176,20 @@ hook_t hooklist_gamerules[] = {
DLL(CSGameRules_GoToIntermission),
DLL(CSGameRules_BalanceTeams),
DLL(CSGameRules_OnRoundFreezeEnd),
DLL(CSGameRules_CanPlayerHearPlayer),
};
hook_t hooklist_grenade[] = {
DLL(CGrenade_DefuseBombStart),
DLL(CGrenade_DefuseBombEnd),
DLL(CGrenade_ExplodeHeGrenade),
DLL(CGrenade_ExplodeFlashbang),
DLL(CGrenade_ExplodeSmokeGrenade),
DLL(CGrenade_ExplodeBomb),
};
hook_t hooklist_weaponbox[] = {
DLL(CWeaponBox_SetModel),
};
#define RCHECK(h,...) { {}, {}, #h, "ReChecker", [](){ return api_cfg.hasRechecker(); }, ((!(RC_##h & (MAX_REGION_RANGE - 1)) ? regfunc::current_cell = 1, true : false) || (RC_##h & (MAX_REGION_RANGE - 1)) == regfunc::current_cell++) ? regfunc(h##__VA_ARGS__) : regfunc(#h#__VA_ARGS__), [](){ g_RecheckerHookchains->##h##()->registerHook(&##h); }, [](){ g_RecheckerHookchains->##h##()->unregisterHook(&##h); }}
@ -190,6 +213,8 @@ hook_t* hooklist_t::getHookSafe(size_t hook)
CASE(player)
CASE(gamerules)
CASE(rechecker)
CASE(grenade)
CASE(weaponbox)
}
return nullptr;
@ -205,6 +230,8 @@ void hooklist_t::clear()
FOREACH_CLEAR(player);
FOREACH_CLEAR(gamerules);
FOREACH_CLEAR(rechecker);
FOREACH_CLEAR(grenade);
FOREACH_CLEAR(weaponbox);
}
void hook_t::clear()

View File

@ -31,6 +31,8 @@ extern hook_t hooklist_animating[];
extern hook_t hooklist_player[];
extern hook_t hooklist_gamerules[];
extern hook_t hooklist_rechecker[];
extern hook_t hooklist_grenade[];
extern hook_t hooklist_weaponbox[];
enum
{
@ -53,6 +55,8 @@ struct hooklist_t
CASE(player)
CASE(gamerules)
CASE(rechecker)
CASE(grenade)
CASE(weaponbox)
}
return nullptr;
@ -69,6 +73,8 @@ struct hooklist_t
ht_player,
ht_gamerules,
ht_rechecker,
ht_grenade,
ht_weaponbox,
ht_end
};
@ -102,6 +108,11 @@ enum GamedllFunc
RG_BuyGunAmmo,
RG_BuyWeaponByWeaponID,
RG_ThrowHeGrenade,
RG_ThrowFlashbang,
RG_ThrowSmokeGrenade,
RG_PlantBomb
// [...]
};
@ -158,6 +169,28 @@ enum GamedllFunc_CBasePlayer
RG_CBasePlayer_StartObserver,
RG_CBasePlayer_GetIntoGame,
RG_CBasePlayer_StartDeathCam,
RG_CBasePlayer_SwitchTeam,
RG_CBasePlayer_CanSwitchTeam,
RG_CBasePlayer_ThrowGrenade,
// [...]
};
enum GamedllFunc_CGrenade
{
RG_CGrenade_DefuseBombStart = BEGIN_FUNC_REGION(grenade),
RG_CGrenade_DefuseBombEnd,
RG_CGrenade_ExplodeHeGrenade,
RG_CGrenade_ExplodeFlashbang,
RG_CGrenade_ExplodeSmokeGrenade,
RG_CGrenade_ExplodeBomb,
// [...]
};
enum GamedllFunc_CWeaponBox
{
RG_CWeaponBox_SetModel = BEGIN_FUNC_REGION(weaponbox),
// [...]
};
@ -188,6 +221,7 @@ enum GamedllFunc_CSGameRules
RG_CSGameRules_GoToIntermission,
RG_CSGameRules_BalanceTeams,
RG_CSGameRules_OnRoundFreezeEnd,
RG_CSGameRules_CanPlayerHearPlayer,
// [...]
};

View File

@ -227,6 +227,9 @@ member_t memberlist_gamerules[] = {
GM_MEMBERS(m_bSkipShowMenu),
GM_MEMBERS(m_bNeededPlayers),
GM_MEMBERS(m_flEscapeRatio),
GM_MEMBERS(m_flTimeLimit),
GM_MEMBERS(m_flGameStartTime),
GM_MEMBERS(m_bTeamBalanced),
};
member_t memberlist_base[] = {

View File

@ -210,6 +210,9 @@ enum CSGameRules_Members
m_bSkipShowMenu,
m_bNeededPlayers,
m_flEscapeRatio,
m_flTimeLimit,
m_flGameStartTime,
m_bTeamBalanced,
};
// CBaseEntity