mumble link support

The coordinate calculation was adopted from Warsow's mumble patch.
This commit is contained in:
Ludwig Nussel 2008-05-30 17:19:31 +00:00
parent a15002ad0d
commit 0ee3960225
6 changed files with 268 additions and 0 deletions

View file

@ -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 );