summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/cl_avi.c13
-rw-r--r--src/client/cl_cgame.c4
-rw-r--r--src/client/cl_cin.c132
-rw-r--r--src/client/cl_console.c14
-rw-r--r--src/client/cl_input.c12
-rw-r--r--src/client/cl_keys.c9
-rw-r--r--src/client/cl_main.c161
-rw-r--r--src/client/cl_parse.c4
-rw-r--r--src/client/cl_ui.c4
-rw-r--r--src/client/client.h9
-rw-r--r--src/client/libmumblelink.c3
-rw-r--r--src/client/qal.h7
-rw-r--r--src/client/snd_codec_ogg.c1
-rw-r--r--src/client/snd_main.c7
-rw-r--r--src/client/snd_openal.c103
15 files changed, 335 insertions, 148 deletions
diff --git a/src/client/cl_avi.c b/src/client/cl_avi.c
index c9680522..7f673fa8 100644
--- a/src/client/cl_avi.c
+++ b/src/client/cl_avi.c
@@ -368,8 +368,13 @@ qboolean CL_OpenAVIForWriting( const char *fileName )
else
afd.motionJpeg = qfalse;
- afd.cBuffer = Z_Malloc( afd.width * afd.height * 4 );
- afd.eBuffer = Z_Malloc( afd.width * afd.height * 4 );
+ // Buffers only need to store RGB pixels.
+ // Allocate a bit more space for the capture buffer to account for possible
+ // padding at the end of pixel lines, and padding for alignment
+ #define MAX_PACK_LEN 16
+ afd.cBuffer = Z_Malloc((afd.width * 3 + MAX_PACK_LEN - 1) * afd.height + MAX_PACK_LEN - 1);
+ // raw avi files have pixel lines start on 4-byte boundaries
+ afd.eBuffer = Z_Malloc(PAD(afd.width * 3, AVI_LINE_PADDING) * afd.height);
afd.a.rate = dma.speed;
afd.a.format = WAV_FORMAT_PCM;
@@ -467,7 +472,7 @@ void CL_WriteAVIVideoFrame( const byte *imageBuffer, int size )
{
int chunkOffset = afd.fileSize - afd.moviOffset - 8;
int chunkSize = 8 + size;
- int paddingSize = PAD( size, 2 ) - size;
+ int paddingSize = PADLEN(size, 2);
byte padding[ 4 ] = { 0 };
if( !afd.fileOpen )
@@ -541,7 +546,7 @@ void CL_WriteAVIAudioFrame( const byte *pcmBuffer, int size )
{
int chunkOffset = afd.fileSize - afd.moviOffset - 8;
int chunkSize = 8 + bytesInBuffer;
- int paddingSize = PAD( bytesInBuffer, 2 ) - bytesInBuffer;
+ int paddingSize = PADLEN(bytesInBuffer, 2);
byte padding[ 4 ] = { 0 };
bufIndex = 0;
diff --git a/src/client/cl_cgame.c b/src/client/cl_cgame.c
index 9f983cd8..babc5241 100644
--- a/src/client/cl_cgame.c
+++ b/src/client/cl_cgame.c
@@ -428,7 +428,7 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) {
Cvar_Update( VMA(1) );
return 0;
case CG_CVAR_SET:
- Cvar_Set( VMA(1), VMA(2) );
+ Cvar_SetSafe( VMA(1), VMA(2) );
return 0;
case CG_CVAR_VARIABLESTRINGBUFFER:
Cvar_VariableStringBuffer( VMA(1), VMA(2), args[3] );
@@ -466,7 +466,7 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) {
CL_AddCgameCommand( VMA(1) );
return 0;
case CG_REMOVECOMMAND:
- Cmd_RemoveCommand( VMA(1) );
+ Cmd_RemoveCommandSafe( VMA(1) );
return 0;
case CG_SENDCLIENTCOMMAND:
CL_AddReliableCommand(VMA(1), qfalse);
diff --git a/src/client/cl_cin.c b/src/client/cl_cin.c
index 6d03d40a..213b7a40 100644
--- a/src/client/cl_cin.c
+++ b/src/client/cl_cin.c
@@ -1500,6 +1500,66 @@ void CIN_SetLooping(int handle, qboolean loop) {
/*
==================
+CIN_ResampleCinematic
+
+Resample cinematic to 256x256 and store in buf2
+==================
+*/
+void CIN_ResampleCinematic(int handle, int *buf2) {
+ int ix, iy, *buf3, xm, ym, ll;
+ byte *buf;
+
+ buf = cinTable[handle].buf;
+
+ xm = cinTable[handle].CIN_WIDTH/256;
+ ym = cinTable[handle].CIN_HEIGHT/256;
+ ll = 8;
+ if (cinTable[handle].CIN_WIDTH==512) {
+ ll = 9;
+ }
+
+ buf3 = (int*)buf;
+ if (xm==2 && ym==2) {
+ byte *bc2, *bc3;
+ int ic, iiy;
+
+ bc2 = (byte *)buf2;
+ bc3 = (byte *)buf3;
+ for (iy = 0; iy<256; iy++) {
+ iiy = iy<<12;
+ for (ix = 0; ix<2048; ix+=8) {
+ for(ic = ix;ic<(ix+4);ic++) {
+ *bc2=(bc3[iiy+ic]+bc3[iiy+4+ic]+bc3[iiy+2048+ic]+bc3[iiy+2048+4+ic])>>2;
+ bc2++;
+ }
+ }
+ }
+ } else if (xm==2 && ym==1) {
+ byte *bc2, *bc3;
+ int ic, iiy;
+
+ bc2 = (byte *)buf2;
+ bc3 = (byte *)buf3;
+ for (iy = 0; iy<256; iy++) {
+ iiy = iy<<11;
+ for (ix = 0; ix<2048; ix+=8) {
+ for(ic = ix;ic<(ix+4);ic++) {
+ *bc2=(bc3[iiy+ic]+bc3[iiy+4+ic])>>1;
+ bc2++;
+ }
+ }
+ }
+ } else {
+ for (iy = 0; iy<256; iy++) {
+ for (ix = 0; ix<256; ix++) {
+ buf2[(iy<<8)+ix] = buf3[((iy*ym)<<ll) + (ix*xm)];
+ }
+ }
+ }
+}
+
+/*
+==================
SCR_DrawCinematic
==================
@@ -1522,54 +1582,12 @@ void CIN_DrawCinematic (int handle) {
SCR_AdjustFrom640( &x, &y, &w, &h );
if (cinTable[handle].dirty && (cinTable[handle].CIN_WIDTH != cinTable[handle].drawX || cinTable[handle].CIN_HEIGHT != cinTable[handle].drawY)) {
- int ix, iy, *buf2, *buf3, xm, ym, ll;
-
- xm = cinTable[handle].CIN_WIDTH/256;
- ym = cinTable[handle].CIN_HEIGHT/256;
- ll = 8;
- if (cinTable[handle].CIN_WIDTH==512) {
- ll = 9;
- }
-
- buf3 = (int*)buf;
+ int *buf2;
+
buf2 = Hunk_AllocateTempMemory( 256*256*4 );
- if (xm==2 && ym==2) {
- byte *bc2, *bc3;
- int ic, iiy;
-
- bc2 = (byte *)buf2;
- bc3 = (byte *)buf3;
- for (iy = 0; iy<256; iy++) {
- iiy = iy<<12;
- for (ix = 0; ix<2048; ix+=8) {
- for(ic = ix;ic<(ix+4);ic++) {
- *bc2=(bc3[iiy+ic]+bc3[iiy+4+ic]+bc3[iiy+2048+ic]+bc3[iiy+2048+4+ic])>>2;
- bc2++;
- }
- }
- }
- } else if (xm==2 && ym==1) {
- byte *bc2, *bc3;
- int ic, iiy;
-
- bc2 = (byte *)buf2;
- bc3 = (byte *)buf3;
- for (iy = 0; iy<256; iy++) {
- iiy = iy<<11;
- for (ix = 0; ix<2048; ix+=8) {
- for(ic = ix;ic<(ix+4);ic++) {
- *bc2=(bc3[iiy+ic]+bc3[iiy+4+ic])>>1;
- bc2++;
- }
- }
- }
- } else {
- for (iy = 0; iy<256; iy++) {
- for (ix = 0; ix<256; ix++) {
- buf2[(iy<<8)+ix] = buf3[((iy*ym)<<ll) + (ix*xm)];
- }
- }
- }
+
+ CIN_ResampleCinematic(handle, buf2);
+
re.DrawStretchRaw( x, y, w, h, 256, 256, (byte *)buf2, handle, qtrue);
cinTable[handle].dirty = qfalse;
Hunk_FreeTempMemory(buf2);
@@ -1649,7 +1667,25 @@ void CIN_UploadCinematic(int handle) {
}
}
}
- re.UploadCinematic( 256, 256, 256, 256, cinTable[handle].buf, handle, cinTable[handle].dirty);
+
+ // Resample the video if needed
+ if (cinTable[handle].dirty && (cinTable[handle].CIN_WIDTH != cinTable[handle].drawX || cinTable[handle].CIN_HEIGHT != cinTable[handle].drawY)) {
+ int *buf2;
+
+ buf2 = Hunk_AllocateTempMemory( 256*256*4 );
+
+ CIN_ResampleCinematic(handle, buf2);
+
+ re.UploadCinematic( cinTable[handle].CIN_WIDTH, cinTable[handle].CIN_HEIGHT, 256, 256, (byte *)buf2, handle, qtrue);
+ cinTable[handle].dirty = qfalse;
+ Hunk_FreeTempMemory(buf2);
+ } else {
+ // Upload video at normal resolution
+ re.UploadCinematic( cinTable[handle].CIN_WIDTH, cinTable[handle].CIN_HEIGHT, cinTable[handle].drawX, cinTable[handle].drawY,
+ cinTable[handle].buf, handle, cinTable[handle].dirty);
+ cinTable[handle].dirty = qfalse;
+ }
+
if (cl_inGameVideo->integer == 0 && cinTable[handle].playonwalls == 1) {
cinTable[handle].playonwalls--;
}
diff --git a/src/client/cl_console.c b/src/client/cl_console.c
index 88ced07a..c7d01bc7 100644
--- a/src/client/cl_console.c
+++ b/src/client/cl_console.c
@@ -240,7 +240,7 @@ Cmd_CompleteTxtName
*/
void Cmd_CompleteTxtName( char *args, int argNum ) {
if( argNum == 2 ) {
- Field_CompleteFilename( "", "txt", qfalse );
+ Field_CompleteFilename( "", "txt", qfalse, qtrue );
}
}
@@ -297,9 +297,9 @@ If no console is visible, the text will appear at the top of the game window
================
*/
void CL_ConsolePrint( char *txt ) {
- int y;
- int c, l;
- int color;
+ int y, l;
+ unsigned char c;
+ unsigned short color;
qboolean skipnotify = qfalse; // NERVE - SMF
// TTimo - prefix for text that shows up in console but not in notify
@@ -336,7 +336,7 @@ void CL_ConsolePrint( char *txt ) {
color = ColorIndex(COLOR_WHITE);
- while ( (c = *txt) != 0 ) {
+ while ( (c = *((unsigned char *) txt)) != 0 ) {
if ( Q_IsColorString( txt ) ) {
color = ColorIndex( *(txt+1) );
txt += 2;
@@ -373,10 +373,8 @@ void CL_ConsolePrint( char *txt ) {
y = con.current % con.totallines;
con.text[y*con.linewidth+con.x] = (color << 8) | c;
con.x++;
- if (con.x >= con.linewidth) {
+ if(con.x >= con.linewidth)
Con_Linefeed(skipnotify);
- con.x = 0;
- }
break;
}
}
diff --git a/src/client/cl_input.c b/src/client/cl_input.c
index 2f063161..ee5b478e 100644
--- a/src/client/cl_input.c
+++ b/src/client/cl_input.c
@@ -417,15 +417,19 @@ void CL_JoystickMove( usercmd_t *cmd ) {
}
if ( !in_strafe.active ) {
- cl.viewangles[YAW] += anglespeed * cl_yawspeed->value * cl.joystickAxis[AXIS_SIDE];
+ cl.viewangles[YAW] += anglespeed * j_yaw->value * cl.joystickAxis[j_yaw_axis->integer];
+ cmd->rightmove = ClampChar( cmd->rightmove + (int) (j_side->value * cl.joystickAxis[j_side_axis->integer]) );
} else {
- cmd->rightmove = ClampChar( cmd->rightmove + cl.joystickAxis[AXIS_SIDE] );
+ cl.viewangles[YAW] += anglespeed * j_side->value * cl.joystickAxis[j_side_axis->integer];
+ cmd->rightmove = ClampChar( cmd->rightmove + (int) (j_yaw->value * cl.joystickAxis[j_yaw_axis->integer]) );
}
if ( in_mlooking ) {
- cl.viewangles[PITCH] += anglespeed * cl_pitchspeed->value * cl.joystickAxis[AXIS_FORWARD];
+ cl.viewangles[PITCH] += anglespeed * j_forward->value * cl.joystickAxis[j_forward_axis->integer];
+ cmd->forwardmove = ClampChar( cmd->forwardmove + (int) (j_pitch->value * cl.joystickAxis[j_pitch_axis->integer]) );
} else {
- cmd->forwardmove = ClampChar( cmd->forwardmove + cl.joystickAxis[AXIS_FORWARD] );
+ cl.viewangles[PITCH] += anglespeed * j_pitch->value * cl.joystickAxis[j_pitch_axis->integer];
+ cmd->forwardmove = ClampChar( cmd->forwardmove + (int) (j_forward->value * cl.joystickAxis[j_forward_axis->integer]) );
}
cmd->upmove = ClampChar( cmd->upmove + cl.joystickAxis[AXIS_UP] );
diff --git a/src/client/cl_keys.c b/src/client/cl_keys.c
index c2cda2d6..71569fe5 100644
--- a/src/client/cl_keys.c
+++ b/src/client/cl_keys.c
@@ -1127,7 +1127,7 @@ void CL_KeyDownEvent( int key, unsigned time )
{
keys[key].down = qtrue;
keys[key].repeats++;
- if( keys[key].repeats == 1 )
+ if( keys[key].repeats == 1 && key != K_SCROLLOCK && key != K_KP_NUMLOCK && key != K_CAPSLOCK )
anykeydown++;
if( keys[K_ALT].down && key == K_ENTER )
@@ -1212,7 +1212,9 @@ void CL_KeyUpEvent( int key, unsigned time )
{
keys[key].repeats = 0;
keys[key].down = qfalse;
- anykeydown--;
+ if (key != K_SCROLLOCK && key != K_KP_NUMLOCK && key != K_CAPSLOCK)
+ anykeydown--;
+
if (anykeydown < 0) {
anykeydown = 0;
}
@@ -1293,6 +1295,9 @@ void Key_ClearStates (void)
anykeydown = 0;
for ( i=0 ; i < MAX_KEYS ; i++ ) {
+ if (i == K_SCROLLOCK || i == K_KP_NUMLOCK || i == K_CAPSLOCK)
+ continue;
+
if ( keys[i].down ) {
CL_KeyEvent( i, qfalse, 0 );
diff --git a/src/client/cl_main.c b/src/client/cl_main.c
index c7ae2614..5166804f 100644
--- a/src/client/cl_main.c
+++ b/src/client/cl_main.c
@@ -84,6 +84,15 @@ cvar_t *m_forward;
cvar_t *m_side;
cvar_t *m_filter;
+cvar_t *j_pitch;
+cvar_t *j_yaw;
+cvar_t *j_forward;
+cvar_t *j_side;
+cvar_t *j_pitch_axis;
+cvar_t *j_yaw_axis;
+cvar_t *j_forward_axis;
+cvar_t *j_side_axis;
+
cvar_t *cl_activeAction;
cvar_t *cl_motdString;
@@ -102,6 +111,8 @@ cvar_t *cl_guidServerUniq;
cvar_t *cl_consoleKeys;
+cvar_t *cl_gamename;
+
clientActive_t cl;
clientConnection_t clc;
clientStatic_t cls;
@@ -129,6 +140,7 @@ int serverStatusCount;
void hA3Dg_ExportRenderGeom (refexport_t *incoming_re);
#endif
+extern void GLimp_Minimize(void);
extern void SV_BotFrame( int time );
void CL_CheckForResend( void );
void CL_ShowIP_f(void);
@@ -676,14 +688,14 @@ void CL_Record_f( void ) {
if ( Cmd_Argc() == 2 ) {
s = Cmd_Argv(1);
Q_strncpyz( demoName, s, sizeof( demoName ) );
- Com_sprintf (name, sizeof(name), "demos/%s.dm_%d", demoName, PROTOCOL_VERSION );
+ Com_sprintf (name, sizeof(name), "demos/%s.%s%d", demoName, DEMOEXT, PROTOCOL_VERSION );
} else {
int number;
// scan for a free demo name
for ( number = 0 ; number <= 9999 ; number++ ) {
CL_DemoFilename( number, demoName );
- Com_sprintf (name, sizeof(name), "demos/%s.dm_%d", demoName, PROTOCOL_VERSION );
+ Com_sprintf (name, sizeof(name), "demos/%s.%s%d", demoName, DEMOEXT, PROTOCOL_VERSION );
if (!FS_FileExists(name))
break; // file doesn't exist
@@ -933,9 +945,22 @@ static void CL_WalkDemoExt(char *arg, char *name, int *demofile)
{
int i = 0;
*demofile = 0;
+
+ Com_sprintf (name, MAX_OSPATH, "demos/%s.%s%d", arg, DEMOEXT, PROTOCOL_VERSION);
+
+ FS_FOpenFileRead( name, demofile, qtrue );
+
+ if (*demofile)
+ {
+ Com_Printf("Demo file: %s\n", name);
+ return;
+ }
+
+ Com_Printf("Not found: %s\n", name);
+
while(demo_protocols[i])
{
- Com_sprintf (name, MAX_OSPATH, "demos/%s.dm_%d", arg, demo_protocols[i]);
+ Com_sprintf (name, MAX_OSPATH, "demos/%s.%s%d", arg, DEMOEXT, demo_protocols[i]);
FS_FOpenFileRead( name, demofile, qtrue );
if (*demofile)
{
@@ -959,8 +984,8 @@ static void CL_CompleteDemoName( char *args, int argNum )
{
char demoExt[ 16 ];
- Com_sprintf( demoExt, sizeof( demoExt ), ".dm_%d", PROTOCOL_VERSION );
- Field_CompleteFilename( "demos", demoExt, qtrue );
+ Com_sprintf(demoExt, sizeof(demoExt), ".%s%d", DEMOEXT, PROTOCOL_VERSION);
+ Field_CompleteFilename( "demos", demoExt, qtrue, qtrue );
}
}
@@ -992,34 +1017,41 @@ void CL_PlayDemo_f( void ) {
CL_Disconnect( qtrue );
- // check for an extension .dm_?? (?? is protocol)
- ext_test = arg + strlen(arg) - 6;
- if ((strlen(arg) > 6) && (ext_test[0] == '.') &&
- ((ext_test[1] == 'd') || (ext_test[1] == 'D')) &&
- ((ext_test[2] == 'm') || (ext_test[2] == 'M')) &&
- (ext_test[3] == '_'))
+ // check for an extension .DEMOEXT_?? (?? is protocol)
+ ext_test = Q_strrchr(arg, '.');
+
+ if(ext_test && !Q_stricmpn(ext_test + 1, DEMOEXT, ARRAY_LEN(DEMOEXT) - 1))
{
- protocol = atoi(ext_test+4);
- i=0;
- while(demo_protocols[i])
+ protocol = atoi(ext_test + ARRAY_LEN(DEMOEXT));
+
+ for(i = 0; demo_protocols[i]; i++)
{
- if (demo_protocols[i] == protocol)
+ if(demo_protocols[i] == protocol)
break;
- i++;
}
- if (demo_protocols[i])
+
+ if(demo_protocols[i] || protocol == PROTOCOL_VERSION)
{
- Com_sprintf (name, sizeof(name), "demos/%s", arg);
- FS_FOpenFileRead( name, &clc.demofile, qtrue );
- } else {
+ Com_sprintf(name, sizeof(name), "demos/%s", arg);
+ FS_FOpenFileRead(name, &clc.demofile, qtrue);
+ }
+ else
+ {
+ int len;
+
Com_Printf("Protocol %d not supported for demos\n", protocol);
- Q_strncpyz(retry, arg, sizeof(retry));
- retry[strlen(retry)-6] = 0;
- CL_WalkDemoExt( retry, name, &clc.demofile );
+ len = ext_test - arg;
+
+ if(len >= ARRAY_LEN(retry))
+ len = ARRAY_LEN(retry) - 1;
+
+ Q_strncpyz(retry, arg, len + 1);
+ retry[len] = '\0';
+ CL_WalkDemoExt(retry, name, &clc.demofile);
}
- } else {
- CL_WalkDemoExt( arg, name, &clc.demofile );
}
+ else
+ CL_WalkDemoExt(arg, name, &clc.demofile);
if (!clc.demofile) {
Com_Error( ERR_DROP, "couldn't open %s", name);
@@ -2421,7 +2453,7 @@ CL_ServersResponsePacket
===================
*/
void CL_ServersResponsePacket( const netadr_t* from, msg_t *msg, qboolean extended ) {
- int i, count, total;
+ int i, j, count, total;
netadr_t addresses[MAX_SERVERSPERPACKET];
int numservers;
byte* buffptr;
@@ -2538,6 +2570,18 @@ void CL_ServersResponsePacket( const netadr_t* from, msg_t *msg, qboolean extend
// build net address
serverInfo_t *server = &cls.globalServers[count];
+ // Tequila: It's possible to have sent many master server requests. Then
+ // we may receive many times the same addresses from the master server.
+ // We just avoid to add a server if it is still in the global servers list.
+ for (j = 0; j < count; j++)
+ {
+ if (NET_CompareAdr(cls.globalServers[j].adr, addresses[i]))
+ break;
+ }
+
+ if (j < count)
+ continue;
+
CL_InitServerInfo( server, &addresses[i] );
Q_strncpyz( server->label, label, sizeof( server->label ) );
// advance to next slot
@@ -3363,6 +3407,7 @@ void CL_Init( void ) {
// offset for the power function (for style 1, ignored otherwise)
// this should be set to the max rate value
cl_mouseAccelOffset = Cvar_Get( "cl_mouseAccelOffset", "5", CVAR_ARCHIVE );
+ Cvar_CheckRange(cl_mouseAccelOffset, 0.001f, 50000.0f, qfalse);
cl_showMouseRate = Cvar_Get ("cl_showmouserate", "0", 0);
@@ -3394,6 +3439,15 @@ void CL_Init( void ) {
m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE);
#endif
+ j_pitch = Cvar_Get ("j_pitch", "0.022", CVAR_ARCHIVE);
+ j_yaw = Cvar_Get ("j_yaw", "-0.022", CVAR_ARCHIVE);
+ j_forward = Cvar_Get ("j_forward", "-0.25", CVAR_ARCHIVE);
+ j_side = Cvar_Get ("j_side", "0.25", CVAR_ARCHIVE);
+ j_pitch_axis = Cvar_Get ("j_pitch_axis", "3", CVAR_ARCHIVE);
+ j_yaw_axis = Cvar_Get ("j_yaw_axis", "4", CVAR_ARCHIVE);
+ j_forward_axis = Cvar_Get ("j_forward_axis", "1", CVAR_ARCHIVE);
+ j_side_axis = Cvar_Get ("j_side_axis", "0", CVAR_ARCHIVE);
+
cl_motdString = Cvar_Get( "cl_motdString", "", CVAR_ROM );
Cvar_Get( "cl_maxPing", "800", CVAR_ARCHIVE );
@@ -3405,6 +3459,8 @@ void CL_Init( void ) {
// ~ and `, as keys and characters
cl_consoleKeys = Cvar_Get( "cl_consoleKeys", "~ ` 0x7e 0x60", CVAR_ARCHIVE);
+ cl_gamename = Cvar_Get("cl_gamename", GAMENAME_FOR_MASTER, CVAR_TEMP);
+
// userinfo
Cvar_Get ("name", Sys_GetCurrentUser( ), CVAR_USERINFO | CVAR_ARCHIVE );
Cvar_Get ("rate", "25000", CVAR_USERINFO | CVAR_ARCHIVE );
@@ -3481,6 +3537,7 @@ void CL_Init( void ) {
Cmd_AddCommand ("model", CL_SetModel_f );
Cmd_AddCommand ("video", CL_Video_f );
Cmd_AddCommand ("stopvideo", CL_StopVideo_f );
+ Cmd_AddCommand("minimize", GLimp_Minimize);
CL_InitRef();
SCR_Init ();
@@ -3944,9 +4001,9 @@ void CL_GlobalServers_f( void ) {
int count, i, masterNum;
char command[1024], *masteraddress;
- if ((count = Cmd_Argc()) < 3 || (masterNum = atoi(Cmd_Argv(1))) < 0 || masterNum > 4)
+ if ((count = Cmd_Argc()) < 3 || (masterNum = atoi(Cmd_Argv(1))) < 0 || masterNum > MAX_MASTER_SERVERS - 1)
{
- Com_Printf( "usage: globalservers <master# 0-4> <protocol> [keywords]\n");
+ Com_Printf("usage: globalservers <master# 0-%d> <protocol> [keywords]\n", MAX_MASTER_SERVERS - 1);
return;
}
@@ -3977,10 +4034,27 @@ void CL_GlobalServers_f( void ) {
cls.numglobalservers = -1;
cls.pingUpdateSource = AS_GLOBAL;
- // TODO: test if we only have an IPv6 connection. If it's the case,
- // request IPv6 servers only by appending " ipv6" to the command
- Com_sprintf( command, sizeof(command), "getserversExt "
- GAMENAME_FOR_MASTER " %s", Cmd_Argv(2) );
+ // Use the extended query for IPv6 masters
+ if (to.type == NA_IP6 || to.type == NA_MULTICAST6)
+ {
+ int v4enabled = Cvar_VariableIntegerValue("net_enabled") & NET_ENABLEV4;
+
+ if(v4enabled)
+ {
+ Com_sprintf(command, sizeof(command), "getserversExt %s %s ipv6",
+ cl_gamename->string, Cmd_Argv(2));
+ }
+ else
+ {
+ Com_sprintf(command, sizeof(command), "getserversExt %s %s",
+ cl_gamename->string, Cmd_Argv(2));
+ }
+
+ // TODO: test if we only have an IPv6 connection. If it's the case,
+ // request IPv6 servers only by appending " ipv6" to the command
+ }
+ else
+ Com_sprintf(command, sizeof(command), "getservers %s", Cmd_Argv(2));
for (i=3; i < count; i++)
{
@@ -4004,9 +4078,9 @@ void CL_GetPing( int n, char *buf, int buflen, int *pingtime )
int time;
int maxPing;
- if (!cl_pinglist[n].adr.port)
+ if (n < 0 || n >= MAX_PINGREQUESTS || !cl_pinglist[n].adr.port)
{
- // empty slot
+ // empty or invalid slot
buf[0] = '\0';
*pingtime = 0;
return;
@@ -4038,29 +4112,14 @@ void CL_GetPing( int n, char *buf, int buflen, int *pingtime )
/*
==================
-CL_UpdateServerInfo
-==================
-*/
-void CL_UpdateServerInfo( int n )
-{
- if (!cl_pinglist[n].adr.port)
- {
- return;
- }
-
- CL_SetServerInfoByAddress(cl_pinglist[n].adr, cl_pinglist[n].info, cl_pinglist[n].time );
-}
-
-/*
-==================
CL_GetPingInfo
==================
*/
void CL_GetPingInfo( int n, char *buf, int buflen )
{
- if (!cl_pinglist[n].adr.port)
+ if (n < 0 || n >= MAX_PINGREQUESTS || !cl_pinglist[n].adr.port)
{
- // empty slot
+ // empty or invalid slot
if (buflen)
buf[0] = '\0';
return;
diff --git a/src/client/cl_parse.c b/src/client/cl_parse.c
index 64404f78..42465f1b 100644
--- a/src/client/cl_parse.c
+++ b/src/client/cl_parse.c
@@ -413,13 +413,13 @@ void CL_SystemInfoChanged( void ) {
else
{
// If this cvar may not be modified by a server discard the value.
- if(!(cvar_flags & (CVAR_SYSTEMINFO | CVAR_SERVER_CREATED)))
+ if(!(cvar_flags & (CVAR_SYSTEMINFO | CVAR_SERVER_CREATED | CVAR_USER_CREATED)))
{
Com_Printf(S_COLOR_YELLOW "WARNING: server is not allowed to set %s=%s\n", key, value);
continue;
}
- Cvar_Set(key, value);
+ Cvar_SetSafe(key, value);
}
}
// if game folder should not be set and it is set at the client side
diff --git a/src/client/cl_ui.c b/src/client/cl_ui.c
index 6b748cf7..edf5ef35 100644
--- a/src/client/cl_ui.c
+++ b/src/client/cl_ui.c
@@ -724,7 +724,7 @@ intptr_t CL_UISystemCalls( intptr_t *args ) {
return 0;
case UI_CVAR_SET:
- Cvar_Set( VMA(1), VMA(2) );
+ Cvar_SetSafe( VMA(1), VMA(2) );
return 0;
case UI_CVAR_VARIABLEVALUE:
@@ -735,7 +735,7 @@ intptr_t CL_UISystemCalls( intptr_t *args ) {
return 0;
case UI_CVAR_SETVALUE:
- Cvar_SetValue( VMA(1), VMF(2) );
+ Cvar_SetValueSafe( VMA(1), VMF(2) );
return 0;
case UI_CVAR_RESET:
diff --git a/src/client/client.h b/src/client/client.h
index 0afdc686..26af5072 100644
--- a/src/client/client.h
+++ b/src/client/client.h
@@ -397,6 +397,15 @@ extern cvar_t *m_forward;
extern cvar_t *m_side;
extern cvar_t *m_filter;
+extern cvar_t *j_pitch;
+extern cvar_t *j_yaw;
+extern cvar_t *j_forward;
+extern cvar_t *j_side;
+extern cvar_t *j_pitch_axis;
+extern cvar_t *j_yaw_axis;
+extern cvar_t *j_forward_axis;
+extern cvar_t *j_side_axis;
+
extern cvar_t *cl_timedemo;
extern cvar_t *cl_aviFrameRate;
extern cvar_t *cl_aviMotionJpeg;
diff --git a/src/client/libmumblelink.c b/src/client/libmumblelink.c
index 10e90011..25ca6786 100644
--- a/src/client/libmumblelink.c
+++ b/src/client/libmumblelink.c
@@ -26,6 +26,9 @@
#define uint32_t UINT32
#else
#include <unistd.h>
+#ifdef __sun
+#define _POSIX_C_SOURCE 199309L
+#endif
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/src/client/qal.h b/src/client/qal.h
index f999dc4f..7665e6ef 100644
--- a/src/client/qal.h
+++ b/src/client/qal.h
@@ -48,6 +48,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#endif
#endif
+/* Hack to enable compiling both on OpenAL SDK and OpenAL-soft. */
+#ifndef ALC_ENUMERATE_ALL_EXT
+# define ALC_ENUMERATE_ALL_EXT 1
+# define ALC_DEFAULT_ALL_DEVICES_SPECIFIER 0x1012
+# define ALC_ALL_DEVICES_SPECIFIER 0x1013
+#endif
+
#ifdef USE_OPENAL_DLOPEN
extern LPALENABLE qalEnable;
extern LPALDISABLE qalDisable;
diff --git a/src/client/snd_codec_ogg.c b/src/client/snd_codec_ogg.c
index eb754ca0..0ca2f689 100644
--- a/src/client/snd_codec_ogg.c
+++ b/src/client/snd_codec_ogg.c
@@ -32,6 +32,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// includes for the OGG codec
#include <errno.h>
+#define OV_EXCLUDE_STATIC_CALLBACKS
#include <vorbis/vorbisfile.h>
// The OGG codec can return the samples in a number of different formats,
diff --git a/src/client/snd_main.c b/src/client/snd_main.c
index 1215e954..22213cc9 100644
--- a/src/client/snd_main.c
+++ b/src/client/snd_main.c
@@ -425,12 +425,9 @@ void S_Play_f( void ) {
i = 1;
while ( i<Cmd_Argc() ) {
- if ( !Q_strrchr(Cmd_Argv(i), '.') ) {
- Com_sprintf( name, sizeof(name), "%s.wav", Cmd_Argv(1) );
- } else {
- Q_strncpyz( name, Cmd_Argv(i), sizeof(name) );
- }
+ Q_strncpyz( name, Cmd_Argv(i), sizeof(name) );
h = si.RegisterSound( name, qfalse );
+
if( h ) {
si.StartLocalSound( h, CHAN_LOCAL_SOUND );
}
diff --git a/src/client/snd_openal.c b/src/client/snd_openal.c
index 6f48713f..9b60aa71 100644
--- a/src/client/snd_openal.c
+++ b/src/client/snd_openal.c
@@ -42,7 +42,13 @@ cvar_t *s_alRolloff;
cvar_t *s_alGraceDistance;
cvar_t *s_alDriver;
cvar_t *s_alDevice;
+cvar_t *s_alInputDevice;
cvar_t *s_alAvailableDevices;
+cvar_t *s_alAvailableInputDevices;
+
+static qboolean enumeration_ext = qfalse;
+static qboolean enumeration_all_ext = qfalse;
+static qboolean capture_ext = qfalse;
/*
=================
@@ -630,7 +636,7 @@ static void S_AL_ScaleGain(src_t *chksrc, vec3_t origin)
scaleFactor *= chksrc->curGain;
- if(chksrc->scaleGain != scaleFactor);
+ if(chksrc->scaleGain != scaleFactor)
{
chksrc->scaleGain = scaleFactor;
S_AL_Gain(chksrc->alSource, chksrc->scaleGain);
@@ -2286,22 +2292,34 @@ void S_AL_MasterGain( float gain )
S_AL_SoundInfo
=================
*/
-static
-void S_AL_SoundInfo( void )
+static void S_AL_SoundInfo(void)
{
Com_Printf( "OpenAL info:\n" );
- Com_Printf( " Vendor: %s\n", qalGetString( AL_VENDOR ) );
- Com_Printf( " Version: %s\n", qalGetString( AL_VERSION ) );
- Com_Printf( " Renderer: %s\n", qalGetString( AL_RENDERER ) );
- Com_Printf( " AL Extensions: %s\n", qalGetString( AL_EXTENSIONS ) );
+ Com_Printf( " Vendor: %s\n", qalGetString( AL_VENDOR ) );
+ Com_Printf( " Version: %s\n", qalGetString( AL_VERSION ) );
+ Com_Printf( " Renderer: %s\n", qalGetString( AL_RENDERER ) );
+ Com_Printf( " AL Extensions: %s\n", qalGetString( AL_EXTENSIONS ) );
Com_Printf( " ALC Extensions: %s\n", qalcGetString( alDevice, ALC_EXTENSIONS ) );
- if(qalcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT"))
+
+ if(enumeration_all_ext)
+ Com_Printf(" Device: %s\n", qalcGetString(alDevice, ALC_ALL_DEVICES_SPECIFIER));
+ else if(enumeration_ext)
+ Com_Printf(" Device: %s\n", qalcGetString(alDevice, ALC_DEVICE_SPECIFIER));
+
+ if(enumeration_all_ext || enumeration_ext)
+ Com_Printf(" Available Devices:\n%s", s_alAvailableDevices->string);
+
+#ifdef USE_VOIP
+ if(capture_ext)
{
- Com_Printf(" Device: %s\n", qalcGetString(alDevice, ALC_DEVICE_SPECIFIER));
- Com_Printf("Available Devices:\n%s", s_alAvailableDevices->string);
+ Com_Printf(" Input Device: %s\n", qalcGetString(alCaptureDevice, ALC_CAPTURE_DEVICE_SPECIFIER));
+ Com_Printf(" Available Input Devices:\n%s", s_alAvailableInputDevices->string);
}
+#endif
}
+
+
/*
=================
S_AL_Shutdown
@@ -2350,6 +2368,7 @@ qboolean S_AL_Init( soundInterface_t *si )
{
#ifdef USE_OPENAL
const char* device = NULL;
+ const char* inputdevice = NULL;
int i;
if( !si ) {
@@ -2375,6 +2394,7 @@ qboolean S_AL_Init( soundInterface_t *si )
s_alDriver = Cvar_Get( "s_alDriver", ALDRIVER_DEFAULT, CVAR_ARCHIVE | CVAR_LATCH );
+ s_alInputDevice = Cvar_Get( "s_alInputDevice", "", CVAR_ARCHIVE | CVAR_LATCH );
s_alDevice = Cvar_Get("s_alDevice", "", CVAR_ARCHIVE | CVAR_LATCH);
// Load QAL
@@ -2388,17 +2408,35 @@ qboolean S_AL_Init( soundInterface_t *si )
if(device && !*device)
device = NULL;
- // Device enumeration support (extension is implemented reasonably only on Windows right now).
- if(qalcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT"))
+ inputdevice = s_alInputDevice->string;
+ if(inputdevice && !*inputdevice)
+ inputdevice = NULL;
+
+
+ // Device enumeration support
+ enumeration_all_ext = qalcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT");
+ enumeration_ext = qalcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT");
+
+ if(enumeration_ext || enumeration_all_ext)
{
- char devicenames[1024] = "";
+ char devicenames[16384] = "";
const char *devicelist;
const char *defaultdevice;
int curlen;
-
+
// get all available devices + the default device name.
- devicelist = qalcGetString(NULL, ALC_DEVICE_SPECIFIER);
- defaultdevice = qalcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
+ if(enumeration_ext)
+ {
+ devicelist = qalcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER);
+ defaultdevice = qalcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER);
+ }
+ else
+ {
+ // We don't have ALC_ENUMERATE_ALL_EXT but normal enumeration.
+ devicelist = qalcGetString(NULL, ALC_DEVICE_SPECIFIER);
+ defaultdevice = qalcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
+ enumeration_ext = qtrue;
+ }
#ifdef _WIN32
// check whether the default device is generic hardware. If it is, change to
@@ -2487,15 +2525,40 @@ qboolean S_AL_Init( soundInterface_t *si )
}
else
{
+ char inputdevicenames[16384] = "";
+ const char *inputdevicelist;
+ const char *defaultinputdevice;
+ int curlen;
+
+ capture_ext = qtrue;
+
+ // get all available input devices + the default input device name.
+ inputdevicelist = qalcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER);
+ defaultinputdevice = qalcGetString(NULL, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER);
+
+ // dump a list of available devices to a cvar for the user to see.
+ while((curlen = strlen(inputdevicelist)))
+ {
+ Q_strcat(inputdevicenames, sizeof(inputdevicenames), inputdevicelist);
+ Q_strcat(inputdevicenames, sizeof(inputdevicenames), "\n");
+ inputdevicelist += curlen + 1;
+ }
+
+ s_alAvailableInputDevices = Cvar_Get("s_alAvailableInputDevices", inputdevicenames, CVAR_ROM | CVAR_NORESTART);
+
// !!! FIXME: 8000Hz is what Speex narrowband mode needs, but we
// !!! FIXME: should probably open the capture device after
// !!! FIXME: initializing Speex so we can change to wideband
// !!! FIXME: if we like.
- Com_Printf("OpenAL default capture device is '%s'\n",
- qalcGetString(NULL, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER));
- alCaptureDevice = qalcCaptureOpenDevice(NULL, 8000, AL_FORMAT_MONO16, 4096);
+ Com_Printf("OpenAL default capture device is '%s'\n", defaultinputdevice);
+ alCaptureDevice = qalcCaptureOpenDevice(inputdevice, 8000, AL_FORMAT_MONO16, 4096);
+ if( !alCaptureDevice && inputdevice )
+ {
+ Com_Printf( "Failed to open OpenAL Input device '%s', trying default.\n", inputdevice );
+ alCaptureDevice = qalcCaptureOpenDevice(NULL, 8000, AL_FORMAT_MONO16, 4096);
+ }
Com_Printf( "OpenAL capture device %s.\n",
- (alCaptureDevice == NULL) ? "failed to open" : "opened");
+ (alCaptureDevice == NULL) ? "failed to open" : "opened");
}
}
#endif