Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: Implement PM_LadderMove hook #740

Merged
merged 2 commits into from
Jul 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions regamedll/dlls/API/CAPI_Impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ GAMEHOOK_REGISTRY(CBasePlayer_Pain);
GAMEHOOK_REGISTRY(CBasePlayer_DeathSound);
GAMEHOOK_REGISTRY(CBasePlayer_JoiningThink);

GAMEHOOK_REGISTRY(PM_LadderMove);

int CReGameApi::GetMajorVersion() {
return REGAMEDLL_API_VERSION_MAJOR;
}
Expand Down
8 changes: 8 additions & 0 deletions regamedll/dlls/API/CAPI_Impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,10 @@ typedef IHookChainRegistryImpl<void, struct playermove_s *, int> CReGameHookRegi
typedef IHookChainImpl<void, int> CReGameHook_PM_AirMove;
typedef IHookChainRegistryImpl<void, int> CReGameHookRegistry_PM_AirMove;

// PM_LadderMove hook
typedef IHookChainImpl<void, struct physent_s *> CReGameHook_PM_LadderMove;
typedef IHookChainRegistryImpl<void, struct physent_s *> CReGameHookRegistry_PM_LadderMove;

// HandleMenu_ChooseAppearance hook
typedef IHookChainImpl<void, CBasePlayer *, int> CReGameHook_HandleMenu_ChooseAppearance;
typedef IHookChainRegistryImpl<void, CBasePlayer *, int> CReGameHookRegistry_HandleMenu_ChooseAppearance;
Expand Down Expand Up @@ -773,6 +777,8 @@ class CReGameHookchains: public IReGameHookchains {
CReGameHookRegistry_CBasePlayer_Pain m_CBasePlayer_Pain;
CReGameHookRegistry_CBasePlayer_DeathSound m_CBasePlayer_DeathSound;
CReGameHookRegistry_CBasePlayer_JoiningThink m_CBasePlayer_JoiningThink;

CReGameHookRegistry_PM_LadderMove m_PM_LadderMove;

public:
virtual IReGameHookRegistry_CBasePlayer_Spawn *CBasePlayer_Spawn();
Expand Down Expand Up @@ -904,6 +910,8 @@ class CReGameHookchains: public IReGameHookchains {
virtual IReGameHookRegistry_CBasePlayer_Pain *CBasePlayer_Pain();
virtual IReGameHookRegistry_CBasePlayer_DeathSound *CBasePlayer_DeathSound();
virtual IReGameHookRegistry_CBasePlayer_JoiningThink *CBasePlayer_JoiningThink();

virtual IReGameHookRegistry_PM_LadderMove *PM_LadderMove();
};

extern CReGameHookchains g_ReGameHookchains;
Expand Down
4 changes: 3 additions & 1 deletion regamedll/pm_shared/pm_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1967,7 +1967,9 @@ void PM_Duck()
}
}

void PM_LadderMove(physent_t *pLadder)
LINK_HOOK_VOID_CHAIN(PM_LadderMove, (physent_t *pLadder), pLadder);

void EXT_FUNC __API_HOOK(PM_LadderMove)(physent_t *pLadder)
{
vec3_t ladderCenter;
trace_t trace;
Expand Down
2 changes: 2 additions & 0 deletions regamedll/pm_shared/pm_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,14 @@ void PM_Init(struct playermove_s *ppmove);
void PM_Move(struct playermove_s *ppmove, int server);
char PM_FindTextureType(char *name);
void PM_AirMove_internal();
void PM_LadderMove(physent_t *pLadder);

#ifdef REGAMEDLL_API
void PM_Init_OrigFunc(struct playermove_s *ppmove);
void PM_Move_OrigFunc(struct playermove_s *ppmove, int server);
void PM_AirMove_OrigFunc(int playerIndex = 0);
void PM_UpdateStepSound_OrigFunc();
void PM_LadderMove_OrigFunc(physent_t *pLadder);
#else
void PM_AirMove(int playerIndex = 0);
#endif
Expand Down
6 changes: 6 additions & 0 deletions regamedll/public/regamedll/regamedll_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ typedef IHookChainRegistry<void, struct playermove_s *, int> IReGameHookRegistry
typedef IHookChain<void, int> IReGameHook_PM_AirMove;
typedef IHookChainRegistry<void, int> IReGameHookRegistry_PM_AirMove;

// PM_LadderMove hook
typedef IHookChain<void, struct physent_s *> IReGameHook_PM_LadderMove;
typedef IHookChainRegistry<void, struct physent_s *> IReGameHookRegistry_PM_LadderMove;

// HandleMenu_ChooseAppearance hook
typedef IHookChain<void, class CBasePlayer *, int> IReGameHook_HandleMenu_ChooseAppearance;
typedef IHookChainRegistry<void, class CBasePlayer *, int> IReGameHookRegistry_HandleMenu_ChooseAppearance;
Expand Down Expand Up @@ -653,6 +657,8 @@ class IReGameHookchains {
virtual IReGameHookRegistry_CBasePlayer_Pain *CBasePlayer_Pain() = 0;
virtual IReGameHookRegistry_CBasePlayer_DeathSound *CBasePlayer_DeathSound() = 0;
virtual IReGameHookRegistry_CBasePlayer_JoiningThink *CBasePlayer_JoiningThink() = 0;

virtual IReGameHookRegistry_PM_LadderMove *PM_LadderMove() = 0;
};

struct ReGameFuncs_t {
Expand Down