r3691 - in trunk/data: . qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Jun 7 05:05:42 EDT 2008


Author: div0
Date: 2008-06-07 05:05:27 -0400 (Sat, 07 Jun 2008)
New Revision: 3691

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/server/defs.qh
   trunk/data/qcsrc/server/g_world.qc
   trunk/data/qcsrc/server/miscfunctions.qc
Log:
Allow FORCING fog by the server (sv_foginterval 5 makes it re-stuffcmd the fog every 5 seconds to each playing client)


Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2008-06-07 08:44:38 UTC (rev 3690)
+++ trunk/data/defaultNexuiz.cfg	2008-06-07 09:05:27 UTC (rev 3691)
@@ -1013,6 +1013,9 @@
 set menu_mouse_absolute 0 // TODO make this seta if the engine understands this right
 seta menu_mouse_speed 1
 
+// force fog for people who turn it off in game (set this to like 5 if you suspect people are "cheating" that way)
+set sv_foginterval 0
+
 // Audio track names (for old-style "cd loop NUMBER" usage)
 cd remap 1 breakdown-easy brainsukker chaos-fog infight neuronal-diving subcities thru-the-mirror calling-bogus beast-of-insanity
 set sv_intermission_cdtrack brainsukker

Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh	2008-06-07 08:44:38 UTC (rev 3690)
+++ trunk/data/qcsrc/server/defs.qh	2008-06-07 09:05:27 UTC (rev 3691)
@@ -9,6 +9,7 @@
 float tourneyInMatchStage;
 
 float sv_cheats;
+float sv_foginterval;
 
 entity	activator;
 string	string_null;

Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc	2008-06-07 08:44:38 UTC (rev 3690)
+++ trunk/data/qcsrc/server/g_world.qc	2008-06-07 09:05:27 UTC (rev 3691)
@@ -8,6 +8,8 @@
 void ShuffleMaplist()
 float() DoNextMapOverride;
 
+.string fog;
+
 void SetDefaultAlpha()
 {
 	if(cvar("g_running_guns"))
@@ -164,6 +166,9 @@
 float world_already_spawned;
 void spawnfunc_worldspawn (void)
 {
+	float fd, l;
+	string s;
+
 	dprint_load(); // load dprint status from cvar
 
 	if(world_already_spawned)
@@ -269,7 +274,6 @@
 	GameLogInit(); // prepare everything
 	if(cvar("sv_eventlog"))
 	{
-		local string s;
 		GameLogEcho(":logversion:2", FALSE);
 		s = strcat(cvar_string("sv_eventlog_files_counter"), ".");
 		s = strcat(s, ftos(random()));
@@ -331,6 +335,29 @@
 		cvar_set("timelimit", "0");
 	}
 
+	fd = fopen(strcat("maps/", mapname, ".cfg"), FILE_READ);
+	if(fd != -1)
+	{
+		while((s = fgets(fd)))
+		{
+			l = tokenize(s);
+			if(l < 2)
+				continue;
+			if(argv(0) != "fog")
+				continue;
+			s = "";
+			while(l >= 2)
+			{
+				--l;
+				s = strcat(argv(l), " ", s);
+			}
+			s = substring(s, 0, strlen(s) - 1);
+			print("Found ^1DEPRECATED^7 fog command in .cfg file: ", s, "\n");
+			world.fog = strzone(s);
+		}
+		fclose(fd);
+	}
+
 	world_initialized = 1;
 }
 
@@ -1105,6 +1132,7 @@
 Exit deathmatch games upon conditions
 ============
 */
+.float fogtime;
 void() CheckRules_Player =
 {
 	if (gameover)	// someone else quit the game already
@@ -1113,6 +1141,14 @@
 	if(self.deadflag == DEAD_NO)
 		self.play_time += frametime;
 
+	if(sv_foginterval)
+	if(world.fog)
+	if(time > self.fogtime)
+	{
+		stuffcmd(self, strcat("\nfog ", world.fog, "\n"));
+		self.fogtime = time + sv_foginterval;
+	}
+
 	// fixme: don't check players; instead check spawnfunc_dom_team and spawnfunc_ctf_team entities
 	//   (div0: and that in CheckRules_World please)
 };

Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc	2008-06-07 08:44:38 UTC (rev 3690)
+++ trunk/data/qcsrc/server/miscfunctions.qc	2008-06-07 09:05:27 UTC (rev 3691)
@@ -724,6 +724,7 @@
 void readlevelcvars(void)
 {
 	sv_cheats = cvar("sv_cheats");
+	sv_foginterval = cvar("sv_foginterval");
 	g_cloaked = cvar("g_cloaked");
 	g_footsteps = cvar("g_footsteps");
 	g_grappling_hook = cvar("g_grappling_hook");




More information about the nexuiz-commits mailing list