fix a mutex deadlock due to my dsound change.

allow the webgl port to directly accept an ip, making up the tcp:// and port part automagically.
fix sdl dependencies slightly.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4305 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2013-04-08 11:27:39 +00:00
parent 2632c351fd
commit c0167628f2
9 changed files with 634 additions and 629 deletions

View file

@ -564,29 +564,29 @@ void ClearBounds( vec3_t mins, vec3_t maxs );
void AddPointToBounds( const vec3_t v, vec3_t mins, vec3_t maxs ); void AddPointToBounds( const vec3_t v, vec3_t mins, vec3_t maxs );
#if !defined( Q3_VM ) || ( defined( Q3_VM ) && defined( __Q3_VM_MATH ) ) #if !defined( Q3_VM ) || ( defined( Q3_VM ) && defined( __Q3_VM_MATH ) )
static ID_INLINE int VectorCompare( const vec3_t v1, const vec3_t v2 ) { ID_INLINE int VectorCompare( const vec3_t v1, const vec3_t v2 ) {
if (v1[0] != v2[0] || v1[1] != v2[1] || v1[2] != v2[2]) { if (v1[0] != v2[0] || v1[1] != v2[1] || v1[2] != v2[2]) {
return 0; return 0;
} }
return 1; return 1;
} }
static ID_INLINE vec_t VectorLength( const vec3_t v ) { ID_INLINE vec_t VectorLength( const vec3_t v ) {
return (vec_t)sqrt (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]); return (vec_t)sqrt (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
} }
static ID_INLINE vec_t VectorLengthSquared( const vec3_t v ) { ID_INLINE vec_t VectorLengthSquared( const vec3_t v ) {
return (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]); return (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
} }
static ID_INLINE vec_t Distance( const vec3_t p1, const vec3_t p2 ) { ID_INLINE vec_t Distance( const vec3_t p1, const vec3_t p2 ) {
vec3_t v; vec3_t v;
VectorSubtract (p2, p1, v); VectorSubtract (p2, p1, v);
return VectorLength( v ); return VectorLength( v );
} }
static ID_INLINE vec_t DistanceSquared( const vec3_t p1, const vec3_t p2 ) { ID_INLINE vec_t DistanceSquared( const vec3_t p1, const vec3_t p2 ) {
vec3_t v; vec3_t v;
VectorSubtract (p2, p1, v); VectorSubtract (p2, p1, v);
@ -595,7 +595,7 @@ static ID_INLINE vec_t DistanceSquared( const vec3_t p1, const vec3_t p2 ) {
// fast vector normalize routine that does not check to make sure // fast vector normalize routine that does not check to make sure
// that length != 0, nor does it return length, uses rsqrt approximation // that length != 0, nor does it return length, uses rsqrt approximation
static ID_INLINE void VectorNormalizeFast( vec3_t v ) ID_INLINE void VectorNormalizeFast( vec3_t v )
{ {
float ilength; float ilength;
@ -606,13 +606,13 @@ static ID_INLINE void VectorNormalizeFast( vec3_t v )
v[2] *= ilength; v[2] *= ilength;
} }
static ID_INLINE void VectorInverse( vec3_t v ){ ID_INLINE void VectorInverse( vec3_t v ){
v[0] = -v[0]; v[0] = -v[0];
v[1] = -v[1]; v[1] = -v[1];
v[2] = -v[2]; v[2] = -v[2];
} }
static ID_INLINE void CrossProduct( const vec3_t v1, const vec3_t v2, vec3_t cross ) { ID_INLINE void CrossProduct( const vec3_t v1, const vec3_t v2, vec3_t cross ) {
cross[0] = v1[1]*v2[2] - v1[2]*v2[1]; cross[0] = v1[1]*v2[2] - v1[2]*v2[1];
cross[1] = v1[2]*v2[0] - v1[0]*v2[2]; cross[1] = v1[2]*v2[0] - v1[0]*v2[2];
cross[2] = v1[0]*v2[1] - v1[1]*v2[0]; cross[2] = v1[0]*v2[1] - v1[1]*v2[0];

View file

@ -595,7 +595,7 @@ void R2D_Font_Callback(struct cvar_s *var, char *oldvalue)
if (qrenderer == QR_NONE) if (qrenderer == QR_NONE)
return; return;
#ifdef _WIN32 #if defined(_WIN32) && !defined(_SDL)
if (!strcmp(var->string, "?")) if (!strcmp(var->string, "?"))
{ {
BOOL (APIENTRY *pChooseFontA)(LPCHOOSEFONTA) = NULL; BOOL (APIENTRY *pChooseFontA)(LPCHOOSEFONTA) = NULL;

View file

@ -190,19 +190,17 @@ static void DSOUND_Shutdown (soundcardinfo_t *sc)
DSOUND_Shutdown_Internal(sc); DSOUND_Shutdown_Internal(sc);
} }
const char *dsndcard;
GUID FAR *dsndguid; GUID FAR *dsndguid;
int dsnd_guids; int dsnd_guids;
int aimedforguid;
static BOOL (CALLBACK DSEnumCallback)(GUID FAR *guid, LPCSTR str1, LPCSTR str2, LPVOID parm) static BOOL (CALLBACK DSEnumCallback)(GUID FAR *guid, LPCSTR str1, LPCSTR str2, LPVOID parm)
{ {
soundcardinfo_t *sc = parm;
if (guid == NULL) if (guid == NULL)
return TRUE; return TRUE;
if (aimedforguid == dsnd_guids) if (sc->audio_fd == dsnd_guids)
{ {
dsndcard = str1; Q_strncpyz(sc->name, str1, sizeof(sc->name));
dsndguid = guid; dsndguid = guid;
} }
dsnd_guids++; dsnd_guids++;
@ -626,17 +624,13 @@ static int DSOUND_InitCard_Internal (soundcardinfo_t *sc, int cardnum)
dsnd_guids=0; dsnd_guids=0;
dsndguid=NULL; dsndguid=NULL;
dsndcard="DirectSound";
if (pDirectSoundEnumerate) if (pDirectSoundEnumerate)
pDirectSoundEnumerate(&DSEnumCallback, NULL); pDirectSoundEnumerate(&DSEnumCallback, sc);
if (!snd_usemultipledevices.ival) //if only one device, ALWAYS use the default. if (!snd_usemultipledevices.ival) //if only one device, ALWAYS use the default.
dsndguid=NULL; dsndguid=NULL;
aimedforguid++; if (!dsndguid && sc->audio_fd != 0) //no more...
return SND_NOMORE;
if (!dsndguid) //no more...
if (aimedforguid != 1) //not the first device.
return SND_NOMORE;
sc->handle = Z_Malloc(sizeof(dshandle_t)); sc->handle = Z_Malloc(sizeof(dshandle_t));
dh = sc->handle; dh = sc->handle;
@ -680,7 +674,6 @@ static int DSOUND_InitCard_Internal (soundcardinfo_t *sc, int cardnum)
// } // }
} }
} }
Q_strncpyz(sc->name, dsndcard, sizeof(sc->name));
dscaps.dwSize = sizeof(dscaps); dscaps.dwSize = sizeof(dscaps);
@ -696,6 +689,7 @@ static int DSOUND_InitCard_Internal (soundcardinfo_t *sc, int cardnum)
return SND_ERROR; return SND_ERROR;
} }
SendMessage(mainwindow, WM_USER, 0, 0);
if (DS_OK != dh->pDS->lpVtbl->SetCooperativeLevel (dh->pDS, mainwindow, DSSCL_EXCLUSIVE)) if (DS_OK != dh->pDS->lpVtbl->SetCooperativeLevel (dh->pDS, mainwindow, DSSCL_EXCLUSIVE))
{ {
Con_SafePrintf ("Set coop level failed\n"); Con_SafePrintf ("Set coop level failed\n");

View file

@ -1189,10 +1189,6 @@ void S_Init (void)
void S_ShutdownCard(soundcardinfo_t *sc) void S_ShutdownCard(soundcardinfo_t *sc)
{ {
soundcardinfo_t *prev; soundcardinfo_t *prev;
#if defined(_WIN32) && defined(AVAIL_DSOUND)
extern int aimedforguid;
aimedforguid = 0;
#endif
if (sndcardinfo == sc) if (sndcardinfo == sc)
sndcardinfo = sc->next; sndcardinfo = sc->next;
@ -1211,10 +1207,6 @@ void S_ShutdownCard(soundcardinfo_t *sc)
void S_Shutdown(void) void S_Shutdown(void)
{ {
soundcardinfo_t *sc, *next; soundcardinfo_t *sc, *next;
#if defined(_WIN32) && defined(AVAIL_DSOUND)
extern int aimedforguid;
aimedforguid = 0;
#endif
for (sc = sndcardinfo; sc; sc=next) for (sc = sndcardinfo; sc; sc=next)
{ {

View file

@ -413,6 +413,7 @@ rulesetrule_t rulesetrules_nqr[] = {
{"ruleset_allow_fbmodels", "0"}, {"ruleset_allow_fbmodels", "0"},
{"r_vertexlight", "0"}, {"r_vertexlight", "0"},
{"v_projectionmode", "0"}, {"v_projectionmode", "0"},
{"sbar_teamstatus", "0"},
{NULL} {NULL}
}; };
@ -420,6 +421,7 @@ static ruleset_t rulesets[] =
{ {
{"strict", rulesetrules_strict}, {"strict", rulesetrules_strict},
{"nqr", rulesetrules_nqr}, {"nqr", rulesetrules_nqr},
//{"eql", rulesetrules_nqr},
{NULL} {NULL}
}; };

View file

@ -951,7 +951,7 @@ qboolean NET_StringToAdr (const char *s, int defaultport, netadr_t *a)
{ {
//make sure that the rest of the address is a valid ip address (4 or 6) //make sure that the rest of the address is a valid ip address (4 or 6)
if (!NET_StringToSockaddr (s+6, 0, &sadr, NULL, NULL)) if (!NET_StringToSockaddr (s+6, defaultport, &sadr, NULL, NULL))
{ {
a->type = NA_INVALID; a->type = NA_INVALID;
return false; return false;
@ -1016,6 +1016,14 @@ qboolean NET_StringToAdr (const char *s, int defaultport, netadr_t *a)
SockadrToNetadr (&sadr, a); SockadrToNetadr (&sadr, a);
#if !defined(HAVE_PACKET) && defined(HAVE_TCP)
//bump over protocols that cannot work in the first place.
if (a->type == NA_IP)
a->type = NA_TCP;
if (a->type == NA_IPV6)
a->type = NA_TCPV6;
#endif
return true; return true;
} }

View file

@ -216,6 +216,7 @@ qboolean Sys_ConditionWait(void *condv)
{ {
condvar_t *cv = (condvar_t *)condv; condvar_t *cv = (condvar_t *)condv;
qboolean success; qboolean success;
DWORD status;
// increase count for non-signaled waiting threads // increase count for non-signaled waiting threads
EnterCriticalSection(&cv->countlock); EnterCriticalSection(&cv->countlock);
@ -225,7 +226,18 @@ qboolean Sys_ConditionWait(void *condv)
LeaveCriticalSection(&cv->mainlock); // unlock as per condition variable definition LeaveCriticalSection(&cv->mainlock); // unlock as per condition variable definition
// wait on a signal // wait on a signal
#if 0
success = (WaitForSingleObject(cv->wait_sem, INFINITE) != WAIT_FAILED); success = (WaitForSingleObject(cv->wait_sem, INFINITE) != WAIT_FAILED);
#else
do
{
MSG msg;
while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
DispatchMessage (&msg);
status = MsgWaitForMultipleObjects(1, &cv->wait_sem, FALSE, INFINITE, QS_SENDMESSAGE|QS_POSTMESSAGE);
} while (status == (WAIT_OBJECT_0+1));
success = status != WAIT_FAILED;
#endif
// update waiting count and alert signaling thread that we're done to avoid the deadlock condition // update waiting count and alert signaling thread that we're done to avoid the deadlock condition
EnterCriticalSection(&cv->countlock); EnterCriticalSection(&cv->countlock);

View file

@ -411,7 +411,6 @@ Global
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.Release|Win32.Build.0 = Release|Win32 {32B12987-DF8C-4E40-B07C-B18586A4CA65}.Release|Win32.Build.0 = Release|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.Release|x64.ActiveCfg = Release|Win32 {32B12987-DF8C-4E40-B07C-B18586A4CA65}.Release|x64.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.D3DDebug|Win32.ActiveCfg = Debug|Win32 {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.D3DDebug|Win32.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.D3DDebug|Win32.Build.0 = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.D3DDebug|x64.ActiveCfg = Release|Win32 {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.D3DDebug|x64.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.D3DRelease|Win32.ActiveCfg = Release|Win32 {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.D3DRelease|Win32.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.D3DRelease|Win32.Build.0 = Release|Win32 {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.D3DRelease|Win32.Build.0 = Release|Win32
@ -424,7 +423,6 @@ Global
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLDebug|Win32.ActiveCfg = Debug|Win32 {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLDebug|Win32.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLDebug|x64.ActiveCfg = Debug|Win32 {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLDebug|x64.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLRelease|Win32.ActiveCfg = Release|Win32 {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLRelease|Win32.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLRelease|Win32.Build.0 = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLRelease|x64.ActiveCfg = Release|Win32 {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLRelease|x64.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MDebug|Win32.ActiveCfg = Debug|Win32 {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MDebug|Win32.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MDebug|x64.ActiveCfg = Debug|Win32 {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MDebug|x64.ActiveCfg = Debug|Win32
@ -458,7 +456,6 @@ Global
{9767E236-8454-44E9-8999-CD5BDAFBE9BA}.GLDebug|Win32.Build.0 = Debug|Win32 {9767E236-8454-44E9-8999-CD5BDAFBE9BA}.GLDebug|Win32.Build.0 = Debug|Win32
{9767E236-8454-44E9-8999-CD5BDAFBE9BA}.GLDebug|x64.ActiveCfg = Debug|Win32 {9767E236-8454-44E9-8999-CD5BDAFBE9BA}.GLDebug|x64.ActiveCfg = Debug|Win32
{9767E236-8454-44E9-8999-CD5BDAFBE9BA}.GLRelease|Win32.ActiveCfg = Release|Win32 {9767E236-8454-44E9-8999-CD5BDAFBE9BA}.GLRelease|Win32.ActiveCfg = Release|Win32
{9767E236-8454-44E9-8999-CD5BDAFBE9BA}.GLRelease|Win32.Build.0 = Release|Win32
{9767E236-8454-44E9-8999-CD5BDAFBE9BA}.GLRelease|x64.ActiveCfg = Release|Win32 {9767E236-8454-44E9-8999-CD5BDAFBE9BA}.GLRelease|x64.ActiveCfg = Release|Win32
{9767E236-8454-44E9-8999-CD5BDAFBE9BA}.MDebug|Win32.ActiveCfg = Debug|Win32 {9767E236-8454-44E9-8999-CD5BDAFBE9BA}.MDebug|Win32.ActiveCfg = Debug|Win32
{9767E236-8454-44E9-8999-CD5BDAFBE9BA}.MDebug|Win32.Build.0 = Debug|Win32 {9767E236-8454-44E9-8999-CD5BDAFBE9BA}.MDebug|Win32.Build.0 = Debug|Win32

File diff suppressed because it is too large Load diff