diff --git a/regamedll/dlls/API/CAPI_Impl.cpp b/regamedll/dlls/API/CAPI_Impl.cpp index f9844764..e5e260cb 100644 --- a/regamedll/dlls/API/CAPI_Impl.cpp +++ b/regamedll/dlls/API/CAPI_Impl.cpp @@ -142,6 +142,21 @@ GAMEHOOK_REGISTRY(CSGameRules_BalanceTeams); GAMEHOOK_REGISTRY(CSGameRules_OnRoundFreezeEnd); GAMEHOOK_REGISTRY(PM_UpdateStepSound); GAMEHOOK_REGISTRY(CBasePlayer_StartDeathCam); +GAMEHOOK_REGISTRY(CBasePlayer_SwitchTeam); +GAMEHOOK_REGISTRY(CBasePlayer_CanSwitchTeam); +GAMEHOOK_REGISTRY(CBasePlayer_ThrowGrenade); +GAMEHOOK_REGISTRY(CSGameRules_CanPlayerHearPlayer); +GAMEHOOK_REGISTRY(CWeaponBox_SetModel); +GAMEHOOK_REGISTRY(CGrenade_DefuseBombStart); +GAMEHOOK_REGISTRY(CGrenade_DefuseBombEnd); +GAMEHOOK_REGISTRY(CGrenade_ExplodeHeGrenade); +GAMEHOOK_REGISTRY(CGrenade_ExplodeFlashbang); +GAMEHOOK_REGISTRY(CGrenade_ExplodeSmokeGrenade); +GAMEHOOK_REGISTRY(CGrenade_ExplodeBomb); +GAMEHOOK_REGISTRY(ThrowHeGrenade); +GAMEHOOK_REGISTRY(ThrowFlashbang); +GAMEHOOK_REGISTRY(ThrowSmokeGrenade); +GAMEHOOK_REGISTRY(PlantBomb); int CReGameApi::GetMajorVersion() { return REGAMEDLL_API_VERSION_MAJOR; diff --git a/regamedll/dlls/API/CAPI_Impl.h b/regamedll/dlls/API/CAPI_Impl.h index 8682cfda..84f61195 100644 --- a/regamedll/dlls/API/CAPI_Impl.h +++ b/regamedll/dlls/API/CAPI_Impl.h @@ -63,6 +63,15 @@ g_ReGameHookchains.m_##customPrefix##_##functionName.callChain(&className::functionName##_OrigFunc, this);\ } +#define LINK_HOOK_CLASS_VOID_CUSTOM2_CHAIN(className, customFuncName, functionName, args, ...)\ + void className::functionName args {\ + g_ReGameHookchains.m_##className##_##customFuncName.callChain(&className::functionName##_OrigFunc, this, __VA_ARGS__);\ + } +#define LINK_HOOK_CLASS_VOID_CUSTOM2_CHAIN2(className, customFuncName, functionName)\ + void className::functionName() {\ + g_ReGameHookchains.m_##className##_##customFuncName.callChain(&className::functionName##_OrigFunc, 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##_OrigFunc, this, __VA_ARGS__);\ @@ -72,6 +81,15 @@ return g_ReGameHookchains.m_##customPrefix##_##functionName.callChain(&className::functionName##_OrigFunc, this);\ } +#define LINK_HOOK_CLASS_CUSTOM2_CHAIN(ret, className, customFuncName, functionName, args, ...)\ + ret className::functionName args {\ + return g_ReGameHookchains.m_##className##_##customFuncName.callChain(&className::functionName##_OrigFunc, this, __VA_ARGS__);\ + } +#define LINK_HOOK_CLASS_CUSTOM2_CHAIN2(ret, className, customFuncName, functionName)\ + ret className::functionName() {\ + return g_ReGameHookchains.m_##className##_##customFuncName.callChain(&className::functionName##_OrigFunc, this);\ + } + #define LINK_HOOK_VOID_CHAIN(functionName, args, ...)\ void functionName args {\ g_ReGameHookchains.m_##functionName.callChain(functionName##_OrigFunc, __VA_ARGS__);\ @@ -82,6 +100,11 @@ return g_ReGameHookchains.m_##functionName.callChain(functionName##_OrigFunc, __VA_ARGS__);\ } +#define LINK_HOOK_CUSTOM2_CHAIN(ret, customFuncName, functionName, args, ...)\ + ret functionName args {\ + return g_ReGameHookchains.m_##customFuncName.callChain(functionName##_OrigFunc, __VA_ARGS__);\ + } + #define LINK_HOOK_VOID_CHAIN2(functionName)\ void functionName() {\ g_ReGameHookchains.m_##functionName.callChain(functionName##_OrigFunc);\ @@ -430,6 +453,10 @@ typedef IHookChainRegistryClassEmptyImpl CReGame typedef IHookChainClassImpl CReGameHook_CSGameRules_OnRoundFreezeEnd; typedef IHookChainRegistryClassEmptyImpl CReGameHookRegistry_CSGameRules_OnRoundFreezeEnd; +// CSGameRules::CanPlayerHearPlayer hook +typedef IHookChainClassImpl CReGameHook_CSGameRules_CanPlayerHearPlayer; +typedef IHookChainRegistryClassEmptyImpl CReGameHookRegistry_CSGameRules_CanPlayerHearPlayer; + // PM_UpdateStepSound hook typedef IHookChainImpl CReGameHook_PM_UpdateStepSound; typedef IHookChainRegistryImpl CReGameHookRegistry_PM_UpdateStepSound; @@ -438,6 +465,62 @@ typedef IHookChainRegistryImpl CReGameHookRegistry_PM_UpdateStepSound; typedef IHookChainClassImpl CReGameHook_CBasePlayer_StartDeathCam; typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_StartDeathCam; +// CBasePlayer::SwitchTeam hook +typedef IHookChainClassImpl CReGameHook_CBasePlayer_SwitchTeam; +typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_SwitchTeam; + +// CBasePlayer::CanSwitchTeam hook +typedef IHookChainClassImpl CReGameHook_CBasePlayer_CanSwitchTeam; +typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_CanSwitchTeam; + +// CBasePlayer::ThrowGrenade hook +typedef IHookChainClassImpl CReGameHook_CBasePlayer_ThrowGrenade; +typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_ThrowGrenade; + +// CWeaponBox::SetModel hook +typedef IHookChainClassImpl CReGameHook_CWeaponBox_SetModel; +typedef IHookChainRegistryClassImpl CReGameHookRegistry_CWeaponBox_SetModel; + +// CGrenade::DefuseBombStart hook +typedef IHookChainClassImpl CReGameHook_CGrenade_DefuseBombStart; +typedef IHookChainRegistryClassImpl CReGameHookRegistry_CGrenade_DefuseBombStart; + +// CGrenade::DefuseBombEnd hook +typedef IHookChainClassImpl CReGameHook_CGrenade_DefuseBombEnd; +typedef IHookChainRegistryClassImpl CReGameHookRegistry_CGrenade_DefuseBombEnd; + +// CGrenade::ExplodeHeGrenade hook +typedef IHookChainClassImpl CReGameHook_CGrenade_ExplodeHeGrenade; +typedef IHookChainRegistryClassImpl CReGameHookRegistry_CGrenade_ExplodeHeGrenade; + +// CGrenade::ExplodeFlashbang hook +typedef IHookChainClassImpl CReGameHook_CGrenade_ExplodeFlashbang; +typedef IHookChainRegistryClassImpl CReGameHookRegistry_CGrenade_ExplodeFlashbang; + +// CGrenade::ExplodeSmokeGrenade hook +typedef IHookChainClassImpl CReGameHook_CGrenade_ExplodeSmokeGrenade; +typedef IHookChainRegistryClassImpl CReGameHookRegistry_CGrenade_ExplodeSmokeGrenade; + +// CGrenade::ExplodeBomb hook +typedef IHookChainClassImpl CReGameHook_CGrenade_ExplodeBomb; +typedef IHookChainRegistryClassImpl CReGameHookRegistry_CGrenade_ExplodeBomb; + +// ThrowHeGrenade hook +typedef IHookChainImpl CReGameHook_ThrowHeGrenade; +typedef IHookChainRegistryImpl CReGameHookRegistry_ThrowHeGrenade; + +// ThrowFlashbang hook +typedef IHookChainImpl CReGameHook_ThrowFlashbang; +typedef IHookChainRegistryImpl CReGameHookRegistry_ThrowFlashbang; + +// ThrowSmokeGrenade hook +typedef IHookChainImpl CReGameHook_ThrowSmokeGrenade; +typedef IHookChainRegistryImpl CReGameHookRegistry_ThrowSmokeGrenade; + +// PlantBomb hook +typedef IHookChainImpl CReGameHook_PlantBomb; +typedef IHookChainRegistryImpl CReGameHookRegistry_PlantBomb; + class CReGameHookchains: public IReGameHookchains { public: // CBasePlayer virtual @@ -526,7 +609,22 @@ public: CReGameHookRegistry_CSGameRules_OnRoundFreezeEnd m_CSGameRules_OnRoundFreezeEnd; CReGameHookRegistry_PM_UpdateStepSound m_PM_UpdateStepSound; CReGameHookRegistry_CBasePlayer_StartDeathCam m_CBasePlayer_StartDeathCam; + CReGameHookRegistry_CBasePlayer_SwitchTeam m_CBasePlayer_SwitchTeam; + CReGameHookRegistry_CBasePlayer_CanSwitchTeam m_CBasePlayer_CanSwitchTeam; + CReGameHookRegistry_CBasePlayer_ThrowGrenade m_CBasePlayer_ThrowGrenade; + CReGameHookRegistry_CSGameRules_CanPlayerHearPlayer m_CSGameRules_CanPlayerHearPlayer; + CReGameHookRegistry_CWeaponBox_SetModel m_CWeaponBox_SetModel; + CReGameHookRegistry_CGrenade_DefuseBombStart m_CGrenade_DefuseBombStart; + CReGameHookRegistry_CGrenade_DefuseBombEnd m_CGrenade_DefuseBombEnd; + CReGameHookRegistry_CGrenade_ExplodeHeGrenade m_CGrenade_ExplodeHeGrenade; + CReGameHookRegistry_CGrenade_ExplodeFlashbang m_CGrenade_ExplodeFlashbang; + CReGameHookRegistry_CGrenade_ExplodeSmokeGrenade m_CGrenade_ExplodeSmokeGrenade; + CReGameHookRegistry_CGrenade_ExplodeBomb m_CGrenade_ExplodeBomb; + CReGameHookRegistry_ThrowHeGrenade m_ThrowHeGrenade; + CReGameHookRegistry_ThrowFlashbang m_ThrowFlashbang; + CReGameHookRegistry_ThrowSmokeGrenade m_ThrowSmokeGrenade; + CReGameHookRegistry_PlantBomb m_PlantBomb; public: virtual IReGameHookRegistry_CBasePlayer_Spawn *CBasePlayer_Spawn(); virtual IReGameHookRegistry_CBasePlayer_Precache *CBasePlayer_Precache(); @@ -613,6 +711,22 @@ public: virtual IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd *CSGameRules_OnRoundFreezeEnd(); virtual IReGameHookRegistry_PM_UpdateStepSound *PM_UpdateStepSound(); virtual IReGameHookRegistry_CBasePlayer_StartDeathCam *CBasePlayer_StartDeathCam(); + virtual IReGameHookRegistry_CBasePlayer_SwitchTeam *CBasePlayer_SwitchTeam(); + virtual IReGameHookRegistry_CBasePlayer_CanSwitchTeam *CBasePlayer_CanSwitchTeam(); + virtual IReGameHookRegistry_CBasePlayer_ThrowGrenade *CBasePlayer_ThrowGrenade(); + + virtual IReGameHookRegistry_CSGameRules_CanPlayerHearPlayer *CSGameRules_CanPlayerHearPlayer(); + virtual IReGameHookRegistry_CWeaponBox_SetModel *CWeaponBox_SetModel(); + virtual IReGameHookRegistry_CGrenade_DefuseBombStart *CGrenade_DefuseBombStart(); + virtual IReGameHookRegistry_CGrenade_DefuseBombEnd *CGrenade_DefuseBombEnd(); + virtual IReGameHookRegistry_CGrenade_ExplodeHeGrenade *CGrenade_ExplodeHeGrenade(); + virtual IReGameHookRegistry_CGrenade_ExplodeFlashbang *CGrenade_ExplodeFlashbang(); + virtual IReGameHookRegistry_CGrenade_ExplodeSmokeGrenade *CGrenade_ExplodeSmokeGrenade(); + virtual IReGameHookRegistry_CGrenade_ExplodeBomb *CGrenade_ExplodeBomb(); + virtual IReGameHookRegistry_ThrowHeGrenade *ThrowHeGrenade(); + virtual IReGameHookRegistry_ThrowFlashbang *ThrowFlashbang(); + virtual IReGameHookRegistry_ThrowSmokeGrenade *ThrowSmokeGrenade(); + virtual IReGameHookRegistry_PlantBomb *PlantBomb(); }; extern CReGameHookchains g_ReGameHookchains; diff --git a/regamedll/dlls/gamerules.h b/regamedll/dlls/gamerules.h index cb4b8922..f29cae67 100644 --- a/regamedll/dlls/gamerules.h +++ b/regamedll/dlls/gamerules.h @@ -772,6 +772,7 @@ protected: float m_flEscapeRatio; float m_flTimeLimit; float m_flGameStartTime; + bool m_bTeamBalanced; }; typedef struct mapcycle_item_s @@ -795,6 +796,10 @@ class CCStrikeGameMgrHelper: public IVoiceGameMgrHelper { public: virtual bool CanPlayerHearPlayer(CBasePlayer *pListener, CBasePlayer *pSender); + +#ifdef REGAMEDLL_API + bool CanPlayerHearPlayer_OrigFunc(CBasePlayer *pListener, CBasePlayer *pSender); +#endif }; extern CGameRules DLLEXPORT *g_pGameRules; diff --git a/regamedll/dlls/ggrenade.cpp b/regamedll/dlls/ggrenade.cpp index 5177cf54..b86b6325 100644 --- a/regamedll/dlls/ggrenade.cpp +++ b/regamedll/dlls/ggrenade.cpp @@ -28,8 +28,10 @@ void CGrenade::Explode(Vector vecSrc, Vector vecAim) Explode(&tr, DMG_BLAST); } +LINK_HOOK_CLASS_VOID_CUSTOM2_CHAIN(CGrenade, ExplodeFlashbang, Explode, (TraceResult *pTrace, int bitsDamageType), pTrace, bitsDamageType) + // UNDONE: temporary scorching for PreAlpha - find a less sleazy permenant solution. -void CGrenade::Explode(TraceResult *pTrace, int bitsDamageType) +void CGrenade::__API_HOOK(Explode)(TraceResult *pTrace, int bitsDamageType) { float flRndSound; // sound randomizer @@ -90,7 +92,9 @@ void CGrenade::Explode(TraceResult *pTrace, int bitsDamageType) } } -void CGrenade::Explode2(TraceResult *pTrace, int bitsDamageType) +LINK_HOOK_CLASS_VOID_CUSTOM2_CHAIN(CGrenade, ExplodeBomb, Explode2, (TraceResult *pTrace, int bitsDamageType), pTrace, bitsDamageType) + +void CGrenade::__API_HOOK(Explode2)(TraceResult *pTrace, int bitsDamageType) { float flRndSound; // sound randomizer @@ -221,7 +225,9 @@ void CGrenade::Explode2(TraceResult *pTrace, int bitsDamageType) } } -void CGrenade::Explode3(TraceResult *pTrace, int bitsDamageType) +LINK_HOOK_CLASS_VOID_CUSTOM2_CHAIN(CGrenade, ExplodeHeGrenade, Explode3, (TraceResult *pTrace, int bitsDamageType), pTrace, bitsDamageType) + +void CGrenade::__API_HOOK(Explode3)(TraceResult *pTrace, int bitsDamageType) { float flRndSound; // sound randomizer @@ -541,7 +547,9 @@ void CGrenade::Detonate() Explode(&tr, DMG_BLAST); } -void CGrenade::SG_Detonate() +LINK_HOOK_CLASS_VOID_CUSTOM2_CHAIN2(CGrenade, ExplodeSmokeGrenade, SG_Detonate) + +void CGrenade::__API_HOOK(SG_Detonate)() { TraceResult tr; Vector vecSpot; @@ -863,7 +871,9 @@ NOXREF CGrenade *CGrenade::ShootContact(entvars_t *pevOwner, Vector vecStart, Ve return pGrenade; } -CGrenade *CGrenade::ShootTimed2(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, int iTeam, unsigned short usEvent) +LINK_HOOK_CUSTOM2_CHAIN(CGrenade *, ThrowHeGrenade, CGrenade::ShootTimed2, (entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, int iTeam, unsigned short usEvent), pevOwner, vecStart, vecVelocity, time, iTeam, usEvent) + +CGrenade *CGrenade::__API_HOOK(ShootTimed2)(entvars_t *pevOwner, VectorRef vecStart, VectorRef vecVelocity, float time, int iTeam, unsigned short usEvent) { CGrenade *pGrenade = GetClassPtr((CGrenade *)nullptr); pGrenade->Spawn(); @@ -897,7 +907,9 @@ CGrenade *CGrenade::ShootTimed2(entvars_t *pevOwner, Vector vecStart, Vector vec return pGrenade; } -CGrenade *CGrenade::ShootTimed(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time) +LINK_HOOK_CUSTOM2_CHAIN(CGrenade *, ThrowFlashbang, CGrenade::ShootTimed, (entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time), pevOwner, vecStart, vecVelocity, time) + +CGrenade *CGrenade::__API_HOOK(ShootTimed)(entvars_t *pevOwner, VectorRef vecStart, VectorRef vecVelocity, float time) { CGrenade *pGrenade = GetClassPtr((CGrenade *)nullptr); pGrenade->Spawn(); @@ -940,40 +952,16 @@ CGrenade *CGrenade::ShootTimed(entvars_t *pevOwner, Vector vecStart, Vector vecV constexpr float NEXT_DEFUSE_TIME = 0.5f; -void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) +LINK_HOOK_CLASS_VOID_CHAIN(CGrenade, DefuseBombStart, (CBasePlayer *pPlayer), pPlayer) + +void CGrenade::__API_HOOK(DefuseBombStart)(CBasePlayer *pPlayer) { - if (!m_bIsC4) - return; - - // TODO: We must be sure that the activator is a player. - CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)pActivator->pev); - - // For CTs to defuse the c4 - if (pPlayer->m_iTeam != CT) - { - return; - } - -#ifdef REGAMEDLL_FIXES - if((pPlayer->pev->flags & FL_ONGROUND) != FL_ONGROUND) // Defuse should start only on ground - { - ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#C4_Defuse_Must_Be_On_Ground"); - return; - } -#endif - - if (m_bStartDefuse) - { - m_fNextDefuse = gpGlobals->time + NEXT_DEFUSE_TIME; - return; - } - // freeze the player in place while defusing SET_CLIENT_MAXSPEED(pPlayer->edict(), 1); if (TheBots) { - TheBots->OnEvent(EVENT_BOMB_DEFUSING, pActivator); + TheBots->OnEvent(EVENT_BOMB_DEFUSING, pPlayer); } if (CSGameRules()->IsCareer() && TheCareerTasks) @@ -1013,7 +1001,7 @@ void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy } pPlayer->m_bIsDefusing = true; - m_pBombDefuser = static_cast(pActivator); + m_pBombDefuser = pPlayer; m_bStartDefuse = true; m_fNextDefuse = gpGlobals->time + NEXT_DEFUSE_TIME; @@ -1024,7 +1012,156 @@ void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy #endif } -CGrenade *CGrenade::ShootSatchelCharge(entvars_t *pevOwner, Vector vecStart, Vector vecAngles) +LINK_HOOK_CLASS_VOID_CHAIN(CGrenade, DefuseBombEnd, (CBasePlayer *pPlayer, bool bDefused), pPlayer, bDefused) + +void CGrenade::__API_HOOK(DefuseBombEnd)(CBasePlayer *pPlayer, bool bDefused) +{ + if (bDefused) + { + // if the defuse process has ended, kill the c4 + if (m_pBombDefuser->pev->deadflag == DEAD_NO) + { + #ifdef REGAMEDLL_ADD + if (!old_bomb_defused_sound.value) + #endif + { + Broadcast("BOMBDEF"); + } + + if (TheBots) + { + TheBots->OnEvent(EVENT_BOMB_DEFUSED, (CBaseEntity *)m_pBombDefuser); + } + + MESSAGE_BEGIN(MSG_SPEC, SVC_DIRECTOR); + WRITE_BYTE(9); + WRITE_BYTE(DRC_CMD_EVENT); + WRITE_SHORT(ENTINDEX(m_pBombDefuser->edict())); + WRITE_SHORT(0); + WRITE_LONG(15 | DRC_FLAG_FINAL | DRC_FLAG_FACEPLAYER | DRC_FLAG_DRAMATIC); + MESSAGE_END(); + + UTIL_LogPrintf("\"%s<%i><%s>\" triggered \"Defused_The_Bomb\"\n", + STRING(m_pBombDefuser->pev->netname), + GETPLAYERUSERID(m_pBombDefuser->edict()), + GETPLAYERAUTHID(m_pBombDefuser->edict())); + + UTIL_EmitAmbientSound(ENT(pev), pev->origin, "weapons/c4_beep5.wav", 0, ATTN_NONE, SND_STOP, 0); + EMIT_SOUND(ENT(m_pBombDefuser->pev), CHAN_WEAPON, "weapons/c4_disarmed.wav", VOL_NORM, ATTN_NORM); + UTIL_Remove(this); + + m_bJustBlew = true; + + // release the player from being frozen + pPlayer->ResetMaxSpeed(); + pPlayer->m_bIsDefusing = false; + + MESSAGE_BEGIN(MSG_ALL, gmsgScenarioIcon); + WRITE_BYTE(0); + MESSAGE_END(); + + if (CSGameRules()->IsCareer() && !pPlayer->IsBot()) + { + if (TheCareerTasks) + { + TheCareerTasks->HandleEvent(EVENT_BOMB_DEFUSED, pPlayer); + } + } + + CSGameRules()->m_bBombDefused = true; + CSGameRules()->CheckWinConditions(); + + // give the defuser credit for defusing the bomb + m_pBombDefuser->pev->frags += 3.0f; + + MESSAGE_BEGIN(MSG_ALL, gmsgBombPickup); + MESSAGE_END(); + + g_pGameRules->m_bBombDropped = FALSE; + m_pBombDefuser = nullptr; + m_bStartDefuse = false; + } + else + { + // if it gets here then the previouse defuser has taken off or been killed + // release the player from being frozen + pPlayer->ResetMaxSpeed(); + pPlayer->m_bIsDefusing = false; + + m_bStartDefuse = false; + m_pBombDefuser = nullptr; + + #ifdef REGAMEDLL_FIXES + pPlayer->SetProgressBarTime(0); + #endif + + // tell the bots someone has aborted defusing + if (TheBots) + { + TheBots->OnEvent(EVENT_BOMB_DEFUSE_ABORTED); + } + } + } + else + { + int iOnGround = ((m_pBombDefuser->pev->flags & FL_ONGROUND) == FL_ONGROUND); + if (!iOnGround) + { + ClientPrint(m_pBombDefuser->pev, HUD_PRINTCENTER, "#C4_Defuse_Must_Be_On_Ground"); + } + + // release the player from being frozen + pPlayer->ResetMaxSpeed(); + pPlayer->m_bIsDefusing = false; + + // cancel the progress bar + pPlayer->SetProgressBarTime(0); + m_pBombDefuser = nullptr; + m_bStartDefuse = false; + m_flDefuseCountDown = 0; + + // tell the bots someone has aborted defusing + if (TheBots) + { + TheBots->OnEvent(EVENT_BOMB_DEFUSE_ABORTED); + } + } +} + +void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) +{ + if (!m_bIsC4) + return; + + // TODO: We must be sure that the activator is a player. + CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)pActivator->pev); + + // For CTs to defuse the c4 + if (pPlayer->m_iTeam != CT) + { + return; + } + +#ifdef REGAMEDLL_FIXES + if((pPlayer->pev->flags & FL_ONGROUND) != FL_ONGROUND) // Defuse should start only on ground + { + ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#C4_Defuse_Must_Be_On_Ground"); + return; + } +#endif + + if (m_bStartDefuse) + { + m_fNextDefuse = gpGlobals->time + NEXT_DEFUSE_TIME; + return; + } + + DefuseBombStart(pPlayer); +} + +LINK_HOOK_CUSTOM2_CHAIN(CGrenade *, PlantBomb, CGrenade::ShootSatchelCharge, (entvars_t *pevOwner, Vector vecStart, Vector vecAngles), pevOwner, vecStart, vecAngles) + +CGrenade *CGrenade::__API_HOOK(ShootSatchelCharge)(entvars_t *pevOwner, VectorRef vecStart, VectorRef vecAngles) { CGrenade *pGrenade = GetClassPtr((CGrenade *)nullptr); pGrenade->pev->movetype = MOVETYPE_TOSS; @@ -1084,7 +1221,9 @@ CGrenade *CGrenade::ShootSatchelCharge(entvars_t *pevOwner, Vector vecStart, Vec return pGrenade; } -CGrenade *CGrenade::ShootSmokeGrenade(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, unsigned short usEvent) +LINK_HOOK_CUSTOM2_CHAIN(CGrenade *, ThrowSmokeGrenade, CGrenade::ShootSmokeGrenade, (entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, unsigned short usEvent), pevOwner, vecStart, vecVelocity, time, usEvent) + +CGrenade *CGrenade::__API_HOOK(ShootSmokeGrenade)(entvars_t *pevOwner, VectorRef vecStart, VectorRef vecVelocity, float time, unsigned short usEvent) { CGrenade *pGrenade = GetClassPtr((CGrenade *)nullptr); pGrenade->Spawn(); @@ -1263,7 +1402,6 @@ void CGrenade::C4Think() { SetThink(&CGrenade::Detonate2); } - } // if the defusing process has started @@ -1279,110 +1417,12 @@ void CGrenade::C4Think() // if the bomb defuser has stopped defusing the bomb if (gpGlobals->time > m_fNextDefuse || !iOnGround) { - if (!iOnGround) - { - ClientPrint(m_pBombDefuser->pev, HUD_PRINTCENTER, "#C4_Defuse_Must_Be_On_Ground"); - } - - // release the player from being frozen - pPlayer->ResetMaxSpeed(); - pPlayer->m_bIsDefusing = false; - - // cancel the progress bar - pPlayer->SetProgressBarTime(0); - m_pBombDefuser = nullptr; - m_bStartDefuse = false; - m_flDefuseCountDown = 0; - - // tell the bots someone has aborted defusing - if (TheBots) - { - TheBots->OnEvent(EVENT_BOMB_DEFUSE_ABORTED); - } + DefuseBombEnd(pPlayer, false); } } - // if the defuse process has ended, kill the c4 - else if (m_pBombDefuser->pev->deadflag == DEAD_NO) - { -#ifdef REGAMEDLL_ADD - if (!old_bomb_defused_sound.value) -#endif - { - Broadcast("BOMBDEF"); - } - - if (TheBots) - { - TheBots->OnEvent(EVENT_BOMB_DEFUSED, (CBaseEntity *)m_pBombDefuser); - } - - MESSAGE_BEGIN(MSG_SPEC, SVC_DIRECTOR); - WRITE_BYTE(9); - WRITE_BYTE(DRC_CMD_EVENT); - WRITE_SHORT(ENTINDEX(m_pBombDefuser->edict())); - WRITE_SHORT(0); - WRITE_LONG(15 | DRC_FLAG_FINAL | DRC_FLAG_FACEPLAYER | DRC_FLAG_DRAMATIC); - MESSAGE_END(); - - UTIL_LogPrintf("\"%s<%i><%s>\" triggered \"Defused_The_Bomb\"\n", - STRING(m_pBombDefuser->pev->netname), - GETPLAYERUSERID(m_pBombDefuser->edict()), - GETPLAYERAUTHID(m_pBombDefuser->edict())); - - UTIL_EmitAmbientSound(ENT(pev), pev->origin, "weapons/c4_beep5.wav", 0, ATTN_NONE, SND_STOP, 0); - EMIT_SOUND(ENT(m_pBombDefuser->pev), CHAN_WEAPON, "weapons/c4_disarmed.wav", VOL_NORM, ATTN_NORM); - UTIL_Remove(this); - - m_bJustBlew = true; - - // release the player from being frozen - pPlayer->ResetMaxSpeed(); - pPlayer->m_bIsDefusing = false; - - MESSAGE_BEGIN(MSG_ALL, gmsgScenarioIcon); - WRITE_BYTE(0); - MESSAGE_END(); - - if (CSGameRules()->IsCareer() && !pPlayer->IsBot()) - { - if (TheCareerTasks) - { - TheCareerTasks->HandleEvent(EVENT_BOMB_DEFUSED, pPlayer); - } - } - - CSGameRules()->m_bBombDefused = true; - CSGameRules()->CheckWinConditions(); - - // give the defuser credit for defusing the bomb - m_pBombDefuser->pev->frags += 3.0f; - - MESSAGE_BEGIN(MSG_ALL, gmsgBombPickup); - MESSAGE_END(); - - g_pGameRules->m_bBombDropped = FALSE; - m_pBombDefuser = nullptr; - m_bStartDefuse = false; - } else { - // if it gets here then the previouse defuser has taken off or been killed - // release the player from being frozen - pPlayer->ResetMaxSpeed(); - pPlayer->m_bIsDefusing = false; - - m_bStartDefuse = false; - m_pBombDefuser = nullptr; - -#ifdef REGAMEDLL_FIXES - pPlayer->SetProgressBarTime(0); -#endif - - // tell the bots someone has aborted defusing - if (TheBots) - { - TheBots->OnEvent(EVENT_BOMB_DEFUSE_ABORTED); - } + DefuseBombEnd(pPlayer, true); } } } diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index c4e23f53..481814d8 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -85,7 +85,9 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(ServerDeactivate)() UTIL_LogPrintf("Career End\n"); } -bool CCStrikeGameMgrHelper::CanPlayerHearPlayer(CBasePlayer *pListener, CBasePlayer *pSender) +LINK_HOOK_CLASS_CUSTOM_CHAIN(bool, CCStrikeGameMgrHelper, CSGameRules, CanPlayerHearPlayer, (CBasePlayer *pListener, CBasePlayer *pSender), pListener, pSender) + +bool CCStrikeGameMgrHelper::__API_HOOK(CanPlayerHearPlayer)(CBasePlayer *pListener, CBasePlayer *pSender) { #ifdef REGAMEDLL_ADD switch ((int)sv_alltalk.value) @@ -489,6 +491,7 @@ CHalfLifeMultiplay::CHalfLifeMultiplay() m_flEscapeRatio = 0.0f; m_flTimeLimit = 0.0f; m_flGameStartTime = 0.0f; + m_bTeamBalanced = false; #ifndef REGAMEDLL_FIXES g_pMPGameRules = this; @@ -1446,8 +1449,10 @@ LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(CHalfLifeMultiplay, CSGameRules, BalanceTeams void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(BalanceTeams)() { - int iTeamToSwap = UNASSIGNED; int iNumToSwap; + TeamName iTeamToSwap = UNASSIGNED; + + m_bTeamBalanced = false; // The ratio for teams is different for Assasination maps if (m_bMapHasVIPSafetyZone) @@ -1522,7 +1527,7 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(BalanceTeams)() CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)pEntity->pev); - if (pPlayer->m_iTeam == iTeamToSwap && GETPLAYERUSERID(pPlayer->edict()) > iHighestUserID && m_pVIP != pPlayer) + if (pPlayer->CanSwitchTeam(iTeamToSwap) && GETPLAYERUSERID(pPlayer->edict()) > iHighestUserID) { iHighestUserID = GETPLAYERUSERID(pPlayer->edict()); toSwap = pPlayer; @@ -1530,7 +1535,9 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(BalanceTeams)() } if (toSwap) { + m_bTeamBalanced = true; toSwap->SwitchTeam(); + m_bTeamBalanced = false; } } } diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 7adbd538..6b23bb4e 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -1248,7 +1248,7 @@ void PackPlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pItem, bool packAmmo) pWeaponBox->PackAmmo(MAKE_STRING(pItem->pszAmmo1()), pPlayer->m_rgAmmo[pItem->PrimaryAmmoIndex()]); } - SET_MODEL(ENT(pWeaponBox->pev), modelName); + pWeaponBox->SetModel(modelName); } } @@ -1304,7 +1304,7 @@ void PackPlayerNade(CBasePlayer *pPlayer, CBasePlayerItem *pItem, bool packAmmo) pWeaponBox->PackAmmo(MAKE_STRING(pItem->pszAmmo1()), pPlayer->m_rgAmmo[pItem->PrimaryAmmoIndex()]); } - SET_MODEL(ENT(pWeaponBox->pev), modelName); + pWeaponBox->SetModel(modelName); } } #endif @@ -1936,7 +1936,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Killed)(entvars_t *pevAttacker, int iGib) CHEGrenade *pHEGrenade = static_cast(m_pActiveItem); if ((pev->button & IN_ATTACK) && m_rgAmmo[pHEGrenade->m_iPrimaryAmmoType]) { - CGrenade::ShootTimed2(pev, (pev->origin + pev->view_ofs), pev->angles, 1.5, m_iTeam, pHEGrenade->m_usCreateExplosion); + ThrowGrenade(pHEGrenade, (pev->origin + pev->view_ofs), pev->angles, 1.5, pHEGrenade->m_usCreateExplosion); #ifdef REGAMEDLL_FIXES m_rgAmmo[m_pActiveItem->PrimaryAmmoIndex()]--; @@ -1946,9 +1946,10 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Killed)(entvars_t *pevAttacker, int iGib) } case WEAPON_FLASHBANG: { - if ((pev->button & IN_ATTACK) && m_rgAmmo[((CBasePlayerWeapon *)m_pActiveItem)->m_iPrimaryAmmoType]) + CFlashbang *pFlashbang = static_cast(m_pActiveItem); + if ((pev->button & IN_ATTACK) && m_rgAmmo[pFlashbang->m_iPrimaryAmmoType]) { - CGrenade::ShootTimed(pev, (pev->origin + pev->view_ofs), pev->angles, 1.5); + ThrowGrenade(pFlashbang, (pev->origin + pev->view_ofs), pev->angles, 1.5); #ifdef REGAMEDLL_FIXES m_rgAmmo[m_pActiveItem->PrimaryAmmoIndex()]--; @@ -1961,7 +1962,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Killed)(entvars_t *pevAttacker, int iGib) CSmokeGrenade *pSmoke = static_cast(m_pActiveItem); if ((pev->button & IN_ATTACK) && m_rgAmmo[pSmoke->m_iPrimaryAmmoType]) { - CGrenade::ShootSmokeGrenade(pev, (pev->origin + pev->view_ofs), pev->angles, 1.5, pSmoke->m_usCreateSmoke); + ThrowGrenade(pSmoke, (pev->origin + pev->view_ofs), pev->angles, 1.5, pSmoke->m_usCreateSmoke); #ifdef REGAMEDLL_FIXES m_rgAmmo[m_pActiveItem->PrimaryAmmoIndex()]--; @@ -3058,6 +3059,20 @@ NOXREF void CBasePlayer::ThrowPrimary() DropShield(); } +LINK_HOOK_CLASS_CHAIN(CGrenade *, CBasePlayer, ThrowGrenade, (CBasePlayerWeapon *pWeapon, Vector vecSrc, Vector vecThrow, float time, unsigned short usEvent), pWeapon, vecSrc, vecThrow, time, usEvent) + +CGrenade *CBasePlayer::__API_HOOK(ThrowGrenade)(CBasePlayerWeapon *pWeapon, VectorRef vecSrc, VectorRef vecThrow, float time, unsigned short usEvent) +{ + switch (pWeapon->m_iId) + { + case WEAPON_HEGRENADE: return CGrenade::ShootTimed2(pev, vecSrc, vecThrow, time, m_iTeam, usEvent); + case WEAPON_FLASHBANG: return CGrenade::ShootTimed(pev, vecSrc, vecThrow, time); + case WEAPON_SMOKEGRENADE: return CGrenade::ShootSmokeGrenade(pev, vecSrc, vecThrow, time, usEvent); + } + + return nullptr; +} + LINK_HOOK_CLASS_VOID_CHAIN(CBasePlayer, AddAccount, (int amount, RewardType type, bool bTrackChange), amount, type, bTrackChange) #ifdef REGAMEDLL_ADD @@ -7429,7 +7444,7 @@ CBaseEntity *EXT_FUNC CBasePlayer::__API_HOOK(DropPlayerItem)(const char *pszIte const char *modelname = GetCSModelName(pWeapon->m_iId); if (modelname) { - SET_MODEL(ENT(pWeaponBox->pev), modelname); + pWeaponBox->SetModel(modelname); } return pWeaponBox; @@ -7470,7 +7485,9 @@ bool CBasePlayer::HasNamedPlayerItem(const char *pszItemName) return false; } -void CBasePlayer::SwitchTeam() +LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, SwitchTeam) + +void CBasePlayer::__API_HOOK(SwitchTeam)() { int oldTeam; char *szOldTeam; @@ -9483,3 +9500,19 @@ void CBasePlayer::PlayerRespawnThink() } #endif } + +LINK_HOOK_CLASS_CHAIN(bool, CBasePlayer, CanSwitchTeam, (TeamName teamToSwap), teamToSwap) + +bool CBasePlayer::__API_HOOK(CanSwitchTeam)(TeamName teamToSwap) +{ + if (m_iTeam != teamToSwap) + return false; + + // we won't VIP player to switch team + if (CSGameRules()->m_pVIP == this) + { + return false; + } + + return true; +} diff --git a/regamedll/dlls/player.h b/regamedll/dlls/player.h index 9a29d6b7..956dfab4 100644 --- a/regamedll/dlls/player.h +++ b/regamedll/dlls/player.h @@ -417,6 +417,9 @@ public: bool MakeBomber_OrigFunc(); bool GetIntoGame_OrigFunc(); void StartDeathCam_OrigFunc(); + CGrenade *ThrowGrenade_OrigFunc(CBasePlayerWeapon *pWeapon, VectorRef vecSrc, VectorRef vecThrow, float time, unsigned short usEvent = 0); + void SwitchTeam_OrigFunc(); + bool CanSwitchTeam_OrigFunc(TeamName teamToSwap); CCSPlayer *CSPlayer() const; #endif // REGAMEDLL_API @@ -442,10 +445,12 @@ public: void SmartRadio(); void ThrowWeapon(char *pszItemName); void ThrowPrimary(); + CGrenade *ThrowGrenade(CBasePlayerWeapon *pWeapon, Vector vecSrc, Vector vecThrow, float time, unsigned short usEvent = 0); void AddAccount(int amount, RewardType type = RT_NONE, bool bTrackChange = true); void Disappear(); void MakeVIP(); bool CanPlayerBuy(bool display = false); + bool CanSwitchTeam(TeamName teamToSwap); void SwitchTeam(); void TabulateAmmo(); void Pain(int iLastHitGroup, bool bHasArmour); diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index 7a960af0..66a21427 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -1564,6 +1564,13 @@ void CWeaponBox::BombThink() pev->nextthink = gpGlobals->time + 1.0f; } +LINK_HOOK_CLASS_VOID_CHAIN(CWeaponBox, SetModel, (const char *pszModelName), pszModelName) + +void CWeaponBox::__API_HOOK(SetModel)(const char *pszModelName) +{ + SET_MODEL(ENT(pev), pszModelName); +} + void CWeaponBox::Spawn() { Precache(); diff --git a/regamedll/dlls/weapons.h b/regamedll/dlls/weapons.h index 4fa70e53..e63ebfdc 100644 --- a/regamedll/dlls/weapons.h +++ b/regamedll/dlls/weapons.h @@ -182,6 +182,9 @@ public: SATCHEL_RELEASE, }; public: + void DefuseBombStart(CBasePlayer *pPlayer); + void DefuseBombEnd(CBasePlayer *pPlayer, bool bDefused); + static CGrenade *ShootTimed(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time); static CGrenade *ShootTimed2(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, int iTeam, unsigned short usEvent); static CGrenade *ShootContact(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity); @@ -195,6 +198,21 @@ public: void Explode3(TraceResult *pTrace, int bitsDamageType); void SG_Explode(TraceResult *pTrace, int bitsDamageType); +#ifdef REGAMEDLL_API + static CGrenade *ShootTimed_OrigFunc(entvars_t *pevOwner, VectorRef vecStart, VectorRef vecVelocity, float time); + static CGrenade *ShootTimed2_OrigFunc(entvars_t *pevOwner, VectorRef vecStart, VectorRef vecVelocity, float time, int iTeam, unsigned short usEvent); + static CGrenade *ShootSmokeGrenade_OrigFunc(entvars_t *pevOwner, VectorRef vecStart, VectorRef vecVelocity, float time, unsigned short usEvent); + static CGrenade *ShootSatchelCharge_OrigFunc(entvars_t *pevOwner, VectorRef vecStart, VectorRef vecVelocity); + + void DefuseBombStart_OrigFunc(CBasePlayer *pPlayer); + void DefuseBombEnd_OrigFunc(CBasePlayer *pPlayer, bool bDefused); + + void Explode_OrigFunc(TraceResult *pTrace, int bitsDamageType); + void Explode3_OrigFunc(TraceResult *pTrace, int bitsDamageType); + void Explode2_OrigFunc(TraceResult *pTrace, int bitsDamageType); + void SG_Detonate_OrigFunc(); +#endif + void EXPORT Smoke(); void EXPORT Smoke2(); void EXPORT Smoke3_A(); @@ -447,11 +465,16 @@ public: void EXPORT Kill(); void EXPORT BombThink(); + void SetModel(const char *pszModelName); BOOL HasWeapon(CBasePlayerItem *pCheckItem); BOOL PackWeapon(CBasePlayerItem *pWeapon); BOOL PackAmmo(string_t iszName, int iCount); +#ifdef REGAMEDLL_API + void SetModel_OrigFunc(const char *pszModelName); +#endif + public: static TYPEDESCRIPTION m_SaveData[]; diff --git a/regamedll/dlls/wpn_shared/wpn_flashbang.cpp b/regamedll/dlls/wpn_shared/wpn_flashbang.cpp index 1a6a5067..0aece25f 100644 --- a/regamedll/dlls/wpn_shared/wpn_flashbang.cpp +++ b/regamedll/dlls/wpn_shared/wpn_flashbang.cpp @@ -193,7 +193,7 @@ void CFlashbang::WeaponIdle() Vector vecSrc = m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16; Vector vecThrow = gpGlobals->v_forward * flVel + m_pPlayer->pev->velocity; - CGrenade::ShootTimed(m_pPlayer->pev, vecSrc, vecThrow, 1.5); + m_pPlayer->ThrowGrenade(this, vecSrc, vecThrow, 1.5); SendWeaponAnim(FLASHBANG_THROW, UseDecrement() != FALSE); SetPlayerShieldAnim(); diff --git a/regamedll/dlls/wpn_shared/wpn_hegrenade.cpp b/regamedll/dlls/wpn_shared/wpn_hegrenade.cpp index 19fd20f0..6ccae936 100644 --- a/regamedll/dlls/wpn_shared/wpn_hegrenade.cpp +++ b/regamedll/dlls/wpn_shared/wpn_hegrenade.cpp @@ -194,7 +194,7 @@ void CHEGrenade::WeaponIdle() Vector vecSrc = m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16; Vector vecThrow = gpGlobals->v_forward * flVel + m_pPlayer->pev->velocity; - CGrenade::ShootTimed2(m_pPlayer->pev, vecSrc, vecThrow, 1.5, m_pPlayer->m_iTeam, m_usCreateExplosion); + m_pPlayer->ThrowGrenade(this, vecSrc, vecThrow, 1.5, m_usCreateExplosion); SendWeaponAnim(HEGRENADE_THROW, UseDecrement() != FALSE); SetPlayerShieldAnim(); diff --git a/regamedll/dlls/wpn_shared/wpn_smokegrenade.cpp b/regamedll/dlls/wpn_shared/wpn_smokegrenade.cpp index 09fcface..bc2b7b9d 100644 --- a/regamedll/dlls/wpn_shared/wpn_smokegrenade.cpp +++ b/regamedll/dlls/wpn_shared/wpn_smokegrenade.cpp @@ -195,7 +195,7 @@ void CSmokeGrenade::WeaponIdle() Vector vecSrc = m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16.0f; Vector vecThrow = gpGlobals->v_forward * flVel + m_pPlayer->pev->velocity; - CGrenade::ShootSmokeGrenade(m_pPlayer->pev, vecSrc, vecThrow, 1.5, m_usCreateSmoke); + m_pPlayer->ThrowGrenade(this, vecSrc, vecThrow, 1.5, m_usCreateSmoke); SendWeaponAnim(SMOKEGRENADE_THROW, UseDecrement() != FALSE); SetPlayerShieldAnim(); diff --git a/regamedll/public/regamedll/regamedll_api.h b/regamedll/public/regamedll/regamedll_api.h index d916f6d6..ddf93e97 100644 --- a/regamedll/public/regamedll/regamedll_api.h +++ b/regamedll/public/regamedll/regamedll_api.h @@ -30,15 +30,15 @@ #include "archtypes.h" -#include #include #include -#include +#include #include #include +#include #define REGAMEDLL_API_VERSION_MAJOR 5 -#define REGAMEDLL_API_VERSION_MINOR 4 +#define REGAMEDLL_API_VERSION_MINOR 5 // CBasePlayer::Spawn hook typedef IHookChainClass IReGameHook_CBasePlayer_Spawn; @@ -356,6 +356,10 @@ typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_BalanceTeams; typedef IHookChain IReGameHook_CSGameRules_OnRoundFreezeEnd; typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd; +// CSGameRules::CanPlayerHearPlayer hook +typedef IHookChain IReGameHook_CSGameRules_CanPlayerHearPlayer; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_CanPlayerHearPlayer; + // PM_UpdateStepSound hook typedef IHookChain IReGameHook_PM_UpdateStepSound; typedef IHookChainRegistry IReGameHookRegistry_PM_UpdateStepSound; @@ -364,6 +368,62 @@ typedef IHookChainRegistry IReGameHookRegistry_PM_UpdateStepSound; typedef IHookChainClass IReGameHook_CBasePlayer_StartDeathCam; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_StartDeathCam; +// CBasePlayer::SwitchTeam hook +typedef IHookChainClass IReGameHook_CBasePlayer_SwitchTeam; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_SwitchTeam; + +// CBasePlayer::CanSwitchTeam hook +typedef IHookChainClass IReGameHook_CBasePlayer_CanSwitchTeam; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_CanSwitchTeam; + +// CBasePlayer::ThrowGrenade hook +typedef IHookChainClass IReGameHook_CBasePlayer_ThrowGrenade; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_ThrowGrenade; + +// CWeaponBox::SetModel hook +typedef IHookChainClass IReGameHook_CWeaponBox_SetModel; +typedef IHookChainRegistryClass IReGameHookRegistry_CWeaponBox_SetModel; + +// CGrenade::DefuseBombStart hook +typedef IHookChainClass IReGameHook_CGrenade_DefuseBombStart; +typedef IHookChainRegistryClass IReGameHookRegistry_CGrenade_DefuseBombStart; + +// CGrenade::DefuseBombEnd hook +typedef IHookChainClass IReGameHook_CGrenade_DefuseBombEnd; +typedef IHookChainRegistryClass IReGameHookRegistry_CGrenade_DefuseBombEnd; + +// CGrenade::ExplodeHeGrenade hook +typedef IHookChainClass IReGameHook_CGrenade_ExplodeHeGrenade; +typedef IHookChainRegistryClass IReGameHookRegistry_CGrenade_ExplodeHeGrenade; + +// CGrenade::ExplodeFlashbang hook +typedef IHookChainClass IReGameHook_CGrenade_ExplodeFlashbang; +typedef IHookChainRegistryClass IReGameHookRegistry_CGrenade_ExplodeFlashbang; + +// CGrenade::ExplodeSmokeGrenade hook +typedef IHookChainClass IReGameHook_CGrenade_ExplodeSmokeGrenade; +typedef IHookChainRegistryClass IReGameHookRegistry_CGrenade_ExplodeSmokeGrenade; + +// CGrenade::ExplodeBomb hook +typedef IHookChainClass IReGameHook_CGrenade_ExplodeBomb; +typedef IHookChainRegistryClass IReGameHookRegistry_CGrenade_ExplodeBomb; + +// ThrowHeGrenade hook +typedef IHookChain IReGameHook_ThrowHeGrenade; +typedef IHookChainRegistry IReGameHookRegistry_ThrowHeGrenade; + +// ThrowFlashbang hook +typedef IHookChain IReGameHook_ThrowFlashbang; +typedef IHookChainRegistry IReGameHookRegistry_ThrowFlashbang; + +// ThrowSmokeGrenade hook +typedef IHookChain IReGameHook_ThrowSmokeGrenade; +typedef IHookChainRegistry IReGameHookRegistry_ThrowSmokeGrenade; + +// PlantBomb hook +typedef IHookChain IReGameHook_PlantBomb; +typedef IHookChainRegistry IReGameHookRegistry_PlantBomb; + class IReGameHookchains { public: virtual ~IReGameHookchains() {} @@ -454,6 +514,21 @@ public: virtual IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd *CSGameRules_OnRoundFreezeEnd() = 0; virtual IReGameHookRegistry_PM_UpdateStepSound *PM_UpdateStepSound() = 0; virtual IReGameHookRegistry_CBasePlayer_StartDeathCam *CBasePlayer_StartDeathCam() = 0; + virtual IReGameHookRegistry_CBasePlayer_SwitchTeam *CBasePlayer_SwitchTeam() = 0; + virtual IReGameHookRegistry_CBasePlayer_CanSwitchTeam *CBasePlayer_CanSwitchTeam() = 0; + virtual IReGameHookRegistry_CBasePlayer_ThrowGrenade *CBasePlayer_ThrowGrenade() = 0; + virtual IReGameHookRegistry_CSGameRules_CanPlayerHearPlayer *CSGameRules_CanPlayerHearPlayer() = 0; + virtual IReGameHookRegistry_CWeaponBox_SetModel *CWeaponBox_SetModel() = 0; + virtual IReGameHookRegistry_CGrenade_DefuseBombStart *CGrenade_DefuseBombStart() = 0; + virtual IReGameHookRegistry_CGrenade_DefuseBombEnd *CGrenade_DefuseBombEnd() = 0; + virtual IReGameHookRegistry_CGrenade_ExplodeHeGrenade *CGrenade_ExplodeHeGrenade() = 0; + virtual IReGameHookRegistry_CGrenade_ExplodeFlashbang *CGrenade_ExplodeFlashbang() = 0; + virtual IReGameHookRegistry_CGrenade_ExplodeSmokeGrenade *CGrenade_ExplodeSmokeGrenade() = 0; + virtual IReGameHookRegistry_CGrenade_ExplodeBomb *CGrenade_ExplodeBomb() = 0; + virtual IReGameHookRegistry_ThrowHeGrenade *ThrowHeGrenade() = 0; + virtual IReGameHookRegistry_ThrowFlashbang *ThrowFlashbang() = 0; + virtual IReGameHookRegistry_ThrowSmokeGrenade *ThrowSmokeGrenade() = 0; + virtual IReGameHookRegistry_PlantBomb *PlantBomb() = 0; }; struct ReGameFuncs_t {