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 ReDrawWindow ();
32 procedure SwapBuffers ();
33 procedure Sleep (ms
: LongWord);
34 function GetDisplayModes (dbpp
: LongWord; var selres
: LongWord): SSArray
;
35 function g_Window_SetDisplay (preserveGL
: Boolean=false): Boolean;
36 function g_Window_SetSize (w
, h
: Word; fullscreen
: Boolean): Boolean;
38 procedure ProcessLoading (forceUpdate
: Boolean=false);
42 gwin_dump_extensions
: Boolean = false;
43 gwin_has_stencil
: Boolean = false;
44 gwin_k8_enable_light_experiments
: Boolean = false;
45 g_dbg_aimline_on
: Boolean = false;
51 {$IFDEF WINDOWS}Windows
,{$ENDIF}
52 SysUtils
, Classes
, MAPDEF
,
53 SDL2
, GL
, GLExt
, e_graphics
, e_log
, e_texture
, g_main
,
54 g_console
, e_input
, g_options
, g_game
,
55 g_basic
, g_textures
, e_sound
, g_sound
, g_menu
, ENet
, g_net
,
56 g_map
, g_gfx
, g_monsters
, g_holmes
, xprofiler
;
60 ProgressUpdateMSecs
= 100;
63 h_Wnd
: PSDL_Window
= nil;
64 h_GL
: TSDL_GLContext
= nil;
66 Time
, Time_Delta
, Time_Old
: Int64;
69 wNeedTimeReset
: Boolean = false;
70 wMinimized
: Boolean = false;
71 wLoadingProgress
: Boolean = false;
72 wLoadingQuit
: Boolean = false;
74 ticksOverflow
: Int64 = -1;
75 lastTicks
: Uint32
= 0; // to detect overflow
77 {$IF not DEFINED(HEADLESS)}
78 curMsButState
: Word = 0;
85 function g_Window_SetDisplay (preserveGL
: Boolean = false): Boolean;
86 {$IF not DEFINED(HEADLESS)}
88 mode
, cmode
: TSDL_DisplayMode
;
91 {$IF not DEFINED(HEADLESS)}
94 e_WriteLog('Setting display mode...', TMsgType
.Notify
);
96 wFlags
:= SDL_WINDOW_OPENGL
or SDL_WINDOW_RESIZABLE
;
97 if gFullscreen
then wFlags
:= wFlags
or SDL_WINDOW_FULLSCREEN
;
98 if gWinMaximized
then wFlags
:= wFlags
or SDL_WINDOW_MAXIMIZED
;
100 if (h_Wnd
<> nil) then
102 SDL_DestroyWindow(h_Wnd
);
108 mode
.w
:= gScreenWidth
;
109 mode
.h
:= gScreenHeight
;
111 mode
.refresh_rate
:= 0;
112 mode
.driverdata
:= nil;
113 if (SDL_GetClosestDisplayMode(0, @mode
, @cmode
) = nil) then
116 gScreenHeight
:= 600;
120 gScreenWidth
:= cmode
.w
;
121 gScreenHeight
:= cmode
.h
;
125 h_Wnd
:= SDL_CreateWindow(PChar(wTitle
), gWinRealPosX
, gWinRealPosY
, gScreenWidth
, gScreenHeight
, wFlags
);
126 if (h_Wnd
= nil) then exit
;
128 SDL_GL_MakeCurrent(h_Wnd
, h_GL
);
129 SDL_ShowCursor(SDL_DISABLE
);
136 function GetDisplayModes(dbpp
: LongWord; var selres
: LongWord): SSArray
;
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.', TMsgType
.Notify
);
164 procedure Sleep (ms
: LongWord);
170 procedure ChangeWindowSize ();
172 gWinSizeX
:= gScreenWidth
;
173 gWinSizeY
:= gScreenHeight
;
174 {$IF not DEFINED(HEADLESS)}
175 e_ResizeWindow(gScreenWidth
, gScreenHeight
);
176 g_Game_SetupScreenSize();
178 g_Game_ClearLoading();
179 g_Holmes_VidModeChanged();
184 function g_Window_SetSize (w
, h
: Word; fullscreen
: Boolean): Boolean;
189 {$IF not DEFINED(HEADLESS)}
192 if (gScreenWidth
<> w
) or (gScreenHeight
<> h
) then
199 if (gFullscreen
<> fullscreen
) then
202 gFullscreen
:= fullscreen
;
208 g_Window_SetDisplay(preserve
);
215 procedure resetKMState ();
217 {$IF not DEFINED(HEADLESS)}
224 function WindowEventHandler (constref ev
: TSDL_WindowEvent
): Boolean;
226 wActivate
, wDeactivate
: Boolean;
230 wDeactivate
:= false;
233 SDL_WINDOWEVENT_MOVED
:
235 if not (gFullscreen
or gWinMaximized
) then
237 gWinRealPosX
:= ev
.data1
;
238 gWinRealPosY
:= ev
.data2
;
242 SDL_WINDOWEVENT_MINIMIZED
:
246 if not wMinimized
then
248 e_ResizeWindow(0, 0);
250 if g_debug_WinMsgs
then
252 g_Console_Add('Now minimized');
253 e_WriteLog('[DEBUG] WinMsgs: Now minimized', TMsgType
.Notify
);
259 SDL_WINDOWEVENT_RESIZED
:
262 gScreenWidth
:= ev
.data1
;
263 gScreenHeight
:= ev
.data2
;
266 if g_debug_WinMsgs
then
268 g_Console_Add('Resized to ' + IntToStr(ev
.data1
) + 'x' + IntToStr(ev
.data2
));
269 e_WriteLog('[DEBUG] WinMsgs: Resized to ' + IntToStr(ev
.data1
) + 'x' + IntToStr(ev
.data2
), TMsgType
.Notify
);
273 SDL_WINDOWEVENT_EXPOSED
:
276 SDL_WINDOWEVENT_MAXIMIZED
:
281 e_ResizeWindow(gScreenWidth
, gScreenHeight
);
285 if not gWinMaximized
then
287 gWinMaximized
:= true;
288 if g_debug_WinMsgs
then
290 g_Console_Add('Now maximized');
291 e_WriteLog('[DEBUG] WinMsgs: Now maximized', TMsgType
.Notify
);
296 SDL_WINDOWEVENT_RESTORED
:
301 e_ResizeWindow(gScreenWidth
, gScreenHeight
);
305 if gWinMaximized
then
306 gWinMaximized
:= false;
307 if g_debug_WinMsgs
then
309 g_Console_Add('Now restored');
310 e_WriteLog('[DEBUG] WinMsgs: Now restored', TMsgType
.Notify
);
314 SDL_WINDOWEVENT_FOCUS_GAINED
:
318 //e_WriteLog('window gained focus!', MSG_NOTIFY);
319 g_Holmes_WindowFocused();
322 SDL_WINDOWEVENT_FOCUS_LOST
:
327 //e_WriteLog('window lost focus!', MSG_NOTIFY);
328 g_Holmes_WindowBlured();
336 e_WriteLog('deactivating window', TMsgType
.Notify
);
337 e_EnableInput
:= false;
338 e_ClearInputBuffer();
340 if gMuteWhenInactive
then
342 //e_WriteLog('deactivating sounds', MSG_NOTIFY);
343 e_MuteChannels(true);
346 if g_debug_WinMsgs
then
348 g_Console_Add('Now inactive');
349 e_WriteLog('[DEBUG] WinMsgs: Now inactive', TMsgType
.Notify
);
355 else if wActivate
then
357 if not gWinActive
then
359 //e_WriteLog('activating window', MSG_NOTIFY);
360 e_EnableInput
:= true;
362 if gMuteWhenInactive
then
364 //e_WriteLog('activating sounds', MSG_NOTIFY);
365 e_MuteChannels(false);
368 if g_debug_WinMsgs
then
370 g_Console_Add('Now active');
371 e_WriteLog('[DEBUG] WinMsgs: Now active', TMsgType
.Notify
);
380 function EventHandler (var ev
: TSDL_Event
): Boolean;
384 {$IF not DEFINED(HEADLESS)}
389 function buildBut (b
: Byte): Word;
393 SDL_BUTTON_LEFT
: result
:= result
or THMouseEvent
.Left
;
394 SDL_BUTTON_MIDDLE
: result
:= result
or THMouseEvent
.Middle
;
395 SDL_BUTTON_RIGHT
: result
:= result
or THMouseEvent
.Right
;
399 {$IF not DEFINED(HEADLESS)}
400 procedure updateKBState ();
405 kbstate
:= SDL_GetKeyboardState(nil);
406 if (kbstate
[SDL_SCANCODE_LCTRL
] <> 0) or (kbstate
[SDL_SCANCODE_RCTRL
] <> 0) then curKbState
:= curKbState
or THKeyEvent
.ModCtrl
;
407 if (kbstate
[SDL_SCANCODE_LALT
] <> 0) or (kbstate
[SDL_SCANCODE_RALT
] <> 0) then curKbState
:= curKbState
or THKeyEvent
.ModAlt
;
408 if (kbstate
[SDL_SCANCODE_LSHIFT
] <> 0) or (kbstate
[SDL_SCANCODE_RSHIFT
] <> 0) then curKbState
:= curKbState
or THKeyEvent
.ModShift
;
414 {$IF not DEFINED(HEADLESS)}
420 result
:= WindowEventHandler(ev
.window
);
424 if gExit
<> EXIT_QUIT
then
426 if not wLoadingProgress
then
432 wLoadingQuit
:= true;
437 SDL_KEYDOWN
, SDL_KEYUP
:
439 key
:= ev
.key
.keysym
.scancode
;
440 {$IF not DEFINED(HEADLESS)}
441 if (g_holmes_enabled
) then
443 if (ev
.type_
= SDL_KEYDOWN
) then kbev
.kind
:= THKeyEvent
.Press
else kbev
.kind
:= THKeyEvent
.Release
;
444 kbev
.scan
:= ev
.key
.keysym
.scancode
;
445 kbev
.sym
:= ev
.key
.keysym
.sym
;
446 kbev
.bstate
:= curMsButState
;
447 kbev
.kstate
:= curKbState
;
448 if g_Holmes_keyEvent(kbev
) then
450 if (ev
.type_
<> SDL_KEYDOWN
) then e_KeyUpDown(ev
.key
.keysym
.scancode
, false);
455 if (ev
.type_
= SDL_KEYDOWN
) then KeyPress(key
);
456 e_KeyUpDown(ev
.key
.keysym
.scancode
, (ev
.type_
= SDL_KEYDOWN
));
459 {$IF not DEFINED(HEADLESS)}
460 SDL_MOUSEBUTTONDOWN
, SDL_MOUSEBUTTONUP
:
462 msev
.dx
:= ev
.button
.x
-curMsX
;
463 msev
.dy
:= ev
.button
.y
-curMsY
;
464 curMsX
:= ev
.button
.x
;
465 curMsY
:= ev
.button
.y
;
466 if (ev
.type_
= SDL_MOUSEBUTTONDOWN
) then msev
.kind
:= THMouseEvent
.Press
else msev
.kind
:= THMouseEvent
.Release
;
467 msev
.but
:= buildBut(ev
.button
.button
);
470 if (msev
.but
<> 0) then
472 // ev.button.clicks: Byte
473 if (ev
.type_
= SDL_MOUSEBUTTONDOWN
) then curMsButState
:= curMsButState
or msev
.but
else curMsButState
:= curMsButState
and (not msev
.but
);
474 msev
.bstate
:= curMsButState
;
475 msev
.kstate
:= curKbState
;
476 if (g_holmes_enabled
) then g_Holmes_mouseEvent(msev
);
481 if (ev
.wheel
.y
<> 0) then
484 msev
.dy
:= ev
.wheel
.y
;
485 msev
.kind
:= THMouseEvent
.Press
;
486 if (ev
.wheel
.y
< 0) then msev
.but
:= THMouseEvent
.WheelUp
else msev
.but
:= THMouseEvent
.WheelDown
;
489 msev
.bstate
:= curMsButState
;
490 msev
.kstate
:= curKbState
;
491 if (g_holmes_enabled
) then g_Holmes_mouseEvent(msev
);
496 msev
.dx
:= ev
.button
.x
-curMsX
;
497 msev
.dy
:= ev
.button
.y
-curMsY
;
498 curMsX
:= ev
.button
.x
;
499 curMsY
:= ev
.button
.y
;
500 msev
.kind
:= THMouseEvent
.Motion
;
504 msev
.bstate
:= curMsButState
;
505 msev
.kstate
:= curKbState
;
506 if (g_holmes_enabled
) then g_Holmes_mouseEvent(msev
);
512 Utf8ToUnicode(@uc
, PChar(ev
.text.text), 1);
514 if (keychr
> 127) then keychr
:= Word(wchar2win(WideChar(keychr
)));
515 CharPress(AnsiChar(keychr
));
518 // other key presses and joysticks are handled in e_input
523 procedure SwapBuffers ();
525 {$IF not DEFINED(HEADLESS)}
526 SDL_GL_SwapWindow(h_Wnd
);
531 procedure KillGLWindow();
533 if (h_Wnd
<> nil) then SDL_DestroyWindow(h_Wnd
);
534 if (h_GL
<> nil) then SDL_GL_DeleteContext(h_GL
);
540 function CreateGLWindow (Title
: PChar): Boolean;
544 gWinSizeX
:= gScreenWidth
;
545 gWinSizeY
:= gScreenHeight
;
548 e_WriteLog('Creating window', TMsgType
.Notify
);
550 if not g_Window_SetDisplay() then
553 e_WriteLog('Window creation error (resolution not supported?)', TMsgType
.Fatal
);
557 {$IF not DEFINED(HEADLESS)}
558 h_Gl
:= SDL_GL_CreateContext(h_Wnd
);
559 if (h_Gl
= nil) then exit
;
562 e_ResizeWindow(gScreenWidth
, gScreenHeight
);
570 // windoze sux; in headless mode `GetTickCount()` (and SDL) returns shit
571 function GetTimer (): Int64;
575 QueryPerformanceFrequency(F
);
576 QueryPerformanceCounter(C
);
577 result
:= Round(C
/F
*1000{000});
580 function GetTimer (): Int64;
586 if (ticksOverflow
= -1) then
593 if (lastTicks
> t
) then
595 // overflow, increment overflow ;-)
596 ticksOverflow
:= ticksOverflow
+(Int64($ffffffff)+Int64(1));
597 tt
:= (Int64($ffffffff)+Int64(1))+Int64(t
);
598 t
:= Uint32(tt
-lastTicks
);
602 result
:= ticksOverflow
+Int64(t
);
607 procedure ResetTimer ();
609 wNeedTimeReset
:= true;
613 procedure PushExitEvent ();
617 ev
.type_
:= SDL_QUITEV
;
623 prevLoadingUpdateTime
: UInt64 = 0;
625 procedure ProcessLoading (forceUpdate
: Boolean=false);
631 FillChar(ev
, sizeof(ev
), 0);
632 wLoadingProgress
:= true;
634 while (SDL_PollEvent(@ev
) > 0) do
636 if (ev
.type_
= SDL_QUITEV
) then break
;
639 if (ev
.type_
= SDL_QUITEV
) or (gExit
= EXIT_QUIT
) then
641 wLoadingProgress
:= false;
645 if not wMinimized
then
649 prevLoadingUpdateTime
:= getTimeMilli();
653 stt
:= getTimeMilli();
654 if (stt
< prevLoadingUpdateTime
) or (stt
-prevLoadingUpdateTime
>= ProgressUpdateMSecs
) then
656 prevLoadingUpdateTime
:= stt
;
663 if g_Texture_Get('INTER', ID
) then
665 e_DrawSize(ID
, 0, 0, 0, false, false, gScreenWidth
, gScreenHeight
)
669 e_Clear(GL_COLOR_BUFFER_BIT
, 0, 0, 0);
679 if NetMode
= NET_SERVER
then
685 if (NetMode
= NET_CLIENT
) and (NetState
<> NET_STATE_AUTH
) then g_Net_Client_UpdateWhileLoading();
688 wLoadingProgress
:= false;
692 function ProcessMessage (): Boolean;
698 FillChar(ev
, SizeOf(ev
), 0);
700 while (SDL_PollEvent(@ev
) > 0) do
702 result
:= EventHandler(ev
);
703 if (ev
.type_
= SDL_QUITEV
) then exit
;
707 Time_Delta
:= Time
-Time_Old
;
711 if wNeedTimeReset
then
714 wNeedTimeReset
:= false;
717 g_Map_ProfilersBegin();
718 g_Mons_ProfilersBegin();
720 t
:= Time_Delta
div 28;
726 if (NetMode
= NET_SERVER
) then g_Net_Host_Update()
727 else if (NetMode
= NET_CLIENT
) then g_Net_Client_Update();
733 if (NetMode
= NET_SERVER
) then g_Net_Host_Update()
734 else if (NetMode
= NET_CLIENT
) then g_Net_Client_Update();
737 g_Map_ProfilersEnd();
738 g_Mons_ProfilersEnd();
746 if (gExit
= EXIT_QUIT
) then
752 // Âðåìÿ ïðåäûäóùåãî îáíîâëåíèÿ
755 Time_Old
:= Time
-(Time_Delta
mod 28);
756 if (not wMinimized
) then
764 Sleep(1); // release time slice, so we won't eat 100% CPU
771 procedure ReDrawWindow ();
777 procedure InitOpenGL (vsync
: Boolean);
778 {$IF not DEFINED(HEADLESS)}
783 {$IF not DEFINED(HEADLESS)}
784 if vsync
then v
:= 1 else v
:= 0;
785 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION
, 2);
786 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION
, 1);
787 SDL_GL_SetAttribute(SDL_GL_RED_SIZE
, 8);
788 SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE
, 8);
789 SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE
, 8);
790 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE
, 16);
791 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER
, 1);
792 SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE
, 8); // lights; it is enough to have 1-bit stencil buffer for lighting, but...
793 SDL_GL_SetSwapInterval(v
);
798 function glHasExtension (const name
: AnsiString): Boolean;
803 extName
: ShortString;
806 if (Length(name
) = 0) then exit
;
807 exts
:= glGetString(GL_EXTENSIONS
);
808 if (exts
= nil) then exit
;
809 while (exts
[0] <> #0) and (exts
[0] = ' ') do Inc(exts
);
810 while (exts
[0] <> #0) do
812 if gwin_dump_extensions
then
815 while (exts
[i
] <> #0) and (exts
[i
] <> ' ') do Inc(i
);
818 e_WriteLog('FUUUUUUUUUUUUU', TMsgType
.Warning
);
822 Move(exts
^, extName
[1], i
);
823 extName
[0] := Char(i
);
824 e_WriteLog(Format('EXT: %s', [extName
]), TMsgType
.Notify
);
828 for i
:= 0 to length(name
)-1 do
830 if (exts
[i
] = #0) then begin found
:= false; break
; end;
831 if (exts
[i
] <> name
[i
+1]) then begin found
:= false; break
; end;
833 if found
and ((exts
[Length(name
)] = #0) or (exts
[Length(name
)] = ' ')) then begin result
:= true; exit
; end;
834 while (exts
[0] <> #0) and (exts
[0] <> ' ') do Inc(exts
);
835 while (exts
[0] <> #0) and (exts
[0] = ' ') do Inc(exts
);
840 function SDLMain (): Integer;
843 {$IF not DEFINED(HEADLESS)}
850 e_NoGraphics
:= true;
854 while (idx
<= ParamCount
) do
856 arg
:= ParamStr(idx
);
858 if arg
= '--opengl-dump-exts' then gwin_dump_extensions
:= true;
859 //if arg = '--twinkletwinkle' then gwin_k8_enable_light_experiments := true;
860 if arg
= '--jah' then g_profile_history_size
:= 100;
861 if arg
= '--no-particles' then gpart_dbg_enabled
:= false;
862 if arg
= '--no-los' then gmon_dbg_los_enabled
:= false;
864 if arg
= '--profile-render' then g_profile_frame_draw
:= true;
865 if arg
= '--profile-coldet' then g_profile_collision
:= true;
866 if arg
= '--profile-los' then g_profile_los
:= true;
868 if arg
= '--no-part-phys' then gpart_dbg_phys_enabled
:= false;
869 if arg
= '--no-part-physics' then gpart_dbg_phys_enabled
:= false;
870 if arg
= '--no-particles-phys' then gpart_dbg_phys_enabled
:= false;
871 if arg
= '--no-particles-physics' then gpart_dbg_phys_enabled
:= false;
872 if arg
= '--no-particle-phys' then gpart_dbg_phys_enabled
:= false;
873 if arg
= '--no-particle-physics' then gpart_dbg_phys_enabled
:= false;
875 {.$IF DEFINED(D2F_DEBUG)}
876 if arg
= '--aimline' then g_dbg_aimline_on
:= true;
879 if arg
= '--holmes' then begin g_holmes_enabled
:= true; g_Game_SetDebugMode(); end;
880 if (arg
= '--holmes-ui-scale') or (arg
= '-holmes-ui-scale') then
882 if (idx
<= ParamCount
) then
884 if not conParseFloat(g_holmes_ui_scale
, ParamStr(idx
)) then g_holmes_ui_scale
:= 1.0;
889 if (arg
= '--game-scale') or (arg
= '-game-scale') then
891 if (idx
<= ParamCount
) then
893 if not conParseFloat(g_dbg_scale
, ParamStr(idx
)) then g_dbg_scale
:= 1.0;
898 if (arg
= '--write-mapdef') or (arg
= '-write-mapdef') then
900 mdfo
:= createDiskFile('mapdef.txt');
901 mdfo
.WriteBuffer(defaultMapDef
[1], Length(defaultMapDef
));
907 e_WriteLog('Initializing OpenGL', TMsgType
.Notify
);
910 e_WriteLog('Creating GL window', TMsgType
.Notify
);
911 if not CreateGLWindow(PChar(Format('Doom 2D: Forever %s', [GAME_VERSION
]))) then
917 {EnumDisplayModes();}
920 //gwin_k8_enable_light_experiments := false;
921 gwin_has_stencil
:= false;
922 glLegacyNPOT
:= false;
923 gwin_dump_extensions
:= false;
925 SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE
, @ltmp
);
926 e_LogWritefln('stencil buffer size: %s', [ltmp
]);
927 gwin_has_stencil
:= (ltmp
> 0);
929 if not glHasExtension('GL_ARB_texture_non_power_of_two') then
931 e_WriteLog('Driver DID''T advertised NPOT textures support', TMsgType
.Warning
);
932 glLegacyNPOT
:= true;
936 e_WriteLog('Driver advertised NPOT textures support', TMsgType
.Notify
);
937 glLegacyNPOT
:= false;
939 gwin_dump_extensions
:= false;
943 Time_Old
:= GetTimer();
946 if (ParamCount
> 0) then g_Game_Process_Params();
949 if (not gGameOn
) and gAskLanguage
then g_Menu_AskLanguage();
951 e_WriteLog('Entering the main loop', TMsgType
.Notify
);
954 while not ProcessMessage() do begin end;