author | unc0rr |
Wed, 18 Mar 2015 23:18:52 +0300 | |
changeset 10862 | 4575977d3ce0 |
parent 10822 | def423815f24 |
child 11024 | b02e38762bbb |
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 |
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
|
30 |
, uVisualGearsList |
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 |
8924 | 40 |
'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
|
41 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
42 |
ReadyTimeLeft:= 1; |
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); |
6001 | 96 |
TryDo(i <= cNetProtoVersion, 'Protocol version mismatch: engine is too old (got '+intToStr(i)+', expecting '+intToStr(cNetProtoVersion)+')', true); |
97 |
TryDo(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 |
|
4413 | 382 |
TryDo(AllInactive, '/nextturn called when not all gears are inactive', true); |
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 |
|
7831 | 401 |
TryDo(CurrentTeam^.hasGone or (CheckSum = lastTurnChecksum), 'Desync detected', true); |
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 |
|
7790 | 411 |
TryDo((s[0] = #1) and (s[1] >= '1') and (s[1] <= '5'), 'Malformed /timer', true); |
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 |
|
7790 | 453 |
TryDo((s[0] = #1) and (s[1] <= char(High(TAmmoType))), 'Malformed /setweap', true); |
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 |
|
477 |
with CurrentHedgehog^.Gear^ do |
|
478 |
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
|
479 |
Message:= Message or (gmAnimate and InputMask); |
8924 | 480 |
MsgParam:= byte(s[1]) ; |
6818
136aa9c8c593
Add the parameters I missed the first time when I added these hooks.
mikade
parents:
6700
diff
changeset
|
481 |
ScriptCall('onTaunt', MsgParam); |
4413 | 482 |
end |
483 |
end; |
|
484 |
||
485 |
procedure chPut(var s: shortstring); |
|
486 |
begin |
|
487 |
s:= s; // avoid compiler hint |
|
488 |
doPut(0, 0, false); |
|
489 |
end; |
|
490 |
||
491 |
procedure chCapture(var s: shortstring); |
|
492 |
begin |
|
493 |
s:= s; // avoid compiler hint |
|
10633
2f062fac5791
Add that "make screenshots of Land/LandPixels" thing for map creators
nemo
parents:
10603
diff
changeset
|
494 |
flagMakeCapture:= true; |
2f062fac5791
Add that "make screenshots of Land/LandPixels" thing for map creators
nemo
parents:
10603
diff
changeset
|
495 |
flagDumpLand:= LocalMessage and gmPrecise <> 0; |
4413 | 496 |
end; |
497 |
||
7629 | 498 |
procedure chRecord(var s: shortstring); |
499 |
begin |
|
500 |
s:= s; // avoid compiler hint |
|
501 |
{$IFDEF USE_VIDEO_RECORDING} |
|
502 |
if flagPrerecording then |
|
503 |
StopPreRecording() |
|
504 |
else |
|
505 |
BeginPreRecording(); |
|
506 |
{$ENDIF} |
|
507 |
end; |
|
508 |
||
4413 | 509 |
procedure chSetMap(var s: shortstring); |
510 |
begin |
|
5679
505c6448069b
accidentally reverted this when reverting the rest of the override changes.
nemo
parents:
5555
diff
changeset
|
511 |
if isDeveloperMode then |
6088 | 512 |
begin |
6339 | 513 |
if s = '' then |
8025 | 514 |
cPathz[ptMapCurrent]:= s |
6339 | 515 |
else |
8025 | 516 |
cPathz[ptMapCurrent]:= cPathz[ptMaps] + '/' + s; |
6088 | 517 |
InitStepsFlags:= InitStepsFlags or cifMap |
518 |
end; |
|
6828
6a5d33bff0b0
At mikade's request. give scripting access to the map name prior to override.
nemo
parents:
6818
diff
changeset
|
519 |
cMapName:= s; |
6245 | 520 |
ScriptLoad('Maps/' + s + '/map.lua') |
4413 | 521 |
end; |
522 |
||
523 |
procedure chSetTheme(var s: shortstring); |
|
524 |
begin |
|
525 |
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
|
526 |
begin |
8025 | 527 |
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
|
528 |
Theme:= s; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
529 |
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
|
530 |
end |
4413 | 531 |
end; |
532 |
||
533 |
procedure chSetSeed(var s: shortstring); |
|
534 |
begin |
|
535 |
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
|
536 |
begin |
8912 | 537 |
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
|
538 |
cSeed:= s; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
539 |
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
|
540 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
541 |
end; |
4413 | 542 |
|
543 |
procedure chAmmoMenu(var s: shortstring); |
|
544 |
begin |
|
545 |
s:= s; // avoid compiler hint |
|
546 |
if CheckNoTeamOrHH then |
|
10439
7de934f2247c
allow toggling ammo menu while NoTeamOrHH, as suggested by unC0Rr
sheepluva
parents:
10392
diff
changeset
|
547 |
bShowAmmoMenu:= (not bShowAmmoMenu) |
4413 | 548 |
else |
549 |
begin |
|
550 |
with CurrentTeam^ do |
|
551 |
with Hedgehogs[CurrHedgehog] do |
|
552 |
begin |
|
553 |
bSelected:= false; |
|
554 |
||
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
555 |
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
|
556 |
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
|
557 |
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
|
558 |
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
|
559 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
560 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
561 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
562 |
bShowAmmoMenu:= true |
4413 | 563 |
end; |
564 |
end |
|
565 |
end; |
|
566 |
||
567 |
procedure chVol_p(var s: shortstring); |
|
568 |
begin |
|
569 |
s:= s; // avoid compiler hint |
|
570 |
inc(cVolumeDelta, 3) |
|
571 |
end; |
|
572 |
||
573 |
procedure chVol_m(var s: shortstring); |
|
574 |
begin |
|
575 |
s:= s; // avoid compiler hint |
|
576 |
dec(cVolumeDelta, 3) |
|
577 |
end; |
|
578 |
||
579 |
procedure chFindhh(var s: shortstring); |
|
580 |
begin |
|
581 |
s:= s; // avoid compiler hint |
|
10392 | 582 |
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
|
583 |
exit; |
5247 | 584 |
|
7629 | 585 |
if autoCameraOn then |
5247 | 586 |
begin |
7629 | 587 |
FollowGear:= nil; |
10455 | 588 |
AddCaption(trmsg[sidAutoCameraOff], $CCCCCC, capgrpVolume); |
5247 | 589 |
autoCameraOn:= false |
590 |
end |
|
7629 | 591 |
else |
592 |
begin |
|
10455 | 593 |
AddCaption(trmsg[sidAutoCameraOn], $CCCCCC, capgrpVolume); |
5247 | 594 |
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
|
595 |
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
|
596 |
FollowGear:= CurrentHedgehog^.Gear; |
5247 | 597 |
autoCameraOn:= true |
598 |
end |
|
4413 | 599 |
end; |
600 |
||
601 |
procedure chPause(var s: shortstring); |
|
602 |
begin |
|
10392 | 603 |
if (gameType <> gmtNet) or (s = 'server') then |
9670
1954f692e8c6
Quick and simple implementation of afk mode (toggled by /pause)
unc0rr
parents:
9489
diff
changeset
|
604 |
isPaused:= not isPaused |
1954f692e8c6
Quick and simple implementation of afk mode (toggled by /pause)
unc0rr
parents:
9489
diff
changeset
|
605 |
else |
9671 | 606 |
if (CurrentTeam^.ExtDriven) or (CurrentHedgehog^.BotLevel > 0) then |
607 |
isAFK:= not isAFK |
|
608 |
else |
|
609 |
isAFK:= false; // for real ninjas |
|
5524
40b7f95d9f18
Oh, and fix cursor visibility correlations between gsConfirm state and paused state
unc0rr
parents:
5523
diff
changeset
|
610 |
|
10392 | 611 |
updateCursorVisibility; |
4413 | 612 |
end; |
613 |
||
614 |
procedure chRotateMask(var s: shortstring); |
|
615 |
begin |
|
616 |
s:= s; // avoid compiler hint |
|
9693 | 617 |
// 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 |
618 |
if LocalMessage and (gmPrecise or gmSwitch) = (gmPrecise or gmSwitch) then |
|
619 |
begin |
|
620 |
if UIDisplay <> uiNone then |
|
621 |
UIDisplay:= uiNone |
|
622 |
else UIDisplay:= uiAll |
|
623 |
end |
|
624 |
else if LocalMessage and gmPrecise = gmPrecise then |
|
625 |
begin |
|
626 |
if ((GameFlags and gfInvulnerable) = 0) then |
|
627 |
cTagsMask:= cTagsMasks[cTagsMask] |
|
628 |
else |
|
629 |
cTagsMask:= cTagsMasksNoHealth[cTagsMask] |
|
630 |
end |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
631 |
else |
9693 | 632 |
begin |
633 |
if UIDisplay <> uiNoTeams then |
|
634 |
UIDisplay:= uiNoTeams |
|
635 |
else UIDisplay:= uiAll |
|
636 |
end |
|
4413 | 637 |
end; |
638 |
||
639 |
procedure chSpeedup_p(var s: shortstring); |
|
640 |
begin |
|
641 |
s:= s; // avoid compiler hint |
|
7629 | 642 |
SpeedStart:= RealTicks; |
4413 | 643 |
isSpeed:= true |
644 |
end; |
|
645 |
||
646 |
procedure chSpeedup_m(var s: shortstring); |
|
647 |
begin |
|
648 |
s:= s; // avoid compiler hint |
|
649 |
isSpeed:= false |
|
650 |
end; |
|
651 |
||
652 |
procedure chZoomIn(var s: shortstring); |
|
653 |
begin |
|
654 |
s:= s; // avoid compiler hint |
|
655 |
if ZoomValue < cMinZoomLevel then |
|
656 |
ZoomValue:= ZoomValue + cZoomDelta; |
|
657 |
end; |
|
658 |
||
659 |
procedure chZoomOut(var s: shortstring); |
|
660 |
begin |
|
661 |
s:= s; // avoid compiler hint |
|
662 |
if ZoomValue > cMaxZoomLevel then |
|
663 |
ZoomValue:= ZoomValue - cZoomDelta; |
|
664 |
end; |
|
665 |
||
666 |
procedure chZoomReset(var s: shortstring); |
|
667 |
begin |
|
668 |
s:= s; // avoid compiler hint |
|
669 |
ZoomValue:= cDefaultZoomLevel; |
|
670 |
end; |
|
671 |
||
6898 | 672 |
procedure chMapGen(var s: shortstring); |
673 |
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
|
674 |
cMapGen:= TMapGen(StrToInt(s)) |
6898 | 675 |
end; |
676 |
||
677 |
procedure chTemplateFilter(var s: shortstring); |
|
678 |
begin |
|
7151 | 679 |
cTemplateFilter:= StrToInt(s) |
6898 | 680 |
end; |
681 |
||
10472
8d04cebedb16
Partially hook up feature size so horrorcat has something to test.
nemo
parents:
10455
diff
changeset
|
682 |
procedure chFeatureSize(var s: shortstring); |
8d04cebedb16
Partially hook up feature size so horrorcat has something to test.
nemo
parents:
10455
diff
changeset
|
683 |
begin |
8d04cebedb16
Partially hook up feature size so horrorcat has something to test.
nemo
parents:
10455
diff
changeset
|
684 |
cFeatureSize:= StrToInt(s) |
8d04cebedb16
Partially hook up feature size so horrorcat has something to test.
nemo
parents:
10455
diff
changeset
|
685 |
end; |
8d04cebedb16
Partially hook up feature size so horrorcat has something to test.
nemo
parents:
10455
diff
changeset
|
686 |
|
6898 | 687 |
procedure chInactDelay(var s: shortstring); |
688 |
begin |
|
7151 | 689 |
cInactDelay:= StrToInt(s) |
6898 | 690 |
end; |
691 |
||
692 |
procedure chReadyDelay(var s: shortstring); |
|
693 |
begin |
|
7151 | 694 |
cReadyDelay:= StrToInt(s) |
6898 | 695 |
end; |
696 |
||
697 |
procedure chCaseFactor(var s: shortstring); |
|
698 |
begin |
|
7151 | 699 |
cCaseFactor:= StrToInt(s) |
6898 | 700 |
end; |
701 |
||
702 |
procedure chHealthCaseProb(var s: shortstring); |
|
703 |
begin |
|
7151 | 704 |
cHealthCaseProb:= StrToInt(s) |
6898 | 705 |
end; |
706 |
||
707 |
procedure chHealthCaseAmount(var s: shortstring); |
|
708 |
begin |
|
7151 | 709 |
cHealthCaseAmount:= StrToInt(s) |
6898 | 710 |
end; |
711 |
||
712 |
procedure chSuddenDTurns(var s: shortstring); |
|
713 |
begin |
|
7151 | 714 |
cSuddenDTurns:= StrToInt(s) |
6898 | 715 |
end; |
716 |
||
717 |
procedure chWaterRise(var s: shortstring); |
|
718 |
begin |
|
7151 | 719 |
cWaterRise:= StrToInt(s) |
6898 | 720 |
end; |
721 |
||
722 |
procedure chHealthDecrease(var s: shortstring); |
|
723 |
begin |
|
7151 | 724 |
cHealthDecrease:= StrToInt(s) |
6898 | 725 |
end; |
726 |
||
727 |
procedure chDamagePercent(var s: shortstring); |
|
728 |
begin |
|
7151 | 729 |
cDamagePercent:= StrToInt(s) |
6898 | 730 |
end; |
731 |
||
732 |
procedure chRopePercent(var s: shortstring); |
|
733 |
begin |
|
7151 | 734 |
cRopePercent:= StrToInt(s) |
6898 | 735 |
end; |
736 |
||
737 |
procedure chGetAwayTime(var s: shortstring); |
|
738 |
begin |
|
7151 | 739 |
cGetAwayTime:= StrToInt(s) |
6898 | 740 |
end; |
741 |
||
742 |
procedure chMineDudPercent(var s: shortstring); |
|
743 |
begin |
|
7151 | 744 |
cMineDudPercent:= StrToInt(s) |
6898 | 745 |
end; |
746 |
||
747 |
procedure chLandMines(var s: shortstring); |
|
748 |
begin |
|
7151 | 749 |
cLandMines:= StrToInt(s) |
6898 | 750 |
end; |
751 |
||
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
|
752 |
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
|
753 |
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
|
754 |
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
|
755 |
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
|
756 |
|
6898 | 757 |
procedure chExplosives(var s: shortstring); |
758 |
begin |
|
7151 | 759 |
cExplosives:= StrToInt(s) |
6898 | 760 |
end; |
761 |
||
762 |
procedure chGameFlags(var s: shortstring); |
|
763 |
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
|
764 |
GameFlags:= StrToInt(s); |
7629 | 765 |
if GameFlags and gfSharedAmmo <> 0 then GameFlags:= GameFlags and (not gfPerHogAmmo) |
6898 | 766 |
end; |
767 |
||
768 |
procedure chHedgehogTurnTime(var s: shortstring); |
|
769 |
begin |
|
7151 | 770 |
cHedgehogTurnTime:= StrToInt(s) |
6898 | 771 |
end; |
772 |
||
773 |
procedure chMinesTime(var s: shortstring); |
|
774 |
begin |
|
7151 | 775 |
cMinesTime:= StrToInt(s) |
6898 | 776 |
end; |
777 |
||
778 |
procedure chFastUntilLag(var s: shortstring); |
|
779 |
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
|
780 |
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
|
781 |
|
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 |
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
|
783 |
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
|
784 |
// 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
|
785 |
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
|
786 |
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
|
787 |
end |
6898 | 788 |
end; |
4413 | 789 |
|
7201
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7187
diff
changeset
|
790 |
procedure chCampVar(var s:shortstring); |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7187
diff
changeset
|
791 |
begin |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7187
diff
changeset
|
792 |
CampaignVariable := s; |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7187
diff
changeset
|
793 |
end; |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7187
diff
changeset
|
794 |
|
9489 | 795 |
procedure chWorldEdge(var s: shortstring); |
796 |
begin |
|
797 |
WorldEdge:= TWorldEdge(StrToInt(s)) |
|
798 |
end; |
|
799 |
||
10237 | 800 |
procedure chAdvancedMapGenMode(var s:shortstring); |
801 |
begin |
|
10249 | 802 |
s:= s; // avoid compiler hint |
10237 | 803 |
cAdvancedMapGenMode:= true; |
804 |
end; |
|
805 |
||
4413 | 806 |
procedure initModule; |
807 |
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
|
808 |
//////// Begin top sorted by freq analysis not including chatmsg |
7407 | 809 |
RegisterVariable('+right' , @chRight_p , false, true); |
810 |
RegisterVariable('-right' , @chRight_m , false, true); |
|
811 |
RegisterVariable('+up' , @chUp_p , false, true); |
|
812 |
RegisterVariable('-up' , @chUp_m , false, true); |
|
813 |
RegisterVariable('+left' , @chLeft_p , false, true); |
|
814 |
RegisterVariable('-left' , @chLeft_m , false, true); |
|
7629 | 815 |
RegisterVariable('+attack' , @chAttack_p , false); |
7407 | 816 |
RegisterVariable('+down' , @chDown_p , false, true); |
817 |
RegisterVariable('-down' , @chDown_m , false, true); |
|
818 |
RegisterVariable('hjump' , @chHJump , false, true); |
|
819 |
RegisterVariable('ljump' , @chLJump , false, true); |
|
7629 | 820 |
RegisterVariable('nextturn', @chNextTurn , false); |
821 |
RegisterVariable('-attack' , @chAttack_m , false); |
|
822 |
RegisterVariable('slot' , @chSlot , false); |
|
7407 | 823 |
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
|
824 |
//////// End top by freq analysis |
7629 | 825 |
RegisterVariable('gencmd' , @chGenCmd , false); |
6898 | 826 |
RegisterVariable('script' , @chScript , false); |
9902 | 827 |
RegisterVariable('scriptparam', @chScriptParam, false); |
6898 | 828 |
RegisterVariable('proto' , @chCheckProto , true ); |
829 |
RegisterVariable('spectate', @chFastUntilLag , false); |
|
830 |
RegisterVariable('capture' , @chCapture , true ); |
|
831 |
RegisterVariable('rotmask' , @chRotateMask , true ); |
|
832 |
RegisterVariable('rdriven' , @chTeamLocal , false); |
|
833 |
RegisterVariable('map' , @chSetMap , false); |
|
834 |
RegisterVariable('theme' , @chSetTheme , false); |
|
835 |
RegisterVariable('seed' , @chSetSeed , false); |
|
836 |
RegisterVariable('template_filter', @chTemplateFilter, false); |
|
837 |
RegisterVariable('mapgen' , @chMapGen , false); |
|
838 |
RegisterVariable('maze_size',@chTemplateFilter, false); |
|
10472
8d04cebedb16
Partially hook up feature size so horrorcat has something to test.
nemo
parents:
10455
diff
changeset
|
839 |
RegisterVariable('feature_size',@chFeatureSize, false); |
6898 | 840 |
RegisterVariable('delay' , @chInactDelay , false); |
841 |
RegisterVariable('ready' , @chReadyDelay , false); |
|
842 |
RegisterVariable('casefreq', @chCaseFactor , false); |
|
843 |
RegisterVariable('healthprob', @chHealthCaseProb, false); |
|
844 |
RegisterVariable('hcaseamount', @chHealthCaseAmount, false); |
|
845 |
RegisterVariable('sd_turns', @chSuddenDTurns , false); |
|
846 |
RegisterVariable('waterrise', @chWaterRise , false); |
|
847 |
RegisterVariable('healthdec', @chHealthDecrease, false); |
|
848 |
RegisterVariable('damagepct',@chDamagePercent , false); |
|
849 |
RegisterVariable('ropepct' , @chRopePercent , false); |
|
850 |
RegisterVariable('getawaytime' , @chGetAwayTime , false); |
|
851 |
RegisterVariable('minedudpct',@chMineDudPercent, false); |
|
852 |
RegisterVariable('minesnum', @chLandMines , false); |
|
10822 | 853 |
RegisterVariable('airmines', @chAirMines , false); |
6898 | 854 |
RegisterVariable('explosives',@chExplosives , false); |
855 |
RegisterVariable('gmflags' , @chGameFlags , false); |
|
856 |
RegisterVariable('turntime', @chHedgehogTurnTime, false); |
|
857 |
RegisterVariable('minestime',@chMinesTime , false); |
|
858 |
RegisterVariable('quit' , @chQuit , true ); |
|
859 |
RegisterVariable('forcequit', @chForceQuit , true ); |
|
860 |
RegisterVariable('confirm' , @chConfirm , true ); |
|
861 |
RegisterVariable('halt', @chHalt , true ); |
|
862 |
RegisterVariable('+speedup', @chSpeedup_p , true ); |
|
863 |
RegisterVariable('-speedup', @chSpeedup_m , true ); |
|
864 |
RegisterVariable('zoomin' , @chZoomIn , true ); |
|
865 |
RegisterVariable('zoomout' , @chZoomOut , true ); |
|
866 |
RegisterVariable('zoomreset',@chZoomReset , true ); |
|
867 |
RegisterVariable('ammomenu', @chAmmoMenu , true); |
|
7629 | 868 |
RegisterVariable('+precise', @chPrecise_p , false, true); |
869 |
RegisterVariable('-precise', @chPrecise_m , false, true); |
|
6898 | 870 |
RegisterVariable('switch' , @chSwitch , false); |
7629 | 871 |
RegisterVariable('timer' , @chTimer , false, true); |
6898 | 872 |
RegisterVariable('taunt' , @chTaunt , false); |
873 |
RegisterVariable('put' , @chPut , false); |
|
874 |
RegisterVariable('+volup' , @chVol_p , true ); |
|
875 |
RegisterVariable('-volup' , @chVol_m , true ); |
|
876 |
RegisterVariable('+voldown', @chVol_m , true ); |
|
877 |
RegisterVariable('-voldown', @chVol_p , true ); |
|
7404 | 878 |
RegisterVariable('findhh' , @chFindhh , true ); |
6898 | 879 |
RegisterVariable('pause' , @chPause , true ); |
880 |
RegisterVariable('+cur_u' , @chCurU_p , true ); |
|
881 |
RegisterVariable('-cur_u' , @chCurU_m , true ); |
|
882 |
RegisterVariable('+cur_d' , @chCurD_p , true ); |
|
883 |
RegisterVariable('-cur_d' , @chCurD_m , true ); |
|
884 |
RegisterVariable('+cur_l' , @chCurL_p , true ); |
|
885 |
RegisterVariable('-cur_l' , @chCurL_m , true ); |
|
886 |
RegisterVariable('+cur_r' , @chCurR_p , true ); |
|
887 |
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
|
888 |
RegisterVariable('campvar' , @chCampVar , true ); |
7629 | 889 |
RegisterVariable('record' , @chRecord , true ); |
9489 | 890 |
RegisterVariable('worldedge',@chWorldEdge , false); |
10237 | 891 |
RegisterVariable('advmapgen',@chAdvancedMapGenMode, false); |
4413 | 892 |
end; |
893 |
||
894 |
procedure freeModule; |
|
895 |
begin |
|
896 |
end; |
|
897 |
||
898 |
end. |