hedgewars/uCommands.pas
author Henek
Mon, 22 Nov 2010 10:04:08 +0100
changeset 4411 79fbc444584c
parent 4406 beb4de0af990
child 4413 46caab3a8f84
permissions -rw-r--r--
fix SetEffect, last parameter was not a boolean
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4373
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
     1
{$INCLUDE "options.inc"}
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
     2
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
     3
unit uCommands;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
     4
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
     5
interface
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
     6
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
     7
var isDeveloperMode: boolean;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
     8
type TVariableType = (vtCommand, vtLongInt, vthwFloat, vtBoolean);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
     9
     TCommandHandler = procedure (var params: shortstring);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    10
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    11
procedure initModule;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    12
procedure freeModule;
4398
36d7e4b6ca81 Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents: 4396
diff changeset
    13
procedure RegisterVariable(Name: shortstring; VType: TVariableType; p: pointer; Trusted: boolean);
4373
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    14
procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    15
procedure StopMessages(Message: Longword);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    16
procedure doPut(putX, putY: LongInt; fromAI: boolean);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    17
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    18
implementation
4401
9cb6990af584 Remove uAmmos dependaency from uCommands
unc0rr
parents: 4398
diff changeset
    19
uses Types, uConsts, uIO, uMobile,
4402
54a78ec6aac4 Remove uChat dependency from uCommands
unc0rr
parents: 4401
diff changeset
    20
     uRandom, SDLh, uScript, uTypes,
4403
unc0rr
parents: 4402
diff changeset
    21
     uVariables, uConsole, uUtils, uDebug;
4373
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    22
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    23
type  PVariable = ^TVariable;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    24
      TVariable = record
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    25
                     Next: PVariable;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    26
                     Name: string[15];
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    27
                    VType: TVariableType;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    28
                  Handler: pointer;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    29
                  Trusted: boolean;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    30
                  end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    31
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    32
var
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    33
      Variables: PVariable;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    34
4398
36d7e4b6ca81 Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents: 4396
diff changeset
    35
procedure RegisterVariable(Name: shortstring; VType: TVariableType; p: pointer; Trusted: boolean);
4373
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    36
var value: PVariable;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    37
begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    38
New(value);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    39
TryDo(value <> nil, 'RegisterVariable: value = nil', true);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    40
FillChar(value^, sizeof(TVariable), 0);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    41
value^.Name:= Name;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    42
value^.VType:= VType;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    43
value^.Handler:= p;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    44
value^.Trusted:= Trusted;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    45
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    46
if Variables = nil then Variables:= value
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    47
                   else begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    48
                        value^.Next:= Variables;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    49
                        Variables:= value
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    50
                        end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    51
end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    52
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    53
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    54
procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    55
var ii: LongInt;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    56
    s: shortstring;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    57
    t: PVariable;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    58
    c: char;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    59
begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    60
//WriteLnToConsole(CmdStr);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    61
if CmdStr[0]=#0 then exit;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    62
{$IFDEF DEBUGFILE}AddFileLog('ParseCommand "' + CmdStr + '"');{$ENDIF}
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    63
c:= CmdStr[1];
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    64
if c in ['/', '$'] then Delete(CmdStr, 1, 1) else c:= '/';
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    65
s:= '';
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    66
SplitBySpace(CmdStr, s);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    67
t:= Variables;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    68
while t <> nil do
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    69
      begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    70
      if t^.Name = CmdStr then
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    71
         begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    72
         if TrustedSource or t^.Trusted then
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    73
            case t^.VType of
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    74
              vtCommand: if c='/' then
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    75
                         begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    76
                         TCommandHandler(t^.Handler)(s);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    77
                         end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    78
              vtLongInt: if c='$' then
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    79
                         if s[0]=#0 then
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    80
                            begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    81
                            str(PLongInt(t^.Handler)^, s);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    82
                            WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    83
                            end else val(s, PLongInt(t^.Handler)^);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    84
              vthwFloat: if c='$' then
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    85
                         if s[0]=#0 then
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    86
                            begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    87
                            //str(PhwFloat(t^.Handler)^:4:6, s);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    88
                            WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    89
                            end else; //val(s, PhwFloat(t^.Handler)^, i);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    90
             vtBoolean: if c='$' then
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    91
                         if s[0]=#0 then
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    92
                            begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    93
                            str(ord(boolean(t^.Handler^)), s);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    94
                            WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    95
                            end else
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    96
                            begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    97
                            val(s, ii);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    98
                            boolean(t^.Handler^):= not (ii = 0)
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    99
                            end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   100
              end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   101
         exit
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   102
         end else t:= t^.Next
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   103
      end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   104
case c of
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   105
     '$': WriteLnToConsole(errmsgUnknownVariable + ': "$' + CmdStr + '"')
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   106
     else WriteLnToConsole(errmsgUnknownCommand  + ': "/' + CmdStr + '"') end
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   107
end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   108
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   109
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   110
procedure StopMessages(Message: Longword);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   111
begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   112
if (Message and gmLeft) <> 0 then ParseCommand('/-left', true) else
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   113
if (Message and gmRight) <> 0 then ParseCommand('/-right', true) else
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   114
if (Message and gmUp) <> 0 then ParseCommand('/-up', true) else
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   115
if (Message and gmDown) <> 0 then ParseCommand('/-down', true) else
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   116
if (Message and gmAttack) <> 0 then ParseCommand('/-attack', true)
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   117
end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   118
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   119
{$INCLUDE "CCHandlers.inc"}
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   120
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   121
procedure initModule;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   122
begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   123
    Variables:= nil;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   124
    isDeveloperMode:= true;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   125
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   126
    // NOTE: please, keep most frequently used commands on bottom
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   127
    RegisterVariable('flag'    , vtCommand, @chFlag         , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   128
    RegisterVariable('script'  , vtCommand, @chScript       , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   129
    RegisterVariable('proto'   , vtCommand, @chCheckProto   , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   130
    RegisterVariable('spectate', vtBoolean, @fastUntilLag   , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   131
    RegisterVariable('capture' , vtCommand, @chCapture      , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   132
    RegisterVariable('rotmask' , vtCommand, @chRotateMask   , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   133
    RegisterVariable('rdriven' , vtCommand, @chTeamLocal    , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   134
    RegisterVariable('map'     , vtCommand, @chSetMap       , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   135
    RegisterVariable('theme'   , vtCommand, @chSetTheme     , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   136
    RegisterVariable('seed'    , vtCommand, @chSetSeed      , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   137
    RegisterVariable('template_filter', vtLongInt, @cTemplateFilter, false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   138
    RegisterVariable('mapgen'  , vtLongInt, @cMapGen        , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   139
    RegisterVariable('maze_size',vtLongInt, @cMazeSize      , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   140
    RegisterVariable('delay'   , vtLongInt, @cInactDelay    , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   141
    RegisterVariable('ready'   , vtLongInt, @cReadyDelay    , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   142
    RegisterVariable('casefreq', vtLongInt, @cCaseFactor    , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   143
    RegisterVariable('healthprob', vtLongInt, @cHealthCaseProb, false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   144
    RegisterVariable('hcaseamount', vtLongInt, @cHealthCaseAmount, false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   145
    RegisterVariable('sd_turns', vtLongInt, @cSuddenDTurns  , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   146
    RegisterVariable('waterrise', vtLongInt, @cWaterRise    , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   147
    RegisterVariable('healthdec', vtLongInt, @cHealthDecrease, false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   148
    RegisterVariable('damagepct',vtLongInt, @cDamagePercent , false);
4406
beb4de0af990 Increase teams to 8 to match the 8 colours, fix issue #108, reenable rope length modifier
nemo
parents: 4403
diff changeset
   149
    RegisterVariable('ropepct' , vtLongInt, @cRopePercent   , false);
4373
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   150
    RegisterVariable('minedudpct',vtLongInt,@cMineDudPercent, false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   151
    RegisterVariable('minesnum', vtLongInt, @cLandMines     , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   152
    RegisterVariable('explosives',vtLongInt,@cExplosives    , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   153
    RegisterVariable('gmflags' , vtLongInt, @GameFlags      , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   154
    RegisterVariable('trflags' , vtLongInt, @TrainingFlags  , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   155
    RegisterVariable('turntime', vtLongInt, @cHedgehogTurnTime, false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   156
    RegisterVariable('minestime',vtLongInt, @cMinesTime     , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   157
    RegisterVariable('fort'    , vtCommand, @chFort         , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   158
    RegisterVariable('grave'   , vtCommand, @chGrave        , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   159
    RegisterVariable('hat'     , vtCommand, @chSetHat       , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   160
    RegisterVariable('quit'    , vtCommand, @chQuit         , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   161
    RegisterVariable('confirm' , vtCommand, @chConfirm      , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   162
    RegisterVariable('+speedup', vtCommand, @chSpeedup_p    , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   163
    RegisterVariable('-speedup', vtCommand, @chSpeedup_m    , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   164
    RegisterVariable('zoomin'  , vtCommand, @chZoomIn       , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   165
    RegisterVariable('zoomout' , vtCommand, @chZoomOut      , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   166
    RegisterVariable('zoomreset',vtCommand, @chZoomReset    , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   167
    RegisterVariable('ammomenu', vtCommand, @chAmmoMenu     , true);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   168
    RegisterVariable('+precise', vtCommand, @chPrecise_p    , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   169
    RegisterVariable('-precise', vtCommand, @chPrecise_m    , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   170
    RegisterVariable('+left'   , vtCommand, @chLeft_p       , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   171
    RegisterVariable('-left'   , vtCommand, @chLeft_m       , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   172
    RegisterVariable('+right'  , vtCommand, @chRight_p      , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   173
    RegisterVariable('-right'  , vtCommand, @chRight_m      , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   174
    RegisterVariable('+up'     , vtCommand, @chUp_p         , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   175
    RegisterVariable('-up'     , vtCommand, @chUp_m         , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   176
    RegisterVariable('+down'   , vtCommand, @chDown_p       , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   177
    RegisterVariable('-down'   , vtCommand, @chDown_m       , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   178
    RegisterVariable('+attack' , vtCommand, @chAttack_p     , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   179
    RegisterVariable('-attack' , vtCommand, @chAttack_m     , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   180
    RegisterVariable('switch'  , vtCommand, @chSwitch       , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   181
    RegisterVariable('nextturn', vtCommand, @chNextTurn     , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   182
    RegisterVariable('timer'   , vtCommand, @chTimer        , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   183
    RegisterVariable('taunt'   , vtCommand, @chTaunt        , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   184
    RegisterVariable('setweap' , vtCommand, @chSetWeapon    , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   185
    RegisterVariable('slot'    , vtCommand, @chSlot         , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   186
    RegisterVariable('put'     , vtCommand, @chPut          , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   187
    RegisterVariable('ljump'   , vtCommand, @chLJump        , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   188
    RegisterVariable('hjump'   , vtCommand, @chHJump        , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   189
    RegisterVariable('+volup'  , vtCommand, @chVol_p        , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   190
    RegisterVariable('-volup'  , vtCommand, @chVol_m        , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   191
    RegisterVariable('+voldown', vtCommand, @chVol_m        , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   192
    RegisterVariable('-voldown', vtCommand, @chVol_p        , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   193
    RegisterVariable('findhh'  , vtCommand, @chFindhh       , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   194
    RegisterVariable('pause'   , vtCommand, @chPause        , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   195
    RegisterVariable('+cur_u'  , vtCommand, @chCurU_p       , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   196
    RegisterVariable('-cur_u'  , vtCommand, @chCurU_m       , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   197
    RegisterVariable('+cur_d'  , vtCommand, @chCurD_p       , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   198
    RegisterVariable('-cur_d'  , vtCommand, @chCurD_m       , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   199
    RegisterVariable('+cur_l'  , vtCommand, @chCurL_p       , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   200
    RegisterVariable('-cur_l'  , vtCommand, @chCurL_m       , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   201
    RegisterVariable('+cur_r'  , vtCommand, @chCurR_p       , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   202
    RegisterVariable('-cur_r'  , vtCommand, @chCurR_m       , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   203
end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   204
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   205
procedure freeModule;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   206
var t, tt: PVariable;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   207
begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   208
    tt:= Variables;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   209
    Variables:= nil;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   210
    while tt <> nil do
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   211
    begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   212
        t:= tt;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   213
        tt:= tt^.Next;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   214
        Dispose(t)
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   215
    end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   216
end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   217
4406
beb4de0af990 Increase teams to 8 to match the 8 colours, fix issue #108, reenable rope length modifier
nemo
parents: 4403
diff changeset
   218
end.