From ac46eb66c927d1d4c0c61f1ada5efe7fc847ac63 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sat, 4 Dec 2010 15:10:27 +0100 Subject: [PATCH] rename teamplay_default to teamplay_mode, stop using the "teamplay" cvar (more cleanup), use "teams_matter" where needed --- defaultXonotic.cfg | 2 +- qcsrc/client/View.qc | 2 +- qcsrc/common/constants.qh | 1 + qcsrc/server/autocvars.qh | 2 +- qcsrc/server/cl_client.qc | 3 -- qcsrc/server/ctf.qc | 5 -- qcsrc/server/domination.qc | 4 -- qcsrc/server/g_damage.qc | 8 ++-- qcsrc/server/miscfunctions.qc | 1 - qcsrc/server/monsters/mode_management.qc | 46 ++----------------- qcsrc/server/sv_main.qc | 5 -- qcsrc/server/teamplay.qc | 5 +- qcsrc/server/tturrets/system/system_damage.qc | 2 +- qcsrc/server/w_minelayer.qc | 4 +- qcsrc/server/w_rocketlauncher.qc | 4 +- 15 files changed, 17 insertions(+), 77 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 16b30d816..6ec248453 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -637,7 +637,7 @@ seta timelimit_suddendeath 5 "number of minutes suddendeath mode lasts after all // common team values set g_tdm 0 "Team Deathmatch: the team who kills their opponents most often wins" -seta teamplay_default 4 "default teamplay setting in team games. 1 = no friendly fire, self damage. 2 = friendly fire and self damage enabled. 3 = no friendly fire, but self damage enabled. 4 = obey the following four cvars" +seta teamplay_mode 4 "default teamplay setting in team games. 1 = no friendly fire, self damage. 2 = friendly fire and self damage enabled. 3 = no friendly fire, but self damage enabled. 4 = obey the following four cvars" seta g_mirrordamage 0.300000 "for teamplay 4: mirror damage factor" seta g_friendlyfire 0.100000 "for teamplay 4: fiendly fire factor" seta g_teamdamage_threshold 50 "for teamplay 4: threshold over which to apply mirror damage" diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 3f8cd6c71..e640e906d 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -479,7 +479,7 @@ void CSQC_UpdateView(float w, float h) ColorTranslateMode = cvar("cl_stripcolorcodes"); activeweapon = getstati(STAT_SWITCHWEAPON); - f = cvar("teamplay"); + f = (serverflags & SERVERFLAG_TEAMPLAY); if(f != teamplay) { teamplay = f; diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index b3929c7cd..50abe9875 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -660,3 +660,4 @@ string HUD_PANELNAME_INFOMESSAGES = "infomessages"; float HUD_MENU_ENABLE = 0; #define SERVERFLAG_ALLOW_FULLBRIGHT 1 +#define SERVERFLAG_TEAMPLAY 2 diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index 6d79ebe30..a9c523353 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -1,4 +1,4 @@ float autocvar_sv_cheats; float autocvar_g_bastet; -float autocvar_teamplay; +float autocvar_teamplay_mode; var float autocvar_g_movement_highspeed = 1; diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 173ef2306..3a416375b 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -1619,9 +1619,6 @@ void ClientConnect (void) // get other cvars from player GetCvars(0); - // set cvar for team scoreboard - stuffcmd(self, strcat("set teamplay ", ftos(autocvar_teamplay), "\n")); - // notify about available teams if(teams_matter) { diff --git a/qcsrc/server/ctf.qc b/qcsrc/server/ctf.qc index a6d31ca57..4bc47b9a2 100644 --- a/qcsrc/server/ctf.qc +++ b/qcsrc/server/ctf.qc @@ -775,9 +775,6 @@ void spawnfunc_item_flag_team1() return; } - //if(!cvar("teamplay")) - // cvar_set("teamplay", "3"); - // link flag into ctf_worldflaglist self.ctf_worldflagnext = ctf_worldflaglist; ctf_worldflaglist = self; @@ -875,8 +872,6 @@ void spawnfunc_item_flag_team2() remove(self); return; } - //if(!cvar("teamplay")) - // cvar_set("teamplay", "3"); // link flag into ctf_worldflaglist self.ctf_worldflagnext = ctf_worldflaglist; diff --git a/qcsrc/server/domination.qc b/qcsrc/server/domination.qc index 9742da1ec..10fc2a1ab 100644 --- a/qcsrc/server/domination.qc +++ b/qcsrc/server/domination.qc @@ -648,9 +648,5 @@ void dom_init() precache_model("models/domination/dom_unclaimed.md3"); precache_sound("domination/claim.wav"); InitializeEntity(world, dom_delayedinit, INITPRIO_GAMETYPE); - - // teamplay is always on in domination, defaults to hurt self but not teammates - //if(!teams_matter) - // cvar_set("teamplay", "3"); }; diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 3bec2ebc8..8998c6afb 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -537,15 +537,15 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float damage = 0; force = '0 0 0'; } - else if(attacker.team == targ.team) + else if(teams_matter && attacker.team == targ.team) { - if(autocvar_teamplay == 1) + if(autocvar_teamplay_mode == 1) damage = 0; else if(attacker != targ) { - if(autocvar_teamplay == 3) + if(autocvar_teamplay_mode == 3) damage = 0; - else if(autocvar_teamplay == 4) + else if(autocvar_teamplay_mode == 4) { if(targ.classname == "player" && targ.deadflag == DEAD_NO) { diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index a5b33acf7..fa054c1f9 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -1171,7 +1171,6 @@ void readlevelcvars(void) if(cvar("g_vampire")) MUTATOR_ADD(mutator_vampire); - serverflags = 0; if(cvar("sv_allow_fullbright")) serverflags |= SERVERFLAG_ALLOW_FULLBRIGHT; diff --git a/qcsrc/server/monsters/mode_management.qc b/qcsrc/server/monsters/mode_management.qc index 9014f0938..daaa76f61 100644 --- a/qcsrc/server/monsters/mode_management.qc +++ b/qcsrc/server/monsters/mode_management.qc @@ -163,57 +163,17 @@ string dmmessage; void(string m) setdm = { - dmmessage = m; - if (cvar("deathmatch") != stof(m)) - cvar_set("deathmatch", m); + error("THIS MUST NOT BE CALLED IN XONOTIC"); } void(string m) setteamplay = { - dmmessage = m; - if (cvar("teamplay") != stof(m)) - cvar_set("teamplay", m); + error("THIS MUST NOT BE CALLED IN XONOTIC"); } void() mode_updatecvars = { - local float dm, tp; - dm = cvar("deathmatch"); - tp = cvar("teamplay"); - // now set deathmatch cvar - if (dm == 0) setdm("0?Dark Places - Coop"); - else if (dm == 1) setdm("1?Dark Places - Deathmatch"); - else if (dm == 2) setdm("2?Dark Places - Deathmatch 2 (can only pickup gun once)"); - else if (dm == 3) setdm("3?Dark Places - Deathmatch 3 (quick ammo respawn)"); - else if (dm == 5) setdm("5?Dark Places - Frag Fest (spawn with full pack)"); -// else if (dm == 6) setdm("6?Dark Places - Random Weapons (spawn with 2 random weapons)"); // removed - else if (dm == 7) setdm("7?Dark Places - Monsters"); -// else if (dm == 8) setdm("8?Dark Places - Elimination"); -// else if (dm == 9) setdm("9?Dark Places - Kill The Leader Mode"); - else if (dm == 10) setdm("10?Dark Places - Capture The Flag - 2 Team"); - else if (dm == 11) setdm("11?Dark Places - Capture The Flag - 3 Team"); - else if (dm == 12) setdm("12?Dark Places - Domination"); - else if (dm == 13) setdm("13?Dark Places - Monster Capture The Flag - 2 Team"); - else if (dm == 14) setdm("14?Dark Places - Super Domination"); - else if (dm == 30) setdm("30?Dark Places - Role Playing Game"); - else setdm("1?Dark Places - Deathmatch"); - - // now set teamplay cvar - if (dm == 0) setteamplay("4?Dark Places - Coop (Can't hurt other players)"); - //else if (dm == 8) setteamplay("3?Dark Places - Elimination"); - //else if (dm == 9) setteamplay("3?Dark Places - Kill The Leader"); - else if (dm == 10) setteamplay("3?Dark Places - Capture The Flag - 2 Team"); - else if (dm == 11) setteamplay("3?Dark Places - Capture The Flag - 3 Team"); - else if (dm == 12) setteamplay("3?Dark Places - Domination"); - else if (dm == 13) setteamplay("3?Dark Places - Monster Capture The Flag - 2 Team"); - else - { - if (tp == 0) setteamplay("0?Dark Places - No Teamplay"); - else if (tp == 1) setteamplay("1?Dark Places - No team damage"); - else if (tp == 2) setteamplay("2?Dark Places - Can hurt anyone"); - else if (tp == 3) setteamplay("3?Dark Places - No team damage, but can hurt self"); - else setteamplay("0?Dark Places - No Teamplay"); - } + error("THIS MUST NOT BE CALLED IN XONOTIC"); }; float nextcvarupdate; diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index aef4031b7..0a170635b 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -182,11 +182,6 @@ void StartFrame (void) if (timeoutStatus == 1) // just before the timeout (when timeoutStatus will be 2) orig_slowmo = cvar("slowmo"); // slowmo will be restored after the timeout - if(teams_matter && !autocvar_teamplay) - cvar_set("teamplay", "3"); // this also updates the autocvar - if(!teams_matter && autocvar_teamplay) - cvar_set("teamplay", "0"); // this also updates the autocvar - skill = cvar("skill"); Spawnqueue_Check(); diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index d7a73f7d6..b001e4a4a 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -162,9 +162,7 @@ void ActivateTeamplay() { float teamplay_default; - teamplay_default = cvar_or("teamplay_default", 3); - cvar_set("teamplay", teamplay_default); - + serverflags |= SERVERFLAG_TEAMPLAY; teams_matter = 1; } @@ -177,7 +175,6 @@ void InitGameplayMode() VoteReset(); teams_matter = 0; - cvar_set("teamplay", "0"); // make sure only ONE type is selected ReadGameCvars(); diff --git a/qcsrc/server/tturrets/system/system_damage.qc b/qcsrc/server/tturrets/system/system_damage.qc index 4e9c8a762..fdeb4dd5c 100644 --- a/qcsrc/server/tturrets/system/system_damage.qc +++ b/qcsrc/server/tturrets/system/system_damage.qc @@ -269,7 +269,7 @@ void turret_stdproc_damage (entity inflictor, entity attacker, float damage, flo if not (self.tur_active) return; - if (autocvar_teamplay != 0) + if (teams_matter) if (self.team == attacker.team) { // This does not happen anymore. Re-enable if you fix that. diff --git a/qcsrc/server/w_minelayer.qc b/qcsrc/server/w_minelayer.qc index 8e0548ecf..225fa5eba 100644 --- a/qcsrc/server/w_minelayer.qc +++ b/qcsrc/server/w_minelayer.qc @@ -314,9 +314,9 @@ float w_minelayer(float req) } float desirabledamage; desirabledamage = enemydamage; - if (autocvar_teamplay != 1 && time > self.invincible_finished && time > self.spawnshieldtime) + if (time > self.invincible_finished && time > self.spawnshieldtime) desirabledamage = desirabledamage - selfdamage * cvar("g_balance_selfdamagepercent"); - if (self.team && autocvar_teamplay != 1) + if (teams_matter && self.team) desirabledamage = desirabledamage - teamdamage; mine = find(world, classname, "mine"); diff --git a/qcsrc/server/w_rocketlauncher.qc b/qcsrc/server/w_rocketlauncher.qc index 9efd46d79..969f54bdb 100644 --- a/qcsrc/server/w_rocketlauncher.qc +++ b/qcsrc/server/w_rocketlauncher.qc @@ -349,9 +349,9 @@ float w_rlauncher(float req) } local float desirabledamage; desirabledamage = enemydamage; - if (autocvar_teamplay != 1 && time > self.invincible_finished && time > self.spawnshieldtime) + if (time > self.invincible_finished && time > self.spawnshieldtime) desirabledamage = desirabledamage - selfdamage * cvar("g_balance_selfdamagepercent"); - if (self.team && autocvar_teamplay != 1) + if (teams_matter && self.team) desirabledamage = desirabledamage - teamdamage; missile = find(world, classname, "rocket"); -- 2.39.2