aboutsummaryrefslogtreecommitdiffstats
path: root/code
diff options
context:
space:
mode:
Diffstat (limited to 'code')
-rw-r--r--code/client/snd_openal.c38
-rw-r--r--code/qcommon/net_ip.c31
2 files changed, 42 insertions, 27 deletions
diff --git a/code/client/snd_openal.c b/code/client/snd_openal.c
index e358516..74be8f2 100644
--- a/code/client/snd_openal.c
+++ b/code/client/snd_openal.c
@@ -476,9 +476,9 @@ typedef struct src_s
} src_t;
#ifdef MACOS_X
- #define MAX_SRC 64
+ #define MAX_SRC 64
#else
- #define MAX_SRC 128
+ #define MAX_SRC 128
#endif
static src_t srcList[MAX_SRC];
static int srcCount = 0;
@@ -873,10 +873,13 @@ S_AL_UpdateEntityPosition
static
void S_AL_UpdateEntityPosition( int entityNum, const vec3_t origin )
{
- S_AL_SanitiseVector( (vec_t *)origin );
+ vec3_t sanOrigin;
+
+ VectorCopy( origin, sanOrigin );
+ S_AL_SanitiseVector( sanOrigin );
if ( entityNum < 0 || entityNum > MAX_GENTITIES )
Com_Error( ERR_DROP, "S_UpdateEntityPosition: bad entitynum %i", entityNum );
- VectorCopy( origin, entityList[entityNum].origin );
+ VectorCopy( sanOrigin, entityList[entityNum].origin );
}
/*
@@ -894,8 +897,8 @@ static qboolean S_AL_CheckInput(int entityNum, sfxHandle_t sfx)
if (sfx < 0 || sfx >= numSfx)
{
Com_Printf(S_COLOR_RED "ERROR: S_AL_CheckInput: handle %i out of range\n", sfx);
- return qtrue;
- }
+ return qtrue;
+ }
return qfalse;
}
@@ -1070,12 +1073,17 @@ S_AL_AddLoopingSound
static
void S_AL_AddLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx )
{
+ vec3_t sanOrigin, sanVelocity;
+
if(S_AL_CheckInput(entityNum, sfx))
return;
- S_AL_SanitiseVector( (vec_t *)origin );
- S_AL_SanitiseVector( (vec_t *)velocity );
- S_AL_SrcLoop(SRCPRI_ENTITY, sfx, origin, velocity, entityNum);
+ VectorCopy( origin, sanOrigin );
+ VectorCopy( velocity, sanVelocity );
+ S_AL_SanitiseVector( sanOrigin );
+ S_AL_SanitiseVector( sanVelocity );
+
+ S_AL_SrcLoop(SRCPRI_ENTITY, sfx, sanOrigin, sanVelocity, entityNum);
}
/*
@@ -1086,20 +1094,24 @@ S_AL_AddRealLoopingSound
static
void S_AL_AddRealLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx )
{
+ vec3_t sanOrigin, sanVelocity;
+
if(S_AL_CheckInput(entityNum, sfx))
return;
- S_AL_SanitiseVector( (vec_t *)origin );
- S_AL_SanitiseVector( (vec_t *)velocity );
+ VectorCopy( origin, sanOrigin );
+ VectorCopy( velocity, sanVelocity );
+ S_AL_SanitiseVector( sanOrigin );
+ S_AL_SanitiseVector( sanVelocity );
// There are certain maps (*cough* Q3:TA mpterra*) that have large quantities
// of ET_SPEAKERS in the PVS at any given time. OpenAL can't cope with mixing
// large numbers of sounds, so this culls them by distance
- if( DistanceSquared( origin, lastListenerOrigin ) > (s_alMaxDistance->value + s_alGraceDistance->value) *
+ if( DistanceSquared( sanOrigin, lastListenerOrigin ) > (s_alMaxDistance->value + s_alGraceDistance->value) *
(s_alMaxDistance->value + s_alGraceDistance->value) )
return;
- S_AL_SrcLoop(SRCPRI_AMBIENT, sfx, origin, velocity, entityNum);
+ S_AL_SrcLoop(SRCPRI_AMBIENT, sfx, sanOrigin, sanVelocity, entityNum);
}
/*
diff --git a/code/qcommon/net_ip.c b/code/qcommon/net_ip.c
index 862f91a..a2960c4 100644
--- a/code/qcommon/net_ip.c
+++ b/code/qcommon/net_ip.c
@@ -483,7 +483,7 @@ qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message ) {
if(ip_socket != INVALID_SOCKET)
{
fromlen = sizeof(from);
- ret = recvfrom( ip_socket, net_message->data, net_message->maxsize, 0, (struct sockaddr *) &from, &fromlen );
+ ret = recvfrom( ip_socket, (void *)net_message->data, net_message->maxsize, 0, (struct sockaddr *) &from, &fromlen );
if (ret == SOCKET_ERROR)
{
@@ -527,7 +527,7 @@ qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message ) {
if(ip6_socket != INVALID_SOCKET)
{
fromlen = sizeof(from);
- ret = recvfrom(ip6_socket, net_message->data, net_message->maxsize, 0, (struct sockaddr *) &from, &fromlen);
+ ret = recvfrom(ip6_socket, (void *)net_message->data, net_message->maxsize, 0, (struct sockaddr *) &from, &fromlen);
if (ret == SOCKET_ERROR)
{
@@ -555,7 +555,7 @@ qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message ) {
if(multicast6_socket != INVALID_SOCKET && multicast6_socket != ip6_socket)
{
fromlen = sizeof(from);
- ret = recvfrom(multicast6_socket, net_message->data, net_message->maxsize, 0, (struct sockaddr *) &from, &fromlen);
+ ret = recvfrom(multicast6_socket, (void *)net_message->data, net_message->maxsize, 0, (struct sockaddr *) &from, &fromlen);
if (ret == SOCKET_ERROR)
{
@@ -835,7 +835,6 @@ int NET_IP6Socket( char *net_interface, int port, struct sockaddr_in6 *bindto, i
SOCKET newsocket;
struct sockaddr_in6 address;
qboolean _true = qtrue;
- int i = 1;
*err = 0;
@@ -865,11 +864,15 @@ int NET_IP6Socket( char *net_interface, int port, struct sockaddr_in6 *bindto, i
}
#ifdef IPV6_V6ONLY
- // ipv4 addresses should not be allowed to connect via this socket.
- if(setsockopt(newsocket, IPPROTO_IPV6, IPV6_V6ONLY, (char *) &i, sizeof(i)) == SOCKET_ERROR)
{
- // win32 systems don't seem to support this anyways.
- Com_DPrintf("WARNING: NET_IP6Socket: setsockopt IPV6_V6ONLY: %s\n", NET_ErrorString());
+ int i;
+
+ // ipv4 addresses should not be allowed to connect via this socket.
+ if(setsockopt(newsocket, IPPROTO_IPV6, IPV6_V6ONLY, (char *) &i, sizeof(i)) == SOCKET_ERROR)
+ {
+ // win32 systems don't seem to support this anyways.
+ Com_DPrintf("WARNING: NET_IP6Socket: setsockopt IPV6_V6ONLY: %s\n", NET_ErrorString());
+ }
}
#endif
@@ -1074,14 +1077,14 @@ void NET_OpenSocks( int port ) {
if ( rfc1929 ) {
buf[2] = 2; // method #2 - method id #02: username/password
}
- if ( send( socks_socket, buf, len, 0 ) == SOCKET_ERROR ) {
+ if ( send( socks_socket, (void *)buf, len, 0 ) == SOCKET_ERROR ) {
err = socketError;
Com_Printf( "NET_OpenSocks: send: %s\n", NET_ErrorString() );
return;
}
// get the response
- len = recv( socks_socket, buf, 64, 0 );
+ len = recv( socks_socket, (void *)buf, 64, 0 );
if ( len == SOCKET_ERROR ) {
err = socketError;
Com_Printf( "NET_OpenSocks: recv: %s\n", NET_ErrorString() );
@@ -1121,14 +1124,14 @@ void NET_OpenSocks( int port ) {
}
// send it
- if ( send( socks_socket, buf, 3 + ulen + plen, 0 ) == SOCKET_ERROR ) {
+ if ( send( socks_socket, (void *)buf, 3 + ulen + plen, 0 ) == SOCKET_ERROR ) {
err = socketError;
Com_Printf( "NET_OpenSocks: send: %s\n", NET_ErrorString() );
return;
}
// get the response
- len = recv( socks_socket, buf, 64, 0 );
+ len = recv( socks_socket, (void *)buf, 64, 0 );
if ( len == SOCKET_ERROR ) {
err = socketError;
Com_Printf( "NET_OpenSocks: recv: %s\n", NET_ErrorString() );
@@ -1151,14 +1154,14 @@ void NET_OpenSocks( int port ) {
buf[3] = 1; // address type: IPV4
*(int *)&buf[4] = INADDR_ANY;
*(short *)&buf[8] = htons( (short)port ); // port
- if ( send( socks_socket, buf, 10, 0 ) == SOCKET_ERROR ) {
+ if ( send( socks_socket, (void *)buf, 10, 0 ) == SOCKET_ERROR ) {
err = socketError;
Com_Printf( "NET_OpenSocks: send: %s\n", NET_ErrorString() );
return;
}
// get the response
- len = recv( socks_socket, buf, 64, 0 );
+ len = recv( socks_socket, (void *)buf, 64, 0 );
if( len == SOCKET_ERROR ) {
err = socketError;
Com_Printf( "NET_OpenSocks: recv: %s\n", NET_ErrorString() );