From 75ef62b6f3b6285295cb2e8d9d582dd35cdcad9c Mon Sep 17 00:00:00 2001
From: Spoike <acceptthis@users.sourceforge.net>
Date: Thu, 28 Nov 2013 01:08:12 +0000
Subject: [PATCH] mingl fixes.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4540 fc73d0e0-1445-4013-8a0c-d673dee63da5
---
 engine/client/cl_demo.c           |  4 ++++
 engine/client/cl_main.c           | 33 +++++++++++++++++++++----------
 engine/dotnet2005/ftequake.vcproj |  8 ++++++++
 3 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/engine/client/cl_demo.c b/engine/client/cl_demo.c
index 989e91073..49753a984 100644
--- a/engine/client/cl_demo.c
+++ b/engine/client/cl_demo.c
@@ -1700,6 +1700,7 @@ void CL_PlayDemo(char *demoname)
 	//figure out where we started
 	start = VFS_TELL(f);
 
+#ifdef Q2CLIENT
 	//check if its a quake2 demo.
 	VFS_READ(f, &len, sizeof(len));
 	VFS_READ(f, &type, sizeof(type));
@@ -1710,7 +1711,9 @@ void CL_PlayDemo(char *demoname)
 		CL_PlayDemoStream(f, NULL, name, DPB_QUAKE2, 0);
 		return;
 	}
+#endif
 
+#ifdef NQPROT
 	//not quake2, check if its NQ
 	ft = 0;	//work out if the first line is a int for the track number.
 	while ((VFS_READ(f, &chr, 1)==1) && (chr != '\n'))
@@ -1730,6 +1733,7 @@ void CL_PlayDemo(char *demoname)
 		return;
 	}
 	VFS_SEEK(f, start);
+#endif
 
 	//its not NQ then. must be QuakeWorld, either .qwd or .mvd
 	//could also be .qwz or .dmz or whatever that nq extension is. we don't support either.
diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c
index 8dd4512d2..5d9c539e8 100644
--- a/engine/client/cl_main.c
+++ b/engine/client/cl_main.c
@@ -3635,7 +3635,7 @@ void Host_BeginFileDownload(struct dl_download *dl, char *mimetype)
 		else if (!strcmp(mimetype, "application/x-ftemanifest"))
 			f->flags |= HRF_MANIFEST;
 		else if (!strcmp(mimetype, "application/x-multiviewdemo"))
-			f->flags |= HRF_MVD;
+			f->flags |= HRF_DEMO_MVD;
 //		else if (!strcmp(mimetype, "application/x-ftebsp"))
 //			f->flags |= HRF_BSP;
 //		else if (!strcmp(mimetype, "application/x-ftepackage"))
@@ -3665,7 +3665,7 @@ void Host_BeginFileDownload(struct dl_download *dl, char *mimetype)
 			f->flags |= HRF_PACKAGE;
 		else
 		{
-			//file type not guessable from extension.
+			//file type not guessable from extension either.
 			f->flags |= HRF_ABORT;
 			Host_DoRunFile(f);
 			return;
@@ -3679,10 +3679,17 @@ void Host_BeginFileDownload(struct dl_download *dl, char *mimetype)
 		CL_PlayDemoStream((dl->file = VFSPIPE_Open()), dl, f->fname, DPB_QUAKEWORLD, 0);
 	else if (f->flags & HRF_DEMO_MVD)
 		CL_PlayDemoStream((dl->file = VFSPIPE_Open()), dl, f->fname, DPB_MVD, 0);
+#ifdef Q2CLIENT
 	else if (f->flags & HRF_DEMO_DM2)
 		CL_PlayDemoStream((dl->file = VFSPIPE_Open()), dl, f->fname, DPB_QUAKE2, 0);
-	else if (f->flags & HRF_DEMO_DEM)
-		CL_PlayDemoStream((dl->file = VFSPIPE_Open()), dl, f->fname, DPB_NETQUAKE, 0);
+#endif
+#ifdef NQPROT
+//fixme: the demo code can't handle the cd track like this.
+//	else if (f->flags & HRF_DEMO_DEM)
+//		CL_PlayDemoStream((dl->file = VFSPIPE_Open()), dl, f->fname, DPB_NETQUAKE, 0);
+#endif
+	else if (f->flags & HRF_DEMO)
+		Con_Printf("%s: format not supported\n", f->fname);	//demos that are not supported in this build for one reason or another
 	else
 		return;
 
@@ -3750,15 +3757,21 @@ void Host_DoRunFile(hrf_t *f)
 
 		//if we get here, we have no mime type to give us any clues.
 		ext = COM_FileExtension(f->fname);
-		if (!strcmp(ext, "qwd") || !strcmp(ext, "dem") || !strcmp(ext, "dm2") || !strcmp(ext, "mvd"))
-			f->flags |= HRF_DEMO;
-		if (!strcmp(ext, "qtv"))
+		if (!strcmp(ext, "qwd"))
+			f->flags |= HRF_DEMO_QWD;
+		else if (!strcmp(ext, "mvd"))
+			f->flags |= HRF_DEMO_MVD;
+		else if (!strcmp(ext, "dm2"))
+			f->flags |= HRF_DEMO_DM2;
+		else if (!strcmp(ext, "dem"))
+			f->flags |= HRF_DEMO_DEM;
+		else if (!strcmp(ext, "qtv"))
 			f->flags |= HRF_QTVINFO;
-		if (!strcmp(ext, "fmf"))
+		else if (!strcmp(ext, "fmf"))
 			f->flags |= HRF_MANIFEST;
-		if (!strcmp(ext, "bsp"))
+		else if (!strcmp(ext, "bsp"))
 			f->flags |= HRF_BSP;
-		if (!strcmp(ext, "pak") || !strcmp(ext, "pk3"))
+		else if (!strcmp(ext, "pak") || !strcmp(ext, "pk3"))
 			f->flags |= HRF_PACKAGE;
 
 		//if we still don't know what it is, give up.
diff --git a/engine/dotnet2005/ftequake.vcproj b/engine/dotnet2005/ftequake.vcproj
index 44319a227..43c3ea414 100644
--- a/engine/dotnet2005/ftequake.vcproj
+++ b/engine/dotnet2005/ftequake.vcproj
@@ -29643,6 +29643,14 @@
 				<File
 					RelativePath="..\common\net_sellingmysoultothedevil.cpp"
 					>
+					<FileConfiguration
+						Name="MinGLDebug|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
 					<FileConfiguration
 						Name="GLDebug|Win32"
 						>