From a77ebf56c612924bdc3da30ae5f26e41372cac9c Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Tue, 30 Aug 2005 22:11:10 +0000 Subject: Windows fixes Subversion-branch: /trunk/chocolate-doom Subversion-revision: 57 --- src/Makefile.am | 2 +- src/d_main.c | 11 +++++++++-- src/i_main.c | 19 +++++++++++++++++-- src/i_net.c | 34 ++++++++++++++++++++++++++++++++-- src/w_wad.c | 28 +++++++++++++++++----------- 5 files changed, 76 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index dd0b8130..b096ce57 100644 --- 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 \ diff --git a/src/d_main.c b/src/d_main.c index 797b160a..8f4683bd 100644 --- 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 @@ void D_DoomMain (void) if (M_CheckParm("-cdrom")) { printf(D_CDROM); +#ifdef _WIN32 + mkdir("c:\\doomdata"); +#else mkdir("c:\\doomdata",0); +#endif strcpy (basedefault,"c:/doomdata/default.cfg"); } diff --git a/src/i_main.c b/src/i_main.c index 795b13e5..c8f77b3f 100644 --- 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 @@ main ( 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 (); diff --git a/src/i_net.c b/src/i_net.c index 11ed335d..0fd21727 100644 --- 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 #include @@ -74,6 +77,8 @@ boolean NetListen (void); int DOOMPORT = 8626; +#ifndef NO_SDL_NET + static UDPsocket udpsocket; static UDPpacket *packet; @@ -325,3 +330,28 @@ void I_NetCmd (void) 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 */ + + diff --git a/src/w_wad.c b/src/w_wad.c index 5fdcf3d0..2d3303cc 100644 --- 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 @@ -79,7 +82,7 @@ void** lumpcache; #define strcmpi strcasecmp -void strupr (char* s) +void string_to_upper (char* s) { while (*s) { *s = toupper(*s); s++; } } @@ -167,7 +170,6 @@ void W_AddFile (char *filename) int length; int startlump; filelump_t* fileinfo; - filelump_t singleinfo; FILE *storehandle; // open the file and add to directory @@ -192,10 +194,10 @@ void W_AddFile (char *filename) 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 @@ void W_AddFile (char *filename) 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 @@ void W_AddFile (char *filename) if (reloadname) fclose (handle); + + Z_Free(fileinfo); } @@ -273,7 +277,7 @@ void W_Reload (void) 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 @@ void W_Reload (void) } fclose(handle); + + Z_Free(fileinfo); } @@ -387,7 +393,7 @@ int W_CheckNumForName (char* name) name8.s[8] = 0; // case insensitive - strupr (name8.s); + string_to_upper (name8.s); v1 = name8.x[0]; v2 = name8.x[1]; -- cgit v1.2.3