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;
65 Time
, Time_Delta
, Time_Old
: Int64;
67 {$IF not DEFINED(HEADLESS)}
70 wNeedTimeReset
: Boolean = false;
71 wMinimized
: Boolean = false;
72 wLoadingProgress
: Boolean = false;
73 wLoadingQuit
: Boolean = false;
75 ticksOverflow
: Int64 = -1;
76 lastTicks
: Uint32
= 0; // to detect overflow
78 {$IF not DEFINED(HEADLESS)}
79 curMsButState
: Word = 0;
86 function g_Window_SetDisplay (preserveGL
: Boolean = false): Boolean;
87 {$IF not DEFINED(HEADLESS)}
89 mode
, cmode
: TSDL_DisplayMode
;
93 {$IF not DEFINED(HEADLESS)}
96 e_WriteLog('Setting display mode...', TMsgType
.Notify
);
98 wFlags
:= SDL_WINDOW_OPENGL
or SDL_WINDOW_RESIZABLE
;
99 if gFullscreen
then wFlags
:= wFlags
or SDL_WINDOW_FULLSCREEN
;
100 if gWinMaximized
then wFlags
:= wFlags
or SDL_WINDOW_MAXIMIZED
;
102 if (h_Wnd
<> nil) then
104 SDL_DestroyWindow(h_Wnd
);
110 mode
.w
:= gScreenWidth
;
111 mode
.h
:= gScreenHeight
;
113 mode
.refresh_rate
:= 0;
114 mode
.driverdata
:= nil;
115 if (SDL_GetClosestDisplayMode(0, @mode
, @cmode
) = nil) then
118 gScreenHeight
:= 600;
122 gScreenWidth
:= cmode
.w
;
123 gScreenHeight
:= cmode
.h
;
127 h_Wnd
:= SDL_CreateWindow(PChar(wTitle
), gWinRealPosX
, gWinRealPosY
, gScreenWidth
, gScreenHeight
, wFlags
);
128 if (h_Wnd
= nil) then exit
;
130 SDL_GL_MakeCurrent(h_Wnd
, h_GL
);
131 SDL_ShowCursor(SDL_DISABLE
);
138 function GetDisplayModes(dbpp
: LongWord; var selres
: LongWord): SSArray
;
140 mode
: TSDL_DisplayMode
;
141 res
, i
, k
, n
, pw
, ph
: Integer;
143 SetLength(result
, 0);
144 {$IFDEF HEADLESS}exit
;{$ENDIF}
146 n
:= SDL_GetNumDisplayModes(0);
150 res
:= SDL_GetDisplayMode(0, i
, @mode
);
151 if res
< 0 then continue
;
152 if SDL_BITSPERPIXEL(mode
.format
) = gBPP
then continue
;
153 if (mode
.w
= pw
) and (mode
.h
= ph
) then continue
;
154 if (mode
.w
= gScreenWidth
) and (mode
.h
= gScreenHeight
) then
157 SetLength(result
, k
);
158 result
[k
-1] := IntToStr(mode
.w
) + 'x' + IntToStr(mode
.h
);
159 pw
:= mode
.w
; ph
:= mode
.h
162 e_WriteLog('SDL: Got ' + IntToStr(k
) + ' resolutions.', TMsgType
.Notify
);
166 procedure Sleep (ms
: LongWord);
172 procedure ChangeWindowSize ();
174 gWinSizeX
:= gScreenWidth
;
175 gWinSizeY
:= gScreenHeight
;
176 {$IF not DEFINED(HEADLESS)}
177 e_ResizeWindow(gScreenWidth
, gScreenHeight
);
178 g_Game_SetupScreenSize();
180 g_Game_ClearLoading();
181 g_Holmes_VidModeChanged();
186 function g_Window_SetSize (w
, h
: Word; fullscreen
: Boolean): Boolean;
187 {$IF not DEFINED(HEADLESS)}
193 {$IF not DEFINED(HEADLESS)}
196 if (gScreenWidth
<> w
) or (gScreenHeight
<> h
) then
203 if (gFullscreen
<> fullscreen
) then
206 gFullscreen
:= fullscreen
;
212 g_Window_SetDisplay(preserve
);
219 procedure resetKMState ();
221 {$IF not DEFINED(HEADLESS)}
228 function WindowEventHandler (constref ev
: TSDL_WindowEvent
): Boolean;
230 wActivate
, wDeactivate
: Boolean;
234 wDeactivate
:= false;
237 SDL_WINDOWEVENT_MOVED
:
239 if not (gFullscreen
or gWinMaximized
) then
241 gWinRealPosX
:= ev
.data1
;
242 gWinRealPosY
:= ev
.data2
;
246 SDL_WINDOWEVENT_MINIMIZED
:
250 if not wMinimized
then
252 e_ResizeWindow(0, 0);
254 if g_debug_WinMsgs
then
256 g_Console_Add('Now minimized');
257 e_WriteLog('[DEBUG] WinMsgs: Now minimized', TMsgType
.Notify
);
263 SDL_WINDOWEVENT_RESIZED
:
266 gScreenWidth
:= ev
.data1
;
267 gScreenHeight
:= ev
.data2
;
270 if g_debug_WinMsgs
then
272 g_Console_Add('Resized to ' + IntToStr(ev
.data1
) + 'x' + IntToStr(ev
.data2
));
273 e_WriteLog('[DEBUG] WinMsgs: Resized to ' + IntToStr(ev
.data1
) + 'x' + IntToStr(ev
.data2
), TMsgType
.Notify
);
277 SDL_WINDOWEVENT_EXPOSED
:
280 SDL_WINDOWEVENT_MAXIMIZED
:
285 e_ResizeWindow(gScreenWidth
, gScreenHeight
);
289 if not gWinMaximized
then
291 gWinMaximized
:= true;
292 if g_debug_WinMsgs
then
294 g_Console_Add('Now maximized');
295 e_WriteLog('[DEBUG] WinMsgs: Now maximized', TMsgType
.Notify
);
300 SDL_WINDOWEVENT_RESTORED
:
305 e_ResizeWindow(gScreenWidth
, gScreenHeight
);
309 if gWinMaximized
then
310 gWinMaximized
:= false;
311 if g_debug_WinMsgs
then
313 g_Console_Add('Now restored');
314 e_WriteLog('[DEBUG] WinMsgs: Now restored', TMsgType
.Notify
);
318 SDL_WINDOWEVENT_FOCUS_GAINED
:
322 //e_WriteLog('window gained focus!', MSG_NOTIFY);
323 g_Holmes_WindowFocused();
326 SDL_WINDOWEVENT_FOCUS_LOST
:
331 //e_WriteLog('window lost focus!', MSG_NOTIFY);
332 g_Holmes_WindowBlured();
340 e_WriteLog('deactivating window', TMsgType
.Notify
);
341 e_EnableInput
:= false;
342 e_ClearInputBuffer();
344 if gMuteWhenInactive
then
346 //e_WriteLog('deactivating sounds', MSG_NOTIFY);
347 e_MuteChannels(true);
350 if g_debug_WinMsgs
then
352 g_Console_Add('Now inactive');
353 e_WriteLog('[DEBUG] WinMsgs: Now inactive', TMsgType
.Notify
);
359 else if wActivate
then
361 if not gWinActive
then
363 //e_WriteLog('activating window', MSG_NOTIFY);
364 e_EnableInput
:= true;
366 if gMuteWhenInactive
then
368 //e_WriteLog('activating sounds', MSG_NOTIFY);
369 e_MuteChannels(false);
372 if g_debug_WinMsgs
then
374 g_Console_Add('Now active');
375 e_WriteLog('[DEBUG] WinMsgs: Now active', TMsgType
.Notify
);
384 function EventHandler (var ev
: TSDL_Event
): Boolean;
388 {$IF not DEFINED(HEADLESS)}
393 function buildBut (b
: Byte): Word;
397 SDL_BUTTON_LEFT
: result
:= result
or THMouseEvent
.Left
;
398 SDL_BUTTON_MIDDLE
: result
:= result
or THMouseEvent
.Middle
;
399 SDL_BUTTON_RIGHT
: result
:= result
or THMouseEvent
.Right
;
403 {$IF not DEFINED(HEADLESS)}
404 procedure updateKBState ();
409 kbstate
:= SDL_GetKeyboardState(nil);
410 if (kbstate
[SDL_SCANCODE_LCTRL
] <> 0) or (kbstate
[SDL_SCANCODE_RCTRL
] <> 0) then curKbState
:= curKbState
or THKeyEvent
.ModCtrl
;
411 if (kbstate
[SDL_SCANCODE_LALT
] <> 0) or (kbstate
[SDL_SCANCODE_RALT
] <> 0) then curKbState
:= curKbState
or THKeyEvent
.ModAlt
;
412 if (kbstate
[SDL_SCANCODE_LSHIFT
] <> 0) or (kbstate
[SDL_SCANCODE_RSHIFT
] <> 0) then curKbState
:= curKbState
or THKeyEvent
.ModShift
;
418 {$IF not DEFINED(HEADLESS)}
424 result
:= WindowEventHandler(ev
.window
);
428 if gExit
<> EXIT_QUIT
then
430 if not wLoadingProgress
then
436 wLoadingQuit
:= true;
441 SDL_KEYDOWN
, SDL_KEYUP
:
443 key
:= ev
.key
.keysym
.scancode
;
444 {$IF not DEFINED(HEADLESS)}
445 if (g_holmes_enabled
) then
447 if (ev
.type_
= SDL_KEYDOWN
) then kbev
.kind
:= THKeyEvent
.Press
else kbev
.kind
:= THKeyEvent
.Release
;
448 kbev
.scan
:= ev
.key
.keysym
.scancode
;
449 kbev
.sym
:= ev
.key
.keysym
.sym
;
450 kbev
.bstate
:= curMsButState
;
451 kbev
.kstate
:= curKbState
;
452 if g_Holmes_keyEvent(kbev
) then
454 if (ev
.type_
<> SDL_KEYDOWN
) then e_KeyUpDown(ev
.key
.keysym
.scancode
, false);
459 if (ev
.type_
= SDL_KEYDOWN
) then KeyPress(key
);
460 e_KeyUpDown(ev
.key
.keysym
.scancode
, (ev
.type_
= SDL_KEYDOWN
));
463 {$IF not DEFINED(HEADLESS)}
464 SDL_MOUSEBUTTONDOWN
, SDL_MOUSEBUTTONUP
:
466 msev
.dx
:= ev
.button
.x
-curMsX
;
467 msev
.dy
:= ev
.button
.y
-curMsY
;
468 curMsX
:= ev
.button
.x
;
469 curMsY
:= ev
.button
.y
;
470 if (ev
.type_
= SDL_MOUSEBUTTONDOWN
) then msev
.kind
:= THMouseEvent
.Press
else msev
.kind
:= THMouseEvent
.Release
;
471 msev
.but
:= buildBut(ev
.button
.button
);
474 if (msev
.but
<> 0) then
476 // ev.button.clicks: Byte
477 if (ev
.type_
= SDL_MOUSEBUTTONDOWN
) then curMsButState
:= curMsButState
or msev
.but
else curMsButState
:= curMsButState
and (not msev
.but
);
478 msev
.bstate
:= curMsButState
;
479 msev
.kstate
:= curKbState
;
480 if (g_holmes_enabled
) then g_Holmes_mouseEvent(msev
);
485 if (ev
.wheel
.y
<> 0) then
488 msev
.dy
:= ev
.wheel
.y
;
489 msev
.kind
:= THMouseEvent
.Press
;
490 if (ev
.wheel
.y
< 0) then msev
.but
:= THMouseEvent
.WheelUp
else msev
.but
:= THMouseEvent
.WheelDown
;
493 msev
.bstate
:= curMsButState
;
494 msev
.kstate
:= curKbState
;
495 if (g_holmes_enabled
) then g_Holmes_mouseEvent(msev
);
500 msev
.dx
:= ev
.button
.x
-curMsX
;
501 msev
.dy
:= ev
.button
.y
-curMsY
;
502 curMsX
:= ev
.button
.x
;
503 curMsY
:= ev
.button
.y
;
504 msev
.kind
:= THMouseEvent
.Motion
;
508 msev
.bstate
:= curMsButState
;
509 msev
.kstate
:= curKbState
;
510 if (g_holmes_enabled
) then g_Holmes_mouseEvent(msev
);
516 Utf8ToUnicode(@uc
, PChar(ev
.text.text), 1);
518 if (keychr
> 127) then keychr
:= Word(wchar2win(WideChar(keychr
)));
519 CharPress(AnsiChar(keychr
));
522 // other key presses and joysticks are handled in e_input
527 procedure SwapBuffers ();
529 {$IF not DEFINED(HEADLESS)}
530 SDL_GL_SwapWindow(h_Wnd
);
535 procedure KillGLWindow();
537 if (h_Wnd
<> nil) then SDL_DestroyWindow(h_Wnd
);
538 if (h_GL
<> nil) then SDL_GL_DeleteContext(h_GL
);
544 function CreateGLWindow (Title
: PChar): Boolean;
548 gWinSizeX
:= gScreenWidth
;
549 gWinSizeY
:= gScreenHeight
;
551 {$IF not DEFINED(HEADLESS)}
554 e_WriteLog('Creating window', TMsgType
.Notify
);
556 if not g_Window_SetDisplay() then
559 e_WriteLog('Window creation error (resolution not supported?)', TMsgType
.Fatal
);
563 {$IF not DEFINED(HEADLESS)}
564 h_Gl
:= SDL_GL_CreateContext(h_Wnd
);
565 if (h_Gl
= nil) then exit
;
568 e_ResizeWindow(gScreenWidth
, gScreenHeight
);
576 // windoze sux; in headless mode `GetTickCount()` (and SDL) returns shit
577 function GetTimer (): Int64;
581 QueryPerformanceFrequency(F
);
582 QueryPerformanceCounter(C
);
583 result
:= Round(C
/F
*1000{000});
586 function GetTimer (): Int64;
592 if (ticksOverflow
= -1) then
599 if (lastTicks
> t
) then
601 // overflow, increment overflow ;-)
602 ticksOverflow
:= ticksOverflow
+(Int64($ffffffff)+Int64(1));
603 tt
:= (Int64($ffffffff)+Int64(1))+Int64(t
);
604 t
:= Uint32(tt
-lastTicks
);
608 result
:= ticksOverflow
+Int64(t
);
613 procedure ResetTimer ();
615 wNeedTimeReset
:= true;
619 procedure PushExitEvent ();
623 ev
.type_
:= SDL_QUITEV
;
629 prevLoadingUpdateTime
: UInt64 = 0;
631 procedure ProcessLoading (forceUpdate
: Boolean=false);
637 FillChar(ev
, sizeof(ev
), 0);
638 wLoadingProgress
:= true;
640 while (SDL_PollEvent(@ev
) > 0) do
642 if (ev
.type_
= SDL_QUITEV
) then break
;
645 if (ev
.type_
= SDL_QUITEV
) or (gExit
= EXIT_QUIT
) then
647 wLoadingProgress
:= false;
651 if not wMinimized
then
655 prevLoadingUpdateTime
:= getTimeMilli();
659 stt
:= getTimeMilli();
660 if (stt
< prevLoadingUpdateTime
) or (stt
-prevLoadingUpdateTime
>= ProgressUpdateMSecs
) then
662 prevLoadingUpdateTime
:= stt
;
669 if g_Texture_Get('INTER', ID
) then
671 e_DrawSize(ID
, 0, 0, 0, false, false, gScreenWidth
, gScreenHeight
)
675 e_Clear(GL_COLOR_BUFFER_BIT
, 0, 0, 0);
685 if NetMode
= NET_SERVER
then
691 if (NetMode
= NET_CLIENT
) and (NetState
<> NET_STATE_AUTH
) then g_Net_Client_UpdateWhileLoading();
694 wLoadingProgress
:= false;
698 function ProcessMessage (): Boolean;
704 FillChar(ev
, SizeOf(ev
), 0);
706 while (SDL_PollEvent(@ev
) > 0) do
708 result
:= EventHandler(ev
);
709 if (ev
.type_
= SDL_QUITEV
) then exit
;
713 Time_Delta
:= Time
-Time_Old
;
717 if wNeedTimeReset
then
720 wNeedTimeReset
:= false;
723 g_Map_ProfilersBegin();
724 g_Mons_ProfilersBegin();
726 t
:= Time_Delta
div 28;
732 if (NetMode
= NET_SERVER
) then g_Net_Host_Update()
733 else if (NetMode
= NET_CLIENT
) then g_Net_Client_Update();
739 if (NetMode
= NET_SERVER
) then g_Net_Host_Update()
740 else if (NetMode
= NET_CLIENT
) then g_Net_Client_Update();
743 g_Map_ProfilersEnd();
744 g_Mons_ProfilersEnd();
752 if (gExit
= EXIT_QUIT
) then
758 // Âðåìÿ ïðåäûäóùåãî îáíîâëåíèÿ
761 Time_Old
:= Time
-(Time_Delta
mod 28);
762 if (not wMinimized
) then
770 Sleep(1); // release time slice, so we won't eat 100% CPU
777 procedure ReDrawWindow ();
783 procedure InitOpenGL (vsync
: Boolean);
784 {$IF not DEFINED(HEADLESS)}
789 {$IF not DEFINED(HEADLESS)}
790 if vsync
then v
:= 1 else v
:= 0;
791 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION
, 2);
792 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION
, 1);
793 SDL_GL_SetAttribute(SDL_GL_RED_SIZE
, 8);
794 SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE
, 8);
795 SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE
, 8);
796 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE
, 16);
797 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER
, 1);
798 SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE
, 8); // lights; it is enough to have 1-bit stencil buffer for lighting, but...
799 SDL_GL_SetSwapInterval(v
);
804 function glHasExtension (const name
: AnsiString): Boolean;
809 extName
: ShortString;
812 if (Length(name
) = 0) then exit
;
813 exts
:= glGetString(GL_EXTENSIONS
);
814 if (exts
= nil) then exit
;
815 while (exts
[0] <> #0) and (exts
[0] = ' ') do Inc(exts
);
816 while (exts
[0] <> #0) do
818 if gwin_dump_extensions
then
821 while (exts
[i
] <> #0) and (exts
[i
] <> ' ') do Inc(i
);
824 e_WriteLog('FUUUUUUUUUUUUU', TMsgType
.Warning
);
828 Move(exts
^, extName
[1], i
);
829 extName
[0] := Char(i
);
830 e_WriteLog(Format('EXT: %s', [extName
]), TMsgType
.Notify
);
834 for i
:= 0 to length(name
)-1 do
836 if (exts
[i
] = #0) then begin found
:= false; break
; end;
837 if (exts
[i
] <> name
[i
+1]) then begin found
:= false; break
; end;
839 if found
and ((exts
[Length(name
)] = #0) or (exts
[Length(name
)] = ' ')) then begin result
:= true; exit
; end;
840 while (exts
[0] <> #0) and (exts
[0] <> ' ') do Inc(exts
);
841 while (exts
[0] <> #0) and (exts
[0] = ' ') do Inc(exts
);
846 function SDLMain (): Integer;
849 {$IF not DEFINED(HEADLESS)}
856 e_NoGraphics
:= true;
860 while (idx
<= ParamCount
) do
862 arg
:= ParamStr(idx
);
864 if arg
= '--opengl-dump-exts' then gwin_dump_extensions
:= true;
865 //if arg = '--twinkletwinkle' then gwin_k8_enable_light_experiments := true;
866 if arg
= '--jah' then g_profile_history_size
:= 100;
867 if arg
= '--no-particles' then gpart_dbg_enabled
:= false;
868 if arg
= '--no-los' then gmon_dbg_los_enabled
:= false;
870 if arg
= '--profile-render' then g_profile_frame_draw
:= true;
871 if arg
= '--profile-coldet' then g_profile_collision
:= true;
872 if arg
= '--profile-los' then g_profile_los
:= true;
874 if arg
= '--no-part-phys' then gpart_dbg_phys_enabled
:= false;
875 if arg
= '--no-part-physics' then gpart_dbg_phys_enabled
:= false;
876 if arg
= '--no-particles-phys' then gpart_dbg_phys_enabled
:= false;
877 if arg
= '--no-particles-physics' then gpart_dbg_phys_enabled
:= false;
878 if arg
= '--no-particle-phys' then gpart_dbg_phys_enabled
:= false;
879 if arg
= '--no-particle-physics' then gpart_dbg_phys_enabled
:= false;
881 {.$IF DEFINED(D2F_DEBUG)}
882 if arg
= '--aimline' then g_dbg_aimline_on
:= true;
885 if arg
= '--holmes' then begin g_holmes_enabled
:= true; g_Game_SetDebugMode(); end;
886 if (arg
= '--holmes-ui-scale') or (arg
= '-holmes-ui-scale') then
888 if (idx
<= ParamCount
) then
890 if not conParseFloat(g_holmes_ui_scale
, ParamStr(idx
)) then g_holmes_ui_scale
:= 1.0;
895 if (arg
= '--game-scale') or (arg
= '-game-scale') then
897 if (idx
<= ParamCount
) then
899 if not conParseFloat(g_dbg_scale
, ParamStr(idx
)) then g_dbg_scale
:= 1.0;
904 if (arg
= '--write-mapdef') or (arg
= '-write-mapdef') then
906 mdfo
:= createDiskFile('mapdef.txt');
907 mdfo
.WriteBuffer(defaultMapDef
[1], Length(defaultMapDef
));
913 e_WriteLog('Initializing OpenGL', TMsgType
.Notify
);
916 e_WriteLog('Creating GL window', TMsgType
.Notify
);
917 if not CreateGLWindow(PChar(Format('Doom 2D: Forever %s', [GAME_VERSION
]))) then
923 {EnumDisplayModes();}
926 //gwin_k8_enable_light_experiments := false;
927 gwin_has_stencil
:= false;
928 glLegacyNPOT
:= false;
929 gwin_dump_extensions
:= false;
931 SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE
, @ltmp
);
932 e_LogWritefln('stencil buffer size: %s', [ltmp
]);
933 gwin_has_stencil
:= (ltmp
> 0);
935 if not glHasExtension('GL_ARB_texture_non_power_of_two') then
937 e_WriteLog('Driver DID''T advertised NPOT textures support', TMsgType
.Warning
);
938 glLegacyNPOT
:= true;
942 e_WriteLog('Driver advertised NPOT textures support', TMsgType
.Notify
);
943 glLegacyNPOT
:= false;
945 gwin_dump_extensions
:= false;
949 Time_Old
:= GetTimer();
952 if (ParamCount
> 0) then g_Game_Process_Params();
955 if (not gGameOn
) and gAskLanguage
then g_Menu_AskLanguage();
957 e_WriteLog('Entering the main loop', TMsgType
.Notify
);
960 while not ProcessMessage() do begin end;