diff --git a/regamedll/dlls/animation.cpp b/regamedll/dlls/animation.cpp index 26c917b4..5ae3c8fa 100644 --- a/regamedll/dlls/animation.cpp +++ b/regamedll/dlls/animation.cpp @@ -1002,7 +1002,7 @@ void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t int chain[MAXSTUDIOBONES]; int chainlength; vec3_t temp_angles; - + /*static */float pos[MAXSTUDIOBONES][3], pos2[MAXSTUDIOBONES][3]; /*static */float q[MAXSTUDIOBONES][4], q2[MAXSTUDIOBONES][4]; @@ -1037,7 +1037,7 @@ void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t f = StudioEstimateFrame(frame, pseqdesc); subframe = int(f); f -= subframe; - + StudioCalcBoneAdj(0, adj, pcontroller, pcontroller, 0); StudioCalcRotations(pbones, chain, chainlength, adj, pos, q, pseqdesc, panim, subframe, f); @@ -1046,7 +1046,7 @@ void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t if (pseqdesc->numblends > 1) { float b = float_precision(pblending[0]) / 255.0f; - + pseqdesc = (mstudioseqdesc_t *)((byte *)g_pstudiohdr + g_pstudiohdr->seqindex) + sequence; panim = StudioGetAnim(pModel, pseqdesc); panim += g_pstudiohdr->numbones; @@ -1060,7 +1060,7 @@ void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t { /*static */float pos3[MAXSTUDIOBONES][3], pos4[MAXSTUDIOBONES][3]; /*static */float q3[MAXSTUDIOBONES][4], q4[MAXSTUDIOBONES][4]; - + float_precision s, t; s = GetPlayerYaw(pEdict); diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index 64076629..82d305bc 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -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) { diff --git a/regamedll/dlls/client.h b/regamedll/dlls/client.h index 39ca83c9..7f933c90 100644 --- a/regamedll/dlls/client.h +++ b/regamedll/dlls/client.h @@ -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(); diff --git a/regamedll/dlls/gamerules.h b/regamedll/dlls/gamerules.h index 08a87cd5..3a71571b 100644 --- a/regamedll/dlls/gamerules.h +++ b/regamedll/dlls/gamerules.h @@ -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(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(); diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index b4fe18a2..d3a2221a 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -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"); diff --git a/regamedll/dlls/player.h b/regamedll/dlls/player.h index d68b3c14..3ccb185f 100644 --- a/regamedll/dlls/player.h +++ b/regamedll/dlls/player.h @@ -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 diff --git a/regamedll/extra/cssdk/dlls/regamedll_api.h b/regamedll/extra/cssdk/dlls/regamedll_api.h index 4a9ec9c9..70632062 100644 --- a/regamedll/extra/cssdk/dlls/regamedll_api.h +++ b/regamedll/extra/cssdk/dlls/regamedll_api.h @@ -202,6 +202,14 @@ typedef IVoidHookChainRegistry IReGameHookRegistry_Han typedef IHookChain IReGameHook_HandleMenu_ChooseTeam; typedef IHookChainRegistry IReGameHookRegistry_HandleMenu_ChooseTeam; +// ShowMenu hook +typedef IVoidHookChain IReGameHook_ShowMenu; +typedef IVoidHookChainRegistry IReGameHookRegistry_ShowMenu; + +// ShowVGUIMenu hook +typedef IVoidHookChain IReGameHook_ShowVGUIMenu; +typedef IVoidHookChainRegistry IReGameHookRegistry_ShowVGUIMenu; + // CHalfLifeMultiplay::FShouldSwitchWeapon hook typedef IHookChain IReGameHook_CSGameRules_FShouldSwitchWeapon; typedef IHookChainRegistry 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; diff --git a/regamedll/public/regamedll/regamedll_api.h b/regamedll/public/regamedll/regamedll_api.h index 4a9ec9c9..70632062 100644 --- a/regamedll/public/regamedll/regamedll_api.h +++ b/regamedll/public/regamedll/regamedll_api.h @@ -202,6 +202,14 @@ typedef IVoidHookChainRegistry IReGameHookRegistry_Han typedef IHookChain IReGameHook_HandleMenu_ChooseTeam; typedef IHookChainRegistry IReGameHookRegistry_HandleMenu_ChooseTeam; +// ShowMenu hook +typedef IVoidHookChain IReGameHook_ShowMenu; +typedef IVoidHookChainRegistry IReGameHookRegistry_ShowMenu; + +// ShowVGUIMenu hook +typedef IVoidHookChain IReGameHook_ShowVGUIMenu; +typedef IVoidHookChainRegistry IReGameHookRegistry_ShowVGUIMenu; + // CHalfLifeMultiplay::FShouldSwitchWeapon hook typedef IHookChain IReGameHook_CSGameRules_FShouldSwitchWeapon; typedef IHookChainRegistry 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; diff --git a/regamedll/regamedll/regamedll_api_impl.cpp b/regamedll/regamedll/regamedll_api_impl.cpp index b6a32a2c..b1120ad8 100644 --- a/regamedll/regamedll/regamedll_api_impl.cpp +++ b/regamedll/regamedll/regamedll_api_impl.cpp @@ -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; } diff --git a/regamedll/regamedll/regamedll_api_impl.h b/regamedll/regamedll/regamedll_api_impl.h index 885a9ebc..c0cd8dac 100644 --- a/regamedll/regamedll/regamedll_api_impl.h +++ b/regamedll/regamedll/regamedll_api_impl.h @@ -196,6 +196,14 @@ typedef IVoidHookChainRegistryImpl CReGameHookRegistry_Handl typedef IHookChainImpl CReGameHook_HandleMenu_ChooseTeam; typedef IHookChainRegistryImpl CReGameHookRegistry_HandleMenu_ChooseTeam; +// ShowMenu hook +typedef IVoidHookChainImpl CReGameHook_ShowMenu; +typedef IVoidHookChainRegistryImpl CReGameHookRegistry_ShowMenu; + +// ShowVGUIMenu hook +typedef IVoidHookChainImpl CReGameHook_ShowVGUIMenu; +typedef IVoidHookChainRegistryImpl CReGameHookRegistry_ShowVGUIMenu; + // CHalfLifeMultiplay::FShouldSwitchWeapon hook typedef IHookChainClassImpl CReGameHook_CSGameRules_FShouldSwitchWeapon; typedef IHookChainRegistryClassEmptyImpl 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();