DEADSOFTWARE

nuke doom2df.cfg; refactor some cvar-related stuff
[d2df-sdl.git] / src / game / g_main.pas
index 7a9785b6964cd331222219282a1f9b4310d4605f..20419ecc0299fcfc9ae8b4fc982f8f77ff58bcf1 100644 (file)
@@ -48,6 +48,8 @@ var
   MapDownloadDirs: SSArray;
   WadDownloadDirs: SSArray;
 
+  GameWADName: string = 'GAME';
+
 implementation
 
 uses
@@ -365,6 +367,16 @@ begin
         AddDir(MapDirs, e_CatPath(rodir, 'maps'));
         AddDir(WadDirs, e_CatPath(rodir, 'wads'));
       end;
+    '--game-wad':
+      begin
+        Inc(i);
+        GameWADName := ParamStr(i);
+      end;
+    '--config':
+      begin
+        Inc(i);
+        gConfigScript := ParamStr(i);
+      end;
     end;
     Inc(i)
   end;
@@ -372,7 +384,7 @@ begin
   // prefer bin dir if it writable and contains game.wad
   if forceBinDir = false then
   begin
-    if findDiskWad(binPath + 'data' + '/' + 'GAME') <> '' then
+    if findDiskWad(binPath + 'data' + '/' + GameWADName) <> '' then
       if e_CanCreateFilesAt(binPath) then
         forceBinDir := true
   end;
@@ -431,10 +443,9 @@ begin
   {$ENDIF}
   for i := 1 to ParamCount do
   begin
-    if (ParamStr(i) = '--con-stdout') then
-    begin
-      conbufDumpToStdOut := true;
-      break
+    case ParamStr(i) of
+      '--con-stdout': conbufDumpToStdOut := true;
+      '--no-fbo': glRenderToFBO := false;
     end
   end;
 
@@ -464,13 +475,18 @@ begin
   PrintDirs('MapDownloadDirs', MapDownloadDirs);
   PrintDirs('WadDownloadDirs', WadDownloadDirs);
 
-  GameWAD := e_FindWad(DataDirs, 'GAME');
+  GameWAD := e_FindWad(DataDirs, GameWADName);
   if GameWad = '' then
   begin
-    e_WriteLog('GAME.WAD not installed?', TMsgType.Fatal);
+    e_WriteLog('WAD ' + GameWADName + ' not found in data directories.', TMsgType.Fatal);
     {$IF DEFINED(USE_SDL2) AND NOT DEFINED(HEADLESS)}
       if forceBinDir = false then
-        SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, 'Doom 2D Forever', 'GAME.WAD not installed?', nil);
+        SDL_ShowSimpleMessageBox(
+          SDL_MESSAGEBOX_ERROR, 
+          'Doom 2D Forever',
+          PChar('WAD ' + GameWADName + ' not found in data directories.'),
+          nil
+        );
     {$ENDIF}
     e_DeinitLog;
     Halt(1);
@@ -491,7 +507,6 @@ procedure Main();
 {$IFDEF ENABLE_HOLMES}
   var flexloaded: Boolean;
 {$ENDIF}
-  var s: AnsiString;
 begin
   InitPath;
   InitPrep;
@@ -500,9 +515,6 @@ begin
 
   g_Options_SetDefault;
   g_Options_SetDefaultVideo;
-  s := CONFIG_FILENAME;
-  if e_FindResource(ConfigDirs, s) = true then
-    g_Options_Read(s);
   g_Console_SysInit;
   if sys_SetDisplayMode(gRC_Width, gRC_Height, gBPP, gRC_FullScreen, gRC_Maximized) = False then
     raise Exception.Create('Failed to set videomode on startup.');