Added api hooks gamerules functions

This commit is contained in:
s1lentq 2016-05-18 00:01:46 +06:00
parent d75089461c
commit 32d0c580dc
25 changed files with 747 additions and 116 deletions

View File

@ -1074,7 +1074,7 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
}
int fullArmor = (pPlayer->pev->armorvalue >= 100);
bool bHasHelmet = (pPlayer->m_iKevlar == ARMOR_TYPE_HELMET);
bool bHasHelmet = (pPlayer->m_iKevlar == ARMOR_VESTHELM);
bool bEnoughMoney = false;
switch (iSlot)

View File

@ -437,8 +437,7 @@ public:
virtual void ChangeLevel();
virtual void GoToIntermission();
#ifdef HOOK_GAMEDLL
#if defined(REGAMEDLL_API) || defined(HOOK_GAMEDLL)
void RefreshSkillData_();
void Think_();
BOOL IsAllowedToSpawn_(CBaseEntity *pEntity);
@ -496,8 +495,7 @@ public:
void GiveC4_();
void ChangeLevel_();
void GoToIntermission_();
#endif // HOOK_GAMEDLL
#endif
public:
// Checks if it still needs players to start a round, or if it has enough players to start rounds.
@ -573,6 +571,8 @@ public:
void ResetCurrentVIP();
void BalanceTeams();
void BalanceTeams_();
void SwapAllPlayers();
void UpdateTeamScores();
void DisplayMaps(CBasePlayer *player, int iVote);

View File

@ -284,8 +284,8 @@ void CItemKevlar::__MAKE_VHOOK(Precache)()
BOOL CItemKevlar::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
{
if (pPlayer->m_iKevlar == ARMOR_TYPE_EMPTY)
pPlayer->m_iKevlar = ARMOR_TYPE_KEVLAR;
if (pPlayer->m_iKevlar == ARMOR_NONE)
pPlayer->m_iKevlar = ARMOR_KEVLAR;
pPlayer->pev->armorvalue = 100;
EMIT_SOUND(pPlayer->edict(), CHAN_ITEM, "items/ammopickup2.wav", VOL_NORM, ATTN_NORM);
@ -322,7 +322,7 @@ void CItemAssaultSuit::__MAKE_VHOOK(Precache)()
BOOL CItemAssaultSuit::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
{
pPlayer->m_iKevlar = ARMOR_TYPE_HELMET;
pPlayer->m_iKevlar = ARMOR_VESTHELM;
pPlayer->pev->armorvalue = 100;
EMIT_SOUND(pPlayer->edict(), CHAN_ITEM, "items/ammopickup2.wav", VOL_NORM, ATTN_NORM);

View File

@ -154,7 +154,9 @@ BOOL CHalfLifeMultiplay::IsCareer()
return IS_CAREER_MATCH();
}
void CHalfLifeMultiplay::__MAKE_VHOOK(ServerDeactivate)()
LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(CHalfLifeMultiplay, CSGameRules, ServerDeactivate);
void CHalfLifeMultiplay::__API_VHOOK(ServerDeactivate)()
{
if (!IsCareer())
{
@ -584,7 +586,9 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(RefreshSkillData)()
gSkillData.plrDmgRPG = 120;
}
void CHalfLifeMultiplay::__MAKE_VHOOK(RemoveGuns)()
LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(CHalfLifeMultiplay, CSGameRules, RemoveGuns);
void CHalfLifeMultiplay::__API_VHOOK(RemoveGuns)()
{
CBaseEntity *toremove = NULL;
@ -613,7 +617,9 @@ void CHalfLifeMultiplay::UpdateTeamScores()
MESSAGE_END();
}
void CHalfLifeMultiplay::__MAKE_VHOOK(CleanUpMap)()
LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(CHalfLifeMultiplay, CSGameRules, CleanUpMap);
void CHalfLifeMultiplay::__API_VHOOK(CleanUpMap)()
{
// Recreate all the map entities from the map data (preserving their indices),
// then remove everything else except the players.
@ -728,7 +734,9 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(CleanUpMap)()
PLAYBACK_EVENT((FEV_GLOBAL | FEV_RELIABLE), 0, m_usResetDecals);
}
void CHalfLifeMultiplay::__MAKE_VHOOK(GiveC4)()
LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(CHalfLifeMultiplay, CSGameRules, GiveC4);
void CHalfLifeMultiplay::__API_VHOOK(GiveC4)()
{
int iTeamCount;
int iTemp = 0;
@ -937,8 +945,10 @@ void CHalfLifeMultiplay::QueueCareerRoundEndMenu(float tmDelay, int iWinStatus)
}
}
LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(CHalfLifeMultiplay, CSGameRules, CheckWinConditions);
// Check if the scenario has been won/lost.
void CHalfLifeMultiplay::__MAKE_VHOOK(CheckWinConditions)()
void CHalfLifeMultiplay::__API_VHOOK(CheckWinConditions)()
{
if (HasRoundInfinite())
return;
@ -1555,7 +1565,9 @@ void CHalfLifeMultiplay::SwapAllPlayers()
UpdateTeamScores();
}
void CHalfLifeMultiplay::BalanceTeams()
LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(CHalfLifeMultiplay, CSGameRules, BalanceTeams);
void CHalfLifeMultiplay::__API_HOOK(BalanceTeams)()
{
int iTeamToSwap = UNASSIGNED;
int iNumToSwap;
@ -1645,7 +1657,9 @@ void CHalfLifeMultiplay::BalanceTeams()
}
}
void CHalfLifeMultiplay::__MAKE_VHOOK(CheckMapConditions)()
LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(CHalfLifeMultiplay, CSGameRules, CheckMapConditions);
void CHalfLifeMultiplay::__API_VHOOK(CheckMapConditions)()
{
// Check to see if this map has a bomb target in it
if (UTIL_FindEntityByClassname(NULL, "func_bomb_target"))
@ -1681,7 +1695,9 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(CheckMapConditions)()
m_iMapHasVIPSafetyZone = MAP_HAVE_VIP_SAFETYZONE_NO;
}
void CHalfLifeMultiplay::__MAKE_VHOOK(RestartRound)()
LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(CHalfLifeMultiplay, CSGameRules, RestartRound);
void CHalfLifeMultiplay::__API_VHOOK(RestartRound)()
{
// tell bots that the round is restarting
if (TheBots != NULL)
@ -3074,7 +3090,9 @@ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(IsCoOp)()
return gpGlobals->coop;
}
BOOL CHalfLifeMultiplay::__MAKE_VHOOK(FShouldSwitchWeapon)(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon)
LINK_HOOK_CLASS_CUSTOM_CHAIN(BOOL, CHalfLifeMultiplay, CSGameRules, FShouldSwitchWeapon, (CBasePlayer *pPlayer, CBasePlayerItem *pWeapon), pPlayer, pWeapon);
BOOL CHalfLifeMultiplay::__API_VHOOK(FShouldSwitchWeapon)(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon)
{
if (!pWeapon->CanDeploy())
return FALSE;
@ -3094,7 +3112,9 @@ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(FShouldSwitchWeapon)(CBasePlayer *pPlayer,
return FALSE;
}
BOOL CHalfLifeMultiplay::__MAKE_VHOOK(GetNextBestWeapon)(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon)
LINK_HOOK_CLASS_CUSTOM_CHAIN(BOOL, CHalfLifeMultiplay, CSGameRules, GetNextBestWeapon, (CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon), pPlayer, pCurrentWeapon);
BOOL CHalfLifeMultiplay::__API_VHOOK(GetNextBestWeapon)(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon)
{
CBasePlayerItem *pCheck;
CBasePlayerItem *pBest; // this will be used in the event that we don't find a weapon in the same category.
@ -3397,13 +3417,17 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(ClientDisconnected)(edict_t *pClient)
CheckWinConditions();
}
float CHalfLifeMultiplay::__MAKE_VHOOK(FlPlayerFallDamage)(CBasePlayer *pPlayer)
LINK_HOOK_CLASS_CUSTOM_CHAIN(float, CHalfLifeMultiplay, CSGameRules, FlPlayerFallDamage, (CBasePlayer *pPlayer), pPlayer);
float CHalfLifeMultiplay::__API_VHOOK(FlPlayerFallDamage)(CBasePlayer *pPlayer)
{
pPlayer->m_flFallVelocity -= PLAYER_MAX_SAFE_FALL_SPEED;
return pPlayer->m_flFallVelocity * DAMAGE_FOR_FALL_SPEED * 1.25;
}
BOOL CHalfLifeMultiplay::__MAKE_VHOOK(FPlayerCanTakeDamage)(CBasePlayer *pPlayer, CBaseEntity *pAttacker)
LINK_HOOK_CLASS_CUSTOM_CHAIN(BOOL, CHalfLifeMultiplay, CSGameRules, FPlayerCanTakeDamage, (CBasePlayer *pPlayer, CBaseEntity *pAttacker), pPlayer, pAttacker);
BOOL CHalfLifeMultiplay::__API_VHOOK(FPlayerCanTakeDamage)(CBasePlayer *pPlayer, CBaseEntity *pAttacker)
{
if (!pAttacker || PlayerRelationship(pPlayer, pAttacker) != GR_TEAMMATE)
{
@ -3485,8 +3509,10 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerThink)(CBasePlayer *pPlayer)
}
}
LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN(CHalfLifeMultiplay, CSGameRules, PlayerSpawn, (CBasePlayer *pPlayer), pPlayer);
// Purpose: Player has just spawned. Equip them.
void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerSpawn)(CBasePlayer *pPlayer)
void CHalfLifeMultiplay::__API_VHOOK(PlayerSpawn)(CBasePlayer *pPlayer)
{
// This is tied to the joining state (m_iJoiningState).. add it when the joining state is there.
if (pPlayer->m_bJustConnected)
@ -3516,7 +3542,9 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerSpawn)(CBasePlayer *pPlayer)
pPlayer->SetPlayerModel(false);
}
BOOL CHalfLifeMultiplay::__MAKE_VHOOK(FPlayerCanRespawn)(CBasePlayer *pPlayer)
LINK_HOOK_CLASS_CUSTOM_CHAIN(BOOL, CHalfLifeMultiplay, CSGameRules, FPlayerCanRespawn, (CBasePlayer *pPlayer), pPlayer);
BOOL CHalfLifeMultiplay::__API_VHOOK(FPlayerCanRespawn)(CBasePlayer *pPlayer)
{
// Player cannot respawn twice in a round
if (pPlayer->m_iNumSpawns > 0)
@ -3571,7 +3599,9 @@ int CHalfLifeMultiplay::__MAKE_VHOOK(IPointsForKill)(CBasePlayer *pAttacker, CBa
return 1;
}
void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor)
LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN(CHalfLifeMultiplay, CSGameRules, PlayerKilled, (CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor), pVictim, pKiller, pInflictor);
void CHalfLifeMultiplay::__API_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor)
{
DeathNotice(pVictim, pKiller, pInflictor);
@ -3712,7 +3742,9 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvar
}
}
void CHalfLifeMultiplay::__MAKE_VHOOK(DeathNotice)(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pevInflictor)
LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN(CHalfLifeMultiplay, CSGameRules, DeathNotice, (CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pevInflictor), pVictim, pKiller, pevInflictor);
void CHalfLifeMultiplay::__API_VHOOK(DeathNotice)(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pevInflictor)
{
// Work out what killed the player, and send a message to all clients about it
// CBaseEntity *Killer = CBaseEntity::Instance(pKiller);
@ -3876,7 +3908,9 @@ int CHalfLifeMultiplay::__MAKE_VHOOK(WeaponShouldRespawn)(CBasePlayerItem *pWeap
return GR_WEAPON_RESPAWN_YES;
}
BOOL CHalfLifeMultiplay::__MAKE_VHOOK(CanHavePlayerItem)(CBasePlayer *pPlayer, CBasePlayerItem *pItem)
LINK_HOOK_CLASS_CUSTOM_CHAIN(BOOL, CHalfLifeMultiplay, CSGameRules, CanHavePlayerItem, (CBasePlayer *pPlayer, CBasePlayerItem *pItem), pPlayer, pItem);
BOOL CHalfLifeMultiplay::__API_VHOOK(CanHavePlayerItem)(CBasePlayer *pPlayer, CBasePlayerItem *pItem)
{
return CGameRules::CanHavePlayerItem(pPlayer, pItem);
}
@ -3951,7 +3985,9 @@ float CHalfLifeMultiplay::__MAKE_VHOOK(FlHEVChargerRechargeTime)()
return 30;
}
int CHalfLifeMultiplay::__MAKE_VHOOK(DeadPlayerWeapons)(CBasePlayer *pPlayer)
LINK_HOOK_CLASS_CUSTOM_CHAIN(int, CHalfLifeMultiplay, CSGameRules, DeadPlayerWeapons, (CBasePlayer *pPlayer), pPlayer);
int CHalfLifeMultiplay::__API_VHOOK(DeadPlayerWeapons)(CBasePlayer *pPlayer)
{
return GR_PLR_DROP_GUN_ACTIVE;
}
@ -3961,7 +3997,9 @@ int CHalfLifeMultiplay::__MAKE_VHOOK(DeadPlayerAmmo)(CBasePlayer *pPlayer)
return GR_PLR_DROP_AMMO_ACTIVE;
}
edict_t *CHalfLifeMultiplay::__MAKE_VHOOK(GetPlayerSpawnSpot)(CBasePlayer *pPlayer)
LINK_HOOK_CLASS_CUSTOM_CHAIN(edict_t *, CHalfLifeMultiplay, CSGameRules, GetPlayerSpawnSpot, (CBasePlayer *pPlayer), pPlayer);
edict_t *CHalfLifeMultiplay::__API_VHOOK(GetPlayerSpawnSpot)(CBasePlayer *pPlayer)
{
// gat valid spawn point
edict_t *pentSpawnSpot = CGameRules::GetPlayerSpawnSpot(pPlayer);
@ -4018,7 +4056,9 @@ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(FAllowMonsters)()
return CVAR_GET_FLOAT("mp_allowmonsters") != 0;
}
void CHalfLifeMultiplay::__MAKE_VHOOK(GoToIntermission)()
LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(CHalfLifeMultiplay, CSGameRules, GoToIntermission);
void CHalfLifeMultiplay::__API_VHOOK(GoToIntermission)()
{
if (g_fGameOver)
return;
@ -4545,8 +4585,10 @@ void CHalfLifeMultiplay::ProcessMapVote(CBasePlayer *player, int iVote)
DisplayMaps(NULL, iVote);
}
LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(CHalfLifeMultiplay, CSGameRules, ChangeLevel);
// Server is changing to a new level, check mapcycle.txt for map name and setup info
void CHalfLifeMultiplay::__MAKE_VHOOK(ChangeLevel)()
void CHalfLifeMultiplay::__API_VHOOK(ChangeLevel)()
{
static char szPreviousMapCycleFile[256];
static mapcycle_t mapcycle;
@ -4722,7 +4764,9 @@ void CHalfLifeMultiplay::SendMOTDToClient(edict_t *client)
FREE_FILE(aFileList);
}
void CHalfLifeMultiplay::__MAKE_VHOOK(ClientUserInfoChanged)(CBasePlayer *pPlayer, char *infobuffer)
LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN(CHalfLifeMultiplay, CSGameRules, ClientUserInfoChanged, (CBasePlayer *pPlayer, char *infobuffer), pPlayer, infobuffer);
void CHalfLifeMultiplay::__API_VHOOK(ClientUserInfoChanged)(CBasePlayer *pPlayer, char *infobuffer)
{
pPlayer->SetPlayerModel(pPlayer->m_bHasC4);
pPlayer->SetPrefsFromUserinfo(infobuffer);

View File

@ -594,7 +594,7 @@ void CBasePlayer::Pain(int iLastHitGroup, bool HasArmour)
if (iLastHitGroup == HITGROUP_HEAD)
{
if (m_iKevlar == ARMOR_TYPE_HELMET)
if (m_iKevlar == ARMOR_VESTHELM)
{
EMIT_SOUND(ENT(pev), CHAN_VOICE, "player/bhit_helmet-1.wav", VOL_NORM, ATTN_NORM);
return;
@ -755,7 +755,7 @@ void CBasePlayer::__API_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDamag
case HITGROUP_HEAD:
{
if (m_iKevlar == ARMOR_TYPE_HELMET)
if (m_iKevlar == ARMOR_VESTHELM)
{
bShouldBleed = false;
bShouldSpark = true;
@ -783,7 +783,7 @@ void CBasePlayer::__API_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDamag
{
flDamage *= 1;
if (m_iKevlar != ARMOR_TYPE_EMPTY)
if (m_iKevlar != ARMOR_NONE)
bShouldBleed = false;
else if (bShouldBleed)
@ -799,7 +799,7 @@ void CBasePlayer::__API_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDamag
{
flDamage *= 1.25;
if (m_iKevlar != ARMOR_TYPE_EMPTY)
if (m_iKevlar != ARMOR_NONE)
bShouldBleed = false;
else if (bShouldBleed)
@ -814,7 +814,7 @@ void CBasePlayer::__API_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDamag
case HITGROUP_LEFTARM:
case HITGROUP_RIGHTARM:
{
if (m_iKevlar != ARMOR_TYPE_EMPTY)
if (m_iKevlar != ARMOR_NONE)
bShouldBleed = false;
break;
@ -996,7 +996,7 @@ int CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev
flDamage = flNew;
if (pev->armorvalue <= 0.0)
m_iKevlar = ARMOR_TYPE_EMPTY;
m_iKevlar = ARMOR_NONE;
Pain(m_LastHitGroup, true);
}
@ -1246,7 +1246,7 @@ int CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev
flDamage = flNew;
if (pev->armorvalue <= 0.0f)
m_iKevlar = ARMOR_TYPE_EMPTY;
m_iKevlar = ARMOR_NONE;
Pain(m_LastHitGroup, true);
}
@ -5060,7 +5060,7 @@ void CBasePlayer::__API_VHOOK(Spawn)()
if (!m_bNotKilled)
{
pev->armorvalue = 0;
m_iKevlar = ARMOR_TYPE_EMPTY;
m_iKevlar = ARMOR_NONE;
}
pev->maxspeed = 1000;
@ -5316,7 +5316,7 @@ void CBasePlayer::__API_VHOOK(Spawn)()
if (m_bIsVIP)
{
m_iKevlar = ARMOR_TYPE_HELMET;
m_iKevlar = ARMOR_VESTHELM;
pev->armorvalue = 200;
HintMessage("#Hint_you_are_the_vip", TRUE, TRUE);
}
@ -5791,6 +5791,25 @@ void CBasePlayer::__API_HOOK(GiveNamedItem)(const char *pszName)
pent->v.origin = pev->origin;
pent->v.spawnflags |= SF_NORESPAWN;
DispatchSpawn(pent);
DispatchTouch(pent, ENT(pev));
}
// external function for 3rd-party
void CBasePlayer::GiveNamedItemEx(const char *pszName)
{
string_t istr = ALLOC_STRING(pszName);
edict_t *pent = CREATE_NAMED_ENTITY(istr);
if (FNullEnt(pent))
{
ALERT(at_console, "NULL Ent in GiveNamedItem!\n");
return;
}
pent->v.origin = pev->origin;
pent->v.spawnflags |= SF_NORESPAWN;
DispatchSpawn(pent);
DispatchTouch(pent, ENT(pev));
@ -8019,14 +8038,14 @@ BOOL CBasePlayer::IsArmored(int nHitGroup)
{
BOOL fApplyArmor = FALSE;
if (m_iKevlar == ARMOR_TYPE_EMPTY)
if (m_iKevlar == ARMOR_NONE)
return FALSE;
switch (nHitGroup)
{
case HITGROUP_HEAD:
{
fApplyArmor = (m_iKevlar == ARMOR_TYPE_HELMET);
fApplyArmor = (m_iKevlar == ARMOR_VESTHELM);
break;
}
case HITGROUP_GENERIC:
@ -8171,7 +8190,7 @@ bool CBasePlayer::CanAffordSecondaryAmmo()
bool CBasePlayer::CanAffordArmor()
{
if (m_iKevlar == ARMOR_TYPE_KEVLAR && pev->armorvalue == 100.0f && m_iAccount >= HELMET_PRICE)
if (m_iKevlar == ARMOR_KEVLAR && pev->armorvalue == 100.0f && m_iAccount >= HELMET_PRICE)
return true;
return (m_iAccount >= KEVLAR_PRICE);
@ -8209,7 +8228,7 @@ bool CBasePlayer::NeedsSecondaryAmmo()
bool CBasePlayer::NeedsArmor()
{
if (m_iKevlar == ARMOR_TYPE_EMPTY)
if (m_iKevlar == ARMOR_NONE)
return true;
return (pev->armorvalue < 50.0f);
@ -9088,7 +9107,7 @@ void CBasePlayer::RebuyArmor()
{
if (m_rebuyStruct.m_armor > m_iKevlar)
{
if (m_rebuyStruct.m_armor == ARMOR_TYPE_KEVLAR)
if (m_rebuyStruct.m_armor == ARMOR_KEVLAR)
ClientCommand("vest");
else
ClientCommand("vesthelm");

View File

@ -480,6 +480,7 @@ public:
void ItemPostFrame();
void GiveNamedItem(const char *pszName);
void GiveNamedItem_(const char *pszName);
void GiveNamedItemEx(const char *pszName);
void EnableControl(BOOL fControl);
bool HintMessage(const char *pMessage, BOOL bDisplayIfPlayerDead = FALSE, BOOL bOverride = FALSE);
void SendAmmoUpdate();

View File

@ -2181,7 +2181,7 @@ void CArmoury::ArmouryTouch(CBaseEntity *pOther)
}
case ARMOURY_KEVLAR:
{
if (p->m_iKevlar == ARMOR_TYPE_KEVLAR)
if (p->m_iKevlar == ARMOR_KEVLAR)
return;
p->GiveNamedItem("item_kevlar");
@ -2190,7 +2190,7 @@ void CArmoury::ArmouryTouch(CBaseEntity *pOther)
}
case ARMOURY_ASSAULT:
{
if (p->m_iKevlar == ARMOR_TYPE_HELMET)
if (p->m_iKevlar == ARMOR_VESTHELM)
return;
p->GiveNamedItem("item_assaultsuit");

View File

@ -46,10 +46,6 @@ class CBasePlayer;
#define WEAPON_IS_ONTARGET 0x40
#define ARMOR_TYPE_EMPTY 0
#define ARMOR_TYPE_KEVLAR 1 // Armor
#define ARMOR_TYPE_HELMET 2 // Armor and helmet
// the maximum amount of ammo each weapon's clip can hold
#define WEAPON_NOCLIP -1
@ -74,6 +70,13 @@ class CBasePlayer;
#include "wpn_shared.h"
// custom enum
enum ArmorType
{
ARMOR_NONE, // no armor
ARMOR_KEVLAR, // body vest only
ARMOR_VESTHELM, // vest and helmet
};
enum ArmouryItemPack
{
ARMOURY_MP5NAVY,

View File

@ -224,7 +224,7 @@ WeaponClassAliasInfo weaponClassAliasInfo[] =
{ NULL, WEAPONCLASS_NONE }
};
WeaponInfoStruct weaponInfo[27];
WeaponInfoStruct weaponInfo[31];
WeaponInfoStruct weaponInfo_default[] =
{
{ WEAPON_P228, P228_PRICE, AMMO_357SIG_PRICE, AMMO_357SIG_BUY, P228_MAX_CLIP, MAX_AMMO_357SIG, AMMO_357SIG, "weapon_p228", "ammo_357sig" },
@ -252,12 +252,57 @@ WeaponInfoStruct weaponInfo_default[] =
{ WEAPON_SG552, SG552_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, SG552_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_sg552", "ammo_556nato" },
{ WEAPON_AK47, AK47_PRICE, AMMO_762MM_PRICE, AMMO_762NATO_BUY, AK47_MAX_CLIP, MAX_AMMO_762NATO, AMMO_762NATO, "weapon_ak47", "ammo_762nato" },
{ WEAPON_P90, P90_PRICE, AMMO_57MM_PRICE, AMMO_57MM_BUY, P90_MAX_CLIP, MAX_AMMO_57MM, AMMO_57MM, "weapon_p90", "ammo_57mm" },
{ WEAPON_SHIELDGUN, SHIELDGUN_PRICE, 0, 0, 0, 0, AMMO_NONE, "weapon_shield", nullptr },
{ 0, 0, 0, 0, 0, 0, AMMO_NONE, nullptr, nullptr }
#ifdef REGAMEDLL_ADD
{ WEAPON_C4, 0, 0, 0, 0, 0, AMMO_NONE, "weapon_c4", nullptr },
{ WEAPON_KNIFE, 0, 0, 0, 0, 0, AMMO_NONE, "weapon_knife", nullptr },
{ WEAPON_HEGRENADE, (WeaponCostType)HEGRENADE_PRICE, 0, 0, 0, 0, AMMO_NONE, "weapon_hegrenade", nullptr },
{ WEAPON_SMOKEGRENADE, (WeaponCostType)SMOKEGRENADE_PRICE, 0, 0, 0, 0, AMMO_NONE, "weapon_smokegrenade", nullptr },
{ WEAPON_FLASHBANG, (WeaponCostType)FLASHBANG_PRICE, 0, 0, 0, 0, AMMO_NONE, "weapon_flashbang", nullptr },
#endif
{ WEAPON_SHIELDGUN, SHIELDGUN_PRICE, 0, 0, 0, 0, AMMO_NONE, "weapon_shield", nullptr },
#ifndef REGAMEDLL_ADD
{ 0, 0, 0, 0, 0, 0, AMMO_NONE, nullptr, nullptr }
#endif
};
#endif // HOOK_GAMEDLL
WeaponSlotInfo weaponSlotInfo[] = {
{ WEAPON_C4, C4_SLOT, "weapon_c4" },
{ WEAPON_KNIFE, KNIFE_SLOT, "weapon_knife" },
{ WEAPON_P228, PISTOL_SLOT, "weapon_p228" },
{ WEAPON_GLOCK, PISTOL_SLOT, "weapon_glock" },
{ WEAPON_ELITE, PISTOL_SLOT, "weapon_elite" },
{ WEAPON_FIVESEVEN, PISTOL_SLOT, "weapon_fiveseven" },
{ WEAPON_USP, PISTOL_SLOT, "weapon_usp" },
{ WEAPON_GLOCK18, PISTOL_SLOT, "weapon_glock18" },
{ WEAPON_DEAGLE, PISTOL_SLOT, "weapon_deagle" },
{ WEAPON_HEGRENADE, GRENADE_SLOT, "weapon_hegrenade" },
{ WEAPON_SMOKEGRENADE, GRENADE_SLOT, "weapon_smokegrenade" },
{ WEAPON_FLASHBANG, GRENADE_SLOT, "weapon_flashbang" },
{ WEAPON_SCOUT, PRIMARY_WEAPON_SLOT, "weapon_scout" },
{ WEAPON_XM1014, PRIMARY_WEAPON_SLOT, "weapon_xm1014" },
{ WEAPON_MAC10, PRIMARY_WEAPON_SLOT, "weapon_mac10" },
{ WEAPON_AUG, PRIMARY_WEAPON_SLOT, "weapon_aug" },
{ WEAPON_UMP45, PRIMARY_WEAPON_SLOT, "weapon_ump45" },
{ WEAPON_SG550, PRIMARY_WEAPON_SLOT, "weapon_sg550" },
{ WEAPON_GALIL, PRIMARY_WEAPON_SLOT, "weapon_galil" },
{ WEAPON_FAMAS, PRIMARY_WEAPON_SLOT, "weapon_famas" },
{ WEAPON_AWP, PRIMARY_WEAPON_SLOT, "weapon_awp" },
{ WEAPON_MP5N, PRIMARY_WEAPON_SLOT, "weapon_mp5navy" },
{ WEAPON_M249, PRIMARY_WEAPON_SLOT, "weapon_m249" },
{ WEAPON_M3, PRIMARY_WEAPON_SLOT, "weapon_m3" },
{ WEAPON_M4A1, PRIMARY_WEAPON_SLOT, "weapon_m4a1" },
{ WEAPON_TMP, PRIMARY_WEAPON_SLOT, "weapon_tmp" },
{ WEAPON_G3SG1, PRIMARY_WEAPON_SLOT, "weapon_g3sg1" },
{ WEAPON_SG552, PRIMARY_WEAPON_SLOT, "weapon_sg552" },
{ WEAPON_AK47, PRIMARY_WEAPON_SLOT, "weapon_ak47" },
{ WEAPON_P90, PRIMARY_WEAPON_SLOT, "weapon_p90" },
{ WEAPON_SHIELDGUN, NONE_SLOT, "weapon_shield" }
};
// Given an alias, return the associated weapon ID
WeaponIdType AliasToWeaponID(const char *alias)
{
@ -373,15 +418,25 @@ bool IsSecondaryWeapon(int id)
return false;
}
WeaponInfoStruct *EXT_FUNC GetWeaponInfo(int weaponID)
WeaponInfoStruct* GetWeaponInfo(int weaponID)
{
for (int i = 0; weaponInfo[i].id != 0; ++i)
{
if (weaponInfo[i].id == weaponID)
return &weaponInfo[i];
for (auto& info : weaponInfo) {
if (info.id == weaponID) {
return &info;
}
}
return NULL;
return nullptr;
}
WeaponInfoStruct* GetWeaponInfo(const char* weaponName)
{
for (auto& info : weaponInfo) {
if (!Q_stricmp(info.entityName, weaponName)) {
return &info;
}
}
return nullptr;
}
void WeaponInfoReset()
@ -391,6 +446,28 @@ void WeaponInfoReset()
#endif
}
WeaponSlotInfo* GetWeaponSlot(WeaponIdType weaponID)
{
for (auto& infoSlot : weaponSlotInfo) {
if (infoSlot.id == weaponID) {
return &infoSlot;
}
}
return nullptr;
}
WeaponSlotInfo* GetWeaponSlot(const char* weaponName)
{
for (auto& infoSlot : weaponSlotInfo) {
if (!Q_stricmp(infoSlot.weaponName, weaponName)) {
return &infoSlot;
}
}
return nullptr;
}
bool CanBuyWeaponByMaptype(int playerTeam, WeaponIdType weaponID, bool useAssasinationRestrictions)
{
if (useAssasinationRestrictions)

View File

@ -333,7 +333,8 @@ enum shieldgren_e
enum InventorySlotType
{
PRIMARY_WEAPON_SLOT = 1,
NONE_SLOT,
PRIMARY_WEAPON_SLOT,
PISTOL_SLOT,
KNIFE_SLOT,
GRENADE_SLOT,
@ -411,9 +412,15 @@ struct WeaponInfoStruct
#endif
};
struct WeaponSlotInfo
{
WeaponIdType id;
InventorySlotType slot;
const char *weaponName;
};
extern AutoBuyInfoStruct g_autoBuyInfo[35];
extern WeaponStruct g_weaponStruct[MAX_WEAPONS];
extern WeaponInfoStruct weaponInfo[27];
// WeaponType
WeaponIdType AliasToWeaponID(const char *alias);
@ -423,8 +430,13 @@ WeaponClassType AliasToWeaponClass(const char *alias);
WeaponClassType WeaponIDToWeaponClass(int id);
bool IsPrimaryWeapon(int id);
bool IsSecondaryWeapon(int id);
WeaponInfoStruct *GetWeaponInfo(int weaponID);
bool CanBuyWeaponByMaptype(int playerTeam, WeaponIdType weaponID, bool useAssasinationRestrictions);
void WeaponInfoReset();
WeaponInfoStruct* GetWeaponInfo(int weaponID);
WeaponInfoStruct* GetWeaponInfo(const char* weaponName);
WeaponSlotInfo* GetWeaponSlot(WeaponIdType weaponID);
WeaponSlotInfo* GetWeaponSlot(const char* weaponName);
#endif // WEAPONTYPE_H

View File

@ -68,16 +68,6 @@ public:
virtual void unregisterHook(hookfunc_t hook) = 0;
};
// Hook chain registry(for hooks [un]registration)
template<typename t_ret, typename ...t_args>
class IHookChainRegistryClassEmpty {
public:
typedef t_ret(*hookfunc_t)(IHookChain<t_ret, t_args...>*, t_args...);
virtual void registerHook(hookfunc_t hook) = 0;
virtual void unregisterHook(hookfunc_t hook) = 0;
};
// Hook chain registry(for hooks [un]registration)
template<typename ...t_args>
class IVoidHookChainRegistry {

View File

@ -171,8 +171,8 @@ typedef IVoidHookChain<class CBasePlayer *, struct entvars_s *, struct entvars_s
typedef IVoidHookChainRegistry<class CBasePlayer *, struct entvars_s *, struct entvars_s *, Vector &, Vector &, struct TraceResult *> IReGameHookRegistry_RadiusFlash_TraceLine;
// RoundEnd hook
typedef IHookChain<bool, int, ScenarioEventEndRound, float> IReGameHook_RoundEnd;
typedef IHookChainRegistryClassEmpty<bool, int, ScenarioEventEndRound, float> IReGameHookRegistry_RoundEnd;
typedef IHookChain<bool, int, enum ScenarioEventEndRound, float> IReGameHook_RoundEnd;
typedef IHookChainRegistry<bool, int, enum ScenarioEventEndRound, float> IReGameHookRegistry_RoundEnd;
// CanBuyThis hook
typedef IHookChain<bool, class CBasePlayer *, int> IReGameHook_CanBuyThis;
@ -191,8 +191,96 @@ typedef IVoidHookChain<struct playermove_s *, int> IReGameHook_PM_Move;
typedef IVoidHookChainRegistry<struct playermove_s *, int> IReGameHookRegistry_PM_Move;
// PM_AirMove hook
typedef IVoidHookChain<> IReGameHook_PM_AirMove;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_PM_AirMove;
typedef IVoidHookChain<int> IReGameHook_PM_AirMove;
typedef IVoidHookChainRegistry<int> IReGameHookRegistry_PM_AirMove;
// CHalfLifeMultiplay::FShouldSwitchWeapon hook
typedef IHookChain<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHook_CSGameRules_FShouldSwitchWeapon;
typedef IHookChainRegistry<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon;
// CHalfLifeMultiplay::GetNextBestWeapon hook
typedef IHookChain<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHook_CSGameRules_GetNextBestWeapon;
typedef IHookChainRegistry<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHookRegistry_CSGameRules_GetNextBestWeapon;
// CHalfLifeMultiplay::FlPlayerFallDamage hook
typedef IHookChain<float, class CBasePlayer *> IReGameHook_CSGameRules_FlPlayerFallDamage;
typedef IHookChainRegistry<float, class CBasePlayer *> IReGameHookRegistry_CSGameRules_FlPlayerFallDamage;
// CHalfLifeMultiplay::FPlayerCanTakeDamage hook
typedef IHookChain<BOOL, class CBasePlayer *, CBaseEntity *> IReGameHook_CSGameRules_FPlayerCanTakeDamage;
typedef IHookChainRegistry<BOOL, class CBasePlayer *, CBaseEntity *> IReGameHookRegistry_CSGameRules_FPlayerCanTakeDamage;
// CHalfLifeMultiplay::PlayerSpawn hook
typedef IVoidHookChain<class CBasePlayer *> IReGameHook_CSGameRules_PlayerSpawn;
typedef IVoidHookChainRegistry<class CBasePlayer *> IReGameHookRegistry_CSGameRules_PlayerSpawn;
// CHalfLifeMultiplay::FPlayerCanRespawn hook
typedef IHookChain<BOOL, class CBasePlayer *> IReGameHook_CSGameRules_FPlayerCanRespawn;
typedef IHookChainRegistry<BOOL, class CBasePlayer *> IReGameHookRegistry_CSGameRules_FPlayerCanRespawn;
// CHalfLifeMultiplay::GetPlayerSpawnSpot hook
typedef IHookChain<struct edict_s *, class CBasePlayer *> IReGameHook_CSGameRules_GetPlayerSpawnSpot;
typedef IHookChainRegistry<struct edict_s *, class CBasePlayer *> IReGameHookRegistry_CSGameRules_GetPlayerSpawnSpot;
// CHalfLifeMultiplay::ClientUserInfoChanged hook
typedef IVoidHookChain<class CBasePlayer *, char *> IReGameHook_CSGameRules_ClientUserInfoChanged;
typedef IVoidHookChainRegistry<class CBasePlayer *, char *> IReGameHookRegistry_CSGameRules_ClientUserInfoChanged;
// CHalfLifeMultiplay::PlayerKilled hook
typedef IVoidHookChain<class CBasePlayer *, struct entvars_s *, struct entvars_s *> IReGameHook_CSGameRules_PlayerKilled;
typedef IVoidHookChainRegistry<class CBasePlayer *, struct entvars_s *, struct entvars_s *> IReGameHookRegistry_CSGameRules_PlayerKilled;
// CHalfLifeMultiplay::DeathNotice hook
typedef IVoidHookChain<class CBasePlayer *, struct entvars_s *, struct entvars_s *> IReGameHook_CSGameRules_DeathNotice;
typedef IVoidHookChainRegistry<class CBasePlayer *, struct entvars_s *, struct entvars_s *> IReGameHookRegistry_CSGameRules_DeathNotice;
// CHalfLifeMultiplay::CanHavePlayerItem hook
typedef IHookChain<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHook_CSGameRules_CanHavePlayerItem;
typedef IHookChainRegistry<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHookRegistry_CSGameRules_CanHavePlayerItem;
// CHalfLifeMultiplay::DeadPlayerWeapons hook
typedef IHookChain<int, class CBasePlayer *> IReGameHook_CSGameRules_DeadPlayerWeapons;
typedef IHookChainRegistry<int, class CBasePlayer *> IReGameHookRegistry_CSGameRules_DeadPlayerWeapons;
// CHalfLifeMultiplay::ServerDeactivate hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_ServerDeactivate;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_ServerDeactivate;
// CHalfLifeMultiplay::CheckMapConditions hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_CheckMapConditions;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_CheckMapConditions;
// CHalfLifeMultiplay::CleanUpMap hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_CleanUpMap;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_CleanUpMap;
// CHalfLifeMultiplay::RestartRound hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_RestartRound;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_RestartRound;
// CHalfLifeMultiplay::CheckWinConditions hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_CheckWinConditions;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_CheckWinConditions;
// CHalfLifeMultiplay::RemoveGuns hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_RemoveGuns;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_RemoveGuns;
// CHalfLifeMultiplay::GiveC4 hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_GiveC4;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_GiveC4;
// CHalfLifeMultiplay::ChangeLevel hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_ChangeLevel;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_ChangeLevel;
// CHalfLifeMultiplay::GoToIntermission hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_GoToIntermission;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_GoToIntermission;
// CHalfLifeMultiplay::BalanceTeams hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_BalanceTeams;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_BalanceTeams;
class IReGameHookchains {
public:
@ -239,6 +327,29 @@ public:
virtual IReGameHookRegistry_PM_Move* PM_Move() = 0;
virtual IReGameHookRegistry_PM_AirMove* PM_AirMove() = 0;
virtual IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon* CSGameRules_FShouldSwitchWeapon() = 0;
virtual IReGameHookRegistry_CSGameRules_GetNextBestWeapon* CSGameRules_GetNextBestWeapon() = 0;
virtual IReGameHookRegistry_CSGameRules_FlPlayerFallDamage* CSGameRules_FlPlayerFallDamage() = 0;
virtual IReGameHookRegistry_CSGameRules_FPlayerCanTakeDamage* CSGameRules_FPlayerCanTakeDamage() = 0;
virtual IReGameHookRegistry_CSGameRules_PlayerSpawn* CSGameRules_PlayerSpawn() = 0;
virtual IReGameHookRegistry_CSGameRules_FPlayerCanRespawn* CSGameRules_FPlayerCanRespawn() = 0;
virtual IReGameHookRegistry_CSGameRules_GetPlayerSpawnSpot* CSGameRules_GetPlayerSpawnSpot() = 0;
virtual IReGameHookRegistry_CSGameRules_ClientUserInfoChanged* CSGameRules_ClientUserInfoChanged() = 0;
virtual IReGameHookRegistry_CSGameRules_PlayerKilled* CSGameRules_PlayerKilled() = 0;
virtual IReGameHookRegistry_CSGameRules_DeathNotice* CSGameRules_DeathNotice() = 0;
virtual IReGameHookRegistry_CSGameRules_CanHavePlayerItem* CSGameRules_CanHavePlayerItem() = 0;
virtual IReGameHookRegistry_CSGameRules_DeadPlayerWeapons* CSGameRules_DeadPlayerWeapons() = 0;
virtual IReGameHookRegistry_CSGameRules_ServerDeactivate* CSGameRules_ServerDeactivate() = 0;
virtual IReGameHookRegistry_CSGameRules_CheckMapConditions* CSGameRules_CheckMapConditions() = 0;
virtual IReGameHookRegistry_CSGameRules_CleanUpMap* CSGameRules_CleanUpMap() = 0;
virtual IReGameHookRegistry_CSGameRules_RestartRound* CSGameRules_RestartRound() = 0;
virtual IReGameHookRegistry_CSGameRules_CheckWinConditions* CSGameRules_CheckWinConditions() = 0;
virtual IReGameHookRegistry_CSGameRules_RemoveGuns* CSGameRules_RemoveGuns() = 0;
virtual IReGameHookRegistry_CSGameRules_GiveC4* CSGameRules_GiveC4() = 0;
virtual IReGameHookRegistry_CSGameRules_ChangeLevel* CSGameRules_ChangeLevel() = 0;
virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission() = 0;
virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams() = 0;
};
struct ReGameFuncs_t {
@ -268,7 +379,13 @@ public:
virtual int GetMinorVersion() = 0;
virtual const ReGameFuncs_t* GetFuncs() = 0;
virtual IReGameHookchains* GetHookchains() = 0;
virtual IReGameData* GetGameData() = 0;
virtual class CGameRules* GetGameRules() = 0;
virtual struct WeaponInfoStruct* GetWeaponInfo(int weaponID) = 0;
virtual struct WeaponInfoStruct* GetWeaponInfo(const char* weaponName) = 0;
virtual struct playermove_s* GetPlayerMove() = 0;
virtual struct WeaponSlotInfo* GetWeaponSlot(WeaponIdType weaponID) = 0;
virtual struct WeaponSlotInfo* GetWeaponSlot(const char* weaponName) = 0;
};

View File

@ -299,8 +299,12 @@ public:
virtual void SetAnimation(PLAYER_ANIM playerAnim) = 0;
virtual void AddAccount(int amount, bool bTrackChange = true) = 0;
virtual void GiveNamedItem(const char *pszName) = 0;
virtual void GiveNamedItemEx(const char *pszName) = 0;
virtual void GiveDefaultItems() = 0;
virtual void GiveShield(bool bDeploy = true) = 0;
virtual void DropShield(bool bDeploy = true) = 0;
virtual void DropPlayerItem(const char *pszItemName) = 0;
virtual void RemoveShield() = 0;
virtual void RemoveAllItems(bool bRemoveSuit) = 0;
};
@ -2071,12 +2075,3 @@ public:
virtual void Spawn() = 0;
virtual void KeyValue(struct KeyValueData_s *pkvd) = 0;
};
class IReGameData {
public:
virtual ~IReGameData() {}
virtual class CGameRules* GetGameRules() = 0;
virtual struct WeaponInfoStruct *GetWeaponInfo(int weaponID) = 0;
virtual struct playermove_s *GetPlayerMove() = 0;
};

View File

@ -44,10 +44,6 @@ class CBasePlayer;
#define WEAPON_IS_ONTARGET 0x40
#define ARMOR_TYPE_EMPTY 0
#define ARMOR_TYPE_KEVLAR 1 // Armor
#define ARMOR_TYPE_HELMET 2 // Armor and helmet
// the maximum amount of ammo each weapon's clip can hold
#define WEAPON_NOCLIP -1
@ -69,6 +65,13 @@ class CBasePlayer;
#define SF_DETONATE 0x0001 // Grenades flagged with this will be triggered when the owner calls detonateSatchelCharges
// custom enum
enum ArmorType
{
ARMOR_NONE, // no armor
ARMOR_KEVLAR, // body vest only
ARMOR_VESTHELM, // vest and helmet
};
enum ArmouryItemPack
{
ARMOURY_MP5NAVY,

View File

@ -328,7 +328,8 @@ enum shieldgren_e
enum InventorySlotType
{
PRIMARY_WEAPON_SLOT = 1,
NONE_SLOT,
PRIMARY_WEAPON_SLOT,
PISTOL_SLOT,
KNIFE_SLOT,
GRENADE_SLOT,
@ -402,3 +403,10 @@ struct WeaponInfoStruct
char *entityName;
const char *ammoName;
};
struct WeaponSlotInfo
{
WeaponIdType id;
InventorySlotType slot;
const char *weaponName;
};

View File

@ -85,6 +85,10 @@ typedef float FloatRef;
#define LINK_HOOK_CLASS_VOID_CHAIN2(...)
#define LINK_HOOK_CLASS_CHAIN(...)
#define LINK_HOOK_CLASS_CHAIN2(...)
#define LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN(...)
#define LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(...)
#define LINK_HOOK_CLASS_CUSTOM_CHAIN(...)
#define LINK_HOOK_CLASS_CUSTOM_CHAIN2(...)
#define LINK_HOOK_VOID_CHAIN(...)
#define LINK_HOOK_CHAIN(...)

View File

@ -1282,9 +1282,14 @@ void PM_WaterMove()
PM_FlyMove();
}
LINK_HOOK_VOID_CHAIN2(PM_AirMove);
LINK_HOOK_VOID_CHAIN(PM_AirMove, (int playerIndex = 0), pmove->player_index + 1);
void EXT_FUNC __API_HOOK(PM_AirMove)()
void EXT_FUNC __API_HOOK(PM_AirMove)(int playerIndex)
{
PM_AirMove_internal();
}
void PM_AirMove_internal()
{
int i;
vec3_t wishvel;

View File

@ -83,7 +83,8 @@ char PM_FindTextureType(char *name);
void PM_Init_(struct playermove_s *ppmove);
void PM_Move_(struct playermove_s *ppmove, int server);
void PM_AirMove_();
void PM_AirMove_(int playerIndex);
void PM_AirMove_internal();
extern struct playermove_s *pmove;

View File

@ -68,16 +68,6 @@ public:
virtual void unregisterHook(hookfunc_t hook) = 0;
};
// Hook chain registry(for hooks [un]registration)
template<typename t_ret, typename ...t_args>
class IHookChainRegistryClassEmpty {
public:
typedef t_ret(*hookfunc_t)(IHookChain<t_ret, t_args...>*, t_args...);
virtual void registerHook(hookfunc_t hook) = 0;
virtual void unregisterHook(hookfunc_t hook) = 0;
};
// Hook chain registry(for hooks [un]registration)
template<typename ...t_args>
class IVoidHookChainRegistry {

View File

@ -171,8 +171,8 @@ typedef IVoidHookChain<class CBasePlayer *, struct entvars_s *, struct entvars_s
typedef IVoidHookChainRegistry<class CBasePlayer *, struct entvars_s *, struct entvars_s *, Vector &, Vector &, struct TraceResult *> IReGameHookRegistry_RadiusFlash_TraceLine;
// RoundEnd hook
typedef IHookChain<bool, int, ScenarioEventEndRound, float> IReGameHook_RoundEnd;
typedef IHookChainRegistryClassEmpty<bool, int, ScenarioEventEndRound, float> IReGameHookRegistry_RoundEnd;
typedef IHookChain<bool, int, enum ScenarioEventEndRound, float> IReGameHook_RoundEnd;
typedef IHookChainRegistry<bool, int, enum ScenarioEventEndRound, float> IReGameHookRegistry_RoundEnd;
// CanBuyThis hook
typedef IHookChain<bool, class CBasePlayer *, int> IReGameHook_CanBuyThis;
@ -191,8 +191,96 @@ typedef IVoidHookChain<struct playermove_s *, int> IReGameHook_PM_Move;
typedef IVoidHookChainRegistry<struct playermove_s *, int> IReGameHookRegistry_PM_Move;
// PM_AirMove hook
typedef IVoidHookChain<> IReGameHook_PM_AirMove;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_PM_AirMove;
typedef IVoidHookChain<int> IReGameHook_PM_AirMove;
typedef IVoidHookChainRegistry<int> IReGameHookRegistry_PM_AirMove;
// CHalfLifeMultiplay::FShouldSwitchWeapon hook
typedef IHookChain<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHook_CSGameRules_FShouldSwitchWeapon;
typedef IHookChainRegistry<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon;
// CHalfLifeMultiplay::GetNextBestWeapon hook
typedef IHookChain<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHook_CSGameRules_GetNextBestWeapon;
typedef IHookChainRegistry<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHookRegistry_CSGameRules_GetNextBestWeapon;
// CHalfLifeMultiplay::FlPlayerFallDamage hook
typedef IHookChain<float, class CBasePlayer *> IReGameHook_CSGameRules_FlPlayerFallDamage;
typedef IHookChainRegistry<float, class CBasePlayer *> IReGameHookRegistry_CSGameRules_FlPlayerFallDamage;
// CHalfLifeMultiplay::FPlayerCanTakeDamage hook
typedef IHookChain<BOOL, class CBasePlayer *, CBaseEntity *> IReGameHook_CSGameRules_FPlayerCanTakeDamage;
typedef IHookChainRegistry<BOOL, class CBasePlayer *, CBaseEntity *> IReGameHookRegistry_CSGameRules_FPlayerCanTakeDamage;
// CHalfLifeMultiplay::PlayerSpawn hook
typedef IVoidHookChain<class CBasePlayer *> IReGameHook_CSGameRules_PlayerSpawn;
typedef IVoidHookChainRegistry<class CBasePlayer *> IReGameHookRegistry_CSGameRules_PlayerSpawn;
// CHalfLifeMultiplay::FPlayerCanRespawn hook
typedef IHookChain<BOOL, class CBasePlayer *> IReGameHook_CSGameRules_FPlayerCanRespawn;
typedef IHookChainRegistry<BOOL, class CBasePlayer *> IReGameHookRegistry_CSGameRules_FPlayerCanRespawn;
// CHalfLifeMultiplay::GetPlayerSpawnSpot hook
typedef IHookChain<struct edict_s *, class CBasePlayer *> IReGameHook_CSGameRules_GetPlayerSpawnSpot;
typedef IHookChainRegistry<struct edict_s *, class CBasePlayer *> IReGameHookRegistry_CSGameRules_GetPlayerSpawnSpot;
// CHalfLifeMultiplay::ClientUserInfoChanged hook
typedef IVoidHookChain<class CBasePlayer *, char *> IReGameHook_CSGameRules_ClientUserInfoChanged;
typedef IVoidHookChainRegistry<class CBasePlayer *, char *> IReGameHookRegistry_CSGameRules_ClientUserInfoChanged;
// CHalfLifeMultiplay::PlayerKilled hook
typedef IVoidHookChain<class CBasePlayer *, struct entvars_s *, struct entvars_s *> IReGameHook_CSGameRules_PlayerKilled;
typedef IVoidHookChainRegistry<class CBasePlayer *, struct entvars_s *, struct entvars_s *> IReGameHookRegistry_CSGameRules_PlayerKilled;
// CHalfLifeMultiplay::DeathNotice hook
typedef IVoidHookChain<class CBasePlayer *, struct entvars_s *, struct entvars_s *> IReGameHook_CSGameRules_DeathNotice;
typedef IVoidHookChainRegistry<class CBasePlayer *, struct entvars_s *, struct entvars_s *> IReGameHookRegistry_CSGameRules_DeathNotice;
// CHalfLifeMultiplay::CanHavePlayerItem hook
typedef IHookChain<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHook_CSGameRules_CanHavePlayerItem;
typedef IHookChainRegistry<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHookRegistry_CSGameRules_CanHavePlayerItem;
// CHalfLifeMultiplay::DeadPlayerWeapons hook
typedef IHookChain<int, class CBasePlayer *> IReGameHook_CSGameRules_DeadPlayerWeapons;
typedef IHookChainRegistry<int, class CBasePlayer *> IReGameHookRegistry_CSGameRules_DeadPlayerWeapons;
// CHalfLifeMultiplay::ServerDeactivate hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_ServerDeactivate;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_ServerDeactivate;
// CHalfLifeMultiplay::CheckMapConditions hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_CheckMapConditions;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_CheckMapConditions;
// CHalfLifeMultiplay::CleanUpMap hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_CleanUpMap;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_CleanUpMap;
// CHalfLifeMultiplay::RestartRound hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_RestartRound;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_RestartRound;
// CHalfLifeMultiplay::CheckWinConditions hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_CheckWinConditions;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_CheckWinConditions;
// CHalfLifeMultiplay::RemoveGuns hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_RemoveGuns;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_RemoveGuns;
// CHalfLifeMultiplay::GiveC4 hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_GiveC4;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_GiveC4;
// CHalfLifeMultiplay::ChangeLevel hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_ChangeLevel;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_ChangeLevel;
// CHalfLifeMultiplay::GoToIntermission hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_GoToIntermission;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_GoToIntermission;
// CHalfLifeMultiplay::BalanceTeams hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_BalanceTeams;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_BalanceTeams;
class IReGameHookchains {
public:
@ -239,6 +327,29 @@ public:
virtual IReGameHookRegistry_PM_Move* PM_Move() = 0;
virtual IReGameHookRegistry_PM_AirMove* PM_AirMove() = 0;
virtual IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon* CSGameRules_FShouldSwitchWeapon() = 0;
virtual IReGameHookRegistry_CSGameRules_GetNextBestWeapon* CSGameRules_GetNextBestWeapon() = 0;
virtual IReGameHookRegistry_CSGameRules_FlPlayerFallDamage* CSGameRules_FlPlayerFallDamage() = 0;
virtual IReGameHookRegistry_CSGameRules_FPlayerCanTakeDamage* CSGameRules_FPlayerCanTakeDamage() = 0;
virtual IReGameHookRegistry_CSGameRules_PlayerSpawn* CSGameRules_PlayerSpawn() = 0;
virtual IReGameHookRegistry_CSGameRules_FPlayerCanRespawn* CSGameRules_FPlayerCanRespawn() = 0;
virtual IReGameHookRegistry_CSGameRules_GetPlayerSpawnSpot* CSGameRules_GetPlayerSpawnSpot() = 0;
virtual IReGameHookRegistry_CSGameRules_ClientUserInfoChanged* CSGameRules_ClientUserInfoChanged() = 0;
virtual IReGameHookRegistry_CSGameRules_PlayerKilled* CSGameRules_PlayerKilled() = 0;
virtual IReGameHookRegistry_CSGameRules_DeathNotice* CSGameRules_DeathNotice() = 0;
virtual IReGameHookRegistry_CSGameRules_CanHavePlayerItem* CSGameRules_CanHavePlayerItem() = 0;
virtual IReGameHookRegistry_CSGameRules_DeadPlayerWeapons* CSGameRules_DeadPlayerWeapons() = 0;
virtual IReGameHookRegistry_CSGameRules_ServerDeactivate* CSGameRules_ServerDeactivate() = 0;
virtual IReGameHookRegistry_CSGameRules_CheckMapConditions* CSGameRules_CheckMapConditions() = 0;
virtual IReGameHookRegistry_CSGameRules_CleanUpMap* CSGameRules_CleanUpMap() = 0;
virtual IReGameHookRegistry_CSGameRules_RestartRound* CSGameRules_RestartRound() = 0;
virtual IReGameHookRegistry_CSGameRules_CheckWinConditions* CSGameRules_CheckWinConditions() = 0;
virtual IReGameHookRegistry_CSGameRules_RemoveGuns* CSGameRules_RemoveGuns() = 0;
virtual IReGameHookRegistry_CSGameRules_GiveC4* CSGameRules_GiveC4() = 0;
virtual IReGameHookRegistry_CSGameRules_ChangeLevel* CSGameRules_ChangeLevel() = 0;
virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission() = 0;
virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams() = 0;
};
struct ReGameFuncs_t {
@ -270,8 +381,11 @@ public:
virtual IReGameHookchains* GetHookchains() = 0;
virtual class CGameRules* GetGameRules() = 0;
virtual struct WeaponInfoStruct *GetWeaponInfo(int weaponID) = 0;
virtual struct playermove_s *GetPlayerMove() = 0;
virtual struct WeaponInfoStruct* GetWeaponInfo(int weaponID) = 0;
virtual struct WeaponInfoStruct* GetWeaponInfo(const char* weaponName) = 0;
virtual struct playermove_s* GetPlayerMove() = 0;
virtual struct WeaponSlotInfo* GetWeaponSlot(WeaponIdType weaponID) = 0;
virtual struct WeaponSlotInfo* GetWeaponSlot(const char* weaponName) = 0;
};

View File

@ -299,8 +299,12 @@ public:
virtual void SetAnimation(PLAYER_ANIM playerAnim) = 0;
virtual void AddAccount(int amount, bool bTrackChange = true) = 0;
virtual void GiveNamedItem(const char *pszName) = 0;
virtual void GiveNamedItemEx(const char *pszName) = 0;
virtual void GiveDefaultItems() = 0;
virtual void GiveShield(bool bDeploy = true) = 0;
virtual void DropShield(bool bDeploy = true) = 0;
virtual void DropPlayerItem(const char *pszItemName) = 0;
virtual void RemoveShield() = 0;
virtual void RemoveAllItems(bool bRemoveSuit) = 0;
};

View File

@ -175,6 +175,40 @@ private:
origfunc_t m_OriginalFunc;
};
template<typename t_class, typename ...t_args>
class IVoidHookChainClassEmptyImpl : public IVoidHookChain<t_args...> {
public:
typedef void(*hookfunc_t)(IVoidHookChain<t_args...>*, t_args...);
typedef void(t_class::*origfunc_t)(t_args...);
IVoidHookChainClassEmptyImpl(void** hooks, origfunc_t orig, t_class *object) : m_Hooks(hooks), m_OriginalFunc(orig), m_Object(object) {}
virtual ~IVoidHookChainClassEmptyImpl() {}
virtual void callNext(t_args... args) {
hookfunc_t nexthook = (hookfunc_t)m_Hooks[0];
if (nexthook)
{
IVoidHookChainClassEmptyImpl nextChain(m_Hooks + 1, m_OriginalFunc, m_Object);
nexthook(&nextChain, args...);
}
else
{
if (m_OriginalFunc && m_Object)
(m_Object->*m_OriginalFunc)(args...);
}
}
virtual void callOriginal(t_args... args) {
(m_Object->*m_OriginalFunc)(args...);
}
private:
void** m_Hooks;
t_class *m_Object;
origfunc_t m_OriginalFunc;
};
// Implementation for void chains in modules
template<typename t_class, typename ...t_args>
class IVoidHookChainClassImpl : public IVoidHookChain<t_args...> {
@ -266,7 +300,7 @@ public:
};
template<typename t_ret, typename t_class, typename ...t_args>
class IHookChainRegistryClassEmptyImpl : public IHookChainRegistryClassEmpty <t_ret, t_args...>, public AbstractHookChainRegistry {
class IHookChainRegistryClassEmptyImpl : public IHookChainRegistry <t_ret, t_args...>, public AbstractHookChainRegistry {
public:
typedef t_ret(*hookfunc_t)(IHookChain<t_ret, t_args...>*, t_args...);
typedef t_ret(t_class::*origfunc_t)(t_args...);
@ -286,6 +320,28 @@ public:
}
};
template<typename t_class, typename ...t_args>
class IVoidHookChainRegistryClassEmptyImpl : public IVoidHookChainRegistry <t_args...>, public AbstractHookChainRegistry {
public:
typedef void(*hookfunc_t)(IVoidHookChain<t_args...>*, t_args...);
typedef void(t_class::*origfunc_t)(t_args...);
virtual ~IVoidHookChainRegistryClassEmptyImpl() { }
void callChain(origfunc_t origFunc, t_class *object, t_args... args) {
IVoidHookChainClassEmptyImpl<t_class, t_args...> chain(m_Hooks, origFunc, object);
chain.callNext(args...);
}
virtual void registerHook(hookfunc_t hook) {
addHook((void*)hook);
}
virtual void unregisterHook(hookfunc_t hook) {
removeHook((void*)hook);
}
};
template<typename ...t_args>
class IVoidHookChainRegistryImpl : public IVoidHookChainRegistry <t_args...>, public AbstractHookChainRegistry {
public:

View File

@ -92,6 +92,29 @@ IReGameHookRegistry_PM_Init* CReGameHookchains::PM_Init() { return &m_PM_Init; }
IReGameHookRegistry_PM_Move* CReGameHookchains::PM_Move() { return &m_PM_Move; }
IReGameHookRegistry_PM_AirMove* CReGameHookchains::PM_AirMove() { return &m_PM_AirMove; }
IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon* CReGameHookchains::CSGameRules_FShouldSwitchWeapon() { return &m_CSGameRules_FShouldSwitchWeapon; }
IReGameHookRegistry_CSGameRules_GetNextBestWeapon* CReGameHookchains::CSGameRules_GetNextBestWeapon() { return &m_CSGameRules_GetNextBestWeapon; }
IReGameHookRegistry_CSGameRules_FlPlayerFallDamage* CReGameHookchains::CSGameRules_FlPlayerFallDamage() { return &m_CSGameRules_FlPlayerFallDamage; }
IReGameHookRegistry_CSGameRules_FPlayerCanTakeDamage* CReGameHookchains::CSGameRules_FPlayerCanTakeDamage() { return &m_CSGameRules_FPlayerCanTakeDamage; }
IReGameHookRegistry_CSGameRules_PlayerSpawn* CReGameHookchains::CSGameRules_PlayerSpawn() { return &m_CSGameRules_PlayerSpawn; }
IReGameHookRegistry_CSGameRules_FPlayerCanRespawn* CReGameHookchains::CSGameRules_FPlayerCanRespawn() { return &m_CSGameRules_FPlayerCanRespawn; }
IReGameHookRegistry_CSGameRules_GetPlayerSpawnSpot* CReGameHookchains::CSGameRules_GetPlayerSpawnSpot() { return &m_CSGameRules_GetPlayerSpawnSpot; }
IReGameHookRegistry_CSGameRules_ClientUserInfoChanged* CReGameHookchains::CSGameRules_ClientUserInfoChanged() { return &m_CSGameRules_ClientUserInfoChanged; }
IReGameHookRegistry_CSGameRules_PlayerKilled* CReGameHookchains::CSGameRules_PlayerKilled() { return &m_CSGameRules_PlayerKilled; }
IReGameHookRegistry_CSGameRules_DeathNotice* CReGameHookchains::CSGameRules_DeathNotice() { return &m_CSGameRules_DeathNotice; }
IReGameHookRegistry_CSGameRules_CanHavePlayerItem* CReGameHookchains::CSGameRules_CanHavePlayerItem() { return &m_CSGameRules_CanHavePlayerItem; }
IReGameHookRegistry_CSGameRules_DeadPlayerWeapons* CReGameHookchains::CSGameRules_DeadPlayerWeapons() { return &m_CSGameRules_DeadPlayerWeapons; }
IReGameHookRegistry_CSGameRules_ServerDeactivate* CReGameHookchains::CSGameRules_ServerDeactivate() { return &m_CSGameRules_ServerDeactivate; }
IReGameHookRegistry_CSGameRules_CheckMapConditions* CReGameHookchains::CSGameRules_CheckMapConditions() { return &m_CSGameRules_CheckMapConditions; }
IReGameHookRegistry_CSGameRules_CleanUpMap* CReGameHookchains::CSGameRules_CleanUpMap() { return &m_CSGameRules_CleanUpMap; }
IReGameHookRegistry_CSGameRules_RestartRound* CReGameHookchains::CSGameRules_RestartRound() { return &m_CSGameRules_RestartRound; }
IReGameHookRegistry_CSGameRules_CheckWinConditions* CReGameHookchains::CSGameRules_CheckWinConditions() { return &m_CSGameRules_CheckWinConditions; }
IReGameHookRegistry_CSGameRules_RemoveGuns* CReGameHookchains::CSGameRules_RemoveGuns() { return &m_CSGameRules_RemoveGuns; }
IReGameHookRegistry_CSGameRules_GiveC4* CReGameHookchains::CSGameRules_GiveC4() { return &m_CSGameRules_GiveC4; }
IReGameHookRegistry_CSGameRules_ChangeLevel* CReGameHookchains::CSGameRules_ChangeLevel() { return &m_CSGameRules_ChangeLevel; }
IReGameHookRegistry_CSGameRules_GoToIntermission* CReGameHookchains::CSGameRules_GoToIntermission() { return &m_CSGameRules_GoToIntermission; }
IReGameHookRegistry_CSGameRules_BalanceTeams* CReGameHookchains::CSGameRules_BalanceTeams() { return &m_CSGameRules_BalanceTeams; }
int CReGameApi::GetMajorVersion()
{
return REGAMEDLL_API_VERSION_MAJOR;
@ -120,10 +143,17 @@ WeaponInfoStruct* EXT_FUNC CReGameApi::GetWeaponInfo(int weaponID) {
return ::GetWeaponInfo(weaponID);
}
WeaponInfoStruct* EXT_FUNC CReGameApi::GetWeaponInfo(const char* weaponName) {
return ::GetWeaponInfo(weaponName);
}
playermove_t* EXT_FUNC CReGameApi::GetPlayerMove() {
return pmove;
}
WeaponSlotInfo* EXT_FUNC CReGameApi::GetWeaponSlot(WeaponIdType weaponID) { return ::GetWeaponSlot(weaponID); }
WeaponSlotInfo* EXT_FUNC CReGameApi::GetWeaponSlot(const char* weaponName) { return ::GetWeaponSlot(weaponName); }
void EXT_FUNC Regamedll_ChangeString_api(char *&dest, const char *source)
{
size_t len = Q_strlen(source);

View File

@ -185,8 +185,96 @@ typedef IVoidHookChainImpl<struct playermove_s *, int> CReGameHook_PM_Move;
typedef IVoidHookChainRegistryImpl<struct playermove_s *, int> CReGameHookRegistry_PM_Move;
// PM_AirMove hook
typedef IVoidHookChainImpl<> CReGameHook_PM_AirMove;
typedef IVoidHookChainRegistryImpl<> CReGameHookRegistry_PM_AirMove;
typedef IVoidHookChainImpl<int> CReGameHook_PM_AirMove;
typedef IVoidHookChainRegistryImpl<int> CReGameHookRegistry_PM_AirMove;
// CHalfLifeMultiplay::FShouldSwitchWeapon hook
typedef IHookChainClassImpl<BOOL, class CHalfLifeMultiplay, CBasePlayer *, CBasePlayerItem *> CReGameHook_CSGameRules_FShouldSwitchWeapon;
typedef IHookChainRegistryClassEmptyImpl<BOOL, class CHalfLifeMultiplay, CBasePlayer *, CBasePlayerItem *> CReGameHookRegistry_CSGameRules_FShouldSwitchWeapon;
// CHalfLifeMultiplay::GetNextBestWeapon hook
typedef IHookChainClassImpl<BOOL, class CHalfLifeMultiplay, CBasePlayer *, CBasePlayerItem *> CReGameHook_CSGameRules_GetNextBestWeapon;
typedef IHookChainRegistryClassEmptyImpl<BOOL, class CHalfLifeMultiplay, CBasePlayer *, CBasePlayerItem *> CReGameHookRegistry_CSGameRules_GetNextBestWeapon;
// CHalfLifeMultiplay::FlPlayerFallDamage hook
typedef IHookChainClassImpl<float, class CHalfLifeMultiplay, CBasePlayer *> CReGameHook_CSGameRules_FlPlayerFallDamage;
typedef IHookChainRegistryClassEmptyImpl<float, class CHalfLifeMultiplay, CBasePlayer *> CReGameHookRegistry_CSGameRules_FlPlayerFallDamage;
// CHalfLifeMultiplay::FPlayerCanTakeDamage hook
typedef IHookChainClassImpl<BOOL, class CHalfLifeMultiplay, CBasePlayer *, CBaseEntity *> CReGameHook_CSGameRules_FPlayerCanTakeDamage;
typedef IHookChainRegistryClassEmptyImpl<BOOL, class CHalfLifeMultiplay, CBasePlayer *, CBaseEntity *> CReGameHookRegistry_CSGameRules_FPlayerCanTakeDamage;
// CHalfLifeMultiplay::PlayerSpawn hook
typedef IVoidHookChainClassImpl<class CHalfLifeMultiplay, CBasePlayer *> CReGameHook_CSGameRules_PlayerSpawn;
typedef IVoidHookChainRegistryClassEmptyImpl<class CHalfLifeMultiplay, CBasePlayer *> CReGameHookRegistry_CSGameRules_PlayerSpawn;
// CHalfLifeMultiplay::FPlayerCanRespawn hook
typedef IHookChainClassImpl<BOOL, class CHalfLifeMultiplay, CBasePlayer *> CReGameHook_CSGameRules_FPlayerCanRespawn;
typedef IHookChainRegistryClassEmptyImpl<BOOL, class CHalfLifeMultiplay, CBasePlayer *> CReGameHookRegistry_CSGameRules_FPlayerCanRespawn;
// CHalfLifeMultiplay::GetPlayerSpawnSpot hook
typedef IHookChainClassImpl<edict_t *, class CHalfLifeMultiplay, CBasePlayer *> CReGameHook_CSGameRules_GetPlayerSpawnSpot;
typedef IHookChainRegistryClassEmptyImpl<edict_t *, class CHalfLifeMultiplay, CBasePlayer *> CReGameHookRegistry_CSGameRules_GetPlayerSpawnSpot;
// CHalfLifeMultiplay::ClientUserInfoChanged hook
typedef IVoidHookChainClassImpl<class CHalfLifeMultiplay, CBasePlayer *, char *> CReGameHook_CSGameRules_ClientUserInfoChanged;
typedef IVoidHookChainRegistryClassEmptyImpl< class CHalfLifeMultiplay, CBasePlayer *, char *> CReGameHookRegistry_CSGameRules_ClientUserInfoChanged;
// CHalfLifeMultiplay::PlayerKilled hook
typedef IVoidHookChainClassImpl<class CHalfLifeMultiplay, CBasePlayer *, entvars_t *, entvars_t *> CReGameHook_CSGameRules_PlayerKilled;
typedef IVoidHookChainRegistryClassEmptyImpl<class CHalfLifeMultiplay, CBasePlayer *, entvars_t *, entvars_t *> CReGameHookRegistry_CSGameRules_PlayerKilled;
// CHalfLifeMultiplay::DeathNotice hook
typedef IVoidHookChainClassImpl<class CHalfLifeMultiplay, CBasePlayer *, entvars_t *, entvars_t *> CReGameHook_CSGameRules_DeathNotice;
typedef IVoidHookChainRegistryClassEmptyImpl<class CHalfLifeMultiplay, CBasePlayer *, entvars_t *, entvars_t *> CReGameHookRegistry_CSGameRules_DeathNotice;
// CHalfLifeMultiplay::CanHavePlayerItem hook
typedef IHookChainClassImpl<BOOL, class CHalfLifeMultiplay, CBasePlayer *, CBasePlayerItem *> CReGameHook_CSGameRules_CanHavePlayerItem;
typedef IHookChainRegistryClassEmptyImpl<BOOL, class CHalfLifeMultiplay, CBasePlayer *, CBasePlayerItem *> CReGameHookRegistry_CSGameRules_CanHavePlayerItem;
// CHalfLifeMultiplay::DeadPlayerWeapons hook
typedef IHookChainClassImpl<int, class CHalfLifeMultiplay, CBasePlayer *> CReGameHook_CSGameRules_DeadPlayerWeapons;
typedef IHookChainRegistryClassEmptyImpl<int, class CHalfLifeMultiplay, CBasePlayer *> CReGameHookRegistry_CSGameRules_DeadPlayerWeapons;
// CHalfLifeMultiplay::ServerDeactivate hook
typedef IVoidHookChainClassImpl<class CHalfLifeMultiplay> CReGameHook_CSGameRules_ServerDeactivate;
typedef IVoidHookChainRegistryClassEmptyImpl<class CHalfLifeMultiplay> CReGameHookRegistry_CSGameRules_ServerDeactivate;
// CHalfLifeMultiplay::CheckMapConditions hook
typedef IVoidHookChainClassImpl<class CHalfLifeMultiplay> CReGameHook_CSGameRules_CheckMapConditions;
typedef IVoidHookChainRegistryClassEmptyImpl<class CHalfLifeMultiplay> CReGameHookRegistry_CSGameRules_CheckMapConditions;
// CHalfLifeMultiplay::CleanUpMap hook
typedef IVoidHookChainClassImpl<class CHalfLifeMultiplay> CReGameHook_CSGameRules_CleanUpMap;
typedef IVoidHookChainRegistryClassEmptyImpl<class CHalfLifeMultiplay> CReGameHookRegistry_CSGameRules_CleanUpMap;
// CHalfLifeMultiplay::RestartRound hook
typedef IVoidHookChainClassImpl<class CHalfLifeMultiplay> CReGameHook_CSGameRules_RestartRound;
typedef IVoidHookChainRegistryClassEmptyImpl<class CHalfLifeMultiplay> CReGameHookRegistry_CSGameRules_RestartRound;
// CHalfLifeMultiplay::CheckWinConditions hook
typedef IVoidHookChainClassImpl<class CHalfLifeMultiplay> CReGameHook_CSGameRules_CheckWinConditions;
typedef IVoidHookChainRegistryClassEmptyImpl<class CHalfLifeMultiplay> CReGameHookRegistry_CSGameRules_CheckWinConditions;
// CHalfLifeMultiplay::RemoveGuns hook
typedef IVoidHookChainClassImpl<class CHalfLifeMultiplay> CReGameHook_CSGameRules_RemoveGuns;
typedef IVoidHookChainRegistryClassEmptyImpl<class CHalfLifeMultiplay> CReGameHookRegistry_CSGameRules_RemoveGuns;
// CHalfLifeMultiplay::GiveC4 hook
typedef IVoidHookChainClassImpl<class CHalfLifeMultiplay> CReGameHook_CSGameRules_GiveC4;
typedef IVoidHookChainRegistryClassEmptyImpl<class CHalfLifeMultiplay> CReGameHookRegistry_CSGameRules_GiveC4;
// CHalfLifeMultiplay::ChangeLevel hook
typedef IVoidHookChainClassImpl<class CHalfLifeMultiplay> CReGameHook_CSGameRules_ChangeLevel;
typedef IVoidHookChainRegistryClassEmptyImpl<class CHalfLifeMultiplay> CReGameHookRegistry_CSGameRules_ChangeLevel;
// CHalfLifeMultiplay::GoToIntermission hook
typedef IVoidHookChainClassImpl<class CHalfLifeMultiplay> CReGameHook_CSGameRules_GoToIntermission;
typedef IVoidHookChainRegistryClassEmptyImpl<class CHalfLifeMultiplay> CReGameHookRegistry_CSGameRules_GoToIntermission;
// CHalfLifeMultiplay::BalanceTeams hook
typedef IVoidHookChainClassImpl<class CHalfLifeMultiplay> CReGameHook_CSGameRules_BalanceTeams;
typedef IVoidHookChainRegistryClassEmptyImpl<class CHalfLifeMultiplay> CReGameHookRegistry_CSGameRules_BalanceTeams;
class CReGameHookchains: public IReGameHookchains {
public:
@ -233,6 +321,29 @@ public:
CReGameHookRegistry_PM_Move m_PM_Move;
CReGameHookRegistry_PM_AirMove m_PM_AirMove;
CReGameHookRegistry_CSGameRules_FShouldSwitchWeapon m_CSGameRules_FShouldSwitchWeapon;
CReGameHookRegistry_CSGameRules_GetNextBestWeapon m_CSGameRules_GetNextBestWeapon;
CReGameHookRegistry_CSGameRules_FlPlayerFallDamage m_CSGameRules_FlPlayerFallDamage;
CReGameHookRegistry_CSGameRules_FPlayerCanTakeDamage m_CSGameRules_FPlayerCanTakeDamage;
CReGameHookRegistry_CSGameRules_PlayerSpawn m_CSGameRules_PlayerSpawn;
CReGameHookRegistry_CSGameRules_FPlayerCanRespawn m_CSGameRules_FPlayerCanRespawn;
CReGameHookRegistry_CSGameRules_GetPlayerSpawnSpot m_CSGameRules_GetPlayerSpawnSpot;
CReGameHookRegistry_CSGameRules_ClientUserInfoChanged m_CSGameRules_ClientUserInfoChanged;
CReGameHookRegistry_CSGameRules_PlayerKilled m_CSGameRules_PlayerKilled;
CReGameHookRegistry_CSGameRules_DeathNotice m_CSGameRules_DeathNotice;
CReGameHookRegistry_CSGameRules_CanHavePlayerItem m_CSGameRules_CanHavePlayerItem;
CReGameHookRegistry_CSGameRules_DeadPlayerWeapons m_CSGameRules_DeadPlayerWeapons;
CReGameHookRegistry_CSGameRules_ServerDeactivate m_CSGameRules_ServerDeactivate;
CReGameHookRegistry_CSGameRules_CheckMapConditions m_CSGameRules_CheckMapConditions;
CReGameHookRegistry_CSGameRules_CleanUpMap m_CSGameRules_CleanUpMap;
CReGameHookRegistry_CSGameRules_RestartRound m_CSGameRules_RestartRound;
CReGameHookRegistry_CSGameRules_CheckWinConditions m_CSGameRules_CheckWinConditions;
CReGameHookRegistry_CSGameRules_RemoveGuns m_CSGameRules_RemoveGuns;
CReGameHookRegistry_CSGameRules_GiveC4 m_CSGameRules_GiveC4;
CReGameHookRegistry_CSGameRules_ChangeLevel m_CSGameRules_ChangeLevel;
CReGameHookRegistry_CSGameRules_GoToIntermission m_CSGameRules_GoToIntermission;
CReGameHookRegistry_CSGameRules_BalanceTeams m_CSGameRules_BalanceTeams;
public:
virtual IReGameHookRegistry_CBasePlayer_Spawn* CBasePlayer_Spawn();
virtual IReGameHookRegistry_CBasePlayer_Precache* CBasePlayer_Precache();
@ -276,6 +387,28 @@ public:
virtual IReGameHookRegistry_PM_Move* PM_Move();
virtual IReGameHookRegistry_PM_AirMove* PM_AirMove();
virtual IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon* CSGameRules_FShouldSwitchWeapon();
virtual IReGameHookRegistry_CSGameRules_GetNextBestWeapon* CSGameRules_GetNextBestWeapon();
virtual IReGameHookRegistry_CSGameRules_FlPlayerFallDamage* CSGameRules_FlPlayerFallDamage();
virtual IReGameHookRegistry_CSGameRules_FPlayerCanTakeDamage* CSGameRules_FPlayerCanTakeDamage();
virtual IReGameHookRegistry_CSGameRules_PlayerSpawn* CSGameRules_PlayerSpawn();
virtual IReGameHookRegistry_CSGameRules_FPlayerCanRespawn* CSGameRules_FPlayerCanRespawn();
virtual IReGameHookRegistry_CSGameRules_GetPlayerSpawnSpot* CSGameRules_GetPlayerSpawnSpot();
virtual IReGameHookRegistry_CSGameRules_ClientUserInfoChanged* CSGameRules_ClientUserInfoChanged();
virtual IReGameHookRegistry_CSGameRules_PlayerKilled* CSGameRules_PlayerKilled();
virtual IReGameHookRegistry_CSGameRules_DeathNotice* CSGameRules_DeathNotice();
virtual IReGameHookRegistry_CSGameRules_CanHavePlayerItem* CSGameRules_CanHavePlayerItem();
virtual IReGameHookRegistry_CSGameRules_DeadPlayerWeapons* CSGameRules_DeadPlayerWeapons();
virtual IReGameHookRegistry_CSGameRules_ServerDeactivate* CSGameRules_ServerDeactivate();
virtual IReGameHookRegistry_CSGameRules_CheckMapConditions* CSGameRules_CheckMapConditions();
virtual IReGameHookRegistry_CSGameRules_CleanUpMap* CSGameRules_CleanUpMap();
virtual IReGameHookRegistry_CSGameRules_RestartRound* CSGameRules_RestartRound();
virtual IReGameHookRegistry_CSGameRules_CheckWinConditions* CSGameRules_CheckWinConditions();
virtual IReGameHookRegistry_CSGameRules_RemoveGuns* CSGameRules_RemoveGuns();
virtual IReGameHookRegistry_CSGameRules_GiveC4* CSGameRules_GiveC4();
virtual IReGameHookRegistry_CSGameRules_ChangeLevel* CSGameRules_ChangeLevel();
virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission();
virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams();
};
extern CReGameHookchains g_ReGameHookchains;
@ -290,12 +423,14 @@ public:
virtual IReGameHookchains *GetHookchains();
virtual CGameRules* GetGameRules();
virtual WeaponInfoStruct *GetWeaponInfo(int weaponID);
virtual playermove_t *GetPlayerMove();
virtual WeaponInfoStruct* GetWeaponInfo(int weaponID);
virtual WeaponInfoStruct* GetWeaponInfo(const char* weaponName);
virtual playermove_t* GetPlayerMove();
virtual WeaponSlotInfo* GetWeaponSlot(WeaponIdType weaponID);
virtual WeaponSlotInfo* GetWeaponSlot(const char* weaponName);
};
void Regamedll_ChangeString_api(char *&dest, const char *source);
void RadiusDamage_api(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType);
void ClearMultiDamage_api();

View File

@ -69,6 +69,24 @@ extern ICSEntity *INDEX_TO_CSENTITY(int iEntityIndex);
return g_ReGameHookchains.m_##className##_##functionName.callChain(&className::functionName##_, this);\
}
#define LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN(className, customPrefix, functionName, args, ...)\
void className::functionName args {\
g_ReGameHookchains.m_##customPrefix##_##functionName.callChain(&className::functionName##_, this, __VA_ARGS__);\
}
#define LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(className, customPrefix, functionName)\
void className::functionName() {\
g_ReGameHookchains.m_##customPrefix##_##functionName.callChain(&className::functionName##_, this);\
}
#define LINK_HOOK_CLASS_CUSTOM_CHAIN(ret, className, customPrefix, functionName, args, ...)\
ret className::functionName args {\
return g_ReGameHookchains.m_##customPrefix##_##functionName.callChain(&className::functionName##_, this, __VA_ARGS__);\
}
#define LINK_HOOK_CLASS_CUSTOM_CHAIN2(ret, className, functionName)\
ret className::functionName() {\
return g_ReGameHookchains.m_##customPrefix##_##functionName.callChain(&className::functionName##_, this);\
}
#define LINK_HOOK_VOID_CHAIN(functionName, args, ...)\
void functionName args {\
g_ReGameHookchains.m_##functionName.callChain(functionName##_, __VA_ARGS__);\
@ -325,9 +343,14 @@ public:
virtual void SetAnimation(PLAYER_ANIM playerAnim) { ((CBasePlayer *)m_pEntity)->SetAnimation(playerAnim); }
virtual void AddAccount(int amount, bool bTrackChange = true) { ((CBasePlayer *)m_pEntity)->AddAccount(amount, bTrackChange); }
virtual void GiveNamedItem(const char *pszName) { ((CBasePlayer *)m_pEntity)->GiveNamedItem(pszName); }
virtual void GiveNamedItemEx(const char *pszName) { ((CBasePlayer *)m_pEntity)->GiveNamedItemEx(pszName); }
virtual void GiveDefaultItems() { ((CBasePlayer *)m_pEntity)->GiveDefaultItems(); }
virtual void GiveShield(bool bDeploy = true) { ((CBasePlayer *)m_pEntity)->GiveShield(bDeploy); }
virtual void DropShield(bool bDeploy = true) { ((CBasePlayer *)m_pEntity)->DropShield(bDeploy); }
virtual void DropPlayerItem(const char *pszItemName) { ((CBasePlayer *)m_pEntity)->DropPlayerItem(pszItemName); }
virtual void RemoveShield() { ((CBasePlayer *)m_pEntity)->RemoveShield(); }
virtual void RemoveAllItems(bool bRemoveSuit) { ((CBasePlayer *)m_pEntity)->RemoveAllItems(bRemoveSuit ? TRUE : FALSE); }
};
class CAPI_Bot: public CCSPlayer {