shithub: choc

Download patch

ref: 860c6b8691ae2b48fc8b3be22d78d0f5fefc9696
parent: e2c0f46e4f64f7970005a66056be85a6929b5227
author: Simon Howard <[email protected]>
date: Sun Oct 16 16:55:50 EDT 2005

Fix the '-cdrom' command-line option.

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

--- a/src/d_main.c
+++ b/src/d_main.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: d_main.c 202 2005-10-16 01:18:10Z fraggle $
+// $Id: d_main.c 204 2005-10-16 20:55:50Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.29  2005/10/16 20:55:50  fraggle
+// Fix the '-cdrom' command-line option.
+//
 // Revision 1.28  2005/10/16 01:18:10  fraggle
 // Global "configdir" variable with directory to store config files in.
 // Create a function to find the filename for a savegame slot.  Store
@@ -130,7 +133,7 @@
 //-----------------------------------------------------------------------------
 
 
-static const char rcsid[] = "$Id: d_main.c 202 2005-10-16 01:18:10Z fraggle $";
+static const char rcsid[] = "$Id: d_main.c 204 2005-10-16 20:55:50Z fraggle $";
 
 #define	BGCOLOR		7
 #define	FGCOLOR		8
@@ -1112,7 +1115,20 @@
     }
     else
     {
-        configdir = strdup("");
+#ifdef _WIN32
+        // when given the -cdrom option, save config+savegames in 
+        // c:\doomdata.  This only applies under Windows.
+
+        if (M_CheckParm("-cdrom") > 0)
+        {
+            printf(D_CDROM);
+            configdir = strdup("c:\\doomdata\\");
+        }
+        else
+#endif
+        {
+            configdir = strdup("");
+        }
     }
 }
 
@@ -1147,20 +1163,6 @@
     if (devparm)
 	printf(D_DEVSTR);
     
-#if 0
-    // BROKEN: -cdrom option
-    if (M_CheckParm("-cdrom"))
-    {
-	printf(D_CDROM);
-#ifdef _WIN32
-        mkdir("c:\\doomdata");
-#else
-	mkdir("c:\\doomdata",0);
-#endif
-	strcpy (basedefault,"c:/doomdata/default.cfg");
-    }
-#endif     
-
     // find which dir to use for config files
 
     SetConfigDir();
@@ -1430,13 +1432,6 @@
     p = M_CheckParm ("-loadgame");
     if (p && p < myargc-1)
     {
-#if 0
-        // -cdrom currently broken
-	if (M_CheckParm("-cdrom"))
-	    sprintf(file, "c:\\doomdata\\"SAVEGAMENAME"%c.dsg",myargv[p+1][0]);
-	else
-#endif
-
         strcpy(file, P_SaveGameFile(atoi(myargv[p+1])));
 	G_LoadGame (file);
     }
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: g_game.c 202 2005-10-16 01:18:10Z fraggle $
+// $Id: g_game.c 204 2005-10-16 20:55:50Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.15  2005/10/16 20:55:50  fraggle
+// Fix the '-cdrom' command-line option.
+//
 // Revision 1.14  2005/10/16 01:18:10  fraggle
 // Global "configdir" variable with directory to store config files in.
 // Create a function to find the filename for a savegame slot.  Store
@@ -82,7 +85,7 @@
 
 
 static const char
-rcsid[] = "$Id: g_game.c 202 2005-10-16 01:18:10Z fraggle $";
+rcsid[] = "$Id: g_game.c 204 2005-10-16 20:55:50Z fraggle $";
 
 #include <string.h>
 #include <stdlib.h>
@@ -1372,13 +1375,6 @@
     int		length; 
     int		i; 
 	
-#if 0
-    // -cdrom currently broken
-    if (M_CheckParm("-cdrom"))
-	sprintf(name,"c:\\doomdata\\"SAVEGAMENAME"%d.dsg",savegameslot);
-    else
-#endif
-
     strcpy(name, P_SaveGameFile(savegameslot));
 
     description = savedescription; 
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: i_video.c 201 2005-10-15 22:50:57Z fraggle $
+// $Id: i_video.c 204 2005-10-16 20:55:50Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.39  2005/10/16 20:55:50  fraggle
+// Fix the '-cdrom' command-line option.
+//
 // Revision 1.38  2005/10/15 22:50:57  fraggle
 // Fix pink icon on startup
 //
@@ -158,7 +161,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: i_video.c 201 2005-10-15 22:50:57Z fraggle $";
+rcsid[] = "$Id: i_video.c 204 2005-10-16 20:55:50Z fraggle $";
 
 #include <SDL.h>
 #include <ctype.h>
@@ -285,7 +288,10 @@
     patch_t *disk;
     int y;
 
-    disk = (patch_t *) W_CacheLumpName("STDISK", PU_STATIC);
+    if (M_CheckParm("-cdrom") > 0)
+        disk = (patch_t *) W_CacheLumpName("STCDROM", PU_STATIC);
+    else
+        disk = (patch_t *) W_CacheLumpName("STDISK", PU_STATIC);
 
     V_DrawPatch(0, 0, 0, disk);
     disk_image_w = SHORT(disk->width);
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: m_menu.c 202 2005-10-16 01:18:10Z fraggle $
+// $Id: m_menu.c 204 2005-10-16 20:55:50Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.10  2005/10/16 20:55:50  fraggle
+// Fix the '-cdrom' command-line option.
+//
 // Revision 1.9  2005/10/16 01:18:10  fraggle
 // Global "configdir" variable with directory to store config files in.
 // Create a function to find the filename for a savegame slot.  Store
@@ -62,7 +65,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: m_menu.c 202 2005-10-16 01:18:10Z fraggle $";
+rcsid[] = "$Id: m_menu.c 204 2005-10-16 20:55:50Z fraggle $";
 
 #include <stdlib.h>
 #include <ctype.h>
@@ -555,12 +558,6 @@
 	
     for (i = 0;i < load_end;i++)
     {
-#if 0
-        // -cdrom currently broken
-	if (M_CheckParm("-cdrom"))
-	    sprintf(name,"c:\\doomdata\\"SAVEGAMENAME"%d.dsg",i);
-	else
-#endif
         strcpy(name, P_SaveGameFile(i));
 
 	handle = fopen(name, "rb");
@@ -621,11 +618,6 @@
 {
     char    name[256];
 	
-#if 0
-    if (M_CheckParm("-cdrom"))
-	sprintf(name,"c:\\doomdata\\"SAVEGAMENAME"%d.dsg",choice);
-    else
-#endif
     strcpy(name, P_SaveGameFile(choice));
 
     G_LoadGame (name);