summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 994ec81)
raw | patch | inline | side by side (parent: 994ec81)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Thu, 17 Jun 2021 16:52:30 +0000 (19:52 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 29 Jun 2021 09:51:12 +0000 (12:51 +0300) |
src/engine/e_input_sdl2.inc | patch | blob | history | |
src/engine/e_input_stub.inc | patch | blob | history | |
src/engine/e_log.pas | patch | blob | history | |
src/game/Doom2DF.lpr | patch | blob | history | |
src/game/g_console.pas | patch | blob | history | |
src/game/g_game.pas | patch | blob | history | |
src/game/g_menu.pas | patch | blob | history | |
src/game/opengl/r_render.pas | [new file with mode: 0644] | patch | blob |
index d619c517456199c6232dc1a8ba50bb8ae5cfcd06..d8704f724d78c0ab7f8315bf7fef47e02c5f37d4 100644 (file)
JOY2_DOWN = JOYH_BEG + 2*e_MaxJoyHats*4 + 0*4 + HAT_DOWN;
JOY3_DOWN = JOYH_BEG + 3*e_MaxJoyHats*4 + 0*4 + HAT_DOWN;
-function e_InitInput: Boolean;
-procedure e_ReleaseInput;
+procedure e_Input_Initialize;
+procedure e_Input_Finalize;
+
procedure e_UnpressAllKeys;
procedure e_KeyUpDown (key: Integer; down: Boolean);
result := i < e_MaxJoys
end;
-function e_InitInput: Boolean;
+procedure e_Input_Initialize;
var i: Integer;
begin
for i := 0 to e_MaxJoys - 1 do
e_JoystickAvailable[i] := False;
- GenerateKeyNames;
- result := True
+ GenerateKeyNames
end;
-procedure e_ReleaseInput;
+procedure e_Input_Finalize;
var i: Integer;
begin
for i := 0 to e_MaxJoys - 1 do
index 670390a2b4c256f2ac257e35e4c972c79ee75c69..cd0cb3d03eb67b479d95a0167f3f15579ce0a66d 100644 (file)
JOY2_DOWN = JOYH_BEG + 2*e_MaxJoyHats*4 + 0*4 + HAT_DOWN;
JOY3_DOWN = JOYH_BEG + 3*e_MaxJoyHats*4 + 0*4 + HAT_DOWN;
-function e_InitInput: Boolean;
-procedure e_ReleaseInput;
+procedure e_Input_Initialize;
+procedure e_Input_Finalize;
+
procedure e_UnpressAllKeys;
procedure e_KeyUpDown (key: Integer; down: Boolean);
result := i < e_MaxJoys
end;
-function e_InitInput: Boolean;
+procedure e_Input_Initialize;
var i: Integer;
begin
for i := 0 to e_MaxJoys - 1 do
e_JoystickAvailable[i] := False;
- GenerateKeyNames;
- result := True
+ GenerateKeyNames
end;
-procedure e_ReleaseInput;
+procedure e_Input_Finalize;
var i: Integer;
begin
for i := 0 to e_MaxJoys - 1 do
diff --git a/src/engine/e_log.pas b/src/engine/e_log.pas
index 7159c18445614beaff3ba4fc3f534df33d2cf474..0dcb0986b57df31edeef14c6a45b778012daa197 100644 (file)
--- a/src/engine/e_log.pas
+++ b/src/engine/e_log.pas
interface
-uses
- SysUtils;
+ uses SysUtils;
-type
- TWriteMode = (WM_NEWFILE, WM_OLDFILE);
- TMsgType = (Fatal, Warning, Notify);
+ type
+ TWriteMode = (WM_NEWFILE, WM_OLDFILE);
+ TMsgType = (Fatal, Warning, Notify);
+ procedure e_Log_Initialize;
+ procedure e_Log_Finalize;
procedure e_InitLog (fFileName: String; fWriteMode: TWriteMode);
procedure e_DeinitLog ();
driverInited: Boolean = false;
+ procedure e_Log_Initialize;
+ begin
+ end;
+
+ procedure e_Log_Finalize;
+ begin
+ e_DeinitLog
+ end;
+
+
function DecodeIPV4 (ip: LongWord): string;
begin
Result := Format('%d.%d.%d.%d', [ip and $FF, (ip shr 8) and $FF, (ip shr 16) and $FF, (ip shr 24)]);
diff --git a/src/game/Doom2DF.lpr b/src/game/Doom2DF.lpr
index 5911994cb9576bfe00be572340c56c474ee2e3b5..268e281a029f8e05fefb378a13db5d7fd20b6117 100644 (file)
--- a/src/game/Doom2DF.lpr
+++ b/src/game/Doom2DF.lpr
r_texture in 'opengl/r_texture.pas',
r_weapons in 'opengl/r_weapons.pas',
r_window in 'opengl/r_window.pas',
+ r_render in 'opengl/r_render.pas',
{$IFDEF USE_FMOD}
fmod in '../lib/FMOD/fmod.pas',
{$R *.res}
{$ENDIF}
+ const
+ autoexecScript = 'autoexec.cfg';
+
var
noct: Boolean = False;
binPath: AnsiString = '';
Frame: Int64;
flag: Boolean = false;
+ NoSound: Boolean;
+
procedure Update ();
begin
// remember old mobj positions, prepare for update
if NetMode = NET_SERVER then g_Net_Flush();
end;
-procedure Init();
-var
- NoSound: Boolean;
-begin
- Randomize;
-
-{$IFDEF HEADLESS}
- {$IFDEF USE_SDLMIXER}
- NoSound := False; // hope env has set SDL_AUDIODRIVER to dummy
- {$ELSE}
- NoSound := True; // FMOD backend will sort it out
- {$ENDIF}
-{$ELSE}
- NoSound := False;
-{$ENDIF}
-
- g_Touch_Init;
-
-(*
- if (e_JoysticksAvailable > 0) then
- e_WriteLog('Input: Joysticks available.', TMsgType.Notify)
- else
- e_WriteLog('Input: No Joysticks.', TMsgType.Notify);
-*)
-
- if (not gNoSound) then
- begin
- e_WriteLog('Initializing sound system', TMsgType.Notify);
- e_InitSoundSystem(NoSound);
- end;
-
- e_WriteLog('Init game', TMsgType.Notify);
- g_Game_Init();
-
-// FillChar(charbuff, sizeof(charbuff), ' ');
-end;
-
-procedure Release();
-begin
- e_WriteLog('Releasing engine', TMsgType.Notify);
- e_ReleaseEngine();
-
- e_WriteLog('Releasing input', TMsgType.Notify);
- e_ReleaseInput();
-
- if not gNoSound then
- begin
- e_WriteLog('Releasing sound', TMsgType.Notify);
- e_ReleaseSoundSystem();
- end;
-end;
-
function ProcessMessage (): Boolean;
var
i, t: Integer;
e_SoundUpdate();
end;
-
-function SDLMain (): Integer;
+procedure DebugOptions;
var
idx: Integer;
arg: AnsiString;
valres: Word;
{$ENDIF}
begin
-
idx := 1;
while (idx <= ParamCount) do
begin
end;
end;
end;
-
- r_Window_Initialize;
-
- Init;
- Time_Old := sys_GetTicks();
-
- g_Net_InitLowLevel();
-
- // game commad line
- if (ParamCount > 0) then g_Game_Process_Params();
-
-{$IFNDEF HEADLESS}
- if (not gGameOn) and gAskLanguage then g_Menu_AskLanguage();
-{$ENDIF}
-
- e_WriteLog('Entering the main loop', TMsgType.Notify);
-
- // main loop
- while not ProcessMessage() do begin end;
-
- g_Net_Slist_ShutdownAll();
-
- Release();
-
- g_Net_DeinitLowLevel();
- result := 0;
end;
function GetBinaryPath (): AnsiString;
AddDir(AllMapDirs, MegawadDirs[i]);
OptimizeDirs(AllMapDirs);
- if LogFileName = '' then
- begin
- rwdir := e_GetWriteableDir(LogDirs, false);
- if rwdir <> '' then
- begin
- {$IFDEF HEADLESS}
- LogFileName := e_CatPath(rwdir, 'Doom2DF_H.log');
- {$ELSE}
- LogFileName := e_CatPath(rwdir, 'Doom2DF.log');
- {$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;
- {$IF DEFINED(ANDROID) AND DEFINED(USE_SDLMIXER)}
- var timiditycfg: AnsiString;
- {$ENDIF}
- var i: Integer;
-begin
- {$IFDEF HEADLESS}
- conbufDumpToStdOut := true;
- {$ENDIF}
- for i := 1 to ParamCount do
+ procedure EntryParams;
+ var i: Integer;
begin
- case ParamStr(i) of
- '--con-stdout': conbufDumpToStdOut := true;
- '--no-fbo': glRenderToFBO := false;
+ i := 1;
+ while i <= ParamCount do
+ begin
+ case ParamStr(i) of
+ '--gdb': noct := true;
+ '--log', '--con-stdout': conbufDumpToStdOut := true;
+ '--safe-log': e_SetSafeSlowLog(true);
+ '--log-file':
+ if i + 1 <= ParamCount then
+ begin
+ Inc(i);
+ LogFileName := ParamStr(i)
+ end;
+ '--no-fbo': glRenderToFBO := false;
+ end;
+ Inc(i)
end
end;
- if LogFileName <> '' then
- e_InitLog(LogFileName, TWriteMode.WM_NEWFILE);
- 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);
-
- PrintDirs('DataDirs', DataDirs);
- PrintDirs('ModelDirs', ModelDirs);
- PrintDirs('MegawadDirs', MegawadDirs);
- PrintDirs('MapDirs', MapDirs);
- PrintDirs('WadDirs', WadDirs);
-
- PrintDirs('LogDirs', LogDirs);
- PrintDirs('SaveDirs', SaveDirs);
- PrintDirs('CacheDirs', CacheDirs);
- PrintDirs('ConfigDirs', ConfigDirs);
- PrintDirs('ScreenshotDirs', ScreenshotDirs);
- PrintDirs('StatsDirs', StatsDirs);
- PrintDirs('MapDownloadDirs', MapDownloadDirs);
- PrintDirs('WadDownloadDirs', WadDownloadDirs);
-
- GameWAD := e_FindWad(DataDirs, GameWADName);
- if GameWad = '' then
+ procedure InitLog;
+ var rwdir: AnsiString;
begin
- 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',
- PChar('WAD ' + GameWADName + ' not found in data directories.'),
- nil
- );
- {$ENDIF}
- e_DeinitLog;
- Halt(1);
- end;
-
- {$IF DEFINED(ANDROID) AND DEFINED(USE_SDLMIXER)}
- timiditycfg := 'timidity.cfg';
- if e_FindResource(ConfigDirs, timiditycfg) = true then
+ if LogFileName = '' then
begin
- timiditycfg := ExpandFileName(timiditycfg);
- SetEnvVar('TIMIDITY_CFG', timiditycfg);
- e_LogWritefln('Set TIMIDITY_CFG = "%s"', [timiditycfg]);
+ rwdir := e_GetWriteableDir(LogDirs, false);
+ if rwdir <> '' then
+ begin
+ {$IFDEF HEADLESS}
+ LogFileName := e_CatPath(rwdir, 'Doom2DF_H.log');
+ {$ELSE}
+ LogFileName := e_CatPath(rwdir, 'Doom2DF.log');
+ {$ENDIF}
+ end
end;
- {$ENDIF}
-end;
-
-procedure Main;
-{$IFDEF ENABLE_HOLMES}
- var flexloaded: Boolean;
-{$ENDIF}
-begin
- InitPath;
- InitPrep;
- e_InitInput;
- sys_Init;
+ if LogFileName <> '' then
+ e_InitLog(LogFileName, TWriteMode.WM_NEWFILE);
+ e_InitWritelnDriver
+ end;
- sys_CharPress := @CharPress;
+ procedure InitPrep;
+ {$IF DEFINED(ANDROID) AND DEFINED(USE_SDLMIXER)}
+ var timiditycfg: AnsiString;
+ {$ENDIF}
+ begin
+ 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);
+
+ PrintDirs('DataDirs', DataDirs);
+ PrintDirs('ModelDirs', ModelDirs);
+ PrintDirs('MegawadDirs', MegawadDirs);
+ PrintDirs('MapDirs', MapDirs);
+ PrintDirs('WadDirs', WadDirs);
+
+ PrintDirs('LogDirs', LogDirs);
+ PrintDirs('SaveDirs', SaveDirs);
+ PrintDirs('CacheDirs', CacheDirs);
+ PrintDirs('ConfigDirs', ConfigDirs);
+ PrintDirs('ScreenshotDirs', ScreenshotDirs);
+ PrintDirs('StatsDirs', StatsDirs);
+ PrintDirs('MapDownloadDirs', MapDownloadDirs);
+ PrintDirs('WadDownloadDirs', WadDownloadDirs);
+
+ {$IFDEF HEADLESS}
+ {$IFDEF USE_SDLMIXER}
+ NoSound := False; // hope env has set SDL_AUDIODRIVER to dummy
+ {$ELSE}
+ NoSound := True; // FMOD backend will sort it out
+ {$ENDIF}
+ {$ELSE}
+ NoSound := False;
+ {$ENDIF}
- g_Options_SetDefault;
- g_Options_SetDefaultVideo;
- 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.');
+ {$IF DEFINED(ANDROID) AND DEFINED(USE_SDLMIXER)}
+ timiditycfg := 'timidity.cfg';
+ if e_FindResource(ConfigDirs, timiditycfg) = true then
+ begin
+ timiditycfg := ExpandFileName(timiditycfg);
+ SetEnvVar('TIMIDITY_CFG', timiditycfg);
+ e_LogWritefln('Set TIMIDITY_CFG = "%s"', [timiditycfg]);
+ end;
+ {$ENDIF}
- e_WriteLog(gLanguage, TMsgType.Notify);
- g_Language_Set(gLanguage);
+ GameWAD := e_FindWad(DataDirs, GameWADName);
+ if GameWad = '' then
+ begin
+ 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',
+ PChar('WAD ' + GameWADName + ' not found in data directories.'),
+ nil
+ );
+ {$ENDIF}
+ e_DeinitLog;
+ Halt(1);
+ end
+ end;
-{$IF not DEFINED(HEADLESS) and DEFINED(ENABLE_HOLMES)}
- flexloaded := true;
- if not fuiAddWad('flexui.wad') then
+{$IFDEF ENABLE_HOLMES}
+ procedure InitHolmes;
+ var flexloaded: Boolean;
begin
- if not fuiAddWad('./data/flexui.wad') then fuiAddWad('./flexui.wad');
- end;
- try
- fuiGfxLoadFont('win8', 'flexui/fonts/win8.fuifont');
- fuiGfxLoadFont('win14', 'flexui/fonts/win14.fuifont');
- fuiGfxLoadFont('win16', 'flexui/fonts/win16.fuifont');
- fuiGfxLoadFont('dos8', 'flexui/fonts/dos8.fuifont');
- fuiGfxLoadFont('msx6', 'flexui/fonts/msx6.fuifont');
- except on e: Exception do
- begin
- writeln('ERROR loading FlexUI fonts');
- flexloaded := false;
- //raise;
- end;
- else
+ flexloaded := true;
+ if not fuiAddWad('flexui.wad') then
begin
- flexloaded := false;
- //raise;
+ if not fuiAddWad('./data/flexui.wad') then fuiAddWad('./flexui.wad');
end;
- end;
- if (flexloaded) then
- begin
try
- e_LogWriteln('FlexUI: loading stylesheet...');
- uiLoadStyles('flexui/widgets.wgs');
- except on e: TParserException do
+ fuiGfxLoadFont('win8', 'flexui/fonts/win8.fuifont');
+ fuiGfxLoadFont('win14', 'flexui/fonts/win14.fuifont');
+ fuiGfxLoadFont('win16', 'flexui/fonts/win16.fuifont');
+ fuiGfxLoadFont('dos8', 'flexui/fonts/dos8.fuifont');
+ fuiGfxLoadFont('msx6', 'flexui/fonts/msx6.fuifont');
+ except on e: Exception do
begin
- writeln('ERROR at (', e.tokLine, ',', e.tokCol, '): ', e.message);
- //raise;
+ writeln('ERROR loading FlexUI fonts');
flexloaded := false;
+ //raise;
end;
else
begin
- //raise;
flexloaded := false;
+ //raise;
end;
end;
+ if flexloaded then
+ begin
+ try
+ e_LogWriteln('FlexUI: loading stylesheet...');
+ uiLoadStyles('flexui/widgets.wgs');
+ except on e: TParserException do
+ begin
+ writeln('ERROR at (', e.tokLine, ',', e.tokCol, '): ', e.message);
+ //raise;
+ flexloaded := false;
+ end;
+ else
+ begin
+ //raise;
+ flexloaded := false;
+ end;
+ end;
+ end;
+ g_holmes_imfunctional := not flexloaded;
+ if not g_holmes_imfunctional then
+ begin
+ uiInitialize();
+ uiContext.font := 'win14';
+ end;
+ if assigned(oglInitCB) then oglInitCB;
end;
- g_holmes_imfunctional := not flexloaded;
- if (not g_holmes_imfunctional) then
+ procedure FreeHolmes;
begin
- uiInitialize();
- uiContext.font := 'win14';
+ if assigned(oglDeinitCB) then
+ oglDeinitCB
end;
-
- if assigned(oglInitCB) then oglInitCB;
{$ENDIF}
- //g_Res_CreateDatabases(true); // it will be done before connecting to the server for the first time
-
- e_WriteLog('Entering SDLMain', TMsgType.Notify);
-
- {$WARNINGS OFF}
- SDLMain();
- {$WARNINGS ON}
-
- {$IFDEF ENABLE_HOLMES}
- if assigned(oglDeinitCB) then oglDeinitCB;
- {$ENDIF}
-
- g_Console_WriteGameConfig;
- sys_Final;
-end;
-
-
-procedure EntryParams;
- var f: Integer;
-begin
- f := 1;
- while f <= ParamCount do
+ procedure Startup;
begin
- case ParamStr(f) of
- '--gdb': noct := true;
- '--log': conbufDumpToStdOut := true;
- '--safe-log': e_SetSafeSlowLog(true);
- '--log-file':
- if f + 1 <= ParamCount then
- begin
- Inc(f);
- LogFileName := ParamStr(f)
- end
- end;
- Inc(f)
- end
-end;
-
-procedure EntryPoint;
-begin
- SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); //k8: fuck off, that's why
- EntryParams;
- if noct then
- Main
- else
- try
- Main;
+ Randomize;
+ InitPath;
+ InitLog;
+ InitPrep;
+ e_Input_Initialize;
+ e_InitSoundSystem(NoSound);
+ sys_Init;
+ sys_CharPress := @CharPress; (* install hook *)
+ g_Options_SetDefault;
+ g_Options_SetDefaultVideo;
+ g_Console_Initialize;
+ // TODO move load configs here
+ g_Language_Set(gLanguage);
+ r_Render_Initialize;
+ g_Touch_Init;
+ DebugOptions;
+ g_Net_InitLowLevel;
+ // TODO init serverlist
+ {$IFDEF ENABLE_HOLMES}
+ InitHolmes;
+ {$ENDIF}
+ g_Game_Init;
+ {$IFNDEF HEADLESS}
+ g_Menu_Init;
+ g_GUI_Init;
+ {$ENDIF}
+ g_Game_Process_Params;
+ // TODO reload GAME textures
+ g_Console_Init; // welcome message
+ {$IFNDEF HEADLESS}
+ if (not gGameOn) and gAskLanguage then
+ g_Menu_AskLanguage;
+ {$ENDIF}
+ Time_Old := sys_GetTicks();
+ while not ProcessMessage() do begin end;
+ g_Console_WriteGameConfig;
+ {$IFNDEF HEADLESS}
+ g_GUI_Destroy;
+ g_Menu_Free;
+ {$ENDIF}
+ {$IFDEF ENABLE_HOLMES}
+ FreeHolmes;
+ {$ENDIF}
+ g_Net_Slist_ShutdownAll;
+ g_Net_DeinitLowLevel;
+ (* g_Touch_Finalize; *)
+ r_Render_Finalize;
+ sys_Final;
+ g_Console_Finalize;
+ e_ReleaseSoundSystem;
+ e_Input_Finalize;
e_WriteLog('Shutdown with no errors.', TMsgType.Notify)
- except on e: Exception do
- e_WriteStackTrace(e.message)
- else
- e_WriteStackTrace('FATAL ERROR')
end;
- e_DeinitLog;
-end;
+ procedure EntryPoint;
+ begin
+ SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); //k8: fuck off, that's why
+ EntryParams;
+ e_Log_Initialize;
+ {$IFDEF HEADLESS}
+ conbufDumpToStdOut := true;
+ {$ENDIF}
+ if noct then
+ Startup
+ else
+ try
+ Startup
+ except on e: Exception do
+ e_WriteStackTrace(e.message)
+ else
+ e_WriteStackTrace('FATAL ERROR')
+ end;
+ e_Log_Finalize
+ end;
{$IFDEF ANDROID}
function SDL_main (argc: CInt; argv: PPChar): CInt; cdecl;
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index 02beb87ee76fc14509f2d5253f9c666a59d70972..feef35d638ad944f7b4352d12f11d24a0daa440b 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
end;
procedure g_Console_Init;
-procedure g_Console_SysInit;
+procedure g_Console_Initialize;
+procedure g_Console_Finalize;
procedure g_Console_Update;
procedure g_Console_Char (C: AnsiChar);
procedure g_Console_Control (K: Word);
g_menu, g_gui, g_language, g_net, g_netmsg, e_log, conbuf;
const
- autoexecScript = 'autoexec.cfg';
configComment = 'generated by doom2d, do not modify';
type
end
end;
-procedure g_Console_SysInit;
+procedure g_Console_Initialize;
var a: Integer;
begin
gConsoleShow := False;
g_Console_ResetBinds;
g_Console_ReadConfig(gConfigScript);
- g_Console_ReadConfig(autoexecScript);
+// g_Console_ReadConfig(autoexecScript);
+ g_Console_ReadConfig('autoexec.cfg');
+
gParsingBinds := False;
end;
+procedure g_Console_Finalize;
+begin
+
+end;
+
procedure g_Console_Init;
begin
g_Console_Add(Format(_lc[I_CONSOLE_WELCOME], [GAME_VERSION]));
procedure g_Console_BindKey (key: Integer; down: AnsiString; up: AnsiString = '');
begin
- //e_LogWritefln('bind "%s" "%s" <%s>', [LowerCase(e_KeyNames[key]), cmd, key]);
+ // e_LogWritefln('bind "%s" "%s" "%s" <%s>', [LowerCase(e_KeyNames[key]), down, up, key]);
ASSERT(key >= 0);
ASSERT(key < e_MaxInputKeys);
if key > 0 then
end;
begin
+ // e_LogWritefln('g_Console_WriteConfig: %s', [filename]);
AssignFile(f, filename);
Rewrite(f);
WriteLn(f, '// ' + configComment);
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index f7aed54523e41c6a4f133426fdd73404165a2746..af3d8ad0c99ffcdd01002045a44084cde72561c2 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
g_Game_SetLoadingText(Format('Doom 2D: Forever %s', [GAME_VERSION]), 0, False);
g_Game_SetLoadingText('', 0, False);
- g_Game_SetLoadingText(_lc[I_LOAD_CONSOLE], 0, False);
- r_Console_Init;
- g_Console_Init();
-
g_Game_SetLoadingText(_lc[I_LOAD_MODELS], 0, False);
- r_PlayerModel_Initialize;
-
// load models from all possible wad types, in all known directories
// this does a loosy job (linear search, ooph!), but meh
for wext in wadExtensions do
g_Sound_CreateWADEx('MUSIC_ROUNDMUS', GameWAD+':MUSIC\ROUNDMUS', True, True);
g_Sound_CreateWADEx('MUSIC_STDENDMUS', GameWAD+':MUSIC\ENDMUS', True);
-{$IFNDEF HEADLESS}
- g_Game_SetLoadingText(_lc[I_LOAD_MENUS], 0, False);
- g_Menu_Init();
-{$ENDIF}
-
gMusic := TMusic.Create();
gMusic.SetByName('MUSIC_MENU');
gMusic.Play();
g_Game_StopAllSounds(True);
gMusic.Free();
g_Game_FreeData();
- r_PlayerModel_Finalize;
g_PlayerModel_FreeData();
g_Texture_DeleteAll();
g_Frames_DeleteAll();
diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas
index 4d20921eee5eb0797cfb7134f6ac43004e850e74..c4d9b38b19b31af46dcc521461e232675f1ac8a2 100644 (file)
--- a/src/game/g_menu.pas
+++ b/src/game/g_menu.pas
procedure g_Menu_Init();
begin
MenuLoadData();
- g_GUI_Init();
CreateAllMenus();
end;
procedure g_Menu_Free();
begin
- g_GUI_Destroy();
-
- e_WriteLog('Releasing menu data...', TMsgType.Notify);
-
MenuFreeData();
end;
diff --git a/src/game/opengl/r_render.pas b/src/game/opengl/r_render.pas
--- /dev/null
@@ -0,0 +1,43 @@
+(* Copyright (C) Doom 2D: Forever Developers
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3 of the License ONLY.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *)
+{$INCLUDE ../../shared/a_modes.inc}
+unit r_render;
+
+interface
+
+ procedure r_Render_Initialize;
+ procedure r_Render_Finalize;
+
+implementation
+
+ uses SysUtils, Classes, g_system, g_game, g_options, r_window, r_graphics, r_console, r_playermodel;
+
+ procedure r_Render_Initialize;
+ begin
+ if sys_SetDisplayMode(gRC_Width, gRC_Height, gBPP, gRC_FullScreen, gRC_Maximized) = False then
+ raise Exception.Create('Failed to set videomode on startup.');
+
+ r_Window_Initialize;
+ r_Console_Init;
+ r_PlayerModel_Initialize;
+ end;
+
+ procedure r_Render_Finalize;
+ begin
+ r_PlayerModel_Finalize;
+ e_ReleaseEngine
+ end;
+
+end.