r4480 - in trunk/data/qcsrc: client common server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Sep 21 11:41:19 EDT 2008


Author: div0
Date: 2008-09-21 11:41:19 -0400 (Sun, 21 Sep 2008)
New Revision: 4480

Modified:
   trunk/data/qcsrc/client/Main.qc
   trunk/data/qcsrc/client/View.qc
   trunk/data/qcsrc/common/constants.qh
   trunk/data/qcsrc/server/cl_client.qc
Log:
handle sv_foginterval on the client now (TESTING)


Modified: trunk/data/qcsrc/client/Main.qc
===================================================================
--- trunk/data/qcsrc/client/Main.qc	2008-09-21 15:28:55 UTC (rev 4479)
+++ trunk/data/qcsrc/client/Main.qc	2008-09-21 15:41:19 UTC (rev 4480)
@@ -54,6 +54,7 @@
 		return db_get(configdb, strcat("/v/", key));
 }
 
+string forcefog;
 void CSQC_Init(void)
 {
 #ifdef USE_FTE
@@ -619,6 +620,23 @@
 
 void CSQC_CheckRevision();
 
+void Fog_Force()
+{
+	string s;
+
+	// TODO somehow thwart prvm_globalset client ...
+
+	if(forcefog != "")
+		localcmd(strcat("\nfog ", forcefog, "\nr_fog_exp2 0\nr_drawfog 1\n"));
+}
+
+void Net_ReadFog()
+{
+	if(forcefog)
+		strunzone(forcefog);
+	forcefog = strzone(ReadString());
+}
+
 void Gamemode_Init();
 void Net_ReadScoresInfo()
 {
@@ -849,6 +867,10 @@
 			Net_ReadWarmupStage();
 			bHandled = true;
 			break;
+		case TE_CSQC_FOG:
+			Net_ReadFog();
+			bHandled = true;
+			break;
 		default:
 			// No special logic for this temporary entity; return 0 so the engine can handle it
 			bHandled = false;

Modified: trunk/data/qcsrc/client/View.qc
===================================================================
--- trunk/data/qcsrc/client/View.qc	2008-09-21 15:28:55 UTC (rev 4479)
+++ trunk/data/qcsrc/client/View.qc	2008-09-21 15:41:19 UTC (rev 4480)
@@ -187,6 +187,8 @@
 	entity e;
 	float fov;
 
+	Fog_Force();
+
 	drawframetime = max(0.000001, time - drawtime);
 	drawtime = time;
 

Modified: trunk/data/qcsrc/common/constants.qh
===================================================================
--- trunk/data/qcsrc/common/constants.qh	2008-09-21 15:28:55 UTC (rev 4479)
+++ trunk/data/qcsrc/common/constants.qh	2008-09-21 15:41:19 UTC (rev 4480)
@@ -17,7 +17,8 @@
 // Revision 16: multi-weapons
 // Revision 17: multi-weaponimpulses
 // Revision 18: warmup
-#define CSQC_REVISION 18
+// Revision 19: fog
+#define CSQC_REVISION 19
 
 // probably put these in common/
 // so server/ and client/ can be synced better
@@ -205,6 +206,7 @@
 const float TE_CSQC_ZOOMNOTIFY = 113;
 const float TE_CSQC_HOLDANGLES = 114;
 const float TE_CSQC_WARMUP = 115;
+const float TE_CSQC_FOG = 116;
 
 const float STAT_KH_KEYS = 32;
 const float STAT_CTF_STATE = 33;

Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc	2008-09-21 15:28:55 UTC (rev 4479)
+++ trunk/data/qcsrc/server/cl_client.qc	2008-09-21 15:41:19 UTC (rev 4480)
@@ -1047,14 +1047,25 @@
 	 */
 }
 
-.float fogtime;
+.float fog_set;
 void SendFog()
 {
 	if(world.fog) // NOT string_null!
-	if(!self.fogtime || (sv_foginterval && time > self.fogtime))
 	{
-		stuffcmd(self, strcat("\nfog ", world.fog, "\nr_fog_exp2 0\nr_drawfog 1\n"));
-		self.fogtime = time + sv_foginterval;
+		if(!self.fog_set)
+		{
+			if(sv_foginterval)
+			{
+				msg_entity = self;
+				WriteByte(MSG_ONE, SVC_TEMPENTITY);
+				WriteByte(MSG_ONE, TE_CSQC_FOG);
+				WriteString(MSG_ONE, world.fog);
+			}
+			else
+				// set it once
+				stuffcmd(self, strcat("\nfog ", world.fog, "\nr_fog_exp2 0\nr_drawfog 1\n"));
+		}
+		self.fog_set = 1;
 	}
 }
 




More information about the nexuiz-commits mailing list