author | nemo |
Sun, 21 Nov 2010 10:53:50 -0500 | |
changeset 4400 | b190572290a0 |
parent 4398 | 36d7e4b6ca81 |
child 4401 | 9cb6990af584 |
permissions | -rw-r--r-- |
4 | 1 |
(* |
2947 | 2 |
* Hedgewars, a free turn based strategy game |
3236
4ab3917d7d44
Update (c) lines to 2010 as unc0rr requested - they all had varying values so I just took the first year mentioned, then tacked on -2010
nemo
parents:
3006
diff
changeset
|
3 |
* Copyright (c) 2004-2010 Andrey Korotaev <unC0Rr@gmail.com> |
2947 | 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 |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
*) |
|
4 | 18 |
|
19 |
//////////////////////////////////////////////////////////////////////////////// |
|
20 |
procedure chQuit(var s: shortstring); |
|
1022 | 21 |
const prevGState: TGameState = gsConfirm; |
4 | 22 |
begin |
3407 | 23 |
s:= s; // avoid compiler hint |
1022 | 24 |
if GameState <> gsConfirm then |
25 |
begin |
|
26 |
prevGState:= GameState; |
|
27 |
GameState:= gsConfirm |
|
28 |
end else |
|
29 |
GameState:= prevGState |
|
30 |
end; |
|
31 |
||
32 |
procedure chConfirm(var s: shortstring); |
|
33 |
begin |
|
3407 | 34 |
s:= s; // avoid compiler hint |
1022 | 35 |
if GameState = gsConfirm then |
2947 | 36 |
begin |
37 |
SendIPC('Q'); |
|
38 |
GameState:= gsExit |
|
39 |
end |
|
2130
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
40 |
else |
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
41 |
begin |
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
42 |
GameState:= gsChat; |
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
43 |
KeyPressChat(27); |
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
44 |
KeyPressChat(47); |
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
45 |
KeyPressChat(116); |
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
46 |
KeyPressChat(101); |
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
47 |
KeyPressChat(97); |
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
48 |
KeyPressChat(109); |
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
49 |
KeyPressChat(32) |
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
50 |
end |
4 | 51 |
end; |
52 |
||
205 | 53 |
procedure chCheckProto(var s: shortstring); |
371 | 54 |
var i, c: LongInt; |
205 | 55 |
begin |
56 |
if isDeveloperMode then |
|
2947 | 57 |
begin |
58 |
val(s, i, c); |
|
59 |
if (c <> 0) or (i = 0) then exit; |
|
60 |
TryDo(i <= cNetProtoVersion, 'Protocol version mismatch: engine is too old', true); |
|
61 |
TryDo(i >= cNetProtoVersion, 'Protocol version mismatch: engine is too new', true) |
|
62 |
end |
|
205 | 63 |
end; |
64 |
||
4 | 65 |
procedure chTeamLocal(var s: shortstring); |
66 |
begin |
|
3407 | 67 |
s:= s; // avoid compiler hint |
4 | 68 |
if not isDeveloperMode then exit; |
69 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/rdriven"', true); |
|
351 | 70 |
CurrentTeam^.ExtDriven:= true |
4 | 71 |
end; |
3969
5f4ef3db0a65
Ok. Let's disable the right one this time. In fact, let's just remove newgrave entirely - no point in half-measures.
nemo
parents:
3968
diff
changeset
|
72 |
|
4 | 73 |
procedure chGrave(var s: shortstring); |
74 |
begin |
|
75 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/grave"', true); |
|
76 |
if s[1]='"' then Delete(s, 1, 1); |
|
77 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
351 | 78 |
CurrentTeam^.GraveName:= s |
4 | 79 |
end; |
80 |
||
81 |
procedure chFort(var s: shortstring); |
|
82 |
begin |
|
764
7513452b1d51
Now game looks almost like it did before switching to OpenGL
unc0rr
parents:
753
diff
changeset
|
83 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/fort"', true); |
4 | 84 |
if s[1]='"' then Delete(s, 1, 1); |
85 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
351 | 86 |
CurrentTeam^.FortName:= s |
4 | 87 |
end; |
88 |
||
2747 | 89 |
procedure chFlag(var s: shortstring); |
90 |
begin |
|
91 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/flag"', true); |
|
92 |
if s[1]='"' then Delete(s, 1, 1); |
|
93 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
94 |
CurrentTeam^.flag:= s |
|
95 |
end; |
|
96 |
||
2786 | 97 |
procedure chScript(var s: shortstring); |
98 |
begin |
|
99 |
if s[1]='"' then Delete(s, 1, 1); |
|
100 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
101 |
ScriptLoad(s) |
|
102 |
end; |
|
103 |
||
1242 | 104 |
procedure chSetHat(var s: shortstring); |
105 |
begin |
|
106 |
if (not isDeveloperMode) or (CurrentTeam = nil) then exit; |
|
107 |
with CurrentTeam^ do |
|
2726 | 108 |
begin |
109 |
if not CurrentHedgehog^.King then |
|
2947 | 110 |
if (s = '') or |
111 |
(((GameFlags and gfKing) <> 0) and (s = 'crown')) or |
|
112 |
((Length(s) > 39) and (Copy(s,1,8) = 'Reserved') and (Copy(s,9,32) <> PlayerHash)) then |
|
113 |
CurrentHedgehog^.Hat:= 'NoHat' |
|
114 |
else |
|
115 |
CurrentHedgehog^.Hat:= s |
|
2726 | 116 |
end; |
4 | 117 |
end; |
118 |
||
3346 | 119 |
procedure chSetAmmoLoadout(var descr: shortstring); |
120 |
begin |
|
121 |
SetAmmoLoadout(descr) |
|
122 |
end; |
|
123 |
||
124 |
procedure chSetAmmoDelay(var descr: shortstring); |
|
125 |
begin |
|
126 |
SetAmmoDelay(descr) |
|
127 |
end; |
|
128 |
||
129 |
procedure chSetAmmoProbability(var descr: shortstring); |
|
130 |
begin |
|
131 |
SetAmmoProbability(descr) |
|
132 |
end; |
|
133 |
||
134 |
procedure chSetAmmoReinforcement(var descr: shortstring); |
|
135 |
begin |
|
136 |
SetAmmoReinforcement(descr) |
|
137 |
end; |
|
138 |
||
288 | 139 |
procedure chAddAmmoStore(var descr: shortstring); |
140 |
begin |
|
3407 | 141 |
descr:= ''; // avoid compiler hint |
3346 | 142 |
AddAmmoStore |
288 | 143 |
end; |
144 |
||
4 | 145 |
procedure chBind(var id: shortstring); |
146 |
var s: shortstring; |
|
371 | 147 |
b: LongInt; |
4 | 148 |
begin |
3407 | 149 |
s:= ''; |
4 | 150 |
if CurrentTeam = nil then exit; |
151 |
SplitBySpace(id, s); |
|
152 |
if s[1]='"' then Delete(s, 1, 1); |
|
153 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
154 |
b:= KeyNameToCode(id); |
|
351 | 155 |
if b = 0 then OutError(errmsgUnknownVariable + ' "' + id + '"', false) |
2947 | 156 |
else CurrentTeam^.Binds[b]:= s |
4 | 157 |
end; |
158 |
||
2428 | 159 |
procedure chCurU_p(var s: shortstring); |
160 |
begin |
|
3407 | 161 |
s:= s; // avoid compiler hint |
2428 | 162 |
CursorMovementY:= -1; |
163 |
end; |
|
164 |
||
165 |
procedure chCurU_m(var s: shortstring); |
|
166 |
begin |
|
3407 | 167 |
s:= s; // avoid compiler hint |
2428 | 168 |
CursorMovementY:= 0; |
169 |
end; |
|
170 |
||
171 |
procedure chCurD_p(var s: shortstring); |
|
172 |
begin |
|
3407 | 173 |
s:= s; // avoid compiler hint |
2428 | 174 |
CursorMovementY:= 1; |
175 |
end; |
|
176 |
||
177 |
procedure chCurD_m(var s: shortstring); |
|
178 |
begin |
|
3407 | 179 |
s:= s; // avoid compiler hint |
2428 | 180 |
CursorMovementY:= 0; |
181 |
end; |
|
182 |
||
183 |
procedure chCurL_p(var s: shortstring); |
|
184 |
begin |
|
3407 | 185 |
s:= s; // avoid compiler hint |
2428 | 186 |
CursorMovementX:= -1; |
187 |
end; |
|
188 |
||
189 |
procedure chCurL_m(var s: shortstring); |
|
190 |
begin |
|
3407 | 191 |
s:= s; // avoid compiler hint |
2428 | 192 |
CursorMovementX:= 0; |
193 |
end; |
|
194 |
||
195 |
procedure chCurR_p(var s: shortstring); |
|
196 |
begin |
|
3407 | 197 |
s:= s; // avoid compiler hint |
2428 | 198 |
CursorMovementX:= 1; |
199 |
end; |
|
200 |
||
201 |
procedure chCurR_m(var s: shortstring); |
|
202 |
begin |
|
3407 | 203 |
s:= s; // avoid compiler hint |
2428 | 204 |
CursorMovementX:= 0; |
205 |
end; |
|
206 |
||
4 | 207 |
procedure chLeft_p(var s: shortstring); |
208 |
begin |
|
3407 | 209 |
s:= s; // avoid compiler hint |
3776 | 210 |
if CheckNoTeamOrHH or isPaused then exit; |
211 |
if not CurrentTeam^.ExtDriven then SendIPC('L'); |
|
3796 | 212 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
176 | 213 |
bShowFinger:= false; |
602 | 214 |
with CurrentHedgehog^.Gear^ do |
3894 | 215 |
Message:= Message or gmLeft |
4 | 216 |
end; |
217 |
||
218 |
procedure chLeft_m(var s: shortstring); |
|
219 |
begin |
|
3407 | 220 |
s:= s; // avoid compiler hint |
4 | 221 |
if CheckNoTeamOrHH then exit; |
351 | 222 |
if not CurrentTeam^.ExtDriven then SendIPC('l'); |
602 | 223 |
with CurrentHedgehog^.Gear^ do |
3894 | 224 |
Message:= Message and not gmLeft |
4 | 225 |
end; |
226 |
||
227 |
procedure chRight_p(var s: shortstring); |
|
228 |
begin |
|
3407 | 229 |
s:= s; // avoid compiler hint |
3776 | 230 |
if CheckNoTeamOrHH or isPaused then exit; |
231 |
if not CurrentTeam^.ExtDriven then SendIPC('R'); |
|
3796 | 232 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
176 | 233 |
bShowFinger:= false; |
602 | 234 |
with CurrentHedgehog^.Gear^ do |
3894 | 235 |
Message:= Message or gmRight |
4 | 236 |
end; |
237 |
||
238 |
procedure chRight_m(var s: shortstring); |
|
239 |
begin |
|
3407 | 240 |
s:= s; // avoid compiler hint |
4 | 241 |
if CheckNoTeamOrHH then exit; |
351 | 242 |
if not CurrentTeam^.ExtDriven then SendIPC('r'); |
602 | 243 |
with CurrentHedgehog^.Gear^ do |
3894 | 244 |
Message:= Message and not gmRight |
4 | 245 |
end; |
246 |
||
247 |
procedure chUp_p(var s: shortstring); |
|
248 |
begin |
|
3407 | 249 |
s:= s; // avoid compiler hint |
3776 | 250 |
if CheckNoTeamOrHH or isPaused then exit; |
251 |
if not CurrentTeam^.ExtDriven then SendIPC('U'); |
|
3796 | 252 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
176 | 253 |
bShowFinger:= false; |
602 | 254 |
with CurrentHedgehog^.Gear^ do |
3894 | 255 |
Message:= Message or gmUp |
4 | 256 |
end; |
257 |
||
258 |
procedure chUp_m(var s: shortstring); |
|
259 |
begin |
|
3407 | 260 |
s:= s; // avoid compiler hint |
4 | 261 |
if CheckNoTeamOrHH then exit; |
351 | 262 |
if not CurrentTeam^.ExtDriven then SendIPC('u'); |
602 | 263 |
with CurrentHedgehog^.Gear^ do |
3894 | 264 |
Message:= Message and not gmUp |
4 | 265 |
end; |
266 |
||
267 |
procedure chDown_p(var s: shortstring); |
|
268 |
begin |
|
3407 | 269 |
s:= s; // avoid compiler hint |
3776 | 270 |
if CheckNoTeamOrHH or isPaused then exit; |
271 |
if not CurrentTeam^.ExtDriven then SendIPC('D'); |
|
3796 | 272 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
176 | 273 |
bShowFinger:= false; |
602 | 274 |
with CurrentHedgehog^.Gear^ do |
3894 | 275 |
Message:= Message or gmDown |
4 | 276 |
end; |
277 |
||
278 |
procedure chDown_m(var s: shortstring); |
|
279 |
begin |
|
3407 | 280 |
s:= s; // avoid compiler hint |
4 | 281 |
if CheckNoTeamOrHH then exit; |
351 | 282 |
if not CurrentTeam^.ExtDriven then SendIPC('d'); |
602 | 283 |
with CurrentHedgehog^.Gear^ do |
3894 | 284 |
Message:= Message and not gmDown |
4 | 285 |
end; |
286 |
||
1639 | 287 |
procedure chPrecise_p(var s: shortstring); |
288 |
begin |
|
3407 | 289 |
s:= s; // avoid compiler hint |
3776 | 290 |
if CheckNoTeamOrHH or isPaused then exit; |
291 |
if not CurrentTeam^.ExtDriven then SendIPC('Z'); |
|
3796 | 292 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
1639 | 293 |
bShowFinger:= false; |
294 |
with CurrentHedgehog^.Gear^ do |
|
3894 | 295 |
Message:= Message or gmPrecise |
1639 | 296 |
end; |
297 |
||
298 |
procedure chPrecise_m(var s: shortstring); |
|
299 |
begin |
|
3407 | 300 |
s:= s; // avoid compiler hint |
1639 | 301 |
if CheckNoTeamOrHH then exit; |
302 |
if not CurrentTeam^.ExtDriven then SendIPC('z'); |
|
303 |
with CurrentHedgehog^.Gear^ do |
|
3894 | 304 |
Message:= Message and not gmPrecise |
1639 | 305 |
end; |
306 |
||
4 | 307 |
procedure chLJump(var s: shortstring); |
308 |
begin |
|
3407 | 309 |
s:= s; // avoid compiler hint |
3776 | 310 |
if CheckNoTeamOrHH or isPaused then exit; |
311 |
if not CurrentTeam^.ExtDriven then SendIPC('j'); |
|
3797 | 312 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
176 | 313 |
bShowFinger:= false; |
602 | 314 |
with CurrentHedgehog^.Gear^ do |
3894 | 315 |
Message:= Message or gmLJump |
4 | 316 |
end; |
317 |
||
318 |
procedure chHJump(var s: shortstring); |
|
319 |
begin |
|
3407 | 320 |
s:= s; // avoid compiler hint |
3776 | 321 |
if CheckNoTeamOrHH or isPaused then exit; |
322 |
if not CurrentTeam^.ExtDriven then SendIPC('J'); |
|
3797 | 323 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
176 | 324 |
bShowFinger:= false; |
602 | 325 |
with CurrentHedgehog^.Gear^ do |
3894 | 326 |
Message:= Message or gmHJump |
4 | 327 |
end; |
328 |
||
329 |
procedure chAttack_p(var s: shortstring); |
|
330 |
begin |
|
3407 | 331 |
s:= s; // avoid compiler hint |
3336 | 332 |
if CheckNoTeamOrHH or isPaused then exit; |
3797 | 333 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
176 | 334 |
bShowFinger:= false; |
602 | 335 |
with CurrentHedgehog^.Gear^ do |
2947 | 336 |
begin |
337 |
{$IFDEF DEBUGFILE}AddFileLog('/+attack: hedgehog''s Gear^.State = '+inttostr(State));{$ENDIF} |
|
338 |
if ((State and gstHHDriven) <> 0) then |
|
4 | 339 |
begin |
602 | 340 |
FollowGear:= CurrentHedgehog^.Gear; |
351 | 341 |
if not CurrentTeam^.ExtDriven then SendIPC('A'); |
3894 | 342 |
Message:= Message or gmAttack |
4 | 343 |
end |
2947 | 344 |
end |
4 | 345 |
end; |
346 |
||
347 |
procedure chAttack_m(var s: shortstring); |
|
348 |
begin |
|
3407 | 349 |
s:= s; // avoid compiler hint |
4 | 350 |
if CheckNoTeamOrHH then exit; |
602 | 351 |
with CurrentHedgehog^.Gear^ do |
2947 | 352 |
begin |
353 |
if not CurrentTeam^.ExtDriven and |
|
3894 | 354 |
((Message and gmAttack) <> 0) then SendIPC('a'); |
355 |
Message:= Message and not gmAttack |
|
2947 | 356 |
end |
4 | 357 |
end; |
358 |
||
359 |
procedure chSwitch(var s: shortstring); |
|
360 |
begin |
|
3407 | 361 |
s:= s; // avoid compiler hint |
3776 | 362 |
if CheckNoTeamOrHH or isPaused then exit; |
351 | 363 |
if not CurrentTeam^.ExtDriven then SendIPC('S'); |
3796 | 364 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
3776 | 365 |
bShowFinger:= false; |
602 | 366 |
with CurrentHedgehog^.Gear^ do |
3894 | 367 |
Message:= Message or gmSwitch |
4 | 368 |
end; |
369 |
||
370 |
procedure chNextTurn(var s: shortstring); |
|
371 |
begin |
|
3639
b5cdbcc89b61
use a button instead of label and simplify a lot touch interaction
koda
parents:
3638
diff
changeset
|
372 |
s:= s; // avoid compiler hint |
b5cdbcc89b61
use a button instead of label and simplify a lot touch interaction
koda
parents:
3638
diff
changeset
|
373 |
TryDo(AllInactive, '/nextturn called when not all gears are inactive', true); |
2046 | 374 |
|
3639
b5cdbcc89b61
use a button instead of label and simplify a lot touch interaction
koda
parents:
3638
diff
changeset
|
375 |
if not CurrentTeam^.ExtDriven then SendIPC('N'); |
b5cdbcc89b61
use a button instead of label and simplify a lot touch interaction
koda
parents:
3638
diff
changeset
|
376 |
{$IFDEF DEBUGFILE} |
b5cdbcc89b61
use a button instead of label and simplify a lot touch interaction
koda
parents:
3638
diff
changeset
|
377 |
AddFileLog('Doing SwitchHedgehog: time '+inttostr(GameTicks)); |
b5cdbcc89b61
use a button instead of label and simplify a lot touch interaction
koda
parents:
3638
diff
changeset
|
378 |
{$ENDIF} |
3935 | 379 |
perfExt_NewTurnBeginning(); |
4 | 380 |
end; |
381 |
||
382 |
procedure chSay(var s: shortstring); |
|
383 |
begin |
|
1356 | 384 |
SendIPC('s' + s); |
1378 | 385 |
|
386 |
if copy(s, 1, 4) = '/me ' then |
|
2947 | 387 |
s:= #2'* ' + UserNick + ' ' + copy(s, 5, Length(s) - 4) |
1378 | 388 |
else |
2947 | 389 |
s:= #1 + UserNick + ': ' + s; |
1378 | 390 |
|
1356 | 391 |
AddChatString(s) |
4 | 392 |
end; |
393 |
||
2124 | 394 |
procedure chTeamSay(var s: shortstring); |
395 |
begin |
|
396 |
SendIPC('b' + s); |
|
397 |
||
2962 | 398 |
s:= #4 + '[Team] ' + UserNick + ': ' + s; |
2124 | 399 |
|
2396 | 400 |
AddChatString(s) |
2124 | 401 |
end; |
402 |
||
4 | 403 |
procedure chTimer(var s: shortstring); |
404 |
begin |
|
2314 | 405 |
if (s[0] <> #1) or (s[1] < '1') or (s[1] > '5') or CheckNoTeamOrHH then exit; |
406 |
||
926
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
917
diff
changeset
|
407 |
if not CurrentTeam^.ExtDriven then SendIPC(s); |
3796 | 408 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
3776 | 409 |
bShowFinger:= false; |
926
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
917
diff
changeset
|
410 |
with CurrentHedgehog^.Gear^ do |
2947 | 411 |
begin |
3894 | 412 |
Message:= Message or gmTimer; |
2947 | 413 |
MsgParam:= byte(s[1]) - ord('0') |
414 |
end |
|
4 | 415 |
end; |
416 |
||
417 |
procedure chSlot(var s: shortstring); |
|
418 |
var slot: LongWord; |
|
419 |
begin |
|
95 | 420 |
if (s[0] <> #1) or CheckNoTeamOrHH then exit; |
4 | 421 |
slot:= byte(s[1]) - 49; |
10 | 422 |
if slot > cMaxSlotIndex then exit; |
351 | 423 |
if not CurrentTeam^.ExtDriven then SendIPC(char(byte(s[1]) + 79)); |
3796 | 424 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
3776 | 425 |
bShowFinger:= false; |
783 | 426 |
with CurrentHedgehog^.Gear^ do |
2947 | 427 |
begin |
3894 | 428 |
Message:= Message or gmSlot; |
2947 | 429 |
MsgParam:= slot |
430 |
end |
|
783 | 431 |
end; |
432 |
||
433 |
procedure chSetWeapon(var s: shortstring); |
|
434 |
begin |
|
3637
0db298524c3d
implement the check on the type of ammo requiring a second tap to confirm
koda
parents:
3611
diff
changeset
|
435 |
if (s[0] <> #1) or CheckNoTeamOrHH then exit; |
784 | 436 |
|
3637
0db298524c3d
implement the check on the type of ammo requiring a second tap to confirm
koda
parents:
3611
diff
changeset
|
437 |
if TAmmoType(s[1]) > High(TAmmoType) then exit; |
784 | 438 |
|
3637
0db298524c3d
implement the check on the type of ammo requiring a second tap to confirm
koda
parents:
3611
diff
changeset
|
439 |
if not CurrentTeam^.ExtDriven then SendIPC('w' + s); |
784 | 440 |
|
3637
0db298524c3d
implement the check on the type of ammo requiring a second tap to confirm
koda
parents:
3611
diff
changeset
|
441 |
with CurrentHedgehog^.Gear^ do |
2947 | 442 |
begin |
3894 | 443 |
Message:= Message or gmWeapon; |
3637
0db298524c3d
implement the check on the type of ammo requiring a second tap to confirm
koda
parents:
3611
diff
changeset
|
444 |
MsgParam:= byte(s[1]); |
0db298524c3d
implement the check on the type of ammo requiring a second tap to confirm
koda
parents:
3611
diff
changeset
|
445 |
end; |
4 | 446 |
end; |
447 |
||
1035 | 448 |
procedure chTaunt(var s: shortstring); |
449 |
begin |
|
450 |
if (s[0] <> #1) or CheckNoTeamOrHH then exit; |
|
451 |
||
452 |
if TWave(s[1]) > High(TWave) then exit; |
|
453 |
||
454 |
if not CurrentTeam^.ExtDriven then SendIPC('t' + s); |
|
455 |
||
456 |
with CurrentHedgehog^.Gear^ do |
|
2947 | 457 |
begin |
3894 | 458 |
Message:= Message or gmAnimate; |
2947 | 459 |
MsgParam:= byte(s[1]) |
460 |
end |
|
1035 | 461 |
end; |
462 |
||
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
463 |
procedure doPut(putX, putY: LongInt; fromAI: boolean); |
4 | 464 |
begin |
3776 | 465 |
if CheckNoTeamOrHH or isPaused then exit; |
3796 | 466 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
3776 | 467 |
bShowFinger:= false; |
2963
0f0789204802
This might be all it takes to prevent the desync. needs local/remote testing. Also toggle 2nd barrel state on 0 movement
nemo
parents:
2962
diff
changeset
|
468 |
if not CurrentTeam^.ExtDriven and bShowAmmoMenu then |
2947 | 469 |
begin |
470 |
bSelected:= true; |
|
471 |
exit |
|
472 |
end; |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
473 |
|
602 | 474 |
with CurrentHedgehog^.Gear^, |
2947 | 475 |
CurrentHedgehog^ do |
476 |
if (State and gstHHChooseTarget) <> 0 then |
|
477 |
begin |
|
478 |
isCursorVisible:= false; |
|
479 |
if not CurrentTeam^.ExtDriven then |
|
480 |
begin |
|
481 |
if fromAI then |
|
482 |
begin |
|
483 |
TargetPoint.X:= putX; |
|
484 |
TargetPoint.Y:= putY |
|
485 |
end else |
|
486 |
begin |
|
487 |
TargetPoint.X:= CursorPoint.X - WorldDx; |
|
488 |
TargetPoint.Y:= cScreenHeight - CursorPoint.Y - WorldDy; |
|
489 |
end; |
|
490 |
SendIPCXY('p', TargetPoint.X, TargetPoint.Y); |
|
491 |
end |
|
492 |
else |
|
493 |
begin |
|
494 |
TargetPoint.X:= putX; |
|
495 |
TargetPoint.Y:= putY |
|
496 |
end; |
|
497 |
{$IFDEF DEBUGFILE}AddFilelog('put: ' + inttostr(TargetPoint.X) + ', ' + inttostr(TargetPoint.Y));{$ENDIF} |
|
498 |
State:= State and not gstHHChooseTarget; |
|
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3797
diff
changeset
|
499 |
if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackingPut) <> 0 then |
3894 | 500 |
Message:= Message or gmAttack; |
2947 | 501 |
end |
502 |
else |
|
503 |
if CurrentTeam^.ExtDriven then |
|
504 |
OutError('got /put while not being in choose target mode', false) |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
505 |
end; |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
506 |
|
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
507 |
procedure chPut(var s: shortstring); |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
508 |
begin |
3638
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3637
diff
changeset
|
509 |
s:= s; // avoid compiler hint |
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3637
diff
changeset
|
510 |
doPut(0, 0, false); |
4 | 511 |
end; |
512 |
||
513 |
procedure chCapture(var s: shortstring); |
|
514 |
begin |
|
3407 | 515 |
s:= s; // avoid compiler hint |
4 | 516 |
flagMakeCapture:= true |
517 |
end; |
|
518 |
||
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
519 |
procedure chSetMap(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
520 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
521 |
if isDeveloperMode then |
2947 | 522 |
begin |
523 |
Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s; |
|
524 |
InitStepsFlags:= InitStepsFlags or cifMap |
|
525 |
end |
|
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
526 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
527 |
|
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
528 |
procedure chSetTheme(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
529 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
530 |
if isDeveloperMode then |
2947 | 531 |
begin |
532 |
Pathz[ptCurrTheme]:= Pathz[ptThemes] + '/' + s; |
|
533 |
InitStepsFlags:= InitStepsFlags or cifTheme |
|
534 |
end |
|
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
535 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
536 |
|
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
537 |
procedure chSetSeed(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
538 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
539 |
if isDeveloperMode then |
2947 | 540 |
begin |
541 |
SetRandomSeed(s); |
|
542 |
cSeed:= s; |
|
543 |
InitStepsFlags:= InitStepsFlags or cifRandomize |
|
544 |
end |
|
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
545 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
546 |
|
161 | 547 |
procedure chAmmoMenu(var s: shortstring); |
548 |
begin |
|
3407 | 549 |
s:= s; // avoid compiler hint |
3797 | 550 |
if CheckNoTeamOrHH then |
551 |
bShowAmmoMenu:= true |
|
2855
7e6adeb57427
Show the ammo menu of the last local non-bot team when not local turn. needs testing
nemo
parents:
2853
diff
changeset
|
552 |
else |
3797 | 553 |
begin |
554 |
with CurrentTeam^ do |
|
2855
7e6adeb57427
Show the ammo menu of the last local non-bot team when not local turn. needs testing
nemo
parents:
2853
diff
changeset
|
555 |
with Hedgehogs[CurrHedgehog] do |
2947 | 556 |
begin |
557 |
bSelected:= false; |
|
682 | 558 |
|
2947 | 559 |
if bShowAmmoMenu then bShowAmmoMenu:= false |
3396
e5b3e5f2818e
More portal changes. Allows for a multishoot utility. Hopefully not breaking anything.
nemo
parents:
3395
diff
changeset
|
560 |
else if ((Gear^.State and (gstAttacking or gstAttacked)) <> 0) or |
4241
835fd7a0e1bf
Move resurrection to utilities, reduce its probablit a bit to match other utilities, rename the "hint" prop since it really isn't being used as a hint anymore. That can be put back if it changes.
nemo
parents:
4210
diff
changeset
|
561 |
((MultiShootAttacks > 0) and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) = 0)) or |
3396
e5b3e5f2818e
More portal changes. Allows for a multishoot utility. Hopefully not breaking anything.
nemo
parents:
3395
diff
changeset
|
562 |
((Gear^.State and gstHHDriven) = 0) then else bShowAmmoMenu:= true |
3797 | 563 |
end; |
564 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1 |
|
565 |
end |
|
161 | 566 |
end; |
567 |
||
175 | 568 |
procedure chVol_p(var s: shortstring); |
174 | 569 |
begin |
3407 | 570 |
s:= s; // avoid compiler hint |
175 | 571 |
inc(cVolumeDelta, 3) |
174 | 572 |
end; |
573 |
||
175 | 574 |
procedure chVol_m(var s: shortstring); |
174 | 575 |
begin |
3407 | 576 |
s:= s; // avoid compiler hint |
175 | 577 |
dec(cVolumeDelta, 3) |
174 | 578 |
end; |
579 |
||
176 | 580 |
procedure chFindhh(var s: shortstring); |
581 |
begin |
|
3407 | 582 |
s:= s; // avoid compiler hint |
3336 | 583 |
if CheckNoTeamOrHH or isPaused then exit; |
176 | 584 |
bShowFinger:= true; |
602 | 585 |
FollowGear:= CurrentHedgehog^.Gear |
176 | 586 |
end; |
587 |
||
281
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
588 |
procedure chPause(var s: shortstring); |
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
589 |
begin |
3407 | 590 |
s:= s; // avoid compiler hint |
3796 | 591 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
1743 | 592 |
if gameType <> gmtNet then |
2947 | 593 |
isPaused:= not isPaused; |
281
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
594 |
SDL_ShowCursor(ord(isPaused)) |
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
595 |
end; |
539
6a9bf1852bbc
Ability to choose which info is shown above hedgehogs
unc0rr
parents:
534
diff
changeset
|
596 |
|
6a9bf1852bbc
Ability to choose which info is shown above hedgehogs
unc0rr
parents:
534
diff
changeset
|
597 |
procedure chRotateMask(var s: shortstring); |
6a9bf1852bbc
Ability to choose which info is shown above hedgehogs
unc0rr
parents:
534
diff
changeset
|
598 |
begin |
3407 | 599 |
s:= s; // avoid compiler hint |
2947 | 600 |
if ((GameFlags and gfInvulnerable) = 0) then cTagsMask:= cTagsMasks[cTagsMask] else cTagsMask:= cTagsMasksNoHealth[cTagsMask]; |
539
6a9bf1852bbc
Ability to choose which info is shown above hedgehogs
unc0rr
parents:
534
diff
changeset
|
601 |
end; |
6a9bf1852bbc
Ability to choose which info is shown above hedgehogs
unc0rr
parents:
534
diff
changeset
|
602 |
|
626 | 603 |
procedure chSpeedup_p(var s: shortstring); |
604 |
begin |
|
3407 | 605 |
s:= s; // avoid compiler hint |
626 | 606 |
isSpeed:= true |
607 |
end; |
|
608 |
||
609 |
procedure chSpeedup_m(var s: shortstring); |
|
610 |
begin |
|
3407 | 611 |
s:= s; // avoid compiler hint |
626 | 612 |
isSpeed:= false |
613 |
end; |
|
946 | 614 |
|
2162 | 615 |
procedure chZoomIn(var s: shortstring); |
616 |
begin |
|
3523 | 617 |
s:= s; // avoid compiler hint |
3638
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3637
diff
changeset
|
618 |
if ZoomValue < cMinZoomLevel then |
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3637
diff
changeset
|
619 |
ZoomValue:= ZoomValue + cZoomDelta; |
2162 | 620 |
end; |
621 |
||
622 |
procedure chZoomOut(var s: shortstring); |
|
623 |
begin |
|
3523 | 624 |
s:= s; // avoid compiler hint |
3638
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3637
diff
changeset
|
625 |
if ZoomValue > cMaxZoomLevel then |
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3637
diff
changeset
|
626 |
ZoomValue:= ZoomValue - cZoomDelta; |
2162 | 627 |
end; |
628 |
||
2379 | 629 |
procedure chZoomReset(var s: shortstring); |
630 |
begin |
|
3523 | 631 |
s:= s; // avoid compiler hint |
632 |
ZoomValue:= cDefaultZoomLevel; |
|
2379 | 633 |
end; |
634 |
||
946 | 635 |
procedure chChat(var s: shortstring); |
636 |
begin |
|
3680 | 637 |
s:= s; // avoid compiler hint |
638 |
GameState:= gsChat; |
|
639 |
KeyPressChat(27) |
|
946 | 640 |
end; |
991 | 641 |
|
642 |
procedure chHistory(var s: shortstring); |
|
643 |
begin |
|
3680 | 644 |
s:= s; // avoid compiler hint |
645 |
uChat.showAll:= not uChat.showAll |
|
991 | 646 |
end; |
4389 | 647 |