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

API: New gamedll hookchains (#280)

This commit is contained in:
Francisco Muñoz 2023-09-05 20:33:11 -03:00 committed by GitHub
parent 4ef19557c9
commit 2142208e77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 719 additions and 11 deletions

View File

@ -75,9 +75,9 @@
* global_get(glb_trace_flags) values
* @note Custom flags that we can retrieve in pfnShouldCollide/TraceLine/TraceHull
*/
#define FTRACE_BULLET (1<<16)
#define FTRACE_FLASH (1<<17)
#define FTRACE_KNIFE (1<<18)
#define FTRACE_BULLET (1<<16)
#define FTRACE_FLASH (1<<17)
#define FTRACE_KNIFE (1<<18)
/**
* get_entvar(entity, var_movetype) values
@ -1368,3 +1368,114 @@ enum InfoMapBuyParam
#define SCORE_STATUS_BOMB (1<<1)
#define SCORE_STATUS_VIP (1<<2)
#define SCORE_STATUS_DEFKIT (1<<3)
/**
* For RG_CBotManager_OnEvent
*/
enum GameEventType
{
EVENT_INVALID = 0,
EVENT_WEAPON_FIRED, // tell bots the player is attack (argumens: 1 = attacker, 2 = NULL)
EVENT_WEAPON_FIRED_ON_EMPTY, // tell bots the player is attack without clip ammo (argumens: 1 = attacker, 2 = NULL)
EVENT_WEAPON_RELOADED, // tell bots the player is reloading his weapon (argumens: 1 = reloader, 2 = NULL)
EVENT_HE_GRENADE_EXPLODED, // tell bots the HE grenade is exploded (argumens: 1 = grenade thrower, 2 = NULL)
EVENT_FLASHBANG_GRENADE_EXPLODED, // tell bots the flashbang grenade is exploded (argumens: 1 = grenade thrower, 2 = explosion origin)
EVENT_SMOKE_GRENADE_EXPLODED, // tell bots the smoke grenade is exploded (argumens: 1 = grenade thrower, 2 = NULL)
EVENT_GRENADE_BOUNCED,
EVENT_BEING_SHOT_AT,
EVENT_PLAYER_BLINDED_BY_FLASHBANG, // tell bots the player is flashed (argumens: 1 = flashed player, 2 = NULL)
EVENT_PLAYER_FOOTSTEP, // tell bots the player is running (argumens: 1 = runner, 2 = NULL)
EVENT_PLAYER_JUMPED, // tell bots the player is jumped (argumens: 1 = jumper, 2 = NULL)
EVENT_PLAYER_DIED, // tell bots the player is killed (argumens: 1 = victim, 2 = killer)
EVENT_PLAYER_LANDED_FROM_HEIGHT, // tell bots the player is fell with some damage (argumens: 1 = felled player, 2 = NULL)
EVENT_PLAYER_TOOK_DAMAGE, // tell bots the player is take damage (argumens: 1 = victim, 2 = attacker)
EVENT_HOSTAGE_DAMAGED, // tell bots the player has injured a hostage (argumens: 1 = hostage, 2 = injurer)
EVENT_HOSTAGE_KILLED, // tell bots the player has killed a hostage (argumens: 1 = hostage, 2 = killer)
EVENT_DOOR, // tell bots the door is moving (argumens: 1 = door, 2 = NULL)
EVENT_BREAK_GLASS, // tell bots the glass has break (argumens: 1 = glass, 2 = NULL)
EVENT_BREAK_WOOD, // tell bots the wood has break (argumens: 1 = wood, 2 = NULL)
EVENT_BREAK_METAL, // tell bots the metal/computer has break (argumens: 1 = metal/computer, 2 = NULL)
EVENT_BREAK_FLESH, // tell bots the flesh has break (argumens: 1 = flesh, 2 = NULL)
EVENT_BREAK_CONCRETE, // tell bots the concrete has break (argumens: 1 = concrete, 2 = NULL)
EVENT_BOMB_PLANTED, // tell bots the bomb has been planted (argumens: 1 = planter, 2 = NULL)
EVENT_BOMB_DROPPED, // tell bots the bomb has been dropped (argumens: 1 = NULL, 2 = NULL)
EVENT_BOMB_PICKED_UP, // let the bots hear the bomb pickup (argumens: 1 = player that pickup c4, 2 = NULL)
EVENT_BOMB_BEEP, // let the bots hear the bomb beeping (argumens: 1 = c4, 2 = NULL)
EVENT_BOMB_DEFUSING, // tell the bots someone has started defusing (argumens: 1 = defuser, 2 = NULL)
EVENT_BOMB_DEFUSE_ABORTED, // tell the bots someone has aborted defusing (argumens: 1 = NULL, 2 = NULL)
EVENT_BOMB_DEFUSED, // tell the bots the bomb is defused (argumens: 1 = defuser, 2 = NULL)
EVENT_BOMB_EXPLODED, // let the bots hear the bomb exploding (argumens: 1 = NULL, 2 = NULL)
EVENT_HOSTAGE_USED, // tell bots the hostage is used (argumens: 1 = user, 2 = NULL)
EVENT_HOSTAGE_RESCUED, // tell bots the hostage is rescued (argumens: 1 = rescuer (CBasePlayer *), 2 = hostage (CHostage *))
EVENT_ALL_HOSTAGES_RESCUED, // tell bots the all hostages are rescued (argumens: 1 = NULL, 2 = NULL)
EVENT_VIP_ESCAPED, // tell bots the VIP is escaped (argumens: 1 = NULL, 2 = NULL)
EVENT_VIP_ASSASSINATED, // tell bots the VIP is assassinated (argumens: 1 = NULL, 2 = NULL)
EVENT_TERRORISTS_WIN, // tell bots the terrorists won the round (argumens: 1 = NULL, 2 = NULL)
EVENT_CTS_WIN, // tell bots the CTs won the round (argumens: 1 = NULL, 2 = NULL)
EVENT_ROUND_DRAW, // tell bots the round was a draw (argumens: 1 = NULL, 2 = NULL)
EVENT_ROUND_WIN, // tell carreer the round was a win (argumens: 1 = NULL, 2 = NULL)
EVENT_ROUND_LOSS, // tell carreer the round was a loss (argumens: 1 = NULL, 2 = NULL)
EVENT_ROUND_START, // tell bots the round was started (when freeze period is expired) (argumens: 1 = NULL, 2 = NULL)
EVENT_PLAYER_SPAWNED, // tell bots the player is spawned (argumens: 1 = spawned player, 2 = NULL)
EVENT_CLIENT_CORPSE_SPAWNED,
EVENT_BUY_TIME_START,
EVENT_PLAYER_LEFT_BUY_ZONE,
EVENT_DEATH_CAMERA_START,
EVENT_KILL_ALL,
EVENT_ROUND_TIME,
EVENT_DIE,
EVENT_KILL,
EVENT_HEADSHOT,
EVENT_KILL_FLASHBANGED,
EVENT_TUTOR_BUY_MENU_OPENNED,
EVENT_TUTOR_AUTOBUY,
EVENT_PLAYER_BOUGHT_SOMETHING,
EVENT_TUTOR_NOT_BUYING_ANYTHING,
EVENT_TUTOR_NEED_TO_BUY_PRIMARY_WEAPON,
EVENT_TUTOR_NEED_TO_BUY_PRIMARY_AMMO,
EVENT_TUTOR_NEED_TO_BUY_SECONDARY_AMMO,
EVENT_TUTOR_NEED_TO_BUY_ARMOR,
EVENT_TUTOR_NEED_TO_BUY_DEFUSE_KIT,
EVENT_TUTOR_NEED_TO_BUY_GRENADE,
EVENT_CAREER_TASK_DONE,
EVENT_START_RADIO_1,
EVENT_RADIO_COVER_ME,
EVENT_RADIO_YOU_TAKE_THE_POINT,
EVENT_RADIO_HOLD_THIS_POSITION,
EVENT_RADIO_REGROUP_TEAM,
EVENT_RADIO_FOLLOW_ME,
EVENT_RADIO_TAKING_FIRE,
EVENT_START_RADIO_2,
EVENT_RADIO_GO_GO_GO,
EVENT_RADIO_TEAM_FALL_BACK,
EVENT_RADIO_STICK_TOGETHER_TEAM,
EVENT_RADIO_GET_IN_POSITION_AND_WAIT,
EVENT_RADIO_STORM_THE_FRONT,
EVENT_RADIO_REPORT_IN_TEAM,
EVENT_START_RADIO_3,
EVENT_RADIO_AFFIRMATIVE,
EVENT_RADIO_ENEMY_SPOTTED,
EVENT_RADIO_NEED_BACKUP,
EVENT_RADIO_SECTOR_CLEAR,
EVENT_RADIO_IN_POSITION,
EVENT_RADIO_REPORTING_IN,
EVENT_RADIO_GET_OUT_OF_THERE,
EVENT_RADIO_NEGATIVE,
EVENT_RADIO_ENEMY_DOWN,
EVENT_END_RADIO,
EVENT_NEW_MATCH, // tell bots the game is new (argumens: 1 = NULL, 2 = NULL)
EVENT_PLAYER_CHANGED_TEAM, // tell bots the player is switch his team (also called from ClientPutInServer()) (argumens: 1 = switcher, 2 = NULL)
EVENT_BULLET_IMPACT, // tell bots the player is shoot at wall (argumens: 1 = shooter, 2 = shoot trace end position)
EVENT_GAME_COMMENCE, // tell bots the game is commencing (argumens: 1 = NULL, 2 = NULL)
EVENT_WEAPON_ZOOMED, // tell bots the player is switch weapon zoom (argumens: 1 = zoom switcher, 2 = NULL)
EVENT_HOSTAGE_CALLED_FOR_HELP, // tell bots the hostage is talking (argumens: 1 = listener, 2 = NULL)
NUM_GAME_EVENTS,
};

View File

@ -25,7 +25,8 @@ enum hooks_tables_e
ht_weaponbox,
ht_weapon,
ht_gib,
ht_cbaseentity
ht_cbaseentity,
ht_botmanager
};
enum members_tables_e
@ -81,6 +82,8 @@ enum members_tables_e
mt_gib
};
#define ReAPIFunc {EngineFunc, GamedllFunc, GamedllFunc_CBaseAnimating, GamedllFunc_CBasePlayer, GamedllFunc_CSGameRules, GamedllFunc_CGrenade, GamedllFunc_CWeaponBox, ReCheckerFunc, GamedllFunc_CBasePlayerWeapon, GamedllFunc_CGib, GamedllFunc_CBaseEntity, GamedllFunc_CBotManager}
// Is like FNullEnt
#define is_nullent(%0) (%0 == 0 || is_entity(%0) == false)
@ -149,7 +152,7 @@ enum HookChain
*
* @return Returns a hook handle. Use EnableHookChain/DisableHookChain to toggle the forward on or off
*/
native HookChain:RegisterHookChain({EngineFunc, GamedllFunc, GamedllFunc_CBaseAnimating, GamedllFunc_CBasePlayer, GamedllFunc_CSGameRules, GamedllFunc_CGrenade, GamedllFunc_CWeaponBox, ReCheckerFunc, GamedllFunc_CBasePlayerWeapon, GamedllFunc_CGib, GamedllFunc_CBaseEntity}:function_id, const callback[], post = 0);
native HookChain:RegisterHookChain(ReAPIFunc:function_id, const callback[], post = 0);
/*
* Stops a hook from triggering.
@ -210,7 +213,7 @@ native SetHookChainArg(number, AType:type, any:...);
*
* @return Returns true if the original function was called, otherwise false
*/
native bool:IsReapiHookOriginalWasCalled({EngineFunc, GamedllFunc, GamedllFunc_CBaseAnimating, GamedllFunc_CBasePlayer, GamedllFunc_CSGameRules, GamedllFunc_CGrenade, GamedllFunc_CWeaponBox, ReCheckerFunc, GamedllFunc_CBasePlayerWeapon, GamedllFunc_CGib}:function_id);
native bool:IsReapiHookOriginalWasCalled(ReAPIFunc:function_id);
/*
* Returns the current hookchain handle.

View File

@ -413,6 +413,72 @@ enum GamedllFunc
* Params: (const pLadder, const playerIndex)
*/
RG_PM_LadderMove,
/*
* Description: Called on every frame after a player jumps on water for a short period of time
* Params: (const playerIndex)
*/
RG_PM_WaterJump,
/*
* Description: Called when a player jumps on water for the first time
* Params: (const playerIndex)
*/
RG_PM_CheckWaterJump,
/*
* Description: Called on every frame while player presses jump button
* Params: (const playerIndex)
*/
RG_PM_Jump,
/*
* Description: Called on every frame to check player ducking
* Params: (const playerIndex)
*/
RG_PM_Duck,
/*
* Description: Called whenever player tries to unduck
* Params: (const playerIndex)
*/
RG_PM_UnDuck,
/*
* Description: Called whenever player emits an step sound
* Params: (step, Float:fvol, const playerIndex)
*/
RG_PM_PlayStepSound,
/*
* Description: Called whenever player is on air (not touching floor)
* Params: (Float:wishdir[3], Float:wishspeed, Float:accel, const playerIndex)
*/
RG_PM_AirAccelerate,
/*
* Description: Called when game clears multidamage data (before TraceAttack)
* Params: ()
*/
RG_ClearMultiDamage,
/*
* Description: Called inside TraceAttack to store entity damage to multidamage data
* Params: (const pevInflictor, const pEntity, Float:flDamage, bitsDamageType)
*/
RG_AddMultiDamage,
/*
* Description: Called after game finished a bullet tracing for applying damage cached on multidamage data
* Params: (const pevInflictor, const pevAttacker)
*/
RG_ApplyMultiDamage,
/*
* Description: Called when player buys an item from buy menu (Nightvision, Kevlar, etc.)
* Params: (const pPlayer, iSlot)
*/
RG_BuyItem,
};
/**
@ -834,6 +900,20 @@ enum GamedllFunc_CBasePlayer
* Params: (const this)
*/
RG_CBasePlayer_JoiningThink,
/*
* Description: Called every client frame to check time based damage
* Return type: void
* Params: (const this)
*/
RG_CBasePlayer_CheckTimeBasedDamage,
/*
* Description: Called when game selects a spawn point (info_player_start/deathmatch) to position the player
* Return type: edict_t * (Entity index of selected spawn point)
* Params: (const this)
*/
RG_CBasePlayer_EntSelectSpawnPoint,
};
/**
@ -868,6 +948,29 @@ enum GamedllFunc_CBasePlayerWeapon
* Params: (const this, iAnim, iStartAnim, Float:fDelay, Float:fStartDelay, const pszReloadSound1[], const pszReloadSound2[])
*/
RG_CBasePlayerWeapon_DefaultShotgunReload,
/*
* Description: Called every client frame (PlayerPostThink) for the player's active weapon
* Return type: void
* Params: (const this)
*/
RG_CBasePlayerWeapon_ItemPostFrame,
/*
* Description: Called whenever player fires a weapon and shakes player screen (punchangles altering)
* @note Weapons that use KickBack: AK47, AUG, FAMAS, GALIL, M249, M4A1, MAC10, MP5NAVY, P90, SG552, TMP, UMP45
* Return type: void
* Params: (const this, Float:up_base, Float:lateral_base, Float:up_modifier, Float:lateral_modifier, Float:p_max, Float:lateral_max, direction_change)
*/
RG_CBasePlayerWeapon_KickBack,
/*
* Description: Called whenever game sends an animation to his current holder (player)
* @note This is often called for all animations in exception of "fire" and "idle" sequences (both called via client prediction)
* Return type: void
* Params: (const this, iAnim, skiplocal)
*/
RG_CBasePlayerWeapon_SendWeaponAnim,
};
/**
@ -922,6 +1025,21 @@ enum GamedllFunc_CBaseEntity
RG_CBaseEntity_FireBullets3,
};
/**
* GamedllFunc CBotManager
*/
enum GamedllFunc_CBotManager
{
/*
* Description: Called on each improved bot event
* Return type: void
* Params: (GameEventType:event, const pEntity, const pOther)
*/
RG_CBotManager_OnEvent = BEGIN_FUNC_REGION(botmanager),
}
/**
* GamedllFunc CSGameRules
*/
@ -1081,6 +1199,32 @@ enum GamedllFunc_CSGameRules
* Params: (const listener, const sender)
*/
RG_CSGameRules_CanPlayerHearPlayer,
/*
* Description: Called every server frame to process game rules
* Params: ()
*/
RG_CSGameRules_Think,
/*
* Description: Called each time player tries to join a team to ensure availability
* Return type: bool
* Params: (team_id)
*/
RG_CSGameRules_TeamFull,
/*
* Description: Called each time player tries to join a team to ensure a fair distribution of players (based on mp_limitteams cvar)
* Return type: bool
* Params: (newTeam_id, curTeam_id)
*/
RG_CSGameRules_TeamStacked,
/*
* Description: Called each time player gets a weapon linked to his inventory
* Params: (const pPlayer, const pWeapon)
*/
RG_CSGameRules_PlayerGotWeapon,
};
/**

View File

@ -36,6 +36,7 @@
#include <gamerules.h>
#include <client.h>
#include <gib.h>
#include <GameEvent.h>
#include <API/CSInterfaces.h>
#define REGAMEDLL_API_VERSION_MAJOR 5
@ -237,10 +238,6 @@ 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;
@ -529,6 +526,94 @@ typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBa
typedef IHookChain<void, class CGameRules **> IReGameHook_FreeGameRules;
typedef IHookChainRegistry<void, class CGameRules **> IReGameHookRegistry_FreeGameRules;
// PM_LadderMove hook
typedef IHookChain<void, struct physent_s *> IReGameHook_PM_LadderMove;
typedef IHookChainRegistry<void, struct physent_s *> IReGameHookRegistry_PM_LadderMove;
// PM_WaterJump hook
typedef IHookChain<void> IReGameHook_PM_WaterJump;
typedef IHookChainRegistry<void> IReGameHookRegistry_PM_WaterJump;
// PM_CheckWaterJump hook
typedef IHookChain<void> IReGameHook_PM_CheckWaterJump;
typedef IHookChainRegistry<void> IReGameHookRegistry_PM_CheckWaterJump;
// PM_Jump hook
typedef IHookChain<void> IReGameHook_PM_Jump;
typedef IHookChainRegistry<void> IReGameHookRegistry_PM_Jump;
// PM_Duck hook
typedef IHookChain<void> IReGameHook_PM_Duck;
typedef IHookChainRegistry<void> IReGameHookRegistry_PM_Duck;
// PM_UnDuck hook
typedef IHookChain<void> IReGameHook_PM_UnDuck;
typedef IHookChainRegistry<void> IReGameHookRegistry_PM_UnDuck;
// PM_PlayStepSound hook
typedef IHookChain<void, int, float> IReGameHook_PM_PlayStepSound;
typedef IHookChainRegistry<void, int, float> IReGameHookRegistry_PM_PlayStepSound;
// PM_AirAccelerate hook
typedef IHookChain<void, vec_t *, float, float> IReGameHook_PM_AirAccelerate;
typedef IHookChainRegistry<void, vec_t *, float, float> IReGameHookRegistry_PM_AirAccelerate;
// ClearMultiDamage hook
typedef IHookChain<void> IReGameHook_ClearMultiDamage;
typedef IHookChainRegistry<void> IReGameHookRegistry_ClearMultiDamage;
// AddMultiDamage hook
typedef IHookChain<void, entvars_t *, CBaseEntity *, float, int> IReGameHook_AddMultiDamage;
typedef IHookChainRegistry<void, entvars_t *, CBaseEntity *, float, int> IReGameHookRegistry_AddMultiDamage;
// ApplyMultiDamage hook
typedef IHookChain<void, entvars_t *, entvars_t *> IReGameHook_ApplyMultiDamage;
typedef IHookChainRegistry<void, entvars_t *, entvars_t *> IReGameHookRegistry_ApplyMultiDamage;
// BuyItem hook
typedef IHookChain<void, CBasePlayer *, int> IReGameHook_BuyItem;
typedef IHookChainRegistry<void, CBasePlayer *, int> IReGameHookRegistry_BuyItem;
// CHalfLifeMultiplay::Think hook
typedef IHookChain<void> IReGameHook_CSGameRules_Think;
typedef IHookChainRegistry<void> IReGameHookRegistry_CSGameRules_Think;
// CHalfLifeMultiplay::TeamFull hook
typedef IHookChain<BOOL, int> IReGameHook_CSGameRules_TeamFull;
typedef IHookChainRegistry<BOOL, int> IReGameHookRegistry_CSGameRules_TeamFull;
// CHalfLifeMultiplay::TeamStacked hook
typedef IHookChain<BOOL, int, int> IReGameHook_CSGameRules_TeamStacked;
typedef IHookChainRegistry<BOOL, int, int> IReGameHookRegistry_CSGameRules_TeamStacked;
// CHalfLifeMultiplay::PlayerGotWeapon hook
typedef IHookChain<void, CBasePlayer *, CBasePlayerItem *> IReGameHook_CSGameRules_PlayerGotWeapon;
typedef IHookChainRegistry<void, CBasePlayer *, CBasePlayerItem *> IReGameHookRegistry_CSGameRules_PlayerGotWeapon;
// CBotManager::OnEvent hook
typedef IHookChain<void, GameEventType, CBaseEntity *, CBaseEntity *> IReGameHook_CBotManager_OnEvent;
typedef IHookChainRegistry<void, GameEventType, CBaseEntity*, CBaseEntity*> IReGameHookRegistry_CBotManager_OnEvent;
// CBasePlayer::CheckTimeBasedDamage hook
typedef IHookChainClass<void, CBasePlayer> IReGameHook_CBasePlayer_CheckTimeBasedDamage;
typedef IHookChainRegistryClass<void, CBasePlayer> IReGameHookRegistry_CBasePlayer_CheckTimeBasedDamage;
// CBasePlayer::EntSelectSpawnPoint hook
typedef IHookChainClass<edict_t *, CBasePlayer> IReGameHook_CBasePlayer_EntSelectSpawnPoint;
typedef IHookChainRegistryClass<edict_t *, CBasePlayer> IReGameHookRegistry_CBasePlayer_EntSelectSpawnPoint;
// CBasePlayerWeapon::ItemPostFrame hook
typedef IHookChainClass<void, CBasePlayerWeapon> IReGameHook_CBasePlayerWeapon_ItemPostFrame;
typedef IHookChainRegistryClass<void, CBasePlayerWeapon> IReGameHookRegistry_CBasePlayerWeapon_ItemPostFrame;
// CBasePlayerWeapon::KickBack hook
typedef IHookChainClass<void, CBasePlayerWeapon, float, float, float, float, float, float, int> IReGameHook_CBasePlayerWeapon_KickBack;
typedef IHookChainRegistryClass<void, CBasePlayerWeapon, float, float, float, float, float, float, int> IReGameHookRegistry_CBasePlayerWeapon_KickBack;
// CBasePlayerWeapon::SendWeaponAnim hook
typedef IHookChainClass<void, CBasePlayerWeapon, int, int> IReGameHook_CBasePlayerWeapon_SendWeaponAnim;
typedef IHookChainRegistryClass<void, CBasePlayerWeapon, int, int> IReGameHookRegistry_CBasePlayerWeapon_SendWeaponAnim;
class IReGameHookchains {
public:
virtual ~IReGameHookchains() {}
@ -665,6 +750,27 @@ public:
virtual IReGameHookRegistry_FreeGameRules *FreeGameRules() = 0;
virtual IReGameHookRegistry_PM_LadderMove *PM_LadderMove() = 0;
virtual IReGameHookRegistry_PM_WaterJump *PM_WaterJump() = 0;
virtual IReGameHookRegistry_PM_CheckWaterJump *PM_CheckWaterJump() = 0;
virtual IReGameHookRegistry_PM_Jump *PM_Jump() = 0;
virtual IReGameHookRegistry_PM_Duck *PM_Duck() = 0;
virtual IReGameHookRegistry_PM_UnDuck *PM_UnDuck() = 0;
virtual IReGameHookRegistry_PM_PlayStepSound *PM_PlayStepSound() = 0;
virtual IReGameHookRegistry_PM_AirAccelerate *PM_AirAccelerate() = 0;
virtual IReGameHookRegistry_ClearMultiDamage *ClearMultiDamage() = 0;
virtual IReGameHookRegistry_AddMultiDamage *AddMultiDamage() = 0;
virtual IReGameHookRegistry_ApplyMultiDamage *ApplyMultiDamage() = 0;
virtual IReGameHookRegistry_BuyItem *BuyItem() = 0;
virtual IReGameHookRegistry_CSGameRules_Think *CSGameRules_Think() = 0;
virtual IReGameHookRegistry_CSGameRules_TeamFull *CSGameRules_TeamFull() = 0;
virtual IReGameHookRegistry_CSGameRules_TeamStacked *CSGameRules_TeamStacked() = 0;
virtual IReGameHookRegistry_CSGameRules_PlayerGotWeapon *CSGameRules_PlayerGotWeapon() = 0;
virtual IReGameHookRegistry_CBotManager_OnEvent *CBotManager_OnEvent() = 0;
virtual IReGameHookRegistry_CBasePlayer_CheckTimeBasedDamage *CBasePlayer_CheckTimeBasedDamage() = 0;
virtual IReGameHookRegistry_CBasePlayer_EntSelectSpawnPoint *CBasePlayer_EntSelectSpawnPoint() = 0;
virtual IReGameHookRegistry_CBasePlayerWeapon_ItemPostFrame *CBasePlayerWeapon_ItemPostFrame() = 0;
virtual IReGameHookRegistry_CBasePlayerWeapon_KickBack *CBasePlayerWeapon_KickBack() = 0;
virtual IReGameHookRegistry_CBasePlayerWeapon_SendWeaponAnim *CBasePlayerWeapon_SendWeaponAnim() = 0;
};
struct ReGameFuncs_t {
@ -685,6 +791,12 @@ struct ReGameFuncs_t {
void (*UTIL_RestartOther)(const char *szClassname);
void (*UTIL_ResetEntities)();
void (*UTIL_RemoveOther)(const char *szClassname, int nCount);
void (*UTIL_DecalTrace)(TraceResult *pTrace, int decalNumber);
void (*UTIL_Remove)(CBaseEntity *pEntity);
int (*AddAmmoNameToAmmoRegistry)(const char *szAmmoname);
void (*TextureTypePlaySound)(TraceResult *ptr, Vector vecSrc, Vector vecEnd, int iBulletType);
class CWeaponBox *(*CreateWeaponBox)(CBasePlayerItem *pItem, CBasePlayer *pPlayerOwner, const char *modelName, Vector &origin, Vector &angles, Vector &velocity, float lifeTime, bool packAmmo);
class CGrenade *(*SpawnGrenade)(WeaponIdType weaponId, entvars_t *pevOwner, Vector &vecSrc, Vector &vecThrow, float time, int iTeam, unsigned short usEvent);
};
class IReGameApi {

View File

@ -1458,6 +1458,254 @@ void PM_LadderMove(IReGameHook_PM_LadderMove *chain, physent_t *pLadder)
PM_LadderMove_AMXX(chain, pLadder, pLadder->player + 1);
}
void PM_WaterJump_AMXX(IReGameHook_PM_WaterJump *chain, int playerIndex)
{
auto original = [chain](int _playerIndex)
{
chain->callNext();
};
callVoidForward(RG_PM_WaterJump, original, playerIndex);
}
void PM_WaterJump(IReGameHook_PM_WaterJump *chain)
{
PM_WaterJump_AMXX(chain, g_pMove->player_index + 1);
}
void PM_CheckWaterJump_AMXX(IReGameHook_PM_CheckWaterJump *chain, int playerIndex)
{
auto original = [chain](int _playerIndex)
{
chain->callNext();
};
callVoidForward(RG_PM_CheckWaterJump, original, playerIndex);
}
void PM_CheckWaterJump(IReGameHook_PM_CheckWaterJump *chain)
{
PM_CheckWaterJump_AMXX(chain, g_pMove->player_index + 1);
}
void PM_Jump_AMXX(IReGameHook_PM_Jump *chain, int playerIndex)
{
auto original = [chain](int _playerIndex)
{
chain->callNext();
};
callVoidForward(RG_PM_Jump, original, playerIndex);
}
void PM_Jump(IReGameHook_PM_Jump *chain)
{
PM_Jump_AMXX(chain, g_pMove->player_index + 1);
}
void PM_Duck_AMXX(IReGameHook_PM_Duck *chain, int playerIndex)
{
auto original = [chain](int _playerIndex)
{
chain->callNext();
};
callVoidForward(RG_PM_Duck, original, playerIndex);
}
void PM_Duck(IReGameHook_PM_Duck *chain)
{
PM_Duck_AMXX(chain, g_pMove->player_index + 1);
}
void PM_UnDuck_AMXX(IReGameHook_PM_UnDuck *chain, int playerIndex)
{
auto original = [chain](int _playerIndex)
{
chain->callNext();
};
callVoidForward(RG_PM_UnDuck, original, playerIndex);
}
void PM_UnDuck(IReGameHook_PM_UnDuck *chain)
{
PM_UnDuck_AMXX(chain, g_pMove->player_index + 1);
}
void PM_PlayStepSound_AMXX(IReGameHook_PM_PlayStepSound *chain, int step, float fvol, int playerIndex)
{
auto original = [chain](int _step, float _fvol, int _playerIndex)
{
chain->callNext(_step, _fvol);
};
callVoidForward(RG_PM_PlayStepSound, original, step, fvol, playerIndex);
}
void PM_PlayStepSound(IReGameHook_PM_PlayStepSound *chain, int step, float fvol)
{
PM_PlayStepSound_AMXX(chain, step, fvol, g_pMove->player_index + 1);
}
void PM_AirAccelerate_AMXX(IReGameHook_PM_AirAccelerate *chain, vec_t *wishdir, float wishspeed, float accel, int playerIndex)
{
Vector wishdirCopy(wishdir);
auto original = [chain, &wishdirCopy](cell _wishdir, float _wishspeed, float _accel, int _playerIndex)
{
chain->callNext(wishdirCopy, _wishspeed, _accel);
};
callVoidForward(RG_PM_AirAccelerate, original, getAmxVector(wishdirCopy), wishspeed, accel, playerIndex);
}
void PM_AirAccelerate(IReGameHook_PM_AirAccelerate *chain, vec_t *wishdir, float wishspeed, float accel)
{
PM_AirAccelerate_AMXX(chain, wishdir, wishspeed, accel, g_pMove->player_index + 1);
}
void ClearMultiDamage(IReGameHook_ClearMultiDamage *chain)
{
auto original = [chain]()
{
chain->callNext();
};
callVoidForward(RG_ClearMultiDamage, original);
}
void AddMultiDamage(IReGameHook_AddMultiDamage *chain, entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType)
{
auto original = [chain](int _pevInflictor, int _pEntity, float _flDamage, int _bitsDamageType)
{
chain->callNext(PEV(_pevInflictor), getPrivate<CBaseEntity>(_pEntity), _flDamage, _bitsDamageType);
};
callVoidForward(RG_AddMultiDamage, original, indexOfEdict(pevInflictor), indexOfEdict(pEntity->pev), flDamage, bitsDamageType);
}
void ApplyMultiDamage(IReGameHook_ApplyMultiDamage *chain, entvars_t *pevInflictor, entvars_t *pevAttacker)
{
auto original = [chain](int _pevInflictor, int _pevAttacker)
{
chain->callNext(PEV(_pevInflictor), PEV(_pevAttacker));
};
callVoidForward(RG_ApplyMultiDamage, original, indexOfEdict(pevInflictor), indexOfEdict(pevAttacker));
}
void BuyItem(IReGameHook_BuyItem *chain, CBasePlayer *pPlayer, int iSlot)
{
auto original = [chain](int _pPlayer, int _iSlot)
{
chain->callNext(getPrivate<CBasePlayer>(_pPlayer), _iSlot);
};
callVoidForward(RG_AddMultiDamage, original, indexOfEdict(pPlayer->pev), iSlot);
}
void CSGameRules_Think(IReGameHook_CSGameRules_Think *chain)
{
auto original = [chain]()
{
chain->callNext();
};
callVoidForward(RG_CSGameRules_Think, original);
}
BOOL CSGameRules_TeamFull(IReGameHook_CSGameRules_TeamFull *chain, int team_id)
{
auto original = [chain](int _team_id)
{
return chain->callNext(_team_id);
};
return callForward<BOOL>(RG_CSGameRules_TeamFull, original, team_id);
}
BOOL CSGameRules_TeamStacked(IReGameHook_CSGameRules_TeamStacked *chain, int newTeam_id, int curTeam_id)
{
auto original = [chain](int _newTeam_id, int _curTeam_id)
{
return chain->callNext(_newTeam_id, _curTeam_id);
};
return callForward<BOOL>(RG_CSGameRules_TeamStacked, original, newTeam_id, curTeam_id);
}
void CSGameRules_PlayerGotWeapon(IReGameHook_CSGameRules_PlayerGotWeapon *chain, CBasePlayer *pPlayer, CBasePlayerItem *pWeapon)
{
auto original = [chain](int _pPlayer, int _pWeapon)
{
chain->callNext(getPrivate<CBasePlayer>(_pPlayer), getPrivate<CBasePlayerItem>(_pWeapon));
};
callVoidForward(RG_CSGameRules_PlayerGotWeapon, original, indexOfEdict(pPlayer->pev), indexOfEdict(pWeapon->pev));
}
void CBotManager_OnEvent(IReGameHook_CBotManager_OnEvent *chain, GameEventType event, CBaseEntity* pEntity, CBaseEntity* pOther)
{
auto original = [chain](GameEventType _event, int _pEntity, int _pOther)
{
chain->callNext(_event, getPrivate<CBaseEntity>(_pEntity), getPrivate<CBaseEntity>(_pOther));
};
callVoidForward(RG_CBotManager_OnEvent, original, event, indexOfEdict(pEntity->pev), indexOfEdict(pOther->pev));
}
void CBasePlayer_CheckTimeBasedDamage(IReGameHook_CBasePlayer_CheckTimeBasedDamage *chain, CBasePlayer *pthis)
{
auto original = [chain](int _pthis)
{
chain->callNext(getPrivate<CBasePlayer>(_pthis));
};
callVoidForward(RG_CBasePlayer_CheckTimeBasedDamage, original, indexOfEdict(pthis->pev));
}
edict_t *CBasePlayer_EntSelectSpawnPoint(IReGameHook_CBasePlayer_EntSelectSpawnPoint *chain, CBasePlayer *pthis)
{
auto original = [chain](int _pthis)
{
return indexOfEdict(chain->callNext(getPrivate<CBasePlayer>(_pthis)));
};
return edictByIndexAmx(callForward<size_t>(RG_CBasePlayer_EntSelectSpawnPoint, original, indexOfEdict(pthis->pev)));
}
void CBasePlayerWeapon_ItemPostFrame(IReGameHook_CBasePlayerWeapon_ItemPostFrame *chain, CBasePlayerWeapon *pthis)
{
auto original = [chain](int _pthis)
{
chain->callNext(getPrivate<CBasePlayerWeapon>(_pthis));
};
callVoidForward(RG_CBasePlayerWeapon_ItemPostFrame, original, indexOfEdict(pthis->pev));
}
void CBasePlayerWeapon_KickBack(IReGameHook_CBasePlayerWeapon_KickBack *chain, CBasePlayerWeapon *pthis, float up_base, float lateral_base, float up_modifier, float lateral_modifier, float up_max, float lateral_max, int direction_change)
{
auto original = [chain](int _pthis, float _up_base, float _lateral_base, float _up_modifier, float _lateral_modifier, float _up_max, float _lateral_max, int _direction_change)
{
chain->callNext(getPrivate<CBasePlayerWeapon>(_pthis), _up_base, _lateral_base, _up_modifier, _lateral_modifier, _up_max, _lateral_max, _direction_change);
};
callVoidForward(RG_CBasePlayerWeapon_KickBack, original, indexOfEdict(pthis->pev), up_base, lateral_base, up_modifier, lateral_modifier, up_max, lateral_max, direction_change);
}
void CBasePlayerWeapon_SendWeaponAnim(IReGameHook_CBasePlayerWeapon_SendWeaponAnim *chain, CBasePlayerWeapon *pthis, int iAnim, int skiplocal)
{
auto original = [chain](int _pthis, int _iAnim, int _skiplocal)
{
chain->callNext(getPrivate<CBasePlayerWeapon>(_pthis), _iAnim, _skiplocal);
};
callVoidForward(RG_CBasePlayerWeapon_SendWeaponAnim, original, indexOfEdict(pthis->pev), iAnim, skiplocal);
}
/*
* VTC functions
*/
@ -1527,3 +1775,4 @@ void CmdExec(IRecheckerHook_CmdExec *chain, IGameClient *cl, IResourceBuffer *re
CmdExec_t data(chain, res);
CmdExec_AMXX(&data, cl, res->GetFileName(), cmdExec, responseHash);
}

View File

@ -529,6 +529,34 @@ void CBasePlayer_JoiningThink(IReGameHook_CBasePlayer_JoiningThink *chain, CBase
// TODO: pending FreeGameRules
void PM_LadderMove_AMXX(IReGameHook_PM_LadderMove *chain, physent_t *pLadder, int playerIndex);
void PM_LadderMove(IReGameHook_PM_LadderMove *chain, physent_t *pLadder);
void PM_WaterJump_AMXX(IReGameHook_PM_WaterJump *chain, int playerIndex);
void PM_WaterJump(IReGameHook_PM_WaterJump *chain);
void PM_CheckWaterJump_AMXX(IReGameHook_PM_CheckWaterJump *chain, int playerIndex);
void PM_CheckWaterJump(IReGameHook_PM_CheckWaterJump *chain);
void PM_Jump_AMXX(IReGameHook_PM_Jump *chain, int playerIndex);
void PM_Jump(IReGameHook_PM_Jump *chain);
void PM_Duck_AMXX(IReGameHook_PM_Duck *chain, int playerIndex);
void PM_Duck(IReGameHook_PM_Duck *chain);
void PM_UnDuck_AMXX(IReGameHook_PM_UnDuck *chain, int playerIndex);
void PM_UnDuck(IReGameHook_PM_UnDuck *chain);
void PM_PlayStepSound_AMXX(IReGameHook_PM_PlayStepSound *chain, int step, float fvol, int playerIndex);
void PM_PlayStepSound(IReGameHook_PM_PlayStepSound *chain, int step, float fvol);
void PM_AirAccelerate_AMXX(IReGameHook_PM_AirAccelerate *chain, vec_t *wishdir, float wishspeed, float accel, int playerIndex);
void PM_AirAccelerate(IReGameHook_PM_AirAccelerate *chain, vec_t *wishdir, float wishspeed, float accel);
void ClearMultiDamage(IReGameHook_ClearMultiDamage *chain);
void AddMultiDamage(IReGameHook_AddMultiDamage *chain, entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType);
void ApplyMultiDamage(IReGameHook_ApplyMultiDamage *chain, entvars_t *pevInflictor, entvars_t *pevAttacker);
void BuyItem(IReGameHook_BuyItem *chain, CBasePlayer *pPlayer, int iSlot);
void CSGameRules_Think(IReGameHook_CSGameRules_Think *chain);
BOOL CSGameRules_TeamFull(IReGameHook_CSGameRules_TeamFull *chain, int team_id);
BOOL CSGameRules_TeamStacked(IReGameHook_CSGameRules_TeamStacked *chain, int newTeam_id, int curTeam_id);
void CSGameRules_PlayerGotWeapon(IReGameHook_CSGameRules_PlayerGotWeapon *chain, CBasePlayer *pPlayer, CBasePlayerItem *pWeapon);
void CBotManager_OnEvent(IReGameHook_CBotManager_OnEvent *chain, GameEventType event, CBaseEntity* pEntity, CBaseEntity* pOther);
void CBasePlayer_CheckTimeBasedDamage(IReGameHook_CBasePlayer_CheckTimeBasedDamage *chain, CBasePlayer *pthis);
edict_t *CBasePlayer_EntSelectSpawnPoint(IReGameHook_CBasePlayer_EntSelectSpawnPoint *chain, CBasePlayer *pthis);
void CBasePlayerWeapon_ItemPostFrame(IReGameHook_CBasePlayerWeapon_ItemPostFrame *chain, CBasePlayerWeapon *pthis);
void CBasePlayerWeapon_KickBack(IReGameHook_CBasePlayerWeapon_KickBack *chain, CBasePlayerWeapon *pthis, float up_base, float lateral_base, float up_modifier, float lateral_modifier, float up_max, float lateral_max, int direction_change);
void CBasePlayerWeapon_SendWeaponAnim(IReGameHook_CBasePlayerWeapon_SendWeaponAnim *chain, CBasePlayerWeapon *pthis, int iAnim, int skiplocal);
/*
* VTC functions
@ -552,3 +580,4 @@ void FileConsistencyProcess_AMXX(FileConsistencyProcess_t *data, IGameClient *cl
void FileConsistencyProcess(IRecheckerHook_FileConsistencyProcess *chain, IGameClient *cl, IResourceBuffer *res, ResourceType_e typeFind, uint32 responseHash);
void FileConsistencyFinal(IRecheckerHook_FileConsistencyFinal *chain, IGameClient *cl);

View File

@ -23,6 +23,8 @@ inline size_t getFwdParamType(void(*)(IResourceBuffer*)) { return FP_CELL
inline size_t getFwdParamType(void(*)(unsigned char)) { return FP_CELL; }
inline size_t getFwdParamType(void(*)(resourcetype_t)) { return FP_CELL; }
inline size_t getFwdParamType(void(*)(cmd_source_t)) { return FP_CELL; }
inline size_t getFwdParamType(void(*)(GameEventType)) { return FP_CELL; }
inline size_t getFwdParamType(void(*)(float*)) { return FP_ARRAY; }
template <typename T>
inline size_t getFwdParamType(void(*)(T *)) { return FP_CELL; }
@ -131,7 +133,18 @@ hook_t hooklist_gamedll[] = {
DLL(SpawnHeadGib),
DLL(SpawnRandomGibs),
DLL(CreateWeaponBox),
DLL(PM_LadderMove),
DLL(PM_LadderMove, _AMXX),
DLL(PM_WaterJump, _AMXX),
DLL(PM_CheckWaterJump, _AMXX),
DLL(PM_Jump, _AMXX),
DLL(PM_Duck, _AMXX),
DLL(PM_UnDuck, _AMXX),
DLL(PM_PlayStepSound, _AMXX),
DLL(PM_AirAccelerate, _AMXX),
DLL(ClearMultiDamage),
DLL(AddMultiDamage),
DLL(ApplyMultiDamage),
DLL(BuyItem),
};
hook_t hooklist_animating[] = {
@ -196,6 +209,9 @@ hook_t hooklist_player[] = {
DLL(CBasePlayer_Pain),
DLL(CBasePlayer_DeathSound),
DLL(CBasePlayer_JoiningThink),
DLL(CBasePlayer_CheckTimeBasedDamage),
DLL(CBasePlayer_EntSelectSpawnPoint),
};
hook_t hooklist_gamerules[] = {
@ -223,6 +239,10 @@ hook_t hooklist_gamerules[] = {
DLL(CSGameRules_BalanceTeams),
DLL(CSGameRules_OnRoundFreezeEnd),
DLL(CSGameRules_CanPlayerHearPlayer),
DLL(CSGameRules_Think),
DLL(CSGameRules_TeamFull),
DLL(CSGameRules_TeamStacked),
DLL(CSGameRules_PlayerGotWeapon),
};
hook_t hooklist_grenade[] = {
@ -243,6 +263,9 @@ hook_t hooklist_weapon[] = {
DLL(CBasePlayerWeapon_DefaultDeploy),
DLL(CBasePlayerWeapon_DefaultReload),
DLL(CBasePlayerWeapon_DefaultShotgunReload),
DLL(CBasePlayerWeapon_ItemPostFrame),
DLL(CBasePlayerWeapon_KickBack),
DLL(CBasePlayerWeapon_SendWeaponAnim),
};
hook_t hooklist_gib[] = {
@ -257,6 +280,10 @@ hook_t hooklist_cbaseentity[] = {
DLL(CBaseEntity_FireBullets3),
};
hook_t hooklist_botmanager[] = {
DLL(CBotManager_OnEvent),
};
#define RCHECK(h,...) { {}, {}, #h, "ReChecker", [](){ return api_cfg.hasRechecker(); }, ((!(RC_##h & (MAX_REGION_RANGE - 1)) ? regfunc::current_cell = 1, true : false) || (RC_##h & (MAX_REGION_RANGE - 1)) == regfunc::current_cell++) ? regfunc(h##__VA_ARGS__) : regfunc(#h#__VA_ARGS__), [](){ g_RecheckerHookchains->h()->registerHook(&h); }, [](){ g_RecheckerHookchains->h()->unregisterHook(&h); }, false}
hook_t hooklist_rechecker[] = {
RCHECK(FileConsistencyProcess, _AMXX),
@ -283,6 +310,7 @@ hook_t* hooklist_t::getHookSafe(size_t hook)
CASE(weapon)
CASE(gib)
CASE(cbaseentity)
CASE(botmanager)
}
return nullptr;
@ -303,6 +331,7 @@ void hooklist_t::clear()
FOREACH_CLEAR(weapon);
FOREACH_CLEAR(gib);
FOREACH_CLEAR(cbaseentity);
FOREACH_CLEAR(botmanager);
}
void hook_t::clear()

View File

@ -38,6 +38,7 @@ extern hook_t hooklist_weaponbox[];
extern hook_t hooklist_weapon[];
extern hook_t hooklist_gib[];
extern hook_t hooklist_cbaseentity[];
extern hook_t hooklist_botmanager[];
enum
{
@ -65,6 +66,7 @@ struct hooklist_t
CASE(weapon)
CASE(gib)
CASE(cbaseentity)
CASE(botmanager)
}
#undef CASE
@ -88,6 +90,7 @@ struct hooklist_t
ht_weapon,
ht_gib,
ht_cbaseentity,
ht_botmanager,
};
};
@ -146,6 +149,17 @@ enum GamedllFunc
RG_CreateWeaponBox,
RG_PM_LadderMove,
RG_PM_WaterJump,
RG_PM_CheckWaterJump,
RG_PM_Jump,
RG_PM_Duck,
RG_PM_UnDuck,
RG_PM_PlayStepSound,
RG_PM_AirAccelerate,
RG_ClearMultiDamage,
RG_AddMultiDamage,
RG_ApplyMultiDamage,
RG_BuyItem,
// [...]
};
@ -219,6 +233,9 @@ enum GamedllFunc_CBasePlayer
RG_CBasePlayer_DeathSound,
RG_CBasePlayer_JoiningThink,
RG_CBasePlayer_CheckTimeBasedDamage,
RG_CBasePlayer_EntSelectSpawnPoint,
// [...]
};
@ -247,6 +264,9 @@ enum GamedllFunc_CBasePlayerWeapon
RG_CBasePlayerWeapon_DefaultDeploy,
RG_CBasePlayerWeapon_DefaultReload,
RG_CBasePlayerWeapon_DefaultShotgunReload,
RG_CBasePlayerWeapon_ItemPostFrame,
RG_CBasePlayerWeapon_KickBack,
RG_CBasePlayerWeapon_SendWeaponAnim,
// [...]
};
@ -278,6 +298,10 @@ enum GamedllFunc_CSGameRules
RG_CSGameRules_BalanceTeams,
RG_CSGameRules_OnRoundFreezeEnd,
RG_CSGameRules_CanPlayerHearPlayer,
RG_CSGameRules_Think,
RG_CSGameRules_TeamFull,
RG_CSGameRules_TeamStacked,
RG_CSGameRules_PlayerGotWeapon,
// [...]
};
@ -300,6 +324,13 @@ enum GamedllFunc_CBaseEntity
// [...]
};
enum GamedllFunc_CBotManager
{
RG_CBotManager_OnEvent = BEGIN_FUNC_REGION(botmanager),
// [...]
};
enum ReCheckerFunc
{
RC_FileConsistencyProcess = BEGIN_FUNC_REGION(rechecker),