moved screenshot base name stuff to common.c, out of fs.c (by adding a gamescreenshot...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 19 May 2004 00:49:08 +0000 (00:49 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 19 May 2004 00:49:08 +0000 (00:49 +0000)
added support for multiple -game directories (-game a -game b -game c ...)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4196 d7cf8633-e32d-0410-b094-e92efae38249

common.c
common.h
fs.c

index 147393c..e5e4713 100644 (file)
--- a/common.c
+++ b/common.c
@@ -43,6 +43,7 @@ char com_cmdline[CMDLINE_LENGTH];
 int gamemode;
 char *gamename;
 char *gamedirname;
+char *gamescreenshotname;
 char com_modname[MAX_OSPATH] = "";
 
 
@@ -776,58 +777,72 @@ void COM_InitGameType (void)
        case GAME_NORMAL:
                gamename = "DarkPlaces-Quake";
                gamedirname = "";
+               gamescreenshotname = "dp";
                break;
        case GAME_HIPNOTIC:
                gamename = "Darkplaces-Hipnotic";
                gamedirname = "hipnotic";
+               gamescreenshotname = "dp";
                break;
        case GAME_ROGUE:
                gamename = "Darkplaces-Rogue";
                gamedirname = "rogue";
+               gamescreenshotname = "dp";
                break;
        case GAME_NEHAHRA:
                gamename = "DarkPlaces-Nehahra";
                gamedirname = "nehahra";
+               gamescreenshotname = "dp";
                break;
        case GAME_NEXUIZ:
                gamename = "Nexuiz";
                gamedirname = "data";
+               gamescreenshotname = "nexuiz";
                break;
        case GAME_TRANSFUSION:
                gamename = "Transfusion";
                gamedirname = "basetf";
+               gamescreenshotname = "transfusion";
                break;
        case GAME_GOODVSBAD2:
                gamename = "GoodVs.Bad2";
                gamedirname = "rts";
+               gamescreenshotname = "gvb2";
                break;
        case GAME_TEU:
                gamename = "TheEvilUnleashed";
                gamedirname = "baseteu";
+               gamescreenshotname = "teu";
                break;
        case GAME_BATTLEMECH:
                gamename = "Battlemech";
                gamedirname = "base";
+               gamescreenshotname = "battlemech";
                break;
        case GAME_ZYMOTIC:
                gamename = "Zymotic";
                gamedirname = "data";
+               gamescreenshotname = "zymotic";
                break;
        case GAME_FNIGGIUM:
                gamename = "Fniggium";
                gamedirname = "data";
+               gamescreenshotname = "fniggium";
                break;
        case GAME_SETHERAL:
                gamename = "Setheral";
                gamedirname = "data";
+               gamescreenshotname = "setheral";
                break;
        case GAME_SOM:
                gamename = "Son of Man";
                gamedirname = "data";
+               gamescreenshotname = "som";
                break;
        case GAME_TENEBRAE:
                gamename = "DarkPlaces-Tenebrae";
                gamedirname = "tenebrae";
+               gamescreenshotname = "dp";
                break;
        default:
                Sys_Error("COM_InitGameType: unknown gamemode %i\n", gamemode);
@@ -854,8 +869,6 @@ void COM_Init (void)
        FS_Init ();
        Log_Init ();
        COM_CheckRegistered ();
-
-       COM_InitGameType();
 }
 
 
index d9e9314..d2ed7ae 100644 (file)
--- a/common.h
+++ b/common.h
@@ -188,6 +188,7 @@ extern      struct cvar_s   cmdline;
 extern int gamemode;
 extern char *gamename;
 extern char *gamedirname;
+extern char *gamescreenshotname;
 extern char com_modname[MAX_OSPATH];
 
 void COM_ToLowerString (const char *in, char *out, size_t size_out);
diff --git a/fs.c b/fs.c
index 2d81ce3..4bf26d4 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -945,58 +945,10 @@ void FS_Init (void)
                return;
        }
 
-       switch(gamemode)
-       {
-               case GAME_NORMAL:
-                       Cvar_SetQuick (&scr_screenshot_name, "dp");
-                       break;
-               case GAME_HIPNOTIC:
-                       Cvar_SetQuick (&scr_screenshot_name, "hipnotic");
-                       break;
-               case GAME_ROGUE:
-                       Cvar_SetQuick (&scr_screenshot_name, "rogue");
-                       break;
-               case GAME_NEHAHRA:
-                       Cvar_SetQuick (&scr_screenshot_name, "nehahra");
-                       break;
-               case GAME_NEXUIZ:
-                       Cvar_SetQuick (&scr_screenshot_name, "nexuiz");
-                       break;
-               case GAME_TRANSFUSION:
-                       Cvar_SetQuick (&scr_screenshot_name, "transfusion");
-                       break;
-               case GAME_GOODVSBAD2:
-                       Cvar_SetQuick (&scr_screenshot_name, "gvb2");
-                       break;
-               case GAME_TEU:
-                       Cvar_SetQuick (&scr_screenshot_name, "teu");
-                       break;
-               case GAME_BATTLEMECH:
-                       Cvar_SetQuick (&scr_screenshot_name, "battlemech");
-                       break;
-               case GAME_ZYMOTIC:
-                       Cvar_SetQuick (&scr_screenshot_name, "zymotic");
-                       break;
-               case GAME_FNIGGIUM:
-                       Cvar_SetQuick (&scr_screenshot_name, "fniggium");
-                       break;
-               case GAME_SETHERAL:
-                       Cvar_SetQuick (&scr_screenshot_name, "setheral");
-                       break;
-               case GAME_SOM:
-                       Cvar_SetQuick (&scr_screenshot_name, "som");
-                       break;
-               case GAME_TENEBRAE:
-                       Cvar_SetQuick (&scr_screenshot_name, "tenebrae");
-                       break;
-               default:
-                       Cvar_SetQuick (&scr_screenshot_name, "dp");
-                       break;
-       }
-
        // start up with GAMENAME by default (id1)
        strlcpy (com_modname, GAMENAME, sizeof (com_modname));
        FS_AddGameDirectory (va("%s/"GAMENAME, fs_basedir));
+       Cvar_SetQuick (&scr_screenshot_name, gamescreenshotname);
 
        // add the game-specific path, if any
        if (gamedirname[0])
@@ -1008,13 +960,19 @@ void FS_Init (void)
 
        // -game <gamedir>
        // Adds basedir/gamedir as an override game
-       i = COM_CheckParm ("-game");
-       if (i && i < com_argc-1)
+       // LordHavoc: now supports multiple -game directories
+       for (i = 1;i < com_argc;i++)
        {
-               fs_modified = true;
-               strlcpy (com_modname, com_argv[i+1], sizeof (com_modname));
-               FS_AddGameDirectory (va("%s/%s", fs_basedir, com_argv[i+1]));
-               Cvar_SetQuick (&scr_screenshot_name, com_modname);
+               if (!com_argv[i])
+                       continue;
+               if (!strcmp (com_argv[i], "-game") && i < com_argc-1)
+               {
+                       i++;
+                       fs_modified = true;
+                       strlcpy (com_modname, com_argv[i], sizeof (com_modname));
+                       FS_AddGameDirectory (va("%s/%s", fs_basedir, com_argv[i]));
+                       Cvar_SetQuick (&scr_screenshot_name, com_modname);
+               }
        }
 }