Skip to content
Open
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
8 changes: 8 additions & 0 deletions reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#define RG_CBasePlayerWeapon_DefaultShotgunReload RG_CBaseWeapon_DefShotgunReload
#define RG_CBasePlayer_Observer_SetMode RG_CBasePlayer_Observer_SetMod
#define RG_CBasePlayer_Observer_FindNextPlayer RG_CBasePlayer_Observer_FindNxt
#define RG_CSGameRules_PlayerRelationship RG_CSGameRules_PlayerRelation
#endif

/**
Expand Down Expand Up @@ -1272,6 +1273,13 @@ enum GamedllFunc_CSGameRules
* Params: (const pKiller, const pVictim, const pAssister, const pevInflictor, const killerWeaponName[], const DeathMessageFlags:iDeathMessageFlags, const KillRarity:iRarityOfKill)
*/
RG_CSGameRules_SendDeathMessage,

/*
* Description: What is the player's relationship with this entity?
* Return type: int
* Params: (const pPlayer, const pEntity)
*/
RG_CSGameRules_PlayerRelationship,
};

/**
Expand Down
7 changes: 6 additions & 1 deletion reapi/include/cssdk/dlls/regamedll_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include <API/CSInterfaces.h>

#define REGAMEDLL_API_VERSION_MAJOR 5
#define REGAMEDLL_API_VERSION_MINOR 30
#define REGAMEDLL_API_VERSION_MINOR 31

// CBasePlayer::Spawn hook
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_Spawn;
Expand Down Expand Up @@ -638,6 +638,10 @@ typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBa
typedef IHookChainClass<void, class CBasePlayer, class CBasePlayer *, float, float> IReGameHook_CBasePlayer_TakeDamageImpulse;
typedef IHookChainRegistryClass<void, class CBasePlayer, class CBasePlayer *, float, float> IReGameHookRegistry_CBasePlayer_TakeDamageImpulse;

// CHalfLifeMultiplay::PlayerRelationship hook
typedef IHookChain<int, CBasePlayer *, CBaseEntity *> IReGameHook_CSGameRules_PlayerRelationship;
typedef IHookChainRegistry<int, CBasePlayer *, CBaseEntity *> IReGameHookRegistry_CSGameRules_PlayerRelationship;

class IReGameHookchains {
public:
virtual ~IReGameHookchains() {}
Expand Down Expand Up @@ -802,6 +806,7 @@ class IReGameHookchains {
virtual IReGameHookRegistry_CBasePlayer_RemoveAllItems *CBasePlayer_RemoveAllItems() = 0;
virtual IReGameHookRegistry_CBasePlayer_UpdateStatusBar *CBasePlayer_UpdateStatusBar() = 0;
virtual IReGameHookRegistry_CBasePlayer_TakeDamageImpulse *CBasePlayer_TakeDamageImpulse() = 0;
virtual IReGameHookRegistry_CSGameRules_PlayerRelationship *CSGameRules_PlayerRelationship() = 0;
};

struct ReGameFuncs_t {
Expand Down
10 changes: 10 additions & 0 deletions reapi/src/hook_callback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,16 @@ void CBasePlayer_TakeDamageImpulse(IReGameHook_CBasePlayer_TakeDamageImpulse *ch
callVoidForward(RG_CBasePlayer_TakeDamageImpulse, original, indexOfEdict(pthis->pev), indexOfEdict(pAttacker->pev), flKnockbackForce, flVelModifier);
}

int CSGameRules_PlayerRelationship(IReGameHook_CSGameRules_PlayerRelationship *chain, CBasePlayer *pPlayer, CBaseEntity *pEntity)
{
auto original = [chain](int _pPlayer, int _pEntity)
{
return chain->callNext(getPrivate<CBasePlayer>(_pPlayer), getPrivate<CBaseEntity>(_pEntity));
};

return callForward(RG_CSGameRules_PlayerRelationship, original, indexOfEdict(pPlayer->pev), indexOfEdict(pEntity->pev));
}

/*
* VTC functions
*/
Expand Down
1 change: 1 addition & 0 deletions reapi/src/hook_callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@ void CBasePlayer_RemoveAllItems(IReGameHook_CBasePlayer_RemoveAllItems *chain, C
void CSGameRules_SendDeathMessage(IReGameHook_CSGameRules_SendDeathMessage *chain, CBaseEntity *pKiller, CBasePlayer *pVictim, CBasePlayer *pAssister, entvars_t *pevInflictor, const char *killerWeaponName, int iDeathMessageFlags, int iRarityOfKill);
void CBasePlayer_UpdateStatusBar(IReGameHook_CBasePlayer_UpdateStatusBar *chain, CBasePlayer *pthis);
void CBasePlayer_TakeDamageImpulse(IReGameHook_CBasePlayer_TakeDamageImpulse *chain, CBasePlayer *pthis, CBasePlayer *pAttacker, float flKnockbackForce, float flVelModifier);
int CSGameRules_PlayerRelationship(IReGameHook_CSGameRules_PlayerRelationship *chain, CBasePlayer *pPlayer, CBaseEntity *pEntity);

/*
* VTC functions
Expand Down
1 change: 1 addition & 0 deletions reapi/src/hook_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ hook_t hooklist_gamerules[] = {
DLL(CSGameRules_TeamStacked),
DLL(CSGameRules_PlayerGotWeapon),
DLL(CSGameRules_SendDeathMessage),
DLL(CSGameRules_PlayerRelationship),
};

hook_t hooklist_grenade[] = {
Expand Down
1 change: 1 addition & 0 deletions reapi/src/hook_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ enum GamedllFunc_CSGameRules
RG_CSGameRules_TeamStacked,
RG_CSGameRules_PlayerGotWeapon,
RG_CSGameRules_SendDeathMessage,
RG_CSGameRules_PlayerRelationship,

// [...]
};
Expand Down
2 changes: 1 addition & 1 deletion reapi/version/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
#pragma once

#define VERSION_MAJOR 5
#define VERSION_MINOR 29
#define VERSION_MINOR 30
#define VERSION_MAINTENANCE 0