aboutsummaryrefslogtreecommitdiffstats
path: root/code/client/cl_main.c
diff options
context:
space:
mode:
authorludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-05-30 17:19:31 +0000
committerludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-05-30 17:19:31 +0000
commit94017ca419caff91bf26841b503b5867d992ca4c (patch)
treecc47c21ed603a9d1da62133019b2234d445bf0fc /code/client/cl_main.c
parent159ae1a34675660e6d155ac77975e8ec7efc5f7b (diff)
downloadioquake3-aero-94017ca419caff91bf26841b503b5867d992ca4c.tar.gz
ioquake3-aero-94017ca419caff91bf26841b503b5867d992ca4c.zip
mumble link support
The coordinate calculation was adopted from Warsow's mumble patch. git-svn-id: svn://svn.icculus.org/quake3/trunk@1347 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/client/cl_main.c')
-rw-r--r--code/client/cl_main.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/code/client/cl_main.c b/code/client/cl_main.c
index d130620..b9243d5 100644
--- a/code/client/cl_main.c
+++ b/code/client/cl_main.c
@@ -24,6 +24,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "client.h"
#include <limits.h>
+#ifdef USE_MUMBLE
+#include "libmumblelink.h"
+#endif
+
+#ifdef USE_MUMBLE
+cvar_t *cl_useMumble;
+cvar_t *cl_mumbleScale;
+#endif
+
cvar_t *cl_nodelta;
cvar_t *cl_debugMove;
@@ -121,6 +130,43 @@ void CL_CDDialog( void ) {
cls.cddialog = qtrue; // start it next frame
}
+#ifdef USE_MUMBLE
+static
+void CL_UpdateMumble(void)
+{
+ vec3_t pos, forward, up;
+ float scale = cl_mumbleScale->value;
+ float tmp;
+
+ if(!cl_useMumble->integer)
+ return;
+
+ // !!! FIXME: not sure if this is even close to correct.
+ AngleVectors( cl.snap.ps.viewangles, forward, NULL, up);
+
+ pos[0] = cl.snap.ps.origin[0] * scale;
+ pos[1] = cl.snap.ps.origin[2] * scale;
+ pos[2] = cl.snap.ps.origin[1] * scale;
+
+ tmp = forward[1];
+ forward[1] = forward[2];
+ forward[2] = tmp;
+
+ tmp = up[1];
+ up[1] = up[2];
+ up[2] = tmp;
+
+ if(cl_useMumble->integer > 1) {
+ fprintf(stderr, "%f %f %f, %f %f %f, %f %f %f\n",
+ pos[0], pos[1], pos[2],
+ forward[0], forward[1], forward[2],
+ up[0], up[1], up[2]);
+ }
+
+ mumble_update_coordinates(pos, forward, up);
+}
+#endif
+
/*
=======================================================================
@@ -852,6 +898,13 @@ void CL_Disconnect( qboolean showMainMenu ) {
*clc.downloadTempName = *clc.downloadName = 0;
Cvar_Set( "cl_downloadName", "" );
+#ifdef USE_MUMBLE
+ if (cl_useMumble->integer && mumble_islinked()) {
+ Com_Printf("Mumble: Unlinking from Mumble application\n");
+ mumble_unlink();
+ }
+#endif
+
if ( clc.demofile ) {
FS_FCloseFile( clc.demofile );
clc.demofile = 0;
@@ -2306,6 +2359,9 @@ void CL_Frame ( int msec ) {
// update audio
S_Update();
+#ifdef USE_MUMBLE
+ CL_UpdateMumble();
+#endif
// advance local effects for next frame
SCR_RunCinematic();
@@ -2720,6 +2776,11 @@ void CL_Init( void ) {
cl_guidServerUniq = Cvar_Get ("cl_guidServerUniq", "1", CVAR_ARCHIVE);
+#ifdef USE_MUMBLE
+ cl_useMumble = Cvar_Get ("cl_useMumble", "0", CVAR_ARCHIVE);
+ cl_mumbleScale = Cvar_Get ("cl_mumbleScale", "0.0254", CVAR_ARCHIVE);
+#endif
+
// userinfo
Cvar_Get ("name", "UnnamedPlayer", CVAR_USERINFO | CVAR_ARCHIVE );
Cvar_Get ("rate", "3000", CVAR_USERINFO | CVAR_ARCHIVE );