X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_main.pas;h=6e393b262f29152ce225cb4698b108970389a58f;hb=c6af190b41328f2516b793553867cd514d14f330;hp=9fadc1beddc6e0c68f2e36ae6ecb39f3e0693985;hpb=b4b66ea803f8d896c2b2abd75108ef233030da03;p=d2df-sdl.git diff --git a/src/game/g_main.pas b/src/game/g_main.pas index 9fadc1b..6e393b2 100644 --- a/src/game/g_main.pas +++ b/src/game/g_main.pas @@ -44,9 +44,12 @@ var CacheDirs: SSArray; ConfigDirs: SSArray; ScreenshotDirs: SSArray; + StatsDirs: SSArray; MapDownloadDirs: SSArray; WadDownloadDirs: SSArray; + GameWADName: string = 'GAME'; + implementation uses @@ -345,6 +348,7 @@ begin AddDir(MapDownloadDirs, e_CatPath(rwdir, 'maps/downloads')); AddDir(WadDownloadDirs, e_CatPath(rwdir, 'wads/downloads')); AddDir(ScreenshotDirs, e_CatPath(rwdir, 'screenshots')); + AddDir(StatsDirs, e_CatPath(rwdir, 'stats')); (* RO *) AddDir(DataDirs, e_CatPath(rwdir, 'data')); AddDir(ModelDirs, e_CatPath(rwdir, 'data/models')); @@ -363,6 +367,11 @@ begin AddDir(MapDirs, e_CatPath(rodir, 'maps')); AddDir(WadDirs, e_CatPath(rodir, 'wads')); end; + '--game-wad': + begin + Inc(i); + GameWADName := ParamStr(i); + end; end; Inc(i) end; @@ -370,7 +379,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; @@ -392,6 +401,7 @@ begin AddDef(MapDownloadDirs, rwdirs, 'maps/downloads'); AddDef(WadDownloadDirs, rwdirs, 'wads/downloads'); AddDef(ScreenshotDirs, rwdirs, 'screenshots'); + AddDef(StatsDirs, rwdirs, 'stats'); for i := 0 to High(MapDirs) do AddDir(AllMapDirs, MapDirs[i]); @@ -411,6 +421,10 @@ begin {$ENDIF} end end; + + // HACK: ensure the screenshots folder also has a stats subfolder in it + rwdir := e_GetWriteableDir(ScreenshotDirs, false); + if rwdir <> '' then CreateDir(rwdir + '/stats'); end; procedure InitPrep; @@ -436,6 +450,8 @@ begin e_InitWritelnDriver(); e_WriteLog('Doom 2D: Forever version ' + GAME_VERSION + ' proto ' + IntToStr(NET_PROTOCOL_VER), TMsgType.Notify); e_WriteLog('Build date: ' + GAME_BUILDDATE + ' ' + GAME_BUILDTIME, TMsgType.Notify); + e_WriteLog('Build hash: ' + g_GetBuildHash(), TMsgType.Notify); + e_WriteLog('Build by: ' + g_GetBuilderName(), TMsgType.Notify); e_LogWritefln('Force bin dir: %s', [forceBinDir], TMsgType.Notify); e_LogWritefln('BINARY PATH: [%s]', [binPath], TMsgType.Notify); @@ -451,16 +467,22 @@ begin PrintDirs('CacheDirs', CacheDirs); PrintDirs('ConfigDirs', ConfigDirs); PrintDirs('ScreenshotDirs', ScreenshotDirs); + PrintDirs('StatsDirs', StatsDirs); 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); @@ -488,20 +510,15 @@ begin e_InitInput; sys_Init; + g_Options_SetDefault; + g_Options_SetDefaultVideo; s := CONFIG_FILENAME; if e_FindResource(ConfigDirs, s) = true then - begin - g_Options_Read(s) - end - else - begin - g_Options_SetDefault; - g_Options_SetDefaultVideo - end; - if sys_SetDisplayMode(gScreenWidth, gScreenHeight, gBPP, gFullScreen) = False 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.'); - g_Console_SysInit; e_WriteLog(gLanguage, TMsgType.Notify); g_Language_Set(gLanguage); @@ -570,6 +587,7 @@ begin if assigned(oglDeinitCB) then oglDeinitCB; {$ENDIF} + g_Console_WriteGameConfig; sys_Final; end;