author | nemo |
Tue, 09 Nov 2010 22:40:38 -0500 | |
changeset 4233 | b4ad20bfe310 |
parent 4210 | caa9b08990eb |
child 4357 | a1fcfc341a52 |
child 4362 | 8dae325dc625 |
permissions | -rw-r--r-- |
4 | 1 |
(* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
883 | 3 |
* Copyright (c) 2004-2008 Andrey Korotaev <unC0Rr@gmail.com> |
4 | 4 |
* |
183 | 5 |
* This program is free software; you can redistribute it and/or modify |
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
4 | 8 |
* |
183 | 9 |
* This program is distributed in the hope that it will be useful, |
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
4 | 13 |
* |
183 | 14 |
* You should have received a copy of the GNU General Public License |
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
4 | 17 |
*) |
18 |
||
2630 | 19 |
{$INCLUDE "options.inc"} |
20 |
||
4 | 21 |
unit uConsole; |
22 |
interface |
|
988 | 23 |
uses uFloat; |
2630 | 24 |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2695
diff
changeset
|
25 |
var isDeveloperMode: boolean; |
371 | 26 |
type TVariableType = (vtCommand, vtLongInt, vthwFloat, vtBoolean); |
4 | 27 |
TCommandHandler = procedure (var params: shortstring); |
28 |
||
3038 | 29 |
procedure initModule; |
30 |
procedure freeModule; |
|
4 | 31 |
procedure WriteToConsole(s: shortstring); |
32 |
procedure WriteLnToConsole(s: shortstring); |
|
351 | 33 |
procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); |
936
ba582673db7d
Fix 'AI may break demos playing' message while loading saves
unc0rr
parents:
917
diff
changeset
|
34 |
procedure StopMessages(Message: Longword); |
53 | 35 |
function GetLastConsoleLine: shortstring; |
4 | 36 |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
539
diff
changeset
|
37 |
procedure doPut(putX, putY: LongInt; fromAI: boolean); |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
539
diff
changeset
|
38 |
|
4 | 39 |
implementation |
3935 | 40 |
uses uMisc, uStore, Types, uConsts, uGears, uTeams, uIO, uKeys, uWorld, uMobile, |
3407 | 41 |
uRandom, uAmmos, uStats, uChat, SDLh, uSound, uVisualGears, uScript; |
950 | 42 |
|
371 | 43 |
const cLineWidth: LongInt = 0; |
4 | 44 |
cLinesCount = 256; |
351 | 45 |
|
4 | 46 |
type PVariable = ^TVariable; |
47 |
TVariable = record |
|
48 |
Next: PVariable; |
|
49 |
Name: string[15]; |
|
50 |
VType: TVariableType; |
|
51 |
Handler: pointer; |
|
167 | 52 |
Trusted: boolean; |
4 | 53 |
end; |
785 | 54 |
TTextLine = record |
55 |
s: shortstring; |
|
56 |
end; |
|
4 | 57 |
|
785 | 58 |
var ConsoleLines: array[byte] of TTextLine; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2695
diff
changeset
|
59 |
CurrLine: LongInt; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2695
diff
changeset
|
60 |
Variables: PVariable; |
4 | 61 |
|
785 | 62 |
procedure SetLine(var tl: TTextLine; str: shortstring); |
63 |
begin |
|
64 |
with tl do |
|
65 |
s:= str; |
|
66 |
end; |
|
67 |
||
2905 | 68 |
function RegisterVariable(Name: shortstring; VType: TVariableType; p: pointer; Trusted: boolean): PVariable; |
2695 | 69 |
var value: PVariable; |
4 | 70 |
begin |
2695 | 71 |
New(value); |
72 |
TryDo(value <> nil, 'RegisterVariable: value = nil', true); |
|
73 |
FillChar(value^, sizeof(TVariable), 0); |
|
74 |
value^.Name:= Name; |
|
75 |
value^.VType:= VType; |
|
76 |
value^.Handler:= p; |
|
77 |
value^.Trusted:= Trusted; |
|
167 | 78 |
|
2695 | 79 |
if Variables = nil then Variables:= value |
4 | 80 |
else begin |
2695 | 81 |
value^.Next:= Variables; |
82 |
Variables:= value |
|
351 | 83 |
end; |
84 |
||
2695 | 85 |
RegisterVariable:= value; |
4 | 86 |
end; |
87 |
||
88 |
procedure WriteToConsole(s: shortstring); |
|
371 | 89 |
var Len: LongInt; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2695
diff
changeset
|
90 |
done: boolean; |
4 | 91 |
begin |
3818
e668970413e6
add a noconsole symbol, update the project file for appstore distribution
koda
parents:
3777
diff
changeset
|
92 |
{$IFNDEF NOCONSOLE} |
4046
cfdbddc4b385
making indentation consistent (noticed while debugging)
nemo
parents:
4003
diff
changeset
|
93 |
{$IFDEF DEBUGFILE}AddFileLog('Console write: ' + s);{$ENDIF} |
cfdbddc4b385
making indentation consistent (noticed while debugging)
nemo
parents:
4003
diff
changeset
|
94 |
Write(s); |
cfdbddc4b385
making indentation consistent (noticed while debugging)
nemo
parents:
4003
diff
changeset
|
95 |
done:= false; |
3697 | 96 |
|
4046
cfdbddc4b385
making indentation consistent (noticed while debugging)
nemo
parents:
4003
diff
changeset
|
97 |
while not done do |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
98 |
begin |
4046
cfdbddc4b385
making indentation consistent (noticed while debugging)
nemo
parents:
4003
diff
changeset
|
99 |
Len:= cLineWidth - Length(ConsoleLines[CurrLine].s); |
cfdbddc4b385
making indentation consistent (noticed while debugging)
nemo
parents:
4003
diff
changeset
|
100 |
SetLine(ConsoleLines[CurrLine], ConsoleLines[CurrLine].s + copy(s, 1, Len)); |
cfdbddc4b385
making indentation consistent (noticed while debugging)
nemo
parents:
4003
diff
changeset
|
101 |
Delete(s, 1, Len); |
cfdbddc4b385
making indentation consistent (noticed while debugging)
nemo
parents:
4003
diff
changeset
|
102 |
if byte(ConsoleLines[CurrLine].s[0]) = cLineWidth then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
103 |
begin |
4046
cfdbddc4b385
making indentation consistent (noticed while debugging)
nemo
parents:
4003
diff
changeset
|
104 |
inc(CurrLine); |
cfdbddc4b385
making indentation consistent (noticed while debugging)
nemo
parents:
4003
diff
changeset
|
105 |
if CurrLine = cLinesCount then CurrLine:= 0; |
cfdbddc4b385
making indentation consistent (noticed while debugging)
nemo
parents:
4003
diff
changeset
|
106 |
PByte(@ConsoleLines[CurrLine].s)^:= 0 |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
107 |
end; |
4046
cfdbddc4b385
making indentation consistent (noticed while debugging)
nemo
parents:
4003
diff
changeset
|
108 |
done:= (Length(s) = 0); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
109 |
end; |
3818
e668970413e6
add a noconsole symbol, update the project file for appstore distribution
koda
parents:
3777
diff
changeset
|
110 |
{$ENDIF} |
4 | 111 |
end; |
112 |
||
113 |
procedure WriteLnToConsole(s: shortstring); |
|
114 |
begin |
|
3825 | 115 |
{$IFNDEF NOCONSOLE} |
4046
cfdbddc4b385
making indentation consistent (noticed while debugging)
nemo
parents:
4003
diff
changeset
|
116 |
WriteToConsole(s); |
cfdbddc4b385
making indentation consistent (noticed while debugging)
nemo
parents:
4003
diff
changeset
|
117 |
WriteLn; |
cfdbddc4b385
making indentation consistent (noticed while debugging)
nemo
parents:
4003
diff
changeset
|
118 |
inc(CurrLine); |
cfdbddc4b385
making indentation consistent (noticed while debugging)
nemo
parents:
4003
diff
changeset
|
119 |
if CurrLine = cLinesCount then |
cfdbddc4b385
making indentation consistent (noticed while debugging)
nemo
parents:
4003
diff
changeset
|
120 |
CurrLine:= 0; |
cfdbddc4b385
making indentation consistent (noticed while debugging)
nemo
parents:
4003
diff
changeset
|
121 |
PByte(@ConsoleLines[CurrLine].s)^:= 0 |
3818
e668970413e6
add a noconsole symbol, update the project file for appstore distribution
koda
parents:
3777
diff
changeset
|
122 |
{$ENDIF} |
4 | 123 |
end; |
124 |
||
351 | 125 |
procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); |
495 | 126 |
var ii: LongInt; |
4 | 127 |
s: shortstring; |
128 |
t: PVariable; |
|
129 |
c: char; |
|
130 |
begin |
|
131 |
//WriteLnToConsole(CmdStr); |
|
132 |
if CmdStr[0]=#0 then exit; |
|
133 |
{$IFDEF DEBUGFILE}AddFileLog('ParseCommand "' + CmdStr + '"');{$ENDIF} |
|
134 |
c:= CmdStr[1]; |
|
135 |
if c in ['/', '$'] then Delete(CmdStr, 1, 1) else c:= '/'; |
|
3407 | 136 |
s:= ''; |
4 | 137 |
SplitBySpace(CmdStr, s); |
138 |
t:= Variables; |
|
139 |
while t <> nil do |
|
140 |
begin |
|
351 | 141 |
if t^.Name = CmdStr then |
4 | 142 |
begin |
351 | 143 |
if TrustedSource or t^.Trusted then |
144 |
case t^.VType of |
|
4 | 145 |
vtCommand: if c='/' then |
146 |
begin |
|
351 | 147 |
TCommandHandler(t^.Handler)(s); |
4 | 148 |
end; |
371 | 149 |
vtLongInt: if c='$' then |
4 | 150 |
if s[0]=#0 then |
151 |
begin |
|
371 | 152 |
str(PLongInt(t^.Handler)^, s); |
4 | 153 |
WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); |
495 | 154 |
end else val(s, PLongInt(t^.Handler)^); |
155 |
vthwFloat: if c='$' then |
|
4 | 156 |
if s[0]=#0 then |
157 |
begin |
|
351 | 158 |
//str(PhwFloat(t^.Handler)^:4:6, s); |
4 | 159 |
WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); |
351 | 160 |
end else; //val(s, PhwFloat(t^.Handler)^, i); |
4 | 161 |
vtBoolean: if c='$' then |
162 |
if s[0]=#0 then |
|
163 |
begin |
|
351 | 164 |
str(ord(boolean(t^.Handler^)), s); |
4 | 165 |
WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); |
166 |
end else |
|
167 |
begin |
|
495 | 168 |
val(s, ii); |
351 | 169 |
boolean(t^.Handler^):= not (ii = 0) |
4 | 170 |
end; |
171 |
end; |
|
172 |
exit |
|
351 | 173 |
end else t:= t^.Next |
4 | 174 |
end; |
175 |
case c of |
|
176 |
'$': WriteLnToConsole(errmsgUnknownVariable + ': "$' + CmdStr + '"') |
|
177 |
else WriteLnToConsole(errmsgUnknownCommand + ': "/' + CmdStr + '"') end |
|
178 |
end; |
|
179 |
||
53 | 180 |
function GetLastConsoleLine: shortstring; |
2695 | 181 |
var valueStr: shortstring; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
182 |
i: LongWord; |
53 | 183 |
begin |
1242 | 184 |
i:= (CurrLine + cLinesCount - 2) mod cLinesCount; |
2695 | 185 |
valueStr:= ConsoleLines[i].s; |
1242 | 186 |
|
2695 | 187 |
valueStr:= valueStr + #10; |
1242 | 188 |
|
189 |
i:= (CurrLine + cLinesCount - 1) mod cLinesCount; |
|
2695 | 190 |
valueStr:= valueStr + ConsoleLines[i].s; |
1242 | 191 |
|
2695 | 192 |
GetLastConsoleLine:= valueStr; |
53 | 193 |
end; |
194 |
||
936
ba582673db7d
Fix 'AI may break demos playing' message while loading saves
unc0rr
parents:
917
diff
changeset
|
195 |
procedure StopMessages(Message: Longword); |
ba582673db7d
Fix 'AI may break demos playing' message while loading saves
unc0rr
parents:
917
diff
changeset
|
196 |
begin |
3894 | 197 |
if (Message and gmLeft) <> 0 then ParseCommand('/-left', true) else |
198 |
if (Message and gmRight) <> 0 then ParseCommand('/-right', true) else |
|
199 |
if (Message and gmUp) <> 0 then ParseCommand('/-up', true) else |
|
200 |
if (Message and gmDown) <> 0 then ParseCommand('/-down', true) else |
|
201 |
if (Message and gmAttack) <> 0 then ParseCommand('/-attack', true) |
|
936
ba582673db7d
Fix 'AI may break demos playing' message while loading saves
unc0rr
parents:
917
diff
changeset
|
202 |
end; |
ba582673db7d
Fix 'AI may break demos playing' message while loading saves
unc0rr
parents:
917
diff
changeset
|
203 |
|
2599 | 204 |
{$INCLUDE "CCHandlers.inc"} |
3038 | 205 |
procedure initModule; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2695
diff
changeset
|
206 |
var i: LongInt; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2695
diff
changeset
|
207 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
208 |
CurrLine:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
209 |
Variables:= nil; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
210 |
isDeveloperMode:= true; |
3697 | 211 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
212 |
// initConsole |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
213 |
cLineWidth:= cScreenWidth div 10; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
214 |
if cLineWidth > 255 then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
215 |
cLineWidth:= 255; |
3697 | 216 |
for i:= 0 to Pred(cLinesCount) do |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
217 |
PByte(@ConsoleLines[i])^:= 0; |
3697 | 218 |
|
3938 | 219 |
// NOTE: please, keep most frequently used commands on bottom |
220 |
RegisterVariable('flag' , vtCommand, @chFlag , false); |
|
221 |
RegisterVariable('script' , vtCommand, @chScript , false); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
222 |
RegisterVariable('proto' , vtCommand, @chCheckProto , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
223 |
RegisterVariable('spectate', vtBoolean, @fastUntilLag , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
224 |
RegisterVariable('capture' , vtCommand, @chCapture , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
225 |
RegisterVariable('rotmask' , vtCommand, @chRotateMask , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
226 |
RegisterVariable('addteam' , vtCommand, @chAddTeam , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
227 |
RegisterVariable('rdriven' , vtCommand, @chTeamLocal , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
228 |
RegisterVariable('map' , vtCommand, @chSetMap , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
229 |
RegisterVariable('theme' , vtCommand, @chSetTheme , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
230 |
RegisterVariable('seed' , vtCommand, @chSetSeed , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
231 |
RegisterVariable('template_filter', vtLongInt, @cTemplateFilter, false); |
3133 | 232 |
RegisterVariable('mapgen' , vtLongInt, @cMapGen , false); |
233 |
RegisterVariable('maze_size',vtLongInt, @cMazeSize , false); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
234 |
RegisterVariable('delay' , vtLongInt, @cInactDelay , false); |
3777 | 235 |
RegisterVariable('ready' , vtLongInt, @cReadyDelay , false); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
236 |
RegisterVariable('casefreq', vtLongInt, @cCaseFactor , false); |
4143
eb7981f34800
Remove the last vestiges of the shoppa hack by adding 2 spinners for percentage health and amount of health in crate, also update translations and increase SD spinner (some users have requested it)
henek
parents:
4046
diff
changeset
|
237 |
RegisterVariable('healthprob', vtLongInt, @cHealthCaseProb, false); |
eb7981f34800
Remove the last vestiges of the shoppa hack by adding 2 spinners for percentage health and amount of health in crate, also update translations and increase SD spinner (some users have requested it)
henek
parents:
4046
diff
changeset
|
238 |
RegisterVariable('hcaseamount', vtLongInt, @cHealthCaseAmount, false); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
239 |
RegisterVariable('sd_turns', vtLongInt, @cSuddenDTurns , false); |
4153
6bd94e4c5d65
2 more variables to control water rise and health loss during sudden death.
henek
parents:
4143
diff
changeset
|
240 |
RegisterVariable('waterrise', vtLongInt, @cWaterRise , false); |
6bd94e4c5d65
2 more variables to control water rise and health loss during sudden death.
henek
parents:
4143
diff
changeset
|
241 |
RegisterVariable('healthdec', vtLongInt, @cHealthDecrease, false); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
242 |
RegisterVariable('damagepct',vtLongInt, @cDamagePercent , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
243 |
RegisterVariable('minedudpct',vtLongInt,@cMineDudPercent, false); |
4003
ca0600ab38bf
disable gfMines and update variable names (landadds -> minesnum, cLandAdditions -> cLandMines)
koda
parents:
3969
diff
changeset
|
244 |
RegisterVariable('minesnum', vtLongInt, @cLandMines , false); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
245 |
RegisterVariable('explosives',vtLongInt,@cExplosives , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
246 |
RegisterVariable('gmflags' , vtLongInt, @GameFlags , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
247 |
RegisterVariable('trflags' , vtLongInt, @TrainingFlags , false); |
4210
caa9b08990eb
revert 4200:dd54999c2822 - it was breaking schemes. koda. just leave this alone until next release
nemo
parents:
4208
diff
changeset
|
248 |
RegisterVariable('turntime', vtLongInt, @cHedgehogTurnTime, false); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
249 |
RegisterVariable('minestime',vtLongInt, @cMinesTime , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
250 |
RegisterVariable('fort' , vtCommand, @chFort , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
251 |
RegisterVariable('voicepack',vtCommand, @chVoicepack , false); |
3969
5f4ef3db0a65
Ok. Let's disable the right one this time. In fact, let's just remove newgrave entirely - no point in half-measures.
nemo
parents:
3968
diff
changeset
|
252 |
RegisterVariable('grave' , vtCommand, @chGrave , false); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
253 |
RegisterVariable('bind' , vtCommand, @chBind , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
254 |
RegisterVariable('addhh' , vtCommand, @chAddHH , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
255 |
RegisterVariable('hat' , vtCommand, @chSetHat , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
256 |
RegisterVariable('hhcoords', vtCommand, @chSetHHCoords , false); |
3346 | 257 |
RegisterVariable('ammloadt', vtCommand, @chSetAmmoLoadout, false); |
258 |
RegisterVariable('ammdelay', vtCommand, @chSetAmmoDelay, false); |
|
259 |
RegisterVariable('ammprob', vtCommand, @chSetAmmoProbability, false); |
|
260 |
RegisterVariable('ammreinf', vtCommand, @chSetAmmoReinforcement, false); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
261 |
RegisterVariable('ammstore', vtCommand, @chAddAmmoStore , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
262 |
RegisterVariable('quit' , vtCommand, @chQuit , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
263 |
RegisterVariable('confirm' , vtCommand, @chConfirm , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
264 |
RegisterVariable('+speedup', vtCommand, @chSpeedup_p , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
265 |
RegisterVariable('-speedup', vtCommand, @chSpeedup_m , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
266 |
RegisterVariable('zoomin' , vtCommand, @chZoomIn , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
267 |
RegisterVariable('zoomout' , vtCommand, @chZoomOut , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
268 |
RegisterVariable('zoomreset',vtCommand, @chZoomReset , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
269 |
RegisterVariable('skip' , vtCommand, @chSkip , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
270 |
RegisterVariable('history' , vtCommand, @chHistory , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
271 |
RegisterVariable('chat' , vtCommand, @chChat , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
272 |
RegisterVariable('say' , vtCommand, @chSay , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
273 |
RegisterVariable('hogsay' , vtCommand, @chHogSay , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
274 |
RegisterVariable('team' , vtCommand, @chTeamSay , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
275 |
RegisterVariable('ammomenu', vtCommand, @chAmmoMenu , true); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
276 |
RegisterVariable('+precise', vtCommand, @chPrecise_p , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
277 |
RegisterVariable('-precise', vtCommand, @chPrecise_m , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
278 |
RegisterVariable('+left' , vtCommand, @chLeft_p , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
279 |
RegisterVariable('-left' , vtCommand, @chLeft_m , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
280 |
RegisterVariable('+right' , vtCommand, @chRight_p , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
281 |
RegisterVariable('-right' , vtCommand, @chRight_m , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
282 |
RegisterVariable('+up' , vtCommand, @chUp_p , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
283 |
RegisterVariable('-up' , vtCommand, @chUp_m , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
284 |
RegisterVariable('+down' , vtCommand, @chDown_p , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
285 |
RegisterVariable('-down' , vtCommand, @chDown_m , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
286 |
RegisterVariable('+attack' , vtCommand, @chAttack_p , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
287 |
RegisterVariable('-attack' , vtCommand, @chAttack_m , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
288 |
RegisterVariable('switch' , vtCommand, @chSwitch , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
289 |
RegisterVariable('nextturn', vtCommand, @chNextTurn , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
290 |
RegisterVariable('timer' , vtCommand, @chTimer , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
291 |
RegisterVariable('taunt' , vtCommand, @chTaunt , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
292 |
RegisterVariable('setweap' , vtCommand, @chSetWeapon , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
293 |
RegisterVariable('slot' , vtCommand, @chSlot , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
294 |
RegisterVariable('put' , vtCommand, @chPut , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
295 |
RegisterVariable('ljump' , vtCommand, @chLJump , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
296 |
RegisterVariable('hjump' , vtCommand, @chHJump , false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
297 |
RegisterVariable('fullscr' , vtCommand, @chFullScr , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
298 |
RegisterVariable('+volup' , vtCommand, @chVol_p , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
299 |
RegisterVariable('-volup' , vtCommand, @chVol_m , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
300 |
RegisterVariable('+voldown', vtCommand, @chVol_m , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
301 |
RegisterVariable('-voldown', vtCommand, @chVol_p , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
302 |
RegisterVariable('findhh' , vtCommand, @chFindhh , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
303 |
RegisterVariable('pause' , vtCommand, @chPause , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
304 |
RegisterVariable('+cur_u' , vtCommand, @chCurU_p , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
305 |
RegisterVariable('-cur_u' , vtCommand, @chCurU_m , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
306 |
RegisterVariable('+cur_d' , vtCommand, @chCurD_p , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
307 |
RegisterVariable('-cur_d' , vtCommand, @chCurD_m , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
308 |
RegisterVariable('+cur_l' , vtCommand, @chCurL_p , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
309 |
RegisterVariable('-cur_l' , vtCommand, @chCurL_m , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
310 |
RegisterVariable('+cur_r' , vtCommand, @chCurR_p , true ); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
311 |
RegisterVariable('-cur_r' , vtCommand, @chCurR_m , true ); |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2695
diff
changeset
|
312 |
end; |
4 | 313 |
|
3038 | 314 |
procedure freeModule; |
3617 | 315 |
var t, tt: PVariable; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2695
diff
changeset
|
316 |
begin |
3617 | 317 |
tt:= Variables; |
318 |
Variables:= nil; |
|
319 |
while tt <> nil do |
|
320 |
begin |
|
321 |
t:= tt; |
|
322 |
tt:= tt^.Next; |
|
323 |
Dispose(t) |
|
324 |
end; |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2695
diff
changeset
|
325 |
end; |
4 | 326 |
|
327 |
end. |