reapi
reapi copied to clipboard
`API`: Implement `RG_PM_LadderMove` hook
Related to https://github.com/s1lentq/reapi/issues/82
useful to create plugins like this: https://dev-cs.ru/threads/19404/
@s1lentq merge it, please :)
@s1lentq orpheu example https://forums.alliedmods.net/showpost.php?p=1290113&postcount=2
@ShadowsAdi @s1lentq I think this hook should keep the schema of PM_AirMove implementation, keeping physent parameter and an additional player index parameter
@s1lentq CAPI_Impl.h
// PM_LadderMove hook
typedef IHookChainImpl<void, physent_t *, int> CReGameHook_PM_LadderMove;
typedef IHookChainRegistryImpl<void, physent_t *, int> CReGameHookRegistry_PM_LadderMove;
pm_shared.cpp
LINK_HOOK_VOID_CHAIN(PM_LadderMove, (physent_t *pLadder, int playerIndex = 0), pLadder, pmove->player_index + 1);
void EXT_FUNC __API_HOOK(PM_LadderMove)(physent_t *pLadder, int playerIndex)
{
PM_LadderMove_internal(pLadder);
}
void PM_LadderMove_internal(physent_t *pLadder)
{
// ...
}
regamedll_api.h
// PM_LadderMove hook
typedef IHookChain<void, physent_t *, int> IReGameHook_PM_LadderMove;
typedef IHookChainRegistry<void, physent_t *, int> IReGameHookRegistry_PM_LadderMove;
@dystopm I thought I took a hasty merge, but this isn't the case, in my opinion, AirMove actually isn't a very good scheme, especially for modules where have a easy access to pmove. I think it's better to use the wrapper with custom arguments for AMXX rather than doing it in the API. Moreover, there are already a couple of such functions like PM_Move, PM_UpdateStepSound etc. Don't you think?
I agree about the physent argument.
@s1lentq
I see you ended adding the physent argument which I think is fine guessing we can add logic in future to change physent structure values, so it's a yes, I agree with you.
In that case, shouldn't PM_AirMove be modified?
PD: there's a few of functions which I coded in my own fork which I find useful to be added, I'll be doing a commit taking advantage of you are merging
In that case, shouldn't PM_AirMove be modified?
No, we should keep API compatibility at least until we update the major version