2
0
mirror of https://github.com/rehlds/reapi.git synced 2024-12-28 07:35:31 +03:00

Update SDK

Reworked PM_AirMove hook, add physent argument
This commit is contained in:
s1lentq 2023-07-16 03:57:03 +07:00
parent d9b72bf3a3
commit 87e4858476
4 changed files with 19 additions and 22 deletions

View File

@ -410,7 +410,7 @@ enum GamedllFunc
/*
* Description: Called when a player is on a ladder.
* Params: (const playerIndex)
* Params: (const pLadder, const playerIndex)
*/
RG_PM_LadderMove,
};
@ -819,14 +819,14 @@ enum GamedllFunc_CBasePlayer
* Params: (const this)
*/
RG_CBasePlayer_Pain,
/*
* Description: Called when a client emits a "death sound" after death.
* Return type: void
* Params: (const this, lastHitGroup, bool:hasArmour)
*/
RG_CBasePlayer_DeathSound,
/*
* Description: Called when a client "thinks for the join status".
* (permanently called on each call of "CBasePlayer::PreThink", and only when he is not assigned as specatator or not playing)

View File

@ -39,7 +39,7 @@
#include <API/CSInterfaces.h>
#define REGAMEDLL_API_VERSION_MAJOR 5
#define REGAMEDLL_API_VERSION_MINOR 21
#define REGAMEDLL_API_VERSION_MINOR 22
// CBasePlayer::Spawn hook
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_Spawn;
@ -525,6 +525,10 @@ typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBa
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_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 {
public:
virtual ~IReGameHookchains() {}
@ -658,7 +662,8 @@ public:
virtual IReGameHookRegistry_CBasePlayer_Pain *CBasePlayer_Pain() = 0;
virtual IReGameHookRegistry_CBasePlayer_DeathSound *CBasePlayer_DeathSound() = 0;
virtual IReGameHookRegistry_CBasePlayer_JoiningThink *CBasePlayer_JoiningThink() = 0;
virtual IReGameHookRegistry_FreeGameRules *FreeGameRules() = 0;
virtual IReGameHookRegistry_PM_LadderMove *PM_LadderMove() = 0;
};
@ -677,6 +682,9 @@ struct ReGameFuncs_t {
class CGrenade *(*PlantBomb)(entvars_t *pevOwner, Vector &vecStart, Vector &vecVelocity);
class CGib *(*SpawnHeadGib)(entvars_t *pevVictim);
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 {

View File

@ -899,21 +899,19 @@ void PM_AirMove(IReGameHook_PM_AirMove *chain, int playerIndex)
callVoidForward(RG_PM_AirMove, original, playerIndex);
}
void PM_LadderMove_AMXX(Phys_T *data, int playerIndex)
void PM_LadderMove_AMXX(IReGameHook_PM_LadderMove *chain, physent_t *pLadder, int playerIndex)
{
auto original = [data](int _playerIndex)
auto original = [chain](physent_t *_pLadder, int _playerIndex)
{
data->m_chain->callNext(data->m_args.pLadder);
chain->callNext(_pLadder);
};
callVoidForward(RG_PM_LadderMove, original, playerIndex);
callVoidForward(RG_PM_LadderMove, original, pLadder, playerIndex);
}
void PM_LadderMove(IReGameHook_PM_LadderMove *chain, physent_t *pLadder)
{
PM_LadderMove_args_t args(pLadder);
Phys_T data(chain, args);
PM_LadderMove_AMXX(&data, pLadder->player + 1);
PM_LadderMove_AMXX(chain, pLadder, pLadder->player + 1);
}
BOOL CSGameRules_FShouldSwitchWeapon(IReGameHook_CSGameRules_FShouldSwitchWeapon *chain, CBasePlayer *pPlayer, CBasePlayerItem *pWeapon)

View File

@ -402,16 +402,7 @@ void PM_Move_AMXX(Move_t *data, int playerIndex);
void PM_Move(IReGameHook_PM_Move *chain, playermove_t *ppmove, int server);
void PM_AirMove(IReGameHook_PM_AirMove *chain, int playerIndex);
struct PM_LadderMove_args_t
{
PM_LadderMove_args_t(physent_t *_ladder) : pLadder(_ladder) {}
physent_t *pLadder;
};
using Phys_T = hookdata_t<IReGameHook_PM_LadderMove *, PM_LadderMove_args_t &>;
void PM_LadderMove_AMXX(Phys_T *data);
void PM_LadderMove_AMXX(IReGameHook_PM_LadderMove *chain, physent_t *pLadder, int playerIndex);
void PM_LadderMove(IReGameHook_PM_LadderMove *chain, physent_t *pLadder);
void HandleMenu_ChooseAppearance(IReGameHook_HandleMenu_ChooseAppearance *chain, CBasePlayer *pPlayer, int slot);