author | koda |
Mon, 19 Apr 2010 15:30:11 +0000 | |
changeset 3360 | 717b4e46e855 |
parent 3346 | 967fd96f7373 |
child 3395 | 095273ad0e08 |
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 |
function CheckNoTeamOrHH: boolean; |
|
2695 | 20 |
var bRes: boolean; |
4 | 21 |
begin |
2695 | 22 |
bRes:= (CurrentTeam = nil) or (CurrentHedgehog^.Gear = nil); |
4 | 23 |
{$IFDEF DEBUGFILE} |
2695 | 24 |
if bRes then |
2947 | 25 |
if CurrentTeam = nil then AddFileLog('CONSOLE: CurTeam = nil') |
351 | 26 |
else AddFileLog('CONSOLE: CurTeam <> nil, Gear = nil'); |
4 | 27 |
{$ENDIF} |
2695 | 28 |
CheckNoTeamOrHH:= bRes; |
4 | 29 |
end; |
30 |
//////////////////////////////////////////////////////////////////////////////// |
|
31 |
procedure chQuit(var s: shortstring); |
|
1022 | 32 |
const prevGState: TGameState = gsConfirm; |
4 | 33 |
begin |
1022 | 34 |
if GameState <> gsConfirm then |
35 |
begin |
|
36 |
prevGState:= GameState; |
|
37 |
GameState:= gsConfirm |
|
38 |
end else |
|
39 |
GameState:= prevGState |
|
40 |
end; |
|
41 |
||
42 |
procedure chConfirm(var s: shortstring); |
|
43 |
begin |
|
44 |
if GameState = gsConfirm then |
|
2947 | 45 |
begin |
46 |
SendIPC('Q'); |
|
47 |
GameState:= gsExit |
|
48 |
end |
|
2130
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
49 |
else |
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
50 |
begin |
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
51 |
GameState:= gsChat; |
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
52 |
KeyPressChat(27); |
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
53 |
KeyPressChat(47); |
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
54 |
KeyPressChat(116); |
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
55 |
KeyPressChat(101); |
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
56 |
KeyPressChat(97); |
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
57 |
KeyPressChat(109); |
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
58 |
KeyPressChat(32) |
708758635955
Please don't take away my checkin privileges - Tiy asked me to keep working on this
nemo
parents:
2125
diff
changeset
|
59 |
end |
4 | 60 |
end; |
61 |
||
205 | 62 |
procedure chCheckProto(var s: shortstring); |
371 | 63 |
var i, c: LongInt; |
205 | 64 |
begin |
65 |
if isDeveloperMode then |
|
2947 | 66 |
begin |
67 |
val(s, i, c); |
|
68 |
if (c <> 0) or (i = 0) then exit; |
|
69 |
TryDo(i <= cNetProtoVersion, 'Protocol version mismatch: engine is too old', true); |
|
70 |
TryDo(i >= cNetProtoVersion, 'Protocol version mismatch: engine is too new', true) |
|
71 |
end |
|
205 | 72 |
end; |
73 |
||
4 | 74 |
procedure chAddTeam(var s: shortstring); |
549 | 75 |
var Color: Longword; |
2874
3c7c2bf1ba38
A simple hat reservation mechanism. Can be worked around with a little effort, but to make it useful, you'd have to get everyone you played with to work around it too. Quite a bit of effort for a small reward feature.
nemo
parents:
2855
diff
changeset
|
76 |
ts, cs: shortstring; |
4 | 77 |
begin |
145 | 78 |
if isDeveloperMode then |
2947 | 79 |
begin |
80 |
SplitBySpace(s, cs); |
|
81 |
SplitBySpace(cs, ts); |
|
82 |
val(cs, Color); |
|
83 |
TryDo(Color <> 0, 'Error: black team color', true); |
|
351 | 84 |
|
2947 | 85 |
// color is always little endian so the mask must be constant also in big endian archs |
86 |
Color:= Color or $FF000000; |
|
87 |
||
88 |
AddTeam(Color); |
|
89 |
CurrentTeam^.TeamName:= ts; |
|
90 |
CurrentTeam^.PlayerHash:= s; |
|
91 |
if GameType in [gmtDemo, gmtSave] then CurrentTeam^.ExtDriven:= true; |
|
1654 | 92 |
|
2947 | 93 |
CurrentTeam^.voicepack:= AskForVoicepack('Default') |
94 |
end |
|
4 | 95 |
end; |
96 |
||
97 |
procedure chTeamLocal(var s: shortstring); |
|
98 |
begin |
|
99 |
if not isDeveloperMode then exit; |
|
100 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/rdriven"', true); |
|
351 | 101 |
CurrentTeam^.ExtDriven:= true |
4 | 102 |
end; |
103 |
||
104 |
procedure chGrave(var s: shortstring); |
|
105 |
begin |
|
106 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/grave"', true); |
|
107 |
if s[1]='"' then Delete(s, 1, 1); |
|
108 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
351 | 109 |
CurrentTeam^.GraveName:= s |
4 | 110 |
end; |
111 |
||
112 |
procedure chFort(var s: shortstring); |
|
113 |
begin |
|
764
7513452b1d51
Now game looks almost like it did before switching to OpenGL
unc0rr
parents:
753
diff
changeset
|
114 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/fort"', true); |
4 | 115 |
if s[1]='"' then Delete(s, 1, 1); |
116 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
351 | 117 |
CurrentTeam^.FortName:= s |
4 | 118 |
end; |
119 |
||
1654 | 120 |
procedure chVoicepack(var s: shortstring); |
121 |
begin |
|
122 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/voicepack"', true); |
|
123 |
if s[1]='"' then Delete(s, 1, 1); |
|
124 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
125 |
CurrentTeam^.voicepack:= AskForVoicepack(s) |
|
126 |
end; |
|
127 |
||
2747 | 128 |
procedure chFlag(var s: shortstring); |
129 |
begin |
|
130 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/flag"', true); |
|
131 |
if s[1]='"' then Delete(s, 1, 1); |
|
132 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
133 |
CurrentTeam^.flag:= s |
|
134 |
end; |
|
135 |
||
2786 | 136 |
procedure chScript(var s: shortstring); |
137 |
begin |
|
138 |
if s[1]='"' then Delete(s, 1, 1); |
|
139 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
140 |
ScriptLoad(s) |
|
141 |
end; |
|
142 |
||
312 | 143 |
procedure chAddHH(var id: shortstring); |
4 | 144 |
var s: shortstring; |
145 |
Gear: PGear; |
|
146 |
begin |
|
394
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
147 |
if (not isDeveloperMode) or (CurrentTeam = nil) then exit; |
312 | 148 |
with CurrentTeam^ do |
2947 | 149 |
begin |
150 |
SplitBySpace(id, s); |
|
151 |
CurrentHedgehog:= @Hedgehogs[HedgehogsNumber]; |
|
152 |
val(id, CurrentHedgehog^.BotLevel); |
|
153 |
Gear:= AddGear(0, 0, gtHedgehog, 0, _0, _0, 0); |
|
154 |
SplitBySpace(s, id); |
|
155 |
val(s, Gear^.Health); |
|
156 |
TryDo(Gear^.Health > 0, 'Invalid hedgehog health', true); |
|
157 |
PHedgehog(Gear^.Hedgehog)^.Team:= CurrentTeam; |
|
2881 | 158 |
if (GameFlags and gfSharedAmmo) <> 0 then CurrentHedgehog^.AmmoStore:= Clan^.ClanIndex |
159 |
else CurrentHedgehog^.AmmoStore:= TeamsCount - 1; |
|
2947 | 160 |
CurrentHedgehog^.Gear:= Gear; |
161 |
CurrentHedgehog^.Name:= id; |
|
2808
8f48b538d591
Need this too to set it to last hog for current switch alg
nemo
parents:
2800
diff
changeset
|
162 |
CurrHedgehog:= HedgehogsNumber; |
2947 | 163 |
inc(HedgehogsNumber) |
164 |
end |
|
1242 | 165 |
end; |
166 |
||
167 |
procedure chSetHat(var s: shortstring); |
|
168 |
begin |
|
169 |
if (not isDeveloperMode) or (CurrentTeam = nil) then exit; |
|
170 |
with CurrentTeam^ do |
|
2726 | 171 |
begin |
172 |
if not CurrentHedgehog^.King then |
|
2947 | 173 |
if (s = '') or |
174 |
(((GameFlags and gfKing) <> 0) and (s = 'crown')) or |
|
175 |
((Length(s) > 39) and (Copy(s,1,8) = 'Reserved') and (Copy(s,9,32) <> PlayerHash)) then |
|
176 |
CurrentHedgehog^.Hat:= 'NoHat' |
|
177 |
else |
|
178 |
CurrentHedgehog^.Hat:= s |
|
2726 | 179 |
end; |
4 | 180 |
end; |
181 |
||
604
2f1165467a66
Let hedgehog position be taken from config, still more work is needed
unc0rr
parents:
602
diff
changeset
|
182 |
procedure chSetHHCoords(var x: shortstring); |
2f1165467a66
Let hedgehog position be taken from config, still more work is needed
unc0rr
parents:
602
diff
changeset
|
183 |
var y: shortstring; |
2f1165467a66
Let hedgehog position be taken from config, still more work is needed
unc0rr
parents:
602
diff
changeset
|
184 |
t: Longint; |
2f1165467a66
Let hedgehog position be taken from config, still more work is needed
unc0rr
parents:
602
diff
changeset
|
185 |
begin |
2f1165467a66
Let hedgehog position be taken from config, still more work is needed
unc0rr
parents:
602
diff
changeset
|
186 |
if (not isDeveloperMode) or (CurrentHedgehog = nil) or (CurrentHedgehog^.Gear = nil) then exit; |
2f1165467a66
Let hedgehog position be taken from config, still more work is needed
unc0rr
parents:
602
diff
changeset
|
187 |
SplitBySpace(x, y); |
2f1165467a66
Let hedgehog position be taken from config, still more work is needed
unc0rr
parents:
602
diff
changeset
|
188 |
val(x, t); |
2f1165467a66
Let hedgehog position be taken from config, still more work is needed
unc0rr
parents:
602
diff
changeset
|
189 |
CurrentHedgehog^.Gear^.X:= int2hwFloat(t); |
2f1165467a66
Let hedgehog position be taken from config, still more work is needed
unc0rr
parents:
602
diff
changeset
|
190 |
val(y, t); |
2f1165467a66
Let hedgehog position be taken from config, still more work is needed
unc0rr
parents:
602
diff
changeset
|
191 |
CurrentHedgehog^.Gear^.Y:= int2hwFloat(t) |
2f1165467a66
Let hedgehog position be taken from config, still more work is needed
unc0rr
parents:
602
diff
changeset
|
192 |
end; |
2f1165467a66
Let hedgehog position be taken from config, still more work is needed
unc0rr
parents:
602
diff
changeset
|
193 |
|
3346 | 194 |
procedure chSetAmmoLoadout(var descr: shortstring); |
195 |
begin |
|
196 |
SetAmmoLoadout(descr) |
|
197 |
end; |
|
198 |
||
199 |
procedure chSetAmmoDelay(var descr: shortstring); |
|
200 |
begin |
|
201 |
SetAmmoDelay(descr) |
|
202 |
end; |
|
203 |
||
204 |
procedure chSetAmmoProbability(var descr: shortstring); |
|
205 |
begin |
|
206 |
SetAmmoProbability(descr) |
|
207 |
end; |
|
208 |
||
209 |
procedure chSetAmmoReinforcement(var descr: shortstring); |
|
210 |
begin |
|
211 |
SetAmmoReinforcement(descr) |
|
212 |
end; |
|
213 |
||
288 | 214 |
procedure chAddAmmoStore(var descr: shortstring); |
215 |
begin |
|
3346 | 216 |
AddAmmoStore |
288 | 217 |
end; |
218 |
||
4 | 219 |
procedure chBind(var id: shortstring); |
220 |
var s: shortstring; |
|
371 | 221 |
b: LongInt; |
4 | 222 |
begin |
223 |
if CurrentTeam = nil then exit; |
|
224 |
SplitBySpace(id, s); |
|
225 |
if s[1]='"' then Delete(s, 1, 1); |
|
226 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
227 |
b:= KeyNameToCode(id); |
|
351 | 228 |
if b = 0 then OutError(errmsgUnknownVariable + ' "' + id + '"', false) |
2947 | 229 |
else CurrentTeam^.Binds[b]:= s |
4 | 230 |
end; |
231 |
||
2428 | 232 |
procedure chCurU_p(var s: shortstring); |
233 |
begin |
|
234 |
CursorMovementY:= -1; |
|
235 |
end; |
|
236 |
||
237 |
procedure chCurU_m(var s: shortstring); |
|
238 |
begin |
|
239 |
CursorMovementY:= 0; |
|
240 |
end; |
|
241 |
||
242 |
procedure chCurD_p(var s: shortstring); |
|
243 |
begin |
|
244 |
CursorMovementY:= 1; |
|
245 |
end; |
|
246 |
||
247 |
procedure chCurD_m(var s: shortstring); |
|
248 |
begin |
|
249 |
CursorMovementY:= 0; |
|
250 |
end; |
|
251 |
||
252 |
procedure chCurL_p(var s: shortstring); |
|
253 |
begin |
|
254 |
CursorMovementX:= -1; |
|
255 |
end; |
|
256 |
||
257 |
procedure chCurL_m(var s: shortstring); |
|
258 |
begin |
|
259 |
CursorMovementX:= 0; |
|
260 |
end; |
|
261 |
||
262 |
procedure chCurR_p(var s: shortstring); |
|
263 |
begin |
|
264 |
CursorMovementX:= 1; |
|
265 |
end; |
|
266 |
||
267 |
procedure chCurR_m(var s: shortstring); |
|
268 |
begin |
|
269 |
CursorMovementX:= 0; |
|
270 |
end; |
|
271 |
||
4 | 272 |
procedure chLeft_p(var s: shortstring); |
273 |
begin |
|
3336 | 274 |
if CheckNoTeamOrHH or isPaused then exit; |
176 | 275 |
bShowFinger:= false; |
351 | 276 |
if not CurrentTeam^.ExtDriven then SendIPC('L'); |
602 | 277 |
with CurrentHedgehog^.Gear^ do |
4 | 278 |
Message:= Message or gm_Left |
279 |
end; |
|
280 |
||
281 |
procedure chLeft_m(var s: shortstring); |
|
282 |
begin |
|
283 |
if CheckNoTeamOrHH then exit; |
|
351 | 284 |
if not CurrentTeam^.ExtDriven then SendIPC('l'); |
602 | 285 |
with CurrentHedgehog^.Gear^ do |
2947 | 286 |
Message:= Message and not gm_Left |
4 | 287 |
end; |
288 |
||
289 |
procedure chRight_p(var s: shortstring); |
|
290 |
begin |
|
3336 | 291 |
if CheckNoTeamOrHH or isPaused then exit; |
176 | 292 |
bShowFinger:= false; |
351 | 293 |
if not CurrentTeam^.ExtDriven then SendIPC('R'); |
602 | 294 |
with CurrentHedgehog^.Gear^ do |
4 | 295 |
Message:= Message or gm_Right |
296 |
end; |
|
297 |
||
298 |
procedure chRight_m(var s: shortstring); |
|
299 |
begin |
|
300 |
if CheckNoTeamOrHH then exit; |
|
351 | 301 |
if not CurrentTeam^.ExtDriven then SendIPC('r'); |
602 | 302 |
with CurrentHedgehog^.Gear^ do |
2947 | 303 |
Message:= Message and not gm_Right |
4 | 304 |
end; |
305 |
||
306 |
procedure chUp_p(var s: shortstring); |
|
307 |
begin |
|
3336 | 308 |
if CheckNoTeamOrHH or isPaused then exit; |
176 | 309 |
bShowFinger:= false; |
351 | 310 |
if not CurrentTeam^.ExtDriven then SendIPC('U'); |
602 | 311 |
with CurrentHedgehog^.Gear^ do |
4 | 312 |
Message:= Message or gm_Up |
313 |
end; |
|
314 |
||
315 |
procedure chUp_m(var s: shortstring); |
|
316 |
begin |
|
317 |
if CheckNoTeamOrHH then exit; |
|
351 | 318 |
if not CurrentTeam^.ExtDriven then SendIPC('u'); |
602 | 319 |
with CurrentHedgehog^.Gear^ do |
2947 | 320 |
Message:= Message and not gm_Up |
4 | 321 |
end; |
322 |
||
323 |
procedure chDown_p(var s: shortstring); |
|
324 |
begin |
|
3336 | 325 |
if CheckNoTeamOrHH or isPaused then exit; |
176 | 326 |
bShowFinger:= false; |
351 | 327 |
if not CurrentTeam^.ExtDriven then SendIPC('D'); |
602 | 328 |
with CurrentHedgehog^.Gear^ do |
4 | 329 |
Message:= Message or gm_Down |
330 |
end; |
|
331 |
||
332 |
procedure chDown_m(var s: shortstring); |
|
333 |
begin |
|
334 |
if CheckNoTeamOrHH then exit; |
|
351 | 335 |
if not CurrentTeam^.ExtDriven then SendIPC('d'); |
602 | 336 |
with CurrentHedgehog^.Gear^ do |
2947 | 337 |
Message:= Message and not gm_Down |
4 | 338 |
end; |
339 |
||
1639 | 340 |
procedure chPrecise_p(var s: shortstring); |
341 |
begin |
|
3336 | 342 |
if CheckNoTeamOrHH or isPaused then exit; |
1639 | 343 |
bShowFinger:= false; |
344 |
if not CurrentTeam^.ExtDriven then SendIPC('Z'); |
|
345 |
with CurrentHedgehog^.Gear^ do |
|
346 |
Message:= Message or gm_Precise |
|
347 |
end; |
|
348 |
||
349 |
procedure chPrecise_m(var s: shortstring); |
|
350 |
begin |
|
351 |
if CheckNoTeamOrHH then exit; |
|
352 |
if not CurrentTeam^.ExtDriven then SendIPC('z'); |
|
353 |
with CurrentHedgehog^.Gear^ do |
|
2947 | 354 |
Message:= Message and not gm_Precise |
1639 | 355 |
end; |
356 |
||
4 | 357 |
procedure chLJump(var s: shortstring); |
358 |
begin |
|
3336 | 359 |
if CheckNoTeamOrHH or isPaused then exit; |
176 | 360 |
bShowFinger:= false; |
351 | 361 |
if not CurrentTeam^.ExtDriven then SendIPC('j'); |
602 | 362 |
with CurrentHedgehog^.Gear^ do |
4 | 363 |
Message:= Message or gm_LJump |
364 |
end; |
|
365 |
||
366 |
procedure chHJump(var s: shortstring); |
|
367 |
begin |
|
3336 | 368 |
if CheckNoTeamOrHH or isPaused then exit; |
176 | 369 |
bShowFinger:= false; |
351 | 370 |
if not CurrentTeam^.ExtDriven then SendIPC('J'); |
602 | 371 |
with CurrentHedgehog^.Gear^ do |
4 | 372 |
Message:= Message or gm_HJump |
373 |
end; |
|
374 |
||
375 |
procedure chAttack_p(var s: shortstring); |
|
376 |
begin |
|
3336 | 377 |
if CheckNoTeamOrHH or isPaused then exit; |
176 | 378 |
bShowFinger:= false; |
602 | 379 |
with CurrentHedgehog^.Gear^ do |
2947 | 380 |
begin |
381 |
{$IFDEF DEBUGFILE}AddFileLog('/+attack: hedgehog''s Gear^.State = '+inttostr(State));{$ENDIF} |
|
382 |
if ((State and gstHHDriven) <> 0) then |
|
4 | 383 |
begin |
602 | 384 |
FollowGear:= CurrentHedgehog^.Gear; |
351 | 385 |
if not CurrentTeam^.ExtDriven then SendIPC('A'); |
4 | 386 |
Message:= Message or gm_Attack |
387 |
end |
|
2947 | 388 |
end |
4 | 389 |
end; |
390 |
||
391 |
procedure chAttack_m(var s: shortstring); |
|
392 |
begin |
|
393 |
if CheckNoTeamOrHH then exit; |
|
602 | 394 |
with CurrentHedgehog^.Gear^ do |
2947 | 395 |
begin |
396 |
if not CurrentTeam^.ExtDriven and |
|
95 | 397 |
((Message and gm_Attack) <> 0) then SendIPC('a'); |
2947 | 398 |
Message:= Message and not gm_Attack |
399 |
end |
|
4 | 400 |
end; |
401 |
||
402 |
procedure chSwitch(var s: shortstring); |
|
403 |
begin |
|
3336 | 404 |
if CheckNoTeamOrHH or isPaused then exit; |
351 | 405 |
if not CurrentTeam^.ExtDriven then SendIPC('S'); |
602 | 406 |
with CurrentHedgehog^.Gear^ do |
2947 | 407 |
Message:= Message or gm_Switch |
4 | 408 |
end; |
409 |
||
410 |
procedure chNextTurn(var s: shortstring); |
|
411 |
begin |
|
2045
b0588498bc3a
- Fix network (my crappy fault, triggered by nemo's patch)
unc0rr
parents:
2042
diff
changeset
|
412 |
TryDo(AllInactive, '/nextturn called when not all gears are inactive', true); |
2046 | 413 |
|
2045
b0588498bc3a
- Fix network (my crappy fault, triggered by nemo's patch)
unc0rr
parents:
2042
diff
changeset
|
414 |
if not CurrentTeam^.ExtDriven then SendIPC('N'); |
b0588498bc3a
- Fix network (my crappy fault, triggered by nemo's patch)
unc0rr
parents:
2042
diff
changeset
|
415 |
{$IFDEF DEBUGFILE}AddFileLog('Doing SwitchHedgehog: time '+inttostr(GameTicks));{$ENDIF} |
4 | 416 |
end; |
417 |
||
418 |
procedure chSay(var s: shortstring); |
|
419 |
begin |
|
1356 | 420 |
SendIPC('s' + s); |
1378 | 421 |
|
422 |
if copy(s, 1, 4) = '/me ' then |
|
2947 | 423 |
s:= #2'* ' + UserNick + ' ' + copy(s, 5, Length(s) - 4) |
1378 | 424 |
else |
2947 | 425 |
s:= #1 + UserNick + ': ' + s; |
1378 | 426 |
|
1356 | 427 |
AddChatString(s) |
4 | 428 |
end; |
429 |
||
2124 | 430 |
procedure chTeamSay(var s: shortstring); |
431 |
begin |
|
432 |
SendIPC('b' + s); |
|
433 |
||
2962 | 434 |
s:= #4 + '[Team] ' + UserNick + ': ' + s; |
2124 | 435 |
|
2396 | 436 |
AddChatString(s) |
2124 | 437 |
end; |
438 |
||
4 | 439 |
procedure chTimer(var s: shortstring); |
440 |
begin |
|
2314 | 441 |
if (s[0] <> #1) or (s[1] < '1') or (s[1] > '5') or CheckNoTeamOrHH then exit; |
176 | 442 |
bShowFinger:= false; |
2314 | 443 |
|
926
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
917
diff
changeset
|
444 |
if not CurrentTeam^.ExtDriven then SendIPC(s); |
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
917
diff
changeset
|
445 |
with CurrentHedgehog^.Gear^ do |
2947 | 446 |
begin |
447 |
Message:= Message or gm_Timer; |
|
448 |
MsgParam:= byte(s[1]) - ord('0') |
|
449 |
end |
|
4 | 450 |
end; |
451 |
||
452 |
procedure chSlot(var s: shortstring); |
|
453 |
var slot: LongWord; |
|
454 |
begin |
|
95 | 455 |
if (s[0] <> #1) or CheckNoTeamOrHH then exit; |
176 | 456 |
bShowFinger:= false; |
4 | 457 |
slot:= byte(s[1]) - 49; |
10 | 458 |
if slot > cMaxSlotIndex then exit; |
351 | 459 |
if not CurrentTeam^.ExtDriven then SendIPC(char(byte(s[1]) + 79)); |
783 | 460 |
with CurrentHedgehog^.Gear^ do |
2947 | 461 |
begin |
462 |
Message:= Message or gm_Slot; |
|
463 |
MsgParam:= slot |
|
464 |
end |
|
783 | 465 |
end; |
466 |
||
467 |
procedure chSetWeapon(var s: shortstring); |
|
468 |
begin |
|
469 |
if (s[0] <> #1) or CheckNoTeamOrHH then exit; |
|
784 | 470 |
|
1850 | 471 |
if TAmmoType(s[1]) > High(TAmmoType) then exit; |
784 | 472 |
|
473 |
if not CurrentTeam^.ExtDriven then SendIPC('w' + s); |
|
474 |
||
783 | 475 |
with CurrentHedgehog^.Gear^ do |
2947 | 476 |
begin |
477 |
Message:= Message or gm_Weapon; |
|
478 |
MsgParam:= byte(s[1]) |
|
479 |
end |
|
4 | 480 |
end; |
481 |
||
1035 | 482 |
procedure chTaunt(var s: shortstring); |
483 |
begin |
|
484 |
if (s[0] <> #1) or CheckNoTeamOrHH then exit; |
|
485 |
||
486 |
if TWave(s[1]) > High(TWave) then exit; |
|
487 |
||
488 |
if not CurrentTeam^.ExtDriven then SendIPC('t' + s); |
|
489 |
||
490 |
with CurrentHedgehog^.Gear^ do |
|
2947 | 491 |
begin |
492 |
Message:= Message or gm_Animate; |
|
493 |
MsgParam:= byte(s[1]) |
|
494 |
end |
|
1035 | 495 |
end; |
496 |
||
2017 | 497 |
procedure chHogSay(var s: shortstring); |
2042
905c554d62e6
Move Speech to visual gears. This checkin CRASHES on deletion of visual gear outside the doStep
nemo
parents:
2022
diff
changeset
|
498 |
var Gear: PVisualGear; |
2017 | 499 |
text: shortstring; |
500 |
begin |
|
501 |
text:= copy(s, 2, Length(s)-1); |
|
2110 | 502 |
if CheckNoTeamOrHH |
2947 | 503 |
or ((CurrentHedgehog^.Gear^.State and gstHHDriven) = 0) then |
2017 | 504 |
begin |
505 |
chSay(text); |
|
506 |
exit |
|
507 |
end; |
|
508 |
||
509 |
if not CurrentTeam^.ExtDriven then SendIPC('h' + s); |
|
2042
905c554d62e6
Move Speech to visual gears. This checkin CRASHES on deletion of visual gear outside the doStep
nemo
parents:
2022
diff
changeset
|
510 |
|
2017 | 511 |
if byte(s[1]) < 4 then |
512 |
begin |
|
2042
905c554d62e6
Move Speech to visual gears. This checkin CRASHES on deletion of visual gear outside the doStep
nemo
parents:
2022
diff
changeset
|
513 |
Gear:= AddVisualGear(0, 0, vgtSpeechBubble); |
2114
9a8ccc7bc3d8
Fix crash caused by speechbubbles when restoring from save or joining already started net game
unc0rr
parents:
2111
diff
changeset
|
514 |
if Gear <> nil then |
2947 | 515 |
begin |
516 |
Gear^.Hedgehog:= CurrentHedgehog; |
|
517 |
Gear^.Text:= text; |
|
518 |
Gear^.FrameTicks:= byte(s[1]) |
|
519 |
end |
|
2017 | 520 |
end |
521 |
else |
|
522 |
begin |
|
2022 | 523 |
SpeechType:= byte(s[1])-3; |
2017 | 524 |
SpeechText:= text |
525 |
end; |
|
2042
905c554d62e6
Move Speech to visual gears. This checkin CRASHES on deletion of visual gear outside the doStep
nemo
parents:
2022
diff
changeset
|
526 |
|
2017 | 527 |
end; |
528 |
||
1821
6b6cf3389f92
Hedgehog drops a grave on "/newgrave" command. Patch by nemo
unc0rr
parents:
1743
diff
changeset
|
529 |
procedure chNewGrave; |
6b6cf3389f92
Hedgehog drops a grave on "/newgrave" command. Patch by nemo
unc0rr
parents:
1743
diff
changeset
|
530 |
begin |
3336 | 531 |
if CheckNoTeamOrHH or isPaused then exit; |
1821
6b6cf3389f92
Hedgehog drops a grave on "/newgrave" command. Patch by nemo
unc0rr
parents:
1743
diff
changeset
|
532 |
|
6b6cf3389f92
Hedgehog drops a grave on "/newgrave" command. Patch by nemo
unc0rr
parents:
1743
diff
changeset
|
533 |
if not CurrentTeam^.ExtDriven then SendIPC('g'); |
6b6cf3389f92
Hedgehog drops a grave on "/newgrave" command. Patch by nemo
unc0rr
parents:
1743
diff
changeset
|
534 |
|
6b6cf3389f92
Hedgehog drops a grave on "/newgrave" command. Patch by nemo
unc0rr
parents:
1743
diff
changeset
|
535 |
AddGear(hwRound(CurrentHedgehog^.Gear^.X), hwRound(CurrentHedgehog^.Gear^.Y), gtGrave, 0, _0, _0, 0) |
6b6cf3389f92
Hedgehog drops a grave on "/newgrave" command. Patch by nemo
unc0rr
parents:
1743
diff
changeset
|
536 |
end; |
6b6cf3389f92
Hedgehog drops a grave on "/newgrave" command. Patch by nemo
unc0rr
parents:
1743
diff
changeset
|
537 |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
538 |
procedure doPut(putX, putY: LongInt; fromAI: boolean); |
4 | 539 |
begin |
3336 | 540 |
if CheckNoTeamOrHH or isPaused then exit; |
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
|
541 |
if not CurrentTeam^.ExtDriven and bShowAmmoMenu then |
2947 | 542 |
begin |
543 |
bSelected:= true; |
|
544 |
exit |
|
545 |
end; |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
546 |
|
602 | 547 |
with CurrentHedgehog^.Gear^, |
2947 | 548 |
CurrentHedgehog^ do |
549 |
if (State and gstHHChooseTarget) <> 0 then |
|
550 |
begin |
|
551 |
isCursorVisible:= false; |
|
552 |
if not CurrentTeam^.ExtDriven then |
|
553 |
begin |
|
554 |
if fromAI then |
|
555 |
begin |
|
556 |
TargetPoint.X:= putX; |
|
557 |
TargetPoint.Y:= putY |
|
558 |
end else |
|
559 |
begin |
|
560 |
TargetPoint.X:= CursorPoint.X - WorldDx; |
|
561 |
TargetPoint.Y:= cScreenHeight - CursorPoint.Y - WorldDy; |
|
562 |
end; |
|
563 |
SendIPCXY('p', TargetPoint.X, TargetPoint.Y); |
|
564 |
end |
|
565 |
else |
|
566 |
begin |
|
567 |
TargetPoint.X:= putX; |
|
568 |
TargetPoint.Y:= putY |
|
569 |
end; |
|
570 |
{$IFDEF DEBUGFILE}AddFilelog('put: ' + inttostr(TargetPoint.X) + ', ' + inttostr(TargetPoint.Y));{$ENDIF} |
|
571 |
State:= State and not gstHHChooseTarget; |
|
572 |
if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_AttackingPut) <> 0 then |
|
573 |
Message:= Message or gm_Attack; |
|
574 |
end |
|
575 |
else |
|
576 |
if CurrentTeam^.ExtDriven then |
|
577 |
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
|
578 |
end; |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
579 |
|
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
580 |
procedure chPut(var s: shortstring); |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
581 |
begin |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
582 |
doPut(0, 0, false) |
4 | 583 |
end; |
584 |
||
585 |
procedure chCapture(var s: shortstring); |
|
586 |
begin |
|
587 |
flagMakeCapture:= true |
|
588 |
end; |
|
589 |
||
48 | 590 |
procedure chSkip(var s: shortstring); |
591 |
begin |
|
351 | 592 |
if not CurrentTeam^.ExtDriven then SendIPC(','); |
871 | 593 |
uStats.Skipped; |
917 | 594 |
skipFlag:= true |
48 | 595 |
end; |
596 |
||
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
597 |
procedure chSetMap(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
598 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
599 |
if isDeveloperMode then |
2947 | 600 |
begin |
601 |
Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s; |
|
602 |
InitStepsFlags:= InitStepsFlags or cifMap |
|
603 |
end |
|
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
604 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
605 |
|
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
606 |
procedure chSetTheme(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
607 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
608 |
if isDeveloperMode then |
2947 | 609 |
begin |
610 |
Pathz[ptCurrTheme]:= Pathz[ptThemes] + '/' + s; |
|
611 |
InitStepsFlags:= InitStepsFlags or cifTheme |
|
612 |
end |
|
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
613 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
614 |
|
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
615 |
procedure chSetSeed(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
616 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
617 |
if isDeveloperMode then |
2947 | 618 |
begin |
619 |
SetRandomSeed(s); |
|
620 |
cSeed:= s; |
|
621 |
InitStepsFlags:= InitStepsFlags or cifRandomize |
|
622 |
end |
|
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
623 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
624 |
|
161 | 625 |
procedure chAmmoMenu(var s: shortstring); |
626 |
begin |
|
2855
7e6adeb57427
Show the ammo menu of the last local non-bot team when not local turn. needs testing
nemo
parents:
2853
diff
changeset
|
627 |
if CheckNoTeamOrHH then |
2947 | 628 |
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
|
629 |
else |
2947 | 630 |
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
|
631 |
with Hedgehogs[CurrHedgehog] do |
2947 | 632 |
begin |
633 |
bSelected:= false; |
|
682 | 634 |
|
2947 | 635 |
if bShowAmmoMenu then bShowAmmoMenu:= false |
636 |
else if ((Gear^.State and (gstAttacking or gstAttacked)) <> 0) or (MultiShootAttacks > 0) |
|
637 |
or ((Gear^.State and gstHHDriven) = 0) then else bShowAmmoMenu:= true |
|
638 |
end |
|
161 | 639 |
end; |
640 |
||
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
641 |
procedure chFullScr(var s: shortstring); |
2671
7e0f88013fe8
smaller patches, one missing Sky-lowres, IMG_Init and Mix_Init (might require newer libraries), updates to SDL bindings, code cleanup, new compile flags
koda
parents:
2645
diff
changeset
|
642 |
var flags: Longword = 0; |
2947 | 643 |
ico: PSDL_Surface; |
192 | 644 |
{$IFDEF DEBUGFILE} |
645 |
buf: array[byte] of char; |
|
646 |
{$ENDIF} |
|
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2714
diff
changeset
|
647 |
{$IFDEF SDL13} |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2714
diff
changeset
|
648 |
window: PSDL_Window; |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2714
diff
changeset
|
649 |
{$ENDIF} |
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
650 |
begin |
2947 | 651 |
if Length(s) = 0 then cFullScreen:= not cFullScreen |
652 |
else cFullScreen:= s = '1'; |
|
192 | 653 |
|
905 | 654 |
{$IFDEF DEBUGFILE} |
2947 | 655 |
AddFileLog('Prepare to change video parameters...'); |
905 | 656 |
{$ENDIF} |
2253 | 657 |
|
2947 | 658 |
flags:= SDL_OPENGL;// or SDL_RESIZABLE; |
753 | 659 |
|
2947 | 660 |
if cFullScreen then |
661 |
begin |
|
662 |
flags:= flags or SDL_FULLSCREEN; |
|
663 |
cScreenWidth:= cInitWidth; |
|
664 |
cScreenHeight:= cInitHeight |
|
665 |
end; |
|
2351
a4a17b8df591
Set window caption even in fullscreen mode (suggested by Smaxx)
unc0rr
parents:
2314
diff
changeset
|
666 |
|
2947 | 667 |
// load window icon |
3006 | 668 |
{$IFDEF SDL_IMAGE_NEWER} |
669 |
WriteToConsole('Init SDL_image... '); |
|
670 |
SDLTry(IMG_Init(IMG_INIT_PNG) <> 0, true); |
|
671 |
WriteLnToConsole(msgOK); |
|
672 |
{$ENDIF} |
|
673 |
{$IFDEF DARWIN} |
|
2947 | 674 |
ico:= LoadImage(Pathz[ptGraphics] + '/hwengine_mac', ifIgnoreCaps); |
3006 | 675 |
{$ELSE} |
676 |
ico:= LoadImage(Pathz[ptGraphics] + '/hwengine', ifIgnoreCaps); |
|
677 |
{$ENDIF} |
|
2947 | 678 |
if ico <> nil then |
3006 | 679 |
begin |
2947 | 680 |
SDL_WM_SetIcon(ico, 0); |
681 |
SDL_FreeSurface(ico) |
|
3006 | 682 |
end; |
2947 | 683 |
|
684 |
// set window caption |
|
685 |
SDL_WM_SetCaption('Hedgewars', nil); |
|
686 |
||
687 |
if SDLPrimSurface <> nil then |
|
688 |
begin |
|
2697 | 689 |
{$IFDEF DEBUGFILE} |
2947 | 690 |
AddFileLog('Freeing old primary surface...'); |
2697 | 691 |
{$ENDIF} |
2947 | 692 |
SDL_FreeSurface(SDLPrimSurface); |
693 |
end; |
|
694 |
||
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2714
diff
changeset
|
695 |
{$IFDEF SDL13} |
2947 | 696 |
window:= SDL_CreateWindow('Hedgewars', 0, 0, cScreenWidth, cScreenHeight, |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
697 |
SDL_WINDOW_OPENGL or SDL_WINDOW_SHOWN |
3006 | 698 |
{$IFDEF IPHONEOS} or SDL_WINDOW_BORDERLESS{$ENDIF}); |
699 |
SDL_CreateRenderer(window, -1, 0); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
700 |
PixelFormat:= nil; |
2947 | 701 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
702 |
SDL_SetRenderDrawColor(0, 0, 0, 255); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
703 |
SDL_RenderFill(nil); |
2947 | 704 |
SDL_RenderPresent(); |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2714
diff
changeset
|
705 |
{$ELSE} |
2947 | 706 |
SDLPrimSurface:= SDL_SetVideoMode(cScreenWidth, cScreenHeight, cBits, flags); |
707 |
SDLTry(SDLPrimSurface <> nil, true); |
|
708 |
PixelFormat:= SDLPrimSurface^.format; |
|
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2714
diff
changeset
|
709 |
{$ENDIF} |
192 | 710 |
|
905 | 711 |
{$IFDEF DEBUGFILE} |
2947 | 712 |
AddFileLog('Setting up OpenGL...'); |
713 |
AddFileLog('SDL video driver: ' + shortstring(SDL_VideoDriverName(buf, sizeof(buf)))); |
|
905 | 714 |
{$ENDIF} |
2947 | 715 |
SetupOpenGL(); |
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
716 |
end; |
161 | 717 |
|
175 | 718 |
procedure chVol_p(var s: shortstring); |
174 | 719 |
begin |
175 | 720 |
inc(cVolumeDelta, 3) |
174 | 721 |
end; |
722 |
||
175 | 723 |
procedure chVol_m(var s: shortstring); |
174 | 724 |
begin |
175 | 725 |
dec(cVolumeDelta, 3) |
174 | 726 |
end; |
727 |
||
176 | 728 |
procedure chFindhh(var s: shortstring); |
729 |
begin |
|
3336 | 730 |
if CheckNoTeamOrHH or isPaused then exit; |
176 | 731 |
bShowFinger:= true; |
602 | 732 |
FollowGear:= CurrentHedgehog^.Gear |
176 | 733 |
end; |
734 |
||
281
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
735 |
procedure chPause(var s: shortstring); |
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
736 |
begin |
1743 | 737 |
if gameType <> gmtNet then |
2947 | 738 |
isPaused:= not isPaused; |
281
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
739 |
SDL_ShowCursor(ord(isPaused)) |
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
740 |
end; |
539
6a9bf1852bbc
Ability to choose which info is shown above hedgehogs
unc0rr
parents:
534
diff
changeset
|
741 |
|
6a9bf1852bbc
Ability to choose which info is shown above hedgehogs
unc0rr
parents:
534
diff
changeset
|
742 |
procedure chRotateMask(var s: shortstring); |
6a9bf1852bbc
Ability to choose which info is shown above hedgehogs
unc0rr
parents:
534
diff
changeset
|
743 |
begin |
2947 | 744 |
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
|
745 |
end; |
6a9bf1852bbc
Ability to choose which info is shown above hedgehogs
unc0rr
parents:
534
diff
changeset
|
746 |
|
626 | 747 |
procedure chSpeedup_p(var s: shortstring); |
748 |
begin |
|
749 |
isSpeed:= true |
|
750 |
end; |
|
751 |
||
752 |
procedure chSpeedup_m(var s: shortstring); |
|
753 |
begin |
|
754 |
isSpeed:= false |
|
755 |
end; |
|
946 | 756 |
|
2162 | 757 |
procedure chZoomIn(var s: shortstring); |
758 |
begin |
|
2579 | 759 |
{$IFDEF IPHONEOS} |
760 |
if ZoomValue < 3.5 then |
|
761 |
{$ELSE} |
|
762 |
if ZoomValue < 3.0 then |
|
763 |
{$ENDIF} |
|
764 |
ZoomValue:= ZoomValue + 0.25; |
|
2162 | 765 |
end; |
766 |
||
767 |
procedure chZoomOut(var s: shortstring); |
|
768 |
begin |
|
2579 | 769 |
{$IFDEF IPHONEOS} |
770 |
if ZoomValue > 0.5 then |
|
771 |
{$ELSE} |
|
772 |
if ZoomValue > 1.0 then |
|
773 |
{$ENDIF} |
|
774 |
ZoomValue:= ZoomValue - 0.25; |
|
2162 | 775 |
end; |
776 |
||
2379 | 777 |
procedure chZoomReset(var s: shortstring); |
778 |
begin |
|
779 |
ZoomValue:= 2.0 |
|
780 |
end; |
|
781 |
||
946 | 782 |
procedure chChat(var s: shortstring); |
783 |
begin |
|
990
dfa6a6fe1542
Implement history for chat (27 entries), no key binding yet
unc0rr
parents:
970
diff
changeset
|
784 |
GameState:= gsChat; |
dfa6a6fe1542
Implement history for chat (27 entries), no key binding yet
unc0rr
parents:
970
diff
changeset
|
785 |
KeyPressChat(27) |
946 | 786 |
end; |
991 | 787 |
|
788 |
procedure chHistory(var s: shortstring); |
|
789 |
begin |
|
790 |
uChat.showAll:= not uChat.showAll |
|
791 |
end; |