author | nemo |
Sun, 21 Nov 2010 16:13:44 -0500 | |
changeset 4408 | 81b0961b9863 |
parent 4402 | 54a78ec6aac4 |
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 |
4402 | 41 |
ParseCommand('chat team', true); |
4 | 42 |
end; |
43 |
||
205 | 44 |
procedure chCheckProto(var s: shortstring); |
371 | 45 |
var i, c: LongInt; |
205 | 46 |
begin |
47 |
if isDeveloperMode then |
|
2947 | 48 |
begin |
49 |
val(s, i, c); |
|
50 |
if (c <> 0) or (i = 0) then exit; |
|
51 |
TryDo(i <= cNetProtoVersion, 'Protocol version mismatch: engine is too old', true); |
|
52 |
TryDo(i >= cNetProtoVersion, 'Protocol version mismatch: engine is too new', true) |
|
53 |
end |
|
205 | 54 |
end; |
55 |
||
4 | 56 |
procedure chTeamLocal(var s: shortstring); |
57 |
begin |
|
3407 | 58 |
s:= s; // avoid compiler hint |
4 | 59 |
if not isDeveloperMode then exit; |
60 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/rdriven"', true); |
|
351 | 61 |
CurrentTeam^.ExtDriven:= true |
4 | 62 |
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
|
63 |
|
4 | 64 |
procedure chGrave(var s: shortstring); |
65 |
begin |
|
66 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/grave"', true); |
|
67 |
if s[1]='"' then Delete(s, 1, 1); |
|
68 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
351 | 69 |
CurrentTeam^.GraveName:= s |
4 | 70 |
end; |
71 |
||
72 |
procedure chFort(var s: shortstring); |
|
73 |
begin |
|
764
7513452b1d51
Now game looks almost like it did before switching to OpenGL
unc0rr
parents:
753
diff
changeset
|
74 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/fort"', true); |
4 | 75 |
if s[1]='"' then Delete(s, 1, 1); |
76 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
351 | 77 |
CurrentTeam^.FortName:= s |
4 | 78 |
end; |
79 |
||
2747 | 80 |
procedure chFlag(var s: shortstring); |
81 |
begin |
|
82 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/flag"', true); |
|
83 |
if s[1]='"' then Delete(s, 1, 1); |
|
84 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
85 |
CurrentTeam^.flag:= s |
|
86 |
end; |
|
87 |
||
2786 | 88 |
procedure chScript(var s: shortstring); |
89 |
begin |
|
90 |
if s[1]='"' then Delete(s, 1, 1); |
|
91 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
92 |
ScriptLoad(s) |
|
93 |
end; |
|
94 |
||
1242 | 95 |
procedure chSetHat(var s: shortstring); |
96 |
begin |
|
97 |
if (not isDeveloperMode) or (CurrentTeam = nil) then exit; |
|
98 |
with CurrentTeam^ do |
|
2726 | 99 |
begin |
100 |
if not CurrentHedgehog^.King then |
|
2947 | 101 |
if (s = '') or |
102 |
(((GameFlags and gfKing) <> 0) and (s = 'crown')) or |
|
103 |
((Length(s) > 39) and (Copy(s,1,8) = 'Reserved') and (Copy(s,9,32) <> PlayerHash)) then |
|
104 |
CurrentHedgehog^.Hat:= 'NoHat' |
|
105 |
else |
|
106 |
CurrentHedgehog^.Hat:= s |
|
2726 | 107 |
end; |
4 | 108 |
end; |
109 |
||
2428 | 110 |
procedure chCurU_p(var s: shortstring); |
111 |
begin |
|
3407 | 112 |
s:= s; // avoid compiler hint |
2428 | 113 |
CursorMovementY:= -1; |
114 |
end; |
|
115 |
||
116 |
procedure chCurU_m(var s: shortstring); |
|
117 |
begin |
|
3407 | 118 |
s:= s; // avoid compiler hint |
2428 | 119 |
CursorMovementY:= 0; |
120 |
end; |
|
121 |
||
122 |
procedure chCurD_p(var s: shortstring); |
|
123 |
begin |
|
3407 | 124 |
s:= s; // avoid compiler hint |
2428 | 125 |
CursorMovementY:= 1; |
126 |
end; |
|
127 |
||
128 |
procedure chCurD_m(var s: shortstring); |
|
129 |
begin |
|
3407 | 130 |
s:= s; // avoid compiler hint |
2428 | 131 |
CursorMovementY:= 0; |
132 |
end; |
|
133 |
||
134 |
procedure chCurL_p(var s: shortstring); |
|
135 |
begin |
|
3407 | 136 |
s:= s; // avoid compiler hint |
2428 | 137 |
CursorMovementX:= -1; |
138 |
end; |
|
139 |
||
140 |
procedure chCurL_m(var s: shortstring); |
|
141 |
begin |
|
3407 | 142 |
s:= s; // avoid compiler hint |
2428 | 143 |
CursorMovementX:= 0; |
144 |
end; |
|
145 |
||
146 |
procedure chCurR_p(var s: shortstring); |
|
147 |
begin |
|
3407 | 148 |
s:= s; // avoid compiler hint |
2428 | 149 |
CursorMovementX:= 1; |
150 |
end; |
|
151 |
||
152 |
procedure chCurR_m(var s: shortstring); |
|
153 |
begin |
|
3407 | 154 |
s:= s; // avoid compiler hint |
2428 | 155 |
CursorMovementX:= 0; |
156 |
end; |
|
157 |
||
4 | 158 |
procedure chLeft_p(var s: shortstring); |
159 |
begin |
|
3407 | 160 |
s:= s; // avoid compiler hint |
3776 | 161 |
if CheckNoTeamOrHH or isPaused then exit; |
162 |
if not CurrentTeam^.ExtDriven then SendIPC('L'); |
|
3796 | 163 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
176 | 164 |
bShowFinger:= false; |
602 | 165 |
with CurrentHedgehog^.Gear^ do |
3894 | 166 |
Message:= Message or gmLeft |
4 | 167 |
end; |
168 |
||
169 |
procedure chLeft_m(var s: shortstring); |
|
170 |
begin |
|
3407 | 171 |
s:= s; // avoid compiler hint |
4 | 172 |
if CheckNoTeamOrHH then exit; |
351 | 173 |
if not CurrentTeam^.ExtDriven then SendIPC('l'); |
602 | 174 |
with CurrentHedgehog^.Gear^ do |
3894 | 175 |
Message:= Message and not gmLeft |
4 | 176 |
end; |
177 |
||
178 |
procedure chRight_p(var s: shortstring); |
|
179 |
begin |
|
3407 | 180 |
s:= s; // avoid compiler hint |
3776 | 181 |
if CheckNoTeamOrHH or isPaused then exit; |
182 |
if not CurrentTeam^.ExtDriven then SendIPC('R'); |
|
3796 | 183 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
176 | 184 |
bShowFinger:= false; |
602 | 185 |
with CurrentHedgehog^.Gear^ do |
3894 | 186 |
Message:= Message or gmRight |
4 | 187 |
end; |
188 |
||
189 |
procedure chRight_m(var s: shortstring); |
|
190 |
begin |
|
3407 | 191 |
s:= s; // avoid compiler hint |
4 | 192 |
if CheckNoTeamOrHH then exit; |
351 | 193 |
if not CurrentTeam^.ExtDriven then SendIPC('r'); |
602 | 194 |
with CurrentHedgehog^.Gear^ do |
3894 | 195 |
Message:= Message and not gmRight |
4 | 196 |
end; |
197 |
||
198 |
procedure chUp_p(var s: shortstring); |
|
199 |
begin |
|
3407 | 200 |
s:= s; // avoid compiler hint |
3776 | 201 |
if CheckNoTeamOrHH or isPaused then exit; |
202 |
if not CurrentTeam^.ExtDriven then SendIPC('U'); |
|
3796 | 203 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
176 | 204 |
bShowFinger:= false; |
602 | 205 |
with CurrentHedgehog^.Gear^ do |
3894 | 206 |
Message:= Message or gmUp |
4 | 207 |
end; |
208 |
||
209 |
procedure chUp_m(var s: shortstring); |
|
210 |
begin |
|
3407 | 211 |
s:= s; // avoid compiler hint |
4 | 212 |
if CheckNoTeamOrHH then exit; |
351 | 213 |
if not CurrentTeam^.ExtDriven then SendIPC('u'); |
602 | 214 |
with CurrentHedgehog^.Gear^ do |
3894 | 215 |
Message:= Message and not gmUp |
4 | 216 |
end; |
217 |
||
218 |
procedure chDown_p(var s: shortstring); |
|
219 |
begin |
|
3407 | 220 |
s:= s; // avoid compiler hint |
3776 | 221 |
if CheckNoTeamOrHH or isPaused then exit; |
222 |
if not CurrentTeam^.ExtDriven then SendIPC('D'); |
|
3796 | 223 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
176 | 224 |
bShowFinger:= false; |
602 | 225 |
with CurrentHedgehog^.Gear^ do |
3894 | 226 |
Message:= Message or gmDown |
4 | 227 |
end; |
228 |
||
229 |
procedure chDown_m(var s: shortstring); |
|
230 |
begin |
|
3407 | 231 |
s:= s; // avoid compiler hint |
4 | 232 |
if CheckNoTeamOrHH then exit; |
351 | 233 |
if not CurrentTeam^.ExtDriven then SendIPC('d'); |
602 | 234 |
with CurrentHedgehog^.Gear^ do |
3894 | 235 |
Message:= Message and not gmDown |
4 | 236 |
end; |
237 |
||
1639 | 238 |
procedure chPrecise_p(var s: shortstring); |
239 |
begin |
|
3407 | 240 |
s:= s; // avoid compiler hint |
3776 | 241 |
if CheckNoTeamOrHH or isPaused then exit; |
242 |
if not CurrentTeam^.ExtDriven then SendIPC('Z'); |
|
3796 | 243 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
1639 | 244 |
bShowFinger:= false; |
245 |
with CurrentHedgehog^.Gear^ do |
|
3894 | 246 |
Message:= Message or gmPrecise |
1639 | 247 |
end; |
248 |
||
249 |
procedure chPrecise_m(var s: shortstring); |
|
250 |
begin |
|
3407 | 251 |
s:= s; // avoid compiler hint |
1639 | 252 |
if CheckNoTeamOrHH then exit; |
253 |
if not CurrentTeam^.ExtDriven then SendIPC('z'); |
|
254 |
with CurrentHedgehog^.Gear^ do |
|
3894 | 255 |
Message:= Message and not gmPrecise |
1639 | 256 |
end; |
257 |
||
4 | 258 |
procedure chLJump(var s: shortstring); |
259 |
begin |
|
3407 | 260 |
s:= s; // avoid compiler hint |
3776 | 261 |
if CheckNoTeamOrHH or isPaused then exit; |
262 |
if not CurrentTeam^.ExtDriven then SendIPC('j'); |
|
3797 | 263 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
176 | 264 |
bShowFinger:= false; |
602 | 265 |
with CurrentHedgehog^.Gear^ do |
3894 | 266 |
Message:= Message or gmLJump |
4 | 267 |
end; |
268 |
||
269 |
procedure chHJump(var s: shortstring); |
|
270 |
begin |
|
3407 | 271 |
s:= s; // avoid compiler hint |
3776 | 272 |
if CheckNoTeamOrHH or isPaused then exit; |
273 |
if not CurrentTeam^.ExtDriven then SendIPC('J'); |
|
3797 | 274 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
176 | 275 |
bShowFinger:= false; |
602 | 276 |
with CurrentHedgehog^.Gear^ do |
3894 | 277 |
Message:= Message or gmHJump |
4 | 278 |
end; |
279 |
||
280 |
procedure chAttack_p(var s: shortstring); |
|
281 |
begin |
|
3407 | 282 |
s:= s; // avoid compiler hint |
3336 | 283 |
if CheckNoTeamOrHH or isPaused then exit; |
3797 | 284 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
176 | 285 |
bShowFinger:= false; |
602 | 286 |
with CurrentHedgehog^.Gear^ do |
2947 | 287 |
begin |
288 |
{$IFDEF DEBUGFILE}AddFileLog('/+attack: hedgehog''s Gear^.State = '+inttostr(State));{$ENDIF} |
|
289 |
if ((State and gstHHDriven) <> 0) then |
|
4 | 290 |
begin |
602 | 291 |
FollowGear:= CurrentHedgehog^.Gear; |
351 | 292 |
if not CurrentTeam^.ExtDriven then SendIPC('A'); |
3894 | 293 |
Message:= Message or gmAttack |
4 | 294 |
end |
2947 | 295 |
end |
4 | 296 |
end; |
297 |
||
298 |
procedure chAttack_m(var s: shortstring); |
|
299 |
begin |
|
3407 | 300 |
s:= s; // avoid compiler hint |
4 | 301 |
if CheckNoTeamOrHH then exit; |
602 | 302 |
with CurrentHedgehog^.Gear^ do |
2947 | 303 |
begin |
304 |
if not CurrentTeam^.ExtDriven and |
|
3894 | 305 |
((Message and gmAttack) <> 0) then SendIPC('a'); |
306 |
Message:= Message and not gmAttack |
|
2947 | 307 |
end |
4 | 308 |
end; |
309 |
||
310 |
procedure chSwitch(var s: shortstring); |
|
311 |
begin |
|
3407 | 312 |
s:= s; // avoid compiler hint |
3776 | 313 |
if CheckNoTeamOrHH or isPaused then exit; |
351 | 314 |
if not CurrentTeam^.ExtDriven then SendIPC('S'); |
3796 | 315 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
3776 | 316 |
bShowFinger:= false; |
602 | 317 |
with CurrentHedgehog^.Gear^ do |
3894 | 318 |
Message:= Message or gmSwitch |
4 | 319 |
end; |
320 |
||
321 |
procedure chNextTurn(var s: shortstring); |
|
322 |
begin |
|
3639
b5cdbcc89b61
use a button instead of label and simplify a lot touch interaction
koda
parents:
3638
diff
changeset
|
323 |
s:= s; // avoid compiler hint |
b5cdbcc89b61
use a button instead of label and simplify a lot touch interaction
koda
parents:
3638
diff
changeset
|
324 |
TryDo(AllInactive, '/nextturn called when not all gears are inactive', true); |
2046 | 325 |
|
3639
b5cdbcc89b61
use a button instead of label and simplify a lot touch interaction
koda
parents:
3638
diff
changeset
|
326 |
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
|
327 |
{$IFDEF DEBUGFILE} |
b5cdbcc89b61
use a button instead of label and simplify a lot touch interaction
koda
parents:
3638
diff
changeset
|
328 |
AddFileLog('Doing SwitchHedgehog: time '+inttostr(GameTicks)); |
b5cdbcc89b61
use a button instead of label and simplify a lot touch interaction
koda
parents:
3638
diff
changeset
|
329 |
{$ENDIF} |
3935 | 330 |
perfExt_NewTurnBeginning(); |
4 | 331 |
end; |
332 |
||
333 |
procedure chTimer(var s: shortstring); |
|
334 |
begin |
|
2314 | 335 |
if (s[0] <> #1) or (s[1] < '1') or (s[1] > '5') or CheckNoTeamOrHH then exit; |
336 |
||
926
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
917
diff
changeset
|
337 |
if not CurrentTeam^.ExtDriven then SendIPC(s); |
3796 | 338 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
3776 | 339 |
bShowFinger:= false; |
926
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
917
diff
changeset
|
340 |
with CurrentHedgehog^.Gear^ do |
2947 | 341 |
begin |
3894 | 342 |
Message:= Message or gmTimer; |
2947 | 343 |
MsgParam:= byte(s[1]) - ord('0') |
344 |
end |
|
4 | 345 |
end; |
346 |
||
347 |
procedure chSlot(var s: shortstring); |
|
348 |
var slot: LongWord; |
|
349 |
begin |
|
95 | 350 |
if (s[0] <> #1) or CheckNoTeamOrHH then exit; |
4 | 351 |
slot:= byte(s[1]) - 49; |
10 | 352 |
if slot > cMaxSlotIndex then exit; |
351 | 353 |
if not CurrentTeam^.ExtDriven then SendIPC(char(byte(s[1]) + 79)); |
3796 | 354 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
3776 | 355 |
bShowFinger:= false; |
783 | 356 |
with CurrentHedgehog^.Gear^ do |
2947 | 357 |
begin |
3894 | 358 |
Message:= Message or gmSlot; |
2947 | 359 |
MsgParam:= slot |
360 |
end |
|
783 | 361 |
end; |
362 |
||
363 |
procedure chSetWeapon(var s: shortstring); |
|
364 |
begin |
|
3637
0db298524c3d
implement the check on the type of ammo requiring a second tap to confirm
koda
parents:
3611
diff
changeset
|
365 |
if (s[0] <> #1) or CheckNoTeamOrHH then exit; |
784 | 366 |
|
3637
0db298524c3d
implement the check on the type of ammo requiring a second tap to confirm
koda
parents:
3611
diff
changeset
|
367 |
if TAmmoType(s[1]) > High(TAmmoType) then exit; |
784 | 368 |
|
3637
0db298524c3d
implement the check on the type of ammo requiring a second tap to confirm
koda
parents:
3611
diff
changeset
|
369 |
if not CurrentTeam^.ExtDriven then SendIPC('w' + s); |
784 | 370 |
|
3637
0db298524c3d
implement the check on the type of ammo requiring a second tap to confirm
koda
parents:
3611
diff
changeset
|
371 |
with CurrentHedgehog^.Gear^ do |
2947 | 372 |
begin |
3894 | 373 |
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
|
374 |
MsgParam:= byte(s[1]); |
0db298524c3d
implement the check on the type of ammo requiring a second tap to confirm
koda
parents:
3611
diff
changeset
|
375 |
end; |
4 | 376 |
end; |
377 |
||
1035 | 378 |
procedure chTaunt(var s: shortstring); |
379 |
begin |
|
380 |
if (s[0] <> #1) or CheckNoTeamOrHH then exit; |
|
381 |
||
382 |
if TWave(s[1]) > High(TWave) then exit; |
|
383 |
||
384 |
if not CurrentTeam^.ExtDriven then SendIPC('t' + s); |
|
385 |
||
386 |
with CurrentHedgehog^.Gear^ do |
|
2947 | 387 |
begin |
3894 | 388 |
Message:= Message or gmAnimate; |
2947 | 389 |
MsgParam:= byte(s[1]) |
390 |
end |
|
1035 | 391 |
end; |
392 |
||
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
393 |
procedure doPut(putX, putY: LongInt; fromAI: boolean); |
4 | 394 |
begin |
3776 | 395 |
if CheckNoTeamOrHH or isPaused then exit; |
3796 | 396 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
3776 | 397 |
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
|
398 |
if not CurrentTeam^.ExtDriven and bShowAmmoMenu then |
2947 | 399 |
begin |
400 |
bSelected:= true; |
|
401 |
exit |
|
402 |
end; |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
403 |
|
602 | 404 |
with CurrentHedgehog^.Gear^, |
2947 | 405 |
CurrentHedgehog^ do |
406 |
if (State and gstHHChooseTarget) <> 0 then |
|
407 |
begin |
|
408 |
isCursorVisible:= false; |
|
409 |
if not CurrentTeam^.ExtDriven then |
|
410 |
begin |
|
411 |
if fromAI then |
|
412 |
begin |
|
413 |
TargetPoint.X:= putX; |
|
414 |
TargetPoint.Y:= putY |
|
415 |
end else |
|
416 |
begin |
|
417 |
TargetPoint.X:= CursorPoint.X - WorldDx; |
|
418 |
TargetPoint.Y:= cScreenHeight - CursorPoint.Y - WorldDy; |
|
419 |
end; |
|
420 |
SendIPCXY('p', TargetPoint.X, TargetPoint.Y); |
|
421 |
end |
|
422 |
else |
|
423 |
begin |
|
424 |
TargetPoint.X:= putX; |
|
425 |
TargetPoint.Y:= putY |
|
426 |
end; |
|
427 |
{$IFDEF DEBUGFILE}AddFilelog('put: ' + inttostr(TargetPoint.X) + ', ' + inttostr(TargetPoint.Y));{$ENDIF} |
|
428 |
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
|
429 |
if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackingPut) <> 0 then |
3894 | 430 |
Message:= Message or gmAttack; |
2947 | 431 |
end |
432 |
else |
|
433 |
if CurrentTeam^.ExtDriven then |
|
434 |
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
|
435 |
end; |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
436 |
|
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
437 |
procedure chPut(var s: shortstring); |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
438 |
begin |
3638
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3637
diff
changeset
|
439 |
s:= s; // avoid compiler hint |
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3637
diff
changeset
|
440 |
doPut(0, 0, false); |
4 | 441 |
end; |
442 |
||
443 |
procedure chCapture(var s: shortstring); |
|
444 |
begin |
|
3407 | 445 |
s:= s; // avoid compiler hint |
4 | 446 |
flagMakeCapture:= true |
447 |
end; |
|
448 |
||
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
449 |
procedure chSetMap(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
450 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
451 |
if isDeveloperMode then |
2947 | 452 |
begin |
453 |
Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s; |
|
454 |
InitStepsFlags:= InitStepsFlags or cifMap |
|
455 |
end |
|
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
456 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
457 |
|
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
458 |
procedure chSetTheme(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
459 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
460 |
if isDeveloperMode then |
2947 | 461 |
begin |
462 |
Pathz[ptCurrTheme]:= Pathz[ptThemes] + '/' + s; |
|
463 |
InitStepsFlags:= InitStepsFlags or cifTheme |
|
464 |
end |
|
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
465 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
466 |
|
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
467 |
procedure chSetSeed(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
468 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
469 |
if isDeveloperMode then |
2947 | 470 |
begin |
471 |
SetRandomSeed(s); |
|
472 |
cSeed:= s; |
|
473 |
InitStepsFlags:= InitStepsFlags or cifRandomize |
|
474 |
end |
|
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
475 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
476 |
|
161 | 477 |
procedure chAmmoMenu(var s: shortstring); |
478 |
begin |
|
3407 | 479 |
s:= s; // avoid compiler hint |
3797 | 480 |
if CheckNoTeamOrHH then |
481 |
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
|
482 |
else |
3797 | 483 |
begin |
484 |
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
|
485 |
with Hedgehogs[CurrHedgehog] do |
2947 | 486 |
begin |
487 |
bSelected:= false; |
|
682 | 488 |
|
2947 | 489 |
if bShowAmmoMenu then bShowAmmoMenu:= false |
3396
e5b3e5f2818e
More portal changes. Allows for a multishoot utility. Hopefully not breaking anything.
nemo
parents:
3395
diff
changeset
|
490 |
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
|
491 |
((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
|
492 |
((Gear^.State and gstHHDriven) = 0) then else bShowAmmoMenu:= true |
3797 | 493 |
end; |
494 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1 |
|
495 |
end |
|
161 | 496 |
end; |
497 |
||
175 | 498 |
procedure chVol_p(var s: shortstring); |
174 | 499 |
begin |
3407 | 500 |
s:= s; // avoid compiler hint |
175 | 501 |
inc(cVolumeDelta, 3) |
174 | 502 |
end; |
503 |
||
175 | 504 |
procedure chVol_m(var s: shortstring); |
174 | 505 |
begin |
3407 | 506 |
s:= s; // avoid compiler hint |
175 | 507 |
dec(cVolumeDelta, 3) |
174 | 508 |
end; |
509 |
||
176 | 510 |
procedure chFindhh(var s: shortstring); |
511 |
begin |
|
3407 | 512 |
s:= s; // avoid compiler hint |
3336 | 513 |
if CheckNoTeamOrHH or isPaused then exit; |
176 | 514 |
bShowFinger:= true; |
602 | 515 |
FollowGear:= CurrentHedgehog^.Gear |
176 | 516 |
end; |
517 |
||
281
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
518 |
procedure chPause(var s: shortstring); |
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
519 |
begin |
3407 | 520 |
s:= s; // avoid compiler hint |
3796 | 521 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
1743 | 522 |
if gameType <> gmtNet then |
2947 | 523 |
isPaused:= not isPaused; |
281
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
524 |
SDL_ShowCursor(ord(isPaused)) |
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
525 |
end; |
539
6a9bf1852bbc
Ability to choose which info is shown above hedgehogs
unc0rr
parents:
534
diff
changeset
|
526 |
|
6a9bf1852bbc
Ability to choose which info is shown above hedgehogs
unc0rr
parents:
534
diff
changeset
|
527 |
procedure chRotateMask(var s: shortstring); |
6a9bf1852bbc
Ability to choose which info is shown above hedgehogs
unc0rr
parents:
534
diff
changeset
|
528 |
begin |
3407 | 529 |
s:= s; // avoid compiler hint |
2947 | 530 |
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
|
531 |
end; |
6a9bf1852bbc
Ability to choose which info is shown above hedgehogs
unc0rr
parents:
534
diff
changeset
|
532 |
|
626 | 533 |
procedure chSpeedup_p(var s: shortstring); |
534 |
begin |
|
3407 | 535 |
s:= s; // avoid compiler hint |
626 | 536 |
isSpeed:= true |
537 |
end; |
|
538 |
||
539 |
procedure chSpeedup_m(var s: shortstring); |
|
540 |
begin |
|
3407 | 541 |
s:= s; // avoid compiler hint |
626 | 542 |
isSpeed:= false |
543 |
end; |
|
946 | 544 |
|
2162 | 545 |
procedure chZoomIn(var s: shortstring); |
546 |
begin |
|
3523 | 547 |
s:= s; // avoid compiler hint |
3638
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3637
diff
changeset
|
548 |
if ZoomValue < cMinZoomLevel then |
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3637
diff
changeset
|
549 |
ZoomValue:= ZoomValue + cZoomDelta; |
2162 | 550 |
end; |
551 |
||
552 |
procedure chZoomOut(var s: shortstring); |
|
553 |
begin |
|
3523 | 554 |
s:= s; // avoid compiler hint |
3638
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3637
diff
changeset
|
555 |
if ZoomValue > cMaxZoomLevel then |
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3637
diff
changeset
|
556 |
ZoomValue:= ZoomValue - cZoomDelta; |
2162 | 557 |
end; |
558 |
||
2379 | 559 |
procedure chZoomReset(var s: shortstring); |
560 |
begin |
|
3523 | 561 |
s:= s; // avoid compiler hint |
562 |
ZoomValue:= cDefaultZoomLevel; |
|
2379 | 563 |
end; |
564 |
||
991 | 565 |