shithub: choc

Download patch

ref: a77ebf56c612924bdc3da30ae5f26e41372cac9c
parent: 0e7c1aeabdea199f705a09eb07139dabb0b47f54
author: Simon Howard <[email protected]>
date: Tue Aug 30 18:11:10 EDT 2005

Windows fixes

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 57

--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,7 +2,7 @@
 bindir = $(prefix)/bin
 
 CFLAGS = @CFLAGS@ @SDL_CFLAGS@ @SDLMIXER_CFLAGS@ @SDLNET_CFLAGS@ -DNORMALUNIX -Wall
-LDFLAGS = @LDFLAGS@ @SDL_LIBS@ @SDLMIXER_LIBS@ @SDLNET_LIBS@
+chocolate_doom_LDADD = @LDFLAGS@ @SDL_LIBS@ @SDLMIXER_LIBS@ @SDLNET_LIBS@
 
 chocolate_doom_SOURCES=\
 am_map.c    d_think.h   i_video.c   p_floor.c   p_tick.c    r_things.h	\
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: d_main.c 41 2005-08-04 22:55:08Z fraggle $
+// $Id: d_main.c 57 2005-08-30 22:11:10Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.6  2005/08/30 22:11:10  fraggle
+// Windows fixes
+//
 // Revision 1.5  2005/08/04 22:55:07  fraggle
 // Use DOOM_VERSION to define the Doom version (don't conflict with
 // automake's config.h).  Display GPL message instead of anti-piracy
@@ -50,7 +53,7 @@
 //-----------------------------------------------------------------------------
 
 
-static const char rcsid[] = "$Id: d_main.c 41 2005-08-04 22:55:08Z fraggle $";
+static const char rcsid[] = "$Id: d_main.c 57 2005-08-30 22:11:10Z fraggle $";
 
 #define	BGCOLOR		7
 #define	FGCOLOR		8
@@ -893,7 +896,11 @@
     if (M_CheckParm("-cdrom"))
     {
 	printf(D_CDROM);
+#ifdef _WIN32
+        mkdir("c:\\doomdata");
+#else
 	mkdir("c:\\doomdata",0);
+#endif
 	strcpy (basedefault,"c:/doomdata/default.cfg");
     }	
     
--- a/src/i_main.c
+++ b/src/i_main.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: i_main.c 8 2005-07-23 16:44:57Z fraggle $
+// $Id: i_main.c 57 2005-08-30 22:11:10Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.3  2005/08/30 22:11:10  fraggle
+// Windows fixes
+//
 // Revision 1.2  2005/07/23 16:44:55  fraggle
 // Update copyright to GNU GPL
 //
@@ -35,7 +38,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: i_main.c 8 2005-07-23 16:44:57Z fraggle $";
+rcsid[] = "$Id: i_main.c 57 2005-08-30 22:11:10Z fraggle $";
 
 
 
@@ -49,8 +52,20 @@
 ( int		argc,
   char**	argv ) 
 { 
+
+    // save arguments
+
     myargc = argc; 
     myargv = argv; 
+
+#ifdef _WIN32
+    // restore stdout/stderr
+
+    freopen("CON", "w", stdout);
+    freopen("CON", "w", stderr);
+
+#endif
+    // start doom
  
     D_DoomMain (); 
 
--- a/src/i_net.c
+++ b/src/i_net.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: i_net.c 52 2005-08-12 16:54:15Z fraggle $
+// $Id: i_net.c 57 2005-08-30 22:11:10Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.6  2005/08/30 22:11:10  fraggle
+// Windows fixes
+//
 // Revision 1.5  2005/08/12 16:54:15  fraggle
 // Port network code to use SDL_net
 //
@@ -43,7 +46,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: i_net.c 52 2005-08-12 16:54:15Z fraggle $";
+rcsid[] = "$Id: i_net.c 57 2005-08-30 22:11:10Z fraggle $";
 
 #include <stdlib.h>
 #include <string.h>
@@ -74,6 +77,8 @@
 
 int	DOOMPORT = 8626;
 
+#ifndef NO_SDL_NET
+
 static UDPsocket udpsocket;
 static UDPpacket *packet;
 
@@ -324,4 +329,29 @@
     else
 	I_Error ("Bad net cmd: %i\n",doomcom->command);
 }
+
+#else 
+
+void I_NetCmd(void)
+{
+}
+
+
+void I_InitNetwork (void)
+{
+    doomcom = malloc (sizeof (*doomcom) );
+    memset (doomcom, 0, sizeof(*doomcom) );
+    
+    // single player game
+    netgame = false;
+    doomcom->id = DOOMCOM_ID;
+    doomcom->numplayers = doomcom->numnodes = 1;
+    doomcom->deathmatch = false;
+    doomcom->consoleplayer = 0;
+    return;
+}
+
+
+#endif /* #ifndef NO_SDL_NET */
+
 
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: w_wad.c 37 2005-08-04 18:42:15Z fraggle $
+// $Id: w_wad.c 57 2005-08-30 22:11:10Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.6  2005/08/30 22:11:10  fraggle
+// Windows fixes
+//
 // Revision 1.5  2005/08/04 18:42:15  fraggle
 // Silence compiler warnings
 //
@@ -45,7 +48,7 @@
 
 
 static const char
-rcsid[] = "$Id: w_wad.c 37 2005-08-04 18:42:15Z fraggle $";
+rcsid[] = "$Id: w_wad.c 57 2005-08-30 22:11:10Z fraggle $";
 
 
 #include <ctype.h>
@@ -79,7 +82,7 @@
 
 #define strcmpi	strcasecmp
 
-void strupr (char* s)
+void string_to_upper (char* s)
 {
     while (*s) { *s = toupper(*s); s++; }
 }
@@ -167,7 +170,6 @@
     int			length;
     int			startlump;
     filelump_t*		fileinfo;
-    filelump_t		singleinfo;
     FILE               *storehandle;
     
     // open the file and add to directory
@@ -192,10 +194,10 @@
     if (strcmpi (filename+strlen(filename)-3 , "wad" ) )
     {
 	// single lump file
-	fileinfo = &singleinfo;
-	singleinfo.filepos = 0;
-	singleinfo.size = LONG(filelength(handle));
-	ExtractFileBase (filename, singleinfo.name);
+	fileinfo = Z_Malloc(sizeof(filelump_t), PU_STATIC, 0);
+	fileinfo->filepos = 0;
+	fileinfo->size = LONG(filelength(handle));
+	ExtractFileBase (filename, fileinfo->name);
 	numlumps++;
     }
     else 
@@ -216,7 +218,7 @@
 	header.numlumps = LONG(header.numlumps);
 	header.infotableofs = LONG(header.infotableofs);
 	length = header.numlumps*sizeof(filelump_t);
-	fileinfo = alloca (length);
+	fileinfo = Z_Malloc(length, PU_STATIC, 0);
 	fseek(handle, header.infotableofs, SEEK_SET);
 	fread(fileinfo, length, 1, handle);
 	numlumps += header.numlumps;
@@ -243,6 +245,8 @@
 	
     if (reloadname)
 	fclose (handle);
+
+    Z_Free(fileinfo);
 }
 
 
@@ -273,7 +277,7 @@
     lumpcount = LONG(header.numlumps);
     header.infotableofs = LONG(header.infotableofs);
     length = lumpcount*sizeof(filelump_t);
-    fileinfo = alloca (length);
+    fileinfo = Z_Malloc(length, PU_STATIC, 0);
     fseek(handle, header.infotableofs, SEEK_SET);
     fread(fileinfo, length, 1, handle);
     
@@ -292,6 +296,8 @@
     }
 	
     fclose(handle);
+
+    Z_Free(fileinfo);
 }
 
 
@@ -387,7 +393,7 @@
     name8.s[8] = 0;
 
     // case insensitive
-    strupr (name8.s);		
+    string_to_upper (name8.s);		
 
     v1 = name8.x[0];
     v2 = name8.x[1];