mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2024-12-28 15:45:41 +03:00
Added api hook ShowMenu, ShowVGUIMenu
Unlocked some cvars limit of the value #34
This commit is contained in:
parent
61d9d64c19
commit
b6e0420365
@ -207,7 +207,9 @@ void EXT_FUNC ClientKill(edict_t *pEntity)
|
||||
}
|
||||
}
|
||||
|
||||
void ShowMenu(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText)
|
||||
LINK_HOOK_VOID_CHAIN(ShowMenu, (CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText), pPlayer, bitsValidSlots, nDisplayTime, fNeedMore, pszText);
|
||||
|
||||
void __API_HOOK(ShowMenu)(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgShowMenu, NULL, pPlayer->pev);
|
||||
WRITE_SHORT(bitsValidSlots);
|
||||
@ -217,7 +219,9 @@ void ShowMenu(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL f
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
||||
void ShowVGUIMenu(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu)
|
||||
LINK_HOOK_VOID_CHAIN(ShowVGUIMenu, (CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu), pPlayer, MenuType, BitMask, szOldMenu);
|
||||
|
||||
void __API_HOOK(ShowVGUIMenu)(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu)
|
||||
{
|
||||
if (pPlayer->m_bVGUIMenus || MenuType > VGUI_Menu_Buy_Item)
|
||||
{
|
||||
|
@ -121,7 +121,9 @@ void ClientDisconnect(edict_t *pEntity);
|
||||
void respawn(entvars_t *pev, BOOL fCopyCorpse = FALSE);
|
||||
void ClientKill(edict_t *pEntity);
|
||||
void ShowMenu(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText);
|
||||
void ShowMenu_(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText);
|
||||
void ShowVGUIMenu(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu);
|
||||
void ShowVGUIMenu_(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu);
|
||||
void ListPlayers(CBasePlayer *current);
|
||||
void ProcessKickVote(CBasePlayer *pVotingPlayer, CBasePlayer *pKickPlayer);
|
||||
TeamName SelectDefaultTeam();
|
||||
|
@ -586,39 +586,12 @@ public:
|
||||
bool IsMatchStarted() { return (m_fTeamCount != 0.0f || m_fCareerRoundMenuTime != 0.0f || m_fCareerMatchMenuTime != 0.0f); }
|
||||
void SendMOTDToClient(edict_t *client);
|
||||
|
||||
inline void TerminateRound(float tmDelay, int iWinStatus)
|
||||
{
|
||||
m_iRoundWinStatus = iWinStatus;
|
||||
m_fTeamCount = gpGlobals->time + tmDelay;
|
||||
m_bRoundTerminating = true;
|
||||
}
|
||||
|
||||
inline float GetRoundRespawnTime() const
|
||||
{
|
||||
#ifdef REGAMEDLL_ADD
|
||||
return roundrespawn_time.value;
|
||||
#else
|
||||
return ROUND_RESPAWN_TIME;
|
||||
#endif
|
||||
}
|
||||
void TerminateRound(float tmDelay, int iWinStatus);
|
||||
float GetRoundRespawnTime() const;
|
||||
|
||||
// allow the mode of fire on a friendly player (FFA)
|
||||
inline bool IsFriendlyFireAttack() const
|
||||
{
|
||||
#ifdef REGAMEDLL_ADD
|
||||
if (friendlyfire.string[0] == '2')
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
inline bool HasRoundInfinite(bool time_expired = false) const
|
||||
{
|
||||
#ifdef REGAMEDLL_ADD
|
||||
if (round_infinite.string[0] == '1' || (time_expired && (UTIL_ReadFlags(round_infinite.string) & SCENARIO_BLOCK_TIME_EXPRIRED)))
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
bool IsFriendlyFireAttack() const;
|
||||
bool HasRoundInfinite(bool time_expired = false) const;
|
||||
|
||||
private:
|
||||
bool HasRoundTimeExpired();
|
||||
@ -774,6 +747,41 @@ inline CHalfLifeMultiplay *CSGameRules()
|
||||
return reinterpret_cast<CHalfLifeMultiplay *>(g_pGameRules);
|
||||
}
|
||||
|
||||
inline void CHalfLifeMultiplay::TerminateRound(float tmDelay, int iWinStatus)
|
||||
{
|
||||
m_iRoundWinStatus = iWinStatus;
|
||||
m_fTeamCount = gpGlobals->time + tmDelay;
|
||||
m_bRoundTerminating = true;
|
||||
}
|
||||
|
||||
inline float CHalfLifeMultiplay::GetRoundRespawnTime() const
|
||||
{
|
||||
#ifdef REGAMEDLL_ADD
|
||||
return roundrespawn_time.value;
|
||||
#else
|
||||
return ROUND_RESPAWN_TIME;
|
||||
#endif
|
||||
}
|
||||
|
||||
// allow the mode of fire on a friendly player (FFA)
|
||||
inline bool CHalfLifeMultiplay::IsFriendlyFireAttack() const
|
||||
{
|
||||
#ifdef REGAMEDLL_ADD
|
||||
if (friendlyfire.string[0] == '2')
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool CHalfLifeMultiplay::HasRoundInfinite(bool time_expired) const
|
||||
{
|
||||
#ifdef REGAMEDLL_ADD
|
||||
if (round_infinite.string[0] == '1' || (time_expired && (UTIL_ReadFlags(round_infinite.string) & SCENARIO_BLOCK_TIME_EXPRIRED)))
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsBotSpeaking();
|
||||
void SV_Continue_f();
|
||||
void SV_Tutor_Toggle_f();
|
||||
|
@ -341,20 +341,6 @@ void ReadMultiplayCvars(CHalfLifeMultiplay *mp)
|
||||
CVAR_SET_FLOAT("mp_roundtime", 1);
|
||||
mp->m_iRoundTime = 60;
|
||||
}
|
||||
#else
|
||||
// a limit of 500 minutes because
|
||||
// if you do more minutes would be a bug in the HUD RoundTime in the form 00:00
|
||||
if (mp->m_iRoundTime > 30000)
|
||||
{
|
||||
CVAR_SET_FLOAT("mp_roundtime", 500);
|
||||
mp->m_iRoundTime = 30000;
|
||||
}
|
||||
else if (mp->m_iRoundTime < 0)
|
||||
{
|
||||
CVAR_SET_FLOAT("mp_roundtime", 0);
|
||||
mp->m_iRoundTime = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mp->m_iIntroRoundTime > 60)
|
||||
{
|
||||
@ -388,6 +374,37 @@ void ReadMultiplayCvars(CHalfLifeMultiplay *mp)
|
||||
CVAR_SET_FLOAT("mp_limitteams", 0);
|
||||
mp->m_iLimitTeams = 0;
|
||||
}
|
||||
#else
|
||||
// a limit of 500 minutes because
|
||||
// if you do more minutes would be a bug in the HUD RoundTime in the form 00:00
|
||||
if (mp->m_iRoundTime > 30000)
|
||||
{
|
||||
CVAR_SET_FLOAT("mp_roundtime", 500);
|
||||
mp->m_iRoundTime = 30000;
|
||||
}
|
||||
else if (mp->m_iRoundTime < 0)
|
||||
{
|
||||
CVAR_SET_FLOAT("mp_roundtime", 0);
|
||||
mp->m_iRoundTime = 0;
|
||||
}
|
||||
if (mp->m_iIntroRoundTime < 0)
|
||||
{
|
||||
CVAR_SET_FLOAT("mp_freezetime", 0);
|
||||
mp->m_iIntroRoundTime = 0;
|
||||
}
|
||||
if (mp->m_iC4Timer < 0)
|
||||
{
|
||||
CVAR_SET_FLOAT("mp_c4timer", 0);
|
||||
mp->m_iC4Timer = 0;
|
||||
}
|
||||
if (mp->m_iLimitTeams < 0)
|
||||
{
|
||||
CVAR_SET_FLOAT("mp_limitteams", 0);
|
||||
mp->m_iLimitTeams = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
CHalfLifeMultiplay::CHalfLifeMultiplay()
|
||||
@ -2958,8 +2975,10 @@ void CHalfLifeMultiplay::CheckRestartRound()
|
||||
|
||||
if (iRestartDelay > 0)
|
||||
{
|
||||
#ifndef REGAMEDLL_ADD
|
||||
if (iRestartDelay > 60)
|
||||
iRestartDelay = 60;
|
||||
#endif
|
||||
|
||||
// log the restart
|
||||
UTIL_LogPrintf("World triggered \"Restart_Round_(%i_%s)\"\n", iRestartDelay, (iRestartDelay == 1) ? "second" : "seconds");
|
||||
|
@ -37,7 +37,11 @@
|
||||
#include "unisignals.h"
|
||||
#include "weapons.h"
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
#define MIN_BUY_TIME 0
|
||||
#else
|
||||
#define MIN_BUY_TIME 15 // the minimum threshold values for cvar mp_buytime 15 sec's
|
||||
#endif
|
||||
|
||||
#define MAX_BUFFER_MENU 175
|
||||
#define MAX_BUFFER_MENU_BRIEFING 50
|
||||
|
@ -202,6 +202,14 @@ typedef IVoidHookChainRegistry<class CBasePlayer *, int> IReGameHookRegistry_Han
|
||||
typedef IHookChain<BOOL, class CBasePlayer *, int> IReGameHook_HandleMenu_ChooseTeam;
|
||||
typedef IHookChainRegistry<BOOL, class CBasePlayer *, int> IReGameHookRegistry_HandleMenu_ChooseTeam;
|
||||
|
||||
// ShowMenu hook
|
||||
typedef IVoidHookChain<class CBasePlayer *, int, int, BOOL, char *> IReGameHook_ShowMenu;
|
||||
typedef IVoidHookChainRegistry<class CBasePlayer *, int, int, BOOL, char *> IReGameHookRegistry_ShowMenu;
|
||||
|
||||
// ShowVGUIMenu hook
|
||||
typedef IVoidHookChain<class CBasePlayer *, int, int, char *> IReGameHook_ShowVGUIMenu;
|
||||
typedef IVoidHookChainRegistry<class CBasePlayer *, int, int, char *> IReGameHookRegistry_ShowVGUIMenu;
|
||||
|
||||
// CHalfLifeMultiplay::FShouldSwitchWeapon hook
|
||||
typedef IHookChain<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHook_CSGameRules_FShouldSwitchWeapon;
|
||||
typedef IHookChainRegistry<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon;
|
||||
@ -336,6 +344,8 @@ public:
|
||||
virtual IReGameHookRegistry_PM_AirMove* PM_AirMove() = 0;
|
||||
virtual IReGameHookRegistry_HandleMenu_ChooseAppearance* HandleMenu_ChooseAppearance() = 0;
|
||||
virtual IReGameHookRegistry_HandleMenu_ChooseTeam* HandleMenu_ChooseTeam() = 0;
|
||||
virtual IReGameHookRegistry_ShowMenu* ShowMenu() = 0;
|
||||
virtual IReGameHookRegistry_ShowVGUIMenu* ShowVGUIMenu() = 0;
|
||||
|
||||
virtual IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon* CSGameRules_FShouldSwitchWeapon() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_GetNextBestWeapon* CSGameRules_GetNextBestWeapon() = 0;
|
||||
|
@ -202,6 +202,14 @@ typedef IVoidHookChainRegistry<class CBasePlayer *, int> IReGameHookRegistry_Han
|
||||
typedef IHookChain<BOOL, class CBasePlayer *, int> IReGameHook_HandleMenu_ChooseTeam;
|
||||
typedef IHookChainRegistry<BOOL, class CBasePlayer *, int> IReGameHookRegistry_HandleMenu_ChooseTeam;
|
||||
|
||||
// ShowMenu hook
|
||||
typedef IVoidHookChain<class CBasePlayer *, int, int, BOOL, char *> IReGameHook_ShowMenu;
|
||||
typedef IVoidHookChainRegistry<class CBasePlayer *, int, int, BOOL, char *> IReGameHookRegistry_ShowMenu;
|
||||
|
||||
// ShowVGUIMenu hook
|
||||
typedef IVoidHookChain<class CBasePlayer *, int, int, char *> IReGameHook_ShowVGUIMenu;
|
||||
typedef IVoidHookChainRegistry<class CBasePlayer *, int, int, char *> IReGameHookRegistry_ShowVGUIMenu;
|
||||
|
||||
// CHalfLifeMultiplay::FShouldSwitchWeapon hook
|
||||
typedef IHookChain<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHook_CSGameRules_FShouldSwitchWeapon;
|
||||
typedef IHookChainRegistry<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon;
|
||||
@ -336,6 +344,8 @@ public:
|
||||
virtual IReGameHookRegistry_PM_AirMove* PM_AirMove() = 0;
|
||||
virtual IReGameHookRegistry_HandleMenu_ChooseAppearance* HandleMenu_ChooseAppearance() = 0;
|
||||
virtual IReGameHookRegistry_HandleMenu_ChooseTeam* HandleMenu_ChooseTeam() = 0;
|
||||
virtual IReGameHookRegistry_ShowMenu* ShowMenu() = 0;
|
||||
virtual IReGameHookRegistry_ShowVGUIMenu* ShowVGUIMenu() = 0;
|
||||
|
||||
virtual IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon* CSGameRules_FShouldSwitchWeapon() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_GetNextBestWeapon* CSGameRules_GetNextBestWeapon() = 0;
|
||||
|
@ -93,6 +93,8 @@ IReGameHookRegistry_PM_Move* CReGameHookchains::PM_Move() { return &m_PM_Move; }
|
||||
IReGameHookRegistry_PM_AirMove* CReGameHookchains::PM_AirMove() { return &m_PM_AirMove; }
|
||||
IReGameHookRegistry_HandleMenu_ChooseAppearance* CReGameHookchains::HandleMenu_ChooseAppearance() { return &m_HandleMenu_ChooseAppearance; }
|
||||
IReGameHookRegistry_HandleMenu_ChooseTeam* CReGameHookchains::HandleMenu_ChooseTeam() { return &m_HandleMenu_ChooseTeam; }
|
||||
IReGameHookRegistry_ShowMenu* CReGameHookchains::ShowMenu() { return &m_ShowMenu; }
|
||||
IReGameHookRegistry_ShowVGUIMenu* CReGameHookchains::ShowVGUIMenu() { return &m_ShowVGUIMenu; }
|
||||
|
||||
IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon* CReGameHookchains::CSGameRules_FShouldSwitchWeapon() { return &m_CSGameRules_FShouldSwitchWeapon; }
|
||||
IReGameHookRegistry_CSGameRules_GetNextBestWeapon* CReGameHookchains::CSGameRules_GetNextBestWeapon() { return &m_CSGameRules_GetNextBestWeapon; }
|
||||
|
@ -196,6 +196,14 @@ typedef IVoidHookChainRegistryImpl<CBasePlayer *, int> CReGameHookRegistry_Handl
|
||||
typedef IHookChainImpl<BOOL, CBasePlayer *, int> CReGameHook_HandleMenu_ChooseTeam;
|
||||
typedef IHookChainRegistryImpl<BOOL, CBasePlayer *, int> CReGameHookRegistry_HandleMenu_ChooseTeam;
|
||||
|
||||
// ShowMenu hook
|
||||
typedef IVoidHookChainImpl<CBasePlayer *, int, int, BOOL, char *> CReGameHook_ShowMenu;
|
||||
typedef IVoidHookChainRegistryImpl<CBasePlayer *, int, int, BOOL, char *> CReGameHookRegistry_ShowMenu;
|
||||
|
||||
// ShowVGUIMenu hook
|
||||
typedef IVoidHookChainImpl<CBasePlayer *, int, int, char *> CReGameHook_ShowVGUIMenu;
|
||||
typedef IVoidHookChainRegistryImpl<CBasePlayer *, int, int, char *> CReGameHookRegistry_ShowVGUIMenu;
|
||||
|
||||
// CHalfLifeMultiplay::FShouldSwitchWeapon hook
|
||||
typedef IHookChainClassImpl<BOOL, class CHalfLifeMultiplay, CBasePlayer *, CBasePlayerItem *> CReGameHook_CSGameRules_FShouldSwitchWeapon;
|
||||
typedef IHookChainRegistryClassEmptyImpl<BOOL, class CHalfLifeMultiplay, CBasePlayer *, CBasePlayerItem *> CReGameHookRegistry_CSGameRules_FShouldSwitchWeapon;
|
||||
@ -330,6 +338,8 @@ public:
|
||||
CReGameHookRegistry_PM_AirMove m_PM_AirMove;
|
||||
CReGameHookRegistry_HandleMenu_ChooseAppearance m_HandleMenu_ChooseAppearance;
|
||||
CReGameHookRegistry_HandleMenu_ChooseTeam m_HandleMenu_ChooseTeam;
|
||||
CReGameHookRegistry_ShowMenu m_ShowMenu;
|
||||
CReGameHookRegistry_ShowVGUIMenu m_ShowVGUIMenu;
|
||||
|
||||
CReGameHookRegistry_CSGameRules_FShouldSwitchWeapon m_CSGameRules_FShouldSwitchWeapon;
|
||||
CReGameHookRegistry_CSGameRules_GetNextBestWeapon m_CSGameRules_GetNextBestWeapon;
|
||||
@ -398,6 +408,8 @@ public:
|
||||
virtual IReGameHookRegistry_PM_AirMove* PM_AirMove();
|
||||
virtual IReGameHookRegistry_HandleMenu_ChooseAppearance* HandleMenu_ChooseAppearance();
|
||||
virtual IReGameHookRegistry_HandleMenu_ChooseTeam* HandleMenu_ChooseTeam();
|
||||
virtual IReGameHookRegistry_ShowMenu* ShowMenu();
|
||||
virtual IReGameHookRegistry_ShowVGUIMenu* ShowVGUIMenu();
|
||||
|
||||
virtual IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon* CSGameRules_FShouldSwitchWeapon();
|
||||
virtual IReGameHookRegistry_CSGameRules_GetNextBestWeapon* CSGameRules_GetNextBestWeapon();
|
||||
|
Loading…
Reference in New Issue
Block a user