summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2007-03-21 23:55:51 +0000
committerTim Angus <tim@ngus.net>2007-03-21 23:55:51 +0000
commitd899c25c571ed061bba9725cf7b35d492cc6e518 (patch)
tree25268c9b3e381d00c2885c1fec7a54f46f56d93b
parentcb5b4648d45b3f078a6ae3da45707764ca46e241 (diff)
* ioq3-r1052 merge
-rw-r--r--Makefile23
-rw-r--r--src/client/cl_cgame.c10
-rw-r--r--src/client/cl_curl.c8
-rw-r--r--src/client/cl_keys.c126
-rw-r--r--src/client/cl_main.c89
-rw-r--r--src/client/cl_parse.c4
-rw-r--r--src/client/cl_ui.c10
-rw-r--r--src/client/client.h4
-rw-r--r--src/client/keycodes.h111
-rw-r--r--src/client/keys.h2
-rw-r--r--src/client/qal.c2
-rw-r--r--src/client/snd_dma.c12
-rw-r--r--src/client/snd_openal.c26
-rw-r--r--src/qcommon/common.c21
-rw-r--r--src/qcommon/cvar.c5
-rw-r--r--src/qcommon/files.c31
-rw-r--r--src/qcommon/md5.c23
-rw-r--r--src/qcommon/net_chan.c5
-rw-r--r--src/qcommon/q_platform.h2
-rw-r--r--src/qcommon/q_shared.c46
-rw-r--r--src/qcommon/q_shared.h39
-rw-r--r--src/qcommon/qcommon.h14
-rw-r--r--src/qcommon/vm.c2
-rw-r--r--src/qcommon/vm_interpreted.c2
-rw-r--r--src/qcommon/vm_x86_64.c6
-rw-r--r--src/renderer/tr_init.c22
-rw-r--r--src/renderer/tr_shader.c3
-rw-r--r--src/server/sv_client.c75
-rw-r--r--src/server/sv_game.c6
-rw-r--r--src/unix/linux_glimp.c4
-rw-r--r--src/unix/sdl_glimp.c33
-rw-r--r--src/unix/sdl_snd.c4
-rw-r--r--src/unix/unix_shared.c16
-rw-r--r--src/win32/win_gamma.c8
-rw-r--r--src/win32/win_shared.c19
-rw-r--r--src/win32/win_wndproc.c4
36 files changed, 600 insertions, 217 deletions
diff --git a/Makefile b/Makefile
index 44a0d810..1ef730c9 100644
--- a/Makefile
+++ b/Makefile
@@ -663,15 +663,22 @@ ifeq ($(PLATFORM),sunos)
-falign-jumps=2 -falign-functions=2 -fstrength-reduce \
-mtune=ultrasparc -mv8plus -mno-faster-structs \
-funroll-loops
- BASE_CFLAGS += -DNO_VM_COMPILED
else
ifeq ($(ARCH),x86)
- OPTIMIZE = -O3 -march=i586 -ffast-math \
- -falign-loops=2 -falign-jumps=2 -falign-functions=2 \
- -funroll-loops -fstrength-reduce
+ OPTIMIZE = -O3 -march=i586 -fomit-frame-pointer -ffast-math \
+ -funroll-loops -falign-loops=2 -falign-jumps=2 \
+ -falign-functions=2 -fstrength-reduce
+ HAVE_VM_COMPILED=true
+ BASE_CFLAGS += -m32
+ LDFLAGS+=-m32
+ GL_CFLAGS+= -I/usr/X11/include/NVIDIA
endif
endif
+ ifneq ($(HAVE_VM_COMPILED),true)
+ BASE_CFLAGS += -DNO_VM_COMPILED
+ endif
+
DEBUG_CFLAGS = $(BASE_CFLAGS) -ggdb -O0
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE)
@@ -691,12 +698,6 @@ ifeq ($(PLATFORM),sunos)
CLIENT_LDFLAGS=-L/usr/openwin/$(LIB) -L/usr/X11/lib -lGLU -lX11 -lXext
endif
- ifeq ($(ARCH),x86)
- # Solarix x86 make ...
- BASE_CFLAGS += -m32
- LDFLAGS+=-m32
- endif
-
else # ifeq sunos
#############################################################################
@@ -1510,7 +1511,7 @@ installer: build_release
dist:
rm -rf tremulous-$(SVN_VERSION)
svn export . tremulous-$(SVN_VERSION)
- tar --force-local -cjf tremulous-$(SVN_VERSION).tar.bz2 tremulous-$(SVN_VERSION)
+ tar --owner=root --group=root --force-local -cjf tremulous-$(SVN_VERSION).tar.bz2 tremulous-$(SVN_VERSION)
rm -rf tremulous-$(SVN_VERSION)
#############################################################################
diff --git a/src/client/cl_cgame.c b/src/client/cl_cgame.c
index 262f6b47..b2fafe08 100644
--- a/src/client/cl_cgame.c
+++ b/src/client/cl_cgame.c
@@ -413,10 +413,10 @@ The cgame module is making a system call
intptr_t CL_CgameSystemCalls( intptr_t *args ) {
switch( args[0] ) {
case CG_PRINT:
- Com_Printf( "%s", VMA(1) );
+ Com_Printf( "%s", (const char*)VMA(1) );
return 0;
case CG_ERROR:
- Com_Error( ERR_DROP, "%s", VMA(1) );
+ Com_Error( ERR_DROP, "%s", (const char*)VMA(1) );
return 0;
case CG_MILLISECONDS:
return Sys_Milliseconds();
@@ -726,7 +726,7 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) {
default:
assert(0); // bk010102
- Com_Error( ERR_DROP, "Bad cgame system trap: %i", args[0] );
+ Com_Error( ERR_DROP, "Bad cgame system trap: %ld", (long int) args[0] );
}
return 0;
}
@@ -774,6 +774,10 @@ void CL_InitCGame( void ) {
// otherwise server commands sent just before a gamestate are dropped
VM_Call( cgvm, CG_INIT, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum );
+ // reset any CVAR_CHEAT cvars registered by cgame
+ if ( !cl_connectedToCheatServer )
+ Cvar_SetCheatState();
+
// we will send a usercmd this frame, which
// will cause the server to send us the first snapshot
cls.state = CA_PRIMED;
diff --git a/src/client/cl_curl.c b/src/client/cl_curl.c
index 246095a1..734cc306 100644
--- a/src/client/cl_curl.c
+++ b/src/client/cl_curl.c
@@ -105,7 +105,7 @@ static void *GPA(char *str)
}
else
{
- Com_DPrintf("Loaded symbol %s (0x%08X)\n", str, rv);
+ Com_DPrintf("Loaded symbol %s (0x%p)\n", str, rv);
return rv;
}
}
@@ -131,8 +131,8 @@ qboolean CL_cURL_Init()
#else
char fn[1024];
getcwd(fn, sizeof(fn));
- strncat(fn, "/", sizeof(fn));
- strncat(fn, cl_cURLLib->string, sizeof(fn));
+ strncat(fn, "/", sizeof(fn)-strlen(fn)-1);
+ strncat(fn, cl_cURLLib->string, sizeof(fn)-strlen(fn)-1);
if( (cURLLib = OBJLOAD(fn)) == 0 )
{
@@ -347,7 +347,7 @@ void CL_cURL_PerformDownload(void)
qcurl_easy_getinfo(msg->easy_handle, CURLINFO_RESPONSE_CODE,
&code);
- Com_Error(ERR_DROP, "Download Error: %s Code: %d URL: %s",
+ Com_Error(ERR_DROP, "Download Error: %s Code: %ld URL: %s",
qcurl_easy_strerror(msg->data.result),
code, clc.downloadURL);
}
diff --git a/src/client/cl_keys.c b/src/client/cl_keys.c
index c65ce916..c768e743 100644
--- a/src/client/cl_keys.c
+++ b/src/client/cl_keys.c
@@ -87,6 +87,9 @@ keyname_t keynames[] =
{"F10", K_F10},
{"F11", K_F11},
{"F12", K_F12},
+ {"F13", K_F13},
+ {"F14", K_F14},
+ {"F15", K_F15},
{"INS", K_INS},
{"DEL", K_DEL},
@@ -177,6 +180,116 @@ keyname_t keynames[] =
{"SEMICOLON", ';'}, // because a raw semicolon seperates commands
+ {"WORLD_0", K_WORLD_0},
+ {"WORLD_1", K_WORLD_1},
+ {"WORLD_2", K_WORLD_2},
+ {"WORLD_3", K_WORLD_3},
+ {"WORLD_4", K_WORLD_4},
+ {"WORLD_5", K_WORLD_5},
+ {"WORLD_6", K_WORLD_6},
+ {"WORLD_7", K_WORLD_7},
+ {"WORLD_8", K_WORLD_8},
+ {"WORLD_9", K_WORLD_9},
+ {"WORLD_10", K_WORLD_10},
+ {"WORLD_11", K_WORLD_11},
+ {"WORLD_12", K_WORLD_12},
+ {"WORLD_13", K_WORLD_13},
+ {"WORLD_14", K_WORLD_14},
+ {"WORLD_15", K_WORLD_15},
+ {"WORLD_16", K_WORLD_16},
+ {"WORLD_17", K_WORLD_17},
+ {"WORLD_18", K_WORLD_18},
+ {"WORLD_19", K_WORLD_19},
+ {"WORLD_20", K_WORLD_20},
+ {"WORLD_21", K_WORLD_21},
+ {"WORLD_22", K_WORLD_22},
+ {"WORLD_23", K_WORLD_23},
+ {"WORLD_24", K_WORLD_24},
+ {"WORLD_25", K_WORLD_25},
+ {"WORLD_26", K_WORLD_26},
+ {"WORLD_27", K_WORLD_27},
+ {"WORLD_28", K_WORLD_28},
+ {"WORLD_29", K_WORLD_29},
+ {"WORLD_30", K_WORLD_30},
+ {"WORLD_31", K_WORLD_31},
+ {"WORLD_32", K_WORLD_32},
+ {"WORLD_33", K_WORLD_33},
+ {"WORLD_34", K_WORLD_34},
+ {"WORLD_35", K_WORLD_35},
+ {"WORLD_36", K_WORLD_36},
+ {"WORLD_37", K_WORLD_37},
+ {"WORLD_38", K_WORLD_38},
+ {"WORLD_39", K_WORLD_39},
+ {"WORLD_40", K_WORLD_40},
+ {"WORLD_41", K_WORLD_41},
+ {"WORLD_42", K_WORLD_42},
+ {"WORLD_43", K_WORLD_43},
+ {"WORLD_44", K_WORLD_44},
+ {"WORLD_45", K_WORLD_45},
+ {"WORLD_46", K_WORLD_46},
+ {"WORLD_47", K_WORLD_47},
+ {"WORLD_48", K_WORLD_48},
+ {"WORLD_49", K_WORLD_49},
+ {"WORLD_50", K_WORLD_50},
+ {"WORLD_51", K_WORLD_51},
+ {"WORLD_52", K_WORLD_52},
+ {"WORLD_53", K_WORLD_53},
+ {"WORLD_54", K_WORLD_54},
+ {"WORLD_55", K_WORLD_55},
+ {"WORLD_56", K_WORLD_56},
+ {"WORLD_57", K_WORLD_57},
+ {"WORLD_58", K_WORLD_58},
+ {"WORLD_59", K_WORLD_59},
+ {"WORLD_60", K_WORLD_60},
+ {"WORLD_61", K_WORLD_61},
+ {"WORLD_62", K_WORLD_62},
+ {"WORLD_63", K_WORLD_63},
+ {"WORLD_64", K_WORLD_64},
+ {"WORLD_65", K_WORLD_65},
+ {"WORLD_66", K_WORLD_66},
+ {"WORLD_67", K_WORLD_67},
+ {"WORLD_68", K_WORLD_68},
+ {"WORLD_69", K_WORLD_69},
+ {"WORLD_70", K_WORLD_70},
+ {"WORLD_71", K_WORLD_71},
+ {"WORLD_72", K_WORLD_72},
+ {"WORLD_73", K_WORLD_73},
+ {"WORLD_74", K_WORLD_74},
+ {"WORLD_75", K_WORLD_75},
+ {"WORLD_76", K_WORLD_76},
+ {"WORLD_77", K_WORLD_77},
+ {"WORLD_78", K_WORLD_78},
+ {"WORLD_79", K_WORLD_79},
+ {"WORLD_80", K_WORLD_80},
+ {"WORLD_81", K_WORLD_81},
+ {"WORLD_82", K_WORLD_82},
+ {"WORLD_83", K_WORLD_83},
+ {"WORLD_84", K_WORLD_84},
+ {"WORLD_85", K_WORLD_85},
+ {"WORLD_86", K_WORLD_86},
+ {"WORLD_87", K_WORLD_87},
+ {"WORLD_88", K_WORLD_88},
+ {"WORLD_89", K_WORLD_89},
+ {"WORLD_90", K_WORLD_90},
+ {"WORLD_91", K_WORLD_91},
+ {"WORLD_92", K_WORLD_92},
+ {"WORLD_93", K_WORLD_93},
+ {"WORLD_94", K_WORLD_94},
+ {"WORLD_95", K_WORLD_95},
+
+ {"WINDOWS", K_SUPER},
+ {"COMPOSE", K_COMPOSE},
+ {"MODE", K_MODE},
+ {"HELP", K_HELP},
+ {"PRINT", K_PRINT},
+ {"SYSREQ", K_SYSREQ},
+ {"SCROLLOCK", K_SCROLLOCK },
+ {"BREAK", K_BREAK},
+ {"MENU", K_MENU},
+ {"POWER", K_POWER},
+ {"EURO", K_EURO},
+ {"UNDO", K_UNDO},
+
{NULL,0}
};
@@ -752,7 +865,7 @@ char *Key_KeynumToString( int keynum ) {
return "<KEY NOT FOUND>";
}
- if ( keynum < 0 || keynum > 255 ) {
+ if ( keynum < 0 || keynum >= MAX_KEYS ) {
return "<OUT OF RANGE>";
}
@@ -937,7 +1050,7 @@ void Key_WriteBindings( fileHandle_t f ) {
FS_Printf (f, "unbindall\n" );
- for (i=0 ; i<256 ; i++) {
+ for (i=0 ; i<MAX_KEYS ; i++) {
if (keys[i].binding && keys[i].binding[0] ) {
FS_Printf (f, "bind %s \"%s\"\n", Key_KeynumToString(i), keys[i].binding);
@@ -956,7 +1069,7 @@ Key_Bindlist_f
void Key_Bindlist_f( void ) {
int i;
- for ( i = 0 ; i < 256 ; i++ ) {
+ for ( i = 0 ; i < MAX_KEYS ; i++ ) {
if ( keys[i].binding && keys[i].binding[0] ) {
Com_Printf( "%s \"%s\"\n", Key_KeynumToString(i), keys[i].binding );
}
@@ -981,7 +1094,7 @@ void CL_InitKeyCommands( void ) {
CL_AddKeyUpCommands
===================
*/
-void CL_AddKeyUpCommands( int key, char *kb ) {
+void CL_AddKeyUpCommands( int key, char *kb, unsigned time) {
int i;
char button[1024], *buttonPtr;
char cmd[1024];
@@ -1067,7 +1180,8 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) {
#endif
// console key is hardcoded, so the user can never unbind it
- if (key == '`' || key == '~') {
+ if (key == '`' || key == '~' ||
+ ( key == K_ESCAPE && keys[K_SHIFT].down ) ) {
if (!down) {
return;
}
@@ -1127,7 +1241,7 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) {
if (!down) {
kb = keys[key].binding;
- CL_AddKeyUpCommands( key, kb );
+ CL_AddKeyUpCommands( key, kb, time );
if ( cls.keyCatchers & KEYCATCH_UI && uivm ) {
VM_Call( uivm, UI_KEY_EVENT, key, down );
diff --git a/src/client/cl_main.c b/src/client/cl_main.c
index 6c7dd032..2fe3151d 100644
--- a/src/client/cl_main.c
+++ b/src/client/cl_main.c
@@ -75,6 +75,8 @@ cvar_t *cl_trn;
cvar_t *cl_lanForcePackets;
+cvar_t *cl_guidServerUniq;
+
clientActive_t cl;
clientConnection_t clc;
clientStatic_t cls;
@@ -758,6 +760,28 @@ void CL_ClearState (void) {
Com_Memset( &cl, 0, sizeof( cl ) );
}
+/*
+====================
+CL_UpdateGUID
+
+update cl_guid using QKEY_FILE and optional prefix
+====================
+*/
+static void CL_UpdateGUID( char *prefix, int prefix_len )
+{
+ fileHandle_t f;
+ int len;
+
+ len = FS_SV_FOpenFileRead( QKEY_FILE, &f );
+ FS_FCloseFile( f );
+
+ if( len != QKEY_SIZE )
+ Cvar_Set( "cl_guid", "" );
+ else
+ Cvar_Set( "cl_guid", Com_MD5File( QKEY_FILE, QKEY_SIZE,
+ prefix, prefix_len ) );
+}
+
/*
=====================
@@ -826,6 +850,7 @@ void CL_Disconnect( qboolean showMainMenu ) {
if( CL_VideoRecording( ) ) {
CL_CloseAVI( );
}
+ CL_UpdateGUID( NULL, 0 );
}
@@ -953,7 +978,7 @@ void CL_Setenv_f( void ) {
if ( env ) {
Com_Printf( "%s=%s\n", Cmd_Argv(1), env );
} else {
- Com_Printf( "%s undefined\n", Cmd_Argv(1), env );
+ Com_Printf( "%s undefined\n", Cmd_Argv(1));
}
}
}
@@ -996,6 +1021,7 @@ CL_Connect_f
*/
void CL_Connect_f( void ) {
char *server;
+ char serverString[ 22 ];
if ( Cmd_Argc() != 2 ) {
Com_Printf( "usage: connect [server]\n");
@@ -1038,10 +1064,17 @@ void CL_Connect_f( void ) {
if (clc.serverAddress.port == 0) {
clc.serverAddress.port = BigShort( PORT_SERVER );
}
- Com_Printf( "%s resolved to %i.%i.%i.%i:%i\n", cls.servername,
- clc.serverAddress.ip[0], clc.serverAddress.ip[1],
- clc.serverAddress.ip[2], clc.serverAddress.ip[3],
- BigShort( clc.serverAddress.port ) );
+ Com_sprintf( serverString, sizeof( serverString ), "%i.%i.%i.%i:%i",
+ clc.serverAddress.ip[0], clc.serverAddress.ip[1],
+ clc.serverAddress.ip[2], clc.serverAddress.ip[3],
+ BigShort( clc.serverAddress.port ) );
+
+ Com_Printf( "%s resolved to %s\n", cls.servername, serverString );
+
+ if( cl_guidServerUniq->integer )
+ CL_UpdateGUID( serverString, strlen( serverString ) );
+ else
+ CL_UpdateGUID( NULL, 0 );
// if we aren't playing on a lan, we need to authenticate
// with the cd key
@@ -2429,25 +2462,44 @@ void CL_StopVideo_f( void )
CL_CloseAVI( );
}
+/*
+===============
+CL_GenerateQKey
+
+test to see if a valid QKEY_FILE exists. If one does not, try to generate
+it by filling it with 2048 bytes of random data.
+===============
+*/
static void CL_GenerateQKey(void)
{
int len = 0;
- unsigned char buff[2048];
+ unsigned char buff[ QKEY_SIZE ];
+ fileHandle_t f;
- len = FS_ReadFile(QKEY_FILE, NULL);
- if(len >= (int)sizeof(buff)) {
- Com_Printf("QKEY found.\n");
+ len = FS_SV_FOpenFileRead( QKEY_FILE, &f );
+ FS_FCloseFile( f );
+ if( len == QKEY_SIZE ) {
+ Com_Printf( "QKEY found.\n" );
return;
}
else {
- int i;
- srand(time(0));
- for(i = 0; i < sizeof(buff) - 1; i++) {
- buff[i] = (unsigned char)(rand() % 255);
+ if( len > 0 ) {
+ Com_Printf( "QKEY file size != %d, regenerating\n",
+ QKEY_SIZE );
}
- buff[i] = 0;
- Com_Printf("QKEY generated\n");
- FS_WriteFile(QKEY_FILE, buff, sizeof(buff));
+
+ Com_Printf( "QKEY building random string\n" );
+ Com_RandomBytes( buff, sizeof(buff) );
+
+ f = FS_SV_FOpenFileWrite( QKEY_FILE );
+ if( !f ) {
+ Com_Printf( "QKEY could not open %s for write\n",
+ QKEY_FILE );
+ return;
+ }
+ FS_Write( buff, sizeof(buff), f );
+ FS_FCloseFile( f );
+ Com_Printf( "QKEY generated\n" );
}
}
@@ -2546,6 +2598,8 @@ void CL_Init( void ) {
cl_lanForcePackets = Cvar_Get ("cl_lanForcePackets", "1", CVAR_ARCHIVE);
+ cl_guidServerUniq = Cvar_Get ("cl_guidServerUniq", "1", CVAR_ARCHIVE);
+
// userinfo
playerName = getenv( "USER" ); // Unixy stuff
if( playerName == NULL )
@@ -2614,7 +2668,8 @@ void CL_Init( void ) {
Cvar_Set( "cl_running", "1" );
CL_GenerateQKey();
- Cvar_Get("cl_guid", Com_MD5File(QKEY_FILE, 0), CVAR_USERINFO | CVAR_ROM);
+ Cvar_Get( "cl_guid", "", CVAR_USERINFO | CVAR_ROM );
+ CL_UpdateGUID( NULL, 0 );
Com_Printf( "----- Client Initialization Complete -----\n" );
}
diff --git a/src/client/cl_parse.c b/src/client/cl_parse.c
index 093893a6..63b1b6e5 100644
--- a/src/client/cl_parse.c
+++ b/src/client/cl_parse.c
@@ -326,6 +326,7 @@ void CL_ParseSnapshot( msg_t *msg ) {
//=====================================================================
int cl_connectedToPureServer;
+int cl_connectedToCheatServer;
/*
==================
@@ -356,7 +357,8 @@ void CL_SystemInfoChanged( void ) {
}
s = Info_ValueForKey( systemInfo, "sv_cheats" );
- if ( atoi(s) == 0 ) {
+ cl_connectedToCheatServer = atoi( s );
+ if ( !cl_connectedToCheatServer ) {
Cvar_SetCheatState();
}
diff --git a/src/client/cl_ui.c b/src/client/cl_ui.c
index c740d3e8..2ba7736a 100644
--- a/src/client/cl_ui.c
+++ b/src/client/cl_ui.c
@@ -690,11 +690,11 @@ The ui module is making a system call
intptr_t CL_UISystemCalls( intptr_t *args ) {
switch( args[0] ) {
case UI_ERROR:
- Com_Error( ERR_DROP, "%s", VMA(1) );
+ Com_Error( ERR_DROP, "%s", (const char*)VMA(1) );
return 0;
case UI_PRINT:
- Com_Printf( "%s", VMA(1) );
+ Com_Printf( "%s", (const char*)VMA(1) );
return 0;
case UI_MILLISECONDS:
@@ -1019,7 +1019,7 @@ intptr_t CL_UISystemCalls( intptr_t *args ) {
return 0;
default:
- Com_Error( ERR_DROP, "Bad UI system trap: %i", args[0] );
+ Com_Error( ERR_DROP, "Bad UI system trap: %ld", (long int) args[0] );
}
@@ -1080,6 +1080,10 @@ void CL_InitUI( void ) {
// init for this gamestate
VM_Call( uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE) );
}
+
+ // reset any CVAR_CHEAT cvars registered by ui
+ if ( !cl_connectedToCheatServer )
+ Cvar_SetCheatState();
}
/*
diff --git a/src/client/client.h b/src/client/client.h
index 77cf7dca..ea98c4f2 100644
--- a/src/client/client.h
+++ b/src/client/client.h
@@ -35,8 +35,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cl_curl.h"
#endif /* USE_CURL */
-// tjw: file full of random crap that gets used to create cl_guid
+// file full of random crap that gets used to create cl_guid
#define QKEY_FILE "qkey"
+#define QKEY_SIZE 2048
#define RETRANSMIT_TIMEOUT 3000 // time between connection packet retransmits
@@ -443,6 +444,7 @@ char *Key_KeynumToString (int keynum);
// cl_parse.c
//
extern int cl_connectedToPureServer;
+extern int cl_connectedToCheatServer;
void CL_SystemInfoChanged( void );
void CL_ParseServerMessage( msg_t *msg );
diff --git a/src/client/keycodes.h b/src/client/keycodes.h
index 69abb9f6..b18c04f6 100644
--- a/src/client/keycodes.h
+++ b/src/client/keycodes.h
@@ -153,7 +153,116 @@ typedef enum {
K_AUX15,
K_AUX16,
- K_LAST_KEY // this had better be <256!
+ K_WORLD_0,
+ K_WORLD_1,
+ K_WORLD_2,
+ K_WORLD_3,
+ K_WORLD_4,
+ K_WORLD_5,
+ K_WORLD_6,
+ K_WORLD_7,
+ K_WORLD_8,
+ K_WORLD_9,
+ K_WORLD_10,
+ K_WORLD_11,
+ K_WORLD_12,
+ K_WORLD_13,
+ K_WORLD_14,
+ K_WORLD_15,
+ K_WORLD_16,
+ K_WORLD_17,
+ K_WORLD_18,
+ K_WORLD_19,
+ K_WORLD_20,
+ K_WORLD_21,
+ K_WORLD_22,
+ K_WORLD_23,
+ K_WORLD_24,
+ K_WORLD_25,
+ K_WORLD_26,
+ K_WORLD_27,
+ K_WORLD_28,
+ K_WORLD_29,
+ K_WORLD_30,
+ K_WORLD_31,
+ K_WORLD_32,
+ K_WORLD_33,
+ K_WORLD_34,
+ K_WORLD_35,
+ K_WORLD_36,
+ K_WORLD_37,
+ K_WORLD_38,
+ K_WORLD_39,
+ K_WORLD_40,
+ K_WORLD_41,
+ K_WORLD_42,
+ K_WORLD_43,
+ K_WORLD_44,
+ K_WORLD_45,
+ K_WORLD_46,
+ K_WORLD_47,
+ K_WORLD_48,
+ K_WORLD_49,
+ K_WORLD_50,
+ K_WORLD_51,
+ K_WORLD_52,
+ K_WORLD_53,
+ K_WORLD_54,
+ K_WORLD_55,
+ K_WORLD_56,
+ K_WORLD_57,
+ K_WORLD_58,
+ K_WORLD_59,
+ K_WORLD_60,
+ K_WORLD_61,
+ K_WORLD_62,
+ K_WORLD_63,
+ K_WORLD_64,
+ K_WORLD_65,
+ K_WORLD_66,
+ K_WORLD_67,
+ K_WORLD_68,
+ K_WORLD_69,
+ K_WORLD_70,
+ K_WORLD_71,
+ K_WORLD_72,
+ K_WORLD_73,
+ K_WORLD_74,
+ K_WORLD_75,
+ K_WORLD_76,
+ K_WORLD_77,
+ K_WORLD_78,
+ K_WORLD_79,
+ K_WORLD_80,
+ K_WORLD_81,
+ K_WORLD_82,
+ K_WORLD_83,
+ K_WORLD_84,
+ K_WORLD_85,
+ K_WORLD_86,
+ K_WORLD_87,
+ K_WORLD_88,
+ K_WORLD_89,
+ K_WORLD_90,
+ K_WORLD_91,
+ K_WORLD_92,
+ K_WORLD_93,
+ K_WORLD_94,
+ K_WORLD_95,
+
+ K_SUPER,
+ K_COMPOSE,
+ K_MODE,
+ K_HELP,
+ K_PRINT,
+ K_SYSREQ,
+ K_SCROLLOCK,
+ K_BREAK,
+ K_MENU,
+ K_EURO,
+ K_UNDO,
+
+ K_LAST_KEY // this had better be < MAX_KEYS!
} keyNum_t;
diff --git a/src/client/keys.h b/src/client/keys.h
index fbab475f..c768fc99 100644
--- a/src/client/keys.h
+++ b/src/client/keys.h
@@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "keycodes.h"
-#define MAX_KEYS 256
+#define MAX_KEYS 384
typedef struct {
qboolean down;
diff --git a/src/client/qal.c b/src/client/qal.c
index 4c04bd41..c0b4a215 100644
--- a/src/client/qal.c
+++ b/src/client/qal.c
@@ -154,7 +154,7 @@ static void *GPA(char *str)
}
else
{
- Com_DPrintf( " Loaded symbol %s (0x%08X)\n", str, rv);
+ Com_DPrintf( " Loaded symbol %s (%p)\n", str, rv);
return rv;
}
}
diff --git a/src/client/snd_dma.c b/src/client/snd_dma.c
index d55f9697..7e7897b1 100644
--- a/src/client/snd_dma.c
+++ b/src/client/snd_dma.c
@@ -110,7 +110,7 @@ void S_Base_SoundInfo(void) {
Com_Printf("%5d samplebits\n", dma.samplebits);
Com_Printf("%5d submission_chunk\n", dma.submission_chunk);
Com_Printf("%5d speed\n", dma.speed);
- Com_Printf("0x%x dma buffer\n", dma.buffer);
+ Com_Printf("%p dma buffer\n", dma.buffer);
if ( s_backgroundStream ) {
Com_Printf("Background file: %s\n", s_backgroundLoop );
} else {
@@ -467,7 +467,7 @@ void S_Base_StartSound(vec3_t origin, int entityNum, int entchannel, sfxHandle_t
}
if ( sfxHandle < 0 || sfxHandle >= s_numSfx ) {
- Com_Printf( S_COLOR_YELLOW, "S_StartSound: handle %i out of range\n", sfxHandle );
+ Com_Printf( S_COLOR_YELLOW "S_StartSound: handle %i out of range\n", sfxHandle );
return;
}
@@ -579,7 +579,7 @@ void S_Base_StartLocalSound( sfxHandle_t sfxHandle, int channelNum ) {
}
if ( sfxHandle < 0 || sfxHandle >= s_numSfx ) {
- Com_Printf( S_COLOR_YELLOW, "S_StartLocalSound: handle %i out of range\n", sfxHandle );
+ Com_Printf( S_COLOR_YELLOW "S_StartLocalSound: handle %i out of range\n", sfxHandle );
return;
}
@@ -688,7 +688,7 @@ void S_Base_AddLoopingSound( int entityNum, const vec3_t origin, const vec3_t ve
}
if ( sfxHandle < 0 || sfxHandle >= s_numSfx ) {
- Com_Printf( S_COLOR_YELLOW, "S_AddLoopingSound: handle %i out of range\n", sfxHandle );
+ Com_Printf( S_COLOR_YELLOW "S_AddLoopingSound: handle %i out of range\n", sfxHandle );
return;
}
@@ -751,7 +751,7 @@ void S_Base_AddRealLoopingSound( int entityNum, const vec3_t origin, const vec3_
}
if ( sfxHandle < 0 || sfxHandle >= s_numSfx ) {
- Com_Printf( S_COLOR_YELLOW, "S_AddRealLoopingSound: handle %i out of range\n", sfxHandle );
+ Com_Printf( S_COLOR_YELLOW "S_AddRealLoopingSound: handle %i out of range\n", sfxHandle );
return;
}
@@ -1116,7 +1116,7 @@ void S_Base_Update( void ) {
ch = s_channels;
for (i=0 ; i<MAX_CHANNELS; i++, ch++) {
if (ch->thesfx && (ch->leftvol || ch->rightvol) ) {
- Com_Printf ("%f %f %s\n", ch->leftvol, ch->rightvol, ch->thesfx->soundName);
+ Com_Printf ("%d %d %s\n", ch->leftvol, ch->rightvol, ch->thesfx->soundName);
total++;
}
}
diff --git a/src/client/snd_openal.c b/src/client/snd_openal.c
index 6f5396c4..61b250d6 100644
--- a/src/client/snd_openal.c
+++ b/src/client/snd_openal.c
@@ -43,7 +43,6 @@ cvar_t *s_alGraceDistance;
cvar_t *s_alDriver;
cvar_t *s_alDevice;
cvar_t *s_alAvailableDevices;
-cvar_t *s_alMaxSpeakerDistance;
/*
=================
@@ -531,15 +530,13 @@ Adapt the gain if necessary to get a quicker fadeout when the source is too far
static void S_AL_ScaleGain(src_t *chksrc, vec3_t origin)
{
float distance;
-
- if(chksrc->local)
- distance = VectorLength(origin);
- else
+
+ if(!chksrc->local)
distance = Distance(origin, lastListenerOrigin);
-
+
// If we exceed a certain distance, scale the gain linearly until the sound
// vanishes into nothingness.
- if((distance -= s_alMaxDistance->value) > 0)
+ if(!chksrc->local && (distance -= s_alMaxDistance->value) > 0)
{
float scaleFactor;
@@ -897,7 +894,7 @@ 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);
+ Com_Printf(S_COLOR_RED "ERROR: S_AL_CheckInput: handle %i out of range\n", sfx);
return qtrue;
}
@@ -914,11 +911,14 @@ Play a local (non-spatialized) sound effect
static
void S_AL_StartLocalSound(sfxHandle_t sfx, int channel)
{
+ srcHandle_t src;
+
if(S_AL_CheckInput(0, sfx))
return;
// Try to grab a source
- srcHandle_t src = S_AL_SrcAlloc(SRCPRI_LOCAL, -1, channel);
+ src = S_AL_SrcAlloc(SRCPRI_LOCAL, -1, channel);
+
if(src == -1)
return;
@@ -940,12 +940,13 @@ static
void S_AL_StartSound( vec3_t origin, int entnum, int entchannel, sfxHandle_t sfx )
{
vec3_t sorigin;
+ srcHandle_t src;
if(S_AL_CheckInput(origin ? 0 : entnum, sfx))
return;
// Try to grab a source
- srcHandle_t src = S_AL_SrcAlloc(SRCPRI_ONESHOT, entnum, entchannel);
+ src = S_AL_SrcAlloc(SRCPRI_ONESHOT, entnum, entchannel);
if(src == -1)
return;
@@ -1095,8 +1096,8 @@ void S_AL_AddRealLoopingSound( int entityNum, const vec3_t origin, const vec3_t
// 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_alMaxSpeakerDistance->value * s_alMaxSpeakerDistance->value )
+ if( DistanceSquared( origin, lastListenerOrigin ) > (s_alMaxDistance->value + s_alGraceDistance->value) *
+ (s_alMaxDistance->value + s_alGraceDistance->value) )
return;
S_AL_SrcLoop(SRCPRI_AMBIENT, sfx, origin, velocity, entityNum);
@@ -1882,7 +1883,6 @@ qboolean S_AL_Init( soundInterface_t *si )
s_alMaxDistance = Cvar_Get("s_alMaxDistance", "1024", CVAR_CHEAT);
s_alRolloff = Cvar_Get( "s_alRolloff", "2", CVAR_CHEAT);
s_alGraceDistance = Cvar_Get("s_alGraceDistance", "512", CVAR_CHEAT);
- s_alMaxSpeakerDistance = Cvar_Get( "s_alMaxSpeakerDistance", "1024", CVAR_ARCHIVE );
s_alDriver = Cvar_Get( "s_alDriver", ALDRIVER_DEFAULT, CVAR_ARCHIVE );
diff --git a/src/qcommon/common.c b/src/qcommon/common.c
index aa0bb668..cdfe3386 100644
--- a/src/qcommon/common.c
+++ b/src/qcommon/common.c
@@ -3080,3 +3080,24 @@ void Field_AutoComplete( field_t *field )
Field_CompleteCommand( completionField->buffer, qtrue, qtrue );
}
+
+/*
+==================
+Com_RandomBytes
+
+fills string array with len radom bytes, peferably from the OS randomizer
+==================
+*/
+void Com_RandomBytes( byte *string, int len )
+{
+ int i;
+
+ if( Sys_RandomBytes( string, len ) )
+ return;
+
+ Com_Printf( "Com_RandomBytes: using weak randomization\n" );
+ srand( time( 0 ) );
+ for( i = 0; i < len; i++ )
+ string[i] = (unsigned char)( rand() % 255 );
+}
+
diff --git a/src/qcommon/cvar.c b/src/qcommon/cvar.c
index 4340dcc4..91d3dfbe 100644
--- a/src/qcommon/cvar.c
+++ b/src/qcommon/cvar.c
@@ -911,10 +911,9 @@ void Cvar_Update( vmCvar_t *vmCvar ) {
vmCvar->modificationCount = cv->modificationCount;
// bk001129 - mismatches.
if ( strlen(cv->string)+1 > MAX_CVAR_VALUE_STRING )
- Com_Error( ERR_DROP, "Cvar_Update: src %s length %d exceeds MAX_CVAR_VALUE_STRING",
+ Com_Error( ERR_DROP, "Cvar_Update: src %s length %zd exceeds MAX_CVAR_VALUE_STRING",
cv->string,
- strlen(cv->string),
- sizeof(vmCvar->string) );
+ strlen(cv->string));
// bk001212 - Q_strncpyz guarantees zero padding and dest[MAX_CVAR_VALUE_STRING-1]==0
// bk001129 - paranoia. Never trust the destination string.
// bk001129 - beware, sizeof(char*) is always 4 (for cv->string).
diff --git a/src/qcommon/files.c b/src/qcommon/files.c
index ac73a0a8..cd369908 100644
--- a/src/qcommon/files.c
+++ b/src/qcommon/files.c
@@ -197,12 +197,20 @@ or configs will never get loaded from disk!
*/
-#define DEMOGAME "demota"
-
// every time a new demo pk3 file is built, this checksum must be updated.
// the easiest way to get it is to just run the game and see what it spits out
#define DEMO_PAK0_CHECKSUM 2985612116u
-#define PAK0_CHECKSUM 1566731103u
+static const unsigned pak_checksums[] = {
+ 1566731103u,
+ 298122907u,
+ 412165236u,
+ 2991495316u,
+ 1197932710u,
+ 4087071573u,
+ 3709064859u,
+ 908855077u,
+ 977125798u
+};
// if this is defined, the executable positively won't work with any paks other
// than the demo pak, even if productid is present. This is only used for our
@@ -2477,7 +2485,6 @@ Sets fs_gamedir, adds the directory to the head of the path,
then loads the zip headers
================
*/
-#define MAX_PAKFILES 1024
static void FS_AddGameDirectory( const char *path, const char *dir ) {
searchpath_t *sp;
int i;
@@ -2486,7 +2493,6 @@ static void FS_AddGameDirectory( const char *path, const char *dir ) {
char *pakfile;
int numfiles;
char **pakfiles;
- char *sorted[MAX_PAKFILES];
// this fixes the case where fs_basepath is the same as fs_cdpath
// which happens on full installs
@@ -2515,20 +2521,11 @@ static void FS_AddGameDirectory( const char *path, const char *dir ) {
pakfiles = Sys_ListFiles( pakfile, ".pk3", NULL, &numfiles, qfalse );
- // sort them so that later alphabetic matches override
- // earlier ones. This makes pak1.pk3 override pak0.pk3
- if ( numfiles > MAX_PAKFILES ) {
- numfiles = MAX_PAKFILES;
- }
- for ( i = 0 ; i < numfiles ; i++ ) {
- sorted[i] = pakfiles[i];
- }
-
- qsort( sorted, numfiles, sizeof(char*), paksort );
+ qsort( pakfiles, numfiles, sizeof(char*), paksort );
for ( i = 0 ; i < numfiles ; i++ ) {
- pakfile = FS_BuildOSPath( path, dir, sorted[i] );
- if ( ( pak = FS_LoadZipFile( pakfile, sorted[i] ) ) == 0 )
+ pakfile = FS_BuildOSPath( path, dir, pakfiles[i] );
+ if ( ( pak = FS_LoadZipFile( pakfile, pakfiles[i] ) ) == 0 )
continue;
// store the game name for downloading
strcpy(pak->pakGamename, dir);
diff --git a/src/qcommon/md5.c b/src/qcommon/md5.c
index ffe77527..5cf12bb3 100644
--- a/src/qcommon/md5.c
+++ b/src/qcommon/md5.c
@@ -257,20 +257,27 @@ static void MD5Final(struct MD5Context *ctx, unsigned char *digest)
}
-char *Com_MD5File(const char *fn, int length)
+char *Com_MD5File( const char *fn, int length, const char *prefix, int prefix_len )
{
- static char final[33] = {"unknown"};
+ static char final[33] = {""};
unsigned char digest[16] = {""};
fileHandle_t f;
MD5_CTX md5;
- char buffer[2048];
+ byte buffer[2048];
int i;
int filelen = 0;
int r = 0;
int total = 0;
- filelen = FS_FOpenFileRead(fn, &f, qtrue);
- if(filelen < 1) {
+ Q_strncpyz( final, "", sizeof( final ) );
+
+ filelen = FS_SV_FOpenFileRead( fn, &f );
+
+ if( !f ) {
+ return final;
+ }
+ if( filelen < 1 ) {
+ FS_FCloseFile( f );
return final;
}
if(filelen < length || !length) {
@@ -278,6 +285,10 @@ char *Com_MD5File(const char *fn, int length)
}
MD5Init(&md5);
+
+ if( prefix_len && *prefix )
+ MD5Update(&md5 , (unsigned char *)prefix, prefix_len);
+
for(;;) {
r = FS_Read2(buffer, sizeof(buffer), f);
if(r < 1)
@@ -285,7 +296,7 @@ char *Com_MD5File(const char *fn, int length)
if(r + total > length)
r = length - total;
total += r;
- MD5Update(&md5 , (unsigned char *)buffer, r);
+ MD5Update(&md5 , buffer, r);
if(r < sizeof(buffer) || total >= length)
break;
}
diff --git a/src/qcommon/net_chan.c b/src/qcommon/net_chan.c
index 9dd41589..869d87a3 100644
--- a/src/qcommon/net_chan.c
+++ b/src/qcommon/net_chan.c
@@ -398,8 +398,7 @@ qboolean Netchan_Process( netchan_t *chan, msg_t *msg ) {
if ( fragmentStart != chan->fragmentLength ) {
if ( showdrop->integer || showpackets->integer ) {
Com_Printf( "%s:Dropped a message fragment\n"
- , NET_AdrToString( chan->remoteAddress )
- , sequence);
+ , NET_AdrToString( chan->remoteAddress ));
}
// we can still keep the part that we have so far,
// so we don't need to clear chan->fragmentLength
@@ -716,7 +715,7 @@ void QDECL NET_OutOfBandPrint( netsrc_t sock, netadr_t adr, const char *format,
string[3] = -1;
va_start( argptr, format );
- vsprintf( string+4, format, argptr );
+ Q_vsnprintf( string+4, sizeof(string)-4, format, argptr );
va_end( argptr );
// send the datagram
diff --git a/src/qcommon/q_platform.h b/src/qcommon/q_platform.h
index 2e0a6aca..ad9a9382 100644
--- a/src/qcommon/q_platform.h
+++ b/src/qcommon/q_platform.h
@@ -223,7 +223,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifdef __sun
-#include <sys/isa_defs.h>
+#include <stdint.h>
#include <sys/byteorder.h>
#define OS_STRING "solaris"
diff --git a/src/qcommon/q_shared.c b/src/qcommon/q_shared.c
index 93c1dc20..aa8d55d5 100644
--- a/src/qcommon/q_shared.c
+++ b/src/qcommon/q_shared.c
@@ -1188,29 +1188,21 @@ Changes or adds a key/value pair
*/
void Info_SetValueForKey( char *s, const char *key, const char *value ) {
char newi[MAX_INFO_STRING];
+ const char* blacklist = "\\;\"";
if ( strlen( s ) >= MAX_INFO_STRING ) {
Com_Error( ERR_DROP, "Info_SetValueForKey: oversize infostring" );
}
- if (strchr (key, '\\') || strchr (value, '\\'))
+ for(; *blacklist; ++blacklist)
{
- Com_Printf ("Can't use keys or values with a \\\n");
- return;
- }
-
- if (strchr (key, ';') || strchr (value, ';'))
- {
- Com_Printf ("Can't use keys or values with a semicolon\n");
- return;
- }
-
- if (strchr (key, '\"') || strchr (value, '\"'))
- {
- Com_Printf ("Can't use keys or values with a \"\n");
- return;
+ if (strchr (key, *blacklist) || strchr (value, *blacklist))
+ {
+ Com_Printf (S_COLOR_YELLOW "Can't use keys or values with a '%c': %s = %s\n", *blacklist, key, value);
+ return;
+ }
}
-
+
Info_RemoveKey (s, key);
if (!value || !strlen(value))
return;
@@ -1236,27 +1228,19 @@ Changes or adds a key/value pair
*/
void Info_SetValueForKey_Big( char *s, const char *key, const char *value ) {
char newi[BIG_INFO_STRING];
+ const char* blacklist = "\\;\"";
if ( strlen( s ) >= BIG_INFO_STRING ) {
Com_Error( ERR_DROP, "Info_SetValueForKey: oversize infostring" );
}
- if (strchr (key, '\\') || strchr (value, '\\'))
+ for(; *blacklist; ++blacklist)
{
- Com_Printf ("Can't use keys or values with a \\\n");
- return;
- }
-
- if (strchr (key, ';') || strchr (value, ';'))
- {
- Com_Printf ("Can't use keys or values with a semicolon\n");
- return;
- }
-
- if (strchr (key, '\"') || strchr (value, '\"'))
- {
- Com_Printf ("Can't use keys or values with a \"\n");
- return;
+ if (strchr (key, *blacklist) || strchr (value, *blacklist))
+ {
+ Com_Printf (S_COLOR_YELLOW "Can't use keys or values with a '%c': %s = %s\n", *blacklist, key, value);
+ return;
+ }
}
Info_RemoveKey_Big (s, key);
diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h
index 3f0ae9a2..50a0b10c 100644
--- a/src/qcommon/q_shared.h
+++ b/src/qcommon/q_shared.h
@@ -113,18 +113,19 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifdef Q3_VM
typedef int intptr_t;
#else
-# ifndef _MSC_VER
-# include <stdint.h>
-# else
- typedef __int64 int64_t;
- typedef __int32 int32_t;
- typedef __int16 int16_t;
- typedef __int8 int8_t;
- typedef unsigned __int64 uint64_t;
- typedef unsigned __int32 uint32_t;
- typedef unsigned __int16 uint16_t;
- typedef unsigned __int8 uint8_t;
-# endif
+ #ifndef _MSC_VER
+ #include <stdint.h>
+ #else
+ #include <io.h>
+ typedef __int64 int64_t;
+ typedef __int32 int32_t;
+ typedef __int16 int16_t;
+ typedef __int8 int8_t;
+ typedef unsigned __int64 uint64_t;
+ typedef unsigned __int32 uint32_t;
+ typedef unsigned __int16 uint16_t;
+ typedef unsigned __int8 uint8_t;
+ #endif
#endif
typedef unsigned char byte;
@@ -656,8 +657,8 @@ int COM_GetCurrentParseLine( void );
char *COM_Parse( char **data_p );
char *COM_ParseExt( char **data_p, qboolean allowLineBreak );
int COM_Compress( char *data_p );
-void COM_ParseError( char *format, ... );
-void COM_ParseWarning( char *format, ... );
+void COM_ParseError( char *format, ... ) __attribute__ ((format (printf, 1, 2)));
+void COM_ParseWarning( char *format, ... ) __attribute__ ((format (printf, 1, 2)));
//int COM_ParseInfos( char *buf, int max, char infos[][MAX_INFO_STRING] );
#define MAX_TOKENLENGTH 1024
@@ -691,11 +692,13 @@ void Parse1DMatrix (char **buf_p, int x, float *m);
void Parse2DMatrix (char **buf_p, int y, int x, float *m);
void Parse3DMatrix (char **buf_p, int z, int y, int x, float *m);
-void QDECL Com_sprintf (char *dest, int size, const char *fmt, ...);
+void QDECL Com_sprintf (char *dest, int size, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
char *Com_SkipTokens( char *s, int numTokens, char *sep );
char *Com_SkipCharset( char *s, char *sep );
+void Com_RandomBytes( byte *string, int len );
+
// mode parm for FS_FOpenFile
typedef enum {
FS_READ,
@@ -763,7 +766,7 @@ float LittleFloat (const float *l);
void Swap_Init (void);
*/
-char * QDECL va(char *format, ...);
+char * QDECL va(char *format, ...) __attribute__ ((format (printf, 1, 2)));
#define TRUNCATE_LENGTH 64
void Com_TruncateLongString( char *buffer, const char *s );
@@ -782,8 +785,8 @@ qboolean Info_Validate( const char *s );
void Info_NextPair( const char **s, char *key, char *value );
// this is only here so the functions in q_shared.c and bg_*.c can link
-void QDECL Com_Error( int level, const char *error, ... );
-void QDECL Com_Printf( const char *msg, ... );
+void QDECL Com_Error( int level, const char *error, ... ) __attribute__ ((format (printf, 2, 3)));
+void QDECL Com_Printf( const char *msg, ... ) __attribute__ ((format (printf, 1, 2)));
/*
diff --git a/src/qcommon/qcommon.h b/src/qcommon/qcommon.h
index 2279fb12..630d4da9 100644
--- a/src/qcommon/qcommon.h
+++ b/src/qcommon/qcommon.h
@@ -159,7 +159,7 @@ void NET_Restart( void );
void NET_Config( qboolean enableNetworking );
void NET_FlushPacketQueue(void);
void NET_SendPacket (netsrc_t sock, int length, const void *data, netadr_t to);
-void QDECL NET_OutOfBandPrint( netsrc_t net_socket, netadr_t adr, const char *format, ...);
+void QDECL NET_OutOfBandPrint( netsrc_t net_socket, netadr_t adr, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
void QDECL NET_OutOfBandData( netsrc_t sock, netadr_t adr, byte *format, int len );
qboolean NET_CompareAdr (netadr_t a, netadr_t b);
@@ -715,14 +715,14 @@ void Info_Print( const char *s );
void Com_BeginRedirect (char *buffer, int buffersize, void (*flush)(char *));
void Com_EndRedirect( void );
-void QDECL Com_Printf( const char *fmt, ... );
-void QDECL Com_DPrintf( const char *fmt, ... );
-void QDECL Com_Error( int code, const char *fmt, ... );
+void QDECL Com_Printf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2)));
+void QDECL Com_DPrintf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2)));
+void QDECL Com_Error( int code, const char *fmt, ... ) __attribute__ ((format (printf, 2, 3)));
void Com_Quit_f( void );
int Com_EventLoop( void );
int Com_Milliseconds( void ); // will be journaled properly
unsigned Com_BlockChecksum( const void *buffer, int length );
-char *Com_MD5File(const char *filename, int length);
+char *Com_MD5File(const char *filename, int length, const char *prefix, int prefix_len);
int Com_HashKey(char *string, int maxlen);
int Com_Filter(char *filter, char *name, int casesensitive);
int Com_FilterPath(char *filter, char *name, int casesensitive);
@@ -978,7 +978,7 @@ void *Sys_GetBotLibAPI( void *parms );
char *Sys_GetCurrentUser( void );
-void QDECL Sys_Error( const char *error, ...);
+void QDECL Sys_Error( const char *error, ...) __attribute__ ((format (printf, 1, 2)));
void Sys_Quit (void);
char *Sys_GetClipboardData( void ); // note that this isn't journaled...
@@ -990,6 +990,8 @@ int Sys_Milliseconds (void);
void Sys_SnapVector( float *v );
+qboolean Sys_RandomBytes( byte *string, int len );
+
// the system console is shown when a dedicated server is running
void Sys_DisplaySystemConsole( qboolean show );
diff --git a/src/qcommon/vm.c b/src/qcommon/vm.c
index 8fb588db..0017b417 100644
--- a/src/qcommon/vm.c
+++ b/src/qcommon/vm.c
@@ -727,7 +727,7 @@ intptr_t QDECL VM_Call( vm_t *vm, int callnum, ... ) {
lastVM = vm;
if ( vm_debugLevel ) {
- Com_Printf( "VM_Call( %ld )\n", callnum );
+ Com_Printf( "VM_Call( %d )\n", callnum );
}
// if we have a dll loaded, call it directly
diff --git a/src/qcommon/vm_interpreted.c b/src/qcommon/vm_interpreted.c
index 3c52f421..00aa4710 100644
--- a/src/qcommon/vm_interpreted.c
+++ b/src/qcommon/vm_interpreted.c
@@ -908,7 +908,7 @@ done:
vm->currentlyInterpreting = qfalse;
if ( opStack != &stack[1] ) {
- Com_Error( ERR_DROP, "Interpreter error: opStack = %i", opStack - stack );
+ Com_Error( ERR_DROP, "Interpreter error: opStack = %ld", (long int) (opStack - stack) );
}
vm->programStack = stackOnEntry;
diff --git a/src/qcommon/vm_x86_64.c b/src/qcommon/vm_x86_64.c
index 822c3e1d..9fde6e75 100644
--- a/src/qcommon/vm_x86_64.c
+++ b/src/qcommon/vm_x86_64.c
@@ -423,7 +423,7 @@ void VM_Compile( vm_t *vm, vmHeader_t *header ) {
unlink(fn_s);
unlink(fn_o);
- Com_Printf(S_COLOR_RED "can't create temporary files for vm\n", fn_s);
+ Com_Printf(S_COLOR_RED "can't create temporary file %s for vm\n", fn_s);
vm->compiled = qfalse;
return;
}
@@ -896,7 +896,7 @@ void VM_Compile( vm_t *vm, vmHeader_t *header ) {
fflush(qdasmout);
#endif
- Com_Printf( "VM file %s compiled to %i bytes of code (0x%lx - 0x%lx)\n", vm->name, vm->codeLength, vm->codeBase, vm->codeBase+vm->codeLength );
+ Com_Printf( "VM file %s compiled to %i bytes of code (%p - %p)\n", vm->name, vm->codeLength, vm->codeBase, vm->codeBase+vm->codeLength );
out:
close(fd_o);
@@ -991,7 +991,7 @@ int VM_CallCompiled( vm_t *vm, int *args ) {
);
if ( opStack != &stack[1] ) {
- Com_Error( ERR_DROP, "opStack corrupted in compiled code (offset %d)\n", (void*)&stack[1] - opStack);
+ Com_Error( ERR_DROP, "opStack corrupted in compiled code (offset %ld)\n", (long int) ((void *) &stack[1] - opStack));
}
if ( programStack != stackOnEntry - 48 ) {
Com_Error( ERR_DROP, "programStack corrupted in compiled code\n" );
diff --git a/src/renderer/tr_init.c b/src/renderer/tr_init.c
index 96fa5b4d..ce966699 100644
--- a/src/renderer/tr_init.c
+++ b/src/renderer/tr_init.c
@@ -133,7 +133,7 @@ cvar_t *r_fullscreen;
cvar_t *r_customwidth;
cvar_t *r_customheight;
-cvar_t *r_customaspect;
+cvar_t *r_customPixelAspect;
cvar_t *r_overBrightBits;
cvar_t *r_mapOverBrightBits;
@@ -395,6 +395,7 @@ static int s_numVidModes = ( sizeof( r_vidModes ) / sizeof( r_vidModes[0] ) );
qboolean R_GetModeInfo( int *width, int *height, float *windowAspect, int mode ) {
vidmode_t *vm;
+ float pixelAspect;
if ( mode < -1 ) {
return qfalse;
@@ -406,17 +407,18 @@ qboolean R_GetModeInfo( int *width, int *height, float *windowAspect, int mode )
if ( mode == -1 ) {
*width = r_customwidth->integer;
*height = r_customheight->integer;
- *windowAspect = r_customaspect->value;
- return qtrue;
- }
+ pixelAspect = r_customPixelAspect->value;
+ } else {
+ vm = &r_vidModes[mode];
- vm = &r_vidModes[mode];
+ *width = vm->width;
+ *height = vm->height;
+ pixelAspect = vm->pixelAspect;
+ }
- *width = vm->width;
- *height = vm->height;
- *windowAspect = (float)vm->width / ( vm->height * vm->pixelAspect );
+ *windowAspect = (float)*width / ( *height * pixelAspect );
- return qtrue;
+ return qtrue;
}
/*
@@ -1024,7 +1026,7 @@ void R_Register( void )
#endif
r_customwidth = ri.Cvar_Get( "r_customwidth", "1600", CVAR_ARCHIVE | CVAR_LATCH );
r_customheight = ri.Cvar_Get( "r_customheight", "1024", CVAR_ARCHIVE | CVAR_LATCH );
- r_customaspect = ri.Cvar_Get( "r_customaspect", "1", CVAR_ARCHIVE | CVAR_LATCH );
+ r_customPixelAspect = ri.Cvar_Get( "r_customPixelAspect", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_simpleMipMaps = ri.Cvar_Get( "r_simpleMipMaps", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_vertexLight = ri.Cvar_Get( "r_vertexLight", "0", CVAR_ARCHIVE | CVAR_LATCH );
r_uiFullScreen = ri.Cvar_Get( "r_uifullscreen", "0", 0);
diff --git a/src/renderer/tr_shader.c b/src/renderer/tr_shader.c
index 0e4504ef..10223a5c 100644
--- a/src/renderer/tr_shader.c
+++ b/src/renderer/tr_shader.c
@@ -2283,9 +2283,8 @@ static shader_t *FinishShader( void ) {
shader.numUnfoggedPasses = stage;
// fogonly shaders don't have any normal passes
- if ( stage == 0 ) {
+ if (stage == 0 && !shader.isSky)
shader.sort = SS_FOG;
- }
// determine which stage iterator function is appropriate
ComputeStageIteratorFunc();
diff --git a/src/server/sv_client.c b/src/server/sv_client.c
index e128b579..323ef602 100644
--- a/src/server/sv_client.c
+++ b/src/server/sv_client.c
@@ -103,6 +103,7 @@ void SV_DirectConnect( netadr_t from ) {
int startIndex;
intptr_t denied;
int count;
+ char *ip;
Com_DPrintf ("SVC_DirectConnect ()\n");
@@ -134,6 +135,19 @@ void SV_DirectConnect( netadr_t from ) {
break;
}
}
+
+ // don't let "ip" overflow userinfo string
+ if ( NET_IsLocalAddress (from) )
+ ip = "localhost";
+ else
+ ip = (char *)NET_AdrToString( from );
+ if( ( strlen( ip ) + strlen( userinfo ) + 4 ) >= MAX_INFO_STRING ) {
+ NET_OutOfBandPrint( NS_SERVER, from,
+ "print\nUserinfo string length exceeded. "
+ "Try removing setu cvars from your config.\n" );
+ return;
+ }
+ Info_SetValueForKey( userinfo, "ip", ip );
// see if the challenge is valid (LAN clients don't need to challenge)
if ( !NET_IsLocalAddress (from) ) {
@@ -150,8 +164,6 @@ void SV_DirectConnect( netadr_t from ) {
NET_OutOfBandPrint( NS_SERVER, from, "print\nNo or bad challenge for address" );
return;
}
- // force the IP key/value pair so the game can filter based on ip
- Info_SetValueForKey( userinfo, "ip", NET_AdrToString( from ) );
ping = svs.time - svs.challenges[i].pingTime;
Com_Printf( "Client %i connecting with %i challenge ping\n", i, ping );
@@ -174,9 +186,6 @@ void SV_DirectConnect( netadr_t from ) {
return;
}
}
- } else {
- // force the "ip" info key to "localhost"
- Info_SetValueForKey( userinfo, "ip", "localhost" );
}
newcl = &temp;
@@ -342,8 +351,6 @@ void SV_DropClient( client_t *drop, const char *reason ) {
// tell everyone why they got dropped
SV_SendServerCommand( NULL, "print \"%s" S_COLOR_WHITE " %s\n\"", drop->name, reason );
- Com_DPrintf( "Going to CS_ZOMBIE for %s\n", drop->name );
- drop->state = CS_ZOMBIE; // become free in a few seconds
if (drop->download) {
FS_FCloseFile( drop->download );
@@ -359,6 +366,9 @@ void SV_DropClient( client_t *drop, const char *reason ) {
// nuke user info
SV_SetUserinfo( drop - svs.clients, "" );
+
+ Com_DPrintf( "Going to CS_ZOMBIE for %s\n", drop->name );
+ drop->state = CS_ZOMBIE; // become free in a few seconds
// if this was the last client on the server, send a heartbeat
// to the master so it is known the server is empty
@@ -524,7 +534,7 @@ Abort a download if in progress
*/
void SV_StopDownload_f( client_t *cl ) {
if (*cl->downloadName)
- Com_DPrintf( "clientDownload: %d : file \"%s\" aborted\n", cl - svs.clients, cl->downloadName );
+ Com_DPrintf( "clientDownload: %d : file \"%s\" aborted\n", (int) (cl - svs.clients), cl->downloadName );
SV_CloseDownload( cl );
}
@@ -555,11 +565,11 @@ void SV_NextDownload_f( client_t *cl )
int block = atoi( Cmd_Argv(1) );
if (block == cl->downloadClientBlock) {
- Com_DPrintf( "clientDownload: %d : client acknowledge of block %d\n", cl - svs.clients, block );
+ Com_DPrintf( "clientDownload: %d : client acknowledge of block %d\n", (int) (cl - svs.clients), block );
// Find out if we are done. A zero-length block indicates EOF
if (cl->downloadBlockSize[cl->downloadClientBlock % MAX_DOWNLOAD_WINDOW] == 0) {
- Com_Printf( "clientDownload: %d : file \"%s\" completed\n", cl - svs.clients, cl->downloadName );
+ Com_Printf( "clientDownload: %d : file \"%s\" completed\n", (int) (cl - svs.clients), cl->downloadName );
SV_CloseDownload( cl );
return;
}
@@ -654,11 +664,11 @@ void SV_WriteDownloadToClient( client_t *cl , msg_t *msg )
// cannot auto-download file
if(unreferenced)
{
- Com_Printf("clientDownload: %d : \"%s\" is not referenced and cannot be downloaded.\n", cl - svs.clients, cl->downloadName);
+ Com_Printf("clientDownload: %d : \"%s\" is not referenced and cannot be downloaded.\n", (int) (cl - svs.clients), cl->downloadName);
Com_sprintf(errorMessage, sizeof(errorMessage), "File \"%s\" is not referenced and cannot be downloaded.", cl->downloadName);
}
else if (idPack) {
- Com_Printf("clientDownload: %d : \"%s\" cannot download id pk3 files\n", cl - svs.clients, cl->downloadName);
+ Com_Printf("clientDownload: %d : \"%s\" cannot download id pk3 files\n", (int) (cl - svs.clients), cl->downloadName);
if (missionPack) {
Com_sprintf(errorMessage, sizeof(errorMessage), "Cannot autodownload Team Arena file \"%s\"\n"
"The Team Arena mission pack can be found in your local game store.", cl->downloadName);
@@ -670,7 +680,7 @@ void SV_WriteDownloadToClient( client_t *cl , msg_t *msg )
else if ( !(sv_allowDownload->integer & DLF_ENABLE) ||
(sv_allowDownload->integer & DLF_NO_UDP) ) {
- Com_Printf("clientDownload: %d : \"%s\" download disabled", cl - svs.clients, cl->downloadName);
+ Com_Printf("clientDownload: %d : \"%s\" download disabled", (int) (cl - svs.clients), cl->downloadName);
if (sv_pure->integer) {
Com_sprintf(errorMessage, sizeof(errorMessage), "Could not download \"%s\" because autodownloading is disabled on the server.\n\n"
"You will need to get this file elsewhere before you "
@@ -684,7 +694,7 @@ void SV_WriteDownloadToClient( client_t *cl , msg_t *msg )
} else {
// NOTE TTimo this is NOT supposed to happen unless bug in our filesystem scheme?
// if the pk3 is referenced, it must have been found somewhere in the filesystem
- Com_Printf("clientDownload: %d : \"%s\" file not found on server\n", cl - svs.clients, cl->downloadName);
+ Com_Printf("clientDownload: %d : \"%s\" file not found on server\n", (int) (cl - svs.clients), cl->downloadName);
Com_sprintf(errorMessage, sizeof(errorMessage), "File \"%s\" not found on server for autodownloading.\n", cl->downloadName);
}
MSG_WriteByte( msg, svc_download );
@@ -696,7 +706,7 @@ void SV_WriteDownloadToClient( client_t *cl , msg_t *msg )
return;
}
- Com_Printf( "clientDownload: %d : beginning \"%s\"\n", cl - svs.clients, cl->downloadName );
+ Com_Printf( "clientDownload: %d : beginning \"%s\"\n", (int) (cl - svs.clients), cl->downloadName );
// Init
cl->downloadCurrentBlock = cl->downloadClientBlock = cl->downloadXmitBlock = 0;
@@ -805,7 +815,7 @@ void SV_WriteDownloadToClient( client_t *cl , msg_t *msg )
MSG_WriteData( msg, cl->downloadBlocks[curindex], cl->downloadBlockSize[curindex] );
}
- Com_DPrintf( "clientDownload: %d : writing block %d\n", cl - svs.clients, cl->downloadXmitBlock );
+ Com_DPrintf( "clientDownload: %d : writing block %d\n", (int) (cl - svs.clients), cl->downloadXmitBlock );
// Move on to the next block
// It will get sent with next snap shot. The rate will keep us in line.
@@ -1009,7 +1019,9 @@ into a more C friendly form.
*/
void SV_UserinfoChanged( client_t *cl ) {
char *val;
+ char *ip;
int i;
+ int len;
// name for C code
Q_strncpyz( cl->name, Info_ValueForKey (cl->userinfo, "name"), sizeof(cl->name) );
@@ -1058,18 +1070,23 @@ void SV_UserinfoChanged( client_t *cl ) {
// TTimo
// maintain the IP information
- // this is set in SV_DirectConnect (directly on the server, not transmitted), may be lost when client updates it's userinfo
// the banning code relies on this being consistently present
- val = Info_ValueForKey (cl->userinfo, "ip");
- if (!val[0])
- {
- //Com_DPrintf("Maintain IP in userinfo for '%s'\n", cl->name);
- if ( !NET_IsLocalAddress(cl->netchan.remoteAddress) )
- Info_SetValueForKey( cl->userinfo, "ip", NET_AdrToString( cl->netchan.remoteAddress ) );
- else
- // force the "ip" info key to "localhost" for local clients
- Info_SetValueForKey( cl->userinfo, "ip", "localhost" );
- }
+ if( NET_IsLocalAddress(cl->netchan.remoteAddress) )
+ ip = "localhost";
+ else
+ ip = (char*)NET_AdrToString( cl->netchan.remoteAddress );
+
+ val = Info_ValueForKey( cl->userinfo, "ip" );
+ if( val[0] )
+ len = strlen( ip ) - strlen( val ) + strlen( cl->userinfo );
+ else
+ len = strlen( ip ) + 4 + strlen( cl->userinfo );
+
+ if( len >= MAX_INFO_STRING )
+ SV_DropClient( cl, "userinfo string length exceeded" );
+ else
+ Info_SetValueForKey( cl->userinfo, "ip", ip );
+
}
@@ -1277,7 +1294,7 @@ static void SV_UserMove( client_t *cl, msg_t *msg, qboolean delta ) {
if (cl->state == CS_ACTIVE)
{
// we didn't get a cp yet, don't assume anything and just send the gamestate all over again
- Com_DPrintf( "%s: didn't get cp command, resending gamestate\n", cl->name, cl->state );
+ Com_DPrintf( "%s: didn't get cp command, resending gamestate\n", cl->name);
SV_SendClientGameState( cl );
}
return;
@@ -1427,7 +1444,7 @@ void SV_ExecuteClientMessage( client_t *cl, msg_t *msg ) {
} else if ( c == clc_moveNoDelta ) {
SV_UserMove( cl, msg, qfalse );
} else if ( c != clc_EOF ) {
- Com_Printf( "WARNING: bad command byte for client %i\n", cl - svs.clients );
+ Com_Printf( "WARNING: bad command byte for client %i\n", (int) (cl - svs.clients) );
}
// if ( msg->readcount != msg->cursize ) {
// Com_Printf( "WARNING: Junk at end of packet for client %i\n", cl - svs.clients );
diff --git a/src/server/sv_game.c b/src/server/sv_game.c
index 82a02184..1f56ed01 100644
--- a/src/server/sv_game.c
+++ b/src/server/sv_game.c
@@ -305,10 +305,10 @@ The module is making a system call
intptr_t SV_GameSystemCalls( intptr_t *args ) {
switch( args[0] ) {
case G_PRINT:
- Com_Printf( "%s", VMA(1) );
+ Com_Printf( "%s", (const char*)VMA(1) );
return 0;
case G_ERROR:
- Com_Error( ERR_DROP, "%s", VMA(1) );
+ Com_Error( ERR_DROP, "%s", (const char*)VMA(1) );
return 0;
case G_MILLISECONDS:
return Sys_Milliseconds();
@@ -492,7 +492,7 @@ intptr_t SV_GameSystemCalls( intptr_t *args ) {
default:
- Com_Error( ERR_DROP, "Bad game system trap: %i", args[0] );
+ Com_Error( ERR_DROP, "Bad game system trap: %ld", (long int) args[0] );
}
return -1;
}
diff --git a/src/unix/linux_glimp.c b/src/unix/linux_glimp.c
index 36e3dc36..650c1c9b 100644
--- a/src/unix/linux_glimp.c
+++ b/src/unix/linux_glimp.c
@@ -200,8 +200,8 @@ static const char *Q_stristr( const char *s, const char *find)
static char *XLateKey(XKeyEvent *ev, int *key)
{
- static char buf[64];
- static char bufnomod[2];
+ static unsigned char buf[64];
+ static unsigned char bufnomod[2];
KeySym keysym;
int XLookupRet;
diff --git a/src/unix/sdl_glimp.c b/src/unix/sdl_glimp.c
index b2cc13a4..6fa5943b 100644
--- a/src/unix/sdl_glimp.c
+++ b/src/unix/sdl_glimp.c
@@ -10,7 +10,7 @@
* GPL release of Quake 3.
*
* Written by Ryan C. Gordon (icculus@icculus.org). Please refer to
- * http://icculus.org/quake3/ for the latest version of this code.
+ * http://ioquake3.org/ for the latest version of this code.
*
* Patches and comments are welcome at the above address.
*
@@ -226,6 +226,9 @@ static const char *XLateKey(SDL_keysym *keysym, int *key)
case SDLK_F10: *key = K_F10; break;
case SDLK_F11: *key = K_F11; break;
case SDLK_F12: *key = K_F12; break;
+ case SDLK_F13: *key = K_F13; break;
+ case SDLK_F14: *key = K_F14; break;
+ case SDLK_F15: *key = K_F15; break;
// bk001206 - from Ryan's Fakk2
case SDLK_BACKSPACE: *key = K_BACKSPACE; break; // ctrl-h
@@ -244,15 +247,35 @@ static const char *XLateKey(SDL_keysym *keysym, int *key)
case SDLK_RALT:
case SDLK_LALT: *key = K_ALT; break;
+ case SDLK_LSUPER:
+ case SDLK_RSUPER: *key = K_SUPER; break;
+
case SDLK_KP5: *key = K_KP_5; break;
case SDLK_INSERT: *key = K_INS; break;
case SDLK_KP0: *key = K_KP_INS; break;
- case SDLK_KP_MULTIPLY: *key = '*'; break;
+ case SDLK_KP_MULTIPLY: *key = K_KP_STAR; break;
case SDLK_KP_PLUS: *key = K_KP_PLUS; break;
case SDLK_KP_MINUS: *key = K_KP_MINUS; break;
case SDLK_KP_DIVIDE: *key = K_KP_SLASH; break;
- default: break;
+ case SDLK_MODE: *key = K_MODE; break;
+ case SDLK_COMPOSE: *key = K_COMPOSE; break;
+ case SDLK_HELP: *key = K_HELP; break;
+ case SDLK_PRINT: *key = K_PRINT; break;
+ case SDLK_SYSREQ: *key = K_SYSREQ; break;
+ case SDLK_BREAK: *key = K_BREAK; break;
+ case SDLK_MENU: *key = K_MENU; break;
+ case SDLK_POWER: *key = K_POWER; break;
+ case SDLK_EURO: *key = K_EURO; break;
+ case SDLK_UNDO: * key = K_UNDO; break;
+ case SDLK_SCROLLOCK: *key = K_SCROLLOCK; break;
+ case SDLK_NUMLOCK: *key = K_KP_NUMLOCK; break;
+ case SDLK_CAPSLOCK: *key = K_CAPSLOCK; break;
+
+ default:
+ if (keysym->sym >= SDLK_WORLD_0 && keysym->sym <= SDLK_WORLD_95)
+ *key = (keysym->sym - SDLK_WORLD_0) + K_WORLD_0;
+ break;
}
if( keysym->unicode <= 127 ) // maps to ASCII?
@@ -268,8 +291,8 @@ static const char *XLateKey(SDL_keysym *keysym, int *key)
//else if (ch >= 'A' && ch <= 'Z')
// ch = ch - 'A' + 'a';
- // tjw: translate K_BACKSPACE to ctrl-h for MACOS_X (others?)
- if (ch == K_BACKSPACE)
+ // translate K_BACKSPACE to ctrl-h for MACOS_X (others?)
+ if (ch == K_BACKSPACE && keysym->sym != SDLK_DELETE)
{
*key = 'h' - 'a' + 1;
buf[0] = *key;
diff --git a/src/unix/sdl_snd.c b/src/unix/sdl_snd.c
index c5c10cb4..8b0aaf06 100644
--- a/src/unix/sdl_snd.c
+++ b/src/unix/sdl_snd.c
@@ -14,7 +14,7 @@
* positional audio, compliments of OpenAL...
*
* Written by Ryan C. Gordon (icculus@icculus.org). Please refer to
- * http://icculus.org/quake3/ for the latest version of this code.
+ * http://ioquake3.org/ for the latest version of this code.
*
* Patches and comments are welcome at the above address.
*
@@ -187,7 +187,7 @@ static void print_audiospec(const char *str, const SDL_AudioSpec *spec)
if( fmt ) {
Com_Printf( " Format: %s\n", fmt );
} else {
- Com_Printf( " Format: " S_COLOR_RED "UNKNOWN\n", fmt );
+ Com_Printf( " Format: " S_COLOR_RED "UNKNOWN\n");
}
Com_Printf( " Freq: %d\n", (int) spec->freq );
diff --git a/src/unix/unix_shared.c b/src/unix/unix_shared.c
index f9fc9e0a..2c238ca7 100644
--- a/src/unix/unix_shared.c
+++ b/src/unix/unix_shared.c
@@ -175,6 +175,22 @@ char *strlwr (char *s) {
return s; // bk001204 - duh
}
+qboolean Sys_RandomBytes( byte *string, int len )
+{
+ FILE *fp;
+
+ fp = fopen( "/dev/urandom", "r" );
+ if( !fp )
+ return qfalse;
+
+ if( !fread( string, sizeof( byte ), len, fp ) ) {
+ fclose( fp );
+ return qfalse;
+ }
+ fclose( fp );
+ return qtrue;
+}
+
//============================================
#define MAX_FOUND_FILES 0x1000
diff --git a/src/win32/win_gamma.c b/src/win32/win_gamma.c
index 27cf9318..18322609 100644
--- a/src/win32/win_gamma.c
+++ b/src/win32/win_gamma.c
@@ -149,11 +149,11 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned
table[2][i] = ( ( ( unsigned short ) blue[i] ) << 8 ) | blue[i];
}
- // Win2K puts this odd restriction on gamma ramps...
+ // Win2K and newer put this odd restriction on gamma ramps...
vinfo.dwOSVersionInfoSize = sizeof(vinfo);
GetVersionEx( &vinfo );
- if ( vinfo.dwMajorVersion == 5 && vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT ) {
- Com_DPrintf( "performing W2K gamma clamp.\n" );
+ if ( vinfo.dwMajorVersion >= 5 && vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT ) {
+ Com_DPrintf( "performing gamma clamp.\n" );
for ( j = 0 ; j < 3 ; j++ ) {
for ( i = 0 ; i < 128 ; i++ ) {
if ( table[j][i] > ( (128+i) << 8 ) ) {
@@ -165,7 +165,7 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned
}
}
} else {
- Com_DPrintf( "skipping W2K gamma clamp.\n" );
+ Com_DPrintf( "skipping gamma clamp.\n" );
}
// enforce constantly increasing
diff --git a/src/win32/win_shared.c b/src/win32/win_shared.c
index 5ed7770c..457a8d51 100644
--- a/src/win32/win_shared.c
+++ b/src/win32/win_shared.c
@@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <direct.h>
#include <io.h>
#include <conio.h>
+#include <wincrypt.h>
/*
================
@@ -82,6 +83,24 @@ void Sys_SnapVector( float *v )
}
#endif
+qboolean Sys_RandomBytes( byte *string, int len )
+{
+ HCRYPTPROV prov;
+
+ if( !CryptAcquireContext( &prov, NULL, NULL,
+ PROV_RSA_FULL, CRYPT_VERIFYCONTEXT ) ) {
+
+ return qfalse;
+ }
+
+ if( !CryptGenRandom( prov, len, (BYTE *)string ) ) {
+ CryptReleaseContext( prov, 0 );
+ return qfalse;
+ }
+ CryptReleaseContext( prov, 0 );
+ return qtrue;
+}
+
/*
**
diff --git a/src/win32/win_wndproc.c b/src/win32/win_wndproc.c
index b22fac91..334d97a4 100644
--- a/src/win32/win_wndproc.c
+++ b/src/win32/win_wndproc.c
@@ -56,7 +56,7 @@ static void WIN_DisableAltTab( void )
{
BOOL old;
- SystemParametersInfo( SPI_SCREENSAVERRUNNING, 1, &old, 0 );
+ SystemParametersInfo( SPI_SETSCREENSAVERRUNNING, 1, &old, 0 );
}
s_alttab_disabled = qtrue;
}
@@ -73,7 +73,7 @@ static void WIN_EnableAltTab( void )
{
BOOL old;
- SystemParametersInfo( SPI_SCREENSAVERRUNNING, 0, &old, 0 );
+ SystemParametersInfo( SPI_SETSCREENSAVERRUNNING, 0, &old, 0 );
}
s_alttab_disabled = qfalse;