r4181 - in branches/nexuiz-2.0: . data/qcsrc/client data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Aug 25 04:27:52 EDT 2008


Author: div0
Date: 2008-08-25 04:27:50 -0400 (Mon, 25 Aug 2008)
New Revision: 4181

Modified:
   branches/nexuiz-2.0/.patchsets
   branches/nexuiz-2.0/data/qcsrc/client/hook.qc
   branches/nexuiz-2.0/data/qcsrc/client/sbar.qc
   branches/nexuiz-2.0/data/qcsrc/server/defs.qh
   branches/nexuiz-2.0/data/qcsrc/server/g_world.qc
   branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc
   branches/nexuiz-2.0/data/qcsrc/server/teamplay.qc
Log:
r4177 | div0 | 2008-08-25 08:35:52 +0200 (Mon, 25 Aug 2008) | 5 lines
major cleanup of game type loading (closes some bug on SF)
new feature: if multiple game type cvars are set, the one NOT matching the last game is used
makes "g_ctf 1; changelevel dismal" work no matter what other game type cvars are set
gamecfg cvar is no longer used for switching game types, bot for AVOIDING one (nobody used that anyway); it now always contains the CURRENT game type
r4178 | div0 | 2008-08-25 08:48:03 +0200 (Mon, 25 Aug 2008) | 2 lines
proper mmsss display for fraglimit
r4179 | div0 | 2008-08-25 08:53:58 +0200 (Mon, 25 Aug 2008) | 2 lines
support fraglimit in qualifying-then-race too
r4180 | div0 | 2008-08-25 09:23:38 +0200 (Mon, 25 Aug 2008) | 2 lines
improve the stupid workaround path for the hook drawing

Modified: branches/nexuiz-2.0/.patchsets
===================================================================
--- branches/nexuiz-2.0/.patchsets	2008-08-25 07:23:38 UTC (rev 4180)
+++ branches/nexuiz-2.0/.patchsets	2008-08-25 08:27:50 UTC (rev 4181)
@@ -1,2 +1,2 @@
 master = svn://svn.icculus.org/nexuiz/trunk
-revisions_applied = 1-4175
+revisions_applied = 1-4180

Modified: branches/nexuiz-2.0/data/qcsrc/client/hook.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/client/hook.qc	2008-08-25 07:23:38 UTC (rev 4180)
+++ branches/nexuiz-2.0/data/qcsrc/client/hook.qc	2008-08-25 08:27:50 UTC (rev 4181)
@@ -51,10 +51,7 @@
 	C = to + thickdir * (thickness / 2);
 	D = to - thickdir * (thickness / 2);
 
-	if(checkextension("DP_SV_WRITEPICTURE"))
-		R_BeginPolygon(texture, 0);
-	else
-		R_BeginPolygon("", 0);
+	R_BeginPolygon(texture, 0);
 	R_PolygonVertex(A, '0 0 0' + t * '1 0 0', rgb, 1);
 	R_PolygonVertex(B, '0 1 0' + t * '1 0 0', rgb, 1);
 	R_PolygonVertex(C, '0 1 0' + (t + length_tex) * '1 0 0', rgb, 1);
@@ -68,6 +65,7 @@
 	vector a, b, o;
 	entity e;
 	string tex;
+	vector rgb;
 
 	o = pmove_org + '0 0 1' * getstati(STAT_VIEWHEIGHT);
 	makevectors(input_angles);
@@ -85,15 +83,33 @@
 			a = e.HookStart;
 		b = e.HookEnd;
 		if(e.team == COLOR_TEAM1)
+		{
 			tex = "particles/hook_red";
+			rgb = '1 .3 .3';
+		}
 		else if(e.team == COLOR_TEAM2)
+		{
 			tex = "particles/hook_blue";
+			rgb = '.3 .3 1';
+		}
 		else if(e.team == COLOR_TEAM3)
+		{
 			tex = "particles/hook_yellow";
+			rgb = '1 1 .3';
+		}
 		else if(e.team == COLOR_TEAM4)
+		{
 			tex = "particles/hook_pink";
+			rgb = '1 .3 1';
+		}
 		else
+		{
 			tex = "particles/hook_green";
-		Draw_GrapplingHookLine(b, a, 8, o, v_forward, tex, 0.25, '1 1 1');
+			rgb = '.3 1 .3';
+		}
+		if(checkextension("DP_SV_WRITEPICTURE"))
+			Draw_GrapplingHookLine(b, a, 8, o, v_forward, tex, 0.25, '1 1 1');
+		else
+			Draw_GrapplingHookLine(b, a, 1, o, v_forward, "", 0.25, rgb);
 	}
 }

Modified: branches/nexuiz-2.0/data/qcsrc/client/sbar.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/client/sbar.qc	2008-08-25 07:23:38 UTC (rev 4180)
+++ branches/nexuiz-2.0/data/qcsrc/client/sbar.qc	2008-08-25 08:27:50 UTC (rev 4181)
@@ -892,9 +892,11 @@
 		{
 			if(tl > 0)
 				str = strcat(str, " or");
-			str = strcat(str, " until ^3", ftos(fl));
+			str = strcat(str, " until ^3", ScoreString(scores_flags[ps_primary], fl));
 			if(scores_label[ps_primary] == "score")
 				str = strcat(str, " points^7");
+			else if(scores_label[ps_primary] == "fastest")
+				str = strcat(str, " is beaten^7");
 			else
 				str = strcat(str, " ", scores_label[ps_primary]);
 		}

Modified: branches/nexuiz-2.0/data/qcsrc/server/defs.qh
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/defs.qh	2008-08-25 07:23:38 UTC (rev 4180)
+++ branches/nexuiz-2.0/data/qcsrc/server/defs.qh	2008-08-25 08:27:50 UTC (rev 4181)
@@ -15,7 +15,7 @@
 
 // Globals
 
-float g_domination, g_ctf, g_tdm, g_keyhunt, g_onslaught, g_assault, g_arena, g_lms, g_runematch, g_race;
+float g_dm, g_domination, g_ctf, g_tdm, g_keyhunt, g_onslaught, g_assault, g_arena, g_lms, g_runematch, g_race;
 float g_cloaked, g_footsteps, g_jump_grunt, g_grappling_hook, g_instagib, g_laserguided_missile, g_midair, g_minstagib, g_nixnex, g_nixnex_with_laser, g_norecoil, g_rocketarena, g_vampire, g_minstagib_invis_alpha;
 float g_tourney;
 float g_ctf_win_mode;

Modified: branches/nexuiz-2.0/data/qcsrc/server/g_world.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/g_world.qc	2008-08-25 07:23:38 UTC (rev 4180)
+++ branches/nexuiz-2.0/data/qcsrc/server/g_world.qc	2008-08-25 08:27:50 UTC (rev 4181)
@@ -187,12 +187,6 @@
 	if(GotoFirstMap())
 		return;
 
-#ifdef MAPINFO
-	MapInfo_LoadMapSettings(mapname);
-	clientstuff = strzone(MapInfo_Map_clientstuff);
-	MapInfo_ClearTemps();
-#endif
-
 	if(sv_cheats)
 		ServerProgsDB = db_create();
 	else
@@ -248,24 +242,22 @@
 	// 63 testing
 	lightstyle(63, "a");
 
-	// for setting by mapinfo
-	q3acompat_machineshotgunswap = cvar("sv_q3acompat_machineshotgunswap");
-	cvar_set("sv_q3acompat_machineshotgunswap", "0");
+	if(cvar("g_campaign"))
+		CampaignPreInit();
 
-	player_count = 0;
-	lms_lowest_lives = 0;
-	lms_next_place = 0;
+	InitGameplayMode();
+	readlevelcvars();
 
+	player_count = 0;
 	bot_waypoints_for_items = cvar("g_waypoints_for_items");
 	if(bot_waypoints_for_items == 1)
 		if(self.spawnflags & SPAWNFLAG_NO_WAYPOINTS_FOR_ITEMS)
 			bot_waypoints_for_items = 0;
 
-	if(cvar("g_campaign"))
-		CampaignPreInit();
+	// for setting by mapinfo
+	q3acompat_machineshotgunswap = cvar("sv_q3acompat_machineshotgunswap");
+	cvar_set("sv_q3acompat_machineshotgunswap", "0");
 
-	readlevelcvars();
-	InitGameplayMode();
 	precache();
 
 	WaypointSprite_Init();
@@ -1536,10 +1528,10 @@
 }
 
 void ReadyRestart();
-float WinningCondition_QualifyingThenRace()
+float WinningCondition_QualifyingThenRace(float limit)
 {
 	float wc;
-	wc = WinningCondition_Scores(0);
+	wc = WinningCondition_Scores(limit);
 
 	// NEVER initiate overtime
 	if(wc == WINNING_YES || wc == WINNING_STARTOVERTIME)
@@ -1719,7 +1711,7 @@
 	}
 	else if(g_race && g_race_qualifying == 2 && timelimit >= 0)
 	{
-		status = WinningCondition_QualifyingThenRace();
+		status = WinningCondition_QualifyingThenRace(fraglimit);
 	}
 	else if(g_assault)
 	{

Modified: branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc	2008-08-25 07:23:38 UTC (rev 4180)
+++ branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc	2008-08-25 08:27:50 UTC (rev 4181)
@@ -732,9 +732,11 @@
 	sv_maxidle_spectatorsareidle = cvar("sv_maxidle_spectatorsareidle");
 	sv_pogostick = cvar("sv_pogostick");
 	sv_doublejump = cvar("sv_doublejump");
-	g_ctf_win_mode = cvar("g_ctf_win_mode");
-	g_race_qualifying = cvar("g_race_qualifying");
 
+	if(g_instagib) g_minstagib = g_nixnex = g_rocketarena = 0;
+	if(g_minstagib) g_nixnex = g_rocketarena = 0;
+	if(g_nixnex) g_rocketarena = 0;
+
 	g_pickup_shells                    = cvar("g_pickup_shells");
 	g_pickup_shells_max                = cvar("g_pickup_shells_max");
 	g_pickup_nails                     = cvar("g_pickup_nails");

Modified: branches/nexuiz-2.0/data/qcsrc/server/teamplay.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/teamplay.qc	2008-08-25 07:23:38 UTC (rev 4180)
+++ branches/nexuiz-2.0/data/qcsrc/server/teamplay.qc	2008-08-25 08:27:50 UTC (rev 4181)
@@ -85,22 +85,61 @@
 	GameLogEcho(str, FALSE);
 }
 
-void ResetGameCvars()
+void WriteGameCvars()
 {
-	cvar_set("g_dm", "0");
-	cvar_set("g_tdm", "0");
-	cvar_set("g_domination", "0");
-	cvar_set("g_ctf", "0");
-	cvar_set("g_runematch", "0");
-	cvar_set("g_lms", "0");
-	cvar_set("g_arena", "0");
-	cvar_set("g_keyhunt", "0");
-	cvar_set("g_assault", "0");
-	cvar_set("g_onslaught", "0");
-	cvar_set("g_race", "0");
-	cvar_set("teamplay", "0");
+	cvar_set("g_dm", ftos(g_dm));
+	cvar_set("g_tdm", ftos(g_tdm));
+	cvar_set("g_domination", ftos(g_domination));
+	cvar_set("g_ctf", ftos(g_ctf));
+	cvar_set("g_runematch", ftos(g_runematch));
+	cvar_set("g_lms", ftos(g_lms));
+	cvar_set("g_arena", ftos(g_arena));
+	cvar_set("g_keyhunt", ftos(g_keyhunt));
+	cvar_set("g_assault", ftos(g_assault));
+	cvar_set("g_onslaught", ftos(g_onslaught));
+	cvar_set("g_race", ftos(g_race));
 }
 
+void ReadGameCvars()
+{
+	float found;
+	float prev;
+	float i;
+
+	found = 0;
+	prev = cvar("gamecfg");
+	for(i = 0; i < 2; ++i)
+	{
+		found += (g_dm = (!found && (prev != GAME_DEATHMATCH) && cvar("g_dm")));
+		found += (g_tdm = (!found && (prev != GAME_TEAM_DEATHMATCH) && cvar("g_tdm")));
+		found += (g_domination = (!found && (prev != GAME_DOMINATION) && cvar("g_domination")));
+		found += (g_ctf = (!found && (prev != GAME_CTF) && cvar("g_ctf")));
+		found += (g_runematch = (!found && (prev != GAME_RUNEMATCH) && cvar("g_runematch")));
+		found += (g_lms = (!found && (prev != GAME_LMS) && cvar("g_lms")));
+		found += (g_arena = (!found && (prev != GAME_ARENA) && cvar("g_arena")));
+		found += (g_keyhunt = (!found && (prev != GAME_KEYHUNT) && cvar("g_keyhunt")));
+		found += (g_assault = (!found && (prev != GAME_ASSAULT) && cvar("g_assault")));
+		found += (g_onslaught = (!found && (prev != GAME_ONSLAUGHT) && cvar("g_onslaught")));
+		found += (g_race = (!found && (prev != GAME_RACE) && cvar("g_race")));
+
+		if(found)
+			break;
+
+		prev = -1; // second attempt takes place WITHOUT prev set
+	}
+
+	if(!found)
+		g_dm = 1;
+
+	if(g_dm && cvar("deathmatch_force_teamplay"))
+	{
+		g_dm = 0;
+		g_tdm = 1;
+	}
+
+	teams_matter = 0;
+}
+
 void default_delayedinit()
 {
 	remove(self);
@@ -118,6 +157,8 @@
 		cvar_set("teamplay", ftos(teamplay_default));
 	else
 		cvar_set("teamplay", "3");
+
+	teams_matter = 1;
 }
 
 void InitGameplayMode()
@@ -125,217 +166,158 @@
 	float fraglimit_override, timelimit_override, capturelimit_override;
 
 	VoteReset();
+	
+	teams_matter = 0;
+	cvar_set("teamplay", "0");
 
-	game = cvar("gamecfg");	// load game options
+	// make sure only ONE type is selected
+	ReadGameCvars();
+	WriteGameCvars();
 
-	// game cvars get reset before map changes
-	// then map's cfg sets them as desired
+#ifdef MAPINFO
+	MapInfo_LoadMapSettings(mapname);
+	clientstuff = strzone(MapInfo_Map_clientstuff);
+	MapInfo_ClearTemps();
 
-	// FIXME: also set a message or game mode name to print to players when the join
+	// in case mapinfo switched the type
+	ReadGameCvars();
+#endif
 
 	// set both here, gamemode can override it later
 	timelimit_override = cvar("timelimit_override");
 	fraglimit_override = cvar("fraglimit_override");
-	capturelimit_override = cvar("capturelimit_override");
 
-	if(game == GAME_DOMINATION || cvar("g_domination"))
+	if(g_dm)
 	{
-		ResetGameCvars();
-		game = GAME_DOMINATION;
-		cvar_set("g_domination", "1");
+		game = GAME_DEATHMATCH;
+		gamemode_name = "Deathmatch";
+	}
 
+	if(g_tdm)
+	{
+		game = GAME_TEAM_DEATHMATCH;
+		gamemode_name = "Team Deathmatch";
 		ActivateTeamplay();
+		tdm_init();
+	}
 
-		fraglimit_override = cvar("g_domination_point_limit");
-
+	if(g_domination)
+	{
+		game = GAME_DOMINATION;
 		gamemode_name = "Domination";
-		teams_matter = 1;
+		ActivateTeamplay();
+		fraglimit_override = cvar("g_domination_point_limit");
+		dom_init();
 	}
-	else if(game == GAME_CTF || cvar("g_ctf"))
+
+	if(g_ctf)
 	{
-		ResetGameCvars();
 		game = GAME_CTF;
-		cvar_set("g_ctf", "1");
-
-		ActivateTeamplay();
-
-		fraglimit_override = cvar("g_ctf_capture_limit");
-		//no capture limit override here
-
 		gamemode_name = "Capture the Flag";
-		teams_matter = 1;
+		ActivateTeamplay();
+		g_ctf_win_mode = cvar("g_ctf_win_mode");
+		if(g_ctf_win_mode == 2)
+			fraglimit_override = cvar("g_ctf_capture_limit");
+		else
+			fraglimit_override = cvar("capturelimit_override");
+		ctf_init();
 	}
-	else if(game == GAME_RUNEMATCH || cvar("g_runematch"))
+
+	if(g_runematch)
 	{
 		game = GAME_RUNEMATCH;
-		cvar_set("g_runematch", "1");
-		cvar_set("g_minstagib", "0");
-
+		gamemode_name = "Rune Match";
 		if(cvar("deathmatch_force_teamplay"))
 			ActivateTeamplay();
-
 		fraglimit_override = cvar("g_runematch_point_limit");
-
-		gamemode_name = "Rune Match";
-		if(cvar("teamplay"))
-			teams_matter = 1;
-		else
-			teams_matter = 0;
+		runematch_init();
 	}
-	else if(game == GAME_DEATHMATCH || game == GAME_TEAM_DEATHMATCH || cvar("g_tdm"))
-	{
-		if(!cvar("deathmatch"))
-			cvar_set("deathmatch", "1");
 
-
-		if(game == GAME_TEAM_DEATHMATCH || cvar("g_tdm") || cvar("deathmatch_force_teamplay"))
-		{
-			ResetGameCvars();
-			game = GAME_TEAM_DEATHMATCH;
-			gamemode_name = "Team Deathmatch";
-			ActivateTeamplay();
-			teams_matter = 1;
-			cvar_set("g_tdm", "1");
-		}
-		else
-		{
-			ResetGameCvars();
-			game = GAME_DEATHMATCH;
-			gamemode_name = "Deathmatch";
-			teams_matter = 0;
-		}
-
-		fraglimit_override = cvar("fraglimit_override");
-	}
-	else if(game == GAME_ASSAULT || cvar("g_assault"))
+	if(g_lms)
 	{
-		ResetGameCvars();
-		game = GAME_ASSAULT;
-		gamemode_name = "Assault";
-		ActivateTeamplay();
-		teams_matter = 1;
-		cvar_set("g_assault", "1");
-	}
-	else if(game == GAME_LMS || cvar("g_lms"))
-	{
-		ResetGameCvars();
 		game = GAME_LMS;
-		cvar_set("g_lms", "1");
+		gamemode_name = "Last Man Standing";
 		fraglimit_override = cvar("g_lms_lives_override");
 		if(fraglimit_override == 0)
 			fraglimit_override = -1;
-		gamemode_name = "Last Man Standing";
-		teams_matter = 0;
 		lms_lowest_lives = 9999;
-
+		lms_next_place = 0;
 		ScoreRules_lms();
 	}
-	else if(game == GAME_ARENA || cvar("g_arena"))
+
+	if(g_arena)
 	{
-		ResetGameCvars();
 		game = GAME_ARENA;
-		cvar_set("g_arena", "1");
+		gamemode_name = "Arena";
 		fraglimit_override = cvar("g_arena_point_limit");
 		maxspawned = cvar("g_arena_maxspawned");
 		if(maxspawned < 2)
 			maxspawned = 2;
 		arena_roundbased = cvar("g_arena_roundbased");
-		gamemode_name = "Arena";
-		teams_matter = 0;
 	}
-	else if(game == GAME_KEYHUNT || cvar("g_keyhunt"))
+
+	if(g_keyhunt)
 	{
-		ResetGameCvars();
 		game = GAME_KEYHUNT;
-		cvar_set("g_keyhunt", "1");
-		fraglimit_override = cvar("g_keyhunt_point_limit");
-		ActivateTeamplay();
 		gamemode_name = "Key Hunt";
-		teams_matter = 1;
+		ActivateTeamplay();
+		fraglimit_override = cvar("g_keyhunt_point_limit");
+		kh_init();
 	}
-	else if(game == GAME_ONSLAUGHT || cvar("g_onslaught"))
-	{
-		ResetGameCvars();
-		game = GAME_ONSLAUGHT;
-		cvar_set("g_onslaught", "1");
 
+	if(g_assault)
+	{
+		game = GAME_ASSAULT;
+		gamemode_name = "Assault";
 		ActivateTeamplay();
+	}
 
+	if(g_onslaught)
+	{
+		game = GAME_ONSLAUGHT;
 		gamemode_name = "Onslaught";
-		teams_matter = 1;
+		ActivateTeamplay();
+		entcs_init();
 	}
-	else if(game == GAME_RACE || cvar("g_race"))
+
+	if(g_race)
 	{
-		ResetGameCvars();
 		game = GAME_RACE;
-		cvar_set("g_race", "1");
-		fraglimit_override = cvar("g_race_laps_limit");
 		gamemode_name = "Race";
+		g_race_qualifying = cvar("g_race_qualifying");
 
+		// In campaign, only this mode makes sense...
+		if(cvar("g_campaign"))
+			g_race_qualifying = 1;
+
 		if(cvar("g_race_teams"))
 		{
 			g_race_qualifying = 0; // not supported!
 			ActivateTeamplay();
-			teams_matter = 1;
 			race_teams = bound(2, cvar("g_race_teams"), 4);
 		}
 		else
-		{
 			race_teams = 0;
-			teams_matter = 0;
-			if(cvar("g_race_qualifying"))
-				independent_players = 1;
-		}
 
+		if(g_race_qualifying == 1)
+			fraglimit_override = 0;
+		else
+			fraglimit_override = cvar("g_race_laps_limit");
+
+		if(g_race_qualifying)
+			independent_players = 1;
+
 		ScoreRules_race();
 	}
-	else
-	{
-		// we can only assume...
-		ResetGameCvars();
-		game = GAME_DEATHMATCH;
-		cvar_set("g_dm", "1");
-		gamemode_name = "Deathmatch";
-		teams_matter = 0;
-	}
 
-	// those mutators rule each other out
-	if(cvar("g_minstagib"))
-	{
-		cvar_set("g_instagib", "0");
-		cvar_set("g_rocketarena", "0");
-	}
-	if(cvar("g_instagib"))
-	{
-		cvar_set("g_minstagib", "0");
-		cvar_set("g_rocketarena", "0");
-	}
-	if(cvar("g_rocketarena"))
-	{
-		cvar_set("g_instagib", "0");
-		cvar_set("g_minstagib", "0");
-	}
+	// save it (for the next startup)
+	cvar_set("gamecfg", ftos(game));
 
-	g_domination = cvar("g_domination");
-	g_ctf = cvar("g_ctf");
-	g_lms = cvar("g_lms");
-	g_tdm = cvar("g_tdm");
-	g_runematch = cvar("g_runematch");
-	g_keyhunt = cvar("g_keyhunt");
-	g_onslaught = cvar("g_onslaught");
-	g_assault = cvar("g_assault");
-	g_race = cvar("g_race");
-	g_arena = cvar("g_arena");
-
 	cache_mutatormsg = strzone("");
 	cache_motd = strzone("");
 	cache_lastmutatormsg = strzone("");
 	cache_lastmotd = strzone("");
 
-	if(g_ctf)
-		if(g_ctf_win_mode != 2)
-			fraglimit_override = capturelimit_override;
-
 	// enforce the server's universal frag/time limits
 	if(!cvar("g_campaign"))
 	{
@@ -345,25 +327,12 @@
 			cvar_set("timelimit", ftos(timelimit_override));
 	}
 
-	if(g_race && g_race_qualifying)
+	if(g_race && g_race_qualifying == 2)
 	{
 		race_fraglimit = cvar("fraglimit");
 		cvar_set("fraglimit", "0");
 	}
 
-	if (game == GAME_DOMINATION)//cvar("g_domination"))
-		dom_init();
-	else if (game == GAME_CTF)//cvar("g_ctf"))
-		ctf_init();
-	else if (game == GAME_RUNEMATCH)//cvar("g_runematch"))
-		runematch_init();
-	else if (game == GAME_TEAM_DEATHMATCH)//cvar("g_runematch"))
-		tdm_init();
-	else if (game == GAME_KEYHUNT)//cvar("g_keyhunt"))
-		kh_init();
-	else if (game == GAME_ONSLAUGHT)
-		entcs_init();
-
 	entity e;
 	e = spawn();
 	e.nextthink = time + 0.3; // MUST be after all other delayed inits!




More information about the nexuiz-commits mailing list