author | unc0rr |
Sun, 21 Nov 2010 19:07:43 +0300 | |
changeset 4401 | 9cb6990af584 |
parent 4398 | 36d7e4b6ca81 |
child 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 |
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 |
||
2428 | 119 |
procedure chCurU_p(var s: shortstring); |
120 |
begin |
|
3407 | 121 |
s:= s; // avoid compiler hint |
2428 | 122 |
CursorMovementY:= -1; |
123 |
end; |
|
124 |
||
125 |
procedure chCurU_m(var s: shortstring); |
|
126 |
begin |
|
3407 | 127 |
s:= s; // avoid compiler hint |
2428 | 128 |
CursorMovementY:= 0; |
129 |
end; |
|
130 |
||
131 |
procedure chCurD_p(var s: shortstring); |
|
132 |
begin |
|
3407 | 133 |
s:= s; // avoid compiler hint |
2428 | 134 |
CursorMovementY:= 1; |
135 |
end; |
|
136 |
||
137 |
procedure chCurD_m(var s: shortstring); |
|
138 |
begin |
|
3407 | 139 |
s:= s; // avoid compiler hint |
2428 | 140 |
CursorMovementY:= 0; |
141 |
end; |
|
142 |
||
143 |
procedure chCurL_p(var s: shortstring); |
|
144 |
begin |
|
3407 | 145 |
s:= s; // avoid compiler hint |
2428 | 146 |
CursorMovementX:= -1; |
147 |
end; |
|
148 |
||
149 |
procedure chCurL_m(var s: shortstring); |
|
150 |
begin |
|
3407 | 151 |
s:= s; // avoid compiler hint |
2428 | 152 |
CursorMovementX:= 0; |
153 |
end; |
|
154 |
||
155 |
procedure chCurR_p(var s: shortstring); |
|
156 |
begin |
|
3407 | 157 |
s:= s; // avoid compiler hint |
2428 | 158 |
CursorMovementX:= 1; |
159 |
end; |
|
160 |
||
161 |
procedure chCurR_m(var s: shortstring); |
|
162 |
begin |
|
3407 | 163 |
s:= s; // avoid compiler hint |
2428 | 164 |
CursorMovementX:= 0; |
165 |
end; |
|
166 |
||
4 | 167 |
procedure chLeft_p(var s: shortstring); |
168 |
begin |
|
3407 | 169 |
s:= s; // avoid compiler hint |
3776 | 170 |
if CheckNoTeamOrHH or isPaused then exit; |
171 |
if not CurrentTeam^.ExtDriven then SendIPC('L'); |
|
3796 | 172 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
176 | 173 |
bShowFinger:= false; |
602 | 174 |
with CurrentHedgehog^.Gear^ do |
3894 | 175 |
Message:= Message or gmLeft |
4 | 176 |
end; |
177 |
||
178 |
procedure chLeft_m(var s: shortstring); |
|
179 |
begin |
|
3407 | 180 |
s:= s; // avoid compiler hint |
4 | 181 |
if CheckNoTeamOrHH then exit; |
351 | 182 |
if not CurrentTeam^.ExtDriven then SendIPC('l'); |
602 | 183 |
with CurrentHedgehog^.Gear^ do |
3894 | 184 |
Message:= Message and not gmLeft |
4 | 185 |
end; |
186 |
||
187 |
procedure chRight_p(var s: shortstring); |
|
188 |
begin |
|
3407 | 189 |
s:= s; // avoid compiler hint |
3776 | 190 |
if CheckNoTeamOrHH or isPaused then exit; |
191 |
if not CurrentTeam^.ExtDriven then SendIPC('R'); |
|
3796 | 192 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
176 | 193 |
bShowFinger:= false; |
602 | 194 |
with CurrentHedgehog^.Gear^ do |
3894 | 195 |
Message:= Message or gmRight |
4 | 196 |
end; |
197 |
||
198 |
procedure chRight_m(var s: shortstring); |
|
199 |
begin |
|
3407 | 200 |
s:= s; // avoid compiler hint |
4 | 201 |
if CheckNoTeamOrHH then exit; |
351 | 202 |
if not CurrentTeam^.ExtDriven then SendIPC('r'); |
602 | 203 |
with CurrentHedgehog^.Gear^ do |
3894 | 204 |
Message:= Message and not gmRight |
4 | 205 |
end; |
206 |
||
207 |
procedure chUp_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('U'); |
|
3796 | 212 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
176 | 213 |
bShowFinger:= false; |
602 | 214 |
with CurrentHedgehog^.Gear^ do |
3894 | 215 |
Message:= Message or gmUp |
4 | 216 |
end; |
217 |
||
218 |
procedure chUp_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('u'); |
602 | 223 |
with CurrentHedgehog^.Gear^ do |
3894 | 224 |
Message:= Message and not gmUp |
4 | 225 |
end; |
226 |
||
227 |
procedure chDown_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('D'); |
|
3796 | 232 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
176 | 233 |
bShowFinger:= false; |
602 | 234 |
with CurrentHedgehog^.Gear^ do |
3894 | 235 |
Message:= Message or gmDown |
4 | 236 |
end; |
237 |
||
238 |
procedure chDown_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('d'); |
602 | 243 |
with CurrentHedgehog^.Gear^ do |
3894 | 244 |
Message:= Message and not gmDown |
4 | 245 |
end; |
246 |
||
1639 | 247 |
procedure chPrecise_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('Z'); |
|
3796 | 252 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
1639 | 253 |
bShowFinger:= false; |
254 |
with CurrentHedgehog^.Gear^ do |
|
3894 | 255 |
Message:= Message or gmPrecise |
1639 | 256 |
end; |
257 |
||
258 |
procedure chPrecise_m(var s: shortstring); |
|
259 |
begin |
|
3407 | 260 |
s:= s; // avoid compiler hint |
1639 | 261 |
if CheckNoTeamOrHH then exit; |
262 |
if not CurrentTeam^.ExtDriven then SendIPC('z'); |
|
263 |
with CurrentHedgehog^.Gear^ do |
|
3894 | 264 |
Message:= Message and not gmPrecise |
1639 | 265 |
end; |
266 |
||
4 | 267 |
procedure chLJump(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('j'); |
|
3797 | 272 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
176 | 273 |
bShowFinger:= false; |
602 | 274 |
with CurrentHedgehog^.Gear^ do |
3894 | 275 |
Message:= Message or gmLJump |
4 | 276 |
end; |
277 |
||
278 |
procedure chHJump(var s: shortstring); |
|
279 |
begin |
|
3407 | 280 |
s:= s; // avoid compiler hint |
3776 | 281 |
if CheckNoTeamOrHH or isPaused then exit; |
282 |
if not CurrentTeam^.ExtDriven then SendIPC('J'); |
|
3797 | 283 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
176 | 284 |
bShowFinger:= false; |
602 | 285 |
with CurrentHedgehog^.Gear^ do |
3894 | 286 |
Message:= Message or gmHJump |
4 | 287 |
end; |
288 |
||
289 |
procedure chAttack_p(var s: shortstring); |
|
290 |
begin |
|
3407 | 291 |
s:= s; // avoid compiler hint |
3336 | 292 |
if CheckNoTeamOrHH or isPaused then exit; |
3797 | 293 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
176 | 294 |
bShowFinger:= false; |
602 | 295 |
with CurrentHedgehog^.Gear^ do |
2947 | 296 |
begin |
297 |
{$IFDEF DEBUGFILE}AddFileLog('/+attack: hedgehog''s Gear^.State = '+inttostr(State));{$ENDIF} |
|
298 |
if ((State and gstHHDriven) <> 0) then |
|
4 | 299 |
begin |
602 | 300 |
FollowGear:= CurrentHedgehog^.Gear; |
351 | 301 |
if not CurrentTeam^.ExtDriven then SendIPC('A'); |
3894 | 302 |
Message:= Message or gmAttack |
4 | 303 |
end |
2947 | 304 |
end |
4 | 305 |
end; |
306 |
||
307 |
procedure chAttack_m(var s: shortstring); |
|
308 |
begin |
|
3407 | 309 |
s:= s; // avoid compiler hint |
4 | 310 |
if CheckNoTeamOrHH then exit; |
602 | 311 |
with CurrentHedgehog^.Gear^ do |
2947 | 312 |
begin |
313 |
if not CurrentTeam^.ExtDriven and |
|
3894 | 314 |
((Message and gmAttack) <> 0) then SendIPC('a'); |
315 |
Message:= Message and not gmAttack |
|
2947 | 316 |
end |
4 | 317 |
end; |
318 |
||
319 |
procedure chSwitch(var s: shortstring); |
|
320 |
begin |
|
3407 | 321 |
s:= s; // avoid compiler hint |
3776 | 322 |
if CheckNoTeamOrHH or isPaused then exit; |
351 | 323 |
if not CurrentTeam^.ExtDriven then SendIPC('S'); |
3796 | 324 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
3776 | 325 |
bShowFinger:= false; |
602 | 326 |
with CurrentHedgehog^.Gear^ do |
3894 | 327 |
Message:= Message or gmSwitch |
4 | 328 |
end; |
329 |
||
330 |
procedure chNextTurn(var s: shortstring); |
|
331 |
begin |
|
3639
b5cdbcc89b61
use a button instead of label and simplify a lot touch interaction
koda
parents:
3638
diff
changeset
|
332 |
s:= s; // avoid compiler hint |
b5cdbcc89b61
use a button instead of label and simplify a lot touch interaction
koda
parents:
3638
diff
changeset
|
333 |
TryDo(AllInactive, '/nextturn called when not all gears are inactive', true); |
2046 | 334 |
|
3639
b5cdbcc89b61
use a button instead of label and simplify a lot touch interaction
koda
parents:
3638
diff
changeset
|
335 |
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
|
336 |
{$IFDEF DEBUGFILE} |
b5cdbcc89b61
use a button instead of label and simplify a lot touch interaction
koda
parents:
3638
diff
changeset
|
337 |
AddFileLog('Doing SwitchHedgehog: time '+inttostr(GameTicks)); |
b5cdbcc89b61
use a button instead of label and simplify a lot touch interaction
koda
parents:
3638
diff
changeset
|
338 |
{$ENDIF} |
3935 | 339 |
perfExt_NewTurnBeginning(); |
4 | 340 |
end; |
341 |
||
342 |
procedure chSay(var s: shortstring); |
|
343 |
begin |
|
1356 | 344 |
SendIPC('s' + s); |
1378 | 345 |
|
346 |
if copy(s, 1, 4) = '/me ' then |
|
2947 | 347 |
s:= #2'* ' + UserNick + ' ' + copy(s, 5, Length(s) - 4) |
1378 | 348 |
else |
2947 | 349 |
s:= #1 + UserNick + ': ' + s; |
1378 | 350 |
|
1356 | 351 |
AddChatString(s) |
4 | 352 |
end; |
353 |
||
2124 | 354 |
procedure chTeamSay(var s: shortstring); |
355 |
begin |
|
356 |
SendIPC('b' + s); |
|
357 |
||
2962 | 358 |
s:= #4 + '[Team] ' + UserNick + ': ' + s; |
2124 | 359 |
|
2396 | 360 |
AddChatString(s) |
2124 | 361 |
end; |
362 |
||
4 | 363 |
procedure chTimer(var s: shortstring); |
364 |
begin |
|
2314 | 365 |
if (s[0] <> #1) or (s[1] < '1') or (s[1] > '5') or CheckNoTeamOrHH then exit; |
366 |
||
926
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
917
diff
changeset
|
367 |
if not CurrentTeam^.ExtDriven then SendIPC(s); |
3796 | 368 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
3776 | 369 |
bShowFinger:= false; |
926
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
917
diff
changeset
|
370 |
with CurrentHedgehog^.Gear^ do |
2947 | 371 |
begin |
3894 | 372 |
Message:= Message or gmTimer; |
2947 | 373 |
MsgParam:= byte(s[1]) - ord('0') |
374 |
end |
|
4 | 375 |
end; |
376 |
||
377 |
procedure chSlot(var s: shortstring); |
|
378 |
var slot: LongWord; |
|
379 |
begin |
|
95 | 380 |
if (s[0] <> #1) or CheckNoTeamOrHH then exit; |
4 | 381 |
slot:= byte(s[1]) - 49; |
10 | 382 |
if slot > cMaxSlotIndex then exit; |
351 | 383 |
if not CurrentTeam^.ExtDriven then SendIPC(char(byte(s[1]) + 79)); |
3796 | 384 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
3776 | 385 |
bShowFinger:= false; |
783 | 386 |
with CurrentHedgehog^.Gear^ do |
2947 | 387 |
begin |
3894 | 388 |
Message:= Message or gmSlot; |
2947 | 389 |
MsgParam:= slot |
390 |
end |
|
783 | 391 |
end; |
392 |
||
393 |
procedure chSetWeapon(var s: shortstring); |
|
394 |
begin |
|
3637
0db298524c3d
implement the check on the type of ammo requiring a second tap to confirm
koda
parents:
3611
diff
changeset
|
395 |
if (s[0] <> #1) or CheckNoTeamOrHH then exit; |
784 | 396 |
|
3637
0db298524c3d
implement the check on the type of ammo requiring a second tap to confirm
koda
parents:
3611
diff
changeset
|
397 |
if TAmmoType(s[1]) > High(TAmmoType) then exit; |
784 | 398 |
|
3637
0db298524c3d
implement the check on the type of ammo requiring a second tap to confirm
koda
parents:
3611
diff
changeset
|
399 |
if not CurrentTeam^.ExtDriven then SendIPC('w' + s); |
784 | 400 |
|
3637
0db298524c3d
implement the check on the type of ammo requiring a second tap to confirm
koda
parents:
3611
diff
changeset
|
401 |
with CurrentHedgehog^.Gear^ do |
2947 | 402 |
begin |
3894 | 403 |
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
|
404 |
MsgParam:= byte(s[1]); |
0db298524c3d
implement the check on the type of ammo requiring a second tap to confirm
koda
parents:
3611
diff
changeset
|
405 |
end; |
4 | 406 |
end; |
407 |
||
1035 | 408 |
procedure chTaunt(var s: shortstring); |
409 |
begin |
|
410 |
if (s[0] <> #1) or CheckNoTeamOrHH then exit; |
|
411 |
||
412 |
if TWave(s[1]) > High(TWave) then exit; |
|
413 |
||
414 |
if not CurrentTeam^.ExtDriven then SendIPC('t' + s); |
|
415 |
||
416 |
with CurrentHedgehog^.Gear^ do |
|
2947 | 417 |
begin |
3894 | 418 |
Message:= Message or gmAnimate; |
2947 | 419 |
MsgParam:= byte(s[1]) |
420 |
end |
|
1035 | 421 |
end; |
422 |
||
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
423 |
procedure doPut(putX, putY: LongInt; fromAI: boolean); |
4 | 424 |
begin |
3776 | 425 |
if CheckNoTeamOrHH or isPaused then exit; |
3796 | 426 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
3776 | 427 |
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
|
428 |
if not CurrentTeam^.ExtDriven and bShowAmmoMenu then |
2947 | 429 |
begin |
430 |
bSelected:= true; |
|
431 |
exit |
|
432 |
end; |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
433 |
|
602 | 434 |
with CurrentHedgehog^.Gear^, |
2947 | 435 |
CurrentHedgehog^ do |
436 |
if (State and gstHHChooseTarget) <> 0 then |
|
437 |
begin |
|
438 |
isCursorVisible:= false; |
|
439 |
if not CurrentTeam^.ExtDriven then |
|
440 |
begin |
|
441 |
if fromAI then |
|
442 |
begin |
|
443 |
TargetPoint.X:= putX; |
|
444 |
TargetPoint.Y:= putY |
|
445 |
end else |
|
446 |
begin |
|
447 |
TargetPoint.X:= CursorPoint.X - WorldDx; |
|
448 |
TargetPoint.Y:= cScreenHeight - CursorPoint.Y - WorldDy; |
|
449 |
end; |
|
450 |
SendIPCXY('p', TargetPoint.X, TargetPoint.Y); |
|
451 |
end |
|
452 |
else |
|
453 |
begin |
|
454 |
TargetPoint.X:= putX; |
|
455 |
TargetPoint.Y:= putY |
|
456 |
end; |
|
457 |
{$IFDEF DEBUGFILE}AddFilelog('put: ' + inttostr(TargetPoint.X) + ', ' + inttostr(TargetPoint.Y));{$ENDIF} |
|
458 |
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
|
459 |
if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackingPut) <> 0 then |
3894 | 460 |
Message:= Message or gmAttack; |
2947 | 461 |
end |
462 |
else |
|
463 |
if CurrentTeam^.ExtDriven then |
|
464 |
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
|
465 |
end; |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
466 |
|
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
467 |
procedure chPut(var s: shortstring); |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
468 |
begin |
3638
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3637
diff
changeset
|
469 |
s:= s; // avoid compiler hint |
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3637
diff
changeset
|
470 |
doPut(0, 0, false); |
4 | 471 |
end; |
472 |
||
473 |
procedure chCapture(var s: shortstring); |
|
474 |
begin |
|
3407 | 475 |
s:= s; // avoid compiler hint |
4 | 476 |
flagMakeCapture:= true |
477 |
end; |
|
478 |
||
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
479 |
procedure chSetMap(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
480 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
481 |
if isDeveloperMode then |
2947 | 482 |
begin |
483 |
Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s; |
|
484 |
InitStepsFlags:= InitStepsFlags or cifMap |
|
485 |
end |
|
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
486 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
487 |
|
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
488 |
procedure chSetTheme(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
489 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
490 |
if isDeveloperMode then |
2947 | 491 |
begin |
492 |
Pathz[ptCurrTheme]:= Pathz[ptThemes] + '/' + s; |
|
493 |
InitStepsFlags:= InitStepsFlags or cifTheme |
|
494 |
end |
|
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
495 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
496 |
|
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
497 |
procedure chSetSeed(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
498 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
499 |
if isDeveloperMode then |
2947 | 500 |
begin |
501 |
SetRandomSeed(s); |
|
502 |
cSeed:= s; |
|
503 |
InitStepsFlags:= InitStepsFlags or cifRandomize |
|
504 |
end |
|
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
505 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
506 |
|
161 | 507 |
procedure chAmmoMenu(var s: shortstring); |
508 |
begin |
|
3407 | 509 |
s:= s; // avoid compiler hint |
3797 | 510 |
if CheckNoTeamOrHH then |
511 |
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
|
512 |
else |
3797 | 513 |
begin |
514 |
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
|
515 |
with Hedgehogs[CurrHedgehog] do |
2947 | 516 |
begin |
517 |
bSelected:= false; |
|
682 | 518 |
|
2947 | 519 |
if bShowAmmoMenu then bShowAmmoMenu:= false |
3396
e5b3e5f2818e
More portal changes. Allows for a multishoot utility. Hopefully not breaking anything.
nemo
parents:
3395
diff
changeset
|
520 |
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
|
521 |
((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
|
522 |
((Gear^.State and gstHHDriven) = 0) then else bShowAmmoMenu:= true |
3797 | 523 |
end; |
524 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1 |
|
525 |
end |
|
161 | 526 |
end; |
527 |
||
175 | 528 |
procedure chVol_p(var s: shortstring); |
174 | 529 |
begin |
3407 | 530 |
s:= s; // avoid compiler hint |
175 | 531 |
inc(cVolumeDelta, 3) |
174 | 532 |
end; |
533 |
||
175 | 534 |
procedure chVol_m(var s: shortstring); |
174 | 535 |
begin |
3407 | 536 |
s:= s; // avoid compiler hint |
175 | 537 |
dec(cVolumeDelta, 3) |
174 | 538 |
end; |
539 |
||
176 | 540 |
procedure chFindhh(var s: shortstring); |
541 |
begin |
|
3407 | 542 |
s:= s; // avoid compiler hint |
3336 | 543 |
if CheckNoTeamOrHH or isPaused then exit; |
176 | 544 |
bShowFinger:= true; |
602 | 545 |
FollowGear:= CurrentHedgehog^.Gear |
176 | 546 |
end; |
547 |
||
281
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
548 |
procedure chPause(var s: shortstring); |
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
549 |
begin |
3407 | 550 |
s:= s; // avoid compiler hint |
3796 | 551 |
if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
1743 | 552 |
if gameType <> gmtNet then |
2947 | 553 |
isPaused:= not isPaused; |
281
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
554 |
SDL_ShowCursor(ord(isPaused)) |
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
555 |
end; |
539
6a9bf1852bbc
Ability to choose which info is shown above hedgehogs
unc0rr
parents:
534
diff
changeset
|
556 |
|
6a9bf1852bbc
Ability to choose which info is shown above hedgehogs
unc0rr
parents:
534
diff
changeset
|
557 |
procedure chRotateMask(var s: shortstring); |
6a9bf1852bbc
Ability to choose which info is shown above hedgehogs
unc0rr
parents:
534
diff
changeset
|
558 |
begin |
3407 | 559 |
s:= s; // avoid compiler hint |
2947 | 560 |
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
|
561 |
end; |
6a9bf1852bbc
Ability to choose which info is shown above hedgehogs
unc0rr
parents:
534
diff
changeset
|
562 |
|
626 | 563 |
procedure chSpeedup_p(var s: shortstring); |
564 |
begin |
|
3407 | 565 |
s:= s; // avoid compiler hint |
626 | 566 |
isSpeed:= true |
567 |
end; |
|
568 |
||
569 |
procedure chSpeedup_m(var s: shortstring); |
|
570 |
begin |
|
3407 | 571 |
s:= s; // avoid compiler hint |
626 | 572 |
isSpeed:= false |
573 |
end; |
|
946 | 574 |
|
2162 | 575 |
procedure chZoomIn(var s: shortstring); |
576 |
begin |
|
3523 | 577 |
s:= s; // avoid compiler hint |
3638
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3637
diff
changeset
|
578 |
if ZoomValue < cMinZoomLevel then |
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3637
diff
changeset
|
579 |
ZoomValue:= ZoomValue + cZoomDelta; |
2162 | 580 |
end; |
581 |
||
582 |
procedure chZoomOut(var s: shortstring); |
|
583 |
begin |
|
3523 | 584 |
s:= s; // avoid compiler hint |
3638
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3637
diff
changeset
|
585 |
if ZoomValue > cMaxZoomLevel then |
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3637
diff
changeset
|
586 |
ZoomValue:= ZoomValue - cZoomDelta; |
2162 | 587 |
end; |
588 |
||
2379 | 589 |
procedure chZoomReset(var s: shortstring); |
590 |
begin |
|
3523 | 591 |
s:= s; // avoid compiler hint |
592 |
ZoomValue:= cDefaultZoomLevel; |
|
2379 | 593 |
end; |
594 |
||
946 | 595 |
procedure chChat(var s: shortstring); |
596 |
begin |
|
3680 | 597 |
s:= s; // avoid compiler hint |
598 |
GameState:= gsChat; |
|
599 |
KeyPressChat(27) |
|
946 | 600 |
end; |
991 | 601 |
|
602 |
procedure chHistory(var s: shortstring); |
|
603 |
begin |
|
3680 | 604 |
s:= s; // avoid compiler hint |
605 |
uChat.showAll:= not uChat.showAll |
|
991 | 606 |
end; |
4389 | 607 |