author | Wuzzy <Wuzzy2@mail.ru> |
Fri, 09 Feb 2018 10:48:24 +0100 | |
changeset 12936 | b9904380ce26 |
parent 12847 | 1aba77b2e4ac |
child 12990 | 8dd95c095882 |
permissions | -rw-r--r-- |
4976 | 1 |
(* |
2 |
* Hedgewars, a free turn based strategy game |
|
11046 | 3 |
* Copyright (c) 2004-2015 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 |
12815
92218a06c9ff
Don't send taunt message for automatically happening taunt animation
unc0rr
parents:
12490
diff
changeset
|
30 |
, uVisualGearsList, uGearsHedgehog |
7629 | 31 |
{$IFDEF USE_VIDEO_RECORDING}, uVideoRec {$ENDIF}; |
4413 | 32 |
|
7028 | 33 |
var prevGState: TGameState = gsConfirm; |
8145
6408c0ba4ba1
Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8025
diff
changeset
|
34 |
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
|
35 |
cTagsMasksNoHealth: array[0..15] of byte = (3, 2, 11, 1, 0, 0, 0, 0, 0, 10, 0, 9, 0, 0, 0, 0); |
7028 | 36 |
|
4531
4ea193b0e378
Reenable ReadyTimer using a synced message NEEDS TESTING.
nemo
parents:
4528
diff
changeset
|
37 |
procedure chGenCmd(var s: shortstring); |
4ea193b0e378
Reenable ReadyTimer using a synced message NEEDS TESTING.
nemo
parents:
4528
diff
changeset
|
38 |
begin |
4ea193b0e378
Reenable ReadyTimer using a synced message NEEDS TESTING.
nemo
parents:
4528
diff
changeset
|
39 |
case s[1] of |
11919
e0476802c8b5
When doing something, set ready time to 0 instead of 1
Wuzzy <almikes@aol.com>
parents:
11532
diff
changeset
|
40 |
'R': if ReadyTimeLeft > 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
|
41 |
begin |
11919
e0476802c8b5
When doing something, set ready time to 0 instead of 1
Wuzzy <almikes@aol.com>
parents:
11532
diff
changeset
|
42 |
ReadyTimeLeft:= 0; |
7805 | 43 |
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
|
44 |
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
|
45 |
end |
4531
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 |
end; |
4ea193b0e378
Reenable ReadyTimer using a synced message NEEDS TESTING.
nemo
parents:
4528
diff
changeset
|
48 |
|
4413 | 49 |
procedure chQuit(var s: shortstring); |
50 |
begin |
|
4751 | 51 |
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
|
52 |
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
|
53 |
begin |
4413 | 54 |
prevGState:= GameState; |
5523 | 55 |
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
|
56 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
57 |
else |
10510 | 58 |
if GameState = gsConfirm then |
59 |
GameState:= prevGState; |
|
60 |
||
10392 | 61 |
updateCursorVisibility; |
4413 | 62 |
end; |
63 |
||
4744
ecc2c757d0df
general uKey refactor in preparaiton of two new shortcuts
koda
parents:
4661
diff
changeset
|
64 |
procedure chForceQuit(var s: shortstring); |
ecc2c757d0df
general uKey refactor in preparaiton of two new shortcuts
koda
parents:
4661
diff
changeset
|
65 |
begin |
ecc2c757d0df
general uKey refactor in preparaiton of two new shortcuts
koda
parents:
4661
diff
changeset
|
66 |
s:= s; // avoid compiler hint |
4751 | 67 |
GameState:= gsConfirm; |
68 |
ParseCommand('confirm', true); |
|
4413 | 69 |
end; |
70 |
||
71 |
procedure chConfirm(var s: shortstring); |
|
72 |
begin |
|
4751 | 73 |
s:= s; // avoid compiler hint |
74 |
if GameState = gsConfirm then |
|
7722 | 75 |
begin |
7068 | 76 |
SendIPC(_S'Q'); |
4751 | 77 |
GameState:= gsExit |
7722 | 78 |
end |
79 |
else |
|
80 |
ParseCommand('chat team', true); |
|
4413 | 81 |
end; |
82 |
||
4751 | 83 |
procedure chHalt (var s: shortstring); |
4746
3ae448aebe7e
implemented actions for closing/enging program (needs testing over the net)
koda
parents:
4744
diff
changeset
|
84 |
begin |
3ae448aebe7e
implemented actions for closing/enging program (needs testing over the net)
koda
parents:
4744
diff
changeset
|
85 |
s:= s; // avoid compiler hint |
7068 | 86 |
SendIPC(_S'H'); |
4746
3ae448aebe7e
implemented actions for closing/enging program (needs testing over the net)
koda
parents:
4744
diff
changeset
|
87 |
GameState:= gsExit |
3ae448aebe7e
implemented actions for closing/enging program (needs testing over the net)
koda
parents:
4744
diff
changeset
|
88 |
end; |
3ae448aebe7e
implemented actions for closing/enging program (needs testing over the net)
koda
parents:
4744
diff
changeset
|
89 |
|
4413 | 90 |
procedure chCheckProto(var s: shortstring); |
8370 | 91 |
var i: LongInt; |
4413 | 92 |
begin |
6001 | 93 |
if isDeveloperMode then |
94 |
begin |
|
8370 | 95 |
i:= StrToInt(s); |
11532 | 96 |
checkFails(i <= cNetProtoVersion, 'Protocol version mismatch: engine is too old (got '+intToStr(i)+', expecting '+intToStr(cNetProtoVersion)+')', true); |
97 |
checkFails(i >= cNetProtoVersion, 'Protocol version mismatch: engine is too new (got '+intToStr(i)+', expecting '+intToStr(cNetProtoVersion)+')', true); |
|
7058 | 98 |
end |
4413 | 99 |
end; |
100 |
||
101 |
procedure chTeamLocal(var s: shortstring); |
|
102 |
begin |
|
103 |
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
|
104 |
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
|
105 |
exit; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
106 |
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
|
107 |
OutError(errmsgIncorrectUse + ' "/rdriven"', true); |
4413 | 108 |
CurrentTeam^.ExtDriven:= true |
109 |
end; |
|
110 |
||
111 |
procedure chScript(var s: shortstring); |
|
112 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
113 |
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
|
114 |
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
|
115 |
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
|
116 |
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
|
117 |
cScriptName:= s; |
4413 | 118 |
ScriptLoad(s) |
119 |
end; |
|
120 |
||
9902 | 121 |
procedure chScriptParam(var s: shortstring); |
122 |
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
|
123 |
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
|
124 |
ScriptCall('onParameters'); |
9902 | 125 |
end; |
126 |
||
4413 | 127 |
procedure chCurU_p(var s: shortstring); |
128 |
begin |
|
129 |
s:= s; // avoid compiler hint |
|
130 |
CursorMovementY:= -1; |
|
131 |
end; |
|
132 |
||
133 |
procedure chCurU_m(var s: shortstring); |
|
134 |
begin |
|
135 |
s:= s; // avoid compiler hint |
|
136 |
CursorMovementY:= 0; |
|
137 |
end; |
|
138 |
||
139 |
procedure chCurD_p(var s: shortstring); |
|
140 |
begin |
|
141 |
s:= s; // avoid compiler hint |
|
142 |
CursorMovementY:= 1; |
|
143 |
end; |
|
144 |
||
145 |
procedure chCurD_m(var s: shortstring); |
|
146 |
begin |
|
147 |
s:= s; // avoid compiler hint |
|
148 |
CursorMovementY:= 0; |
|
149 |
end; |
|
150 |
||
151 |
procedure chCurL_p(var s: shortstring); |
|
152 |
begin |
|
153 |
s:= s; // avoid compiler hint |
|
154 |
CursorMovementX:= -1; |
|
155 |
end; |
|
156 |
||
157 |
procedure chCurL_m(var s: shortstring); |
|
158 |
begin |
|
159 |
s:= s; // avoid compiler hint |
|
160 |
CursorMovementX:= 0; |
|
161 |
end; |
|
162 |
||
163 |
procedure chCurR_p(var s: shortstring); |
|
164 |
begin |
|
165 |
s:= s; // avoid compiler hint |
|
166 |
CursorMovementX:= 1; |
|
167 |
end; |
|
168 |
||
169 |
procedure chCurR_m(var s: shortstring); |
|
170 |
begin |
|
171 |
s:= s; // avoid compiler hint |
|
172 |
CursorMovementX:= 0; |
|
173 |
end; |
|
174 |
||
175 |
procedure chLeft_p(var s: shortstring); |
|
176 |
begin |
|
177 |
s:= s; // avoid compiler hint |
|
10392 | 178 |
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
|
179 |
exit; |
7805 | 180 |
if not isExternalSource then |
7068 | 181 |
SendIPC(_S'L'); |
4413 | 182 |
bShowFinger:= false; |
183 |
with CurrentHedgehog^.Gear^ do |
|
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
184 |
Message:= Message or (gmLeft and InputMask); |
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
185 |
ScriptCall('onLeft'); |
4413 | 186 |
end; |
187 |
||
188 |
procedure chLeft_m(var s: shortstring); |
|
189 |
begin |
|
190 |
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
|
191 |
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
|
192 |
exit; |
7805 | 193 |
if not isExternalSource then |
7068 | 194 |
SendIPC(_S'l'); |
4413 | 195 |
with CurrentHedgehog^.Gear^ do |
6453
11c578d30bd3
Countless imporvements to the parser and countless help to the parser in sources.
unc0rr
parents:
6415
diff
changeset
|
196 |
Message:= Message and (not (gmLeft and InputMask)); |
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
197 |
ScriptCall('onLeftUp'); |
4413 | 198 |
end; |
199 |
||
200 |
procedure chRight_p(var s: shortstring); |
|
201 |
begin |
|
202 |
s:= s; // avoid compiler hint |
|
10392 | 203 |
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
|
204 |
exit; |
7805 | 205 |
if not isExternalSource then |
7068 | 206 |
SendIPC(_S'R'); |
4413 | 207 |
bShowFinger:= false; |
208 |
with CurrentHedgehog^.Gear^ do |
|
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
209 |
Message:= Message or (gmRight and InputMask); |
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
210 |
ScriptCall('onRight'); |
4413 | 211 |
end; |
212 |
||
213 |
procedure chRight_m(var s: shortstring); |
|
214 |
begin |
|
215 |
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
|
216 |
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
|
217 |
exit; |
7805 | 218 |
if not isExternalSource then |
7068 | 219 |
SendIPC(_S'r'); |
4413 | 220 |
with CurrentHedgehog^.Gear^ do |
6453
11c578d30bd3
Countless imporvements to the parser and countless help to the parser in sources.
unc0rr
parents:
6415
diff
changeset
|
221 |
Message:= Message and (not (gmRight and InputMask)); |
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
222 |
ScriptCall('onRightUp'); |
4413 | 223 |
end; |
224 |
||
225 |
procedure chUp_p(var s: shortstring); |
|
226 |
begin |
|
227 |
s:= s; // avoid compiler hint |
|
10392 | 228 |
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
|
229 |
exit; |
7805 | 230 |
if not isExternalSource then |
7068 | 231 |
SendIPC(_S'U'); |
4413 | 232 |
bShowFinger:= false; |
233 |
with CurrentHedgehog^.Gear^ do |
|
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
234 |
Message:= Message or (gmUp and InputMask); |
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
235 |
ScriptCall('onUp'); |
4413 | 236 |
end; |
237 |
||
238 |
procedure chUp_m(var s: shortstring); |
|
239 |
begin |
|
240 |
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
|
241 |
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
|
242 |
exit; |
7805 | 243 |
if not isExternalSource then |
7068 | 244 |
SendIPC(_S'u'); |
4413 | 245 |
with CurrentHedgehog^.Gear^ do |
6453
11c578d30bd3
Countless imporvements to the parser and countless help to the parser in sources.
unc0rr
parents:
6415
diff
changeset
|
246 |
Message:= Message and (not (gmUp and InputMask)); |
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
247 |
ScriptCall('onUpUp'); |
4413 | 248 |
end; |
249 |
||
250 |
procedure chDown_p(var s: shortstring); |
|
251 |
begin |
|
252 |
s:= s; // avoid compiler hint |
|
10392 | 253 |
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
|
254 |
exit; |
7805 | 255 |
if not isExternalSource then |
7068 | 256 |
SendIPC(_S'D'); |
4413 | 257 |
bShowFinger:= false; |
258 |
with CurrentHedgehog^.Gear^ do |
|
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
259 |
Message:= Message or (gmDown and InputMask); |
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
260 |
ScriptCall('onDown'); |
4413 | 261 |
end; |
262 |
||
263 |
procedure chDown_m(var s: shortstring); |
|
264 |
begin |
|
265 |
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
|
266 |
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
|
267 |
exit; |
7805 | 268 |
if not isExternalSource then |
7068 | 269 |
SendIPC(_S'd'); |
4413 | 270 |
with CurrentHedgehog^.Gear^ do |
6453
11c578d30bd3
Countless imporvements to the parser and countless help to the parser in sources.
unc0rr
parents:
6415
diff
changeset
|
271 |
Message:= Message and (not (gmDown and InputMask)); |
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
272 |
ScriptCall('onDownUp'); |
4413 | 273 |
end; |
274 |
||
275 |
procedure chPrecise_p(var s: shortstring); |
|
276 |
begin |
|
277 |
s:= s; // avoid compiler hint |
|
10392 | 278 |
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
|
279 |
exit; |
7805 | 280 |
if not isExternalSource then |
7068 | 281 |
SendIPC(_S'Z'); |
4413 | 282 |
bShowFinger:= false; |
283 |
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
|
284 |
Message:= Message or (gmPrecise and InputMask); |
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
285 |
ScriptCall('onPrecise'); |
4413 | 286 |
end; |
287 |
||
288 |
procedure chPrecise_m(var s: shortstring); |
|
289 |
begin |
|
290 |
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
|
291 |
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
|
292 |
exit; |
7805 | 293 |
if not isExternalSource then |
7068 | 294 |
SendIPC(_S'z'); |
4413 | 295 |
with CurrentHedgehog^.Gear^ do |
6453
11c578d30bd3
Countless imporvements to the parser and countless help to the parser in sources.
unc0rr
parents:
6415
diff
changeset
|
296 |
Message:= Message and (not (gmPrecise and InputMask)); |
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
297 |
ScriptCall('onPreciseUp'); |
4413 | 298 |
end; |
299 |
||
300 |
procedure chLJump(var s: shortstring); |
|
301 |
begin |
|
302 |
s:= s; // avoid compiler hint |
|
10392 | 303 |
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
|
304 |
exit; |
7805 | 305 |
if not isExternalSource then |
7068 | 306 |
SendIPC(_S'j'); |
4413 | 307 |
bShowFinger:= false; |
308 |
with CurrentHedgehog^.Gear^ do |
|
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
309 |
Message:= Message or (gmLJump and InputMask); |
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
310 |
ScriptCall('onLJump'); |
4413 | 311 |
end; |
312 |
||
313 |
procedure chHJump(var s: shortstring); |
|
314 |
begin |
|
315 |
s:= s; // avoid compiler hint |
|
10392 | 316 |
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
|
317 |
exit; |
7805 | 318 |
if not isExternalSource then |
7068 | 319 |
SendIPC(_S'J'); |
4413 | 320 |
bShowFinger:= false; |
321 |
with CurrentHedgehog^.Gear^ do |
|
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
322 |
Message:= Message or (gmHJump and InputMask); |
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
323 |
ScriptCall('onHJump'); |
4413 | 324 |
end; |
325 |
||
326 |
procedure chAttack_p(var s: shortstring); |
|
10672 | 327 |
var inbtwnTrgtAttks: Boolean; |
4413 | 328 |
begin |
329 |
s:= s; // avoid compiler hint |
|
10392 | 330 |
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
|
331 |
exit; |
4413 | 332 |
bShowFinger:= false; |
333 |
with CurrentHedgehog^.Gear^ do |
|
334 |
begin |
|
4900 | 335 |
AddFileLog('/+attack: hedgehog''s Gear^.State = '+inttostr(State)); |
4413 | 336 |
if ((State and gstHHDriven) <> 0) then |
337 |
begin |
|
10672 | 338 |
inbtwnTrgtAttks:= ((GameFlags and gfInfAttack) <> 0) and ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) <> 0); |
339 |
if (not inbtwnTrgtAttks) then |
|
340 |
FollowGear:= CurrentHedgehog^.Gear; |
|
7805 | 341 |
if not isExternalSource then |
7068 | 342 |
SendIPC(_S'A'); |
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
343 |
Message:= Message or (gmAttack and InputMask); |
10228 | 344 |
ScriptCall('onAttack'); // so if I fire airstrike, it doesn't count as attack? fine, fine |
4413 | 345 |
end |
346 |
end |
|
347 |
end; |
|
348 |
||
349 |
procedure chAttack_m(var s: shortstring); |
|
350 |
begin |
|
351 |
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
|
352 |
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
|
353 |
exit; |
4413 | 354 |
with CurrentHedgehog^.Gear^ do |
355 |
begin |
|
7805 | 356 |
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
|
357 |
((Message and gmAttack) <> 0) then |
7068 | 358 |
SendIPC(_S'a'); |
6453
11c578d30bd3
Countless imporvements to the parser and countless help to the parser in sources.
unc0rr
parents:
6415
diff
changeset
|
359 |
Message:= Message and (not (gmAttack and InputMask)); |
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
360 |
ScriptCall('onAttackUp'); |
4413 | 361 |
end |
362 |
end; |
|
363 |
||
364 |
procedure chSwitch(var s: shortstring); |
|
365 |
begin |
|
366 |
s:= s; // avoid compiler hint |
|
10392 | 367 |
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
|
368 |
exit; |
7805 | 369 |
if not isExternalSource then |
7068 | 370 |
SendIPC(_S'S'); |
4413 | 371 |
bShowFinger:= false; |
372 |
with CurrentHedgehog^.Gear^ do |
|
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
373 |
Message:= Message or (gmSwitch and InputMask); |
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
374 |
ScriptCall('onSwitch'); |
4413 | 375 |
end; |
376 |
||
377 |
procedure chNextTurn(var s: shortstring); |
|
7671 | 378 |
var gi: PGear; |
4413 | 379 |
begin |
380 |
s:= s; // avoid compiler hint |
|
7103 | 381 |
|
11532 | 382 |
if checkFails(AllInactive, '/nextturn called when not all gears are inactive', true) then exit; |
4413 | 383 |
|
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
|
384 |
CheckSum:= CheckSum xor GameTicks; |
7104 | 385 |
gi := GearsList; |
386 |
while gi <> nil do |
|
387 |
begin |
|
9797
1fdc1507e42d
remove state from check, just to see if this was why we just desynced
nemo
parents:
9796
diff
changeset
|
388 |
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
|
389 |
AddRandomness(CheckSum); |
7104 | 390 |
gi := gi^.NextGear |
391 |
end; |
|
7103 | 392 |
|
7805 | 393 |
if not isExternalSource then |
7103 | 394 |
begin |
395 |
s[0]:= #5; |
|
396 |
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
|
397 |
SDLNet_Write32(CheckSum, @s[2]); |
7103 | 398 |
SendIPC(s) |
399 |
end |
|
400 |
else |
|
11532 | 401 |
checkFails(CurrentTeam^.hasGone or (CheckSum = lastTurnChecksum), 'Desync detected', true); |
7831 | 402 |
|
7187
aff30d80bd7b
- Allow camera movement while current hedgehog is falling
unc0rr
parents:
7151
diff
changeset
|
403 |
AddFileLog('Next turn: time '+inttostr(GameTicks)); |
4413 | 404 |
end; |
405 |
||
406 |
procedure chTimer(var s: shortstring); |
|
407 |
begin |
|
7790 | 408 |
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
|
409 |
exit; |
4413 | 410 |
|
11532 | 411 |
if checkFails((s[0] = #1) and (s[1] >= '1') and (s[1] <= '5'), 'Malformed /timer', true) then exit; |
7790 | 412 |
|
7805 | 413 |
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
|
414 |
SendIPC(s); |
4413 | 415 |
bShowFinger:= false; |
416 |
with CurrentHedgehog^.Gear^ do |
|
417 |
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
|
418 |
Message:= Message or (gmTimer and InputMask); |
4661
f5d858e4b634
Whole ton of script callbacks on commands. Poor engine.
mikade
parents:
4611
diff
changeset
|
419 |
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
|
420 |
ScriptCall('onTimer', MsgParam); |
4413 | 421 |
end |
422 |
end; |
|
423 |
||
424 |
procedure chSlot(var s: shortstring); |
|
425 |
var slot: LongWord; |
|
7068 | 426 |
ss: shortstring; |
4413 | 427 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
428 |
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
|
429 |
exit; |
4413 | 430 |
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
|
431 |
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
|
432 |
exit; |
7805 | 433 |
if not isExternalSource then |
7068 | 434 |
begin |
435 |
ss[0]:= #1; |
|
436 |
ss[1]:= char(byte(s[1]) + 79); |
|
437 |
SendIPC(ss); |
|
438 |
end; |
|
4413 | 439 |
bShowFinger:= false; |
440 |
with CurrentHedgehog^.Gear^ do |
|
441 |
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
|
442 |
Message:= Message or (gmSlot and InputMask); |
8924 | 443 |
MsgParam:= slot; |
6818
136aa9c8c593
Add the parameters I missed the first time when I added these hooks.
mikade
parents:
6700
diff
changeset
|
444 |
ScriptCall('onSlot', MsgParam); |
4413 | 445 |
end |
446 |
end; |
|
447 |
||
448 |
procedure chSetWeapon(var s: shortstring); |
|
449 |
begin |
|
7790 | 450 |
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
|
451 |
exit; |
4413 | 452 |
|
11532 | 453 |
if checkFails((s[0] = #1) and (s[1] <= char(High(TAmmoType))), 'Malformed /setweap', true) then exit; |
4413 | 454 |
|
7805 | 455 |
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
|
456 |
SendIPC('w' + s); |
4413 | 457 |
|
458 |
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
|
459 |
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
|
460 |
Message:= Message or (gmWeapon and InputMask); |
4413 | 461 |
MsgParam:= byte(s[1]); |
6818
136aa9c8c593
Add the parameters I missed the first time when I added these hooks.
mikade
parents:
6700
diff
changeset
|
462 |
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
|
463 |
end; |
4413 | 464 |
end; |
465 |
||
466 |
procedure chTaunt(var s: shortstring); |
|
467 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
468 |
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
|
469 |
exit; |
4413 | 470 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
471 |
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
|
472 |
exit; |
4413 | 473 |
|
7805 | 474 |
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
|
475 |
SendIPC('t' + s); |
4413 | 476 |
|
12815
92218a06c9ff
Don't send taunt message for automatically happening taunt animation
unc0rr
parents:
12490
diff
changeset
|
477 |
PlayTaunt(byte(s[1])) |
4413 | 478 |
end; |
479 |
||
480 |
procedure chPut(var s: shortstring); |
|
481 |
begin |
|
482 |
s:= s; // avoid compiler hint |
|
483 |
doPut(0, 0, false); |
|
484 |
end; |
|
485 |
||
486 |
procedure chCapture(var s: shortstring); |
|
487 |
begin |
|
488 |
s:= s; // avoid compiler hint |
|
10633
2f062fac5791
Add that "make screenshots of Land/LandPixels" thing for map creators
nemo
parents:
10603
diff
changeset
|
489 |
flagMakeCapture:= true; |
11025
999afa63035f
just disable landpixels w/ blurry land instead. the mask can be helpful for debugging at least.
nemo
parents:
11024
diff
changeset
|
490 |
flagDumpLand:= (LocalMessage and gmPrecise <> 0); |
4413 | 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 |
12847
1aba77b2e4ac
This is a desyncing change. But... We might need a new release anyway. ☹
nemo
parents:
12815
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 |
12216
5b525d041fb4
Fix crash when trying to open ammo menu with current team hog gear = nil
Wuzzy <almikes@aol.com>
parents:
11919
diff
changeset
|
552 |
else if not(CurrentTeam^.Extdriven) and ((Gear = nil) or ((Gear^.State and (gstAttacking or gstAttacked)) <> 0) |
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
|
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; |
10455 | 583 |
AddCaption(trmsg[sidAutoCameraOff], $CCCCCC, capgrpVolume); |
5247 | 584 |
autoCameraOn:= false |
585 |
end |
|
7629 | 586 |
else |
587 |
begin |
|
10455 | 588 |
AddCaption(trmsg[sidAutoCameraOn], $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 |
|
12490
b4eb289b5913
Backed out changeset c19e5ece5b3f
Wuzzy <almikes@aol.com>
parents:
12488
diff
changeset
|
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 |
9693 | 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 |
|
12490
b4eb289b5913
Backed out changeset c19e5ece5b3f
Wuzzy <almikes@aol.com>
parents:
12488
diff
changeset
|
626 |
else |
b4eb289b5913
Backed out changeset c19e5ece5b3f
Wuzzy <almikes@aol.com>
parents:
12488
diff
changeset
|
627 |
begin |
b4eb289b5913
Backed out changeset c19e5ece5b3f
Wuzzy <almikes@aol.com>
parents:
12488
diff
changeset
|
628 |
if UIDisplay <> uiNoTeams then |
b4eb289b5913
Backed out changeset c19e5ece5b3f
Wuzzy <almikes@aol.com>
parents:
12488
diff
changeset
|
629 |
UIDisplay:= uiNoTeams |
b4eb289b5913
Backed out changeset c19e5ece5b3f
Wuzzy <almikes@aol.com>
parents:
12488
diff
changeset
|
630 |
else UIDisplay:= uiAll |
b4eb289b5913
Backed out changeset c19e5ece5b3f
Wuzzy <almikes@aol.com>
parents:
12488
diff
changeset
|
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 |
|
10603
bda5c7caf396
switch mapgen to enum. should still try and make sure the values are backwards compatible if possible.
nemo
parents:
10510
diff
changeset
|
669 |
cMapGen:= TMapGen(StrToInt(s)) |
6898 | 670 |
end; |
671 |
||
672 |
procedure chTemplateFilter(var s: shortstring); |
|
673 |
begin |
|
7151 | 674 |
cTemplateFilter:= StrToInt(s) |
6898 | 675 |
end; |
676 |
||
10472
8d04cebedb16
Partially hook up feature size so horrorcat has something to test.
nemo
parents:
10455
diff
changeset
|
677 |
procedure chFeatureSize(var s: shortstring); |
8d04cebedb16
Partially hook up feature size so horrorcat has something to test.
nemo
parents:
10455
diff
changeset
|
678 |
begin |
8d04cebedb16
Partially hook up feature size so horrorcat has something to test.
nemo
parents:
10455
diff
changeset
|
679 |
cFeatureSize:= StrToInt(s) |
8d04cebedb16
Partially hook up feature size so horrorcat has something to test.
nemo
parents:
10455
diff
changeset
|
680 |
end; |
8d04cebedb16
Partially hook up feature size so horrorcat has something to test.
nemo
parents:
10455
diff
changeset
|
681 |
|
6898 | 682 |
procedure chInactDelay(var s: shortstring); |
683 |
begin |
|
7151 | 684 |
cInactDelay:= StrToInt(s) |
6898 | 685 |
end; |
686 |
||
687 |
procedure chReadyDelay(var s: shortstring); |
|
688 |
begin |
|
7151 | 689 |
cReadyDelay:= StrToInt(s) |
6898 | 690 |
end; |
691 |
||
692 |
procedure chCaseFactor(var s: shortstring); |
|
693 |
begin |
|
7151 | 694 |
cCaseFactor:= StrToInt(s) |
6898 | 695 |
end; |
696 |
||
697 |
procedure chHealthCaseProb(var s: shortstring); |
|
698 |
begin |
|
7151 | 699 |
cHealthCaseProb:= StrToInt(s) |
6898 | 700 |
end; |
701 |
||
702 |
procedure chHealthCaseAmount(var s: shortstring); |
|
703 |
begin |
|
7151 | 704 |
cHealthCaseAmount:= StrToInt(s) |
6898 | 705 |
end; |
706 |
||
707 |
procedure chSuddenDTurns(var s: shortstring); |
|
708 |
begin |
|
7151 | 709 |
cSuddenDTurns:= StrToInt(s) |
6898 | 710 |
end; |
711 |
||
712 |
procedure chWaterRise(var s: shortstring); |
|
713 |
begin |
|
7151 | 714 |
cWaterRise:= StrToInt(s) |
6898 | 715 |
end; |
716 |
||
717 |
procedure chHealthDecrease(var s: shortstring); |
|
718 |
begin |
|
7151 | 719 |
cHealthDecrease:= StrToInt(s) |
6898 | 720 |
end; |
721 |
||
722 |
procedure chDamagePercent(var s: shortstring); |
|
723 |
begin |
|
7151 | 724 |
cDamagePercent:= StrToInt(s) |
6898 | 725 |
end; |
726 |
||
727 |
procedure chRopePercent(var s: shortstring); |
|
728 |
begin |
|
7151 | 729 |
cRopePercent:= StrToInt(s) |
6898 | 730 |
end; |
731 |
||
732 |
procedure chGetAwayTime(var s: shortstring); |
|
733 |
begin |
|
7151 | 734 |
cGetAwayTime:= StrToInt(s) |
6898 | 735 |
end; |
736 |
||
737 |
procedure chMineDudPercent(var s: shortstring); |
|
738 |
begin |
|
7151 | 739 |
cMineDudPercent:= StrToInt(s) |
6898 | 740 |
end; |
741 |
||
742 |
procedure chLandMines(var s: shortstring); |
|
743 |
begin |
|
7151 | 744 |
cLandMines:= StrToInt(s) |
6898 | 745 |
end; |
746 |
||
10818
f642a28cab0c
Add placement of airmines in engine outside of hog proximity. Has a bug, only protecting 1st team. Also fix a spelling error and rename gstHHChooseTarget to gstChooseTarget
nemo
parents:
10672
diff
changeset
|
747 |
procedure chAirMines(var s: shortstring); |
f642a28cab0c
Add placement of airmines in engine outside of hog proximity. Has a bug, only protecting 1st team. Also fix a spelling error and rename gstHHChooseTarget to gstChooseTarget
nemo
parents:
10672
diff
changeset
|
748 |
begin |
f642a28cab0c
Add placement of airmines in engine outside of hog proximity. Has a bug, only protecting 1st team. Also fix a spelling error and rename gstHHChooseTarget to gstChooseTarget
nemo
parents:
10672
diff
changeset
|
749 |
cAirMines:= StrToInt(s) |
f642a28cab0c
Add placement of airmines in engine outside of hog proximity. Has a bug, only protecting 1st team. Also fix a spelling error and rename gstHHChooseTarget to gstChooseTarget
nemo
parents:
10672
diff
changeset
|
750 |
end; |
f642a28cab0c
Add placement of airmines in engine outside of hog proximity. Has a bug, only protecting 1st team. Also fix a spelling error and rename gstHHChooseTarget to gstChooseTarget
nemo
parents:
10672
diff
changeset
|
751 |
|
6898 | 752 |
procedure chExplosives(var s: shortstring); |
753 |
begin |
|
7151 | 754 |
cExplosives:= StrToInt(s) |
6898 | 755 |
end; |
756 |
||
757 |
procedure chGameFlags(var s: shortstring); |
|
758 |
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
|
759 |
GameFlags:= StrToInt(s); |
7629 | 760 |
if GameFlags and gfSharedAmmo <> 0 then GameFlags:= GameFlags and (not gfPerHogAmmo) |
6898 | 761 |
end; |
762 |
||
763 |
procedure chHedgehogTurnTime(var s: shortstring); |
|
764 |
begin |
|
7151 | 765 |
cHedgehogTurnTime:= StrToInt(s) |
6898 | 766 |
end; |
767 |
||
768 |
procedure chMinesTime(var s: shortstring); |
|
769 |
begin |
|
7151 | 770 |
cMinesTime:= StrToInt(s) |
6898 | 771 |
end; |
772 |
||
773 |
procedure chFastUntilLag(var s: shortstring); |
|
774 |
begin |
|
10862
4575977d3ce0
Don't spawn team widget sorter on each frame when in lag. Issue 'spectate 0' instead, and only on first lag occasion.
unc0rr
parents:
10822
diff
changeset
|
775 |
fastUntilLag:= StrToInt(s) <> 0; |
4575977d3ce0
Don't spawn team widget sorter on each frame when in lag. Issue 'spectate 0' instead, and only on first lag occasion.
unc0rr
parents:
10822
diff
changeset
|
776 |
|
4575977d3ce0
Don't spawn team widget sorter on each frame when in lag. Issue 'spectate 0' instead, and only on first lag occasion.
unc0rr
parents:
10822
diff
changeset
|
777 |
if not fastUntilLag then |
4575977d3ce0
Don't spawn team widget sorter on each frame when in lag. Issue 'spectate 0' instead, and only on first lag occasion.
unc0rr
parents:
10822
diff
changeset
|
778 |
begin |
4575977d3ce0
Don't spawn team widget sorter on each frame when in lag. Issue 'spectate 0' instead, and only on first lag occasion.
unc0rr
parents:
10822
diff
changeset
|
779 |
// update health bars and the wind indicator |
4575977d3ce0
Don't spawn team widget sorter on each frame when in lag. Issue 'spectate 0' instead, and only on first lag occasion.
unc0rr
parents:
10822
diff
changeset
|
780 |
AddVisualGear(0, 0, vgtTeamHealthSorter); |
4575977d3ce0
Don't spawn team widget sorter on each frame when in lag. Issue 'spectate 0' instead, and only on first lag occasion.
unc0rr
parents:
10822
diff
changeset
|
781 |
AddVisualGear(0, 0, vgtSmoothWindBar) |
4575977d3ce0
Don't spawn team widget sorter on each frame when in lag. Issue 'spectate 0' instead, and only on first lag occasion.
unc0rr
parents:
10822
diff
changeset
|
782 |
end |
6898 | 783 |
end; |
4413 | 784 |
|
7201
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7187
diff
changeset
|
785 |
procedure chCampVar(var s:shortstring); |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7187
diff
changeset
|
786 |
begin |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7187
diff
changeset
|
787 |
CampaignVariable := s; |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7187
diff
changeset
|
788 |
end; |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7187
diff
changeset
|
789 |
|
9489 | 790 |
procedure chWorldEdge(var s: shortstring); |
791 |
begin |
|
792 |
WorldEdge:= TWorldEdge(StrToInt(s)) |
|
793 |
end; |
|
794 |
||
10237 | 795 |
procedure chAdvancedMapGenMode(var s:shortstring); |
796 |
begin |
|
10249 | 797 |
s:= s; // avoid compiler hint |
10237 | 798 |
cAdvancedMapGenMode:= true; |
799 |
end; |
|
800 |
||
4413 | 801 |
procedure initModule; |
802 |
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
|
803 |
//////// Begin top sorted by freq analysis not including chatmsg |
7407 | 804 |
RegisterVariable('+right' , @chRight_p , false, true); |
805 |
RegisterVariable('-right' , @chRight_m , false, true); |
|
806 |
RegisterVariable('+up' , @chUp_p , false, true); |
|
807 |
RegisterVariable('-up' , @chUp_m , false, true); |
|
808 |
RegisterVariable('+left' , @chLeft_p , false, true); |
|
809 |
RegisterVariable('-left' , @chLeft_m , false, true); |
|
7629 | 810 |
RegisterVariable('+attack' , @chAttack_p , false); |
7407 | 811 |
RegisterVariable('+down' , @chDown_p , false, true); |
812 |
RegisterVariable('-down' , @chDown_m , false, true); |
|
813 |
RegisterVariable('hjump' , @chHJump , false, true); |
|
814 |
RegisterVariable('ljump' , @chLJump , false, true); |
|
7629 | 815 |
RegisterVariable('nextturn', @chNextTurn , false); |
816 |
RegisterVariable('-attack' , @chAttack_m , false); |
|
817 |
RegisterVariable('slot' , @chSlot , false); |
|
7407 | 818 |
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
|
819 |
//////// End top by freq analysis |
7629 | 820 |
RegisterVariable('gencmd' , @chGenCmd , false); |
6898 | 821 |
RegisterVariable('script' , @chScript , false); |
9902 | 822 |
RegisterVariable('scriptparam', @chScriptParam, false); |
6898 | 823 |
RegisterVariable('proto' , @chCheckProto , true ); |
824 |
RegisterVariable('spectate', @chFastUntilLag , false); |
|
825 |
RegisterVariable('capture' , @chCapture , true ); |
|
826 |
RegisterVariable('rotmask' , @chRotateMask , true ); |
|
827 |
RegisterVariable('rdriven' , @chTeamLocal , false); |
|
828 |
RegisterVariable('map' , @chSetMap , false); |
|
829 |
RegisterVariable('theme' , @chSetTheme , false); |
|
830 |
RegisterVariable('seed' , @chSetSeed , false); |
|
831 |
RegisterVariable('template_filter', @chTemplateFilter, false); |
|
832 |
RegisterVariable('mapgen' , @chMapGen , false); |
|
833 |
RegisterVariable('maze_size',@chTemplateFilter, false); |
|
10472
8d04cebedb16
Partially hook up feature size so horrorcat has something to test.
nemo
parents:
10455
diff
changeset
|
834 |
RegisterVariable('feature_size',@chFeatureSize, false); |
6898 | 835 |
RegisterVariable('delay' , @chInactDelay , false); |
836 |
RegisterVariable('ready' , @chReadyDelay , false); |
|
837 |
RegisterVariable('casefreq', @chCaseFactor , false); |
|
838 |
RegisterVariable('healthprob', @chHealthCaseProb, false); |
|
839 |
RegisterVariable('hcaseamount', @chHealthCaseAmount, false); |
|
840 |
RegisterVariable('sd_turns', @chSuddenDTurns , false); |
|
841 |
RegisterVariable('waterrise', @chWaterRise , false); |
|
842 |
RegisterVariable('healthdec', @chHealthDecrease, false); |
|
843 |
RegisterVariable('damagepct',@chDamagePercent , false); |
|
844 |
RegisterVariable('ropepct' , @chRopePercent , false); |
|
845 |
RegisterVariable('getawaytime' , @chGetAwayTime , false); |
|
846 |
RegisterVariable('minedudpct',@chMineDudPercent, false); |
|
847 |
RegisterVariable('minesnum', @chLandMines , false); |
|
10822 | 848 |
RegisterVariable('airmines', @chAirMines , false); |
6898 | 849 |
RegisterVariable('explosives',@chExplosives , false); |
850 |
RegisterVariable('gmflags' , @chGameFlags , false); |
|
851 |
RegisterVariable('turntime', @chHedgehogTurnTime, false); |
|
852 |
RegisterVariable('minestime',@chMinesTime , false); |
|
853 |
RegisterVariable('quit' , @chQuit , true ); |
|
854 |
RegisterVariable('forcequit', @chForceQuit , true ); |
|
855 |
RegisterVariable('confirm' , @chConfirm , true ); |
|
856 |
RegisterVariable('halt', @chHalt , true ); |
|
857 |
RegisterVariable('+speedup', @chSpeedup_p , true ); |
|
858 |
RegisterVariable('-speedup', @chSpeedup_m , true ); |
|
859 |
RegisterVariable('zoomin' , @chZoomIn , true ); |
|
860 |
RegisterVariable('zoomout' , @chZoomOut , true ); |
|
861 |
RegisterVariable('zoomreset',@chZoomReset , true ); |
|
862 |
RegisterVariable('ammomenu', @chAmmoMenu , true); |
|
7629 | 863 |
RegisterVariable('+precise', @chPrecise_p , false, true); |
864 |
RegisterVariable('-precise', @chPrecise_m , false, true); |
|
6898 | 865 |
RegisterVariable('switch' , @chSwitch , false); |
7629 | 866 |
RegisterVariable('timer' , @chTimer , false, true); |
6898 | 867 |
RegisterVariable('taunt' , @chTaunt , false); |
868 |
RegisterVariable('put' , @chPut , false); |
|
869 |
RegisterVariable('+volup' , @chVol_p , true ); |
|
870 |
RegisterVariable('-volup' , @chVol_m , true ); |
|
871 |
RegisterVariable('+voldown', @chVol_m , true ); |
|
872 |
RegisterVariable('-voldown', @chVol_p , true ); |
|
7404 | 873 |
RegisterVariable('findhh' , @chFindhh , true ); |
6898 | 874 |
RegisterVariable('pause' , @chPause , true ); |
875 |
RegisterVariable('+cur_u' , @chCurU_p , true ); |
|
876 |
RegisterVariable('-cur_u' , @chCurU_m , true ); |
|
877 |
RegisterVariable('+cur_d' , @chCurD_p , true ); |
|
878 |
RegisterVariable('-cur_d' , @chCurD_m , true ); |
|
879 |
RegisterVariable('+cur_l' , @chCurL_p , true ); |
|
880 |
RegisterVariable('-cur_l' , @chCurL_m , true ); |
|
881 |
RegisterVariable('+cur_r' , @chCurR_p , true ); |
|
882 |
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
|
883 |
RegisterVariable('campvar' , @chCampVar , true ); |
7629 | 884 |
RegisterVariable('record' , @chRecord , true ); |
9489 | 885 |
RegisterVariable('worldedge',@chWorldEdge , false); |
10237 | 886 |
RegisterVariable('advmapgen',@chAdvancedMapGenMode, false); |
4413 | 887 |
end; |
888 |
||
889 |
procedure freeModule; |
|
890 |
begin |
|
891 |
end; |
|
892 |
||
893 |
end. |