DEADSOFTWARE

put "{$MODE ...}" directive in each source file; removed trailing spaces, and convert...
[d2df-sdl.git] / src / game / g_console.pas
index 3c1603744276a18bd6bc36a39cf877a81f636657..8b9ef250a34b6c3fff8d245cd63acd70af04bdb0 100644 (file)
@@ -1,3 +1,4 @@
+{$MODE DELPHI}
 unit g_console;
 
 interface
@@ -27,8 +28,8 @@ implementation
 
 uses
   g_textures, g_main, e_graphics, e_input, g_game,
-  SysUtils, g_basic, g_options, WADEDITOR, Math,
-  g_menu, g_language, g_net, g_netmsg;
+  SysUtils, g_basic, g_options, wadreader, Math,
+  g_menu, g_language, g_net, g_netmsg, e_log;
 
 type
   TCmdProc = procedure (P: SArray);
@@ -75,6 +76,7 @@ function GetStrACmd(var Str: String): String;
 var
   a: Integer;
 begin
+  Result := '';
   for a := 1 to Length(Str) do
     if (a = Length(Str)) or (Str[a+1] = ';') then
     begin
@@ -108,6 +110,7 @@ var
   F: TextFile;
 begin
   Cmd := LowerCase(P[0]);
+  s := '';
 
   if Cmd = 'clear' then
   begin
@@ -440,6 +443,18 @@ begin
   AddCommand('clientlist', GameCommands);
   AddCommand('event', GameCommands);
 
+  AddCommand('god', GameCheats);
+  AddCommand('notarget', GameCheats);
+  AddCommand('give', GameCheats); // "exit" too ;-)
+  AddCommand('open', GameCheats);
+  AddCommand('fly', GameCheats);
+  AddCommand('noclip', GameCheats);
+  AddCommand('speedy', GameCheats);
+  AddCommand('jumpy', GameCheats);
+  AddCommand('noreload', GameCheats);
+  AddCommand('aimline', GameCheats);
+  AddCommand('automap', GameCheats);
+
   WhitelistCommand('say');
   WhitelistCommand('tell');
   WhitelistCommand('overtime');
@@ -664,13 +679,13 @@ begin
     IK_DELETE:
       if (Length(Line) > 0) and (CPos <= Length(Line)) then
         Delete(Line, CPos, 1);
-    IK_LEFT:
+    IK_LEFT, IK_KPLEFT:
       if CPos > 1 then
         CPos := CPos - 1;
-    IK_RIGHT:
+    IK_RIGHT, IK_KPRIGHT:
       if CPos <= Length(Line) then
         CPos := CPos + 1;
-    IK_RETURN:
+    IK_RETURN, IK_KPRETURN:
     begin
       if Cons_Shown then
         g_Console_Process(Line)
@@ -706,7 +721,7 @@ begin
     IK_TAB:
       if not gChatShow then
         Complete();
-    IK_DOWN:
+    IK_DOWN, IK_KPDOWN:
       if not gChatShow then
         if (CommandHistory <> nil) and
            (CmdIndex < Length(CommandHistory)) then
@@ -716,7 +731,7 @@ begin
           Line := CommandHistory[CmdIndex];
           CPos := Length(Line) + 1;
         end;
-    IK_UP:
+    IK_UP, IK_KPUP:
       if not gChatShow then
         if (CommandHistory <> nil) and
            (CmdIndex <= Length(CommandHistory)) then
@@ -726,15 +741,15 @@ begin
           Line := CommandHistory[CmdIndex];
           Cpos := Length(Line) + 1;
         end;
-    IK_PAGEUP: // PgUp
+    IK_PAGEUP, IK_KPPAGEUP: // PgUp
       if not gChatShow then
         IncMax(OffSet, Length(ConsoleHistory)-1);
-    IK_PAGEDN: // PgDown
+    IK_PAGEDN, IK_KPPAGEDN: // PgDown
       if not gChatShow then
         DecMin(OffSet, 0);
-    IK_HOME:
+    IK_HOME, IK_KPHOME:
       CPos := 1;
-    IK_END:
+    IK_END, IK_KPEND:
       CPos := Length(Line) + 1;
   end;
 end;
@@ -743,6 +758,7 @@ function GetStr(var Str: String): String;
 var
   a, b: Integer;
 begin
+  Result := '';
   if Str[1] = '"' then
   begin
     for b := 1 to Length(Str) do
@@ -817,6 +833,10 @@ begin
       Time := MsgTime;
     end;
   end;
+
+{$IFDEF HEADLESS}
+  e_WriteLog('CON: ' + L, MSG_NOTIFY);
+{$ENDIF}
 end;
 
 procedure g_Console_Clear();