From 94017ca419caff91bf26841b503b5867d992ca4c Mon Sep 17 00:00:00 2001 From: ludwig Date: Fri, 30 May 2008 17:19:31 +0000 Subject: 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 --- code/client/cl_main.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'code/client/cl_main.c') 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 +#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 ); -- cgit v1.2.3