diff -rub --exclude='*.vcproj' --exclude='*.sln' --exclude=winquake.rc --exclude=Makefile dfengine_r4/code/client/cl_console.c dfengine_r12/code/client/cl_console.c
--- dfengine_r4/code/client/cl_console.c	2008-11-16 15:34:05.000000000 +0100
+++ dfengine_r12/code/client/cl_console.c	2008-11-16 17:18:26.000000000 +0100
@@ -45,7 +45,7 @@
 
 	float	displayFrac;	// aproaches finalFrac at scr_conspeed
 	float	finalFrac;		// 0.0 to 1.0 lines of console to display
-
+	float	userFrac;		// 0.0 to 1.0 - for user Configurations. Don't want to mess with finalFrac - marky
 	int		vislines;		// in scanlines
 
 	int		times[NUM_CON_TIMES];	// cls.realtime time the line was generated
@@ -726,7 +726,7 @@
 void Con_RunConsole (void) {
 	// decide on the destination height of the console
 	if ( cls.keyCatchers & KEYCATCH_CONSOLE )
-		con.finalFrac = 0.5;		// half screen
+		con.finalFrac = con.userFrac;	// marky
 	else
 		con.finalFrac = 0;				// none visible
 	
@@ -747,6 +747,18 @@
 
 }
 
+// marky
+/*
+==================
+Con_SetFrac
+==================
+*/
+void Con_SetFrac(const float conFrac)
+{
+	con.userFrac = conFrac;
+}
+// !marky
+
 
 void Con_PageUp( void ) {
 	con.display -= 2;
diff -rub --exclude='*.vcproj' --exclude='*.sln' --exclude=winquake.rc --exclude=Makefile dfengine_r4/code/client/client.h dfengine_r12/code/client/client.h
--- dfengine_r4/code/client/client.h	2008-11-16 15:34:05.000000000 +0100
+++ dfengine_r12/code/client/client.h	2008-11-16 17:18:26.000000000 +0100
@@ -449,6 +449,8 @@
 void Con_Bottom( void );
 void Con_Close( void );
 
+void Con_SetFrac( const float conFrac );	// marky
+
 
 //
 // cl_scrn.c
diff -rub --exclude='*.vcproj' --exclude='*.sln' --exclude=winquake.rc --exclude=Makefile dfengine_r4/code/client/cl_keys.c dfengine_r12/code/client/cl_keys.c
--- dfengine_r4/code/client/cl_keys.c	2008-11-16 15:34:05.000000000 +0100
+++ dfengine_r12/code/client/cl_keys.c	2008-11-16 17:18:26.000000000 +0100
@@ -45,6 +45,8 @@
 qboolean	anykeydown;
 qkey_t		keys[MAX_KEYS];
 
+cvar_t 		*con_height; //marky
+
 
 typedef struct {
 	char	*name;
@@ -1039,7 +1041,8 @@
 			anykeydown = 0;
 		}
 	}
-
+// marky
+/*
 #ifdef __linux__
   if (key == K_ENTER)
   {
@@ -1064,13 +1067,26 @@
     }
   }
 #endif
+*/
+// !marky
 
 	// console key is hardcoded, so the user can never unbind it
 	if (key == '`' || key == '~') {
 		if (!down) {
 			return;
 		}
+		//marky
+		con_height = Cvar_Get("con_height", "0.5", 0);	//called early, used as default (set by user)
+		Con_SetFrac(con_height->value);				
+		if(key == '`' || key == '~') {
+			if(keys[K_ALT].down)
+				Con_SetFrac(1.0f);
+			else if (keys[K_SHIFT].down)			// We use shift because CTRL doesn't want to work...
+				Con_SetFrac(.25f);
+			}
+		// !marky
     Con_ToggleConsole_f ();
+    Key_ClearStates();	// marky
 		return;
 	}
 
@@ -1205,7 +1221,8 @@
 */
 void CL_CharEvent( int key ) {
 	// the console key should never be used as a char
-	if ( key == '`' || key == '~' ) {
+	if ( key == '`' || key == '~' 
+		|| key == 178 ) {	// Cgg - azerty french keyboard layout
 		return;
 	}
 
diff -rub --exclude='*.vcproj' --exclude='*.sln' --exclude=winquake.rc --exclude=Makefile dfengine_r4/code/client/cl_main.c dfengine_r12/code/client/cl_main.c
--- dfengine_r4/code/client/cl_main.c	2008-11-16 15:34:05.000000000 +0100
+++ dfengine_r12/code/client/cl_main.c	2008-11-16 15:40:16.000000000 +0100
@@ -279,11 +279,11 @@
 		Com_Printf ("You must be in a level to record.\n");
 		return;
 	}
-
+/* Cgg
   // sync 0 doesn't prevent recording, so not forcing it off .. everyone does g_sync 1 ; record ; g_sync 0 ..
 	if ( !Cvar_VariableValue( "g_synchronousClients" ) ) {
 		Com_Printf (S_COLOR_YELLOW "WARNING: You should set 'g_synchronousClients 1' for smoother demo recording\n");
-	}
+	}*/
 
 	if ( Cmd_Argc() == 2 ) {
 		s = Cmd_Argv(1);
diff -rub --exclude='*.vcproj' --exclude='*.sln' --exclude=winquake.rc --exclude=Makefile dfengine_r4/code/client/cl_parse.c dfengine_r12/code/client/cl_parse.c
--- dfengine_r4/code/client/cl_parse.c	2008-11-16 15:34:05.000000000 +0100
+++ dfengine_r12/code/client/cl_parse.c	2008-11-16 15:40:16.000000000 +0100
@@ -255,6 +255,16 @@
 
 	// read areamask
 	len = MSG_ReadByte( msg );
+	// Cgg - ioquake3 rev 796
+	// Fix remotely exploitable parse download overflow reported by Luigi Auriemma.
+	// See http://lists.grok.org.uk/pipermail/full-disclosure/2006-June/046578.html
+	// for the advisory.
+	if(len > sizeof(newSnap.areamask))
+	{
+		Com_Error (ERR_DROP,"CL_ParseSnapshot: Invalid size %d for areamask.", len);
+		return;
+	}
+	// !Cgg
 	MSG_ReadData( msg, &newSnap.areamask, len);
 
 	// read playerinfo
@@ -475,6 +485,17 @@
 	unsigned char data[MAX_MSGLEN];
 	int block;
 
+	// Cgg - ioquake3 rev 796
+	// Fix remotely exploitable parse download overflow reported by Luigi Auriemma.
+	// See http://lists.grok.org.uk/pipermail/full-disclosure/2006-June/046578.html
+	// for the advisory.
+	if (!*clc.downloadTempName) {
+		Com_Printf("Server sending download, but no download was requested\n");
+		CL_AddReliableCommand( "stopdl" );
+		return;
+	}
+	// !Cgg
+
 	// read the data
 	block = MSG_ReadShort ( msg );
 
@@ -493,8 +514,17 @@
 	}
 
 	size = MSG_ReadShort ( msg );
-	if (size > 0)
-		MSG_ReadData( msg, data, size );
+	// Cgg - ioquake3 rev 796
+	// Fix remotely exploitable parse download overflow reported by Luigi Auriemma.
+	// See http://lists.grok.org.uk/pipermail/full-disclosure/2006-June/046578.html
+	// for the advisory.
+	if (size < 0 || size > sizeof(data))
+	{
+		Com_Error(ERR_DROP, "CL_ParseDownload: Invalid size %d for download chunk.", size);
+		return;
+	}
+	MSG_ReadData(msg, data, size);	
+	// !Cgg
 
 	if (clc.downloadBlock != block) {
 		Com_DPrintf( "CL_ParseDownload: Expected block %d, got %d\n", clc.downloadBlock, block);
@@ -504,11 +534,17 @@
 	// open the file if not opened yet
 	if (!clc.download)
 	{
+		// Cgg - ioquake3 rev 796
+		// Fix remotely exploitable parse download overflow reported by Luigi Auriemma.
+		// See http://lists.grok.org.uk/pipermail/full-disclosure/2006-June/046578.html
+		// for the advisory.
+	/*
 		if (!*clc.downloadTempName) {
 			Com_Printf("Server sending download, but no download was requested\n");
 			CL_AddReliableCommand( "stopdl" );
 			return;
-		}
+		}*/
+		// !Cgg
 
 		clc.download = FS_SV_FOpenFileWrite( clc.downloadTempName );
 
diff -rub --exclude='*.vcproj' --exclude='*.sln' --exclude=winquake.rc --exclude=Makefile dfengine_r4/code/client/cl_scrn.c dfengine_r12/code/client/cl_scrn.c
--- dfengine_r4/code/client/cl_scrn.c	2008-11-16 15:34:05.000000000 +0100
+++ dfengine_r12/code/client/cl_scrn.c	2008-11-16 15:40:16.000000000 +0100
@@ -30,6 +30,7 @@
 cvar_t		*cl_graphheight;
 cvar_t		*cl_graphscale;
 cvar_t		*cl_graphshift;
+cvar_t		*ch_recordMessage;	// Cgg
 
 /*
 ================
@@ -329,6 +330,12 @@
 	char	string[1024];
 	int		pos;
 
+	// Cgg - off by default
+	if (!ch_recordMessage->integer) {
+		return;
+	}
+	// !Cgg
+
 	if ( !clc.demorecording ) {
 		return;
 	}
@@ -421,6 +428,7 @@
 	cl_graphheight = Cvar_Get ("graphheight", "32", CVAR_CHEAT);
 	cl_graphscale = Cvar_Get ("graphscale", "1", CVAR_CHEAT);
 	cl_graphshift = Cvar_Get ("graphshift", "0", CVAR_CHEAT);
+	ch_recordMessage = Cvar_Get ("ch_recordMessage", "0", CVAR_ARCHIVE);	// Cgg
 
 	scr_initialized = qtrue;
 }
diff -rub --exclude='*.vcproj' --exclude='*.sln' --exclude=winquake.rc --exclude=Makefile dfengine_r4/code/game/q_shared.h dfengine_r12/code/game/q_shared.h
--- dfengine_r4/code/game/q_shared.h	2008-11-16 15:34:05.000000000 +0100
+++ dfengine_r12/code/game/q_shared.h	2008-11-16 18:37:35.000000000 +0100
@@ -26,7 +26,8 @@
 // q_shared.h -- included first by ALL program modules.
 // A user mod should never modify this file
 
-#define	Q3_VERSION		"Q3 1.32b"
+// Cgg
+#define	Q3_VERSION		"dfengine 1.03"
 // 1.32 released 7-10-2002
 
 #define MAX_TEAMNAME 32
@@ -54,6 +55,7 @@
 #pragma warning(disable : 4702)		// unreachable code
 #pragma warning(disable : 4711)		// selected for automatic inline expansion
 #pragma warning(disable : 4220)		// varargs matches remaining parameters
+#define _CRT_SECURE_NO_WARNINGS 1	// Cgg - disabling deprecated warnings in crt functions with msvc 2008
 #endif
 
 /**********************************************************************
diff -rub --exclude='*.vcproj' --exclude='*.sln' --exclude=winquake.rc --exclude=Makefile dfengine_r4/code/qcommon/cmd.c dfengine_r12/code/qcommon/cmd.c
--- dfengine_r4/code/qcommon/cmd.c	2008-11-16 15:34:05.000000000 +0100
+++ dfengine_r12/code/qcommon/cmd.c	2008-11-16 15:41:31.000000000 +0100
@@ -24,7 +24,10 @@
 #include "../game/q_shared.h"
 #include "qcommon.h"
 
-#define	MAX_CMD_BUFFER	16384
+// Cgg - expanding command buffer from 16k to 64k
+//#define	MAX_CMD_BUFFER	16384
+#define	MAX_CMD_BUFFER	0x10000
+// !Cgg
 #define	MAX_CMD_LINE	1024
 
 typedef struct {
diff -rub --exclude='*.vcproj' --exclude='*.sln' --exclude=winquake.rc --exclude=Makefile dfengine_r4/code/qcommon/common.c dfengine_r12/code/qcommon/common.c
--- dfengine_r4/code/qcommon/common.c	2008-11-16 15:34:05.000000000 +0100
+++ dfengine_r12/code/qcommon/common.c	2008-11-16 15:40:16.000000000 +0100
@@ -3184,6 +3184,12 @@
 // field we are working on, passed to Field_CompleteCommand (&g_consoleCommand for instance)
 static field_t *completionField;
 
+// Cgg
+const char *Field_GetCompletionString() {
+	return completionString;
+}
+// !Cgg
+
 /*
 ===============
 FindMatches
@@ -3203,11 +3209,14 @@
 	}
 
 	// cut shortestMatch to the amount common with s
-	for ( i = 0 ; s[i] ; i++ ) {
+	// Cgg - was wrong when s had fewer chars than shortestMatch
+	i = 0;
+	do {
 		if ( tolower(shortestMatch[i]) != tolower(s[i]) ) {
 			shortestMatch[i] = 0;
 		}
-	}
+	} while (s[i++]);
+	// !Cgg
 }
 
 /*
@@ -3222,6 +3231,15 @@
 	}
 }
 
+// Cgg
+static void PrintCvarMatches(const char *s) {
+	if (Q_stricmpn(s, shortestMatch, strlen(shortestMatch))) {
+		return;
+	}
+	Com_Printf("    %-32s ^7\"%s^7\"\n", s, Cvar_VariableString(s));
+}
+// !Cgg
+
 static void keyConcatArgs( void ) {
 	int		i;
 	char	*arg;
@@ -3284,6 +3302,51 @@
 		return;
 	}
 
+	// Cgg - autocompletion on map names
+	if (!Q_stricmp(completionString, "map")
+		|| !Q_stricmp(completionString, "devmap")
+		|| !Q_stricmp(completionString, "vq3")
+		|| !Q_stricmp(completionString, "devvq3")
+		|| !Q_stricmp(completionString, "cpm")
+		|| !Q_stricmp(completionString, "devcpm")) {
+		const char *cmd;
+		cmd = Q_strlwr(Cmd_Argv(0));
+		completionString = Cmd_Argv(1);
+		if ( cmd[0] == '\\' || cmd[0] == '/' ) {
+			cmd++;
+		}
+		Maps_CommandCompletion(FindMatches);
+		Com_sprintf(completionField->buffer, sizeof(completionField->buffer), "\\%s %s", cmd, (shortestMatch[0]) ? shortestMatch : Cmd_Argv(1));
+		completionField->cursor = strlen(completionField->buffer);
+		if (matchCount < 2) {
+			return;
+		}
+		Com_Printf( "]%s\n", completionField->buffer );
+		Maps_CommandCompletion(PrintMatches);
+		return;
+	}
+	// !Cgg
+
+	// Cgg - autocompletion on demo names
+	if (!Q_stricmp(completionString, "demo")) {
+		const char *cmd;
+		cmd = Q_strlwr(Cmd_Argv(0));
+		completionString = Cmd_Argv(1);
+		if ( cmd[0] == '\\' || cmd[0] == '/' ) {
+			cmd++;
+		}
+		Demos_CommandCompletion(FindMatches);
+		Com_sprintf(completionField->buffer, sizeof(completionField->buffer), "\\%s %s", cmd, (shortestMatch[0]) ? shortestMatch : Cmd_Argv(1));
+		completionField->cursor = strlen(completionField->buffer);
+		if (matchCount < 2) {
+			return;
+		}
+		Com_Printf( "]%s\n", completionField->buffer );
+		Demos_CommandCompletion(PrintMatches);
+		return;
+	}
+	// !Cgg
+
 	Cmd_CommandCompletion( FindMatches );
 	Cvar_CommandCompletion( FindMatches );
 
@@ -3313,5 +3376,5 @@
 
 	// run through again, printing matches
 	Cmd_CommandCompletion( PrintMatches );
-	Cvar_CommandCompletion( PrintMatches );
+	Cvar_CommandCompletion( PrintCvarMatches );	// Cgg
 }
diff -rub --exclude='*.vcproj' --exclude='*.sln' --exclude=winquake.rc --exclude=Makefile dfengine_r4/code/qcommon/files.c dfengine_r12/code/qcommon/files.c
--- dfengine_r4/code/qcommon/files.c	2008-11-16 15:34:05.000000000 +0100
+++ dfengine_r12/code/qcommon/files.c	2008-11-16 17:18:26.000000000 +0100
@@ -1705,6 +1705,10 @@
 	{
 		err = unzGetCurrentFileInfo(uf, &file_info, filename_inzip, sizeof(filename_inzip), NULL, 0, NULL, 0);
 		if (err != UNZ_OK) {
+			// Cgg - it's better to fail and have the user notified than to have a half-loaded pk3,
+			// or worse a failed pack referenced that results in further failures (yes it does happen)
+			Com_Error(ERR_FATAL, "Corrupted pk3 file \'%s\'", basename);
+			// !Cgg
 			break;
 		}
 		len += strlen(filename_inzip) + 1;
@@ -1746,6 +1750,9 @@
 	{
 		err = unzGetCurrentFileInfo(uf, &file_info, filename_inzip, sizeof(filename_inzip), NULL, 0, NULL, 0);
 		if (err != UNZ_OK) {
+			// Cgg - see above
+			Com_Error(ERR_FATAL, "Corrupted pk3 file \'%s\'", basename);
+			// !Cgg
 			break;
 		}
 		if (file_info.uncompressed_size > 0) {
@@ -2436,6 +2443,131 @@
 	}
 }
 
+// Cgg - autocompletion on map & demo names
+void Maps_CommandCompletion(void (*callback) (const char *s)) {
+	char **matches;
+	char m[MAX_QPATH];
+	char *c;
+	int i, n;
+
+	matches = FS_ListFilteredFiles("maps", ".bsp", NULL, &n);
+	FS_SortFileList(matches, n);
+	for (i=0; i<n; i++) {
+		Q_strncpyz(m, matches[i], sizeof(m));
+		for (c=m+strlen(m)-1; c>m; c--) {
+			if (*c != '.') {
+				continue;
+			}
+			*c = 0;
+			break;
+		}
+		callback(m);
+	}
+	FS_FreeFileList(matches);
+}
+const char *Field_GetCompletionString();	// prototype from common.c
+void Demos_CommandCompletion(void (*callback) (const char *s)) {
+	char searchpath[MAX_QPATH];
+	char path[MAX_QPATH];
+	char m[MAX_QPATH];
+	char **matches;
+	char **list;
+	const char *completionString, *c;
+	int i, n, nlist;
+
+	// set up searchpath
+	Q_strncpyz(path, "", sizeof(path));
+	Q_strncpyz(searchpath, "demos", sizeof(searchpath));
+	completionString = Field_GetCompletionString();
+	for (c=completionString+strlen(completionString)-1; c>completionString; c--) {
+		if (*c == '/') {
+			Q_strncpyz(path, completionString, c-completionString+1);	// destsize accounts for the trailing \0
+			Com_sprintf(searchpath, sizeof(searchpath), "demos/%s", path);
+			break;
+		}
+	}
+
+	// set up the list
+	list = Z_Malloc(MAX_FOUND_FILES * sizeof(*list));
+	nlist = 0;
+
+	// directories
+	matches = FS_ListFilteredFiles(searchpath, "/", NULL, &n);
+	for (i=0; i<n; i++) {
+		// filter out . .. and hidden files that follow the unix convention
+		if (matches[i][0] == '.') {
+			continue;
+		}
+		// FS_ListFilteredFiles() on directories returns one empty string
+		if (matches[i][0] == 0) {
+			continue;
+		}
+		if (strlen(path)) {
+			Com_sprintf(m, sizeof(m), "%s/%s/", path, matches[i]);
+		} else {
+			Com_sprintf(m, sizeof(m), "%s/", matches[i]);
+		}
+		nlist = FS_AddFileToList(m, list, nlist);
+	}
+	FS_FreeFileList(matches);
+
+	// .dm_68
+	matches = FS_ListFilteredFiles(searchpath, ".dm_68", NULL, &n);
+	for (i=0; i<n; i++) {
+		// filter hidden files out
+		if (matches[i][0] == '.') {
+			continue;
+		}
+		if (strlen(path)) {
+			Com_sprintf(m, sizeof(m), "%s/%s", path, matches[i]);
+			nlist = FS_AddFileToList(m, list, nlist);
+			continue;
+		}
+		nlist = FS_AddFileToList(matches[i], list, nlist);
+	}
+	FS_FreeFileList(matches);
+
+	// .dm_67
+	matches = FS_ListFilteredFiles(searchpath, ".dm_67", NULL, &n);
+	for (i=0; i<n; i++) {
+		// filter hidden files out
+		if (matches[i][0] == '.') {
+			continue;
+		}
+		if (strlen(path)) {
+			Com_sprintf(m, sizeof(m), "%s/%s", path, matches[i]);
+			nlist = FS_AddFileToList(m, list, nlist);
+			continue;
+		}
+		nlist = FS_AddFileToList(matches[i], list, nlist);
+	}
+	FS_FreeFileList(matches);
+
+	// .dm_66
+	matches = FS_ListFilteredFiles(searchpath, ".dm_66", NULL, &n);
+	for (i=0; i<n; i++) {
+		// filter hidden files out
+		if (matches[i][0] == '.') {
+			continue;
+		}
+		if (strlen(path)) {
+			Com_sprintf(m, sizeof(m), "%s/%s", path, matches[i]);
+			nlist = FS_AddFileToList(m, list, nlist);
+			continue;
+		}
+		nlist = FS_AddFileToList(matches[i], list, nlist);
+	}
+	FS_FreeFileList(matches);
+
+	// sort list and callback
+	FS_SortFileList(list, nlist);
+	for (i=0; i<nlist; i++) {
+		callback(list[i]);
+	}
+	FS_FreeFileList(list);
+}
+// !Cgg
+
 //===========================================================================
 
 
diff -rub --exclude='*.vcproj' --exclude='*.sln' --exclude=winquake.rc --exclude=Makefile dfengine_r4/code/qcommon/qcommon.h dfengine_r12/code/qcommon/qcommon.h
--- dfengine_r4/code/qcommon/qcommon.h	2008-11-16 15:34:05.000000000 +0100
+++ dfengine_r12/code/qcommon/qcommon.h	2008-11-16 15:39:00.000000000 +0100
@@ -632,6 +632,11 @@
 
 void FS_Rename( const char *from, const char *to );
 
+// Cgg - autocompletion on map & demo names
+void Maps_CommandCompletion(void (*callback) (const char *s));
+void Demos_CommandCompletion(void (*callback) (const char *s));
+// !Cgg
+
 /*
 ==============================================================
 
diff -rub --exclude='*.vcproj' --exclude='*.sln' --exclude=winquake.rc --exclude=Makefile dfengine_r4/code/server/sv_init.c dfengine_r12/code/server/sv_init.c
--- dfengine_r4/code/server/sv_init.c	2008-11-16 15:34:05.000000000 +0100
+++ dfengine_r12/code/server/sv_init.c	2008-11-16 15:39:00.000000000 +0100
@@ -520,12 +520,17 @@
 		Cvar_Set( "sv_paks", "" );
 		Cvar_Set( "sv_pakNames", "" );
 	}
+// Cgg - this fails with the large number of defrag pk3s
+// Removing this prevents packs from being auto-downloaded, but so does repacking.
+/*
 	// the server sends these to the clients so they can figure
 	// out which pk3s should be auto-downloaded
 	p = FS_ReferencedPakChecksums();
 	Cvar_Set( "sv_referencedPaks", p );
 	p = FS_ReferencedPakNames();
 	Cvar_Set( "sv_referencedPakNames", p );
+*/
+// !Cgg
 
 	// save systeminfo and serverinfo strings
 	Q_strncpyz( systemInfo, Cvar_InfoString_Big( CVAR_SYSTEMINFO ), sizeof( systemInfo ) );
diff -rub --exclude='*.vcproj' --exclude='*.sln' --exclude=winquake.rc --exclude=Makefile dfengine_r4/code/win32/win_main.c dfengine_r12/code/win32/win_main.c
--- dfengine_r4/code/win32/win_main.c	2008-11-16 15:34:05.000000000 +0100
+++ dfengine_r12/code/win32/win_main.c	2008-11-16 15:39:00.000000000 +0100
@@ -1191,6 +1191,10 @@
         return 0;
 	}
 
+	// Cgg - max number of open files at the crt level
+	_setmaxstdio(2048);
+	// !Cgg
+
 	g_wv.hInstance = hInstance;
 	Q_strncpyz( sys_cmdline, lpCmdLine, sizeof( sys_cmdline ) );
 
