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();
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;
48 {$IFDEF WINDOWS}Windows
,{$ENDIF}
49 SDL2
, GL
, GLExt
, e_graphics
, e_log
, g_main
,
50 g_console
, SysUtils
, e_input
, g_options
, g_game
,
51 g_basic
, g_textures
, e_sound
, g_sound
, g_menu
, ENet
, g_net
,
52 g_map
, g_gfx
, g_monsters
, g_holmes
;
58 Time
, Time_Delta
, Time_Old
: Int64;
61 wNeedTimeReset
: Boolean = False;
62 //wWindowCreated: Boolean = False;
63 //wCursorShown: Boolean = False;
64 wMinimized
: Boolean = False;
65 //wNeedFree: Boolean = True;
66 wLoadingProgress
: Boolean = False;
67 wLoadingQuit
: Boolean = False;
68 {wWinPause: Byte = 0;}
70 ticksOverflow
: Int64 = -1;
71 lastTicks
: Uint32
= 0; // to detect overflow
73 curMsButState
: Word = 0;
79 // TODO: move this to a separate file
80 CP1251
: array [0..127] of Word = (
81 $0402,$0403,$201A,$0453,$201E,$2026,$2020,$2021,$20AC,$2030,$0409,$2039,$040A,$040C,$040B,$040F,
82 $0452,$2018,$2019,$201C,$201D,$2022,$2013,$2014,$003F,$2122,$0459,$203A,$045A,$045C,$045B,$045F,
83 $00A0,$040E,$045E,$0408,$00A4,$0490,$00A6,$00A7,$0401,$00A9,$0404,$00AB,$00AC,$00AD,$00AE,$0407,
84 $00B0,$00B1,$0406,$0456,$0491,$00B5,$00B6,$00B7,$0451,$2116,$0454,$00BB,$0458,$0405,$0455,$0457,
85 $0410,$0411,$0412,$0413,$0414,$0415,$0416,$0417,$0418,$0419,$041A,$041B,$041C,$041D,$041E,$041F,
86 $0420,$0421,$0422,$0423,$0424,$0425,$0426,$0427,$0428,$0429,$042A,$042B,$042C,$042D,$042E,$042F,
87 $0430,$0431,$0432,$0433,$0434,$0435,$0436,$0437,$0438,$0439,$043A,$043B,$043C,$043D,$043E,$043F,
88 $0440,$0441,$0442,$0443,$0444,$0445,$0446,$0447,$0448,$0449,$044A,$044B,$044C,$044D,$044E,$044F
91 // TODO: make a transition table or something
92 function WCharToCP1251(wc
: Word): Word;
98 if CP1251
[n
] = wc
then begin Result
:= n
; break
end;
99 Result
:= Result
+ 128;
102 function g_Window_SetDisplay(PreserveGL
: Boolean = False): Boolean;
104 mode
, cmode
: TSDL_DisplayMode
;
113 e_WriteLog('Setting display mode...', MSG_NOTIFY
);
115 wFlags
:= SDL_WINDOW_OPENGL
or SDL_WINDOW_RESIZABLE
;
116 if gFullscreen
then wFlags
:= wFlags
or SDL_WINDOW_FULLSCREEN
;
117 if gWinMaximized
then wFlags
:= wFlags
or SDL_WINDOW_MAXIMIZED
;
121 SDL_DestroyWindow(h_Wnd
);
127 mode
.w
:= gScreenWidth
;
128 mode
.h
:= gScreenHeight
;
130 mode
.refresh_rate
:= 0;
131 mode
.driverdata
:= nil;
132 if SDL_GetClosestDisplayMode(0, @mode
, @cmode
) = nil then
135 gScreenHeight
:= 600;
139 gScreenWidth
:= cmode
.w
;
140 gScreenHeight
:= cmode
.h
;
144 h_Wnd
:= SDL_CreateWindow(PChar(wTitle
), gWinRealPosX
, gWinRealPosY
, gScreenWidth
, gScreenHeight
, wFlags
);
145 if h_Wnd
= nil then Exit
;
147 SDL_GL_MakeCurrent(h_Wnd
, h_GL
);
148 SDL_ShowCursor(SDL_DISABLE
);
153 procedure ReShowCursor();
155 // TODO: what was this for?
158 function GetDisplayModes(dBPP
: DWORD
; var SelRes
: DWORD
): SArray
;
160 mode
: TSDL_DisplayMode
;
161 res
, i
, k
, n
, pw
, ph
: Integer;
163 SetLength(Result
, 0);
164 {$IFDEF HEADLESS}Exit
;{$ENDIF}
166 n
:= SDL_GetNumDisplayModes(0);
170 res
:= SDL_GetDisplayMode(0, i
, @mode
);
171 if res
< 0 then continue
;
172 if SDL_BITSPERPIXEL(mode
.format
) = gBPP
then continue
;
173 if (mode
.w
= pw
) and (mode
.h
= ph
) then continue
;
174 if (mode
.w
= gScreenWidth
) and (mode
.h
= gScreenHeight
) then
177 SetLength(Result
, k
);
178 Result
[k
-1] := IntToStr(mode
.w
) + 'x' + IntToStr(mode
.h
);
179 pw
:= mode
.w
; ph
:= mode
.h
182 e_WriteLog('SDL: Got ' + IntToStr(k
) + ' resolutions.', MSG_NOTIFY
);
185 procedure Sleep(ms
: LongWord);
190 procedure ChangeWindowSize();
192 gWinSizeX
:= gScreenWidth
;
193 gWinSizeY
:= gScreenHeight
;
194 {$IFDEF HEADLESS}Exit
;{$ENDIF}
195 e_ResizeWindow(gScreenWidth
, gScreenHeight
);
196 g_Game_SetupScreenSize();
198 g_Game_ClearLoading();
199 g_Holmes_VidModeChanged();
202 function g_Window_SetSize(W
, H
: Word; FScreen
: Boolean): Boolean;
207 {$IFDEF HEADLESS}Exit
;{$ENDIF}
210 if (gScreenWidth
<> W
) or (gScreenHeight
<> H
) then
217 if gFullscreen
<> FScreen
then
220 gFullscreen
:= FScreen
;
226 g_Window_SetDisplay(Preserve
);
231 function WindowEventHandler(ev
: TSDL_WindowEvent
): Boolean;
233 wActivate
, wDeactivate
: Boolean;
237 wDeactivate
:= False;
240 SDL_WINDOWEVENT_MOVED
:
242 if not (gFullscreen
or gWinMaximized
) then
244 gWinRealPosX
:= ev
.data1
;
245 gWinRealPosY
:= ev
.data2
;
249 SDL_WINDOWEVENT_MINIMIZED
:
254 if not wMinimized
then
256 e_ResizeWindow(0, 0);
259 if g_debug_WinMsgs
then
261 g_Console_Add('Now minimized');
262 e_WriteLog('[DEBUG] WinMsgs: Now minimized', MSG_NOTIFY
);
268 SDL_WINDOWEVENT_RESIZED
:
272 gScreenWidth
:= ev
.data1
;
273 gScreenHeight
:= ev
.data2
;
276 if g_debug_WinMsgs
then
278 g_Console_Add('Resized to ' + IntToStr(ev
.data1
) + 'x' + IntToStr(ev
.data2
));
279 e_WriteLog('[DEBUG] WinMsgs: Resized to ' + IntToStr(ev
.data1
) + 'x' + IntToStr(ev
.data2
), MSG_NOTIFY
);
283 SDL_WINDOWEVENT_EXPOSED
:
286 SDL_WINDOWEVENT_MAXIMIZED
:
292 e_ResizeWindow(gScreenWidth
, gScreenHeight
);
296 if not gWinMaximized
then
298 gWinMaximized
:= True;
299 if g_debug_WinMsgs
then
301 g_Console_Add('Now maximized');
302 e_WriteLog('[DEBUG] WinMsgs: Now maximized', MSG_NOTIFY
);
307 SDL_WINDOWEVENT_RESTORED
:
313 e_ResizeWindow(gScreenWidth
, gScreenHeight
);
317 if gWinMaximized
then
318 gWinMaximized
:= False;
319 if g_debug_WinMsgs
then
321 g_Console_Add('Now restored');
322 e_WriteLog('[DEBUG] WinMsgs: Now restored', MSG_NOTIFY
);
326 SDL_WINDOWEVENT_FOCUS_GAINED
:
331 //e_WriteLog('window gained focus!', MSG_NOTIFY);
332 g_Holmes_WindowFocused();
335 SDL_WINDOWEVENT_FOCUS_LOST
:
341 //e_WriteLog('window lost focus!', MSG_NOTIFY);
342 g_Holmes_WindowBlured();
350 e_WriteLog('deactivating window', MSG_NOTIFY
);
351 e_EnableInput
:= False;
352 e_ClearInputBuffer();
354 if gMuteWhenInactive
then
356 //e_WriteLog('deactivating sounds', MSG_NOTIFY);
357 e_MuteChannels(True);
360 if g_debug_WinMsgs
then
362 g_Console_Add('Now inactive');
363 e_WriteLog('[DEBUG] WinMsgs: Now inactive', MSG_NOTIFY
);
369 else if wActivate
then
371 if not gWinActive
then
373 //e_WriteLog('activating window', MSG_NOTIFY);
374 e_EnableInput
:= True;
376 if gMuteWhenInactive
then
378 //e_WriteLog('activating sounds', MSG_NOTIFY);
379 e_MuteChannels(False);
382 if g_debug_WinMsgs
then
384 g_Console_Add('Now active');
385 e_WriteLog('[DEBUG] WinMsgs: Now active', MSG_NOTIFY
);
393 function EventHandler(ev
: TSDL_Event
): Boolean;
401 function buildBut (b
: Byte): Word;
405 SDL_BUTTON_LEFT
: result
:= result
or THMouseEvent
.Left
;
406 SDL_BUTTON_MIDDLE
: result
:= result
or THMouseEvent
.Middle
;
407 SDL_BUTTON_RIGHT
: result
:= result
or THMouseEvent
.Right
;
411 procedure updateKBState ();
416 kbstate
:= SDL_GetKeyboardState(nil);
417 if (kbstate
[SDL_SCANCODE_LCTRL
] <> 0) or (kbstate
[SDL_SCANCODE_RCTRL
] <> 0) then curKbState
:= curKbState
or THKeyEvent
.ModCtrl
;
418 if (kbstate
[SDL_SCANCODE_LALT
] <> 0) or (kbstate
[SDL_SCANCODE_RALT
] <> 0) then curKbState
:= curKbState
or THKeyEvent
.ModAlt
;
419 if (kbstate
[SDL_SCANCODE_LSHIFT
] <> 0) or (kbstate
[SDL_SCANCODE_RSHIFT
] <> 0) then curKbState
:= curKbState
or THKeyEvent
.ModShift
;
428 Result
:= WindowEventHandler(ev
.window
);
432 if gExit
<> EXIT_QUIT
then
434 if not wLoadingProgress
then
440 wLoadingQuit
:= True;
445 SDL_KEYDOWN
, SDL_KEYUP
:
447 key
:= ev
.key
.keysym
.scancode
;
448 if (g_holmes_enabled
) then
450 if (ev
.type_
= SDL_KEYDOWN
) then kbev
.kind
:= THKeyEvent
.Press
else kbev
.kind
:= THKeyEvent
.Release
;
451 kbev
.scan
:= ev
.key
.keysym
.scancode
;
452 kbev
.sym
:= ev
.key
.keysym
.sym
;
453 kbev
.bstate
:= curMsButState
;
454 kbev
.kstate
:= curKbState
;
455 if g_Holmes_keyEvent(kbev
) then
457 if (ev
.type_
<> SDL_KEYDOWN
) then e_KeyUpDown(ev
.key
.keysym
.scancode
, false);
461 if (ev
.type_
= SDL_KEYDOWN
) then KeyPress(key
);
462 e_KeyUpDown(ev
.key
.keysym
.scancode
, (ev
.type_
= SDL_KEYDOWN
));
465 SDL_MOUSEBUTTONDOWN
, SDL_MOUSEBUTTONUP
:
467 msev
.dx
:= ev
.button
.x
-curMsX
;
468 msev
.dy
:= ev
.button
.y
-curMsY
;
469 curMsX
:= ev
.button
.x
;
470 curMsY
:= ev
.button
.y
;
471 if (ev
.type_
= SDL_MOUSEBUTTONDOWN
) then msev
.kind
:= THMouseEvent
.Press
else msev
.kind
:= THMouseEvent
.Release
;
472 msev
.but
:= buildBut(ev
.button
.button
);
475 if (msev
.but
<> 0) then
477 // ev.button.clicks: Byte
478 if (ev
.type_
= SDL_MOUSEBUTTONDOWN
) then curMsButState
:= curMsButState
or msev
.but
else curMsButState
:= curMsButState
and (not msev
.but
);
479 msev
.bstate
:= curMsButState
;
480 msev
.kstate
:= curKbState
;
481 if (g_holmes_enabled
) then g_Holmes_mouseEvent(msev
);
486 if (ev
.wheel
.y
<> 0) then
489 msev
.dy
:= ev
.wheel
.y
;
490 msev
.kind
:= THMouseEvent
.Press
;
491 if (ev
.wheel
.y
< 0) then msev
.but
:= THMouseEvent
.WheelUp
else msev
.but
:= THMouseEvent
.WheelDown
;
494 msev
.bstate
:= curMsButState
;
495 msev
.kstate
:= curKbState
;
496 if (g_holmes_enabled
) then g_Holmes_mouseEvent(msev
);
501 msev
.dx
:= ev
.button
.x
-curMsX
;
502 msev
.dy
:= ev
.button
.y
-curMsY
;
503 curMsX
:= ev
.button
.x
;
504 curMsY
:= ev
.button
.y
;
505 msev
.kind
:= THMouseEvent
.Motion
;
509 msev
.bstate
:= curMsButState
;
510 msev
.kstate
:= curKbState
;
511 if (g_holmes_enabled
) then g_Holmes_mouseEvent(msev
);
516 Utf8ToUnicode(@uc
, PChar(ev
.text.text), 1);
518 if (keychr
> 127) then keychr
:= WCharToCP1251(keychr
);
519 CharPress(Chr(keychr
));
522 // other key presses and joysticks are handled in e_input
526 procedure SwapBuffers();
528 {$IFDEF HEADLESS}Exit
;{$ENDIF}
529 SDL_GL_SwapWindow(h_Wnd
);
532 procedure KillGLWindow();
534 if h_Wnd
<> nil then SDL_DestroyWindow(h_Wnd
);
535 if h_GL
<> nil then SDL_GL_DeleteContext(h_GL
);
538 //wWindowCreated := False;
541 function CreateGLWindow(Title
: PChar): Boolean;
547 gWinSizeX
:= gScreenWidth
;
548 gWinSizeY
:= gScreenHeight
;
551 e_WriteLog('Creating window', MSG_NOTIFY
);
553 if not g_Window_SetDisplay() then
556 e_WriteLog('Window creation error (resolution not supported?)', MSG_FATALERROR
);
561 h_Gl
:= SDL_GL_CreateContext(h_Wnd
);
562 if h_Gl
= nil then Exit
;
564 //wWindowCreated := True;
566 e_ResizeWindow(gScreenWidth
, gScreenHeight
);
573 // windoze sux; in headless mode `GetTickCount()` (and SDL) returns shit
574 function GetTimer(): Int64;
578 QueryPerformanceFrequency(F
);
579 QueryPerformanceCounter(C
);
580 Result
:= Round(C
/F
*1000{000});
583 function GetTimer(): Int64;
588 t
:= SDL_GetTicks() {* 1000}; // TODO: do we really need microseconds here? k8: NOPE!
589 if ticksOverflow
= -1 then
596 if lastTicks
> t
then
598 // overflow, increment overflow ;-)
599 ticksOverflow
:= ticksOverflow
+(Int64($ffffffff)+Int64(1));
600 tt
:= (Int64($ffffffff)+Int64(1))+Int64(t
);
601 t
:= Uint32(tt
-lastTicks
);
605 result
:= ticksOverflow
+Int64(t
);
609 procedure ResetTimer();
611 wNeedTimeReset
:= True;
614 procedure PushExitEvent();
618 ev
.type_
:= SDL_QUITEV
;
622 procedure ProcessLoading();
627 FillChar(ev
, SizeOf(ev
), 0);
628 //wNeedFree := False;
629 wLoadingProgress
:= True;
630 while SDL_PollEvent(@ev
) > 0 do
632 if (ev
.type_
= SDL_QUITEV
) then
637 if (ev
.type_
= SDL_QUITEV
) or (gExit
= EXIT_QUIT
) then
639 wLoadingProgress
:= False;
643 if not wMinimized
then
645 if g_Texture_Get('INTER', ID
) then
646 e_DrawSize(ID
, 0, 0, 0, False, False, gScreenWidth
, gScreenHeight
)
648 e_Clear(GL_COLOR_BUFFER_BIT
, 0, 0, 0);
658 if NetMode
= NET_SERVER
then
661 if (NetMode
= NET_CLIENT
) and (NetState
<> NET_STATE_AUTH
) then
662 g_Net_Client_UpdateWhileLoading
;
663 wLoadingProgress
:= False;
666 function ProcessMessage(): Boolean;
672 FillChar(ev
, SizeOf(ev
), 0);
674 while SDL_PollEvent(@ev
) > 0 do
676 Result
:= EventHandler(ev
);
677 if ev
.type_
= SDL_QUITEV
then exit
;
681 Time_Delta
:= Time
- Time_Old
;
685 if wNeedTimeReset
then
687 Time_Delta
:= 28{(27777 div 1000)};
688 wNeedTimeReset
:= False;
691 g_Map_ProfilersBegin();
692 g_Mons_ProfilersBegin();
694 t
:= Time_Delta
div 28{(27777 div 1000)};
700 if NetMode
= NET_SERVER
then g_Net_Host_Update()
701 else if NetMode
= NET_CLIENT
then g_Net_Client_Update();
707 if NetMode
= NET_SERVER
then g_Net_Host_Update()
708 else if NetMode
= NET_CLIENT
then g_Net_Client_Update();
711 g_Map_ProfilersEnd();
712 g_Mons_ProfilersEnd();
720 if gExit
= EXIT_QUIT
then
726 // Âðåìÿ ïðåäûäóùåãî îáíîâëåíèÿ:
729 Time_Old
:= Time
- (Time_Delta
mod 28{(27777 div 1000)});
730 if (not wMinimized
) then
743 procedure ReDrawWindow
;
749 procedure InitOpenGL(VSync
: Boolean);
753 {$IFDEF HEADLESS}Exit
;{$ENDIF}
754 if VSync
then v
:= 1 else v
:= 0;
755 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION
, 2);
756 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION
, 1);
757 SDL_GL_SetAttribute(SDL_GL_RED_SIZE
, 8);
758 SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE
, 8);
759 SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE
, 8);
760 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE
, 16);
761 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER
, 1);
762 if gwin_k8_enable_light_experiments
then
764 SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE
, 1); // lights; it is enough to have 1-bit stencil buffer for lighting
766 SDL_GL_SetSwapInterval(v
);
769 function glHasExtension (name
: AnsiString): Boolean;
774 extName
: ShortString;
777 if length(name
) = 0 then exit
;
778 exts
:= glGetString(GL_EXTENSIONS
);
779 if exts
= nil then exit
;
780 while (exts
[0] <> #0) and (exts
[0] = ' ') do Inc(exts
);
781 while exts
[0] <> #0 do
783 if gwin_dump_extensions
then
786 while (exts
[i
] <> #0) and (exts
[i
] <> ' ') do Inc(i
);
789 e_WriteLog('FUUUUUUUUUUUUU', MSG_WARNING
);
793 Move(exts
^, extName
[1], i
);
794 extName
[0] := Char(i
);
795 e_WriteLog(Format('EXT: %s', [extName
]), MSG_NOTIFY
);
799 for i
:= 0 to length(name
)-1 do
801 if exts
[i
] = #0 then begin found
:= false; break
; end;
802 if exts
[i
] <> name
[i
+1] then begin found
:= false; break
; end;
804 if found
and ((exts
[length(name
)] = #0) or (exts
[length(name
)] = ' ')) then begin result
:= true; exit
; end;
805 while (exts
[0] <> #0) and (exts
[0] <> ' ') do Inc(exts
);
806 while (exts
[0] <> #0) and (exts
[0] = ' ') do Inc(exts
);
810 function SDLMain(): Integer;
816 e_NoGraphics
:= True;
819 for idx
:= 1 to ParamCount
do
821 if ParamStr(idx
) = '--opengl-dump-exts' then gwin_dump_extensions
:= true;
822 if ParamStr(idx
) = '--twinkletwinkle' then gwin_k8_enable_light_experiments
:= true;
823 if ParamStr(idx
) = '--jah' then g_profile_history_size
:= 100;
824 if ParamStr(idx
) = '--no-particles' then gpart_dbg_enabled
:= false;
825 if ParamStr(idx
) = '--no-los' then gmon_dbg_los_enabled
:= false;
827 if ParamStr(idx
) = '--profile-render' then g_profile_frame_draw
:= true;
828 if ParamStr(idx
) = '--profile-coldet' then g_profile_collision
:= true;
829 if ParamStr(idx
) = '--profile-los' then g_profile_los
:= true;
831 if ParamStr(idx
) = '--no-part-phys' then gpart_dbg_phys_enabled
:= false;
832 if ParamStr(idx
) = '--no-part-physics' then gpart_dbg_phys_enabled
:= false;
833 if ParamStr(idx
) = '--no-particles-phys' then gpart_dbg_phys_enabled
:= false;
834 if ParamStr(idx
) = '--no-particles-physics' then gpart_dbg_phys_enabled
:= false;
835 if ParamStr(idx
) = '--no-particle-phys' then gpart_dbg_phys_enabled
:= false;
836 if ParamStr(idx
) = '--no-particle-physics' then gpart_dbg_phys_enabled
:= false;
838 if ParamStr(idx
) = '--holmes' then begin g_holmes_enabled
:= true; g_Game_SetDebugMode(); end;
841 e_WriteLog('Initializing OpenGL', MSG_NOTIFY
);
844 e_WriteLog('Creating GL window', MSG_NOTIFY
);
845 if not CreateGLWindow(PChar(Format('Doom 2D: Forever %s', [GAME_VERSION
]))) then
851 {EnumDisplayModes();}
853 if gwin_k8_enable_light_experiments
then
855 SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE
, @ltmp
);
856 e_WriteLog(Format('stencil buffer size: %d', [ltmp
]), MSG_WARNING
);
857 gwin_has_stencil
:= (ltmp
> 0);
861 gwin_has_stencil
:= false;
864 if not glHasExtension('GL_ARB_texture_non_power_of_two') then
866 e_WriteLog('Driver DID''T advertised NPOT textures support', MSG_WARNING
);
867 glLegacyNPOT
:= true;
871 e_WriteLog('Driver advertised NPOT textures support', MSG_NOTIFY
);
872 glLegacyNPOT
:= false;
874 gwin_dump_extensions
:= false;
877 Time_Old
:= GetTimer();
880 if ParamCount
> 0 then
881 g_Game_Process_Params();
884 if (not gGameOn
) and gAskLanguage
then
885 g_Menu_AskLanguage();
887 e_WriteLog('Entering the main loop', MSG_NOTIFY
);
889 while not ProcessMessage() do