16085cead25ca40398edda2a2a43bb8a4b6f51e6
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, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../shared/a_modes.inc}
27 procedure KeyPress (K
: Word);
28 procedure CharPress (C
: AnsiChar);
35 {--- Read-only dirs ---}
42 AllMapDirs
: SSArray
; // Maps + Megawads
44 {--- Read-Write dirs ---}
50 ScreenshotDirs
: SSArray
;
51 MapDownloadDirs
: SSArray
;
52 WadDownloadDirs
: SSArray
;
57 {$INCLUDE ../nogl/noGLuses.inc}
58 {$IFDEF ENABLE_HOLMES}
59 g_holmes
, sdlcarcass
, fui_ctls
, fui_wadread
, fui_style
, fui_gfx_gl
,
67 wadreader
, e_log
, g_window
,
68 e_graphics
, e_input
, g_game
, g_console
, g_gui
,
69 e_sound
, g_options
, g_sound
, g_player
, g_basic
,
70 g_weapons
, SysUtils
, g_triggers
, MAPDEF
, g_map
, e_res
,
71 g_menu
, g_language
, g_net
, g_touch
, g_system
, g_res_downloader
,
77 charbuff
: packed array [0..15] of AnsiChar;
78 binPath
: AnsiString = '';
79 forceCurrentDir
: Boolean = false;
82 function GetBinaryPath (): AnsiString;
89 result
:= ExtractFilePath(ParamStr(0));
91 // it may be a symlink; do some guesswork here
92 sl
:= fpReadLink(ExtractFileName(ParamStr(0)));
93 if (sl
= ParamStr(0)) then
95 // use current directory, as we don't have anything better
100 result
:= fixSlashes(result
);
101 if (length(result
) > 0) and (result
[length(result
)] <> '/') then result
:= result
+'/';
104 procedure PrintDirs (msg
: AnsiString; dirs
: SSArray
);
107 e_LogWriteln(msg
+ ':');
109 e_LogWriteln(' ' + dir
);
113 var i
: Integer; rwdir
, rodir
: AnsiString; rwdirs
, rodirs
: SSArray
;
114 //first: Boolean = true;
116 procedure xput (s
: AnsiString);
121 AssignFile(f, 'zzz.log');
138 procedure AddPath (var arr
: SSArray
; str
: AnsiString; usecwd
: Boolean=true);
142 if (length(str
) = 0) then exit
;
143 //writeln('NEW PATH(0): ['+str+']');
144 if (forceCurrentDir
or usecwd
) then
146 str
:= fixSlashes(ExpandFileName(str
));
150 str
:= fixSlashes(str
);
151 if (not isAbsolutePath(str
)) then str
:= binPath
+str
;
152 while (length(str
) > 0) do
154 if (isRootPath(str
)) then exit
;
155 if (str
[length(str
)] = '/') then begin Delete(str
, length(str
), 1); continue
; end;
156 if (length(str
) >= 2) and (Copy(str
, length(str
)-1, 2) = '/.') then begin Delete(str
, length(str
)-1, 2); continue
; end;
160 if (length(str
) = 0) then exit
;
161 if (length(str
) > 255) then
163 xput('path too long: ['+str
+']');
164 raise Exception
.Create(Format('path "%s" too long', [str
]));
168 //writeln('<<<', ss, '>>> : [', str, ']');
169 if (ss
= str
) then exit
;
171 SetLength(arr
, Length(arr
)+1);
172 //arr[High(arr)] := ExpandFileName(str);
173 arr
[High(arr
)] := str
;
174 //writeln('NEW PATH(1): ['+str+']');
177 procedure AddDef (var dirs
: SSArray
; base
: SSArray
; append
: AnsiString);
180 if Length(dirs
) = 0 then
182 AddPath(dirs
, e_CatPath(s
, append
), false)
185 procedure AddDir (var dirs
: SSArray
; append
: AnsiString);
187 SetLength(dirs
, Length(dirs
) + 1);
188 dirs
[High(dirs
)] := append
191 function GetDefaultRODirs (): SSArray
;
193 var home
: AnsiString;
197 AddDir(result
, SDL_GetBasePath());
198 AddDir(result
, SDL_GetPrefPath('', 'doom2df'));
201 AddDir(result
, '/usr/share/doom2df');
202 AddDir(result
, '/usr/local/share/doom2df');
203 home
:= GetEnvironmentVariable('HOME');
205 AddDir(result
, e_CatPath(home
, '.doom2df'));
207 {$IF DEFINED(ANDROID) AND DEFINED(USE_SDL2)}
208 AddDir(result
, SDL_AndroidGetInternalStoragePath());
209 if SDL_AndroidGetExternalStorageState() <> 0 then
210 AddDir(result
, SDL_AndroidGetExternalStoragePath());
215 function GetDefaultRWDirs (): SSArray
;
217 var home
: AnsiString;
220 {$IF DEFINED(USE_SDL2)}
221 AddDir(result
, SDL_GetPrefPath('', 'doom2df'));
224 home
:= GetEnvironmentVariable('HOME');
226 AddDir(result
, e_CatPath(home
, '.doom2df'));
228 {$IF DEFINED(ANDROID) AND DEFINED(USE_SDL2)}
229 if SDL_AndroidGetExternalStorageState() <> 0 then
230 AddDir(result
, SDL_AndroidGetExternalStoragePath());
236 //GetDir(0, GameDir);
237 binPath
:= GetBinaryPath();
238 xput('binPath=['+binPath
+']');
240 for i
:= 1 to ParamCount
do
242 if (ParamStr(i
) = '--cwd') then
244 forceCurrentDir
:= true;
250 while i
< ParamCount
do
256 rwdir
:= ParamStr(i
);
258 AddPath(LogDirs
, e_CatPath(rwdir
, ''));
259 AddPath(SaveDirs
, e_CatPath(rwdir
, 'data'));
260 AddPath(CacheDirs
, e_CatPath(rwdir
, 'data/cache'));
261 AddPath(ConfigDirs
, e_CatPath(rwdir
, ''));
262 AddPath(MapDownloadDirs
, e_CatPath(rwdir
, 'maps/downloads'));
263 AddPath(WadDownloadDirs
, e_CatPath(rwdir
, 'wads/downloads'));
264 AddPath(ScreenshotDirs
, e_CatPath(rwdir
, 'screenshots'));
266 AddPath(DataDirs
, e_CatPath(rwdir
, 'data'));
267 AddPath(ModelDirs
, e_CatPath(rwdir
, 'data/models'));
268 AddPath(MegawadDirs
, e_CatPath(rwdir
, 'maps/megawads'));
269 AddPath(MapDirs
, e_CatPath(rwdir
, 'maps'));
270 AddPath(WadDirs
, e_CatPath(rwdir
, 'wads'));
275 rodir
:= ParamStr(i
);
277 AddPath(DataDirs
, e_CatPath(rodir
, 'data'));
278 AddPath(ModelDirs
, e_CatPath(rodir
, 'data/models'));
279 AddPath(MegawadDirs
, e_CatPath(rodir
, 'maps/megawads'));
280 AddPath(MapDirs
, e_CatPath(rodir
, 'maps'));
281 AddPath(WadDirs
, e_CatPath(rodir
, 'wads'));
288 rodirs
:= GetDefaultRODirs();
289 AddDef(DataDirs
, rodirs
, 'data');
290 AddDef(ModelDirs
, rodirs
, 'data/models');
291 AddDef(MegawadDirs
, rodirs
, 'maps/megawads');
292 AddDef(MapDirs
, rodirs
, 'maps');
293 AddDef(WadDirs
, rodirs
, 'wads');
296 rwdirs
:= GetDefaultRWDirs();
297 AddDef(LogDirs
, rwdirs
, '');
298 AddDef(SaveDirs
, rwdirs
, 'data');
299 AddDef(CacheDirs
, rwdirs
, 'data/cache');
300 AddDef(ConfigDirs
, rwdirs
, '');
301 AddDef(MapDownloadDirs
, rwdirs
, 'maps/downloads');
302 AddDef(WadDownloadDirs
, rwdirs
, 'wads/downloads');
303 AddDef(ScreenshotDirs
, rwdirs
, 'screenshots');
305 for i
:= 0 to High(MapDirs
) do
306 AddPath(AllMapDirs
, MapDirs
[i
]);
307 for i
:= 0 to High(MegawadDirs
) do
308 AddPath(AllMapDirs
, MegawadDirs
[i
]);
310 if LogFileName
= '' then
312 rwdir
:= e_GetWriteableDir(LogDirs
, false);
316 LogFileName
:= e_CatPath(rwdir
, 'Doom2DF_H.log');
318 LogFileName
:= e_CatPath(rwdir
, 'Doom2DF.log');
323 xput('binPath=['+binPath
+']');
327 {$IF DEFINED(ANDROID) AND DEFINED(USE_SDLMIXER)}
328 var timiditycfg
: AnsiString;
333 conbufDumpToStdOut
:= true;
335 for i
:= 1 to ParamCount
do
337 if (ParamStr(i
) = '--con-stdout') then
339 conbufDumpToStdOut
:= true;
344 if LogFileName
<> '' then
345 e_InitLog(LogFileName
, TWriteMode
.WM_NEWFILE
);
346 e_InitWritelnDriver();
347 e_WriteLog('Doom 2D: Forever version ' + GAME_VERSION
+ ' proto ' + IntToStr(NET_PROTOCOL_VER
), TMsgType
.Notify
);
348 e_WriteLog('Build date: ' + GAME_BUILDDATE
+ ' ' + GAME_BUILDTIME
, TMsgType
.Notify
);
350 e_LogWritefln('BINARY PATH: [%s]', [binPath
], TMsgType
.Notify
);
352 PrintDirs('DataDirs', DataDirs
);
353 PrintDirs('ModelDirs', ModelDirs
);
354 PrintDirs('MegawadDirs', MegawadDirs
);
355 PrintDirs('MapDirs', MapDirs
);
356 PrintDirs('WadDirs', WadDirs
);
358 PrintDirs('LogDirs', LogDirs
);
359 PrintDirs('SaveDirs', SaveDirs
);
360 PrintDirs('CacheDirs', CacheDirs
);
361 PrintDirs('ConfigDirs', ConfigDirs
);
362 PrintDirs('ScreenshotDirs', ScreenshotDirs
);
363 PrintDirs('MapDownloadDirs', MapDownloadDirs
);
364 PrintDirs('WadDownloadDirs', WadDownloadDirs
);
366 GameWAD
:= e_FindWad(DataDirs
, 'GAME');
369 e_WriteLog('GAME.WAD not installed?', TMsgType
.Fatal
);
371 SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR
, 'Doom 2D Forever', 'GAME.WAD not installed?', nil);
376 {$IF DEFINED(ANDROID) AND DEFINED(USE_SDLMIXER)}
377 timiditycfg
:= 'timidity.cfg';
378 if e_FindResource(ConfigDirs
, timiditycfg
) = true then
380 timiditycfg
:= ExpandFileName(timiditycfg
);
381 SetEnvVar('TIMIDITY_CFG', timiditycfg
);
382 e_LogWritefln('Set TIMIDITY_CFG = "%s"', [timiditycfg
]);
388 {$IFDEF ENABLE_HOLMES}
389 var flexloaded
: Boolean;
398 s
:= CONFIG_FILENAME
;
399 if e_FindResource(ConfigDirs
, s
) = true then
405 g_Options_SetDefault
;
406 g_Options_SetDefaultVideo
408 if sys_SetDisplayMode(gScreenWidth
, gScreenHeight
, gBPP
, gFullScreen
) = False then
409 raise Exception
.Create('Failed to set videomode on startup.');
412 e_WriteLog(gLanguage
, TMsgType
.Notify
);
413 g_Language_Set(gLanguage
);
415 {$IF not DEFINED(HEADLESS) and DEFINED(ENABLE_HOLMES)}
417 if not fuiAddWad('flexui.wad') then
419 if not fuiAddWad('./data/flexui.wad') then fuiAddWad('./flexui.wad');
422 fuiGfxLoadFont('win8', 'flexui/fonts/win8.fuifont');
423 fuiGfxLoadFont('win14', 'flexui/fonts/win14.fuifont');
424 fuiGfxLoadFont('win16', 'flexui/fonts/win16.fuifont');
425 fuiGfxLoadFont('dos8', 'flexui/fonts/dos8.fuifont');
426 fuiGfxLoadFont('msx6', 'flexui/fonts/msx6.fuifont');
427 except on e
: Exception
do
429 writeln('ERROR loading FlexUI fonts');
442 e_LogWriteln('FlexUI: loading stylesheet...');
443 uiLoadStyles('flexui/widgets.wgs');
444 except on e
: TParserException
do
446 writeln('ERROR at (', e
.tokLine
, ',', e
.tokCol
, '): ', e
.message);
457 g_holmes_imfunctional
:= not flexloaded
;
459 if (not g_holmes_imfunctional
) then
462 uiContext
.font
:= 'win14';
465 if assigned(oglInitCB
) then oglInitCB
;
468 //g_Res_CreateDatabases(true); // it will be done before connecting to the server for the first time
470 e_WriteLog('Entering SDLMain', TMsgType
.Notify
);
476 {$IFDEF ENABLE_HOLMES}
477 if assigned(oglDeinitCB
) then oglDeinitCB
;
490 {$IFDEF USE_SDLMIXER}
491 NoSound
:= False; // hope env has set SDL_AUDIODRIVER to dummy
493 NoSound
:= True; // FMOD backend will sort it out
502 if (e_JoysticksAvailable > 0) then
503 e_WriteLog('Input: Joysticks available.', TMsgType.Notify)
505 e_WriteLog('Input: No Joysticks.', TMsgType.Notify);
508 if (not gNoSound
) then
510 e_WriteLog('Initializing sound system', TMsgType
.Notify
);
511 e_InitSoundSystem(NoSound
);
514 e_WriteLog('Init game', TMsgType
.Notify
);
517 FillChar(charbuff
, sizeof(charbuff
), ' ');
523 e_WriteLog('Releasing engine', TMsgType
.Notify
);
526 e_WriteLog('Releasing input', TMsgType
.Notify
);
531 e_WriteLog('Releasing sound', TMsgType
.Notify
);
532 e_ReleaseSoundSystem();
549 function Translit (const S
: AnsiString): AnsiString;
554 for i
:= 1 to Length(Result
) do
557 'É': Result
[i
] := 'Q';
558 'Ö': Result
[i
] := 'W';
559 'Ó': Result
[i
] := 'E';
560 'Ê': Result
[i
] := 'R';
561 'Å': Result
[i
] := 'T';
562 'Í': Result
[i
] := 'Y';
563 'Ã': Result
[i
] := 'U';
564 'Ø': Result
[i
] := 'I';
565 'Ù': Result
[i
] := 'O';
566 'Ç': Result
[i
] := 'P';
567 'Õ': Result
[i
] := '['; //Chr(219);
568 'Ú': Result
[i
] := ']'; //Chr(221);
569 'Ô': Result
[i
] := 'A';
570 'Û': Result
[i
] := 'S';
571 'Â': Result
[i
] := 'D';
572 'À': Result
[i
] := 'F';
573 'Ï': Result
[i
] := 'G';
574 'Ð': Result
[i
] := 'H';
575 'Î': Result
[i
] := 'J';
576 'Ë': Result
[i
] := 'K';
577 'Ä': Result
[i
] := 'L';
578 'Æ': Result
[i
] := ';'; //Chr(186);
579 'Ý': Result
[i
] := #39; //Chr(222);
580 'ß': Result
[i
] := 'Z';
581 '×': Result
[i
] := 'X';
582 'Ñ': Result
[i
] := 'C';
583 'Ì': Result
[i
] := 'V';
584 'È': Result
[i
] := 'B';
585 'Ò': Result
[i
] := 'N';
586 'Ü': Result
[i
] := 'M';
587 'Á': Result
[i
] := ','; //Chr(188);
588 'Þ': Result
[i
] := '.'; //Chr(190);
594 function CheckCheat (ct
: TStrings_Locale
; eofs
: Integer=0): Boolean;
599 ls2
:= Translit(CheatRus
[ct
]);
600 if length(ls1
) = 0 then ls1
:= '~';
601 if length(ls2
) = 0 then ls2
:= '~';
603 (Copy(charbuff
, 17-Length(ls1
)-eofs
, Length(ls1
)) = ls1
) or
604 (Translit(Copy(charbuff
, 17-Length(ls1
)-eofs
, Length(ls1
))) = ls1
) or
605 (Copy(charbuff
, 17-Length(ls2
)-eofs
, Length(ls2
)) = ls2
) or
606 (Translit(Copy(charbuff
, 17-Length(ls2
)-eofs
, Length(ls2
))) = ls2
);
608 if ct = I_GAME_CHEAT_JETPACK then
610 e_WriteLog('ls1: ['+ls1+']', MSG_NOTIFY);
611 e_WriteLog('ls2: ['+ls2+']', MSG_NOTIFY);
612 e_WriteLog('bf0: ['+Copy(charbuff, 17-Length(ls1)-eofs, Length(ls1))+']', MSG_NOTIFY);
613 e_WriteLog('bf1: ['+Translit(Copy(charbuff, 17-Length(ls1)-eofs, Length(ls1)))+']', MSG_NOTIFY);
614 e_WriteLog('bf2: ['+Copy(charbuff, 17-Length(ls2)-eofs, Length(ls2))+']', MSG_NOTIFY);
615 e_WriteLog('bf3: ['+Translit(Copy(charbuff, 17-Length(ls2)-eofs, Length(ls2)))+']', MSG_NOTIFY);
632 if (not gGameOn) or (not gCheats) or ((gGameSettings.GameType <> GT_SINGLE) and
633 (gGameSettings.GameMode <> GM_COOP) and (not gDebugMode))
634 or g_Game_IsNet then Exit;
636 if not gGameOn
then exit
;
637 if not conIsCheatsEnabled
then exit
;
639 s
:= 'SOUND_GAME_RADIO';
642 if CheckCheat(I_GAME_CHEAT_GODMODE
) then
644 if gPlayer1
<> nil then gPlayer1
.GodMode
:= not gPlayer1
.GodMode
;
645 if gPlayer2
<> nil then gPlayer2
.GodMode
:= not gPlayer2
.GodMode
;
649 if CheckCheat(I_GAME_CHEAT_WEAPONS
) then
651 if gPlayer1
<> nil then gPlayer1
.AllRulez(False);
652 if gPlayer2
<> nil then gPlayer2
.AllRulez(False);
656 if CheckCheat(I_GAME_CHEAT_HEALTH
) then
658 if gPlayer1
<> nil then gPlayer1
.AllRulez(True);
659 if gPlayer2
<> nil then gPlayer2
.AllRulez(True);
663 if CheckCheat(I_GAME_CHEAT_DEATH
) then
665 if gPlayer1
<> nil then gPlayer1
.Damage(CHEAT_DAMAGE
, 0, 0, 0, HIT_TRAP
);
666 if gPlayer2
<> nil then gPlayer2
.Damage(CHEAT_DAMAGE
, 0, 0, 0, HIT_TRAP
);
667 s
:= 'SOUND_MONSTER_HAHA';
671 if CheckCheat(I_GAME_CHEAT_DOORS
) then
673 g_Triggers_OpenAll();
677 if CheckCheat(I_GAME_CHEAT_NEXTMAP
) then
679 if gTriggers
<> nil then
680 for a
:= 0 to High(gTriggers
) do
681 if gTriggers
[a
].TriggerType
= TRIGGER_EXIT
then
683 gExitByTrigger
:= True;
684 //g_Game_ExitLevel(gTriggers[a].Data.MapName);
685 g_Game_ExitLevel(gTriggers
[a
].tgcMap
);
691 s2
:= Copy(charbuff
, 15, 2);
692 if CheckCheat(I_GAME_CHEAT_CHANGEMAP
, 2) and (s2
[1] >= '0') and (s2
[1] <= '9') and (s2
[2] >= '0') and (s2
[2] <= '9') then
694 if g_Map_Exist(gGameSettings
.WAD
+ ':\MAP' + s2
) then
702 if CheckCheat(I_GAME_CHEAT_FLY
) then
708 if CheckCheat(I_GAME_CHEAT_JUMPS
) then
710 VEL_JUMP
:= 30-VEL_JUMP
;
714 if CheckCheat(I_GAME_CHEAT_SPEED
) then
716 MAX_RUNVEL
:= 32-MAX_RUNVEL
;
720 if CheckCheat(I_GAME_CHEAT_SUIT
) then
722 if gPlayer1
<> nil then gPlayer1
.GiveItem(ITEM_SUIT
);
723 if gPlayer2
<> nil then gPlayer2
.GiveItem(ITEM_SUIT
);
727 if CheckCheat(I_GAME_CHEAT_AIR
) then
729 if gPlayer1
<> nil then gPlayer1
.GiveItem(ITEM_OXYGEN
);
730 if gPlayer2
<> nil then gPlayer2
.GiveItem(ITEM_OXYGEN
);
734 if CheckCheat(I_GAME_CHEAT_BERSERK
) then
736 if gPlayer1
<> nil then gPlayer1
.GiveItem(ITEM_MEDKIT_BLACK
);
737 if gPlayer2
<> nil then gPlayer2
.GiveItem(ITEM_MEDKIT_BLACK
);
741 if CheckCheat(I_GAME_CHEAT_JETPACK
) then
743 if gPlayer1
<> nil then gPlayer1
.GiveItem(ITEM_JETPACK
);
744 if gPlayer2
<> nil then gPlayer2
.GiveItem(ITEM_JETPACK
);
748 if CheckCheat(I_GAME_CHEAT_NOCLIP
) then
750 if gPlayer1
<> nil then gPlayer1
.SwitchNoClip
;
751 if gPlayer2
<> nil then gPlayer2
.SwitchNoClip
;
755 if CheckCheat(I_GAME_CHEAT_NOTARGET
) then
757 if gPlayer1
<> nil then gPlayer1
.NoTarget
:= not gPlayer1
.NoTarget
;
758 if gPlayer2
<> nil then gPlayer2
.NoTarget
:= not gPlayer2
.NoTarget
;
762 if CheckCheat(I_GAME_CHEAT_NORELOAD
) then
764 if gPlayer1
<> nil then gPlayer1
.NoReload
:= not gPlayer1
.NoReload
;
765 if gPlayer2
<> nil then gPlayer2
.NoReload
:= not gPlayer2
.NoReload
;
768 if CheckCheat(I_GAME_CHEAT_AIMLINE
) then
770 gAimLine
:= not gAimLine
;
773 if CheckCheat(I_GAME_CHEAT_AUTOMAP
) then
775 gShowMap
:= not gShowMap
;
785 procedure KeyPress (K
: Word);
795 if (g_ActiveWindow
<> nil) then
797 Msg
.Msg
:= WM_KEYDOWN
;
798 Msg
.WParam
:= VK_ESCAPE
;
799 g_ActiveWindow
.OnMessage(Msg
);
800 if (not g_Game_IsNet
) and (g_ActiveWindow
= nil) then g_Game_Pause(false); //Fn loves to do this
802 else if (gState
<> STATE_FOLD
) then
804 if gGameOn
or (gState
= STATE_INTERSINGLE
) or (gState
= STATE_INTERCUSTOM
) then
806 g_Game_InGameMenu(True);
808 else if (gExit
= 0) and (gState
<> STATE_SLIST
) then
810 if (gState
<> STATE_MENU
) then
812 if (NetMode
<> NET_NONE
) then
814 g_Game_StopAllSounds(True);
816 gState
:= STATE_MENU
;
820 g_GUI_ShowWindow('MainMenu');
821 g_Sound_PlayEx('MENU_OPEN');
826 IK_F2
, IK_F3
, IK_F4
, IK_F5
, IK_F6
, IK_F7
, IK_F10
:
827 begin // <F2> .. <F6> � <F12>
828 if gGameOn
and (not gConsoleShow
) and (not gChatShow
) then
830 while (g_ActiveWindow
<> nil) do g_GUI_HideWindow(False);
831 if (not g_Game_IsNet
) then g_Game_Pause(True);
833 IK_F2
: g_Menu_Show_SaveMenu();
834 IK_F3
: g_Menu_Show_LoadMenu();
835 IK_F4
: g_Menu_Show_GameSetGame();
836 IK_F5
: g_Menu_Show_OptionsVideo();
837 IK_F6
: g_Menu_Show_OptionsSound();
838 IK_F7
: g_Menu_Show_EndGameMenu();
839 IK_F10
: g_Menu_Show_QuitGameMenu();
846 gJustChatted
:= False;
847 if gConsoleShow
or gChatShow
then
849 g_Console_Control(K
);
851 else if (g_ActiveWindow
<> nil) then
853 Msg
.Msg
:= WM_KEYDOWN
;
855 g_ActiveWindow
.OnMessage(Msg
);
857 else if (gState
= STATE_MENU
) then
859 g_GUI_ShowWindow('MainMenu');
860 g_Sound_PlayEx('MENU_OPEN');
868 procedure CharPress (C
: AnsiChar);
873 if gConsoleShow
or gChatShow
then
877 else if (g_ActiveWindow
<> nil) then
880 Msg
.WParam
:= Ord(C
);
881 g_ActiveWindow
.OnMessage(Msg
);
885 for a
:= 0 to 14 do charbuff
[a
] := charbuff
[a
+1];
886 charbuff
[15] := upcase1251(C
);