r4237 - in trunk/data/qcsrc: client common server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Aug 29 12:43:21 EDT 2008
Author: div0
Date: 2008-08-29 12:43:20 -0400 (Fri, 29 Aug 2008)
New Revision: 4237
Modified:
trunk/data/qcsrc/client/Main.qc
trunk/data/qcsrc/client/View.qc
trunk/data/qcsrc/client/main.qh
trunk/data/qcsrc/common/constants.qh
trunk/data/qcsrc/server/cl_client.qc
Log:
record zoom in demos (TODO: also send zoom state when fov is below a threshold?)
Modified: trunk/data/qcsrc/client/Main.qc
===================================================================
--- trunk/data/qcsrc/client/Main.qc 2008-08-29 16:16:25 UTC (rev 4236)
+++ trunk/data/qcsrc/client/Main.qc 2008-08-29 16:43:20 UTC (rev 4237)
@@ -217,11 +217,12 @@
strCmd = argv(0);
if(strCmd == "+button4") { // zoom
+ // return false, because the message shall be sent to the server anyway (for demos/speccing)
button_zoom = 1;
- return true;
+ return false;
} else if(strCmd == "-button4") { // zoom
button_zoom = 0;
- return true;
+ return false;
} else if(strCmd == "+button3") { // secondary
button_attack2 = 1;
return false;
@@ -738,6 +739,11 @@
spectatee_status = newspectatee_status;
}
+void Net_ReadZoomNotify()
+{
+ spectatorbutton_zoom = ReadByte();
+}
+
void Net_ReadSpawn()
{
zoomin_effect = 1;
@@ -790,10 +796,14 @@
Net_GrapplingHook();
bHandled = true;
break;
- case TE_CSQC_SPAWN: // TE_BEAM
+ case TE_CSQC_SPAWN:
Net_ReadSpawn();
bHandled = true;
break;
+ case TE_CSQC_ZOOMNOTIFY:
+ Net_ReadZoomNotify();
+ 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-08-29 16:16:25 UTC (rev 4236)
+++ trunk/data/qcsrc/client/View.qc 2008-08-29 16:43:20 UTC (rev 4237)
@@ -30,6 +30,14 @@
zoomdir = button_zoom;
if(activeweapon == 7 && !minstagib)
zoomdir += button_attack2;
+ if(spectatee_status > 0 || isdemo())
+ {
+ if(spectatorbutton_zoom)
+ zoomdir = 0 + !zoomdir;
+ // do not even THINK about removing this 0
+ // _I_ know what I am doing
+ // fteqcc does not
+ }
if(zoomdir)
zoomin_effect = 0;
Modified: trunk/data/qcsrc/client/main.qh
===================================================================
--- trunk/data/qcsrc/client/main.qh 2008-08-29 16:16:25 UTC (rev 4236)
+++ trunk/data/qcsrc/client/main.qh 2008-08-29 16:43:20 UTC (rev 4237)
@@ -115,6 +115,7 @@
vector view_origin, view_angles, view_forward, view_right, view_up;
float button_zoom;
+float spectatorbutton_zoom;
float button_attack2;
float activeweapon;
float minstagib;
Modified: trunk/data/qcsrc/common/constants.qh
===================================================================
--- trunk/data/qcsrc/common/constants.qh 2008-08-29 16:16:25 UTC (rev 4236)
+++ trunk/data/qcsrc/common/constants.qh 2008-08-29 16:43:20 UTC (rev 4237)
@@ -13,7 +13,8 @@
// Revision 12: smaller scores updates (SERVER: requires new engine)
// Revision 13: pointparticles
// Revision 14: laser
-#define CSQC_REVISION 14
+// Revision 15: zoom
+#define CSQC_REVISION 15
// probably put these in common/
// so server/ and client/ can be synced better
@@ -198,6 +199,7 @@
const float TE_CSQC_FORCESCOREBOARD = 110;
const float TE_CSQC_SPECTATING = 111;
const float TE_CSQC_SPAWN = 112;
+const float TE_CSQC_ZOOMNOTIFY = 113;
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-08-29 16:16:25 UTC (rev 4236)
+++ trunk/data/qcsrc/server/cl_client.qc 2008-08-29 16:43:20 UTC (rev 4237)
@@ -1655,6 +1655,21 @@
self.event_damage(self, self, 1, DEATH_ROT, self.origin, '0 0 0');
}
+.float zoomstate;
+float zoomstate_set;
+void SetZoomState(float z)
+{
+ if(z != self.zoomstate)
+ {
+ msg_entity = self;
+ WriteByte(MSG_ONE, SVC_TEMPENTITY);
+ WriteByte(MSG_ONE, TE_CSQC_ZOOMNOTIFY);
+ WriteByte(MSG_ONE, z);
+ self.zoomstate = z;
+ }
+ zoomstate_set = 1;
+}
+
/*
======================
spectate mode routines
@@ -1679,6 +1694,7 @@
self.fixangle = TRUE;
setorigin(self, spectatee.origin);
setsize(self, spectatee.mins, spectatee.maxs);
+ SetZoomState(spectatee.zoomstate);
}
float SpectateUpdate() {
@@ -1928,6 +1944,8 @@
if(blockSpectators)
checkSpectatorBlock();
+ zoomstate_set = 0;
+
if(self.netname_previous != self.netname)
{
if(cvar("sv_eventlog"))
@@ -2144,6 +2162,9 @@
SpectatorThink();
}
+ if(!zoomstate_set)
+ SetZoomState(self.BUTTON_ZOOM || (self.BUTTON_ATCK2 && !g_minstagib && self.weapon == WEP_NEX));
+
float oldspectatee_status;
oldspectatee_status = self.spectatee_status;
if(self.classname == "spectator")
More information about the nexuiz-commits
mailing list