Refactoring (#540)

* Rename CMD mp_swapteams
* Remove unused CVar mp_mirrordamage
* Refactoring checks
This commit is contained in:
Vaqtincha 2021-04-12 17:55:03 +05:00 committed by GitHub
parent 913bfc6609
commit fc52871739
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 7 deletions

View File

@ -27,7 +27,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
| :---------------------------------- | :---------------------------------------------- |
| game version | Will show GameDLL build version, date & URL. |
| endround | Args:<br/>`T` force round end with Terrorists win. <br/>`CT` force round end with Counter-Terrorists win. <br/> or terminate round draw when called without arguments. |
| mp_swapteams | Swap the teams and restart the game. |
| swapteams | Swap the teams and restart the game. |
## Configuration (cvars)
<details>

View File

@ -243,7 +243,11 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&autoteambalance);
CVAR_REGISTER(&tkpunish);
CVAR_REGISTER(&hostagepenalty);
#ifndef REGAMEDLL_FIXES
CVAR_REGISTER(&mirrordamage);
#endif
CVAR_REGISTER(&logmessages);
CVAR_REGISTER(&forcecamera);
CVAR_REGISTER(&forcechasecam);
@ -320,7 +324,7 @@ void EXT_FUNC GameDLLInit()
ADD_SERVER_COMMAND("game", GameDLL_Version_f);
ADD_SERVER_COMMAND("endround", GameDLL_EndRound_f);
ADD_SERVER_COMMAND("mp_swapteams", GameDLL_SwapTeams_f);
ADD_SERVER_COMMAND("swapteams", GameDLL_SwapTeams_f);
CVAR_REGISTER(&game_version);
CVAR_REGISTER(&maxmoney);

View File

@ -3910,9 +3910,8 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(PlayerKilled)(CBasePlayer *pVictim,
{
// if a player dies in a deathmatch game and the killer is a client, award the killer some points
CBasePlayer *killer = GetClassPtr<CCSPlayer>((CBasePlayer *)pKiller);
bool killedByFFA = IsFreeForAll();
if (killer->m_iTeam == pVictim->m_iTeam && !killedByFFA)
if (g_pGameRules->PlayerRelationship(pVictim, killer) == GR_TEAMMATE)
{
// if a player dies by from teammate
pKiller->frags -= IPointsForKill(peKiller, pVictim);

View File

@ -835,7 +835,7 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(TakeDamage)(entvars_t *pevInflictor, entva
CBaseEntity *pAttacker = GET_PRIVATE<CBaseEntity>(ENT(pevAttacker));
// don't take damage if victim has protection
if (((pAttacker && pAttacker->IsPlayer()) || (bitsDamageType & DMG_FALL)) && CSPlayer()->GetProtectionState() == CCSPlayer::ProtectionSt_Active)
if (((pAttacker && pAttacker->IsPlayer()) || (bitsDamageType & DMG_FALL)) && CSPlayer()->GetProtectionState() == CCSPlayer::ProtectionSt_Active)
return FALSE;
}
#endif
@ -1034,7 +1034,7 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(TakeDamage)(entvars_t *pevInflictor, entva
pAttack = GetClassPtr<CCSPlayer>((CBasePlayer *)pevAttacker);
// warn about team attacks
if (!CSGameRules()->IsFreeForAll() && pAttack->m_iTeam == m_iTeam)
if (g_pGameRules->PlayerRelationship(this, pAttack) == GR_TEAMMATE)
{
if (pAttack != this)
{
@ -7748,7 +7748,7 @@ void CBasePlayer::UpdateStatusBar()
{
CBasePlayer *pTarget = (CBasePlayer *)pEntity;
bool sameTeam = !CSGameRules()->IsFreeForAll() && pTarget->m_iTeam == m_iTeam;
bool sameTeam = g_pGameRules->PlayerRelationship(this, pTarget) == GR_TEAMMATE;
newSBarState[SBAR_ID_TARGETNAME] = ENTINDEX(pTarget->edict());
newSBarState[SBAR_ID_TARGETTYPE] = sameTeam ? SBAR_TARGETTYPE_TEAMMATE : SBAR_TARGETTYPE_ENEMY;