[quake3-commits] r1764 - trunk/code/client
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Mon Jan 4 09:12:20 EST 2010
Author: ludwig
Date: 2010-01-04 09:12:18 -0500 (Mon, 04 Jan 2010)
New Revision: 1764
Modified:
trunk/code/client/libmumblelink.c
trunk/code/client/libmumblelink.h
Log:
update mumble link interface for version 1.2
Modified: trunk/code/client/libmumblelink.c
===================================================================
--- trunk/code/client/libmumblelink.c 2010-01-03 22:37:14 UTC (rev 1763)
+++ trunk/code/client/libmumblelink.c 2010-01-04 14:12:18 UTC (rev 1764)
@@ -39,14 +39,26 @@
#include "libmumblelink.h"
+#ifndef MIN
+#define MIN(a, b) ((a)<(b)?(a):(b))
+#endif
+
typedef struct
{
uint32_t uiVersion;
uint32_t uiTick;
- float fPosition[3];
- float fFront[3];
- float fTop[3];
+ float fAvatarPosition[3];
+ float fAvatarFront[3];
+ float fAvatarTop[3];
wchar_t name[256];
+ /* new in mumble 1.2 */
+ float fCameraPosition[3];
+ float fCameraFront[3];
+ float fCameraTop[3];
+ wchar_t identity[256];
+ uint32_t context_len;
+ unsigned char context[256];
+ wchar_t description[2048];
} LinkedMem;
static LinkedMem *lm = NULL;
@@ -104,16 +116,51 @@
void mumble_update_coordinates(float fPosition[3], float fFront[3], float fTop[3])
{
+ mumble_update_coordinates2(fPosition, fFront, fTop, fPosition, fFront, fTop);
+}
+
+void mumble_update_coordinates2(float fAvatarPosition[3], float fAvatarFront[3], float fAvatarTop[3],
+ float fCameraPosition[3], float fCameraFront[3], float fCameraTop[3])
+{
if (!lm)
return;
- memcpy(lm->fPosition, fPosition, sizeof(fPosition));
- memcpy(lm->fFront, fFront, sizeof(fFront));
- memcpy(lm->fTop, fTop, sizeof(fTop));
- lm->uiVersion = 1;
+ memcpy(lm->fAvatarPosition, fAvatarPosition, sizeof(fAvatarPosition));
+ memcpy(lm->fAvatarFront, fAvatarFront, sizeof(fAvatarFront));
+ memcpy(lm->fAvatarTop, fAvatarTop, sizeof(fAvatarTop));
+ memcpy(lm->fCameraPosition, fCameraPosition, sizeof(fCameraPosition));
+ memcpy(lm->fCameraFront, fCameraFront, sizeof(fCameraFront));
+ memcpy(lm->fCameraTop, fCameraTop, sizeof(fCameraTop));
+ lm->uiVersion = 2;
lm->uiTick = GetTickCount();
}
+void mumble_set_identity(const char* identity)
+{
+ size_t len;
+ if (!lm)
+ return;
+ len = MIN(sizeof(lm->identity), strlen(identity)+1);
+ mbstowcs(lm->identity, identity, len);
+}
+
+void mumble_set_context(const unsigned char* context, size_t len)
+{
+ if (!lm)
+ return;
+ len = MIN(sizeof(lm->context), len);
+ memcpy(lm->context, context, len);
+}
+
+void mumble_set_description(const char* description)
+{
+ size_t len;
+ if (!lm)
+ return;
+ len = MIN(sizeof(lm->description), strlen(description)+1);
+ mbstowcs(lm->description, description, len);
+}
+
void mumble_unlink()
{
if(!lm)
Modified: trunk/code/client/libmumblelink.h
===================================================================
--- trunk/code/client/libmumblelink.h 2010-01-03 22:37:14 UTC (rev 1763)
+++ trunk/code/client/libmumblelink.h 2010-01-04 14:12:18 UTC (rev 1764)
@@ -23,4 +23,13 @@
int mumble_link(const char* name);
int mumble_islinked(void);
void mumble_update_coordinates(float fPosition[3], float fFront[3], float fTop[3]);
+
+/* new for mumble 1.2: also set camera position */
+void mumble_update_coordinates2(float fAvatarPosition[3], float fAvatarFront[3], float fAvatarTop[3],
+ float fCameraPosition[3], float fCameraFront[3], float fCameraTop[3]);
+
+void mumble_set_description(const char* description);
+void mumble_set_context(const unsigned char* context, size_t len);
+void mumble_set_identity(const char* identity);
+
void mumble_unlink(void);
More information about the quake3-commits
mailing list