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_UnDuck hook #743

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions regamedll/dlls/API/CAPI_Impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ GAMEHOOK_REGISTRY(CSGameRules_GoToIntermission);
GAMEHOOK_REGISTRY(CSGameRules_BalanceTeams);
GAMEHOOK_REGISTRY(CSGameRules_OnRoundFreezeEnd);
GAMEHOOK_REGISTRY(PM_UpdateStepSound);
GAMEHOOK_REGISTRY(PM_UnDuck);
GAMEHOOK_REGISTRY(CBasePlayer_StartDeathCam);
GAMEHOOK_REGISTRY(CBasePlayer_SwitchTeam);
GAMEHOOK_REGISTRY(CBasePlayer_CanSwitchTeam);
Expand Down
7 changes: 7 additions & 0 deletions regamedll/dlls/API/CAPI_Impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,10 @@ typedef IHookChainRegistryClassEmptyImpl<bool, CCStrikeGameMgrHelper, CBasePlaye
typedef IHookChainImpl<void> CReGameHook_PM_UpdateStepSound;
typedef IHookChainRegistryImpl<void> CReGameHookRegistry_PM_UpdateStepSound;

// PM_UnDuck hook
typedef IHookChainImpl<void> CReGameHook_PM_UnDuck;
typedef IHookChainRegistryImpl<void> CReGameHookRegistry_PM_UnDuck;

// CBasePlayer::StartDeathCam hook
typedef IHookChainClassImpl<void, CBasePlayer> CReGameHook_CBasePlayer_StartDeathCam;
typedef IHookChainRegistryClassImpl<void, CBasePlayer> CReGameHookRegistry_CBasePlayer_StartDeathCam;
Expand Down Expand Up @@ -728,6 +732,7 @@ class CReGameHookchains: public IReGameHookchains {
CReGameHookRegistry_CSGameRules_BalanceTeams m_CSGameRules_BalanceTeams;
CReGameHookRegistry_CSGameRules_OnRoundFreezeEnd m_CSGameRules_OnRoundFreezeEnd;
CReGameHookRegistry_PM_UpdateStepSound m_PM_UpdateStepSound;
CReGameHookRegistry_PM_UnDuck m_PM_UnDuck;
CReGameHookRegistry_CBasePlayer_StartDeathCam m_CBasePlayer_StartDeathCam;
CReGameHookRegistry_CBasePlayer_SwitchTeam m_CBasePlayer_SwitchTeam;
CReGameHookRegistry_CBasePlayer_CanSwitchTeam m_CBasePlayer_CanSwitchTeam;
Expand Down Expand Up @@ -904,6 +909,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_UnDuck *PM_UnDuck();
};

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 @@ -1793,7 +1793,9 @@ void PM_FixPlayerCrouchStuck(int direction)
VectorCopy(test, pmove->origin);
}

void PM_UnDuck()
LINK_HOOK_VOID_CHAIN2(PM_UnDuck);

void EXT_FUNC __API_HOOK(PM_UnDuck)()
{
#ifdef REGAMEDLL_ADD
if (unduck_method.value)
Expand Down
1 change: 1 addition & 0 deletions regamedll/pm_shared/pm_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ 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_UnDuck_OrigFunc();
#else
void PM_AirMove(int playerIndex = 0);
#endif
Expand Down
5 changes: 5 additions & 0 deletions regamedll/public/regamedll/regamedll_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,10 @@ typedef IHookChainRegistry<bool, class CBasePlayer *, class CBasePlayer *> IReGa
typedef IHookChain<void> IReGameHook_PM_UpdateStepSound;
typedef IHookChainRegistry<void> IReGameHookRegistry_PM_UpdateStepSound;

// PM_UnDuck hook
typedef IHookChain<void> IReGameHook_PM_UnDuck;
typedef IHookChainRegistry<void> IReGameHookRegistry_PM_UnDuck;

// CBasePlayer::StartDeathCam hook
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_StartDeathCam;
typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBasePlayer_StartDeathCam;
Expand Down Expand Up @@ -653,6 +657,7 @@ 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_UnDuck *PM_UnDuck() = 0;
};

struct ReGameFuncs_t {
Expand Down