author | sheepluva |
Mon, 20 Oct 2014 19:50:46 +0200 | |
changeset 10439 | 7de934f2247c |
parent 10392 | 5012e1f9e893 |
child 10455 | e167cfdf6e80 |
permissions | -rw-r--r-- |
4976 | 1 |
(* |
2 |
* Hedgewars, a free turn based strategy game |
|
9998 | 3 |
* Copyright (c) 2004-2014 Andrey Korotaev <unC0Rr@gmail.com> |
4976 | 4 |
* |
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 |
|
8 |
* |
|
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. |
|
13 |
* |
|
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 |
|
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
10015
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
4976 | 17 |
*) |
18 |
||
4413 | 19 |
{$INCLUDE "options.inc"} |
4976 | 20 |
|
4413 | 21 |
unit uCommandHandlers; |
22 |
||
23 |
interface |
|
24 |
||
25 |
procedure initModule; |
|
26 |
procedure freeModule; |
|
27 |
||
28 |
implementation |
|
10392 | 29 |
uses uCommands, uTypes, uVariables, uIO, uDebug, uConsts, uScript, uUtils, SDLh, uWorld, uRandom, uCaptions |
7629 | 30 |
{$IFDEF USE_VIDEO_RECORDING}, uVideoRec {$ENDIF}; |
4413 | 31 |
|
7028 | 32 |
var prevGState: TGameState = gsConfirm; |
8145
6408c0ba4ba1
Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8025
diff
changeset
|
33 |
cTagsMasks : array[0..15] of byte = (7, 0, 0, 0, 15, 6, 4, 5, 0, 0, 0, 0, 0, 14, 12, 13); |
6408c0ba4ba1
Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8025
diff
changeset
|
34 |
cTagsMasksNoHealth: array[0..15] of byte = (3, 2, 11, 1, 0, 0, 0, 0, 0, 10, 0, 9, 0, 0, 0, 0); |
7028 | 35 |
|
4531
4ea193b0e378
Reenable ReadyTimer using a synced message NEEDS TESTING.
nemo
parents:
4528
diff
changeset
|
36 |
procedure chGenCmd(var s: shortstring); |
4ea193b0e378
Reenable ReadyTimer using a synced message NEEDS TESTING.
nemo
parents:
4528
diff
changeset
|
37 |
begin |
4ea193b0e378
Reenable ReadyTimer using a synced message NEEDS TESTING.
nemo
parents:
4528
diff
changeset
|
38 |
case s[1] of |
8924 | 39 |
'R': if ReadyTimeLeft > 1 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
40 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
41 |
ReadyTimeLeft:= 1; |
7805 | 42 |
if not isExternalSource then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
43 |
SendIPC('c'+s); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
44 |
end |
4531
4ea193b0e378
Reenable ReadyTimer using a synced message NEEDS TESTING.
nemo
parents:
4528
diff
changeset
|
45 |
end |
4ea193b0e378
Reenable ReadyTimer using a synced message NEEDS TESTING.
nemo
parents:
4528
diff
changeset
|
46 |
end; |
4ea193b0e378
Reenable ReadyTimer using a synced message NEEDS TESTING.
nemo
parents:
4528
diff
changeset
|
47 |
|
4413 | 48 |
procedure chQuit(var s: shortstring); |
49 |
begin |
|
4751 | 50 |
s:= s; // avoid compiler hint |
5555
38e3d9347910
Don't switch to gsConfirm state (which is pretty same as gsGame) when not in gsGame or gsChat state. Prevents crashes and other possible kinds of wierd behaviour.
unc0rr
parents:
5524
diff
changeset
|
51 |
if (GameState = gsGame) or (GameState = gsChat) then |
38e3d9347910
Don't switch to gsConfirm state (which is pretty same as gsGame) when not in gsGame or gsChat state. Prevents crashes and other possible kinds of wierd behaviour.
unc0rr
parents:
5524
diff
changeset
|
52 |
begin |
4413 | 53 |
prevGState:= GameState; |
5523 | 54 |
GameState:= gsConfirm; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
55 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
56 |
else |
10392 | 57 |
if GameState = gsConfirm then |
58 |
GameState:= prevGState; |
|
59 |
||
60 |
updateCursorVisibility; |
|
4413 | 61 |
end; |
62 |
||
4744
ecc2c757d0df
general uKey refactor in preparaiton of two new shortcuts
koda
parents:
4661
diff
changeset
|
63 |
procedure chForceQuit(var s: shortstring); |
ecc2c757d0df
general uKey refactor in preparaiton of two new shortcuts
koda
parents:
4661
diff
changeset
|
64 |
begin |
ecc2c757d0df
general uKey refactor in preparaiton of two new shortcuts
koda
parents:
4661
diff
changeset
|
65 |
s:= s; // avoid compiler hint |
4751 | 66 |
GameState:= gsConfirm; |
67 |
ParseCommand('confirm', true); |
|
4413 | 68 |
end; |
69 |
||
70 |
procedure chConfirm(var s: shortstring); |
|
71 |
begin |
|
4751 | 72 |
s:= s; // avoid compiler hint |
73 |
if GameState = gsConfirm then |
|
7722 | 74 |
begin |
7068 | 75 |
SendIPC(_S'Q'); |
4751 | 76 |
GameState:= gsExit |
7722 | 77 |
end |
78 |
else |
|
79 |
ParseCommand('chat team', true); |
|
4413 | 80 |
end; |
81 |
||
4751 | 82 |
procedure chHalt (var s: shortstring); |
4746
3ae448aebe7e
implemented actions for closing/enging program (needs testing over the net)
koda
parents:
4744
diff
changeset
|
83 |
begin |
3ae448aebe7e
implemented actions for closing/enging program (needs testing over the net)
koda
parents:
4744
diff
changeset
|
84 |
s:= s; // avoid compiler hint |
7068 | 85 |
SendIPC(_S'H'); |
4746
3ae448aebe7e
implemented actions for closing/enging program (needs testing over the net)
koda
parents:
4744
diff
changeset
|
86 |
GameState:= gsExit |
3ae448aebe7e
implemented actions for closing/enging program (needs testing over the net)
koda
parents:
4744
diff
changeset
|
87 |
end; |
3ae448aebe7e
implemented actions for closing/enging program (needs testing over the net)
koda
parents:
4744
diff
changeset
|
88 |
|
4413 | 89 |
procedure chCheckProto(var s: shortstring); |
8370 | 90 |
var i: LongInt; |
4413 | 91 |
begin |
6001 | 92 |
if isDeveloperMode then |
93 |
begin |
|
8370 | 94 |
i:= StrToInt(s); |
6001 | 95 |
TryDo(i <= cNetProtoVersion, 'Protocol version mismatch: engine is too old (got '+intToStr(i)+', expecting '+intToStr(cNetProtoVersion)+')', true); |
96 |
TryDo(i >= cNetProtoVersion, 'Protocol version mismatch: engine is too new (got '+intToStr(i)+', expecting '+intToStr(cNetProtoVersion)+')', true); |
|
7058 | 97 |
end |
4413 | 98 |
end; |
99 |
||
100 |
procedure chTeamLocal(var s: shortstring); |
|
101 |
begin |
|
102 |
s:= s; // avoid compiler hint |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
103 |
if not isDeveloperMode then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
104 |
exit; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
105 |
if CurrentTeam = nil then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
106 |
OutError(errmsgIncorrectUse + ' "/rdriven"', true); |
4413 | 107 |
CurrentTeam^.ExtDriven:= true |
108 |
end; |
|
109 |
||
110 |
procedure chScript(var s: shortstring); |
|
111 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
112 |
if s[1]='"' then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
113 |
Delete(s, 1, 1); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
114 |
if s[byte(s[0])]='"' then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
115 |
Delete(s, byte(s[0]), 1); |
6254
e90fb60cb46d
Force a desync if there is a script name mismatch. This avoids playing until the game desyncs due to script differences.
nemo
parents:
6245
diff
changeset
|
116 |
cScriptName:= s; |
4413 | 117 |
ScriptLoad(s) |
118 |
end; |
|
119 |
||
9902 | 120 |
procedure chScriptParam(var s: shortstring); |
121 |
begin |
|
9985
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9902
diff
changeset
|
122 |
ScriptSetString('ScriptParam', s); |
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9902
diff
changeset
|
123 |
ScriptCall('onParameters'); |
9902 | 124 |
end; |
125 |
||
4413 | 126 |
procedure chCurU_p(var s: shortstring); |
127 |
begin |
|
128 |
s:= s; // avoid compiler hint |
|
129 |
CursorMovementY:= -1; |
|
130 |
end; |
|
131 |
||
132 |
procedure chCurU_m(var s: shortstring); |
|
133 |
begin |
|
134 |
s:= s; // avoid compiler hint |
|
135 |
CursorMovementY:= 0; |
|
136 |
end; |
|
137 |
||
138 |
procedure chCurD_p(var s: shortstring); |
|
139 |
begin |
|
140 |
s:= s; // avoid compiler hint |
|
141 |
CursorMovementY:= 1; |
|
142 |
end; |
|
143 |
||
144 |
procedure chCurD_m(var s: shortstring); |
|
145 |
begin |
|
146 |
s:= s; // avoid compiler hint |
|
147 |
CursorMovementY:= 0; |
|
148 |
end; |
|
149 |
||
150 |
procedure chCurL_p(var s: shortstring); |
|
151 |
begin |
|
152 |
s:= s; // avoid compiler hint |
|
153 |
CursorMovementX:= -1; |
|
154 |
end; |
|
155 |
||
156 |
procedure chCurL_m(var s: shortstring); |
|
157 |
begin |
|
158 |
s:= s; // avoid compiler hint |
|
159 |
CursorMovementX:= 0; |
|
160 |
end; |
|
161 |
||
162 |
procedure chCurR_p(var s: shortstring); |
|
163 |
begin |
|
164 |
s:= s; // avoid compiler hint |
|
165 |
CursorMovementX:= 1; |
|
166 |
end; |
|
167 |
||
168 |
procedure chCurR_m(var s: shortstring); |
|
169 |
begin |
|
170 |
s:= s; // avoid compiler hint |
|
171 |
CursorMovementX:= 0; |
|
172 |
end; |
|
173 |
||
174 |
procedure chLeft_p(var s: shortstring); |
|
175 |
begin |
|
176 |
s:= s; // avoid compiler hint |
|
10392 | 177 |
if CheckNoTeamOrHH then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
178 |
exit; |
7805 | 179 |
if not isExternalSource then |
7068 | 180 |
SendIPC(_S'L'); |
4413 | 181 |
bShowFinger:= false; |
182 |
with CurrentHedgehog^.Gear^ do |
|
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
183 |
Message:= Message or (gmLeft and InputMask); |
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
184 |
ScriptCall('onLeft'); |
4413 | 185 |
end; |
186 |
||
187 |
procedure chLeft_m(var s: shortstring); |
|
188 |
begin |
|
189 |
s:= s; // avoid compiler hint |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
190 |
if CheckNoTeamOrHH then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
191 |
exit; |
7805 | 192 |
if not isExternalSource then |
7068 | 193 |
SendIPC(_S'l'); |
4413 | 194 |
with CurrentHedgehog^.Gear^ do |
6453
11c578d30bd3
Countless imporvements to the parser and countless help to the parser in sources.
unc0rr
parents:
6415
diff
changeset
|
195 |
Message:= Message and (not (gmLeft and InputMask)); |
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
196 |
ScriptCall('onLeftUp'); |
4413 | 197 |
end; |
198 |
||
199 |
procedure chRight_p(var s: shortstring); |
|
200 |
begin |
|
201 |
s:= s; // avoid compiler hint |
|
10392 | 202 |
if CheckNoTeamOrHH then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
203 |
exit; |
7805 | 204 |
if not isExternalSource then |
7068 | 205 |
SendIPC(_S'R'); |
4413 | 206 |
bShowFinger:= false; |
207 |
with CurrentHedgehog^.Gear^ do |
|
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
208 |
Message:= Message or (gmRight and InputMask); |
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
209 |
ScriptCall('onRight'); |
4413 | 210 |
end; |
211 |
||
212 |
procedure chRight_m(var s: shortstring); |
|
213 |
begin |
|
214 |
s:= s; // avoid compiler hint |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
215 |
if CheckNoTeamOrHH then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
216 |
exit; |
7805 | 217 |
if not isExternalSource then |
7068 | 218 |
SendIPC(_S'r'); |
4413 | 219 |
with CurrentHedgehog^.Gear^ do |
6453
11c578d30bd3
Countless imporvements to the parser and countless help to the parser in sources.
unc0rr
parents:
6415
diff
changeset
|
220 |
Message:= Message and (not (gmRight and InputMask)); |
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
221 |
ScriptCall('onRightUp'); |
4413 | 222 |
end; |
223 |
||
224 |
procedure chUp_p(var s: shortstring); |
|
225 |
begin |
|
226 |
s:= s; // avoid compiler hint |
|
10392 | 227 |
if CheckNoTeamOrHH then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
228 |
exit; |
7805 | 229 |
if not isExternalSource then |
7068 | 230 |
SendIPC(_S'U'); |
4413 | 231 |
bShowFinger:= false; |
232 |
with CurrentHedgehog^.Gear^ do |
|
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
233 |
Message:= Message or (gmUp and InputMask); |
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
234 |
ScriptCall('onUp'); |
4413 | 235 |
end; |
236 |
||
237 |
procedure chUp_m(var s: shortstring); |
|
238 |
begin |
|
239 |
s:= s; // avoid compiler hint |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
240 |
if CheckNoTeamOrHH then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
241 |
exit; |
7805 | 242 |
if not isExternalSource then |
7068 | 243 |
SendIPC(_S'u'); |
4413 | 244 |
with CurrentHedgehog^.Gear^ do |
6453
11c578d30bd3
Countless imporvements to the parser and countless help to the parser in sources.
unc0rr
parents:
6415
diff
changeset
|
245 |
Message:= Message and (not (gmUp and InputMask)); |
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
246 |
ScriptCall('onUpUp'); |
4413 | 247 |
end; |
248 |
||
249 |
procedure chDown_p(var s: shortstring); |
|
250 |
begin |
|
251 |
s:= s; // avoid compiler hint |
|
10392 | 252 |
if CheckNoTeamOrHH then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
253 |
exit; |
7805 | 254 |
if not isExternalSource then |
7068 | 255 |
SendIPC(_S'D'); |
4413 | 256 |
bShowFinger:= false; |
257 |
with CurrentHedgehog^.Gear^ do |
|
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
258 |
Message:= Message or (gmDown and InputMask); |
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
259 |
ScriptCall('onDown'); |
4413 | 260 |
end; |
261 |
||
262 |
procedure chDown_m(var s: shortstring); |
|
263 |
begin |
|
264 |
s:= s; // avoid compiler hint |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
265 |
if CheckNoTeamOrHH then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
266 |
exit; |
7805 | 267 |
if not isExternalSource then |
7068 | 268 |
SendIPC(_S'd'); |
4413 | 269 |
with CurrentHedgehog^.Gear^ do |
6453
11c578d30bd3
Countless imporvements to the parser and countless help to the parser in sources.
unc0rr
parents:
6415
diff
changeset
|
270 |
Message:= Message and (not (gmDown and InputMask)); |
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
271 |
ScriptCall('onDownUp'); |
4413 | 272 |
end; |
273 |
||
274 |
procedure chPrecise_p(var s: shortstring); |
|
275 |
begin |
|
276 |
s:= s; // avoid compiler hint |
|
10392 | 277 |
if CheckNoTeamOrHH then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
278 |
exit; |
7805 | 279 |
if not isExternalSource then |
7068 | 280 |
SendIPC(_S'Z'); |
4413 | 281 |
bShowFinger:= false; |
282 |
with CurrentHedgehog^.Gear^ do |
|
4522
0f590eefd531
Add an input mask for setting of gear messages. Intended for intercepting user messages. This is totally untested. I don't think it should desync but seriously needs a lot of testing. Esp the doPut behaviour.
nemo
parents:
4437
diff
changeset
|
283 |
Message:= Message or (gmPrecise and InputMask); |
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
284 |
ScriptCall('onPrecise'); |
4413 | 285 |
end; |
286 |
||
287 |
procedure chPrecise_m(var s: shortstring); |
|
288 |
begin |
|
289 |
s:= s; // avoid compiler hint |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
290 |
if CheckNoTeamOrHH then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
291 |
exit; |
7805 | 292 |
if not isExternalSource then |
7068 | 293 |
SendIPC(_S'z'); |
4413 | 294 |
with CurrentHedgehog^.Gear^ do |
6453
11c578d30bd3
Countless imporvements to the parser and countless help to the parser in sources.
unc0rr
parents:
6415
diff
changeset
|
295 |
Message:= Message and (not (gmPrecise and InputMask)); |
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
296 |
ScriptCall('onPreciseUp'); |
4413 | 297 |
end; |
298 |
||
299 |
procedure chLJump(var s: shortstring); |
|
300 |
begin |
|
301 |
s:= s; // avoid compiler hint |
|
10392 | 302 |
if CheckNoTeamOrHH then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
303 |
exit; |
7805 | 304 |
if not isExternalSource then |
7068 | 305 |
SendIPC(_S'j'); |
4413 | 306 |
bShowFinger:= false; |
307 |
with CurrentHedgehog^.Gear^ do |
|
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
308 |
Message:= Message or (gmLJump and InputMask); |
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
309 |
ScriptCall('onLJump'); |
4413 | 310 |
end; |
311 |
||
312 |
procedure chHJump(var s: shortstring); |
|
313 |
begin |
|
314 |
s:= s; // avoid compiler hint |
|
10392 | 315 |
if CheckNoTeamOrHH then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
316 |
exit; |
7805 | 317 |
if not isExternalSource then |
7068 | 318 |
SendIPC(_S'J'); |
4413 | 319 |
bShowFinger:= false; |
320 |
with CurrentHedgehog^.Gear^ do |
|
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
321 |
Message:= Message or (gmHJump and InputMask); |
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
322 |
ScriptCall('onHJump'); |
4413 | 323 |
end; |
324 |
||
325 |
procedure chAttack_p(var s: shortstring); |
|
326 |
begin |
|
327 |
s:= s; // avoid compiler hint |
|
10392 | 328 |
if CheckNoTeamOrHH then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
329 |
exit; |
4413 | 330 |
bShowFinger:= false; |
331 |
with CurrentHedgehog^.Gear^ do |
|
332 |
begin |
|
4900 | 333 |
AddFileLog('/+attack: hedgehog''s Gear^.State = '+inttostr(State)); |
4413 | 334 |
if ((State and gstHHDriven) <> 0) then |
335 |
begin |
|
336 |
FollowGear:= CurrentHedgehog^.Gear; |
|
7805 | 337 |
if not isExternalSource then |
7068 | 338 |
SendIPC(_S'A'); |
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
339 |
Message:= Message or (gmAttack and InputMask); |
10228 | 340 |
ScriptCall('onAttack'); // so if I fire airstrike, it doesn't count as attack? fine, fine |
4413 | 341 |
end |
342 |
end |
|
343 |
end; |
|
344 |
||
345 |
procedure chAttack_m(var s: shortstring); |
|
346 |
begin |
|
347 |
s:= s; // avoid compiler hint |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
348 |
if CheckNoTeamOrHH then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
349 |
exit; |
4413 | 350 |
with CurrentHedgehog^.Gear^ do |
351 |
begin |
|
7805 | 352 |
if not isExternalSource and |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
353 |
((Message and gmAttack) <> 0) then |
7068 | 354 |
SendIPC(_S'a'); |
6453
11c578d30bd3
Countless imporvements to the parser and countless help to the parser in sources.
unc0rr
parents:
6415
diff
changeset
|
355 |
Message:= Message and (not (gmAttack and InputMask)); |
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
356 |
ScriptCall('onAttackUp'); |
4413 | 357 |
end |
358 |
end; |
|
359 |
||
360 |
procedure chSwitch(var s: shortstring); |
|
361 |
begin |
|
362 |
s:= s; // avoid compiler hint |
|
10392 | 363 |
if CheckNoTeamOrHH then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
364 |
exit; |
7805 | 365 |
if not isExternalSource then |
7068 | 366 |
SendIPC(_S'S'); |
4413 | 367 |
bShowFinger:= false; |
368 |
with CurrentHedgehog^.Gear^ do |
|
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
369 |
Message:= Message or (gmSwitch and InputMask); |
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
370 |
ScriptCall('onSwitch'); |
4413 | 371 |
end; |
372 |
||
373 |
procedure chNextTurn(var s: shortstring); |
|
7671 | 374 |
var gi: PGear; |
4413 | 375 |
begin |
376 |
s:= s; // avoid compiler hint |
|
7103 | 377 |
|
4413 | 378 |
TryDo(AllInactive, '/nextturn called when not all gears are inactive', true); |
379 |
||
7389
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7218
diff
changeset
|
380 |
CheckSum:= CheckSum xor GameTicks; |
7104 | 381 |
gi := GearsList; |
382 |
while gi <> nil do |
|
383 |
begin |
|
9797
1fdc1507e42d
remove state from check, just to see if this was why we just desynced
nemo
parents:
9796
diff
changeset
|
384 |
with gi^ do CheckSum:= CheckSum xor X.round xor X.frac xor dX.round xor dX.frac xor Y.round xor Y.frac xor dY.round xor dY.frac; |
7389
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7218
diff
changeset
|
385 |
AddRandomness(CheckSum); |
7104 | 386 |
gi := gi^.NextGear |
387 |
end; |
|
7103 | 388 |
|
7805 | 389 |
if not isExternalSource then |
7103 | 390 |
begin |
391 |
s[0]:= #5; |
|
392 |
s[1]:= 'N'; |
|
7389
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7218
diff
changeset
|
393 |
SDLNet_Write32(CheckSum, @s[2]); |
7103 | 394 |
SendIPC(s) |
395 |
end |
|
396 |
else |
|
7831 | 397 |
TryDo(CurrentTeam^.hasGone or (CheckSum = lastTurnChecksum), 'Desync detected', true); |
398 |
||
7187
aff30d80bd7b
- Allow camera movement while current hedgehog is falling
unc0rr
parents:
7151
diff
changeset
|
399 |
AddFileLog('Next turn: time '+inttostr(GameTicks)); |
4413 | 400 |
end; |
401 |
||
402 |
procedure chTimer(var s: shortstring); |
|
403 |
begin |
|
7790 | 404 |
if CheckNoTeamOrHH then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
405 |
exit; |
4413 | 406 |
|
7790 | 407 |
TryDo((s[0] = #1) and (s[1] >= '1') and (s[1] <= '5'), 'Malformed /timer', true); |
408 |
||
7805 | 409 |
if not isExternalSource then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
410 |
SendIPC(s); |
4413 | 411 |
bShowFinger:= false; |
412 |
with CurrentHedgehog^.Gear^ do |
|
413 |
begin |
|
4522
0f590eefd531
Add an input mask for setting of gear messages. Intended for intercepting user messages. This is totally untested. I don't think it should desync but seriously needs a lot of testing. Esp the doPut behaviour.
nemo
parents:
4437
diff
changeset
|
414 |
Message:= Message or (gmTimer and InputMask); |
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
415 |
MsgParam:= byte(s[1]) - ord('0'); |
6818
136aa9c8c593
Add the parameters I missed the first time when I added these hooks.
mikade
parents:
6700
diff
changeset
|
416 |
ScriptCall('onTimer', MsgParam); |
4413 | 417 |
end |
418 |
end; |
|
419 |
||
420 |
procedure chSlot(var s: shortstring); |
|
421 |
var slot: LongWord; |
|
7068 | 422 |
ss: shortstring; |
4413 | 423 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
424 |
if (s[0] <> #1) or CheckNoTeamOrHH then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
425 |
exit; |
4413 | 426 |
slot:= byte(s[1]) - 49; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
427 |
if slot > cMaxSlotIndex then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
428 |
exit; |
7805 | 429 |
if not isExternalSource then |
7068 | 430 |
begin |
431 |
ss[0]:= #1; |
|
432 |
ss[1]:= char(byte(s[1]) + 79); |
|
433 |
SendIPC(ss); |
|
434 |
end; |
|
4413 | 435 |
bShowFinger:= false; |
436 |
with CurrentHedgehog^.Gear^ do |
|
437 |
begin |
|
4522
0f590eefd531
Add an input mask for setting of gear messages. Intended for intercepting user messages. This is totally untested. I don't think it should desync but seriously needs a lot of testing. Esp the doPut behaviour.
nemo
parents:
4437
diff
changeset
|
438 |
Message:= Message or (gmSlot and InputMask); |
8924 | 439 |
MsgParam:= slot; |
6818
136aa9c8c593
Add the parameters I missed the first time when I added these hooks.
mikade
parents:
6700
diff
changeset
|
440 |
ScriptCall('onSlot', MsgParam); |
4413 | 441 |
end |
442 |
end; |
|
443 |
||
444 |
procedure chSetWeapon(var s: shortstring); |
|
445 |
begin |
|
7790 | 446 |
if CheckNoTeamOrHH then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
447 |
exit; |
4413 | 448 |
|
7790 | 449 |
TryDo((s[0] = #1) and (s[1] <= char(High(TAmmoType))), 'Malformed /setweap', true); |
4413 | 450 |
|
7805 | 451 |
if not isExternalSource then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
452 |
SendIPC('w' + s); |
4413 | 453 |
|
454 |
with CurrentHedgehog^.Gear^ do |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
455 |
begin |
4522
0f590eefd531
Add an input mask for setting of gear messages. Intended for intercepting user messages. This is totally untested. I don't think it should desync but seriously needs a lot of testing. Esp the doPut behaviour.
nemo
parents:
4437
diff
changeset
|
456 |
Message:= Message or (gmWeapon and InputMask); |
4413 | 457 |
MsgParam:= byte(s[1]); |
6818
136aa9c8c593
Add the parameters I missed the first time when I added these hooks.
mikade
parents:
6700
diff
changeset
|
458 |
ScriptCall('onSetWeapon', MsgParam); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
459 |
end; |
4413 | 460 |
end; |
461 |
||
462 |
procedure chTaunt(var s: shortstring); |
|
463 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
464 |
if (s[0] <> #1) or CheckNoTeamOrHH then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
465 |
exit; |
4413 | 466 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
467 |
if TWave(s[1]) > High(TWave) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
468 |
exit; |
4413 | 469 |
|
7805 | 470 |
if not isExternalSource then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
471 |
SendIPC('t' + s); |
4413 | 472 |
|
473 |
with CurrentHedgehog^.Gear^ do |
|
474 |
begin |
|
4522
0f590eefd531
Add an input mask for setting of gear messages. Intended for intercepting user messages. This is totally untested. I don't think it should desync but seriously needs a lot of testing. Esp the doPut behaviour.
nemo
parents:
4437
diff
changeset
|
475 |
Message:= Message or (gmAnimate and InputMask); |
8924 | 476 |
MsgParam:= byte(s[1]) ; |
6818
136aa9c8c593
Add the parameters I missed the first time when I added these hooks.
mikade
parents:
6700
diff
changeset
|
477 |
ScriptCall('onTaunt', MsgParam); |
4413 | 478 |
end |
479 |
end; |
|
480 |
||
481 |
procedure chPut(var s: shortstring); |
|
482 |
begin |
|
483 |
s:= s; // avoid compiler hint |
|
484 |
doPut(0, 0, false); |
|
485 |
end; |
|
486 |
||
487 |
procedure chCapture(var s: shortstring); |
|
488 |
begin |
|
489 |
s:= s; // avoid compiler hint |
|
490 |
flagMakeCapture:= true |
|
491 |
end; |
|
492 |
||
7629 | 493 |
procedure chRecord(var s: shortstring); |
494 |
begin |
|
495 |
s:= s; // avoid compiler hint |
|
496 |
{$IFDEF USE_VIDEO_RECORDING} |
|
497 |
if flagPrerecording then |
|
498 |
StopPreRecording() |
|
499 |
else |
|
500 |
BeginPreRecording(); |
|
501 |
{$ENDIF} |
|
502 |
end; |
|
503 |
||
4413 | 504 |
procedure chSetMap(var s: shortstring); |
505 |
begin |
|
5679
505c6448069b
accidentally reverted this when reverting the rest of the override changes.
nemo
parents:
5555
diff
changeset
|
506 |
if isDeveloperMode then |
6088 | 507 |
begin |
6339 | 508 |
if s = '' then |
8025 | 509 |
cPathz[ptMapCurrent]:= s |
6339 | 510 |
else |
8025 | 511 |
cPathz[ptMapCurrent]:= cPathz[ptMaps] + '/' + s; |
6088 | 512 |
InitStepsFlags:= InitStepsFlags or cifMap |
513 |
end; |
|
6828
6a5d33bff0b0
At mikade's request. give scripting access to the map name prior to override.
nemo
parents:
6818
diff
changeset
|
514 |
cMapName:= s; |
6245 | 515 |
ScriptLoad('Maps/' + s + '/map.lua') |
4413 | 516 |
end; |
517 |
||
518 |
procedure chSetTheme(var s: shortstring); |
|
519 |
begin |
|
520 |
if isDeveloperMode then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
521 |
begin |
8025 | 522 |
cPathz[ptCurrTheme]:= cPathz[ptThemes] + '/' + s; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
523 |
Theme:= s; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
524 |
InitStepsFlags:= InitStepsFlags or cifTheme |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
525 |
end |
4413 | 526 |
end; |
527 |
||
528 |
procedure chSetSeed(var s: shortstring); |
|
529 |
begin |
|
530 |
if isDeveloperMode then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
531 |
begin |
8912 | 532 |
SetRandomSeed(s, true); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
533 |
cSeed:= s; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
534 |
InitStepsFlags:= InitStepsFlags or cifRandomize |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
535 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
536 |
end; |
4413 | 537 |
|
538 |
procedure chAmmoMenu(var s: shortstring); |
|
539 |
begin |
|
540 |
s:= s; // avoid compiler hint |
|
541 |
if CheckNoTeamOrHH then |
|
10439
7de934f2247c
allow toggling ammo menu while NoTeamOrHH, as suggested by unC0Rr
sheepluva
parents:
10392
diff
changeset
|
542 |
bShowAmmoMenu:= (not bShowAmmoMenu) |
4413 | 543 |
else |
544 |
begin |
|
545 |
with CurrentTeam^ do |
|
546 |
with Hedgehogs[CurrHedgehog] do |
|
547 |
begin |
|
548 |
bSelected:= false; |
|
549 |
||
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
550 |
if bShowAmmoMenu then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
551 |
bShowAmmoMenu:= false |
7946
a99a79bbd857
Simplify ammo menu conditions so it shows up in more states. Should fix issue #465. The part w/ sliding in uworld is main #465 problem.
nemo
parents:
7831
diff
changeset
|
552 |
else if not(CurrentTeam^.Extdriven) and (((Gear^.State and (gstAttacking or gstAttacked)) <> 0) |
a99a79bbd857
Simplify ammo menu conditions so it shows up in more states. Should fix issue #465. The part w/ sliding in uworld is main #465 problem.
nemo
parents:
7831
diff
changeset
|
553 |
or ((Gear^.State and gstHHDriven) = 0)) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
554 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
555 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
556 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
557 |
bShowAmmoMenu:= true |
4413 | 558 |
end; |
559 |
end |
|
560 |
end; |
|
561 |
||
562 |
procedure chVol_p(var s: shortstring); |
|
563 |
begin |
|
564 |
s:= s; // avoid compiler hint |
|
565 |
inc(cVolumeDelta, 3) |
|
566 |
end; |
|
567 |
||
568 |
procedure chVol_m(var s: shortstring); |
|
569 |
begin |
|
570 |
s:= s; // avoid compiler hint |
|
571 |
dec(cVolumeDelta, 3) |
|
572 |
end; |
|
573 |
||
574 |
procedure chFindhh(var s: shortstring); |
|
575 |
begin |
|
576 |
s:= s; // avoid compiler hint |
|
10392 | 577 |
if CheckNoTeamOrHH then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
578 |
exit; |
5247 | 579 |
|
7629 | 580 |
if autoCameraOn then |
5247 | 581 |
begin |
7629 | 582 |
FollowGear:= nil; |
10127 | 583 |
AddCaption(ansistring('Auto Camera Off'), $CCCCCC, capgrpVolume); |
5247 | 584 |
autoCameraOn:= false |
585 |
end |
|
7629 | 586 |
else |
587 |
begin |
|
10127 | 588 |
AddCaption(ansistring('Auto Camera On'), $CCCCCC, capgrpVolume); |
5247 | 589 |
bShowFinger:= true; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
590 |
if not CurrentHedgehog^.Unplaced then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
591 |
FollowGear:= CurrentHedgehog^.Gear; |
5247 | 592 |
autoCameraOn:= true |
593 |
end |
|
4413 | 594 |
end; |
595 |
||
596 |
procedure chPause(var s: shortstring); |
|
597 |
begin |
|
10392 | 598 |
if (gameType <> gmtNet) or (s = 'server') then |
9670
1954f692e8c6
Quick and simple implementation of afk mode (toggled by /pause)
unc0rr
parents:
9489
diff
changeset
|
599 |
isPaused:= not isPaused |
1954f692e8c6
Quick and simple implementation of afk mode (toggled by /pause)
unc0rr
parents:
9489
diff
changeset
|
600 |
else |
9671 | 601 |
if (CurrentTeam^.ExtDriven) or (CurrentHedgehog^.BotLevel > 0) then |
602 |
isAFK:= not isAFK |
|
603 |
else |
|
604 |
isAFK:= false; // for real ninjas |
|
5524
40b7f95d9f18
Oh, and fix cursor visibility correlations between gsConfirm state and paused state
unc0rr
parents:
5523
diff
changeset
|
605 |
|
10392 | 606 |
updateCursorVisibility; |
4413 | 607 |
end; |
608 |
||
609 |
procedure chRotateMask(var s: shortstring); |
|
610 |
begin |
|
611 |
s:= s; // avoid compiler hint |
|
9693 | 612 |
// this is just for me, 'cause I thought it'd be fun. using the old precise + switch to keep it out of people's way |
613 |
if LocalMessage and (gmPrecise or gmSwitch) = (gmPrecise or gmSwitch) then |
|
614 |
begin |
|
615 |
if UIDisplay <> uiNone then |
|
616 |
UIDisplay:= uiNone |
|
617 |
else UIDisplay:= uiAll |
|
618 |
end |
|
619 |
else if LocalMessage and gmPrecise = gmPrecise then |
|
620 |
begin |
|
621 |
if ((GameFlags and gfInvulnerable) = 0) then |
|
622 |
cTagsMask:= cTagsMasks[cTagsMask] |
|
623 |
else |
|
624 |
cTagsMask:= cTagsMasksNoHealth[cTagsMask] |
|
625 |
end |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
626 |
else |
9693 | 627 |
begin |
628 |
if UIDisplay <> uiNoTeams then |
|
629 |
UIDisplay:= uiNoTeams |
|
630 |
else UIDisplay:= uiAll |
|
631 |
end |
|
4413 | 632 |
end; |
633 |
||
634 |
procedure chSpeedup_p(var s: shortstring); |
|
635 |
begin |
|
636 |
s:= s; // avoid compiler hint |
|
7629 | 637 |
SpeedStart:= RealTicks; |
4413 | 638 |
isSpeed:= true |
639 |
end; |
|
640 |
||
641 |
procedure chSpeedup_m(var s: shortstring); |
|
642 |
begin |
|
643 |
s:= s; // avoid compiler hint |
|
644 |
isSpeed:= false |
|
645 |
end; |
|
646 |
||
647 |
procedure chZoomIn(var s: shortstring); |
|
648 |
begin |
|
649 |
s:= s; // avoid compiler hint |
|
650 |
if ZoomValue < cMinZoomLevel then |
|
651 |
ZoomValue:= ZoomValue + cZoomDelta; |
|
652 |
end; |
|
653 |
||
654 |
procedure chZoomOut(var s: shortstring); |
|
655 |
begin |
|
656 |
s:= s; // avoid compiler hint |
|
657 |
if ZoomValue > cMaxZoomLevel then |
|
658 |
ZoomValue:= ZoomValue - cZoomDelta; |
|
659 |
end; |
|
660 |
||
661 |
procedure chZoomReset(var s: shortstring); |
|
662 |
begin |
|
663 |
s:= s; // avoid compiler hint |
|
664 |
ZoomValue:= cDefaultZoomLevel; |
|
665 |
end; |
|
666 |
||
6898 | 667 |
procedure chMapGen(var s: shortstring); |
668 |
begin |
|
7151 | 669 |
cMapGen:= StrToInt(s) |
6898 | 670 |
end; |
671 |
||
672 |
procedure chTemplateFilter(var s: shortstring); |
|
673 |
begin |
|
7151 | 674 |
cTemplateFilter:= StrToInt(s) |
6898 | 675 |
end; |
676 |
||
677 |
procedure chInactDelay(var s: shortstring); |
|
678 |
begin |
|
7151 | 679 |
cInactDelay:= StrToInt(s) |
6898 | 680 |
end; |
681 |
||
682 |
procedure chReadyDelay(var s: shortstring); |
|
683 |
begin |
|
7151 | 684 |
cReadyDelay:= StrToInt(s) |
6898 | 685 |
end; |
686 |
||
687 |
procedure chCaseFactor(var s: shortstring); |
|
688 |
begin |
|
7151 | 689 |
cCaseFactor:= StrToInt(s) |
6898 | 690 |
end; |
691 |
||
692 |
procedure chHealthCaseProb(var s: shortstring); |
|
693 |
begin |
|
7151 | 694 |
cHealthCaseProb:= StrToInt(s) |
6898 | 695 |
end; |
696 |
||
697 |
procedure chHealthCaseAmount(var s: shortstring); |
|
698 |
begin |
|
7151 | 699 |
cHealthCaseAmount:= StrToInt(s) |
6898 | 700 |
end; |
701 |
||
702 |
procedure chSuddenDTurns(var s: shortstring); |
|
703 |
begin |
|
7151 | 704 |
cSuddenDTurns:= StrToInt(s) |
6898 | 705 |
end; |
706 |
||
707 |
procedure chWaterRise(var s: shortstring); |
|
708 |
begin |
|
7151 | 709 |
cWaterRise:= StrToInt(s) |
6898 | 710 |
end; |
711 |
||
712 |
procedure chHealthDecrease(var s: shortstring); |
|
713 |
begin |
|
7151 | 714 |
cHealthDecrease:= StrToInt(s) |
6898 | 715 |
end; |
716 |
||
717 |
procedure chDamagePercent(var s: shortstring); |
|
718 |
begin |
|
7151 | 719 |
cDamagePercent:= StrToInt(s) |
6898 | 720 |
end; |
721 |
||
722 |
procedure chRopePercent(var s: shortstring); |
|
723 |
begin |
|
7151 | 724 |
cRopePercent:= StrToInt(s) |
6898 | 725 |
end; |
726 |
||
727 |
procedure chGetAwayTime(var s: shortstring); |
|
728 |
begin |
|
7151 | 729 |
cGetAwayTime:= StrToInt(s) |
6898 | 730 |
end; |
731 |
||
732 |
procedure chMineDudPercent(var s: shortstring); |
|
733 |
begin |
|
7151 | 734 |
cMineDudPercent:= StrToInt(s) |
6898 | 735 |
end; |
736 |
||
737 |
procedure chLandMines(var s: shortstring); |
|
738 |
begin |
|
7151 | 739 |
cLandMines:= StrToInt(s) |
6898 | 740 |
end; |
741 |
||
742 |
procedure chExplosives(var s: shortstring); |
|
743 |
begin |
|
7151 | 744 |
cExplosives:= StrToInt(s) |
6898 | 745 |
end; |
746 |
||
747 |
procedure chGameFlags(var s: shortstring); |
|
748 |
begin |
|
7218
9ecd5bc9810b
Ensure that Clan ammo always takes precedence over Per Hog Ammo in the flags. It'd be best for the user sake if these buttons acted more like radio buttons.
nemo
parents:
7187
diff
changeset
|
749 |
GameFlags:= StrToInt(s); |
7629 | 750 |
if GameFlags and gfSharedAmmo <> 0 then GameFlags:= GameFlags and (not gfPerHogAmmo) |
6898 | 751 |
end; |
752 |
||
753 |
procedure chHedgehogTurnTime(var s: shortstring); |
|
754 |
begin |
|
7151 | 755 |
cHedgehogTurnTime:= StrToInt(s) |
6898 | 756 |
end; |
757 |
||
758 |
procedure chMinesTime(var s: shortstring); |
|
759 |
begin |
|
7151 | 760 |
cMinesTime:= StrToInt(s) |
6898 | 761 |
end; |
762 |
||
763 |
procedure chFastUntilLag(var s: shortstring); |
|
764 |
begin |
|
7151 | 765 |
fastUntilLag:= StrToInt(s) <> 0 |
6898 | 766 |
end; |
4413 | 767 |
|
7201
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7187
diff
changeset
|
768 |
procedure chCampVar(var s:shortstring); |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7187
diff
changeset
|
769 |
begin |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7187
diff
changeset
|
770 |
CampaignVariable := s; |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7187
diff
changeset
|
771 |
end; |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7187
diff
changeset
|
772 |
|
9489 | 773 |
procedure chWorldEdge(var s: shortstring); |
774 |
begin |
|
775 |
WorldEdge:= TWorldEdge(StrToInt(s)) |
|
776 |
end; |
|
777 |
||
10237 | 778 |
procedure chAdvancedMapGenMode(var s:shortstring); |
779 |
begin |
|
10249 | 780 |
s:= s; // avoid compiler hint |
10237 | 781 |
cAdvancedMapGenMode:= true; |
782 |
end; |
|
783 |
||
4413 | 784 |
procedure initModule; |
785 |
begin |
|
4528
630f4ab0c926
Reorder top registered variables by frequency gathered from 60 or so games of varying length/type. Oh. And add green hair to joker.
nemo
parents:
4522
diff
changeset
|
786 |
//////// Begin top sorted by freq analysis not including chatmsg |
7407 | 787 |
RegisterVariable('+right' , @chRight_p , false, true); |
788 |
RegisterVariable('-right' , @chRight_m , false, true); |
|
789 |
RegisterVariable('+up' , @chUp_p , false, true); |
|
790 |
RegisterVariable('-up' , @chUp_m , false, true); |
|
791 |
RegisterVariable('+left' , @chLeft_p , false, true); |
|
792 |
RegisterVariable('-left' , @chLeft_m , false, true); |
|
7629 | 793 |
RegisterVariable('+attack' , @chAttack_p , false); |
7407 | 794 |
RegisterVariable('+down' , @chDown_p , false, true); |
795 |
RegisterVariable('-down' , @chDown_m , false, true); |
|
796 |
RegisterVariable('hjump' , @chHJump , false, true); |
|
797 |
RegisterVariable('ljump' , @chLJump , false, true); |
|
7629 | 798 |
RegisterVariable('nextturn', @chNextTurn , false); |
799 |
RegisterVariable('-attack' , @chAttack_m , false); |
|
800 |
RegisterVariable('slot' , @chSlot , false); |
|
7407 | 801 |
RegisterVariable('setweap' , @chSetWeapon , false, true); |
4528
630f4ab0c926
Reorder top registered variables by frequency gathered from 60 or so games of varying length/type. Oh. And add green hair to joker.
nemo
parents:
4522
diff
changeset
|
802 |
//////// End top by freq analysis |
7629 | 803 |
RegisterVariable('gencmd' , @chGenCmd , false); |
6898 | 804 |
RegisterVariable('script' , @chScript , false); |
9902 | 805 |
RegisterVariable('scriptparam', @chScriptParam, false); |
6898 | 806 |
RegisterVariable('proto' , @chCheckProto , true ); |
807 |
RegisterVariable('spectate', @chFastUntilLag , false); |
|
808 |
RegisterVariable('capture' , @chCapture , true ); |
|
809 |
RegisterVariable('rotmask' , @chRotateMask , true ); |
|
810 |
RegisterVariable('rdriven' , @chTeamLocal , false); |
|
811 |
RegisterVariable('map' , @chSetMap , false); |
|
812 |
RegisterVariable('theme' , @chSetTheme , false); |
|
813 |
RegisterVariable('seed' , @chSetSeed , false); |
|
814 |
RegisterVariable('template_filter', @chTemplateFilter, false); |
|
815 |
RegisterVariable('mapgen' , @chMapGen , false); |
|
816 |
RegisterVariable('maze_size',@chTemplateFilter, false); |
|
817 |
RegisterVariable('delay' , @chInactDelay , false); |
|
818 |
RegisterVariable('ready' , @chReadyDelay , false); |
|
819 |
RegisterVariable('casefreq', @chCaseFactor , false); |
|
820 |
RegisterVariable('healthprob', @chHealthCaseProb, false); |
|
821 |
RegisterVariable('hcaseamount', @chHealthCaseAmount, false); |
|
822 |
RegisterVariable('sd_turns', @chSuddenDTurns , false); |
|
823 |
RegisterVariable('waterrise', @chWaterRise , false); |
|
824 |
RegisterVariable('healthdec', @chHealthDecrease, false); |
|
825 |
RegisterVariable('damagepct',@chDamagePercent , false); |
|
826 |
RegisterVariable('ropepct' , @chRopePercent , false); |
|
827 |
RegisterVariable('getawaytime' , @chGetAwayTime , false); |
|
828 |
RegisterVariable('minedudpct',@chMineDudPercent, false); |
|
829 |
RegisterVariable('minesnum', @chLandMines , false); |
|
830 |
RegisterVariable('explosives',@chExplosives , false); |
|
831 |
RegisterVariable('gmflags' , @chGameFlags , false); |
|
832 |
RegisterVariable('turntime', @chHedgehogTurnTime, false); |
|
833 |
RegisterVariable('minestime',@chMinesTime , false); |
|
834 |
RegisterVariable('quit' , @chQuit , true ); |
|
835 |
RegisterVariable('forcequit', @chForceQuit , true ); |
|
836 |
RegisterVariable('confirm' , @chConfirm , true ); |
|
837 |
RegisterVariable('halt', @chHalt , true ); |
|
838 |
RegisterVariable('+speedup', @chSpeedup_p , true ); |
|
839 |
RegisterVariable('-speedup', @chSpeedup_m , true ); |
|
840 |
RegisterVariable('zoomin' , @chZoomIn , true ); |
|
841 |
RegisterVariable('zoomout' , @chZoomOut , true ); |
|
842 |
RegisterVariable('zoomreset',@chZoomReset , true ); |
|
843 |
RegisterVariable('ammomenu', @chAmmoMenu , true); |
|
7629 | 844 |
RegisterVariable('+precise', @chPrecise_p , false, true); |
845 |
RegisterVariable('-precise', @chPrecise_m , false, true); |
|
6898 | 846 |
RegisterVariable('switch' , @chSwitch , false); |
7629 | 847 |
RegisterVariable('timer' , @chTimer , false, true); |
6898 | 848 |
RegisterVariable('taunt' , @chTaunt , false); |
849 |
RegisterVariable('put' , @chPut , false); |
|
850 |
RegisterVariable('+volup' , @chVol_p , true ); |
|
851 |
RegisterVariable('-volup' , @chVol_m , true ); |
|
852 |
RegisterVariable('+voldown', @chVol_m , true ); |
|
853 |
RegisterVariable('-voldown', @chVol_p , true ); |
|
7404 | 854 |
RegisterVariable('findhh' , @chFindhh , true ); |
6898 | 855 |
RegisterVariable('pause' , @chPause , true ); |
856 |
RegisterVariable('+cur_u' , @chCurU_p , true ); |
|
857 |
RegisterVariable('-cur_u' , @chCurU_m , true ); |
|
858 |
RegisterVariable('+cur_d' , @chCurD_p , true ); |
|
859 |
RegisterVariable('-cur_d' , @chCurD_m , true ); |
|
860 |
RegisterVariable('+cur_l' , @chCurL_p , true ); |
|
861 |
RegisterVariable('-cur_l' , @chCurL_m , true ); |
|
862 |
RegisterVariable('+cur_r' , @chCurR_p , true ); |
|
863 |
RegisterVariable('-cur_r' , @chCurR_m , true ); |
|
7201
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7187
diff
changeset
|
864 |
RegisterVariable('campvar' , @chCampVar , true ); |
7629 | 865 |
RegisterVariable('record' , @chRecord , true ); |
9489 | 866 |
RegisterVariable('worldedge',@chWorldEdge , false); |
10237 | 867 |
RegisterVariable('advmapgen',@chAdvancedMapGenMode, false); |
4413 | 868 |
end; |
869 |
||
870 |
procedure freeModule; |
|
871 |
begin |
|
872 |
end; |
|
873 |
||
874 |
end. |