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 procedure PushExitEvent ();
28 function ProcessMessage (): Boolean;
29 procedure ReDrawWindow ();
30 procedure SwapBuffers ();
31 procedure Sleep (ms
: LongWord);
32 function GetDisplayModes (dbpp
: LongWord; var selres
: LongWord): SSArray
;
33 function g_Window_SetDisplay (preserveGL
: Boolean=false): Boolean;
34 function g_Window_SetSize (w
, h
: Word; fullscreen
: Boolean): Boolean;
36 procedure ProcessLoading (forceUpdate
: Boolean=false);
38 // returns `true` if quit event was received
39 function g_ProcessMessages (): Boolean;
43 gwin_dump_extensions
: Boolean = false;
44 gwin_has_stencil
: Boolean = false;
45 gwin_k8_enable_light_experiments
: Boolean = false;
46 g_dbg_aimline_on
: Boolean = false;
52 {$IFDEF WINDOWS}Windows
,{$ENDIF}
53 SysUtils
, Classes
, MAPDEF
,
54 SDL2
, GL
, GLExt
, e_graphics
, e_log
, e_texture
, g_main
,
55 g_console
, e_input
, g_options
, g_game
,
56 g_basic
, g_textures
, e_sound
, g_sound
, g_menu
, ENet
, g_net
,
57 g_map
, g_gfx
, g_monsters
, g_holmes
, xprofiler
,
62 ProgressUpdateMSecs
= 1;//100;
65 h_Wnd
: PSDL_Window
= nil;
66 h_GL
: TSDL_GLContext
= nil;
67 Time
, Time_Delta
, Time_Old
: Int64;
69 {$IF not DEFINED(HEADLESS)}
72 wNeedTimeReset
: Boolean = false;
73 wMinimized
: Boolean = false;
74 wLoadingProgress
: Boolean = false;
75 wLoadingQuit
: Boolean = false;
77 ticksOverflow
: Int64 = -1;
78 lastTicks
: Uint32
= 0; // to detect overflow
82 procedure KillGLWindow (preserveGL
: Boolean);
84 if (h_GL
<> nil) and (not preserveGL
) then begin if (assigned(oglDeinitCB
)) then oglDeinitCB(); end;
85 if (h_Wnd
<> nil) then SDL_DestroyWindow(h_Wnd
);
86 if (h_GL
<> nil) and (not preserveGL
) then SDL_GL_DeleteContext(h_GL
);
88 if (not preserveGL
) then h_GL
:= nil;
92 function g_Window_SetDisplay (preserveGL
: Boolean = false): Boolean;
93 {$IF not DEFINED(HEADLESS)}
95 mode
, cmode
: TSDL_DisplayMode
;
100 {$IF not DEFINED(HEADLESS)}
103 e_WriteLog('Setting display mode...', TMsgType
.Notify
);
105 wFlags
:= SDL_WINDOW_OPENGL
{or SDL_WINDOW_RESIZABLE};
106 if gFullscreen
then wFlags
:= wFlags
or SDL_WINDOW_FULLSCREEN
else wFlags
:= wFlags
or SDL_WINDOW_RESIZABLE
;
107 if (not gFullscreen
) and gWinMaximized
then wFlags
:= wFlags
or SDL_WINDOW_MAXIMIZED
;
111 mode
.w
:= gScreenWidth
;
112 mode
.h
:= gScreenHeight
;
114 mode
.refresh_rate
:= 0;
115 mode
.driverdata
:= nil;
116 if (SDL_GetClosestDisplayMode(0, @mode
, @cmode
) = nil) then
118 e_WriteLog('SDL: cannot find display mode for '+IntToStr(gScreenWidth
), TMsgType
.Notify
);
120 gScreenHeight
:= 600;
124 e_WriteLog('SDL: found display mode for '+IntToStr(gScreenWidth
)+'x'+IntToStr(gScreenHeight
)+': '+IntToStr(cmode
.w
)+'x'+IntToStr(cmode
.h
), TMsgType
.Notify
);
125 gScreenWidth
:= cmode
.w
;
126 gScreenHeight
:= cmode
.h
;
130 (*if (preserveGL) and (h_Wnd <> nil) {and (gFullscreen)} then
132 e_WriteLog('SDL: going fullscreen...', TMsgType.Notify);
133 //SDL_SetWindowMaximumSize(h_Wnd, gScreenWidth, gScreenHeight);
134 SDL_SetWindowDisplayMode(h_Wnd, @cmode);
135 SDL_SetWindowSize(h_Wnd, gScreenWidth, gScreenHeight);
136 if (gFullscreen) then
138 SDL_SetWindowFullscreen(h_Wnd, SDL_WINDOW_FULLSCREEN);
142 SDL_SetWindowFullscreen(h_Wnd, 0);
147 KillGLWindow(preserveGL
);
148 h_Wnd
:= SDL_CreateWindow(PChar(wTitle
), gWinRealPosX
, gWinRealPosY
, gScreenWidth
, gScreenHeight
, wFlags
);
149 if (h_Wnd
= nil) then exit
;
152 SDL_GL_MakeCurrent(h_Wnd
, h_GL
);
153 SDL_ShowCursor(SDL_DISABLE
);
154 if (gFullscreen
) then
158 SDL_GetWindowSize(h_Wnd
, @nw
, @nh
);
159 if (nw
> 128) and (nh
> 128) then
161 e_WriteLog('SDL: fullscreen window got size '+IntToStr(nw
)+'x'+IntToStr(nh
)+': '+IntToStr(gScreenWidth
)+'x'+IntToStr(gScreenHeight
), TMsgType
.Notify
);
167 e_WriteLog('SDL: fullscreen window got invalid size: '+IntToStr(nw
)+'x'+IntToStr(nh
), TMsgType
.Notify
);
170 fuiScrWdt
:= gScreenWidth
;
171 fuiScrHgt
:= gScreenHeight
;
172 if (h_GL
<> nil) and (not preserveGL
) then begin if (assigned(oglInitCB
)) then oglInitCB(); end;
179 function GetDisplayModes (dbpp
: LongWord; var selres
: LongWord): SSArray
;
181 mode
: TSDL_DisplayMode
;
182 res
, i
, k
, n
, pw
, ph
: Integer;
184 SetLength(result
, 0);
185 {$IFDEF HEADLESS}exit
;{$ENDIF}
187 n
:= SDL_GetNumDisplayModes(0);
191 res
:= SDL_GetDisplayMode(0, i
, @mode
);
192 if res
< 0 then continue
;
193 if SDL_BITSPERPIXEL(mode
.format
) = gBPP
then continue
;
194 if (mode
.w
= pw
) and (mode
.h
= ph
) then continue
;
195 if (mode
.w
= gScreenWidth
) and (mode
.h
= gScreenHeight
) then
198 SetLength(result
, k
);
199 result
[k
-1] := IntToStr(mode
.w
) + 'x' + IntToStr(mode
.h
);
200 pw
:= mode
.w
; ph
:= mode
.h
203 e_WriteLog('SDL: Got ' + IntToStr(k
) + ' resolutions.', TMsgType
.Notify
);
207 procedure Sleep (ms
: LongWord);
213 procedure ChangeWindowSize ();
215 e_LogWritefln(' ChangeWindowSize: (ws=%dx%d) (ss=%dx%d)', [gWinSizeX
, gWinSizeY
, gScreenWidth
, gScreenHeight
]);
216 gWinSizeX
:= gScreenWidth
;
217 gWinSizeY
:= gScreenHeight
;
218 {$IF not DEFINED(HEADLESS)}
219 fuiScrWdt
:= gScreenWidth
;
220 fuiScrHgt
:= gScreenHeight
;
221 e_ResizeWindow(gScreenWidth
, gScreenHeight
);
222 g_Game_SetupScreenSize();
224 g_Game_ClearLoading();
229 function g_Window_SetSize (w
, h
: Word; fullscreen
: Boolean): Boolean;
230 {$IF not DEFINED(HEADLESS)}
236 {$IF not DEFINED(HEADLESS)}
239 if (gScreenWidth
<> w
) or (gScreenHeight
<> h
) then
247 if (gFullscreen
<> fullscreen
) then
251 gFullscreen
:= fullscreen
;
257 g_Window_SetDisplay(preserve
);
264 function WindowEventHandler (constref ev
: TSDL_WindowEvent
): Boolean;
266 wActivate
, wDeactivate
: Boolean;
270 wDeactivate
:= false;
273 SDL_WINDOWEVENT_MOVED
:
275 if not (gFullscreen
or gWinMaximized
) then
277 gWinRealPosX
:= ev
.data1
;
278 gWinRealPosY
:= ev
.data2
;
282 SDL_WINDOWEVENT_MINIMIZED
:
285 if not wMinimized
then
287 e_ResizeWindow(0, 0);
289 if g_debug_WinMsgs
then
291 g_Console_Add('Now minimized');
292 e_WriteLog('[DEBUG] WinMsgs: Now minimized', TMsgType
.Notify
);
298 SDL_WINDOWEVENT_RESIZED
:
300 e_LogWritefln('Resize: (os=%dx%d) (ns=%dx%d)', [gScreenWidth
, gScreenHeight
, Integer(ev
.data1
), Integer(ev
.data2
)]);
301 {if (gFullscreen) then
303 e_LogWriteln(' fullscreen fix applied.');
304 if (gScreenWidth <> ev.data1) or (gScreenHeight <> ev.data2) then
306 SDL_SetWindowSize(h_Wnd, gScreenWidth, gScreenHeight);
311 gScreenWidth
:= ev
.data1
;
312 gScreenHeight
:= ev
.data2
;
316 if g_debug_WinMsgs
then
318 g_Console_Add('Resized to ' + IntToStr(ev
.data1
) + 'x' + IntToStr(ev
.data2
));
319 e_WriteLog('[DEBUG] WinMsgs: Resized to ' + IntToStr(ev
.data1
) + 'x' + IntToStr(ev
.data2
), TMsgType
.Notify
);
323 SDL_WINDOWEVENT_EXPOSED
:
326 SDL_WINDOWEVENT_MAXIMIZED
:
330 e_ResizeWindow(gScreenWidth
, gScreenHeight
);
334 if (not gWinMaximized
) and (not gFullscreen
) then
336 gWinMaximized
:= true;
337 if g_debug_WinMsgs
then
339 g_Console_Add('Now maximized');
340 e_WriteLog('[DEBUG] WinMsgs: Now maximized', TMsgType
.Notify
);
345 SDL_WINDOWEVENT_RESTORED
:
349 e_ResizeWindow(gScreenWidth
, gScreenHeight
);
353 gWinMaximized
:= false;
354 if g_debug_WinMsgs
then
356 g_Console_Add('Now restored');
357 e_WriteLog('[DEBUG] WinMsgs: Now restored', TMsgType
.Notify
);
361 SDL_WINDOWEVENT_FOCUS_GAINED
:
364 //e_WriteLog('window gained focus!', MSG_NOTIFY);
367 SDL_WINDOWEVENT_FOCUS_LOST
:
371 //e_WriteLog('window lost focus!', MSG_NOTIFY);
379 e_WriteLog('deactivating window', TMsgType
.Notify
);
380 e_EnableInput
:= false;
381 e_ClearInputBuffer();
383 if gMuteWhenInactive
then
385 //e_WriteLog('deactivating sounds', MSG_NOTIFY);
386 e_MuteChannels(true);
389 if g_debug_WinMsgs
then
391 g_Console_Add('Now inactive');
392 e_WriteLog('[DEBUG] WinMsgs: Now inactive', TMsgType
.Notify
);
397 if assigned(winBlurCB
) then winBlurCB();
400 else if wActivate
then
402 if not gWinActive
then
404 //e_WriteLog('activating window', MSG_NOTIFY);
405 e_EnableInput
:= true;
407 if gMuteWhenInactive
then
409 //e_WriteLog('activating sounds', MSG_NOTIFY);
410 e_MuteChannels(false);
413 if g_debug_WinMsgs
then
415 g_Console_Add('Now active');
416 e_WriteLog('[DEBUG] WinMsgs: Now active', TMsgType
.Notify
);
420 if assigned(winFocusCB
) then winFocusCB();
426 function EventHandler (var ev
: TSDL_Event
): Boolean;
436 result
:= WindowEventHandler(ev
.window
);
440 if (gExit
<> EXIT_QUIT
) then
442 if not wLoadingProgress
then
449 wLoadingQuit
:= true;
455 SDL_KEYDOWN
, SDL_KEYUP
:
457 key
:= ev
.key
.keysym
.scancode
;
458 down
:= (ev
.type_
= SDL_KEYDOWN
);
459 {$IF not DEFINED(HEADLESS)}
460 if fuiOnSDLEvent(ev
) then
462 // event eaten, but...
463 if not down
then e_KeyUpDown(key
, false);
467 if down
then KeyPress(key
);
468 e_KeyUpDown(key
, down
);
471 {$IF not DEFINED(HEADLESS)}
472 SDL_MOUSEBUTTONDOWN
, SDL_MOUSEBUTTONUP
, SDL_MOUSEWHEEL
, SDL_MOUSEMOTION
:
478 Utf8ToUnicode(@uc
, PChar(ev
.text.text), 1);
480 if (keychr
> 127) then keychr
:= Word(wchar2win(WideChar(keychr
)));
481 if (keychr
> 0) and (keychr
<= 255) then CharPress(AnsiChar(keychr
));
484 // other key presses and joysticks are handled in e_input
489 procedure SwapBuffers ();
491 {$IF not DEFINED(HEADLESS)}
492 SDL_GL_SwapWindow(h_Wnd
);
497 function CreateGLWindow (Title
: PChar): Boolean;
501 gWinSizeX
:= gScreenWidth
;
502 gWinSizeY
:= gScreenHeight
;
504 {$IF not DEFINED(HEADLESS)}
507 e_WriteLog('Creating window', TMsgType
.Notify
);
509 if not g_Window_SetDisplay() then
512 e_WriteLog('Window creation error (resolution not supported?)', TMsgType
.Fatal
);
516 {$IF not DEFINED(HEADLESS)}
517 h_GL
:= SDL_GL_CreateContext(h_Wnd
);
518 if (h_GL
= nil) then exit
;
519 fuiScrWdt
:= gScreenWidth
;
520 fuiScrHgt
:= gScreenHeight
;
521 if (assigned(oglInitCB
)) then oglInitCB();
524 e_ResizeWindow(gScreenWidth
, gScreenHeight
);
532 // windoze sux; in headless mode `GetTickCount()` (and SDL) returns shit
533 function GetTimer (): Int64;
537 QueryPerformanceFrequency(F
);
538 QueryPerformanceCounter(C
);
539 result
:= Round(C
/F
*1000{000});
542 function GetTimer (): Int64;
548 if (ticksOverflow
= -1) then
555 if (lastTicks
> t
) then
557 // overflow, increment overflow ;-)
558 ticksOverflow
:= ticksOverflow
+(Int64($ffffffff)+Int64(1));
559 tt
:= (Int64($ffffffff)+Int64(1))+Int64(t
);
560 t
:= Uint32(tt
-lastTicks
);
564 result
:= ticksOverflow
+Int64(t
);
569 procedure ResetTimer ();
571 wNeedTimeReset
:= true;
575 procedure PushExitEvent ();
579 ev
.type_
:= SDL_QUITEV
;
585 prevLoadingUpdateTime
: UInt64 = 0;
587 procedure ProcessLoading (forceUpdate
: Boolean=false);
593 FillChar(ev
, sizeof(ev
), 0);
594 wLoadingProgress
:= true;
596 while (SDL_PollEvent(@ev
) > 0) do
599 if (ev
.type_
= SDL_QUITEV
) then break
;
603 if (ev
.type_
= SDL_QUITEV
) or (gExit
= EXIT_QUIT
) then
605 wLoadingProgress
:= false;
609 if not wMinimized
then
613 prevLoadingUpdateTime
:= getTimeMilli();
617 stt
:= getTimeMilli();
618 if (stt
< prevLoadingUpdateTime
) or (stt
-prevLoadingUpdateTime
>= ProgressUpdateMSecs
) then
620 prevLoadingUpdateTime
:= stt
;
627 if g_Texture_Get('INTER', ID
) then
629 e_DrawSize(ID
, 0, 0, 0, false, false, gScreenWidth
, gScreenHeight
);
630 e_DarkenQuadWH(0, 0, gScreenWidth
, gScreenHeight
, 150);
634 e_Clear(GL_COLOR_BUFFER_BIT
, 0, 0, 0);
644 if NetMode
= NET_SERVER
then
650 if (NetMode
= NET_CLIENT
) and (NetState
<> NET_STATE_AUTH
) then g_Net_Client_UpdateWhileLoading();
653 wLoadingProgress
:= false;
657 function g_ProcessMessages (): Boolean;
662 FillChar(ev
, SizeOf(ev
), 0);
663 while (SDL_PollEvent(@ev
) > 0) do
665 result
:= EventHandler(ev
);
666 if (ev
.type_
= SDL_QUITEV
) then exit
;
672 function ProcessMessage (): Boolean;
676 result
:= g_ProcessMessages();
679 Time_Delta
:= Time
-Time_Old
;
683 if wNeedTimeReset
then
686 wNeedTimeReset
:= false;
689 g_Map_ProfilersBegin();
690 g_Mons_ProfilersBegin();
692 t
:= Time_Delta
div 28;
698 if (NetMode
= NET_SERVER
) then g_Net_Host_Update()
699 else if (NetMode
= NET_CLIENT
) then g_Net_Client_Update();
705 if (NetMode
= NET_SERVER
) then g_Net_Host_Update()
706 else if (NetMode
= NET_CLIENT
) then g_Net_Client_Update();
709 g_Map_ProfilersEnd();
710 g_Mons_ProfilersEnd();
718 if (gExit
= EXIT_QUIT
) then
724 // Âðåìÿ ïðåäûäóùåãî îáíîâëåíèÿ
727 Time_Old
:= Time
-(Time_Delta
mod 28);
728 if (not wMinimized
) then
736 Sleep(1); // release time slice, so we won't eat 100% CPU
743 procedure ReDrawWindow ();
749 procedure InitOpenGL (vsync
: Boolean);
750 {$IF not DEFINED(HEADLESS)}
755 {$IF not DEFINED(HEADLESS)}
756 if vsync
then v
:= 1 else v
:= 0;
757 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION
, 2);
758 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION
, 1);
759 SDL_GL_SetAttribute(SDL_GL_RED_SIZE
, 8);
760 SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE
, 8);
761 SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE
, 8);
762 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE
, 16);
763 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER
, 1);
764 SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE
, 8); // lights; it is enough to have 1-bit stencil buffer for lighting, but...
765 SDL_GL_SetSwapInterval(v
);
770 function glHasExtension (const name
: AnsiString): Boolean;
775 extName
: ShortString;
778 if (Length(name
) = 0) then exit
;
779 exts
:= glGetString(GL_EXTENSIONS
);
780 if (exts
= nil) then exit
;
781 while (exts
[0] <> #0) and (exts
[0] = ' ') do Inc(exts
);
782 while (exts
[0] <> #0) do
784 if gwin_dump_extensions
then
787 while (exts
[i
] <> #0) and (exts
[i
] <> ' ') do Inc(i
);
790 e_WriteLog('FUUUUUUUUUUUUU', TMsgType
.Warning
);
794 Move(exts
^, extName
[1], i
);
795 extName
[0] := Char(i
);
796 e_WriteLog(Format('EXT: %s', [extName
]), TMsgType
.Notify
);
800 for i
:= 0 to length(name
)-1 do
802 if (exts
[i
] = #0) then begin found
:= false; break
; end;
803 if (exts
[i
] <> name
[i
+1]) then begin found
:= false; break
; end;
805 if found
and ((exts
[Length(name
)] = #0) or (exts
[Length(name
)] = ' ')) then begin result
:= true; exit
; end;
806 while (exts
[0] <> #0) and (exts
[0] <> ' ') do Inc(exts
);
807 while (exts
[0] <> #0) and (exts
[0] = ' ') do Inc(exts
);
812 function SDLMain (): Integer;
815 {$IF not DEFINED(HEADLESS)}
824 e_NoGraphics
:= true;
826 if (not g_holmes_imfunctional
) then
829 uiContext
.font
:= 'win14';
834 while (idx
<= ParamCount
) do
836 arg
:= ParamStr(idx
);
838 if arg
= '--opengl-dump-exts' then gwin_dump_extensions
:= true;
839 //if arg = '--twinkletwinkle' then gwin_k8_enable_light_experiments := true;
840 if arg
= '--jah' then g_profile_history_size
:= 100;
841 if arg
= '--no-particles' then gpart_dbg_enabled
:= false;
842 if arg
= '--no-los' then gmon_dbg_los_enabled
:= false;
844 if arg
= '--profile-render' then g_profile_frame_draw
:= true;
845 if arg
= '--profile-coldet' then g_profile_collision
:= true;
846 if arg
= '--profile-los' then g_profile_los
:= true;
848 if arg
= '--no-part-phys' then gpart_dbg_phys_enabled
:= false;
849 if arg
= '--no-part-physics' then gpart_dbg_phys_enabled
:= false;
850 if arg
= '--no-particles-phys' then gpart_dbg_phys_enabled
:= false;
851 if arg
= '--no-particles-physics' then gpart_dbg_phys_enabled
:= false;
852 if arg
= '--no-particle-phys' then gpart_dbg_phys_enabled
:= false;
853 if arg
= '--no-particle-physics' then gpart_dbg_phys_enabled
:= false;
855 {.$IF DEFINED(D2F_DEBUG)}
856 if arg
= '--aimline' then g_dbg_aimline_on
:= true;
859 if arg
= '--holmes' then begin g_holmes_enabled
:= true; g_Game_SetDebugMode(); end;
861 if (arg
= '--holmes-ui-scale') or (arg
= '-holmes-ui-scale') then
863 if (idx
<= ParamCount
) then
865 if not conParseFloat(fuiRenderScale
, ParamStr(idx
)) then fuiRenderScale
:= 1.0;
870 if (arg
= '--holmes-font') or (arg
= '-holmes-font') then
872 if (idx
<= ParamCount
) then
875 val(ParamStr(idx
), itmp
, valres
);
877 if (valres
= 0) and (not g_holmes_imfunctional
) then
880 8: uiContext
.font
:= 'win8';
881 14: uiContext
.font
:= 'win14';
882 16: uiContext
.font
:= 'win16';
894 if (arg
= '--game-scale') or (arg
= '-game-scale') then
896 if (idx
<= ParamCount
) then
898 if not conParseFloat(g_dbg_scale
, ParamStr(idx
)) then g_dbg_scale
:= 1.0;
903 if (arg
= '--write-mapdef') or (arg
= '-write-mapdef') then
905 mdfo
:= createDiskFile('mapdef.txt');
906 mdfo
.WriteBuffer(defaultMapDef
[1], Length(defaultMapDef
));
912 e_WriteLog('Initializing OpenGL', TMsgType
.Notify
);
915 e_WriteLog('Creating GL window', TMsgType
.Notify
);
916 if not CreateGLWindow(PChar(Format('Doom 2D: Forever %s', [GAME_VERSION
]))) then
922 {EnumDisplayModes();}
925 //gwin_k8_enable_light_experiments := false;
926 gwin_has_stencil
:= false;
927 glLegacyNPOT
:= false;
928 gwin_dump_extensions
:= false;
930 SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE
, @ltmp
);
931 e_LogWritefln('stencil buffer size: %s', [ltmp
]);
932 gwin_has_stencil
:= (ltmp
> 0);
934 if not glHasExtension('GL_ARB_texture_non_power_of_two') then
936 e_WriteLog('NPOT textures: NO', TMsgType
.Warning
);
937 glLegacyNPOT
:= true;
941 e_WriteLog('NPOT textures: YES', TMsgType
.Notify
);
942 glLegacyNPOT
:= false;
944 gwin_dump_extensions
:= false;
948 Time_Old
:= GetTimer();
951 if (ParamCount
> 0) then g_Game_Process_Params();
954 if (not gGameOn
) and gAskLanguage
then g_Menu_AskLanguage();
956 e_WriteLog('Entering the main loop', TMsgType
.Notify
);
959 while not ProcessMessage() do begin end;