diff --git a/include/main.h b/include/main.h index d6f6cff..af9c54a 100644 --- a/include/main.h +++ b/include/main.h @@ -7,6 +7,14 @@ #define GET_DISTANCE(a, b) ((a - b).Length2D()) #define GET_COLLIDE(a, b) (abs(a.z - b.z) < 96 && (a - b).Length2D() < 96) +enum +{ + SC_TEAM_ALL = 0, + SC_TEAM_T, + SC_TEAM_CT, + SC_TEAM_TEAMMATE, +}; + extern int DispatchSpawn(edict_t *pEntity); extern int ShouldCollide(edict_t *pentTouched, edict_t *pentOther); extern int OnMetaAttach(); diff --git a/src/config.cpp b/src/config.cpp index 7eacc9f..7de626f 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -62,7 +62,7 @@ bool CConfig::Parse_Settings(const char *str, const char *value) cfg_effects = clamp(i, 0, 1); } else if (!strcasecmp(str, "team")) { - cfg_team = clamp(i, 0, 3); + cfg_team = clamp(i, SC_TEAM_ALL, SC_TEAM_TEAMMATE); } else if (!strcasecmp(str, "penetfire")) { cfg_penetfire = clamp(i, 0, 1); @@ -209,7 +209,7 @@ int Load_Config() g_Config.SetEnable(1); g_Config.SetTime(0.0f); - g_Config.SetTeam(3); + g_Config.SetTeam(SC_TEAM_TEAMMATE); g_Config.SetCrouch(0); g_Config.SetDistance(160.0f); g_Config.SetTransparency(100); diff --git a/src/main.cpp b/src/main.cpp index eef84f8..bfad457 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -285,11 +285,11 @@ inline bool allowDontSolid(playermove_t *pm, edict_t *pHost, int host, int j) int entTeamId = EntPlayer->m_iTeam; *pPlayer->GetDiff(pObject) = GET_DISTANCE(hostOrigin, entOrigin); - *pPlayer->GetSolid(pObject) = (hostTeamId == 3 + *pPlayer->GetSolid(pObject) = (hostTeamId == SPECTATOR || ((g_Config.GetEffects() || *pPlayer->GetDiff(pObject) < g_Config.GetDistance()) - && ((g_Config.GetTeam() == 0) ? 1 - : (g_Config.GetTeam() == 3) ? (hostTeamId == entTeamId) + && ((g_Config.GetTeam() == SC_TEAM_ALL) ? 1 + : (g_Config.GetTeam() == SC_TEAM_TEAMMATE) ? (CSGameRules()->PlayerRelationship(HostPlayer, EntPlayer) == GR_TEAMMATE) : (hostTeamId == g_Config.GetTeam() && entTeamId == g_Config.GetTeam())) && !pObject->GetDont())); @@ -428,8 +428,8 @@ void PM_Move(playermove_t *pm, int server) continue; } - if ((g_Config.GetTeam() == 0) ? 1 - : (g_Config.GetTeam() == 3) ? (hostTeamId == EntPlayer->m_iTeam) + if ((g_Config.GetTeam() == SC_TEAM_ALL) ? 1 + : (g_Config.GetTeam() == SC_TEAM_TEAMMATE) ? (CSGameRules()->PlayerRelationship(pCBasePlayer, EntPlayer) == GR_TEAMMATE) : (hostTeamId == g_Config.GetTeam() && EntPlayer->m_iTeam == g_Config.GetTeam())) { @@ -571,7 +571,7 @@ void SVR_SemiclipOption() g_RehldsHookchains->SV_CreatePacketEntities()->unregisterHook(&SV_CreatePacketEntities); g_RehldsHookchains->SV_CreatePacketEntities()->registerHook(&SV_CreatePacketEntities, HC_PRIORITY_HIGH); - + g_ReGameHookchains->CBasePlayer_Spawn()->unregisterHook(&CBasePlayer_Spawn); g_ReGameHookchains->CBasePlayer_Spawn()->registerHook(&CBasePlayer_Spawn, HC_PRIORITY_DEFAULT + 1); g_ReGameHookchains->CSGameRules_OnRoundFreezeEnd()->unregisterHook(&CSGameRules_OnRoundFreezeEnd);