hedgewars/uConsole.pas
author unc0rr
Tue, 22 Apr 2008 12:40:43 +0000
changeset 856 beecc5c5c71c
parent 841 0700e3d3474d
child 866 ac6f6c95c23f
permissions -rw-r--r--
- Fix braindead shotgun shot arithmetics - Small optimizations in hwFloat
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
     1
(*
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
     2
 * Hedgewars, a worms-like game
393
db01cc79f278 Update copyright information
unc0rr
parents: 377
diff changeset
     3
 * Copyright (c) 2004-2007 Andrey Korotaev <unC0Rr@gmail.com>
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
     4
 *
183
57c2ef19f719 Relicense to GPL
unc0rr
parents: 176
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
57c2ef19f719 Relicense to GPL
unc0rr
parents: 176
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
57c2ef19f719 Relicense to GPL
unc0rr
parents: 176
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
     8
 *
183
57c2ef19f719 Relicense to GPL
unc0rr
parents: 176
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
57c2ef19f719 Relicense to GPL
unc0rr
parents: 176
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
57c2ef19f719 Relicense to GPL
unc0rr
parents: 176
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
57c2ef19f719 Relicense to GPL
unc0rr
parents: 176
diff changeset
    12
 * GNU General Public License for more details.
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    13
 *
183
57c2ef19f719 Relicense to GPL
unc0rr
parents: 176
diff changeset
    14
 * You should have received a copy of the GNU General Public License
57c2ef19f719 Relicense to GPL
unc0rr
parents: 176
diff changeset
    15
 * along with this program; if not, write to the Free Software
57c2ef19f719 Relicense to GPL
unc0rr
parents: 176
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    17
 *)
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    18
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    19
unit uConsole;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    20
interface
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
    21
uses SDLh, uFloat;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    22
{$INCLUDE options.inc}
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    23
const isDeveloperMode: boolean = true;
371
731ad6d27bd1 integer -> LongInt
unc0rr
parents: 351
diff changeset
    24
type TVariableType = (vtCommand, vtLongInt, vthwFloat, vtBoolean);
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    25
     TCommandHandler = procedure (var params: shortstring);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    26
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    27
procedure DrawConsole(Surface: PSDL_Surface);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    28
procedure WriteToConsole(s: shortstring);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    29
procedure WriteLnToConsole(s: shortstring);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    30
procedure KeyPressConsole(Key: Longword);
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
    31
procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
53
0e27949850e3 - Fixed bubble theme object
unc0rr
parents: 51
diff changeset
    32
function  GetLastConsoleLine: shortstring;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    33
543
465e2ec8f05f - Better randomness of placing hedgehogs on the land
unc0rr
parents: 539
diff changeset
    34
procedure doPut(putX, putY: LongInt; fromAI: boolean);
465e2ec8f05f - Better randomness of placing hedgehogs on the land
unc0rr
parents: 539
diff changeset
    35
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    36
implementation
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    37
{$J+}
288
929c44745fd9 Ammo schemes and ammo stores support in engine
unc0rr
parents: 281
diff changeset
    38
uses uMisc, uStore, Types, uConsts, uGears, uTeams, uIO, uKeys, uWorld, uLand,
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    39
     uRandom, uAmmos, uTriggers, GL;
371
731ad6d27bd1 integer -> LongInt
unc0rr
parents: 351
diff changeset
    40
const cLineWidth: LongInt = 0;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    41
      cLinesCount = 256;
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
    42
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    43
type  PVariable = ^TVariable;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    44
      TVariable = record
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    45
                     Next: PVariable;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    46
                     Name: string[15];
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    47
                    VType: TVariableType;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    48
                  Handler: pointer;
167
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
    49
                  Trusted: boolean;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    50
                  end;
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    51
      TTextLine = record
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    52
                  s: shortstring;
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    53
                  tex: PTexture;
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    54
                  updatetex: boolean;
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    55
                  end;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    56
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    57
var   ConsoleLines: array[byte] of TTextLine;
371
731ad6d27bd1 integer -> LongInt
unc0rr
parents: 351
diff changeset
    58
      CurrLine: LongInt = 0;
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    59
      InputStr: TTextLine;
787
5064d72fa0e2 - Bring back usual console look
unc0rr
parents: 786
diff changeset
    60
      InputStrL: array[0..260] of char; // for full str + 4-byte utf-8 char
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    61
      Variables: PVariable = nil;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    62
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    63
procedure SetLine(var tl: TTextLine; str: shortstring);
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    64
begin
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    65
with tl do
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    66
     begin
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    67
     s:= str;
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    68
     if tex <> nil then FreeTexture(tex);
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    69
     updatetex:= true
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    70
     end
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    71
end;
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    72
167
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
    73
function RegisterVariable(Name: string; VType: TVariableType; p: pointer; Trusted: boolean): PVariable;
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
    74
var Result: PVariable;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    75
begin
17
a6bed8d31444 minor code review
unc0rr
parents: 4
diff changeset
    76
New(Result);
a6bed8d31444 minor code review
unc0rr
parents: 4
diff changeset
    77
TryDo(Result <> nil, 'RegisterVariable: Result = nil', true);
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    78
FillChar(Result^, sizeof(TVariable), 0);
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
    79
Result^.Name:= Name;
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
    80
Result^.VType:= VType;
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
    81
Result^.Handler:= p;
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
    82
Result^.Trusted:= Trusted;
167
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
    83
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    84
if Variables = nil then Variables:= Result
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    85
                   else begin
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
    86
                        Result^.Next:= Variables;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    87
                        Variables:= Result
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
    88
                        end;
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
    89
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
    90
RegisterVariable:= Result
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    91
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    92
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    93
procedure FreeVariablesList;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    94
var t, tt: PVariable;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    95
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    96
tt:= Variables;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    97
Variables:= nil;
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
    98
while tt <> nil do
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    99
      begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   100
      t:= tt;
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   101
      tt:= tt^.Next;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   102
      Dispose(t)
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   103
      end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   104
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   105
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   106
procedure SplitBySpace(var a, b: shortstring);
371
731ad6d27bd1 integer -> LongInt
unc0rr
parents: 351
diff changeset
   107
var i, t: LongInt;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   108
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   109
i:= Pos(' ', a);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   110
if i>0 then
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   111
   begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   112
   for t:= 1 to Pred(i) do
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   113
       if (a[t] >= 'A')and(a[t] <= 'Z') then Inc(a[t], 32);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   114
   b:= copy(a, i + 1, Length(a) - i);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   115
   while (b[0]<>#0) and (b[1]=#32) do Delete(b, 1, 1);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   116
   byte(a[0]):= Pred(i)
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   117
   end else b:= '';
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   118
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   119
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   120
procedure DrawConsole(Surface: PSDL_Surface);
371
731ad6d27bd1 integer -> LongInt
unc0rr
parents: 351
diff changeset
   121
var x, y: LongInt;
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   122
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   123
    procedure DrawLine(var tl: TTextLine; X, Y: LongInt);
787
5064d72fa0e2 - Bring back usual console look
unc0rr
parents: 786
diff changeset
   124
    var tmpSurface: PSDL_Surface;
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   125
    begin
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   126
    with tl do
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   127
       begin
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   128
       if updatetex then
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   129
          begin
787
5064d72fa0e2 - Bring back usual console look
unc0rr
parents: 786
diff changeset
   130
          if s[0] <> #0 then
5064d72fa0e2 - Bring back usual console look
unc0rr
parents: 786
diff changeset
   131
             begin
5064d72fa0e2 - Bring back usual console look
unc0rr
parents: 786
diff changeset
   132
             tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), $FFFFFF);
5064d72fa0e2 - Bring back usual console look
unc0rr
parents: 786
diff changeset
   133
             tex:= Surface2Tex(tmpSurface);
5064d72fa0e2 - Bring back usual console look
unc0rr
parents: 786
diff changeset
   134
             SDL_FreeSurface(tmpSurface)
5064d72fa0e2 - Bring back usual console look
unc0rr
parents: 786
diff changeset
   135
             end else tex:= nil;
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   136
          updatetex:= false
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   137
          end;
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   138
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   139
       if tex <> nil then
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   140
          DrawTexture(X, Y, tex);
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   141
       end
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   142
    end;
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   143
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   144
begin
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   145
glEnable(GL_TEXTURE_2D);
787
5064d72fa0e2 - Bring back usual console look
unc0rr
parents: 786
diff changeset
   146
glEnable(GL_BLEND);
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   147
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   148
for y:= 0 to cConsoleHeight div 256 + 1 do
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   149
    for x:= 0 to cScreenWidth div 256 + 1 do
841
0700e3d3474d Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents: 787
diff changeset
   150
        DrawSprite(sprConsoleBG, x * 256, cConsoleHeight - 256 - y * 256, 0);
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   151
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   152
for y:= 0 to cConsoleHeight div Fontz[fnt16].Height do
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   153
    DrawLine(ConsoleLines[(CurrLine - 1 - y + cLinesCount) mod cLinesCount], 4, cConsoleHeight - (y + 2) * (Fontz[fnt16].Height + 2));
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   154
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   155
DrawLine(InputStr, 4, cConsoleHeight - Fontz[fnt16].Height - 2);
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   156
787
5064d72fa0e2 - Bring back usual console look
unc0rr
parents: 786
diff changeset
   157
glDisable(GL_BLEND);
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   158
glDisable(GL_TEXTURE_2D);
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   159
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   160
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   161
procedure WriteToConsole(s: shortstring);
371
731ad6d27bd1 integer -> LongInt
unc0rr
parents: 351
diff changeset
   162
var Len: LongInt;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   163
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   164
{$IFDEF DEBUGFILE}AddFileLog('Console write: ' + s);{$ENDIF}
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   165
Write(s);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   166
repeat
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   167
Len:= cLineWidth - Length(ConsoleLines[CurrLine].s);
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   168
SetLine(ConsoleLines[CurrLine], ConsoleLines[CurrLine].s + copy(s, 1, Len));
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   169
Delete(s, 1, Len);
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   170
if byte(ConsoleLines[CurrLine].s[0]) = cLineWidth then
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   171
   begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   172
   inc(CurrLine);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   173
   if CurrLine = cLinesCount then CurrLine:= 0;
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   174
   PByte(@ConsoleLines[CurrLine].s)^:= 0
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   175
   end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   176
until Length(s) = 0
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   177
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   178
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   179
procedure WriteLnToConsole(s: shortstring);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   180
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   181
WriteToConsole(s);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   182
WriteLn;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   183
inc(CurrLine);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   184
if CurrLine = cLinesCount then CurrLine:= 0;
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   185
PByte(@ConsoleLines[CurrLine].s)^:= 0
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   186
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   187
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   188
procedure InitConsole;
371
731ad6d27bd1 integer -> LongInt
unc0rr
parents: 351
diff changeset
   189
var i: LongInt;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   190
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   191
cLineWidth:= cScreenWidth div 10;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   192
if cLineWidth > 255 then cLineWidth:= 255;
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   193
for i:= 0 to Pred(cLinesCount) do PByte(@ConsoleLines[i])^:= 0
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   194
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   195
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   196
procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   197
type PhwFloat = ^hwFloat;
495
62c1c2b4414c - Fix most of the warnings in hwengine
unc0rr
parents: 415
diff changeset
   198
var ii: LongInt;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   199
    s: shortstring;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   200
    t: PVariable;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   201
    c: char;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   202
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   203
//WriteLnToConsole(CmdStr);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   204
if CmdStr[0]=#0 then exit;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   205
{$IFDEF DEBUGFILE}AddFileLog('ParseCommand "' + CmdStr + '"');{$ENDIF}
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   206
c:= CmdStr[1];
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   207
if c in ['/', '$'] then Delete(CmdStr, 1, 1) else c:= '/';
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   208
SplitBySpace(CmdStr, s);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   209
t:= Variables;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   210
while t <> nil do
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   211
      begin
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   212
      if t^.Name = CmdStr then
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   213
         begin
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   214
         if TrustedSource or t^.Trusted then
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   215
            case t^.VType of
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   216
              vtCommand: if c='/' then
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   217
                         begin
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   218
                         TCommandHandler(t^.Handler)(s);
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   219
                         end;
371
731ad6d27bd1 integer -> LongInt
unc0rr
parents: 351
diff changeset
   220
              vtLongInt: if c='$' then
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   221
                         if s[0]=#0 then
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   222
                            begin
371
731ad6d27bd1 integer -> LongInt
unc0rr
parents: 351
diff changeset
   223
                            str(PLongInt(t^.Handler)^, s);
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   224
                            WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
495
62c1c2b4414c - Fix most of the warnings in hwengine
unc0rr
parents: 415
diff changeset
   225
                            end else val(s, PLongInt(t^.Handler)^);
62c1c2b4414c - Fix most of the warnings in hwengine
unc0rr
parents: 415
diff changeset
   226
              vthwFloat: if c='$' then
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   227
                         if s[0]=#0 then
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   228
                            begin
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   229
                            //str(PhwFloat(t^.Handler)^:4:6, s);
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   230
                            WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   231
                            end else; //val(s, PhwFloat(t^.Handler)^, i);
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   232
             vtBoolean: if c='$' then
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   233
                         if s[0]=#0 then
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   234
                            begin
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   235
                            str(ord(boolean(t^.Handler^)), s);
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   236
                            WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   237
                            end else
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   238
                            begin
495
62c1c2b4414c - Fix most of the warnings in hwengine
unc0rr
parents: 415
diff changeset
   239
                            val(s, ii);
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   240
                            boolean(t^.Handler^):= not (ii = 0)
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   241
                            end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   242
              end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   243
         exit
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   244
         end else t:= t^.Next
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   245
      end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   246
case c of
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   247
     '$': WriteLnToConsole(errmsgUnknownVariable + ': "$' + CmdStr + '"')
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   248
     else WriteLnToConsole(errmsgUnknownCommand  + ': "/' + CmdStr + '"') end
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   249
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   250
46
c99140d2355a - Fixed dynamit sprite
unc0rr
parents: 39
diff changeset
   251
procedure AutoComplete;
c99140d2355a - Fixed dynamit sprite
unc0rr
parents: 39
diff changeset
   252
var t: PVariable;
c99140d2355a - Fixed dynamit sprite
unc0rr
parents: 39
diff changeset
   253
    c: char;
c99140d2355a - Fixed dynamit sprite
unc0rr
parents: 39
diff changeset
   254
begin
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   255
if InputStr.s[0] = #0 then exit;
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   256
c:= InputStr.s[1];
786
346c886bca7b Some bugfixing
unc0rr
parents: 785
diff changeset
   257
if c in ['/', '$'] then Delete(InputStr.s, 1, 1) else c:= #0;
346c886bca7b Some bugfixing
unc0rr
parents: 785
diff changeset
   258
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   259
if InputStr.s[byte(InputStr.s[0])] = #32 then dec(InputStr.s[0]);
46
c99140d2355a - Fixed dynamit sprite
unc0rr
parents: 39
diff changeset
   260
t:= Variables;
c99140d2355a - Fixed dynamit sprite
unc0rr
parents: 39
diff changeset
   261
while t <> nil do
c99140d2355a - Fixed dynamit sprite
unc0rr
parents: 39
diff changeset
   262
      begin
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   263
      if (c=#0) or ((t^.VType =  vtCommand) and (c='/'))or
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   264
                   ((t^.VType <> vtCommand) and (c='$'))then
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   265
         if copy(t^.Name, 1, Length(InputStr.s)) = InputStr.s then
46
c99140d2355a - Fixed dynamit sprite
unc0rr
parents: 39
diff changeset
   266
            begin
786
346c886bca7b Some bugfixing
unc0rr
parents: 785
diff changeset
   267
            if t^.VType = vtCommand then SetLine(InputStr, '/' + t^.Name + ' ')
346c886bca7b Some bugfixing
unc0rr
parents: 785
diff changeset
   268
                                    else SetLine(InputStr, '$' + t^.Name + ' ');
46
c99140d2355a - Fixed dynamit sprite
unc0rr
parents: 39
diff changeset
   269
            exit
c99140d2355a - Fixed dynamit sprite
unc0rr
parents: 39
diff changeset
   270
            end;
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   271
      t:= t^.Next
46
c99140d2355a - Fixed dynamit sprite
unc0rr
parents: 39
diff changeset
   272
      end
c99140d2355a - Fixed dynamit sprite
unc0rr
parents: 39
diff changeset
   273
end;
c99140d2355a - Fixed dynamit sprite
unc0rr
parents: 39
diff changeset
   274
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   275
procedure KeyPressConsole(Key: Longword);
377
d9b88dbdf5a9 Support unicode input for chat
unc0rr
parents: 371
diff changeset
   276
const firstByteMark: array[1..4] of byte = (0, $C0, $E0, $F0);
d9b88dbdf5a9 Support unicode input for chat
unc0rr
parents: 371
diff changeset
   277
var i, btw: integer;
d9b88dbdf5a9 Support unicode input for chat
unc0rr
parents: 371
diff changeset
   278
    utf8: shortstring;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   279
begin
377
d9b88dbdf5a9 Support unicode input for chat
unc0rr
parents: 371
diff changeset
   280
if Key <> 0 then
d9b88dbdf5a9 Support unicode input for chat
unc0rr
parents: 371
diff changeset
   281
  case Key of
786
346c886bca7b Some bugfixing
unc0rr
parents: 785
diff changeset
   282
      8: if Length(InputStr.s) > 0 then
346c886bca7b Some bugfixing
unc0rr
parents: 785
diff changeset
   283
            begin
787
5064d72fa0e2 - Bring back usual console look
unc0rr
parents: 786
diff changeset
   284
            InputStr.s[0]:= InputStrL[byte(InputStr.s[0])];
786
346c886bca7b Some bugfixing
unc0rr
parents: 785
diff changeset
   285
            SetLine(InputStr, InputStr.s)
346c886bca7b Some bugfixing
unc0rr
parents: 785
diff changeset
   286
            end;
46
c99140d2355a - Fixed dynamit sprite
unc0rr
parents: 39
diff changeset
   287
      9: AutoComplete;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   288
 13,271: begin
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   289
         if InputStr.s[1] in ['/', '$'] then
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   290
            ParseCommand(InputStr.s, false)
46
c99140d2355a - Fixed dynamit sprite
unc0rr
parents: 39
diff changeset
   291
         else
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   292
            ParseCommand('/say ' + InputStr.s, false);
786
346c886bca7b Some bugfixing
unc0rr
parents: 785
diff changeset
   293
         SetLine(InputStr, '')
415
d6d3a6a473a3 - Bind also 9th slot
unc0rr
parents: 393
diff changeset
   294
         end
377
d9b88dbdf5a9 Support unicode input for chat
unc0rr
parents: 371
diff changeset
   295
     else
d9b88dbdf5a9 Support unicode input for chat
unc0rr
parents: 371
diff changeset
   296
     if (Key < $80) then btw:= 1
d9b88dbdf5a9 Support unicode input for chat
unc0rr
parents: 371
diff changeset
   297
     else if (Key < $800) then btw:= 2
d9b88dbdf5a9 Support unicode input for chat
unc0rr
parents: 371
diff changeset
   298
     else if (Key < $10000) then btw:= 3
d9b88dbdf5a9 Support unicode input for chat
unc0rr
parents: 371
diff changeset
   299
     else btw:= 4;
d9b88dbdf5a9 Support unicode input for chat
unc0rr
parents: 371
diff changeset
   300
     utf8:= '';
d9b88dbdf5a9 Support unicode input for chat
unc0rr
parents: 371
diff changeset
   301
     for i:= btw downto 2 do
d9b88dbdf5a9 Support unicode input for chat
unc0rr
parents: 371
diff changeset
   302
         begin
d9b88dbdf5a9 Support unicode input for chat
unc0rr
parents: 371
diff changeset
   303
         utf8:= char((Key or $80) and $BF) + utf8;
d9b88dbdf5a9 Support unicode input for chat
unc0rr
parents: 371
diff changeset
   304
         Key:= Key shr 6
d9b88dbdf5a9 Support unicode input for chat
unc0rr
parents: 371
diff changeset
   305
         end;
d9b88dbdf5a9 Support unicode input for chat
unc0rr
parents: 371
diff changeset
   306
     utf8:= char(Key or firstByteMark[btw]) + utf8;
787
5064d72fa0e2 - Bring back usual console look
unc0rr
parents: 786
diff changeset
   307
5064d72fa0e2 - Bring back usual console look
unc0rr
parents: 786
diff changeset
   308
     InputStrL[byte(InputStr.s[0]) + btw]:= InputStr.s[0];
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   309
     SetLine(InputStr, InputStr.s + utf8)
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   310
     end
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   311
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   312
53
0e27949850e3 - Fixed bubble theme object
unc0rr
parents: 51
diff changeset
   313
function GetLastConsoleLine: shortstring;
0e27949850e3 - Fixed bubble theme object
unc0rr
parents: 51
diff changeset
   314
begin
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   315
if CurrLine = 0 then GetLastConsoleLine:= ConsoleLines[Pred(cLinesCount)].s
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
   316
                else GetLastConsoleLine:= ConsoleLines[Pred(CurrLine)].s
53
0e27949850e3 - Fixed bubble theme object
unc0rr
parents: 51
diff changeset
   317
end;
0e27949850e3 - Fixed bubble theme object
unc0rr
parents: 51
diff changeset
   318
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   319
{$INCLUDE CCHandlers.inc}
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   320
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   321
initialization
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   322
InitConsole;
167
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   323
RegisterVariable('quit'    , vtCommand, @chQuit         , true );
205
8d9aff55e6ab - Set version to 0.8
unc0rr
parents: 196
diff changeset
   324
RegisterVariable('proto'   , vtCommand, @chCheckProto   , true );
167
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   325
RegisterVariable('capture' , vtCommand, @chCapture      , true );
539
6a9bf1852bbc Ability to choose which info is shown above hedgehogs
unc0rr
parents: 495
diff changeset
   326
RegisterVariable('rotmask' , vtCommand, @chRotateMask   , true );
167
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   327
RegisterVariable('addteam' , vtCommand, @chAddTeam      , false);
589
f382c41f658a Start implementing triggers in engine
unc0rr
parents: 546
diff changeset
   328
RegisterVariable('addtrig' , vtCommand, @chAddTrigger   , false);
167
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   329
RegisterVariable('rdriven' , vtCommand, @chTeamLocal    , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   330
RegisterVariable('map'     , vtCommand, @chSetMap       , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   331
RegisterVariable('theme'   , vtCommand, @chSetTheme     , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   332
RegisterVariable('seed'    , vtCommand, @chSetSeed      , false);
614
0e04504bc140 - Fix some warnings
unc0rr
parents: 605
diff changeset
   333
RegisterVariable('delay'   , vtLongInt, @cInactDelay    , false);
0e04504bc140 - Fix some warnings
unc0rr
parents: 605
diff changeset
   334
RegisterVariable('casefreq', vtLongInt, @cCaseFactor    , false);
622
cedd47d956ec - New training (not finished yet)
unc0rr
parents: 614
diff changeset
   335
RegisterVariable('landadds', vtLongInt, @cLandAdditions , false);
371
731ad6d27bd1 integer -> LongInt
unc0rr
parents: 351
diff changeset
   336
RegisterVariable('c_height', vtLongInt, @cConsoleHeight , false);
731ad6d27bd1 integer -> LongInt
unc0rr
parents: 351
diff changeset
   337
RegisterVariable('gmflags' , vtLongInt, @GameFlags      , false);
731ad6d27bd1 integer -> LongInt
unc0rr
parents: 351
diff changeset
   338
RegisterVariable('turntime', vtLongInt, @cHedgehogTurnTime, false);
167
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   339
RegisterVariable('fort'    , vtCommand, @chFort         , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   340
RegisterVariable('grave'   , vtCommand, @chGrave        , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   341
RegisterVariable('bind'    , vtCommand, @chBind         , true );
312
c36d0b34ac3d Use new parameters, small protocol change
unc0rr
parents: 288
diff changeset
   342
RegisterVariable('addhh'   , vtCommand, @chAddHH        , false);
604
2f1165467a66 Let hedgehog position be taken from config, still more work is needed
unc0rr
parents: 589
diff changeset
   343
RegisterVariable('hhcoords', vtCommand, @chSetHHCoords  , false);
288
929c44745fd9 Ammo schemes and ammo stores support in engine
unc0rr
parents: 281
diff changeset
   344
RegisterVariable('ammstore', vtCommand, @chAddAmmoStore , false);
626
a30171dbcd19 's' key to speed up demo playing
unc0rr
parents: 622
diff changeset
   345
RegisterVariable('+speedup', vtCommand, @chSpeedup_p    , true );
a30171dbcd19 's' key to speed up demo playing
unc0rr
parents: 622
diff changeset
   346
RegisterVariable('-speedup', vtCommand, @chSpeedup_m    , true );
167
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   347
RegisterVariable('skip'    , vtCommand, @chSkip         , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   348
RegisterVariable('say'     , vtCommand, @chSay          , true );
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   349
RegisterVariable('ammomenu', vtCommand, @chAmmoMenu     , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   350
RegisterVariable('+left'   , vtCommand, @chLeft_p       , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   351
RegisterVariable('-left'   , vtCommand, @chLeft_m       , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   352
RegisterVariable('+right'  , vtCommand, @chRight_p      , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   353
RegisterVariable('-right'  , vtCommand, @chRight_m      , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   354
RegisterVariable('+up'     , vtCommand, @chUp_p         , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   355
RegisterVariable('-up'     , vtCommand, @chUp_m         , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   356
RegisterVariable('+down'   , vtCommand, @chDown_p       , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   357
RegisterVariable('-down'   , vtCommand, @chDown_m       , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   358
RegisterVariable('+attack' , vtCommand, @chAttack_p     , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   359
RegisterVariable('-attack' , vtCommand, @chAttack_m     , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   360
RegisterVariable('switch'  , vtCommand, @chSwitch       , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   361
RegisterVariable('nextturn', vtCommand, @chNextTurn     , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   362
RegisterVariable('timer'   , vtCommand, @chTimer        , false);
783
4f59db6f147d - New command 'set weapon'
unc0rr
parents: 771
diff changeset
   363
RegisterVariable('setweap' , vtCommand, @chSetWeapon    , false);
167
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   364
RegisterVariable('slot'    , vtCommand, @chSlot         , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   365
RegisterVariable('put'     , vtCommand, @chPut          , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   366
RegisterVariable('ljump'   , vtCommand, @chLJump        , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   367
RegisterVariable('hjump'   , vtCommand, @chHJump        , false);
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
   368
RegisterVariable('fullscr' , vtCommand, @chFullScr      , true );
175
d226d976d836 - Some improvements to volume control
unc0rr
parents: 174
diff changeset
   369
RegisterVariable('+volup'  , vtCommand, @chVol_p        , true );
d226d976d836 - Some improvements to volume control
unc0rr
parents: 174
diff changeset
   370
RegisterVariable('-volup'  , vtCommand, @chVol_m        , true );
d226d976d836 - Some improvements to volume control
unc0rr
parents: 174
diff changeset
   371
RegisterVariable('+voldown', vtCommand, @chVol_m        , true );
d226d976d836 - Some improvements to volume control
unc0rr
parents: 174
diff changeset
   372
RegisterVariable('-voldown', vtCommand, @chVol_p        , true );
176
533d03041dcd 'h' marks out current hedgehog
unc0rr
parents: 175
diff changeset
   373
RegisterVariable('findhh'  , vtCommand, @chFindhh       , true );
281
5b483aa9f2ab Pause support (mouse cursor is released when the game is paused)
unc0rr
parents: 205
diff changeset
   374
RegisterVariable('pause'   , vtCommand, @chPause        , true );
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   375
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   376
finalization
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   377
FreeVariablesList
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   378
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   379
end.