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}
21 procedure g_Console_Init();
22 procedure g_Console_Update();
23 procedure g_Console_Draw();
24 procedure g_Console_Switch();
25 procedure g_Console_Char(C
: Char);
26 procedure g_Console_Control(K
: Word);
27 procedure g_Console_Process(L
: String; Quiet
: Boolean = False);
28 procedure g_Console_Add(L
: String; Show
: Boolean = False);
29 procedure g_Console_Clear();
30 function g_Console_CommandBlacklisted(C
: String): Boolean;
32 procedure g_Console_Chat_Switch(Team
: Boolean = False);
35 gConsoleShow
: Boolean; // True - êîíñîëü îòêðûòà èëè îòêðûâàåòñÿ
37 gChatTeam
: Boolean = False;
38 gAllowConsoleMessages
: Boolean = True;
39 gChatEnter
: Boolean = True;
40 gJustChatted
: Boolean = False; // ÷òîáû àäìèí â èíòåðå ÷àòÿñü íå ïðîìàòûâàë ñòàòèñòèêó
45 g_textures
, g_main
, e_graphics
, e_input
, g_game
,
46 SysUtils
, g_basic
, g_options
, wadreader
, Math
,
47 g_menu
, g_language
, g_net
, g_netmsg
, e_log
, conbuf
;
50 TCmdProc
= procedure (P
: SArray
);
66 MaxScriptRecursion
= 16;
68 DEBUG_STRING
= 'DEBUG MODE';
72 RecursionDepth
: Word = 0;
73 RecursionLimitHit
: Boolean = False;
75 Cons_Shown
: Boolean; // Ðèñîâàòü ëè êîíñîëü?
78 //ConsoleHistory: SArray;
79 CommandHistory
: SArray
;
81 Commands
: Array of TCommand
;
82 Aliases
: Array of TAlias
;
84 conSkipLines
: Integer = 0;
85 MsgArray
: Array [0..4] of record
90 function GetStrACmd(var Str
: String): String;
95 for a
:= 1 to Length(Str
) do
96 if (a
= Length(Str
)) or (Str
[a
+1] = ';') then
98 Result
:= Copy(Str
, 1, a
);
105 function ParseAlias(Str
: String): SArray
;
116 SetLength(Result
, Length(Result
)+1);
117 Result
[High(Result
)] := GetStrACmd(Str
);
121 procedure ConsoleCommands(P
: SArray
);
127 Cmd
:= LowerCase(P
[0]);
130 if Cmd
= 'clear' then
132 //ConsoleHistory := nil;
136 for a
:= 0 to High(MsgArray
) do
144 if Cmd
= 'clearhistory' then
145 CommandHistory
:= nil;
147 if Cmd
= 'showhistory' then
148 if CommandHistory
<> nil then
151 for a
:= 0 to High(CommandHistory
) do
152 g_Console_Add(' '+CommandHistory
[a
]);
155 if Cmd
= 'commands' then
158 g_Console_Add('Commands list:');
159 for a
:= High(Commands
) downto 0 do
160 g_Console_Add(' '+Commands
[a
].Cmd
);
164 g_Console_Add(TimeToStr(Now
), True);
167 g_Console_Add(DateToStr(Now
), True);
170 if Length(P
) > 1 then
172 if P
[1] = 'ololo' then
177 for a
:= 1 to High(P
) do
179 g_Console_Add(b_Text_Format(s
), True);
188 if ConsoleHistory <> nil then
190 if Length(P) > 1 then
193 s := GameDir+'/console.txt';
198 if IOResult <> 0 then
200 g_Console_Add(Format(_lc[I_CONSOLE_ERROR_WRITE], [s]));
205 for a := 0 to High(ConsoleHistory) do
206 WriteLn(F, ConsoleHistory[a]);
209 g_Console_Add(Format(_lc[I_CONSOLE_DUMPED], [s]));
218 if Length(P
) > 1 then
220 s
:= GameDir
+'/'+P
[1];
225 if IOResult
<> 0 then
227 g_Console_Add(Format(_lc
[I_CONSOLE_ERROR_READ
], [s
]));
231 g_Console_Add(Format(_lc
[I_CONSOLE_EXEC
], [s
]));
236 if IOResult
<> 0 then
238 g_Console_Add(Format(_lc
[I_CONSOLE_ERROR_READ
], [s
]));
242 if Pos('#', s
) <> 1 then // script comment
244 // prevents endless loops
246 RecursionLimitHit
:= (RecursionDepth
> MaxScriptRecursion
) or RecursionLimitHit
;
247 if not RecursionLimitHit
then
248 g_Console_Process(s
, True);
252 if (RecursionDepth
= 0) and RecursionLimitHit
then
254 g_Console_Add(Format(_lc
[I_CONSOLE_ERROR_CALL
], [s
]));
255 RecursionLimitHit
:= False;
262 g_Console_Add('exec <script file>');
265 if Cmd
= 'alias' then
267 // alias [alias_name] [commands]
268 if Length(P
) > 1 then
270 for a
:= 0 to High(Aliases
) do
271 if Aliases
[a
].Name
= P
[1] then
273 if Length(P
) > 2 then
274 Aliases
[a
].Commands
:= ParseAlias(P
[2])
276 for b
:= 0 to High(Aliases
[a
].Commands
) do
277 g_Console_Add(Aliases
[a
].Commands
[b
]);
280 SetLength(Aliases
, Length(Aliases
)+1);
282 Aliases
[a
].Name
:= P
[1];
283 if Length(P
) > 2 then
284 Aliases
[a
].Commands
:= ParseAlias(P
[2])
286 for b
:= 0 to High(Aliases
[a
].Commands
) do
287 g_Console_Add(Aliases
[a
].Commands
[b
]);
289 for a
:= 0 to High(Aliases
) do
290 if Aliases
[a
].Commands
<> nil then
291 g_Console_Add(Aliases
[a
].Name
);
297 if Length(P
) > 1 then
299 if Aliases
= nil then
301 for a
:= 0 to High(Aliases
) do
302 if Aliases
[a
].Name
= P
[1] then
304 if Aliases
[a
].Commands
<> nil then
306 // with this system proper endless loop detection seems either impossible
307 // or very dirty to implement, so let's have this instead
308 // prevents endless loops
309 for b
:= 0 to High(Aliases
[a
].Commands
) do
312 RecursionLimitHit
:= (RecursionDepth
> MaxScriptRecursion
) or RecursionLimitHit
;
313 if not RecursionLimitHit
then
314 g_Console_Process(Aliases
[a
].Commands
[b
], True);
317 if (RecursionDepth
= 0) and RecursionLimitHit
then
319 g_Console_Add(Format(_lc
[I_CONSOLE_ERROR_CALL
], [s
]));
320 RecursionLimitHit
:= False;
327 g_Console_Add('call <alias name>');
331 procedure WhitelistCommand(Cmd
: string);
335 SetLength(Whitelist
, Length(Whitelist
)+1);
336 a
:= High(Whitelist
);
340 procedure AddCommand(Cmd
: String; Proc
: TCmdProc
);
344 SetLength(Commands
, Length(Commands
)+1);
346 Commands
[a
].Cmd
:= Cmd
;
347 Commands
[a
].Proc
:= Proc
;
350 procedure g_Console_Init();
354 g_Texture_CreateWAD(ID
, GameWAD
+':TEXTURES\CONSOLE');
355 Cons_Y
:= -(gScreenHeight
div 2);
356 gConsoleShow
:= False;
361 for a
:= 0 to High(MsgArray
) do
368 AddCommand('clear', ConsoleCommands
);
369 AddCommand('clearhistory', ConsoleCommands
);
370 AddCommand('showhistory', ConsoleCommands
);
371 AddCommand('commands', ConsoleCommands
);
372 AddCommand('time', ConsoleCommands
);
373 AddCommand('date', ConsoleCommands
);
374 AddCommand('echo', ConsoleCommands
);
375 AddCommand('dump', ConsoleCommands
);
376 AddCommand('exec', ConsoleCommands
);
377 AddCommand('alias', ConsoleCommands
);
378 AddCommand('call', ConsoleCommands
);
380 AddCommand('d_window', DebugCommands
);
381 AddCommand('d_sounds', DebugCommands
);
382 AddCommand('d_frames', DebugCommands
);
383 AddCommand('d_winmsg', DebugCommands
);
384 AddCommand('d_monoff', DebugCommands
);
385 AddCommand('d_botoff', DebugCommands
);
386 AddCommand('d_monster', DebugCommands
);
387 AddCommand('d_health', DebugCommands
);
388 AddCommand('d_player', DebugCommands
);
389 AddCommand('d_joy', DebugCommands
);
391 AddCommand('dpp', ProfilerCommands
);
392 AddCommand('dpu', ProfilerCommands
);
393 AddCommand('dpc', ProfilerCommands
);
394 AddCommand('r_gridrender', ProfilerCommands
);
395 AddCommand('dbg_coldet_grid', ProfilerCommands
);
397 AddCommand('t_dump_node_queries', ProfilerCommands
);
399 AddCommand('sq_use_grid', ProfilerCommands
);
400 AddCommand('sq_use_tree', ProfilerCommands
);
402 AddCommand('p1_name', GameCVars
);
403 AddCommand('p2_name', GameCVars
);
404 AddCommand('p1_color', GameCVars
);
405 AddCommand('p2_color', GameCVars
);
406 AddCommand('r_showfps', GameCVars
);
407 AddCommand('r_showtime', GameCVars
);
408 AddCommand('r_showscore', GameCVars
);
409 AddCommand('r_showlives', GameCVars
);
410 AddCommand('r_showstat', GameCVars
);
411 AddCommand('r_showkillmsg', GameCVars
);
412 AddCommand('r_showspect', GameCVars
);
413 AddCommand('r_showping', GameCVars
);
414 AddCommand('g_gamemode', GameCVars
);
415 AddCommand('g_friendlyfire', GameCVars
);
416 AddCommand('g_weaponstay', GameCVars
);
417 AddCommand('g_allow_exit', GameCVars
);
418 AddCommand('g_allow_monsters', GameCVars
);
419 AddCommand('g_bot_vsmonsters', GameCVars
);
420 AddCommand('g_bot_vsplayers', GameCVars
);
421 AddCommand('g_scorelimit', GameCVars
);
422 AddCommand('g_timelimit', GameCVars
);
423 AddCommand('g_maxlives', GameCVars
);
424 AddCommand('g_warmuptime', GameCVars
);
425 AddCommand('net_interp', GameCVars
);
426 AddCommand('net_forceplayerupdate', GameCVars
);
427 AddCommand('net_predictself', GameCVars
);
428 AddCommand('sv_name', GameCVars
);
429 AddCommand('sv_passwd', GameCVars
);
430 AddCommand('sv_maxplrs', GameCVars
);
431 AddCommand('sv_public', GameCVars
);
432 AddCommand('sv_intertime', GameCVars
);
434 AddCommand('quit', GameCommands
);
435 AddCommand('exit', GameCommands
);
436 AddCommand('pause', GameCommands
);
437 AddCommand('endgame', GameCommands
);
438 AddCommand('restart', GameCommands
);
439 AddCommand('addbot', GameCommands
);
440 AddCommand('bot_add', GameCommands
);
441 AddCommand('bot_addlist', GameCommands
);
442 AddCommand('bot_addred', GameCommands
);
443 AddCommand('bot_addblue', GameCommands
);
444 AddCommand('bot_removeall', GameCommands
);
445 AddCommand('chat', GameCommands
);
446 AddCommand('teamchat', GameCommands
);
447 AddCommand('game', GameCommands
);
448 AddCommand('host', GameCommands
);
449 AddCommand('map', GameCommands
);
450 AddCommand('nextmap', GameCommands
);
451 AddCommand('endmap', GameCommands
);
452 AddCommand('goodbye', GameCommands
);
453 AddCommand('suicide', GameCommands
);
454 AddCommand('spectate', GameCommands
);
455 AddCommand('ready', GameCommands
);
456 AddCommand('kick', GameCommands
);
457 AddCommand('kick_id', GameCommands
);
458 AddCommand('ban', GameCommands
);
459 AddCommand('permban', GameCommands
);
460 AddCommand('ban_id', GameCommands
);
461 AddCommand('permban_id', GameCommands
);
462 AddCommand('unban', GameCommands
);
463 AddCommand('connect', GameCommands
);
464 AddCommand('disconnect', GameCommands
);
465 AddCommand('reconnect', GameCommands
);
466 AddCommand('say', GameCommands
);
467 AddCommand('tell', GameCommands
);
468 AddCommand('overtime', GameCommands
);
469 AddCommand('rcon_password', GameCommands
);
470 AddCommand('rcon', GameCommands
);
471 AddCommand('callvote', GameCommands
);
472 AddCommand('vote', GameCommands
);
473 AddCommand('clientlist', GameCommands
);
474 AddCommand('event', GameCommands
);
476 AddCommand('god', GameCheats
);
477 AddCommand('notarget', GameCheats
);
478 AddCommand('give', GameCheats
); // "exit" too ;-)
479 AddCommand('open', GameCheats
);
480 AddCommand('fly', GameCheats
);
481 AddCommand('noclip', GameCheats
);
482 AddCommand('speedy', GameCheats
);
483 AddCommand('jumpy', GameCheats
);
484 AddCommand('noreload', GameCheats
);
485 AddCommand('aimline', GameCheats
);
486 AddCommand('automap', GameCheats
);
488 WhitelistCommand('say');
489 WhitelistCommand('tell');
490 WhitelistCommand('overtime');
491 WhitelistCommand('ready');
492 WhitelistCommand('map');
493 WhitelistCommand('nextmap');
494 WhitelistCommand('endmap');
495 WhitelistCommand('restart');
496 WhitelistCommand('kick');
497 WhitelistCommand('ban');
499 WhitelistCommand('addbot');
500 WhitelistCommand('bot_add');
501 WhitelistCommand('bot_addred');
502 WhitelistCommand('bot_addblue');
503 WhitelistCommand('bot_removeall');
505 WhitelistCommand('g_gamemode');
506 WhitelistCommand('g_friendlyfire');
507 WhitelistCommand('g_weaponstay');
508 WhitelistCommand('g_allow_exit');
509 WhitelistCommand('g_allow_monsters');
510 WhitelistCommand('g_scorelimit');
511 WhitelistCommand('g_timelimit');
513 g_Console_Add(Format(_lc
[I_CONSOLE_WELCOME
], [GAME_VERSION
]));
517 procedure g_Console_Update();
523 // Â ïðîöåññå îòêðûòèÿ:
524 if gConsoleShow
and (Cons_Y
< 0) then
526 Cons_Y
:= Cons_Y
+Step
;
529 // Â ïðîöåññå çàêðûòèÿ:
530 if (not gConsoleShow
) and
531 (Cons_Y
> -(gScreenHeight
div 2)) then
532 Cons_Y
:= Cons_Y
-Step
;
534 // Îêîí÷àòåëüíî îòêðûëàñü:
538 // Îêîí÷àòåëüíî çàêðûëàñü:
539 if Cons_Y
<= (-(gScreenHeight
div 2)) then
541 Cons_Y
:= -(gScreenHeight
div 2);
547 while a
<= High(MsgArray
) do
549 if MsgArray
[a
].Time
> 0 then
551 if MsgArray
[a
].Time
= 1 then
553 if a
< High(MsgArray
) then
555 for b
:= a
to High(MsgArray
)-1 do
556 MsgArray
[b
] := MsgArray
[b
+1];
558 MsgArray
[High(MsgArray
)].Time
:= 0;
564 Dec(MsgArray
[a
].Time
);
572 procedure drawConsoleText ();
574 CWidth
, CHeight
: Byte;
579 procedure putLine (sp
, ep
: LongWord);
588 cw
:= e_TextureFontCharWidth(cbufAt(p
), gStdFont
);
589 if wdt
+cw
> gScreenWidth
-8 then break
;
590 //e_TextureFontPrintChar(X, Y: Integer; Ch: Char; FontID: DWORD; Shadow: Boolean = False);
594 if p
<> ep
then putLine(p
, ep
); // do rest of the line first
595 // now print our part
603 cw
:= e_TextureFontCharWidth(cbufAt(p
), gStdFont
);
604 e_TextureFontPrintCharEx(wdt
, ty
, cbufAt(p
), gStdFont
);
617 e_TextureFontGetSize(gStdFont
, CWidth
, CHeight
);
618 ty
:= (gScreenHeight
div 2)-4-2*CHeight
-Abs(Cons_Y
);
619 skip
:= conSkipLines
;
620 cbufLastLine(sp
, ep
);
623 if ty
+CHeight
<= 0 then break
;
624 until not cbufLineUp(sp
, ep
);
627 procedure g_Console_Draw();
629 CWidth
, CHeight
: Byte;
633 e_TextureFontGetSize(gStdFont
, CWidth
, CHeight
);
635 for a
:= 0 to High(MsgArray
) do
636 if MsgArray
[a
].Time
> 0 then
637 e_TextureFontPrintFmt(0, CHeight
*a
, MsgArray
[a
].Msg
,
640 if not Cons_Shown
then
646 e_TextureFontPrintEx(0, gScreenHeight
- CHeight
- 1, 'say team> ' + Line
,
647 gStdFont
, 255, 255, 255, 1, True);
648 e_TextureFontPrintEx((CPos
+ 9)*CWidth
, gScreenHeight
- CHeight
- 1, '_',
649 gStdFont
, 255, 255, 255, 1, True);
653 e_TextureFontPrintEx(0, gScreenHeight
- CHeight
- 1, 'say> ' + Line
,
654 gStdFont
, 255, 255, 255, 1, True);
655 e_TextureFontPrintEx((CPos
+ 4)*CWidth
, gScreenHeight
- CHeight
- 1, '_',
656 gStdFont
, 255, 255, 255, 1, True);
664 e_CharFont_GetSize(gMenuFont
, DEBUG_STRING
, mfW
, mfH
);
665 a
:= (gScreenWidth
- 2*mfW
) div 2;
666 b
:= Cons_Y
+ ((gScreenHeight
div 2) - 2*mfH
) div 2;
667 e_CharFont_PrintEx(gMenuFont
, a
div 2, b
div 2, DEBUG_STRING
,
668 _RGB(128, 0, 0), 2.0);
671 e_DrawSize(ID
, 0, Cons_Y
, Alpha
, False, False, gScreenWidth
, gScreenHeight
div 2);
672 e_TextureFontPrint(0, Cons_Y
+(gScreenHeight
div 2)-CHeight
-4, '> '+Line
, gStdFont
);
676 if ConsoleHistory <> nil then
680 if Length(ConsoleHistory) > ((gScreenHeight div 2) div CHeight)-1 then
681 b := Length(ConsoleHistory)-((gScreenHeight div 2) div CHeight)+1;
683 b := Max(b-Offset, 0);
684 d := Max(High(ConsoleHistory)-Offset, 0);
687 for a := d downto b do
689 e_TextureFontPrintFmt(0, (gScreenHeight div 2)-4-c*CHeight-Abs(Cons_Y), ConsoleHistory[a],
696 e_TextureFontPrint((CPos
+1)*CWidth
, Cons_Y
+(gScreenHeight
div 2)-21, '_', gStdFont
);
699 procedure g_Console_Switch();
701 if gChatShow
then Exit
;
702 gConsoleShow
:= not gConsoleShow
;
706 procedure g_Console_Chat_Switch(Team
: Boolean = False);
708 if gConsoleShow
then Exit
;
709 if not g_Game_IsNet
then Exit
;
710 gChatShow
:= not gChatShow
;
718 procedure g_Console_Char(C
: Char);
720 if gChatShow
and (not gChatEnter
) then
722 Insert(C
, Line
, CPos
);
726 procedure Complete();
736 for i
:= 0 to High(Commands
) do
737 if LowerCase(Line
) = LowerCase(Copy(Commands
[i
].Cmd
, 0, Length(Line
))) then
739 SetLength(t
, Length(t
) + 1);
740 t
[Length(t
)-1] := Commands
[i
].Cmd
;
746 if Length(t
) = 1 then
749 CPos
:= Length(Line
)+1;
754 for i
:= 0 to High(t
) do
755 g_Console_Add(' '+t
[i
]);
759 procedure g_Console_Control(K
: Word);
763 if (Length(Line
) > 0) and (CPos
> 1) then
765 Delete(Line
, CPos
-1, 1);
769 if (Length(Line
) > 0) and (CPos
<= Length(Line
)) then
770 Delete(Line
, CPos
, 1);
774 IK_RIGHT
, IK_KPRIGHT
:
775 if CPos
<= Length(Line
) then
777 IK_RETURN
, IK_KPRETURN
:
780 g_Console_Process(Line
)
784 if (Length(Line
) > 0) and g_Game_IsNet
then
788 if g_Game_IsClient
then
789 MC_SEND_Chat(b_Text_Format(Line
), NET_CHAT_TEAM
)
791 MH_SEND_Chat('[' + gPlayer1Settings
.Name
+ ']: ' + b_Text_Format(Line
),
792 NET_CHAT_TEAM
, gPlayer1Settings
.Team
);
796 if g_Game_IsClient
then
797 MC_SEND_Chat(b_Text_Format(Line
), NET_CHAT_PLAYER
)
799 MH_SEND_Chat('[' + gPlayer1Settings
.Name
+ ']: ' + b_Text_Format(Line
),
807 gJustChatted
:= True;
811 if not gChatShow
then
814 if not gChatShow
then
815 if (CommandHistory
<> nil) and
816 (CmdIndex
< Length(CommandHistory
)) then
818 if CmdIndex
< Length(CommandHistory
)-1 then
819 CmdIndex
:= CmdIndex
+ 1;
820 Line
:= CommandHistory
[CmdIndex
];
821 CPos
:= Length(Line
) + 1;
824 if not gChatShow
then
825 if (CommandHistory
<> nil) and
826 (CmdIndex
<= Length(CommandHistory
)) then
829 CmdIndex
:= CmdIndex
- 1;
830 Line
:= CommandHistory
[CmdIndex
];
831 Cpos
:= Length(Line
) + 1;
833 IK_PAGEUP
, IK_KPPAGEUP
: // PgUp
834 if not gChatShow
then Inc(conSkipLines
);
835 IK_PAGEDN
, IK_KPPAGEDN
: // PgDown
836 if not gChatShow
and (conSkipLines
> 0) then Dec(conSkipLines
);
840 CPos
:= Length(Line
) + 1;
844 function GetStr(var Str
: String): String;
851 for b
:= 1 to Length(Str
) do
852 if (b
= Length(Str
)) or (Str
[b
+1] = '"') then
854 Result
:= Copy(Str
, 2, b
-1);
861 for a
:= 1 to Length(Str
) do
862 if (a
= Length(Str
)) or (Str
[a
+1] = ' ') then
864 Result
:= Copy(Str
, 1, a
);
871 function ParseString(Str
: String): SArray
;
882 SetLength(Result
, Length(Result
)+1);
883 Result
[High(Result
)] := GetStr(Str
);
887 procedure g_Console_Add (L
: string; Show
: Boolean=false);
889 procedure conmsg (s
: AnsiString);
893 if length(s
) = 0 then exit
;
894 for a
:= 0 to High(MsgArray
) do
906 for a
:= 0 to High(MsgArray
)-1 do MsgArray
[a
] := MsgArray
[a
+1];
907 with MsgArray
[High(MsgArray
)] do
919 if (length(L
) = 0) or ((L
[length(L
)] <> #10) and (L
[length(L
)] <> #13)) then cbufPut(#10);
921 // now show 'em out of console too
922 Show
:= Show
and gAllowConsoleMessages
;
923 if Show
and gShowMessages
then
925 // Âûâîä ñòðîê ñ ïåðåíîñàìè ïî î÷åðåäè
926 while length(L
) > 0 do
929 if f
<= 0 then f
:= length(L
)+1;
930 conmsg(Copy(L
, 1, f
-1));
935 //SetLength(ConsoleHistory, Length(ConsoleHistory)+1);
936 //ConsoleHistory[High(ConsoleHistory)] := L;
940 e_WriteLog('CON: ' + L, MSG_NOTIFY);
945 procedure g_Console_Clear();
947 //ConsoleHistory := nil;
952 procedure AddToHistory(L
: String);
956 len
:= Length(CommandHistory
);
959 (LowerCase(CommandHistory
[len
-1]) <> LowerCase(L
)) then
961 SetLength(CommandHistory
, len
+1);
962 CommandHistory
[len
] := L
;
965 CmdIndex
:= Length(CommandHistory
);
968 function g_Console_CommandBlacklisted(C
: String): Boolean;
980 Arr
:= ParseString(C
);
984 for i
:= 0 to High(Whitelist
) do
985 if Whitelist
[i
] = LowerCase(Arr
[0]) then
989 procedure g_Console_Process(L
: String; Quiet
: Boolean = False);
999 conSkipLines
:= 0; // "unscroll"
1001 if L
= 'goobers' then
1006 g_Console_Add('Your memory serves you well.');
1012 g_Console_Add('> '+L
);
1017 Arr
:= ParseString(L
);
1021 if Commands
= nil then
1027 for i
:= 0 to High(Commands
) do
1028 if Commands
[i
].Cmd
= LowerCase(Arr
[0]) then
1029 if @Commands
[i
].Proc
<> nil then
1031 Commands
[i
].Proc(Arr
);
1035 g_Console_Add(Format(_lc
[I_CONSOLE_UNKNOWN
], [Arr
[0]]));