From e6df6ef5779c9641b8e37c0f332e6605183847e8 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Wed, 8 Jun 2016 04:41:07 +0700 Subject: [PATCH] Added cvar mp_refill_bpammo_weapons Added new things for API Update README.md --- README.md | 18 ++-- dist/game.cfg | 14 ++- regamedll/dlls/bot/states/cs_bot_buy.cpp | 2 +- regamedll/dlls/game.cpp | 4 +- regamedll/dlls/game.h | 1 + regamedll/dlls/gamerules.h | 58 ++++++++++-- regamedll/dlls/hostage/hostage.cpp | 2 +- regamedll/dlls/multiplay_gamerules.cpp | 91 ++++++++++++------- regamedll/dlls/player.cpp | 43 +++++---- regamedll/dlls/player.h | 2 +- regamedll/dlls/weapons.cpp | 21 ++++- regamedll/dlls/weapons.h | 2 +- regamedll/dlls/wpn_shared/wpn_usp.cpp | 2 +- regamedll/extra/cssdk/dlls/gamerules.h | 44 +++++++++ regamedll/extra/cssdk/dlls/hookchains.h | 4 +- regamedll/extra/cssdk/dlls/regamedll_api.h | 5 - regamedll/hookers/6153_hooker.cpp | 2 +- regamedll/msvc/ReGameDLL.vcxproj | 2 +- regamedll/public/regamedll/hookchains.h | 4 +- regamedll/public/regamedll/regamedll_api.h | 11 +-- .../public/regamedll/regamedll_interfaces.h | 6 +- regamedll/regamedll/hookchains_impl.h | 4 +- regamedll/regamedll/regamedll_api_impl.cpp | 3 - regamedll/regamedll/regamedll_api_impl.h | 9 +- .../regamedll/regamedll_interfaces_impl.cpp | 6 +- 25 files changed, 244 insertions(+), 116 deletions(-) diff --git a/README.md b/README.md index 327b51d0..f3477dc3 100644 --- a/README.md +++ b/README.md @@ -4,15 +4,13 @@ Reverse-engineered gamedll (mp.dll / Counter-Strike) ## What is this? Regamedll_CS is a result of reverse engineering of original library mods HLDS (build 6153beta) using DWARF debug info embedded into linux version of HLDS, cs.so -At the moment, the work of reverse engineering continues - ## Goals of the project * Provide more stable (than official) version of Counter-Strike game with extended API for mods and plugins ## How can use it? Regamedll_CS is fully compatible with official mod CS 1.6 by Valve. All you have to do is to download binaries and replace original mo.dll/cs.so -Compiled binaries are available here: http://nexus.rehlds.org/nexus/content/repositories/regamedll-snapshots/regamedll/regamedll/0.2-SNAPSHOT/ +Compiled binaries are available here: [link](http://nexus.rehlds.org/nexus/content/repositories/regamedll-snapshots/regamedll/regamedll/0.2-SNAPSHOT/) Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure' * 'pure' version is designed to work exactly as official mod CS @@ -20,9 +18,17 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure' Warning! Regamedll_CS is not binary compatible with original hlds since it's compiled with compilers other than ones used for original mod CS. This means that plugins that do binary code analysis (Orpheu for example) probably will not work with Regamedll_CS. -## Current status -* Counter-Strike 1.6 - 100% -* Counter-Strike: Condition Zero - 100% +## Configuration (cvars) +| CVar | Default | Min | Max | Description | +| :---------------------------- | :-----: | :-: | :----------: | :--------------------------------------------- | +| mp_friendlyfire | 0 | 0 | 2 | Allow inflict damage to teammates
`0` disabled
`1` enabled
`2` FFA mode | +| mp_maxmoney | 16000 | 0 | `0x7FFFFFFF` | The maximum allowable amount of money in the game +| mp_round_infinite | 0 | 0 | 1 | Flags for fine grained control (choose as many as needed)
`0` disabled
`1` enabled

or flags
`a` block round time round end check
`b` block needed players round end check
`c` block VIP assassination/success round end check
`d` block prison escape round end check
`e` block bomb round end check
`f` block team extermination round end check
`g` block hostage rescue round end check

`Example setting:` "ae" blocks round time and bomb round end checks | +| mp_hegrenade_penetration | 0 | 0 | 1 | Disable grenade damage through walls
`0` disabled
`1` enabled | +| mp_nadedrops | 0 | 0 | 2 | Drop a grenade after player death
`0` disabled
`1` drop one the grenade
`2` drop a everyone grenades | +| mp_roundrespawn_time | 20 | 0 | - | Player cannot respawn until next round if more than N seconds has elapsed since the beginning round | +| mp_auto_reload_weapons | 0 | 0 | 1 | Automatically reload each weapon on player spawn
`0` disabled
`1` enabled | +| mp_refill_bpammo_weapons | 0 | 0 | 2 | Refill amount of backpack ammo up to the max
`0` disabled
`1` refill backpack ammo on player spawn
`2` refill backpack ammo on each weapon reload | ## How to install zBot for CS 1.6? * Extract all the files from an [archive](regamedll/extra/zBot/bot_profiles.zip?raw=true) diff --git a/dist/game.cfg b/dist/game.cfg index 83589ac1..65acb179 100644 --- a/dist/game.cfg +++ b/dist/game.cfg @@ -39,8 +39,8 @@ mp_hegrenade_penetration 0 // Drop a grenade after player death // 0 - disabled -// 1 - enabled (only the first slot grenades) -// 2 - drop a everyone +// 1 - drop one the grenade +// 2 - drop a everyone grenades // Default value: "0" mp_nadedrops 0 @@ -50,9 +50,17 @@ mp_nadedrops 0 // Default value: "20" mp_roundrespawn_time 20 -// Automatically reloaded all weapons a spawn the player +// Automatically reload each weapon on player spawn // 0 - disabled (default behaviour) // 1 - enabled // // Default value: "0" mp_auto_reload_weapons "0" + +// Refill amount of backpack ammo up to the max +// 0 - disabled (default behaviour) +// 1 - refill backpack ammo on player spawn +// 2 - refill backpack ammo on each weapon reload (NOTE: Useful for mods like DeathMatch, GunGame, ZombieMod etc.) +// +// Default value: "0" +mp_refill_bpammo_weapons 0 diff --git a/regamedll/dlls/bot/states/cs_bot_buy.cpp b/regamedll/dlls/bot/states/cs_bot_buy.cpp index e1442c5f..4a50de48 100644 --- a/regamedll/dlls/bot/states/cs_bot_buy.cpp +++ b/regamedll/dlls/bot/states/cs_bot_buy.cpp @@ -261,7 +261,7 @@ void BuyState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) if (!(me->m_signals.GetState() & SIGNAL_BUY)) { m_doneBuying = true; - UTIL_DPrintf("%s bot spawned outside of a buy zone (%d, %d, %d)\n", (me->m_iTeam == CT) ? "CT" : "Terrorist", me->pev->origin.x, me->pev->origin.y, me->pev->origin.z); + UTIL_DPrintf("%s bot spawned outside of a buy zone (%d, %d, %d)\n", (me->m_iTeam == CT) ? "CT" : "Terrorist", int(me->pev->origin.x), int(me->pev->origin.y), int(me->pev->origin.z)); return; } diff --git a/regamedll/dlls/game.cpp b/regamedll/dlls/game.cpp index 463c976d..5383441f 100644 --- a/regamedll/dlls/game.cpp +++ b/regamedll/dlls/game.cpp @@ -102,6 +102,7 @@ cvar_t hegrenade_penetration = { "mp_hegrenade_penetration", "0", 0, 0.0f, nullp cvar_t nadedrops = { "mp_nadedrops", "0", 0, 0.0f, nullptr }; cvar_t roundrespawn_time = { "mp_roundrespawn_time", "20", 0, 20.0f, nullptr }; cvar_t auto_reload_weapons = { "mp_auto_reload_weapons", "0", 0, 0.0f, nullptr }; +cvar_t refill_bpammo_weapons = { "mp_refill_bpammo_weapons", "0", 0, 0.0f, nullptr }; // Useful for mods like CSDM, GunGame, ZombieMod etc void GameDLL_Version_f() { @@ -116,7 +117,7 @@ void GameDLL_Version_f() void GameDLL_EndRound_f() { - EndRoundMessage("#Round_Draw", ROUND_END_DRAW); + CSGameRules()->EndRoundMessage("#Round_Draw", ROUND_END_DRAW); Broadcast("rounddraw"); CSGameRules()->TerminateRound(5, WINSTATUS_DRAW); } @@ -230,6 +231,7 @@ void EXT_FUNC GameDLLInit() CVAR_REGISTER(&nadedrops); CVAR_REGISTER(&roundrespawn_time); CVAR_REGISTER(&auto_reload_weapons); + CVAR_REGISTER(&refill_bpammo_weapons); // print version CONSOLE_ECHO("ReGameDLL build: " __TIME__ " " __DATE__ " (" APP_VERSION_STRD ")\n"); diff --git a/regamedll/dlls/game.h b/regamedll/dlls/game.h index 31aa5f70..b0620660 100644 --- a/regamedll/dlls/game.h +++ b/regamedll/dlls/game.h @@ -139,6 +139,7 @@ extern cvar_t hegrenade_penetration; extern cvar_t nadedrops; extern cvar_t roundrespawn_time; extern cvar_t auto_reload_weapons; +extern cvar_t refill_bpammo_weapons; #endif diff --git a/regamedll/dlls/gamerules.h b/regamedll/dlls/gamerules.h index 4f5c9dcb..7f70d65c 100644 --- a/regamedll/dlls/gamerules.h +++ b/regamedll/dlls/gamerules.h @@ -96,6 +96,33 @@ enum ScenarioEventEndRound ROUND_GAME_COMMENCE, }; +enum RewardRules +{ + RR_CTS_WIN, + RR_TERRORISTS_WIN, + RR_TARGET_BOMB, + RR_VIP_ESCAPED, + RR_VIP_ASSASSINATED, + RR_TERRORISTS_ESCAPED, + RR_CTS_PREVENT_ESCAPE, + RR_ESCAPING_TERRORISTS_NEUTRALIZED, + RR_BOMB_DEFUSED, + RR_BOMB_PLANTED, + RR_BOMB_EXPLODED, + RR_ALL_HOSTAGES_RESCUED, + RR_TARGET_BOMB_SAVED, + RR_HOSTAGE_NOT_RESCUED, + RR_VIP_NOT_ESCAPED, + RR_LOSER_BONUS_DEFAULT, + RR_LOSER_BONUS_MIN, + RR_LOSER_BONUS_MAX, + RR_LOSER_BONUS_ADD, + RR_RESCUED_HOSTAGE, + RR_TOOK_HOSTAGE_ACC, + RR_TOOK_HOSTAGE, + RR_END +}; + // custom enum enum RewardAccount { @@ -129,8 +156,8 @@ enum RewardAccount REWARD_VIP_HAVE_SELF_RESCUED = 2500, REWARD_TAKEN_HOSTAGE = 1000, - REWARD_TOOK_HOSTAGE = 150 - + REWARD_TOOK_HOSTAGE_ACC = 100, + REWARD_TOOK_HOSTAGE = 150, }; // custom enum @@ -363,6 +390,12 @@ public: #endif // HOOK_GAMEDLL }; +#if defined(REGAMEDLL_ADD) && !defined(HOOK_GAMEDLL) +#define VFUNC virtual +#else +#define VFUNC +#endif + class CHalfLifeMultiplay: public CGameRules { public: @@ -507,7 +540,7 @@ public: bool NeededPlayersCheck(); // Setup counts for m_iNumTerrorist, m_iNumCT, m_iNumSpawnableTerrorist, m_iNumSpawnableCT, etc. - void InitializePlayerCounts(int &NumAliveTerrorist, int &NumAliveCT, int &NumDeadTerrorist, int &NumDeadCT); + VFUNC void InitializePlayerCounts(int &NumAliveTerrorist, int &NumAliveCT, int &NumDeadTerrorist, int &NumDeadCT); // Check to see if the round is over for the various game types. Terminates the round // and returns true if the round should end. @@ -574,18 +607,21 @@ public: void StackVIPQueue(); void ResetCurrentVIP(); - void BalanceTeams(); + VFUNC void BalanceTeams(); void BalanceTeams_(); - void SwapAllPlayers(); - void UpdateTeamScores(); + VFUNC void SwapAllPlayers(); + VFUNC void UpdateTeamScores(); + VFUNC void EndRoundMessage(const char *sentence, int event); + VFUNC void SetAccountRules(RewardRules rules, int amount) { m_rgRewardAccountRules[rules] = static_cast(amount); } + void DisplayMaps(CBasePlayer *player, int iVote); void ResetAllMapVotes(); void ProcessMapVote(CBasePlayer *player, int iVote); // BOMB MAP FUNCTIONS - BOOL IsThereABomber(); - BOOL IsThereABomb(); + VFUNC BOOL IsThereABomber(); + VFUNC BOOL IsThereABomb(); bool IsMatchStarted() { return (m_fTeamCount != 0.0f || m_fCareerRoundMenuTime != 0.0f || m_fCareerMatchMenuTime != 0.0f); } void SendMOTDToClient(edict_t *client); @@ -598,11 +634,13 @@ public: bool HasRoundInfinite(bool time_expired = false) const; private: - bool HasRoundTimeExpired(); - bool IsBombPlanted(); + VFUNC bool HasRoundTimeExpired(); + VFUNC bool IsBombPlanted(); void MarkLivingPlayersOnTeamAsNotReceivingMoneyNextRound(int iTeam); public: + static RewardAccount m_rgRewardAccountRules[]; + CVoiceGameMgr m_VoiceGameMgr; float m_fTeamCount; // m_flRestartRoundTime, the global time when the round is supposed to end, if this is not 0 float m_flCheckWinConditions; diff --git a/regamedll/dlls/hostage/hostage.cpp b/regamedll/dlls/hostage/hostage.cpp index 945997e5..e468cc5e 100644 --- a/regamedll/dlls/hostage/hostage.cpp +++ b/regamedll/dlls/hostage/hostage.cpp @@ -910,7 +910,7 @@ void CHostage::GiveCTTouchBonus(CBasePlayer *pPlayer) return; m_bTouched = TRUE; - CSGameRules()->m_iAccountCT += 100; + CSGameRules()->m_iAccountCT += CSGameRules()->m_rgRewardAccountRules[RR_TOOK_HOSTAGE_ACC]; pPlayer->AddAccount(REWARD_TOOK_HOSTAGE, RT_HOSTAGE_TOOK); UTIL_LogPrintf("\"%s<%i><%s>\" triggered \"Touched_A_Hostage\"\n", STRING(pPlayer->pev->netname), GETPLAYERUSERID(pPlayer->edict()), GETPLAYERAUTHID(pPlayer->edict())); diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index 471114ef..c6577316 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -11,7 +11,31 @@ cvar_t *sv_clienttrace = NULL; #endif CCStrikeGameMgrHelper g_GameMgrHelper; -CHalfLifeMultiplay *g_pMPGameRules = NULL; +CHalfLifeMultiplay *g_pMPGameRules = nullptr; +RewardAccount CHalfLifeMultiplay::m_rgRewardAccountRules[] = { + REWARD_CTS_WIN, // RR_CTS_WIN + REWARD_TERRORISTS_WIN, // RR_TERRORISTS_WIN + REWARD_TARGET_BOMB, // RR_TARGET_BOMB + REWARD_VIP_ESCAPED, // RR_VIP_ESCAPED + REWARD_VIP_ASSASSINATED, // RR_VIP_ASSASSINATED + REWARD_TERRORISTS_ESCAPED, // RR_TERRORISTS_ESCAPED + REWARD_CTS_PREVENT_ESCAPE, // RR_CTS_PREVENT_ESCAPE + REWARD_ESCAPING_TERRORISTS_NEUTRALIZED, // RR_ESCAPING_TERRORISTS_NEUTRALIZED + REWARD_BOMB_DEFUSED, // RR_BOMB_DEFUSED + REWARD_BOMB_PLANTED, // RR_BOMB_PLANTED + REWARD_BOMB_EXPLODED, // RR_BOMB_EXPLODED + REWARD_ALL_HOSTAGES_RESCUED, // RR_ALL_HOSTAGES_RESCUED + REWARD_TARGET_BOMB_SAVED, // RR_TARGET_BOMB_SAVED + REWARD_HOSTAGE_NOT_RESCUED, // RR_HOSTAGE_NOT_RESCUED + REWARD_VIP_NOT_ESCAPED, // RR_VIP_NOT_ESCAPED + REWARD_LOSER_BONUS_DEFAULT, // RR_LOSER_BONUS_DEFAULT + REWARD_LOSER_BONUS_MIN, // RR_LOSER_BONUS_MIN + REWARD_LOSER_BONUS_MAX, // RR_LOSER_BONUS_MAX + REWARD_LOSER_BONUS_ADD, // RR_LOSER_BONUS_ADD + REWARD_RESCUED_HOSTAGE, // RR_RESCUED_HOSTAGE + REWARD_TOOK_HOSTAGE_ACC, // RR_TOOK_HOSTAGE_ACC + REWARD_TOOK_HOSTAGE, // RR_TOOK_HOSTAGE +}; bool IsBotSpeaking() { @@ -260,7 +284,7 @@ char *GetTeam(int teamNo) return ""; } -void EXT_FUNC EndRoundMessage(const char *sentence, int event) +void CHalfLifeMultiplay::EndRoundMessage(const char *sentence, int event) { char *team = NULL; const char *message = &(sentence[1]); @@ -308,16 +332,13 @@ void EXT_FUNC EndRoundMessage(const char *sentence, int event) break; } - if (CSGameRules() != NULL) + if (bTeamTriggered) { - if (bTeamTriggered) - { - UTIL_LogPrintf("Team \"%s\" triggered \"%s\" (CT \"%i\") (T \"%i\")\n", team, message, CSGameRules()->m_iNumCTWins, CSGameRules()->m_iNumTerroristWins); - } - else - { - UTIL_LogPrintf("World triggered \"%s\" (CT \"%i\") (T \"%i\")\n", message, CSGameRules()->m_iNumCTWins, CSGameRules()->m_iNumTerroristWins); - } + UTIL_LogPrintf("Team \"%s\" triggered \"%s\" (CT \"%i\") (T \"%i\")\n", team, message, m_iNumCTWins, m_iNumTerroristWins); + } + else + { + UTIL_LogPrintf("World triggered \"%s\" (CT \"%i\") (T \"%i\")\n", message, m_iNumCTWins, m_iNumTerroristWins); } UTIL_LogPrintf("World triggered \"Round_End\"\n"); @@ -429,7 +450,7 @@ CHalfLifeMultiplay::CHalfLifeMultiplay() m_bMapHasCameras = MAP_HAS_CAMERAS_INIT; g_fGameOver = FALSE; - m_iLoserBonus = REWARD_LOSER_BONUS_DEFAULT; + m_iLoserBonus = m_rgRewardAccountRules[RR_LOSER_BONUS_DEFAULT]; m_iNumConsecutiveCTLoses = 0; m_iNumConsecutiveTerroristLoses = 0; m_iC4Guy = 0; @@ -1148,7 +1169,7 @@ bool CHalfLifeMultiplay::NeededPlayersCheck() bool CHalfLifeMultiplay::VIP_Escaped_internal(int winStatus, ScenarioEventEndRound event, float tmDelay) { Broadcast("ctwin"); - m_iAccountCT += REWARD_VIP_ESCAPED; + m_iAccountCT += m_rgRewardAccountRules[RR_VIP_ESCAPED]; if (!m_bNeededPlayers) { @@ -1185,7 +1206,7 @@ bool CHalfLifeMultiplay::VIP_Escaped_internal(int winStatus, ScenarioEventEndRou bool CHalfLifeMultiplay::VIP_Died_internal(int winStatus, ScenarioEventEndRound event, float tmDelay) { Broadcast("terwin"); - m_iAccountTerrorist += REWARD_VIP_ASSASSINATED; + m_iAccountTerrorist += m_rgRewardAccountRules[RR_VIP_ASSASSINATED]; if (!m_bNeededPlayers) { @@ -1233,7 +1254,7 @@ bool CHalfLifeMultiplay::VIPRoundEndCheck() bool CHalfLifeMultiplay::Prison_Escaped_internal(int winStatus, ScenarioEventEndRound event, float tmDelay) { Broadcast("terwin"); - m_iAccountTerrorist += REWARD_TERRORISTS_ESCAPED; + m_iAccountTerrorist += m_rgRewardAccountRules[RR_TERRORISTS_ESCAPED]; if (!m_bNeededPlayers) { @@ -1257,7 +1278,7 @@ bool CHalfLifeMultiplay::Prison_PreventEscape_internal(int winStatus, ScenarioEv Broadcast("ctwin"); // CTs are rewarded based on how many terrorists have escaped... - m_iAccountCT += (1 - m_flEscapeRatio) * REWARD_CTS_PREVENT_ESCAPE; + m_iAccountCT += (1 - m_flEscapeRatio) * m_rgRewardAccountRules[RR_CTS_PREVENT_ESCAPE]; if (!m_bNeededPlayers) { @@ -1281,7 +1302,7 @@ bool CHalfLifeMultiplay::Prison_Neutralized_internal(int winStatus, ScenarioEven Broadcast("ctwin"); // CTs are rewarded based on how many terrorists have escaped... - m_iAccountCT += (1 - m_flEscapeRatio) * REWARD_ESCAPING_TERRORISTS_NEUTRALIZED; + m_iAccountCT += (1 - m_flEscapeRatio) * m_rgRewardAccountRules[RR_ESCAPING_TERRORISTS_NEUTRALIZED]; if (!m_bNeededPlayers) { @@ -1329,7 +1350,7 @@ bool CHalfLifeMultiplay::PrisonRoundEndCheck(int NumAliveTerrorist, int NumAlive bool CHalfLifeMultiplay::Target_Bombed_internal(int winStatus, ScenarioEventEndRound event, float tmDelay) { Broadcast("terwin"); - m_iAccountTerrorist += REWARD_TARGET_BOMB; + m_iAccountTerrorist += m_rgRewardAccountRules[RR_TARGET_BOMB]; if (!m_bNeededPlayers) { @@ -1352,8 +1373,8 @@ bool CHalfLifeMultiplay::Target_Bombed_internal(int winStatus, ScenarioEventEndR bool CHalfLifeMultiplay::Target_Defused_internal(int winStatus, ScenarioEventEndRound event, float tmDelay) { Broadcast("ctwin"); - m_iAccountCT += REWARD_BOMB_DEFUSED; - m_iAccountTerrorist += REWARD_BOMB_PLANTED; + m_iAccountCT += m_rgRewardAccountRules[RR_BOMB_DEFUSED]; + m_iAccountTerrorist += m_rgRewardAccountRules[RR_BOMB_PLANTED]; if (!m_bNeededPlayers) { @@ -1391,7 +1412,7 @@ bool CHalfLifeMultiplay::BombRoundEndCheck() bool CHalfLifeMultiplay::Round_Cts_internal(int winStatus, ScenarioEventEndRound event, float tmDelay) { Broadcast("ctwin"); - m_iAccountCT += m_bMapHasBombTarget ? REWARD_BOMB_DEFUSED : REWARD_CTS_WIN; + m_iAccountCT += m_rgRewardAccountRules[m_bMapHasBombTarget ? RR_BOMB_DEFUSED : RR_CTS_WIN]; if (!m_bNeededPlayers) { @@ -1414,7 +1435,7 @@ bool CHalfLifeMultiplay::Round_Cts_internal(int winStatus, ScenarioEventEndRound bool CHalfLifeMultiplay::Round_Ts_internal(int winStatus, ScenarioEventEndRound event, float tmDelay) { Broadcast("terwin"); - m_iAccountTerrorist += m_bMapHasBombTarget ? REWARD_BOMB_EXPLODED : REWARD_TERRORISTS_WIN; + m_iAccountTerrorist += m_rgRewardAccountRules[m_bMapHasBombTarget ? RR_BOMB_EXPLODED : RR_TERRORISTS_WIN]; if (!m_bNeededPlayers) { @@ -1487,7 +1508,7 @@ bool CHalfLifeMultiplay::TeamExterminationCheck(int NumAliveTerrorist, int NumAl bool CHalfLifeMultiplay::Hostage_Rescue_internal(int winStatus, ScenarioEventEndRound event, float tmDelay) { Broadcast("ctwin"); - m_iAccountCT += REWARD_ALL_HOSTAGES_RESCUED; + m_iAccountCT += m_rgRewardAccountRules[RR_ALL_HOSTAGES_RESCUED]; if (!m_bNeededPlayers) { @@ -1925,7 +1946,7 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)() if (hostage->pev->solid != SOLID_NOT) { - acct_tmp += REWARD_TOOK_HOSTAGE; + acct_tmp += m_rgRewardAccountRules[RR_TOOK_HOSTAGE]; if (hostage->pev->deadflag == DEAD_DEAD) { @@ -1943,7 +1964,7 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)() if (m_iNumConsecutiveTerroristLoses > 1) { // this is the default losing bonus - m_iLoserBonus = REWARD_LOSER_BONUS_MIN; + m_iLoserBonus = m_rgRewardAccountRules[RR_LOSER_BONUS_MIN]; } m_iNumConsecutiveTerroristLoses = 0; // starting fresh @@ -1955,7 +1976,7 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)() if (m_iNumConsecutiveCTLoses > 1) { // this is the default losing bonus - m_iLoserBonus = REWARD_LOSER_BONUS_MIN; + m_iLoserBonus = m_rgRewardAccountRules[RR_LOSER_BONUS_MIN]; } m_iNumConsecutiveCTLoses = 0; // starting fresh @@ -1963,15 +1984,15 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)() } // check if the losing team is in a losing streak & that the loser bonus hasen't maxed out. - if (m_iNumConsecutiveTerroristLoses > 1 && m_iLoserBonus < REWARD_LOSER_BONUS_MAX) + if (m_iNumConsecutiveTerroristLoses > 1 && m_iLoserBonus < m_rgRewardAccountRules[RR_LOSER_BONUS_MAX]) { // help out the team in the losing streak - m_iLoserBonus += REWARD_LOSER_BONUS_ADD; + m_iLoserBonus += m_rgRewardAccountRules[RR_LOSER_BONUS_ADD]; } - else if (m_iNumConsecutiveCTLoses > 1 && m_iLoserBonus < REWARD_LOSER_BONUS_MAX) + else if (m_iNumConsecutiveCTLoses > 1 && m_iLoserBonus < m_rgRewardAccountRules[RR_LOSER_BONUS_MAX]) { // help out the team in the losing streak - m_iLoserBonus += REWARD_LOSER_BONUS_ADD; + m_iLoserBonus += m_rgRewardAccountRules[RR_LOSER_BONUS_ADD]; } // assign the wining and losing bonuses @@ -1992,7 +2013,7 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)() } // Update CT account based on number of hostages rescued - m_iAccountCT += m_iHostagesRescued * REWARD_RESCUED_HOSTAGE; + m_iAccountCT += m_iHostagesRescued * m_rgRewardAccountRules[RR_RESCUED_HOSTAGE]; // Update individual players accounts and respawn players @@ -2010,7 +2031,7 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)() m_iNumCTWins = 0; m_iNumConsecutiveTerroristLoses = 0; m_iNumConsecutiveCTLoses = 0; - m_iLoserBonus = REWARD_LOSER_BONUS_DEFAULT; + m_iLoserBonus = m_rgRewardAccountRules[RR_LOSER_BONUS_DEFAULT]; } // tell bots that the round is restarting @@ -2819,7 +2840,7 @@ void CHalfLifeMultiplay::CheckFreezePeriodExpired() bool CHalfLifeMultiplay::Target_Saved_internal(int winStatus, ScenarioEventEndRound event, float tmDelay) { Broadcast("ctwin"); - m_iAccountCT += REWARD_TARGET_BOMB_SAVED; + m_iAccountCT += m_rgRewardAccountRules[RR_TARGET_BOMB_SAVED]; m_iNumCTWins++; EndRoundMessage("#Target_Saved", event); @@ -2839,7 +2860,7 @@ bool CHalfLifeMultiplay::Target_Saved_internal(int winStatus, ScenarioEventEndRo bool CHalfLifeMultiplay::Hostage_NotRescued_internal(int winStatus, ScenarioEventEndRound event, float tmDelay) { Broadcast("terwin"); - m_iAccountTerrorist += REWARD_HOSTAGE_NOT_RESCUED; + m_iAccountTerrorist += m_rgRewardAccountRules[RR_HOSTAGE_NOT_RESCUED]; m_iNumTerroristWins++; EndRoundMessage("#Hostages_Not_Rescued", event); @@ -2875,7 +2896,7 @@ bool CHalfLifeMultiplay::Prison_NotEscaped_internal(int winStatus, ScenarioEvent bool CHalfLifeMultiplay::VIP_NotEscaped_internal(int winStatus, ScenarioEventEndRound event, float tmDelay) { Broadcast("terwin"); - m_iAccountTerrorist += REWARD_VIP_NOT_ESCAPED; + m_iAccountTerrorist += m_rgRewardAccountRules[RR_VIP_NOT_ESCAPED]; m_iNumTerroristWins++; EndRoundMessage("#VIP_Not_Escaped", event); diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 124f2c51..f11a4146 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -3125,23 +3125,17 @@ void CBasePlayer::__API_HOOK(AddAccount)(int amount, RewardType type, bool bTrac m_iAccount += amount; #ifndef REGAMEDLL_ADD - if (m_iAccount < 0) - m_iAccount = 0; - - else if (m_iAccount > 16000) + if (m_iAccount > 16000) m_iAccount = 16000; - #else - int mmoney = int(maxmoney.value); - - if (m_iAccount < 0) - m_iAccount = 0; - - else if (m_iAccount > mmoney) - m_iAccount = mmoney; - + auto nMax = int(maxmoney.value); + if (m_iAccount > nMax) + m_iAccount = nMax; #endif + else if (m_iAccount < 0) + m_iAccount = 0; + // Send money update to HUD MESSAGE_BEGIN(MSG_ONE, gmsgMoney, NULL, pev); WRITE_LONG(m_iAccount); @@ -5258,9 +5252,7 @@ void EXT_ALIGN CBasePlayer::__API_VHOOK(Spawn)() m_flFlashLightTime = 1; #ifdef REGAMEDLL_ADD - if (auto_reload_weapons.string[0] == '1') { - ReloadWeapons(); - } + ReloadWeapons(); #endif if (m_bHasDefuser) @@ -9244,8 +9236,15 @@ void CBasePlayer::UpdateLocation(bool forceUpdate) } } -void CBasePlayer::ReloadWeapons(CBasePlayerItem *pWeapon) +void CBasePlayer::ReloadWeapons(CBasePlayerItem *pWeapon, bool bForceReload, bool bForceRefill) { +#ifdef REGAMEDLL_ADD + bool bCanAutoReload = (bForceReload || auto_reload_weapons.value != 0.0f); + bool bCanRefillBPAmmo = (bForceRefill || refill_bpammo_weapons.value != 0.0f); + + if (!bCanAutoReload && !bCanRefillBPAmmo) + return; + // if we died in the previous round // so that we have nothing to reload if (!m_bNotKilled) @@ -9261,7 +9260,14 @@ void CBasePlayer::ReloadWeapons(CBasePlayerItem *pWeapon) while (item != nullptr) { if (pWeapon == nullptr || pWeapon == item) - ((CBasePlayerWeapon *)item)->InstantReload(); + { + if (bCanRefillBPAmmo) { + m_rgAmmo[ item->PrimaryAmmoIndex() ] = item->iMaxAmmo1(); + } + if (bCanAutoReload) { + ((CBasePlayerWeapon *)item)->InstantReload(bCanRefillBPAmmo); + } + } if (pWeapon == item) break; @@ -9272,4 +9278,5 @@ void CBasePlayer::ReloadWeapons(CBasePlayerItem *pWeapon) if (pWeapon != nullptr && pWeapon == item) break; } +#endif } diff --git a/regamedll/dlls/player.h b/regamedll/dlls/player.h index f65c385c..21e7d937 100644 --- a/regamedll/dlls/player.h +++ b/regamedll/dlls/player.h @@ -589,7 +589,7 @@ public: void SendItemStatus(); edict_t *EntSelectSpawnPoint(); void SetScoreAttrib(CBasePlayer *dest); - void ReloadWeapons(CBasePlayerItem *pWeapon = nullptr); + void ReloadWeapons(CBasePlayerItem *pWeapon = nullptr, bool bForceReload = false, bool bForceRefill = false); #ifdef REGAMEDLL_ADD CCSPlayer *CSPlayer() const; diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index d6023904..d49e955d 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -904,7 +904,17 @@ void CBasePlayerWeapon::__MAKE_VHOOK(ItemPostFrame)() // Add them to the clip m_iClip += j; + +#ifdef REGAMEDLL_ADD + // Do not remove bpammo of the player, + // if cvar allows to refill bpammo on during reloading the weapons + if (refill_bpammo_weapons.value < 2.0f) { + m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= j; + } +#else m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= j; +#endif + m_pPlayer->TabulateAmmo(); m_fInReload = FALSE; } @@ -1305,7 +1315,6 @@ int CBasePlayerWeapon::DefaultReload(int iClipSize, int iAnim, float fDelay) return FALSE; int j = Q_min(iClipSize - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]); - if (!j) { return FALSE; @@ -2233,7 +2242,9 @@ void CArmoury::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) LINK_ENTITY_TO_CLASS(armoury_entity, CArmoury, CCSArmoury); -void CBasePlayerWeapon::InstantReload() +// true - keep the amount of bpammo +// false - let take away bpammo +void CBasePlayerWeapon::InstantReload(bool bCanRefillBPAmmo) { // if you already reload if (m_fInReload) @@ -2249,6 +2260,10 @@ void CBasePlayerWeapon::InstantReload() // Add them to the clip m_iClip += j; - m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= j; + + if (!bCanRefillBPAmmo) { + m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= j; + } + m_pPlayer->TabulateAmmo(); } diff --git a/regamedll/dlls/weapons.h b/regamedll/dlls/weapons.h index 6f288142..fc785698 100644 --- a/regamedll/dlls/weapons.h +++ b/regamedll/dlls/weapons.h @@ -398,7 +398,7 @@ public: void SetPlayerShieldAnim(); void ResetPlayerShieldAnim(); bool ShieldSecondaryFire(int iUpAnim, int iDownAnim); - void InstantReload(); + void InstantReload(bool bCanRefillBPAmmo = false); public: static TYPEDESCRIPTION IMPL(m_SaveData)[7]; diff --git a/regamedll/dlls/wpn_shared/wpn_usp.cpp b/regamedll/dlls/wpn_shared/wpn_usp.cpp index a96cfc9e..1e279039 100644 --- a/regamedll/dlls/wpn_shared/wpn_usp.cpp +++ b/regamedll/dlls/wpn_shared/wpn_usp.cpp @@ -45,7 +45,7 @@ int CUSP::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) p->pszAmmo1 = "45ACP"; #endif // REGAMEDLL_FIXES p->iMaxAmmo1 = MAX_AMMO_45ACP; - p->pszAmmo2 = 0; + p->pszAmmo2 = NULL; p->iMaxAmmo2 = -1; p->iMaxClip = USP_MAX_CLIP; p->iSlot = 1; diff --git a/regamedll/extra/cssdk/dlls/gamerules.h b/regamedll/extra/cssdk/dlls/gamerules.h index b2064251..a7d0d331 100644 --- a/regamedll/extra/cssdk/dlls/gamerules.h +++ b/regamedll/extra/cssdk/dlls/gamerules.h @@ -90,6 +90,33 @@ enum ScenarioEventEndRound ROUND_GAME_COMMENCE, }; +enum RewardRules +{ + RR_CTS_WIN, + RR_TERRORISTS_WIN, + RR_TARGET_BOMB, + RR_VIP_ESCAPED, + RR_VIP_ASSASSINATED, + RR_TERRORISTS_ESCAPED, + RR_CTS_PREVENT_ESCAPE, + RR_ESCAPING_TERRORISTS_NEUTRALIZED, + RR_BOMB_DEFUSED, + RR_BOMB_PLANTED, + RR_BOMB_EXPLODED, + RR_ALL_HOSTAGES_RESCUED, + RR_TARGET_BOMB_SAVED, + RR_HOSTAGE_NOT_RESCUED, + RR_VIP_NOT_ESCAPED, + RR_LOSER_BONUS_DEFAULT, + RR_LOSER_BONUS_MIN, + RR_LOSER_BONUS_MAX, + RR_LOSER_BONUS_ADD, + RR_RESCUED_HOSTAGE, + RR_TOOK_HOSTAGE_ACC, + RR_TOOK_HOSTAGE, + RR_END +}; + // custom enum enum RewardAccount { @@ -371,6 +398,23 @@ public: virtual void GiveC4() = 0; virtual void ChangeLevel() = 0; virtual void GoToIntermission() = 0; + + // Setup counts for m_iNumTerrorist, m_iNumCT, m_iNumSpawnableTerrorist, m_iNumSpawnableCT, etc. + virtual void InitializePlayerCounts(int &NumAliveTerrorist, int &NumAliveCT, int &NumDeadTerrorist, int &NumDeadCT) = 0; + + virtual void BalanceTeams() = 0; + virtual void SwapAllPlayers() = 0; + virtual void UpdateTeamScores() = 0; + virtual void EndRoundMessage(const char *sentence, int event) = 0; + virtual void SetAccountRules(RewardRules rules, int amount) = 0; + + // BOMB MAP FUNCTIONS + virtual BOOL IsThereABomber() = 0; + virtual BOOL IsThereABomb() = 0; + + virtual bool HasRoundTimeExpired() = 0; + virtual bool IsBombPlanted() = 0; + public: bool ShouldSkipSpawn() const { return m_bSkipSpawn; } void MarkSpawnSkipped() { m_bSkipSpawn = false; } diff --git a/regamedll/extra/cssdk/dlls/hookchains.h b/regamedll/extra/cssdk/dlls/hookchains.h index eefe8a54..408d8a43 100644 --- a/regamedll/extra/cssdk/dlls/hookchains.h +++ b/regamedll/extra/cssdk/dlls/hookchains.h @@ -83,7 +83,7 @@ public: template class IHookChainRegistryClass { public: - typedef t_ret(*hookfunc_t)(IHookChain*, t_class *, t_args...); + typedef t_ret(*hookfunc_t)(IHookChainClass*, t_class *, t_args...); virtual void registerHook(hookfunc_t hook) = 0; virtual void unregisterHook(hookfunc_t hook) = 0; @@ -103,7 +103,7 @@ public: template class IVoidHookChainRegistryClass { public: - typedef void(*hookfunc_t)(IVoidHookChain*, t_class *, t_args...); + typedef void(*hookfunc_t)(IVoidHookChainClass*, t_class *, t_args...); virtual void registerHook(hookfunc_t hook) = 0; virtual void unregisterHook(hookfunc_t hook) = 0; diff --git a/regamedll/extra/cssdk/dlls/regamedll_api.h b/regamedll/extra/cssdk/dlls/regamedll_api.h index bf8e982a..7286b769 100644 --- a/regamedll/extra/cssdk/dlls/regamedll_api.h +++ b/regamedll/extra/cssdk/dlls/regamedll_api.h @@ -161,10 +161,6 @@ typedef IVoidHookChainRegistryClass IReGameHo typedef IVoidHookChainClass IReGameHook_CBaseAnimating_ResetSequenceInfo; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo; - - - - // GetForceCamera hook typedef IHookChain IReGameHook_GetForceCamera; typedef IHookChainRegistry IReGameHookRegistry_GetForceCamera; @@ -391,7 +387,6 @@ struct ReGameFuncs_t { void (*ApplyMultiDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker); void (*AddMultiDamage)(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType); - void (*EndRoundMessage)(const char *sentence, int event); class CBaseEntity *(*UTIL_FindEntityByString)(class CBaseEntity *pStartEntity, const char *szKeyword, const char *szValue); }; diff --git a/regamedll/hookers/6153_hooker.cpp b/regamedll/hookers/6153_hooker.cpp index 67c9ce3b..8980fd74 100644 --- a/regamedll/hookers/6153_hooker.cpp +++ b/regamedll/hookers/6153_hooker.cpp @@ -2715,7 +2715,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D8B400, "_Z21SV_CareerMatchLimit_fv", (size_t)&SV_CareerMatchLimit_f }, { 0x01D8B6E0, "_Z9BroadcastPKc", (size_t)&Broadcast }, { 0x01D8B780, "_Z7GetTeami", (size_t)&GetTeam }, - { 0x01D8B7B0, "_Z15EndRoundMessagePKci", (size_t)&EndRoundMessage }, + //{ 0x01D8B7B0, "_Z15EndRoundMessagePKci", (size_t)&EndRoundMessage }, //{ 0x01D8BD80, "_ZL18ReadMultiplayCvarsP18CHalfLifeMultiplay", (size_t)&ReadMultiplayCvars }, //{ 0x01D92670, "_Z15DestroyMapCycleP10mapcycle_s", (size_t)&DestroyMapCycle }, // NOXREF { 0x01D926B0, "_Z15MP_COM_GetTokenv", (size_t)&MP_COM_GetToken }, diff --git a/regamedll/msvc/ReGameDLL.vcxproj b/regamedll/msvc/ReGameDLL.vcxproj index 0388f522..bf2bf366 100644 --- a/regamedll/msvc/ReGameDLL.vcxproj +++ b/regamedll/msvc/ReGameDLL.vcxproj @@ -1488,7 +1488,7 @@ Level3 Full true - REGAMEDLL_SELF;PLAY_GAMEDLL;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;NDEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions) + REGAMEDLL_SELF;PLAY_GAMEDLL;REGAMEDLL_API;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;NDEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions) Precise /arch:IA32 %(AdditionalOptions) MultiThreaded diff --git a/regamedll/public/regamedll/hookchains.h b/regamedll/public/regamedll/hookchains.h index eefe8a54..408d8a43 100644 --- a/regamedll/public/regamedll/hookchains.h +++ b/regamedll/public/regamedll/hookchains.h @@ -83,7 +83,7 @@ public: template class IHookChainRegistryClass { public: - typedef t_ret(*hookfunc_t)(IHookChain*, t_class *, t_args...); + typedef t_ret(*hookfunc_t)(IHookChainClass*, t_class *, t_args...); virtual void registerHook(hookfunc_t hook) = 0; virtual void unregisterHook(hookfunc_t hook) = 0; @@ -103,7 +103,7 @@ public: template class IVoidHookChainRegistryClass { public: - typedef void(*hookfunc_t)(IVoidHookChain*, t_class *, t_args...); + typedef void(*hookfunc_t)(IVoidHookChainClass*, t_class *, t_args...); virtual void registerHook(hookfunc_t hook) = 0; virtual void unregisterHook(hookfunc_t hook) = 0; diff --git a/regamedll/public/regamedll/regamedll_api.h b/regamedll/public/regamedll/regamedll_api.h index bf8e982a..3f2a2f07 100644 --- a/regamedll/public/regamedll/regamedll_api.h +++ b/regamedll/public/regamedll/regamedll_api.h @@ -161,10 +161,6 @@ typedef IVoidHookChainRegistryClass IReGameHo typedef IVoidHookChainClass IReGameHook_CBaseAnimating_ResetSequenceInfo; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo; - - - - // GetForceCamera hook typedef IHookChain IReGameHook_GetForceCamera; typedef IHookChainRegistry IReGameHookRegistry_GetForceCamera; @@ -383,21 +379,17 @@ public: struct ReGameFuncs_t { class CBasePlayer *(*UTIL_PlayerByIndex)(int playerIndex); struct edict_s *(*CREATE_NAMED_ENTITY2)(string_t iClass); - void (*ChangeString)(char *&dest, const char *source); - void (*RadiusDamage)(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType); void (*ClearMultiDamage)(); void (*ApplyMultiDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker); void (*AddMultiDamage)(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType); - - void (*EndRoundMessage)(const char *sentence, int event); class CBaseEntity *(*UTIL_FindEntityByString)(class CBaseEntity *pStartEntity, const char *szKeyword, const char *szValue); }; class IReGameApi { public: - virtual ~IReGameApi() { } + virtual ~IReGameApi() {} virtual int GetMajorVersion() = 0; virtual int GetMinorVersion() = 0; @@ -410,7 +402,6 @@ public: virtual struct playermove_s* GetPlayerMove() = 0; virtual struct WeaponSlotInfo* GetWeaponSlot(WeaponIdType weaponID) = 0; virtual struct WeaponSlotInfo* GetWeaponSlot(const char* weaponName) = 0; - }; #define VRE_GAMEDLL_API_VERSION "VRE_GAMEDLL_API_VERSION001" diff --git a/regamedll/public/regamedll/regamedll_interfaces.h b/regamedll/public/regamedll/regamedll_interfaces.h index 4d7b1004..f8676cc6 100644 --- a/regamedll/public/regamedll/regamedll_interfaces.h +++ b/regamedll/public/regamedll/regamedll_interfaces.h @@ -78,7 +78,11 @@ public: virtual void SetBombIcon(bool bFlash = false); virtual void SetScoreAttrib(CBasePlayer *dest); virtual void SendItemStatus(); - virtual void ReloadWeapons(CBasePlayerItem *pWeapon = nullptr); + virtual void ReloadWeapons(CBasePlayerItem *pWeapon = nullptr, bool bForceReload = false, bool bForceRefill = false); + virtual void Observer_SetMode(int iMode); + virtual bool SelectSpawnSpot(const char *pEntClassName, CBaseEntity* &pSpot); + virtual bool SwitchWeapon(CBasePlayerItem *pWeapon); + virtual void SwitchTeam(); CBasePlayer *BasePlayer() const; public: diff --git a/regamedll/regamedll/hookchains_impl.h b/regamedll/regamedll/hookchains_impl.h index 6b0bf5b0..27f55b54 100644 --- a/regamedll/regamedll/hookchains_impl.h +++ b/regamedll/regamedll/hookchains_impl.h @@ -280,7 +280,7 @@ public: template class IHookChainRegistryClassImpl : public IHookChainRegistryClass , public AbstractHookChainRegistry { public: - typedef t_ret(*hookfunc_t)(IHookChain*, t_class *, t_args...); + typedef t_ret(*hookfunc_t)(IHookChainClass*, t_class *, t_args...); typedef t_ret(t_class::*origfunc_t)(t_args...); virtual ~IHookChainRegistryClassImpl() { } @@ -366,7 +366,7 @@ public: template class IVoidHookChainRegistryClassImpl : public IVoidHookChainRegistryClass , public AbstractHookChainRegistry { public: - typedef void(*hookfunc_t)(IVoidHookChain*, t_class *, t_args...); + typedef void(*hookfunc_t)(IVoidHookChainClass*, t_class *, t_args...); typedef void(t_class::*origfunc_t)(t_args...); virtual ~IVoidHookChainRegistryClassImpl() { } diff --git a/regamedll/regamedll/regamedll_api_impl.cpp b/regamedll/regamedll/regamedll_api_impl.cpp index 2c04fdb8..c1a0bcf0 100644 --- a/regamedll/regamedll/regamedll_api_impl.cpp +++ b/regamedll/regamedll/regamedll_api_impl.cpp @@ -40,7 +40,6 @@ ReGameFuncs_t g_ReGameApiFuncs = { &ApplyMultiDamage_api, &AddMultiDamage_api, - &EndRoundMessage, &UTIL_FindEntityByString, }; @@ -76,8 +75,6 @@ IReGameHookRegistry_CBasePlayer_AddAccount* CReGameHookchains::CBasePlayer_AddAc IReGameHookRegistry_CBasePlayer_GiveShield* CReGameHookchains::CBasePlayer_GiveShield() { return &m_CBasePlayer_GiveShield; } IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel* CReGameHookchains::CBasePlayer_SetClientUserInfoModel() { return &m_CBasePlayer_SetClientUserInfoModel; } IReGameHookRegistry_CBasePlayer_SetClientUserInfoName* CReGameHookchains::CBasePlayer_SetClientUserInfoName() { return &m_CBasePlayer_SetClientUserInfoName; } - - IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CReGameHookchains::CBaseAnimating_ResetSequenceInfo() { return &m_CBaseAnimating_ResetSequenceInfo; } IReGameHookRegistry_GetForceCamera* CReGameHookchains::GetForceCamera() { return &m_GetForceCamera; } diff --git a/regamedll/regamedll/regamedll_api_impl.h b/regamedll/regamedll/regamedll_api_impl.h index 85ec378b..3b6ddd2a 100644 --- a/regamedll/regamedll/regamedll_api_impl.h +++ b/regamedll/regamedll/regamedll_api_impl.h @@ -152,12 +152,10 @@ typedef IVoidHookChainRegistryClassImpl CReGameHook typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_SetClientUserInfoName; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_SetClientUserInfoName; - // CBaseAnimating::ResetSequenceInfo hook typedef IVoidHookChainClassImpl CReGameHook_CBaseAnimating_ResetSequenceInfo; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBaseAnimating_ResetSequenceInfo; - // GetForceCamera hook typedef IHookChainImpl CReGameHook_GetForceCamera; typedef IHookChainRegistryImpl CReGameHookRegistry_GetForceCamera; @@ -331,7 +329,7 @@ public: CReGameHookRegistry_CBasePlayer_AddAccount m_CBasePlayer_AddAccount; CReGameHookRegistry_CBasePlayer_GiveShield m_CBasePlayer_GiveShield; CReGameHookRegistry_CBasePlayer_SetClientUserInfoModel m_CBasePlayer_SetClientUserInfoModel; - + CReGameHookRegistry_CBasePlayer_SetClientUserInfoName m_CBasePlayer_SetClientUserInfoName; CReGameHookRegistry_CBaseAnimating_ResetSequenceInfo m_CBaseAnimating_ResetSequenceInfo; CReGameHookRegistry_GetForceCamera m_GetForceCamera; @@ -371,7 +369,6 @@ public: CReGameHookRegistry_CSGameRules_GoToIntermission m_CSGameRules_GoToIntermission; CReGameHookRegistry_CSGameRules_BalanceTeams m_CSGameRules_BalanceTeams; - CReGameHookRegistry_CBasePlayer_SetClientUserInfoName m_CBasePlayer_SetClientUserInfoName; public: virtual IReGameHookRegistry_CBasePlayer_Spawn* CBasePlayer_Spawn(); virtual IReGameHookRegistry_CBasePlayer_Precache* CBasePlayer_Precache(); @@ -403,7 +400,7 @@ public: virtual IReGameHookRegistry_CBasePlayer_AddAccount* CBasePlayer_AddAccount(); virtual IReGameHookRegistry_CBasePlayer_GiveShield* CBasePlayer_GiveShield(); virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel* CBasePlayer_SetClientUserInfoModel(); - + virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoName* CBasePlayer_SetClientUserInfoName(); virtual IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CBaseAnimating_ResetSequenceInfo(); virtual IReGameHookRegistry_GetForceCamera* GetForceCamera(); @@ -442,8 +439,6 @@ public: virtual IReGameHookRegistry_CSGameRules_ChangeLevel* CSGameRules_ChangeLevel(); virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission(); virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams(); - - virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoName* CBasePlayer_SetClientUserInfoName(); }; extern CReGameHookchains g_ReGameHookchains; diff --git a/regamedll/regamedll/regamedll_interfaces_impl.cpp b/regamedll/regamedll/regamedll_interfaces_impl.cpp index 93edecb0..be0a9f42 100644 --- a/regamedll/regamedll/regamedll_interfaces_impl.cpp +++ b/regamedll/regamedll/regamedll_interfaces_impl.cpp @@ -84,4 +84,8 @@ edict_t *CCSPlayer::EntSelectSpawnPoint() { return BasePlayer()->EntSelectSpawnP void CCSPlayer::SendItemStatus() { BasePlayer()->SendItemStatus(); } void CCSPlayer::SetBombIcon(bool bFlash) { BasePlayer()->SetBombIcon(bFlash ? TRUE : FALSE); } void CCSPlayer::SetScoreAttrib(CBasePlayer *dest) { BasePlayer()->SetScoreAttrib(dest); } -void CCSPlayer::ReloadWeapons(CBasePlayerItem *pWeapon) { BasePlayer()->ReloadWeapons(pWeapon); } +void CCSPlayer::ReloadWeapons(CBasePlayerItem *pWeapon, bool bForceReload, bool bForceRefill) { BasePlayer()->ReloadWeapons(pWeapon, bForceReload, bForceRefill); } +void CCSPlayer::Observer_SetMode(int iMode) { BasePlayer()->Observer_SetMode(iMode); } +bool CCSPlayer::SelectSpawnSpot(const char *pEntClassName, CBaseEntity* &pSpot) { return BasePlayer()->SelectSpawnSpot(pEntClassName, pSpot); } +bool CCSPlayer::SwitchWeapon(CBasePlayerItem *pWeapon) { return BasePlayer()->SwitchWeapon(pWeapon) != FALSE; } +void CCSPlayer::SwitchTeam() { BasePlayer()->SwitchTeam(); }