r4238 - trunk/data/qcsrc/client

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Aug 29 12:58:10 EDT 2008


Author: div0
Date: 2008-08-29 12:58:10 -0400 (Fri, 29 Aug 2008)
New Revision: 4238

Modified:
   trunk/data/qcsrc/client/Main.qc
   trunk/data/qcsrc/client/View.qc
   trunk/data/qcsrc/client/main.qh
Log:
also detect zoom scripts, and write zoom status to the server (for speccing) and demo (assuming any fov < 50 is zoomed)


Modified: trunk/data/qcsrc/client/Main.qc
===================================================================
--- trunk/data/qcsrc/client/Main.qc	2008-08-29 16:43:20 UTC (rev 4237)
+++ trunk/data/qcsrc/client/Main.qc	2008-08-29 16:58:10 UTC (rev 4238)
@@ -218,9 +218,19 @@
 
 	if(strCmd == "+button4") { // zoom
 		// return false, because the message shall be sent to the server anyway (for demos/speccing)
+		if(ignore_plus_zoom)
+		{
+			--ignore_plus_zoom;
+			return false;
+		}
 		button_zoom = 1;
 		return false;
 	} else if(strCmd == "-button4") { // zoom
+		if(ignore_minus_zoom)
+		{
+			--ignore_minus_zoom;
+			return false;
+		}
 		button_zoom = 0;
 		return false;
 	} else if(strCmd == "+button3") { // secondary

Modified: trunk/data/qcsrc/client/View.qc
===================================================================
--- trunk/data/qcsrc/client/View.qc	2008-08-29 16:43:20 UTC (rev 4237)
+++ trunk/data/qcsrc/client/View.qc	2008-08-29 16:58:10 UTC (rev 4238)
@@ -14,7 +14,7 @@
 	return v_y * 0.01745329251994329576;
 }
 
-vector GetCurrentFov()
+vector GetCurrentFov(float fov)
 {
 	float zoomsensitivity, zoomspeed, zoomfactor, zoomdir;
 
@@ -70,7 +70,7 @@
 		setsensitivityscale(1);
 
 	float frustumx, frustumy, fovx, fovy;
-	frustumy = tan(cvar("fov") * 0.00872664625997164788) * 0.75 * current_viewzoom;
+	frustumy = tan(fov * 0.00872664625997164788) * 0.75 * current_viewzoom;
 	frustumx = frustumy * cvar("vid_width") / cvar("vid_height") / cvar("vid_pixelheight");
 	fovx = atan2(frustumx, 1) / 0.00872664625997164788;
 	fovy = atan2(frustumy, 1) / 0.00872664625997164788;
@@ -84,9 +84,11 @@
 void CSQC_ctf_hud(void);
 void PostInit(void);
 float Sbar_WouldDrawScoreboard ();
+float zoomscript_caught;
 void CSQC_UpdateView(void)
 {
 	entity e;
+	float fov;
 
 	drawframetime = time - drawtime;
 	drawtime = time;
@@ -96,6 +98,26 @@
 	// might even be better to add the gametype to TE_CSQC_INIT...?
 	if(!postinit)
 		PostInit();
+
+	fov = cvar("fov");
+	if(fov < 50)
+	{
+		if(!zoomscript_caught)
+		{
+			localcmd("+button4\n");
+			zoomscript_caught = 1;
+			ignore_plus_zoom += 1;
+		}
+	}
+	else
+	{
+		if(zoomscript_caught)
+		{
+			localcmd("-button4\n");
+			zoomscript_caught = 0;
+			ignore_minus_zoom += 1;
+		}
+	}
 	
 	sbar_alpha_fg = cvar("sbar_alpha_fg" );
 	sbar_hudselector = cvar("sbar_hudselector");
@@ -114,7 +136,7 @@
 	// Draw the World (and sky)
 	R_SetView(VF_DRAWWORLD, 1);
 
-	R_SetView(VF_FOV, GetCurrentFov());
+	R_SetView(VF_FOV, GetCurrentFov(fov));
 	
 	// Draw the Crosshair
 	R_SetView(VF_DRAWCROSSHAIR, !Sbar_WouldDrawScoreboard());

Modified: trunk/data/qcsrc/client/main.qh
===================================================================
--- trunk/data/qcsrc/client/main.qh	2008-08-29 16:43:20 UTC (rev 4237)
+++ trunk/data/qcsrc/client/main.qh	2008-08-29 16:58:10 UTC (rev 4238)
@@ -121,3 +121,5 @@
 float minstagib;
 float current_viewzoom;
 float zoomin_effect;
+float ignore_plus_zoom;
+float ignore_minus_zoom;




More information about the nexuiz-commits mailing list