1 (* Copyright (C) DooM 2D:Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 {$INCLUDE ../shared/a_modes.inc}
24 function SDLMain(): Integer;
25 function GetTimer(): Int64;
26 procedure ResetTimer();
27 function CreateGLWindow(Title
: PChar): Boolean;
28 procedure KillGLWindow();
29 procedure PushExitEvent();
30 function ProcessMessage(): Boolean;
31 procedure ProcessLoading (forceUpdate
: Boolean=false);
32 procedure ReDrawWindow();
33 procedure SwapBuffers();
34 procedure Sleep(ms
: LongWord);
35 function GetDisplayModes(dBPP
: DWORD
; var SelRes
: DWORD
): SArray
;
36 function g_Window_SetDisplay(PreserveGL
: Boolean = False): Boolean;
37 function g_Window_SetSize(W
, H
: Word; FScreen
: Boolean): Boolean;
40 gwin_dump_extensions
: Boolean = false;
41 gwin_has_stencil
: Boolean = false;
42 gwin_k8_enable_light_experiments
: Boolean = false;
43 g_dbg_aimline_on
: Boolean = false;
49 {$IFDEF WINDOWS}Windows
,{$ENDIF}
50 SysUtils
, Classes
, MAPDEF
,
51 SDL2
, GL
, GLExt
, e_graphics
, e_log
, e_texture
, g_main
,
52 g_console
, e_input
, g_options
, g_game
,
53 g_basic
, g_textures
, e_sound
, g_sound
, g_menu
, ENet
, g_net
,
54 g_map
, g_gfx
, g_monsters
, g_holmes
, xprofiler
, utils
;
60 Time
, Time_Delta
, Time_Old
: Int64;
63 wNeedTimeReset
: Boolean = False;
64 //wWindowCreated: Boolean = False;
65 //wCursorShown: Boolean = False;
66 wMinimized
: Boolean = False;
67 //wNeedFree: Boolean = True;
68 wLoadingProgress
: Boolean = False;
69 wLoadingQuit
: Boolean = False;
70 {wWinPause: Byte = 0;}
72 ticksOverflow
: Int64 = -1;
73 lastTicks
: Uint32
= 0; // to detect overflow
75 curMsButState
: Word = 0;
80 function g_Window_SetDisplay(PreserveGL
: Boolean = False): Boolean;
82 mode
, cmode
: TSDL_DisplayMode
;
91 e_WriteLog('Setting display mode...', MSG_NOTIFY
);
93 wFlags
:= SDL_WINDOW_OPENGL
or SDL_WINDOW_RESIZABLE
;
94 if gFullscreen
then wFlags
:= wFlags
or SDL_WINDOW_FULLSCREEN
;
95 if gWinMaximized
then wFlags
:= wFlags
or SDL_WINDOW_MAXIMIZED
;
99 SDL_DestroyWindow(h_Wnd
);
105 mode
.w
:= gScreenWidth
;
106 mode
.h
:= gScreenHeight
;
108 mode
.refresh_rate
:= 0;
109 mode
.driverdata
:= nil;
110 if SDL_GetClosestDisplayMode(0, @mode
, @cmode
) = nil then
113 gScreenHeight
:= 600;
117 gScreenWidth
:= cmode
.w
;
118 gScreenHeight
:= cmode
.h
;
122 h_Wnd
:= SDL_CreateWindow(PChar(wTitle
), gWinRealPosX
, gWinRealPosY
, gScreenWidth
, gScreenHeight
, wFlags
);
123 if h_Wnd
= nil then Exit
;
125 SDL_GL_MakeCurrent(h_Wnd
, h_GL
);
126 SDL_ShowCursor(SDL_DISABLE
);
131 procedure ReShowCursor();
133 // TODO: what was this for?
136 function GetDisplayModes(dBPP
: DWORD
; var SelRes
: DWORD
): SArray
;
138 mode
: TSDL_DisplayMode
;
139 res
, i
, k
, n
, pw
, ph
: Integer;
141 SetLength(Result
, 0);
142 {$IFDEF HEADLESS}Exit
;{$ENDIF}
144 n
:= SDL_GetNumDisplayModes(0);
148 res
:= SDL_GetDisplayMode(0, i
, @mode
);
149 if res
< 0 then continue
;
150 if SDL_BITSPERPIXEL(mode
.format
) = gBPP
then continue
;
151 if (mode
.w
= pw
) and (mode
.h
= ph
) then continue
;
152 if (mode
.w
= gScreenWidth
) and (mode
.h
= gScreenHeight
) then
155 SetLength(Result
, k
);
156 Result
[k
-1] := IntToStr(mode
.w
) + 'x' + IntToStr(mode
.h
);
157 pw
:= mode
.w
; ph
:= mode
.h
160 e_WriteLog('SDL: Got ' + IntToStr(k
) + ' resolutions.', MSG_NOTIFY
);
163 procedure Sleep(ms
: LongWord);
168 procedure ChangeWindowSize();
170 gWinSizeX
:= gScreenWidth
;
171 gWinSizeY
:= gScreenHeight
;
172 {$IFDEF HEADLESS}Exit
;{$ENDIF}
173 e_ResizeWindow(gScreenWidth
, gScreenHeight
);
174 g_Game_SetupScreenSize();
176 g_Game_ClearLoading();
177 g_Holmes_VidModeChanged();
180 function g_Window_SetSize(W
, H
: Word; FScreen
: Boolean): Boolean;
185 {$IFDEF HEADLESS}Exit
;{$ENDIF}
188 if (gScreenWidth
<> W
) or (gScreenHeight
<> H
) then
195 if gFullscreen
<> FScreen
then
198 gFullscreen
:= FScreen
;
204 g_Window_SetDisplay(Preserve
);
209 function WindowEventHandler(ev
: TSDL_WindowEvent
): Boolean;
211 wActivate
, wDeactivate
: Boolean;
215 wDeactivate
:= False;
218 SDL_WINDOWEVENT_MOVED
:
220 if not (gFullscreen
or gWinMaximized
) then
222 gWinRealPosX
:= ev
.data1
;
223 gWinRealPosY
:= ev
.data2
;
227 SDL_WINDOWEVENT_MINIMIZED
:
232 if not wMinimized
then
234 e_ResizeWindow(0, 0);
237 if g_debug_WinMsgs
then
239 g_Console_Add('Now minimized');
240 e_WriteLog('[DEBUG] WinMsgs: Now minimized', MSG_NOTIFY
);
246 SDL_WINDOWEVENT_RESIZED
:
250 gScreenWidth
:= ev
.data1
;
251 gScreenHeight
:= ev
.data2
;
254 if g_debug_WinMsgs
then
256 g_Console_Add('Resized to ' + IntToStr(ev
.data1
) + 'x' + IntToStr(ev
.data2
));
257 e_WriteLog('[DEBUG] WinMsgs: Resized to ' + IntToStr(ev
.data1
) + 'x' + IntToStr(ev
.data2
), MSG_NOTIFY
);
261 SDL_WINDOWEVENT_EXPOSED
:
264 SDL_WINDOWEVENT_MAXIMIZED
:
270 e_ResizeWindow(gScreenWidth
, gScreenHeight
);
274 if not gWinMaximized
then
276 gWinMaximized
:= True;
277 if g_debug_WinMsgs
then
279 g_Console_Add('Now maximized');
280 e_WriteLog('[DEBUG] WinMsgs: Now maximized', MSG_NOTIFY
);
285 SDL_WINDOWEVENT_RESTORED
:
291 e_ResizeWindow(gScreenWidth
, gScreenHeight
);
295 if gWinMaximized
then
296 gWinMaximized
:= False;
297 if g_debug_WinMsgs
then
299 g_Console_Add('Now restored');
300 e_WriteLog('[DEBUG] WinMsgs: Now restored', MSG_NOTIFY
);
304 SDL_WINDOWEVENT_FOCUS_GAINED
:
309 //e_WriteLog('window gained focus!', MSG_NOTIFY);
310 g_Holmes_WindowFocused();
313 SDL_WINDOWEVENT_FOCUS_LOST
:
319 //e_WriteLog('window lost focus!', MSG_NOTIFY);
320 g_Holmes_WindowBlured();
328 e_WriteLog('deactivating window', MSG_NOTIFY
);
329 e_EnableInput
:= False;
330 e_ClearInputBuffer();
332 if gMuteWhenInactive
then
334 //e_WriteLog('deactivating sounds', MSG_NOTIFY);
335 e_MuteChannels(True);
338 if g_debug_WinMsgs
then
340 g_Console_Add('Now inactive');
341 e_WriteLog('[DEBUG] WinMsgs: Now inactive', MSG_NOTIFY
);
347 else if wActivate
then
349 if not gWinActive
then
351 //e_WriteLog('activating window', MSG_NOTIFY);
352 e_EnableInput
:= True;
354 if gMuteWhenInactive
then
356 //e_WriteLog('activating sounds', MSG_NOTIFY);
357 e_MuteChannels(False);
360 if g_debug_WinMsgs
then
362 g_Console_Add('Now active');
363 e_WriteLog('[DEBUG] WinMsgs: Now active', MSG_NOTIFY
);
371 function EventHandler(ev
: TSDL_Event
): Boolean;
379 function buildBut (b
: Byte): Word;
383 SDL_BUTTON_LEFT
: result
:= result
or THMouseEvent
.Left
;
384 SDL_BUTTON_MIDDLE
: result
:= result
or THMouseEvent
.Middle
;
385 SDL_BUTTON_RIGHT
: result
:= result
or THMouseEvent
.Right
;
389 procedure updateKBState ();
394 kbstate
:= SDL_GetKeyboardState(nil);
395 if (kbstate
[SDL_SCANCODE_LCTRL
] <> 0) or (kbstate
[SDL_SCANCODE_RCTRL
] <> 0) then curKbState
:= curKbState
or THKeyEvent
.ModCtrl
;
396 if (kbstate
[SDL_SCANCODE_LALT
] <> 0) or (kbstate
[SDL_SCANCODE_RALT
] <> 0) then curKbState
:= curKbState
or THKeyEvent
.ModAlt
;
397 if (kbstate
[SDL_SCANCODE_LSHIFT
] <> 0) or (kbstate
[SDL_SCANCODE_RSHIFT
] <> 0) then curKbState
:= curKbState
or THKeyEvent
.ModShift
;
406 Result
:= WindowEventHandler(ev
.window
);
410 if gExit
<> EXIT_QUIT
then
412 if not wLoadingProgress
then
418 wLoadingQuit
:= True;
423 SDL_KEYDOWN
, SDL_KEYUP
:
425 key
:= ev
.key
.keysym
.scancode
;
426 if (g_holmes_enabled
) then
428 if (ev
.type_
= SDL_KEYDOWN
) then kbev
.kind
:= THKeyEvent
.Press
else kbev
.kind
:= THKeyEvent
.Release
;
429 kbev
.scan
:= ev
.key
.keysym
.scancode
;
430 kbev
.sym
:= ev
.key
.keysym
.sym
;
431 kbev
.bstate
:= curMsButState
;
432 kbev
.kstate
:= curKbState
;
433 {$IF not DEFINED(HEADLESS)}
434 if g_Holmes_keyEvent(kbev
) then
436 if (ev
.type_
<> SDL_KEYDOWN
) then e_KeyUpDown(ev
.key
.keysym
.scancode
, false);
441 if (ev
.type_
= SDL_KEYDOWN
) then KeyPress(key
);
442 e_KeyUpDown(ev
.key
.keysym
.scancode
, (ev
.type_
= SDL_KEYDOWN
));
445 {$IF not DEFINED(HEADLESS)}
446 SDL_MOUSEBUTTONDOWN
, SDL_MOUSEBUTTONUP
:
448 msev
.dx
:= ev
.button
.x
-curMsX
;
449 msev
.dy
:= ev
.button
.y
-curMsY
;
450 curMsX
:= ev
.button
.x
;
451 curMsY
:= ev
.button
.y
;
452 if (ev
.type_
= SDL_MOUSEBUTTONDOWN
) then msev
.kind
:= THMouseEvent
.Press
else msev
.kind
:= THMouseEvent
.Release
;
453 msev
.but
:= buildBut(ev
.button
.button
);
456 if (msev
.but
<> 0) then
458 // ev.button.clicks: Byte
459 if (ev
.type_
= SDL_MOUSEBUTTONDOWN
) then curMsButState
:= curMsButState
or msev
.but
else curMsButState
:= curMsButState
and (not msev
.but
);
460 msev
.bstate
:= curMsButState
;
461 msev
.kstate
:= curKbState
;
462 if (g_holmes_enabled
) then g_Holmes_mouseEvent(msev
);
467 if (ev
.wheel
.y
<> 0) then
470 msev
.dy
:= ev
.wheel
.y
;
471 msev
.kind
:= THMouseEvent
.Press
;
472 if (ev
.wheel
.y
< 0) then msev
.but
:= THMouseEvent
.WheelUp
else msev
.but
:= THMouseEvent
.WheelDown
;
475 msev
.bstate
:= curMsButState
;
476 msev
.kstate
:= curKbState
;
477 if (g_holmes_enabled
) then g_Holmes_mouseEvent(msev
);
482 msev
.dx
:= ev
.button
.x
-curMsX
;
483 msev
.dy
:= ev
.button
.y
-curMsY
;
484 curMsX
:= ev
.button
.x
;
485 curMsY
:= ev
.button
.y
;
486 msev
.kind
:= THMouseEvent
.Motion
;
490 msev
.bstate
:= curMsButState
;
491 msev
.kstate
:= curKbState
;
492 if (g_holmes_enabled
) then g_Holmes_mouseEvent(msev
);
498 Utf8ToUnicode(@uc
, PChar(ev
.text.text), 1);
500 if (keychr
> 127) then keychr
:= Word(wchar2win(WideChar(keychr
)));
501 CharPress(AnsiChar(keychr
));
504 // other key presses and joysticks are handled in e_input
508 procedure SwapBuffers();
510 {$IFDEF HEADLESS}Exit
;{$ENDIF}
511 SDL_GL_SwapWindow(h_Wnd
);
514 procedure KillGLWindow();
516 if h_Wnd
<> nil then SDL_DestroyWindow(h_Wnd
);
517 if h_GL
<> nil then SDL_GL_DeleteContext(h_GL
);
520 //wWindowCreated := False;
523 function CreateGLWindow(Title
: PChar): Boolean;
529 gWinSizeX
:= gScreenWidth
;
530 gWinSizeY
:= gScreenHeight
;
533 e_WriteLog('Creating window', MSG_NOTIFY
);
535 if not g_Window_SetDisplay() then
538 e_WriteLog('Window creation error (resolution not supported?)', MSG_FATALERROR
);
543 h_Gl
:= SDL_GL_CreateContext(h_Wnd
);
544 if h_Gl
= nil then Exit
;
546 //wWindowCreated := True;
548 e_ResizeWindow(gScreenWidth
, gScreenHeight
);
555 // windoze sux; in headless mode `GetTickCount()` (and SDL) returns shit
556 function GetTimer(): Int64;
560 QueryPerformanceFrequency(F
);
561 QueryPerformanceCounter(C
);
562 Result
:= Round(C
/F
*1000{000});
565 function GetTimer(): Int64;
570 t
:= SDL_GetTicks() {* 1000}; // TODO: do we really need microseconds here? k8: NOPE!
571 if ticksOverflow
= -1 then
578 if lastTicks
> t
then
580 // overflow, increment overflow ;-)
581 ticksOverflow
:= ticksOverflow
+(Int64($ffffffff)+Int64(1));
582 tt
:= (Int64($ffffffff)+Int64(1))+Int64(t
);
583 t
:= Uint32(tt
-lastTicks
);
587 result
:= ticksOverflow
+Int64(t
);
591 procedure ResetTimer();
593 wNeedTimeReset
:= True;
596 procedure PushExitEvent();
600 ev
.type_
:= SDL_QUITEV
;
606 prevLoadingUpdateTime
: UInt64 = 0;
608 procedure ProcessLoading (forceUpdate
: Boolean=false);
614 FillChar(ev
, SizeOf(ev
), 0);
615 //wNeedFree := False;
616 wLoadingProgress
:= True;
617 while SDL_PollEvent(@ev
) > 0 do
619 if (ev
.type_
= SDL_QUITEV
) then
624 if (ev
.type_
= SDL_QUITEV
) or (gExit
= EXIT_QUIT
) then
626 wLoadingProgress
:= False;
630 if not wMinimized
then
634 prevLoadingUpdateTime
:= getTimeMilli();
638 stt
:= getTimeMilli();
639 if (stt
< prevLoadingUpdateTime
) or (stt
-prevLoadingUpdateTime
>= 400) then
641 prevLoadingUpdateTime
:= stt
;
648 if g_Texture_Get('INTER', ID
) then
650 e_DrawSize(ID
, 0, 0, 0, False, False, gScreenWidth
, gScreenHeight
)
654 e_Clear(GL_COLOR_BUFFER_BIT
, 0, 0, 0);
666 if NetMode
= NET_SERVER
then
672 if (NetMode
= NET_CLIENT
) and (NetState
<> NET_STATE_AUTH
) then g_Net_Client_UpdateWhileLoading();
674 wLoadingProgress
:= False;
677 function ProcessMessage(): Boolean;
683 FillChar(ev
, SizeOf(ev
), 0);
685 while SDL_PollEvent(@ev
) > 0 do
687 Result
:= EventHandler(ev
);
688 if ev
.type_
= SDL_QUITEV
then exit
;
692 Time_Delta
:= Time
- Time_Old
;
696 if wNeedTimeReset
then
698 Time_Delta
:= 28{(27777 div 1000)};
699 wNeedTimeReset
:= False;
702 g_Map_ProfilersBegin();
703 g_Mons_ProfilersBegin();
705 t
:= Time_Delta
div 28{(27777 div 1000)};
711 if NetMode
= NET_SERVER
then g_Net_Host_Update()
712 else if NetMode
= NET_CLIENT
then g_Net_Client_Update();
718 if NetMode
= NET_SERVER
then g_Net_Host_Update()
719 else if NetMode
= NET_CLIENT
then g_Net_Client_Update();
722 g_Map_ProfilersEnd();
723 g_Mons_ProfilersEnd();
731 if gExit
= EXIT_QUIT
then
737 // Âðåìÿ ïðåäûäóùåãî îáíîâëåíèÿ:
740 Time_Old
:= Time
- (Time_Delta
mod 28{(27777 div 1000)});
741 if (not wMinimized
) then
754 procedure ReDrawWindow
;
760 procedure InitOpenGL(VSync
: Boolean);
764 {$IFDEF HEADLESS}Exit
;{$ENDIF}
765 if VSync
then v
:= 1 else v
:= 0;
766 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION
, 2);
767 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION
, 1);
768 SDL_GL_SetAttribute(SDL_GL_RED_SIZE
, 8);
769 SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE
, 8);
770 SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE
, 8);
771 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE
, 16);
772 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER
, 1);
773 if gwin_k8_enable_light_experiments
then
775 SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE
, 1); // lights; it is enough to have 1-bit stencil buffer for lighting
777 SDL_GL_SetSwapInterval(v
);
780 function glHasExtension (name
: AnsiString): Boolean;
785 extName
: ShortString;
788 if length(name
) = 0 then exit
;
789 exts
:= glGetString(GL_EXTENSIONS
);
790 if exts
= nil then exit
;
791 while (exts
[0] <> #0) and (exts
[0] = ' ') do Inc(exts
);
792 while exts
[0] <> #0 do
794 if gwin_dump_extensions
then
797 while (exts
[i
] <> #0) and (exts
[i
] <> ' ') do Inc(i
);
800 e_WriteLog('FUUUUUUUUUUUUU', MSG_WARNING
);
804 Move(exts
^, extName
[1], i
);
805 extName
[0] := Char(i
);
806 e_WriteLog(Format('EXT: %s', [extName
]), MSG_NOTIFY
);
810 for i
:= 0 to length(name
)-1 do
812 if exts
[i
] = #0 then begin found
:= false; break
; end;
813 if exts
[i
] <> name
[i
+1] then begin found
:= false; break
; end;
815 if found
and ((exts
[length(name
)] = #0) or (exts
[length(name
)] = ' ')) then begin result
:= true; exit
; end;
816 while (exts
[0] <> #0) and (exts
[0] <> ' ') do Inc(exts
);
817 while (exts
[0] <> #0) and (exts
[0] = ' ') do Inc(exts
);
821 function SDLMain(): Integer;
829 e_NoGraphics
:= True;
833 while (idx
<= ParamCount
) do
835 arg
:= ParamStr(idx
);
837 if arg
= '--opengl-dump-exts' then gwin_dump_extensions
:= true;
838 if arg
= '--twinkletwinkle' then gwin_k8_enable_light_experiments
:= true;
839 if arg
= '--jah' then g_profile_history_size
:= 100;
840 if arg
= '--no-particles' then gpart_dbg_enabled
:= false;
841 if arg
= '--no-los' then gmon_dbg_los_enabled
:= false;
843 if arg
= '--profile-render' then g_profile_frame_draw
:= true;
844 if arg
= '--profile-coldet' then g_profile_collision
:= true;
845 if arg
= '--profile-los' then g_profile_los
:= true;
847 if arg
= '--no-part-phys' then gpart_dbg_phys_enabled
:= false;
848 if arg
= '--no-part-physics' then gpart_dbg_phys_enabled
:= false;
849 if arg
= '--no-particles-phys' then gpart_dbg_phys_enabled
:= false;
850 if arg
= '--no-particles-physics' then gpart_dbg_phys_enabled
:= false;
851 if arg
= '--no-particle-phys' then gpart_dbg_phys_enabled
:= false;
852 if arg
= '--no-particle-physics' then gpart_dbg_phys_enabled
:= false;
854 {$IF DEFINED(D2F_DEBUG)}
855 if arg
= '--aimline' then g_dbg_aimline_on
:= false;
858 if arg
= '--holmes' then begin g_holmes_enabled
:= true; g_Game_SetDebugMode(); end;
859 if (arg
= '--holmes-ui-scale') or (arg
= '-holmes-ui-scale') then
861 if (idx
<= ParamCount
) then
863 if not conParseFloat(g_holmes_ui_scale
, ParamStr(idx
)) then g_holmes_ui_scale
:= 1.0;
868 if (arg
= '--game-scale') or (arg
= '-game-scale') then
870 if (idx
<= ParamCount
) then
872 if not conParseFloat(g_dbg_scale
, ParamStr(idx
)) then g_dbg_scale
:= 1.0;
877 if (arg
= '--write-mapdef') or (arg
= '-write-mapdef') then
879 mdfo
:= createDiskFile('mapdef.txt');
880 mdfo
.WriteBuffer(defaultMapDef
[1], Length(defaultMapDef
));
886 e_WriteLog('Initializing OpenGL', MSG_NOTIFY
);
889 e_WriteLog('Creating GL window', MSG_NOTIFY
);
890 if not CreateGLWindow(PChar(Format('Doom 2D: Forever %s', [GAME_VERSION
]))) then
896 {EnumDisplayModes();}
898 if gwin_k8_enable_light_experiments
then
900 SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE
, @ltmp
);
901 e_WriteLog(Format('stencil buffer size: %d', [ltmp
]), MSG_WARNING
);
902 gwin_has_stencil
:= (ltmp
> 0);
906 gwin_has_stencil
:= false;
909 if not glHasExtension('GL_ARB_texture_non_power_of_two') then
911 e_WriteLog('Driver DID''T advertised NPOT textures support', MSG_WARNING
);
912 glLegacyNPOT
:= true;
916 e_WriteLog('Driver advertised NPOT textures support', MSG_NOTIFY
);
917 glLegacyNPOT
:= false;
919 gwin_dump_extensions
:= false;
922 Time_Old
:= GetTimer();
925 if ParamCount
> 0 then
926 g_Game_Process_Params();
929 if (not gGameOn
) and gAskLanguage
then
930 g_Menu_AskLanguage();
932 e_WriteLog('Entering the main loop', MSG_NOTIFY
);
934 while not ProcessMessage() do