From 6f4968442a8956acf479a2c2e35f1913ff4a016d Mon Sep 17 00:00:00 2001 From: div0 Date: Mon, 1 May 2006 09:00:07 +0000 Subject: [PATCH] g_balance_teams fixed and defaults to 0 again. If the team selection dialog disappeared for you, this is because of this commit. Change g_balance_teams to 0. git-svn-id: svn://svn.icculus.org/nexuiz/trunk@1355 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/default.cfg | 2 +- data/maps/campaign.txt | 18 +++++++++--------- data/qcsrc/server/gamec/bots.c | 24 ++++++------------------ data/qcsrc/server/gamec/campaign.c | 2 +- data/qcsrc/server/gamec/campaign.h | 4 ++++ data/qcsrc/server/gamec/cl_client.c | 17 ++++++++++------- data/qcsrc/server/gamec/clientcommands.c | 5 +++-- data/qcsrc/server/gamec/teamplay.c | 7 ++----- 8 files changed, 36 insertions(+), 43 deletions(-) diff --git a/data/default.cfg b/data/default.cfg index 513c91e82..16428e220 100644 --- a/data/default.cfg +++ b/data/default.cfg @@ -217,7 +217,7 @@ seta timelimit_maxovertime 5 set g_tdm 0 seta teamplay_default 3 // default teamplay setting in team games set deathmatch_force_teamplay 0 // always play TDM on dm maps -seta g_balance_teams 1 // automatically balance out players entering +seta g_balance_teams 0 // automatically balance out players entering instead of asking them for their preferred team seta g_balance_teams_force 0 // automatically balance out teams when players move or disconnect seta g_balance_teams_prevent_imbalance 0 // prevent players from changing to larger teams seta g_tdm_teams 2 // how many teams are in team deathmatch diff --git a/data/maps/campaign.txt b/data/maps/campaign.txt index 63e4b25f4..693deae66 100644 --- a/data/maps/campaign.txt +++ b/data/maps/campaign.txt @@ -3,22 +3,22 @@ dm_nexdm01 1 0 10 "" dm_nexdm05 2 0 10 "" "Downer" "What could be worse than one bot... TWO BOTS!" dm_nexdm08 2 1 10 "" "Glow Arena" "Yes, these things do glow. Do not forget to hit your enemies..." dm_nexdm06 3 1 10 "" "Starship" "Pink ZOMGWTFBBQ" -dm_nexdm03 3 2 10 "g_vampire 1" "The Slime Pit" "DO NOT go for a bath in there... and win FREE HEALTH by shooting enemies! (Vampire mutator)" -tdm_nexdm11 3 0 30 "" "Team DM on Toxic" "MORE GREEN STUFF! YEAH! And note: you have one teammate." -tdm_nexdm07 3 1 30 "" "Team DM on DSI" "Did you know? Team mates have a TEAM MATE bubble above their heads." +dm_nexdm03 3 2 10 "g_vampire 1" "The Slime Pit" "Note that slime does hurt. +++ Win FREE HEALTH by shooting enemies! (Vampire mutator)" +tdm_nexdm11 3 0 30 "" "Team DM on Toxic" "MORE GREEN STUFF! YEAH! +++ And note: you have one teammate." +tdm_nexdm07 3 1 30 "" "Team DM on DSI" "Did you know? +++ Team mates have a TEAM MATE bubble above their heads." dom_nexdm02 3 0 300 "" "Domination on Bleach" "Take and hold the control points. The more your team holds, the better you score." dom_nexdm04 3 1 300 "" "Domination on Skyway" "Find the following items: Rocket launcher, Megahealth, Strength." ctf_nexdm13 3 0 60 "" "CTF on Dismal" "Capture the Flag: take the enemy flag and bring it to your base, touching your flag. Prevent your enemy from doing the same." -ctf_nexctf01 3 1 60 "" "CTF on Basement" "This map is a variant of the first map you played. Hint: use the laser." +ctf_nexctf01 3 1 60 "" "CTF on Basement" "This map is a variant of the first map you played. +++ Note that defending this flag isn't easy." dm_nexdm14 2 -1 10 "g_minstagib 1" "MinstaGib on Soylent Space" "MinstaGib: all you have is a sniper gun with integrated laser. Use it." dm_nexdmextra1 1 1 10 "g_cloaked 1" "Cloaked DM on Q1Dm6 remake" "Watch out, everyone is partially invisible!" -dm_nexdm09 3 1 10 "g_nixnex 1" "NixNex DM on Aneurism" "No-items-Nexuiz: everyone has the same weapon as the others. Weapons are cycled in regular intervals." -dm_nexdm12 2 2 10 "g_rocketarena 1" "RL arena on Evil Space" "You will LOVE that." -dm_nexdm16 5 1 15 "g_grappling_hook 1" "Hook on Silver City" "Play with the grappling hook! (hint: default binding is E)" +dm_nexdm09 3 1 15 "g_nixnex 1" "NixNex DM on Aneurism" "No-items-Nexuiz: everyone has the same weapon as the others. Weapons are cycled in regular intervals." +dm_nexdm12 2 2 10 "g_rocketarena 1" "RL arena on Evil Space" "Just rocket launchers... +++ You will LOVE that." +dm_nexdm16 5 1 15 "g_grappling_hook 1" "Hook on Silver City" "Play with the grappling hook! +++ Hint: default binding is E." dm_nexdm10 5 0 15 "g_laserguided_missile 1; g_rocketarena 1" "LG missiles on StormKeep" "Laser guided missiles - toggle laser using altfire." dm_nexdm15 5 1 15 "" "Oilrig" "Bots... bots... bots..." dom_nexdm17 5 1 300 "" "Domination on Diesel Power" "Control points... control points... control points..." ctf_nexctf02 5 0 60 "" "CTF on Running Man" "Some larger CTF map. Will you find home?" -dm_nexdmextra2 1 1 10 "g_footsteps 1" "1on1 on Aggressor" "One player, one bot. Who will win? To make it easier, you can hear footsteps." +dm_nexdmextra2 1 1 10 "g_footsteps 1" "1on1 on Aggressor" "One on one. +++ Who will win? +++ To make it easier, you can hear footsteps." dm_nexdm18_1on1remix 1 2 10 "" "1on1 on Running Man" "Now how well will you do without footsteps?" -lms_nexdm19 3 3 9 "" "LMS on Blood Prison" "Last Man Standing: you have nine lives. Make something out of it!" +lms_nexdm19 3 3 9 "" "LMS on Blood Prison" "Last Man Standing: you have nine lives. +++ Make something out of it!" diff --git a/data/qcsrc/server/gamec/bots.c b/data/qcsrc/server/gamec/bots.c index 1a6f03425..9afa062f0 100644 --- a/data/qcsrc/server/gamec/bots.c +++ b/data/qcsrc/server/gamec/bots.c @@ -1597,6 +1597,12 @@ void() bot_think = //self.bot_painintensity = self.bot_painintensity + self.bot_oldhealth - self.health; //self.bot_painintensity = bound(0, self.bot_painintensity, 100); + if(cvar("g_campaign") && !campaign_bots_may_start) + { + self.nextthink = time + 0.5; + return; + } + if (self.fixangle) { self.v_angle = self.angles; @@ -1642,7 +1648,6 @@ void() bot_think = entity bot_strategytoken; entity player_list; .entity nextplayer; -.float was_playing; void() bot_relinkplayerlist = { local entity e; @@ -1655,23 +1660,6 @@ void() bot_relinkplayerlist = while (e) { player_count = player_count + 1; - if(cvar("g_campaign")) - { - // only count real players, no observers unless they have already - // played (for LMS!) - if(clienttype(e) == CLIENTTYPE_REAL) - { - if(e.classname == "player") - { - e.was_playing = 1; - } - else if(!e.was_playing) - { - // do not count him! - player_count = player_count - 1; - } - } - } e.nextplayer = e.chain; if (clienttype(e) == CLIENTTYPE_BOT) { diff --git a/data/qcsrc/server/gamec/campaign.c b/data/qcsrc/server/gamec/campaign.c index 333548df2..9bbbc5b8a 100644 --- a/data/qcsrc/server/gamec/campaign.c +++ b/data/qcsrc/server/gamec/campaign.c @@ -49,7 +49,7 @@ string Campaign_wordwrap(string s, float l) if(word == "+++") { t = fstrunzone(t); - t = strzone(strcat(t, "\n")); + t = strzone(strcat(t, "\n\n")); lleft = l; } else if(strlen(word) < lleft) diff --git a/data/qcsrc/server/gamec/campaign.h b/data/qcsrc/server/gamec/campaign.h index 3156d41ed..487deb982 100644 --- a/data/qcsrc/server/gamec/campaign.h +++ b/data/qcsrc/server/gamec/campaign.h @@ -9,3 +9,7 @@ void CampaignPreIntermission(); void CampaignPostIntermission(); // must change map void CampaignLevelWarp(float n); + +float campaign_bots_may_start; +// campaign mode: bots shall spawn but wait for the player to spawn before they do anything +// in other game modes, this is ignored diff --git a/data/qcsrc/server/gamec/cl_client.c b/data/qcsrc/server/gamec/cl_client.c index 48c46fed7..092684e7f 100644 --- a/data/qcsrc/server/gamec/cl_client.c +++ b/data/qcsrc/server/gamec/cl_client.c @@ -522,11 +522,6 @@ void PutClientInServer (void) } else if(self.classname == "observer") { PutObserverInServer (); } - - // in campaign mode, players are only counted once they are active. So - // update the counts NOW. - if(cvar("g_campaign")) - bot_relinkplayerlist(); } /* @@ -1346,9 +1341,13 @@ void PlayerPreThink (void) if (self.flags & FL_JUMPRELEASED) { if (self.button2 && self.version == cvar("gameversion")) { - if(!cvar("teamplay") || cvar("g_campaign")) { + if(!cvar("teamplay") || cvar("g_campaign") || cvar("g_balance_teams")) { self.flags = self.flags & !FL_JUMPRELEASED; self.classname = "player"; + if(cvar("g_campaign") || cvar("g_balance_teams")) + JoinBestTeam(self, 0); + if(cvar("g_campaign")) + campaign_bots_may_start = 1; PutClientInServer(); if(self.flags & !FL_NOTARGET) bprint (strcat("^4", self.netname, "^4 is playing now\n")); @@ -1375,12 +1374,16 @@ void PlayerPreThink (void) if (self.flags & FL_JUMPRELEASED) { if (self.button2 && self.version == cvar("gameversion")) { - if(!cvar("teamplay") || cvar("g_campaign")) { + if(!cvar("teamplay") || cvar("g_campaign") || cvar("g_balance_teams")) { self.flags = self.flags & !FL_JUMPRELEASED; self.classname = "player"; if(!cvar("g_lms")) bprint (strcat("^4", self.netname, "^4 is playing now\n")); + if(cvar("g_campaign") || cvar("g_balance_teams")) + JoinBestTeam(self, 0); + if(cvar("g_campaign")) + campaign_bots_may_start = 1; PutClientInServer(); centerprint(self,""); return; diff --git a/data/qcsrc/server/gamec/clientcommands.c b/data/qcsrc/server/gamec/clientcommands.c index 4a097de4a..03d8b4da5 100644 --- a/data/qcsrc/server/gamec/clientcommands.c +++ b/data/qcsrc/server/gamec/clientcommands.c @@ -199,8 +199,8 @@ void SV_ParseClientCommand(string s) { self.classname = "observer"; self.frags = -2; PutClientInServer(); - } else if(cvar("g_campaign")) { - JoinBestTeam(self, 0); + } else if(cvar("g_campaign") || cvar("g_balance_teams")) { + //JoinBestTeam(self, 0); } else if(cvar("teamplay") && !cvar("sv_spectate")) { self.classname = "observer"; stuffcmd(self,"menu_showteamselect\n"); @@ -237,6 +237,7 @@ void SV_ParseClientCommand(string s) { } else if( argv(1) == "yellow" ) { SV_ChangeTeam( COLOR_TEAM4 - 1 ); } else if( argv(1) == "auto" ) { + self.team = -1; JoinBestTeam( self, 0 ); } else { sprint( self, strcat( "selectteam none/red/blue/pink/yellow/auto - \"", argv(1), "\" not recognised\n" ) ); diff --git a/data/qcsrc/server/gamec/teamplay.c b/data/qcsrc/server/gamec/teamplay.c index dc1604810..d25641e27 100644 --- a/data/qcsrc/server/gamec/teamplay.c +++ b/data/qcsrc/server/gamec/teamplay.c @@ -610,11 +610,9 @@ float FindSmallestTeam(entity pl, float ignore_pl) // count how many players are in each team if(ignore_pl) - GetTeamCounts(world); - else GetTeamCounts(pl); - - + else + GetTeamCounts(world); // c1...c4 now have counts of each team // figure out which is smallest, giving priority to the team the player is already on as a tie-breaker @@ -694,7 +692,6 @@ float JoinBestTeam(entity pl, float only_return_best) // find out what teams are available CheckAllowedTeams(); - if(cvar("g_domination")) { if(cvar("g_domination_default_teams") < 3) -- 2.39.2