diff options
author | Thilo Schulz <arny@ats.s.bawue.de> | 2011-07-27 15:47:29 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-10 22:36:32 +0000 |
commit | 34e5d1056d0cd83648db904549a368ef904e2be8 (patch) | |
tree | 94f69d7546b28b8b8854b06526b70934a65c0dc0 /src/qcommon | |
parent | d28ee7e3da161ae9a9e9f339291001948672dae7 (diff) |
- Apply parts of Ben Millwood's target bitfield patch (#3787) - Fix Ryan's FIXME and have voip packet buffer on the server dynamically allocated via Z_Malloc and store pointers in a circular buffer - Improve voip target parsing on top of Ben Millwood's patch - Add new "spatial" target where speaker is spatialized in 3d space and can be heard by all clients in hearing range (s_alMaxDistance) (#4467) - Decrease voip sound lengths from 240ms to 80ms per voip packet to mitigate udp packet loss and decrease latency - Protocol version incremented to 71
Diffstat (limited to 'src/qcommon')
-rw-r--r-- | src/qcommon/common.c | 30 | ||||
-rw-r--r-- | src/qcommon/q_shared.h | 17 | ||||
-rw-r--r-- | src/qcommon/qcommon.h | 2 |
3 files changed, 49 insertions, 0 deletions
diff --git a/src/qcommon/common.c b/src/qcommon/common.c index 0a4e7eba..c6feee42 100644 --- a/src/qcommon/common.c +++ b/src/qcommon/common.c @@ -3422,3 +3422,33 @@ void Com_RandomBytes( byte *string, int len ) string[i] = (unsigned char)( rand() % 255 ); } + +/* +================== +Com_IsVoipTarget + +Returns non-zero if given clientNum is enabled in voipTargets, zero otherwise. +If clientNum is negative return if any bit is set. +================== +*/ +qboolean Com_IsVoipTarget(uint8_t *voipTargets, int voipTargetsSize, int clientNum) +{ + int index; + if(clientNum < 0) + { + for(index = 0; index < voipTargetsSize; index++) + { + if(voipTargets[index]) + return qtrue; + } + + return qfalse; + } + + index = clientNum >> 3; + + if(index < voipTargetsSize) + return (voipTargets[index] & (1 << (clientNum & 0x07))); + + return qfalse; +} diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h index d0977d99..189d1751 100644 --- a/src/qcommon/q_shared.h +++ b/src/qcommon/q_shared.h @@ -989,6 +989,23 @@ typedef struct { char string[MAX_CVAR_VALUE_STRING]; } vmCvar_t; + +/* +============================================================== + +VoIP + +============================================================== +*/ + +// if you change the count of flags be sure to also change VOIP_FLAGNUM +#define VOIP_SPATIAL 0x01 // spatialized voip message +#define VOIP_DIRECT 0x02 // non-spatialized voip message + +// number of flags voip knows. You will have to bump protocol version number if you +// change this. +#define VOIP_FLAGCNT 2 + /* ============================================================== diff --git a/src/qcommon/qcommon.h b/src/qcommon/qcommon.h index 035d98b1..f761b134 100644 --- a/src/qcommon/qcommon.h +++ b/src/qcommon/qcommon.h @@ -812,6 +812,8 @@ int Com_RealTime(qtime_t *qtime); qboolean Com_SafeMode( void ); void Com_RunAndTimeServerPacket(netadr_t *evFrom, msg_t *buf); +qboolean Com_IsVoipTarget(uint8_t *voipTargets, int voipTargetsSize, int clientNum); + void Com_StartupVariable( const char *match ); // checks for and removes command line "+set var arg" constructs // if match is NULL, all set commands will be executed, otherwise |