diff --git a/README.md b/README.md index 773f4d59..ad797642 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Regamedll_CS is a result of reverse engineering of original library mods HLDS (b ## How can use it? Regamedll_CS is fully compatible with official mod CS 1.6 / CZero by Valve. All you have to do is to download binaries and replace original mp.dll/cs.so -Compiled binaries are available here: [link](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-dev/regamedll/regamedll/) Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure' * 'pure' version is designed to work exactly as official mod CS diff --git a/regamedll/common/mathlib.h b/regamedll/common/mathlib.h index 45ea7b20..88bb0568 100644 --- a/regamedll/common/mathlib.h +++ b/regamedll/common/mathlib.h @@ -121,6 +121,14 @@ inline double M_sqrt(double value) { return ret; } +template +inline void SWAP(T &first, T &second) +{ + T temp = first; + first = second; + second = temp; +} + #define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];} #define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];} #define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];} diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index b2088844..5eeb8a82 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -181,7 +181,7 @@ void EXT_FUNC ClientKill(edict_t *pEntity) if (pPlayer->m_fNextSuicideTime > gpGlobals->time) return; - pPlayer->m_LastHitGroup = 0; + pPlayer->m_LastHitGroup = HITGROUP_GENERIC; // don't let them suicide for 5 seconds after suiciding pPlayer->m_fNextSuicideTime = gpGlobals->time + 1.0f; @@ -1494,10 +1494,6 @@ LINK_HOOK_CHAIN(BOOL, HandleMenu_ChooseTeam, (CBasePlayer *player, int slot), pl // can be closed...false if the menu should be displayed again BOOL EXT_FUNC __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *player, int slot) { - int oldTeam; - char *szOldTeam; - char *szNewTeam; - // If this player is a VIP, don't allow him to switch teams/appearances unless the following conditions are met : // a) There is another TEAM_CT player who is in the queue to be a VIP // b) This player is dead @@ -1820,6 +1816,9 @@ BOOL EXT_FUNC __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *player, int slot) } } + TeamName oldTeam; + char *szOldTeam, *szNewTeam; + // Switch their actual team... player->m_bTeamChanged = true; oldTeam = player->m_iTeam; @@ -4746,7 +4745,7 @@ void EXT_FUNC CreateInstancedBaselines() int EXT_FUNC InconsistentFile(const edict_t *player, const char *filename, char *disconnect_message) { // Server doesn't care? - if (CVAR_GET_FLOAT("mp_consistency") != 1) + if (!CVAR_GET_FLOAT("mp_consistency")) return 0; // Default behavior is to kick the player diff --git a/regamedll/dlls/gamerules.h b/regamedll/dlls/gamerules.h index cb27b567..448de431 100644 --- a/regamedll/dlls/gamerules.h +++ b/regamedll/dlls/gamerules.h @@ -44,6 +44,7 @@ #define WEAPON_RESPAWN_TIME 20 #define AMMO_RESPAWN_TIME 20 #define ROUND_RESPAWN_TIME 20 +#define ROUND_BEGIN_DELAY 5 // delay before beginning new round // longest the intermission can last, in seconds #define MAX_INTERMISSION_TIME 120 @@ -727,6 +728,7 @@ public: void MarkSpawnSkipped() { m_bSkipSpawn = false; } void PlayerJoinedTeam(CBasePlayer *pPlayer) { } float GetRoundRemainingTime() const { return m_iRoundTimeSecs - gpGlobals->time + m_fRoundStartTime; } + float GetRoundRemainingTimeReal() const; float GetTimeLeft() const { return m_flTimeLimit - gpGlobals->time; } BOOL TeamFull(int team_id); @@ -783,7 +785,7 @@ public: int m_iRoundTime; // (From mp_roundtime) - How many seconds long this round is. int m_iRoundTimeSecs; int m_iIntroRoundTime; // (From mp_freezetime) - How many seconds long the intro round (when players are frozen) is. - float m_fIntroRoundCount; // The global time when the intro round ends and the real one starts + float m_fRoundStartTimeReal; // The global time when the intro round ends and the real one starts // wrote the original "m_flRoundTime" comment for this variable). int m_iAccountTerrorist; int m_iAccountCT; @@ -917,6 +919,15 @@ inline void CHalfLifeMultiplay::TerminateRound(float tmDelay, int iWinStatus) m_bRoundTerminating = true; } +inline float CHalfLifeMultiplay::GetRoundRemainingTimeReal() const +{ +#ifdef REGAMEDLL_FIXES + return m_iRoundTimeSecs - gpGlobals->time + m_fRoundStartTimeReal; +#else + return GetRoundRemainingTime(); +#endif +} + inline float CHalfLifeMultiplay::GetRoundRespawnTime() const { #ifdef REGAMEDLL_ADD diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index 5ef885d0..7face28c 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -500,7 +500,12 @@ CHalfLifeMultiplay::CHalfLifeMultiplay() ReadMultiplayCvars(); m_iIntroRoundTime += 2; - m_fMaxIdlePeriod = m_iRoundTime * 2; + +#ifdef REGAMEDLL_FIXES + m_fMaxIdlePeriod = (((m_iRoundTime < 60) ? 60 : m_iRoundTime) * 2); +#else + m_fMaxIdlePeriod = (m_iRoundTime * 2); +#endif float flAutoKickIdle = autokick_timeout.value; if (flAutoKickIdle > 0.0) @@ -547,7 +552,7 @@ CHalfLifeMultiplay::CHalfLifeMultiplay() } m_fRoundStartTime = 0; - m_fIntroRoundCount = 0; + m_fRoundStartTimeReal = 0; #ifndef CSTRIKE InstallBotControl(); @@ -925,9 +930,15 @@ void EXT_FUNC CHalfLifeMultiplay::__API_VHOOK(CheckWinConditions)() if (HasRoundInfinite()) return; +#ifdef REGAMEDLL_FIXES + // If a winner has already been determined.. then get the heck out of here + if (m_iRoundWinStatus != WINNER_NONE) + return; +#else // If a winner has already been determined and game of started.. then get the heck out of here if (m_bGameStarted && m_iRoundWinStatus != WINNER_NONE) return; +#endif #ifdef REGAMEDLL_ADD int scenarioFlags = UTIL_ReadFlags(round_infinite.string); @@ -1173,12 +1184,12 @@ bool CHalfLifeMultiplay::VIPRoundEndCheck() { if (m_pVIP->m_bEscaped) { - return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::VIP_Escaped_internal, this, WINSTATUS_CTS, ROUND_VIP_ESCAPED, 5); + return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::VIP_Escaped_internal, this, WINSTATUS_CTS, ROUND_VIP_ESCAPED, ROUND_BEGIN_DELAY); } // The VIP is dead else if (m_pVIP->pev->deadflag != DEAD_NO) { - return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::VIP_Died_internal, this, WINSTATUS_TERRORISTS, ROUND_VIP_ASSASSINATED, 5); + return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::VIP_Died_internal, this, WINSTATUS_TERRORISTS, ROUND_VIP_ASSASSINATED, ROUND_BEGIN_DELAY); } } @@ -1265,15 +1276,15 @@ bool CHalfLifeMultiplay::PrisonRoundEndCheck(int NumAliveTerrorist, int NumAlive if (m_flEscapeRatio >= m_flRequiredEscapeRatio) { - return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Prison_Escaped_internal, this, WINSTATUS_TERRORISTS, ROUND_TERRORISTS_ESCAPED, 5); + return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Prison_Escaped_internal, this, WINSTATUS_TERRORISTS, ROUND_TERRORISTS_ESCAPED, ROUND_BEGIN_DELAY); } else if (NumAliveTerrorist == 0 && m_flEscapeRatio < m_flRequiredEscapeRatio) { - return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Prison_PreventEscape_internal, this, WINSTATUS_CTS, ROUND_CTS_PREVENT_ESCAPE, 5); + return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Prison_PreventEscape_internal, this, WINSTATUS_CTS, ROUND_CTS_PREVENT_ESCAPE, ROUND_BEGIN_DELAY); } else if (NumAliveTerrorist == 0 && NumDeadTerrorist != 0 && m_iNumSpawnableCT > 0) { - return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Prison_Neutralized_internal, this, WINSTATUS_CTS, ROUND_ESCAPING_TERRORISTS_NEUTRALIZED, 5); + return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Prison_Neutralized_internal, this, WINSTATUS_CTS, ROUND_ESCAPING_TERRORISTS_NEUTRALIZED, ROUND_BEGIN_DELAY); } // else return true; } @@ -1333,11 +1344,11 @@ bool CHalfLifeMultiplay::BombRoundEndCheck() // Check to see if the bomb target was hit or the bomb defused.. if so, then let's end the round! if (m_bTargetBombed && m_bMapHasBombTarget) { - return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Target_Bombed_internal, this, WINSTATUS_TERRORISTS, ROUND_TARGET_BOMB, 5); + return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Target_Bombed_internal, this, WINSTATUS_TERRORISTS, ROUND_TARGET_BOMB, ROUND_BEGIN_DELAY); } else if (m_bBombDefused && m_bMapHasBombTarget) { - return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Target_Defused_internal, this, WINSTATUS_CTS, ROUND_BOMB_DEFUSED, 5); + return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Target_Defused_internal, this, WINSTATUS_CTS, ROUND_BOMB_DEFUSED, ROUND_BEGIN_DELAY); } return false; @@ -1419,19 +1430,19 @@ bool CHalfLifeMultiplay::TeamExterminationCheck(int NumAliveTerrorist, int NumAl if (!nowin) { - return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Round_Cts_internal, this, WINSTATUS_CTS, ROUND_CTS_WIN, 5); + return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Round_Cts_internal, this, WINSTATUS_CTS, ROUND_CTS_WIN, ROUND_BEGIN_DELAY); } } // Terrorists WON else if (NumAliveCT == 0 && NumDeadCT != 0) { - return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Round_Ts_internal, this, WINSTATUS_TERRORISTS, ROUND_TERRORISTS_WIN, 5); + return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Round_Ts_internal, this, WINSTATUS_TERRORISTS, ROUND_TERRORISTS_WIN, ROUND_BEGIN_DELAY); } } else if (NumAliveCT == 0 && NumAliveTerrorist == 0) { - return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Round_Draw_internal, this, WINSTATUS_DRAW, ROUND_END_DRAW, 5); + return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Round_Draw_internal, this, WINSTATUS_DRAW, ROUND_END_DRAW, ROUND_BEGIN_DELAY); } return false; @@ -1499,7 +1510,7 @@ bool CHalfLifeMultiplay::HostageRescueRoundEndCheck() { if (m_iHostagesRescued >= (iHostages * 0.5f)) { - return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Hostage_Rescue_internal, this, WINSTATUS_CTS, ROUND_ALL_HOSTAGES_RESCUED, 5); + return g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Hostage_Rescue_internal, this, WINSTATUS_CTS, ROUND_ALL_HOSTAGES_RESCUED, ROUND_BEGIN_DELAY); } } @@ -1813,7 +1824,11 @@ void EXT_FUNC CHalfLifeMultiplay::__API_VHOOK(RestartRound)() if (flAutoKickIdle > 0) m_fMaxIdlePeriod = flAutoKickIdle; else +#ifdef REGAMEDLL_FIXES + m_fMaxIdlePeriod = (((m_iRoundTime < 60) ? 60 : m_iRoundTime) * 2); +#else m_fMaxIdlePeriod = (m_iRoundTime * 2); +#endif // This makes the round timer function as the intro timer on the client side m_iRoundTimeSecs = m_iIntroRoundTime; @@ -1929,7 +1944,7 @@ void EXT_FUNC CHalfLifeMultiplay::__API_VHOOK(RestartRound)() // Update individual players accounts and respawn players // the round time stamp must be set before players are spawned - m_fIntroRoundCount = m_fRoundStartTime = gpGlobals->time; + m_fRoundStartTime = m_fRoundStartTimeReal = gpGlobals->time; // Adrian - No cash for anyone at first rounds! ( well, only the default. ) if (m_bCompleteReset) @@ -2361,7 +2376,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(Think)() if (!m_fRoundStartTime) { // initialize the timer time stamps, this happens once only - m_fIntroRoundCount = m_fRoundStartTime = gpGlobals->time; + m_fRoundStartTime = m_fRoundStartTimeReal = gpGlobals->time; } if (m_flForceCameraValue != forcecamera.value @@ -2828,7 +2843,18 @@ bool CHalfLifeMultiplay::Target_Saved_internal(int winStatus, ScenarioEventEndRo Broadcast("ctwin"); m_iAccountCT += m_rgRewardAccountRules[RR_TARGET_BOMB_SAVED]; + +#ifdef REGAMEDLL_FIXES + if (!m_bNeededPlayers) + { + m_iNumCTWins++; + + // Update the clients team score + UpdateTeamScores(); + } +#else m_iNumCTWins++; +#endif EndRoundMessage("#Target_Saved", event); TerminateRound(tmDelay, winStatus); @@ -2838,9 +2864,10 @@ bool CHalfLifeMultiplay::Target_Saved_internal(int winStatus, ScenarioEventEndRo QueueCareerRoundEndMenu(tmDelay, winStatus); } +#ifndef REGAMEDLL_FIXES UpdateTeamScores(); +#endif MarkLivingPlayersOnTeamAsNotReceivingMoneyNextRound(TERRORIST); - return true; } @@ -2848,7 +2875,18 @@ bool CHalfLifeMultiplay::Hostage_NotRescued_internal(int winStatus, ScenarioEven Broadcast("terwin"); m_iAccountTerrorist += m_rgRewardAccountRules[RR_HOSTAGE_NOT_RESCUED]; + +#ifdef REGAMEDLL_FIXES + if (!m_bNeededPlayers) + { + m_iNumTerroristWins++; + + // Update the clients team score + UpdateTeamScores(); + } +#else m_iNumTerroristWins++; +#endif EndRoundMessage("#Hostages_Not_Rescued", event); TerminateRound(tmDelay, winStatus); @@ -2858,7 +2896,9 @@ bool CHalfLifeMultiplay::Hostage_NotRescued_internal(int winStatus, ScenarioEven QueueCareerRoundEndMenu(tmDelay, winStatus); } +#ifndef REGAMEDLL_FIXES UpdateTeamScores(); +#endif MarkLivingPlayersOnTeamAsNotReceivingMoneyNextRound(CT); return true; } @@ -2866,7 +2906,18 @@ bool CHalfLifeMultiplay::Hostage_NotRescued_internal(int winStatus, ScenarioEven bool CHalfLifeMultiplay::Prison_NotEscaped_internal(int winStatus, ScenarioEventEndRound event, float tmDelay) { Broadcast("ctwin"); + +#ifdef REGAMEDLL_FIXES + if (!m_bNeededPlayers) + { + m_iNumCTWins++; + + // Update the clients team score + UpdateTeamScores(); + } +#else m_iNumCTWins++; +#endif EndRoundMessage("#Terrorists_Not_Escaped", event); TerminateRound(tmDelay, winStatus); @@ -2876,7 +2927,9 @@ bool CHalfLifeMultiplay::Prison_NotEscaped_internal(int winStatus, ScenarioEvent QueueCareerRoundEndMenu(tmDelay, winStatus); } +#ifndef REGAMEDLL_FIXES UpdateTeamScores(); +#endif return true; } @@ -2884,7 +2937,18 @@ bool CHalfLifeMultiplay::VIP_NotEscaped_internal(int winStatus, ScenarioEventEnd Broadcast("terwin"); m_iAccountTerrorist += m_rgRewardAccountRules[RR_VIP_NOT_ESCAPED]; + +#ifdef REGAMEDLL_FIXES + if (!m_bNeededPlayers) + { + m_iNumTerroristWins++; + + // Update the clients team score + UpdateTeamScores(); + } +#else m_iNumTerroristWins++; +#endif EndRoundMessage("#VIP_Not_Escaped", event); TerminateRound(tmDelay, winStatus); @@ -2894,7 +2958,9 @@ bool CHalfLifeMultiplay::VIP_NotEscaped_internal(int winStatus, ScenarioEventEnd QueueCareerRoundEndMenu(tmDelay, winStatus); } +#ifndef REGAMEDLL_FIXES UpdateTeamScores(); +#endif return true; } @@ -2933,29 +2999,29 @@ void CHalfLifeMultiplay::CheckRoundTimeExpired() // New code to get rid of round draws!! if (m_bMapHasBombTarget) { - if (!g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Target_Saved_internal, this, WINSTATUS_CTS, ROUND_TARGET_SAVED, 5)) + if (!g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Target_Saved_internal, this, WINSTATUS_CTS, ROUND_TARGET_SAVED, ROUND_BEGIN_DELAY)) return; } else if (UTIL_FindEntityByClassname(NULL, "hostage_entity")) { - if (!g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Hostage_NotRescued_internal, this, WINSTATUS_TERRORISTS, ROUND_HOSTAGE_NOT_RESCUED, 5)) + if (!g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Hostage_NotRescued_internal, this, WINSTATUS_TERRORISTS, ROUND_HOSTAGE_NOT_RESCUED, ROUND_BEGIN_DELAY)) return; } else if (m_bMapHasEscapeZone) { - if (!g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Prison_NotEscaped_internal, this, WINSTATUS_CTS, ROUND_TERRORISTS_NOT_ESCAPED, 5)) + if (!g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::Prison_NotEscaped_internal, this, WINSTATUS_CTS, ROUND_TERRORISTS_NOT_ESCAPED, ROUND_BEGIN_DELAY)) return; } else if (m_bMapHasVIPSafetyZone) { - if (!g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::VIP_NotEscaped_internal, this, WINSTATUS_TERRORISTS, ROUND_VIP_NOT_ESCAPED, 5)) + if (!g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::VIP_NotEscaped_internal, this, WINSTATUS_TERRORISTS, ROUND_VIP_NOT_ESCAPED, ROUND_BEGIN_DELAY)) return; } #ifdef REGAMEDLL_ADD else if (roundover.value) { // round is over - if (!g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::RoundOver_internal, this, WINSTATUS_DRAW, ROUND_GAME_OVER, 5)) + if (!g_ReGameHookchains.m_RoundEnd.callChain(&CHalfLifeMultiplay::RoundOver_internal, this, WINSTATUS_DRAW, ROUND_GAME_OVER, ROUND_BEGIN_DELAY)) return; } #endif @@ -3659,9 +3725,13 @@ BOOL EXT_FUNC CHalfLifeMultiplay::__API_VHOOK(FPlayerCanRespawn)(CBasePlayer *pP if (GetRoundRespawnTime() != -1) #endif { - // TODO: to be correct, need use m_fIntroRoundCount instead of it. + // TODO: to be correct, need use time the real one starts of round, m_fRoundStartTimeReal instead of it. // m_fRoundStartTime able to extend the time to 60 seconds when there is a remaining time of round. +#ifdef REGAMEDLL_FIXES + if (gpGlobals->time > m_fRoundStartTimeReal + GetRoundRespawnTime()) +#else if (gpGlobals->time > m_fRoundStartTime + GetRoundRespawnTime()) +#endif { // If this player just connected and fadetoblack is on, then maybe // the server admin doesn't want him peeking around. diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 02aeee32..7586a94f 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -560,7 +560,6 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Radio)(const char *msg_id, const char *msg { // do this when spectator mode is in int iSpecMode = pPlayer->IsObserver(); - if (iSpecMode != OBS_CHASE_LOCKED && iSpecMode != OBS_CHASE_FREE && iSpecMode != OBS_IN_EYE) continue; @@ -633,7 +632,7 @@ void CBasePlayer::SmartRadio() ; } -void CBasePlayer::Pain(int iLastHitGroup, bool HasArmour) +void CBasePlayer::Pain(int iLastHitGroup, bool bHasArmour) { int temp = RANDOM_LONG(0, 2); @@ -647,8 +646,8 @@ void CBasePlayer::Pain(int iLastHitGroup, bool HasArmour) switch (temp) { - case 0: EMIT_SOUND(ENT(pev), CHAN_VOICE, "player/headshot1.wav", VOL_NORM, ATTN_NORM); break; - case 1: EMIT_SOUND(ENT(pev), CHAN_VOICE, "player/headshot2.wav", VOL_NORM, ATTN_NORM); break; + case 0: EMIT_SOUND(ENT(pev), CHAN_VOICE, "player/headshot1.wav", VOL_NORM, ATTN_NORM); break; + case 1: EMIT_SOUND(ENT(pev), CHAN_VOICE, "player/headshot2.wav", VOL_NORM, ATTN_NORM); break; default: EMIT_SOUND(ENT(pev), CHAN_VOICE, "player/headshot3.wav", VOL_NORM, ATTN_NORM); break; } } @@ -656,7 +655,7 @@ void CBasePlayer::Pain(int iLastHitGroup, bool HasArmour) { if (iLastHitGroup != HITGROUP_LEFTLEG && iLastHitGroup != HITGROUP_RIGHTLEG) { - if (HasArmour) + if (bHasArmour) { EMIT_SOUND(ENT(pev), CHAN_VOICE, "player/bhit_kevlar-1.wav", VOL_NORM, ATTN_NORM); return; @@ -665,14 +664,14 @@ void CBasePlayer::Pain(int iLastHitGroup, bool HasArmour) switch (temp) { - case 0: EMIT_SOUND(ENT(pev), CHAN_VOICE, "player/bhit_flesh-1.wav", VOL_NORM, ATTN_NORM); break; - case 1: EMIT_SOUND(ENT(pev), CHAN_VOICE, "player/bhit_flesh-2.wav", VOL_NORM, ATTN_NORM); break; + case 0: EMIT_SOUND(ENT(pev), CHAN_VOICE, "player/bhit_flesh-1.wav", VOL_NORM, ATTN_NORM); break; + case 1: EMIT_SOUND(ENT(pev), CHAN_VOICE, "player/bhit_flesh-2.wav", VOL_NORM, ATTN_NORM); break; default: EMIT_SOUND(ENT(pev), CHAN_VOICE, "player/bhit_flesh-3.wav", VOL_NORM, ATTN_NORM); break; } } } -Vector VecVelocityForDamage(float flDamage) +NOXREF Vector VecVelocityForDamage(float flDamage) { Vector vec(RANDOM_FLOAT(-100, 100), RANDOM_FLOAT(-100, 100), RANDOM_FLOAT(200, 300)); @@ -3286,7 +3285,7 @@ void CBasePlayer::SyncRoundTimer() if (g_pGameRules->IsMultiplayer()) { - tmRemaining = CSGameRules()->GetRoundRemainingTime(); + tmRemaining = CSGameRules()->GetRoundRemainingTimeReal(); #ifdef REGAMEDLL_FIXES // hide timer HUD because it is useless. @@ -4875,10 +4874,10 @@ void EXT_FUNC CBasePlayer::__API_VHOOK(PostThink)() { float flFallDamage = g_pGameRules->FlPlayerFallDamage(this); - //splat + // splat if (flFallDamage > pev->health) { - // note: play on item channel because we play footstep landing on body channel + // NOTE: play on item channel because we play footstep landing on body channel EMIT_SOUND(ENT(pev), CHAN_ITEM, "common/bodysplat.wav", VOL_NORM, ATTN_NORM); } if (flFallDamage > 0) @@ -4926,7 +4925,7 @@ void EXT_FUNC CBasePlayer::__API_VHOOK(PostThink)() StudioFrameAdvance(); CheckPowerups(); - // s1lent: this is useless for CS 1.6 + // NOTE: this is useless for CS 1.6 - s1lent #ifndef REGAMEDLL_FIXES UpdatePlayerSound(); #endif diff --git a/regamedll/dlls/player.h b/regamedll/dlls/player.h index 3aab91a0..6c5347d2 100644 --- a/regamedll/dlls/player.h +++ b/regamedll/dlls/player.h @@ -461,7 +461,7 @@ public: bool CanPlayerBuy(bool display = false); void SwitchTeam(); void TabulateAmmo(); - void Pain(int iLastHitGroup, bool HasArmour); + void Pain(int iLastHitGroup, bool bHasArmour); BOOL IsBombGuy(); bool IsLookingAtPosition(Vector *pos, float angleTolerance = 20.0f); void Reset(); diff --git a/regamedll/dlls/tutor_base_tutor.cpp b/regamedll/dlls/tutor_base_tutor.cpp index ae3d02ca..fd89aac1 100644 --- a/regamedll/dlls/tutor_base_tutor.cpp +++ b/regamedll/dlls/tutor_base_tutor.cpp @@ -70,13 +70,13 @@ void TutorMessageEvent::AddParameter(char *str) param->m_next = NULL; param->m_data = new char[Q_strlen(str) + 1]; - if (param->m_data != NULL) + if (param->m_data) { Q_strcpy(param->m_data, str); param->m_data[Q_strlen(str)] = '\0'; ++m_numParameters; - if (m_paramList != NULL) + if (m_paramList) { TutorMessageEventParam *temp = m_paramList; @@ -125,8 +125,7 @@ CBaseTutor::CBaseTutor() CBaseTutor::~CBaseTutor() { TutorMessageEvent *event = m_eventList; - - while (event != NULL) + while (event) { TutorMessageEvent *temp = event; event = event->GetNext(); @@ -175,8 +174,7 @@ void CBaseTutor::DisplayMessageToPlayer(CBasePlayer *player, int id, const char for (int arg = 0; arg < numArgs; ++arg) { char *str = event->GetNextParameter(param, sizeof(param)); - - if (str != NULL) + if (str) WRITE_STRING(str); else WRITE_STRING(""); @@ -185,7 +183,7 @@ void CBaseTutor::DisplayMessageToPlayer(CBasePlayer *player, int id, const char WRITE_SHORT(id); WRITE_SHORT(player->IsAlive() == FALSE); - if (definition != NULL) + if (definition) WRITE_SHORT(definition->m_type); else WRITE_SHORT(TUTORMESSAGETYPE_DEFAULT); @@ -193,7 +191,7 @@ void CBaseTutor::DisplayMessageToPlayer(CBasePlayer *player, int id, const char m_deadAirStartTime = -1.0f; - if (definition != NULL) + if (definition) { if (gpGlobals->time - m_roundStartTime > 1.0f) { @@ -246,7 +244,7 @@ void CBaseTutor::CloseCurrentWindow() { CBasePlayer *localPlayer = (CBasePlayer *)UTIL_GetLocalPlayer(); - if (localPlayer != NULL) + if (localPlayer) { MESSAGE_BEGIN(MSG_ONE, gmsgTutorClose, NULL, localPlayer->pev); MESSAGE_END(); @@ -319,7 +317,7 @@ bool CBaseTutor::__MAKE_VHOOK(IsPlayerLookingAtEntity)(CBaseEntity *entity, CBas TraceResult result; UTIL_TraceLine(srcVec, destVec, dont_ignore_monsters, ignore_glass, ENT(player->pev), &result); - if (result.pHit != NULL) + if (result.pHit) { if (!FNullEnt(result.pHit) && CBaseEntity::Instance(result.pHit) == entity) { diff --git a/regamedll/dlls/vector.h b/regamedll/dlls/vector.h index 12f71b00..3eb2f9e4 100644 --- a/regamedll/dlls/vector.h +++ b/regamedll/dlls/vector.h @@ -366,14 +366,6 @@ inline Vector CrossProduct(const Vector &a, const Vector &b) return Vector(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x); } -template -inline void SWAP(T &first, T &second) -{ - T temp = first; - first = second; - second = temp; -} - template< typename X, typename Y, diff --git a/regamedll/dlls/world.cpp b/regamedll/dlls/world.cpp index 7f6411b2..2a007e72 100644 --- a/regamedll/dlls/world.cpp +++ b/regamedll/dlls/world.cpp @@ -504,7 +504,7 @@ void CWorld::__MAKE_VHOOK(Precache)() g_pGameRules = InstallGameRules(); - // s1lent: What is the essence of soundent in CS 1.6? I think this is for NPC monsters. + // NOTE: What is the essence of soundent in CS 1.6? I think this is for NPC monsters - s1lent #ifndef REGAMEDLL_FIXES // UNDONE why is there so much Spawn code in the Precache function? I'll just keep it here diff --git a/regamedll/dlls/wpn_shared/wpn_c4.cpp b/regamedll/dlls/wpn_shared/wpn_c4.cpp index c8475108..4113a918 100644 --- a/regamedll/dlls/wpn_shared/wpn_c4.cpp +++ b/regamedll/dlls/wpn_shared/wpn_c4.cpp @@ -20,7 +20,6 @@ void CC4::__MAKE_VHOOK(Spawn)() { pev->effects |= EF_NODRAW; DROP_TO_FLOOR(edict()); - return; } diff --git a/regamedll/extra/cssdk/dlls/gamerules.h b/regamedll/extra/cssdk/dlls/gamerules.h index 16181554..1555284f 100644 --- a/regamedll/extra/cssdk/dlls/gamerules.h +++ b/regamedll/extra/cssdk/dlls/gamerules.h @@ -552,6 +552,7 @@ public: void MarkSpawnSkipped() { m_bSkipSpawn = false; } float GetRoundRemainingTime() const { return m_iRoundTimeSecs - gpGlobals->time + m_fRoundStartTime; } + float GetRoundRemainingTimeReal() const { return m_iRoundTimeSecs - gpGlobals->time + m_fRoundStartTimeReal; } float GetTimeLeft() const { return m_flTimeLimit - gpGlobals->time; } bool IsMatchStarted() { return (m_flRestartRoundTime != 0.0f || m_fCareerRoundMenuTime != 0.0f || m_fCareerMatchMenuTime != 0.0f); } @@ -565,7 +566,7 @@ public: int m_iRoundTime; // (From mp_roundtime) - How many seconds long this round is. int m_iRoundTimeSecs; int m_iIntroRoundTime; // (From mp_freezetime) - How many seconds long the intro round (when players are frozen) is. - float m_fIntroRoundCount; // The global time when the intro round ends and the real one starts + float m_fRoundStartTimeReal; // The global time when the intro round ends and the real one starts // wrote the original "m_flRoundTime" comment for this variable). int m_iAccountTerrorist; int m_iAccountCT; diff --git a/regamedll/hookers/hooker_impl.h b/regamedll/hookers/hooker_impl.h index dcd1d1bb..54e56544 100644 --- a/regamedll/hookers/hooker_impl.h +++ b/regamedll/hookers/hooker_impl.h @@ -962,7 +962,7 @@ qboolean PM_CheckWater(); void PM_CatagorizePosition(); int PM_GetRandomStuckOffsets(int nIndex, int server, vec_t *offset); void PM_ResetStuckOffsets(int nIndex, int server); -int PM_CheckStuck(); +qboolean PM_CheckStuck(); void PM_SpectatorMove(); float PM_SplineFraction(float value, float scale); float PM_SimpleSpline(float value); diff --git a/regamedll/pm_shared/pm_shared.cpp b/regamedll/pm_shared/pm_shared.cpp index 55643c77..479f81ee 100644 --- a/regamedll/pm_shared/pm_shared.cpp +++ b/regamedll/pm_shared/pm_shared.cpp @@ -75,7 +75,7 @@ void PM_InitTextureTypes() int i, j; byte *pMemFile; int fileSize, filePos; - static qboolean bTextureTypeInit = false; + static bool bTextureTypeInit = false; if (bTextureTypeInit) return; @@ -1511,7 +1511,7 @@ void PM_ResetStuckOffsets(int nIndex, int server) // If pmove->origin is in a solid position, // try nudging slightly on all axis to // allow for the cut precision of the net coordinates -int PM_CheckStuck() +qboolean PM_CheckStuck() { vec3_t base; vec3_t offset; @@ -1530,7 +1530,7 @@ int PM_CheckStuck() if (hitent == -1) { PM_ResetStuckOffsets(pmove->player_index, pmove->server); - return 0; + return FALSE; } VectorCopy(pmove->origin, base); @@ -1552,7 +1552,7 @@ int PM_CheckStuck() { PM_ResetStuckOffsets(pmove->player_index, pmove->server); VectorCopy(test, pmove->origin); - return 0; + return FALSE; } nReps++; @@ -1562,7 +1562,6 @@ int PM_CheckStuck() } // Only an issue on the client. - if (pmove->server) idx = 0; else @@ -1573,7 +1572,7 @@ int PM_CheckStuck() // Too soon? if (rgStuckCheckTime[pmove->player_index][idx] >= (fTime - PM_CHECKSTUCK_MINTIME)) { - return 1; + return TRUE; } rgStuckCheckTime[pmove->player_index][idx] = fTime; @@ -1592,7 +1591,7 @@ int PM_CheckStuck() VectorCopy(test, pmove->origin); } - return 0; + return FALSE; } // If player is flailing while stuck in another player (should never happen), then see @@ -1620,14 +1619,14 @@ int PM_CheckStuck() if (pmove->PM_TestPlayerPosition(test, NULL) == -1) { VectorCopy(test, pmove->origin); - return 0; + return FALSE; } } } } } - return 1; + return TRUE; } void PM_SpectatorMove() @@ -1657,7 +1656,7 @@ void PM_SpectatorMove() iJumpSpectator = 0; return; } -#endif +#endif // Move around in normal spectator method speed = Length (pmove->velocity); @@ -1937,7 +1936,7 @@ void PM_LadderMove(physent_t *pLadder) { vec3_t ladderCenter; trace_t trace; - qboolean onFloor; + bool onFloor; vec3_t floor; vec3_t modelmins, modelmaxs;