author | unc0rr |
Mon, 08 Jan 2007 20:51:22 +0000 | |
changeset 312 | c36d0b34ac3d |
parent 288 | 929c44745fd9 |
child 324 | f4c109c82a0c |
permissions | -rw-r--r-- |
4 | 1 |
(* |
2 |
* Hedgewars, a worms-like game |
|
3 |
* Copyright (c) 2004, 2005 Andrey Korotaev <unC0Rr@gmail.com> |
|
4 |
* |
|
183 | 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 |
|
4 | 8 |
* |
183 | 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. |
|
4 | 13 |
* |
183 | 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 |
|
4 | 17 |
*) |
18 |
||
19 |
function CheckNoTeamOrHH: boolean; |
|
20 |
begin |
|
21 |
Result:= (CurrentTeam=nil) or (CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear = nil); |
|
22 |
{$IFDEF DEBUGFILE} |
|
23 |
if Result then |
|
24 |
if CurrentTeam = nil then AddFileLog('CONSOLE: CurTeam = nil') |
|
25 |
else AddFileLog('CONSOLE: CurTeam <> nil, Gear = nil') |
|
26 |
{$ENDIF} |
|
27 |
end; |
|
28 |
//////////////////////////////////////////////////////////////////////////////// |
|
29 |
procedure chQuit(var s: shortstring); |
|
30 |
begin |
|
31 |
GameState:= gsExit |
|
32 |
end; |
|
33 |
||
205 | 34 |
procedure chCheckProto(var s: shortstring); |
35 |
var i, c: integer; |
|
36 |
begin |
|
37 |
if isDeveloperMode then |
|
38 |
begin |
|
39 |
val(s, i, c); |
|
40 |
if (c <> 0) or (i = 0) then exit; |
|
41 |
TryDo(i <= cNetProtoVersion, 'Protocol version mismatch: engine is too old', true); |
|
42 |
TryDo(i >= cNetProtoVersion, 'Protocol version mismatch: engine is too new', true) |
|
43 |
end |
|
44 |
end; |
|
45 |
||
4 | 46 |
procedure chAddTeam(var s: shortstring); |
145 | 47 |
const TeamsCount: Longword = 0; |
4 | 48 |
begin |
145 | 49 |
if isDeveloperMode then |
50 |
begin |
|
51 |
inc(TeamsCount); |
|
52 |
TryDo(TeamsCount <= 5, 'Too many teams', true); |
|
53 |
AddTeam |
|
54 |
end; |
|
55 |
||
72 | 56 |
if GameType in [gmtDemo, gmtSave] then CurrentTeam.ExtDriven:= true |
4 | 57 |
end; |
58 |
||
59 |
procedure chTeamLocal(var s: shortstring); |
|
60 |
begin |
|
61 |
if not isDeveloperMode then exit; |
|
62 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/rdriven"', true); |
|
63 |
CurrentTeam.ExtDriven:= true |
|
64 |
end; |
|
65 |
||
66 |
procedure chName(var id: shortstring); |
|
67 |
var s: shortstring; |
|
68 |
begin |
|
69 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/name"', true); |
|
70 |
SplitBySpace(id, s); |
|
71 |
if s[1]='"' then Delete(s, 1, 1); |
|
72 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
73 |
if id = 'team' then CurrentTeam.TeamName:= s |
|
83 | 74 |
else if (id[1] = 'h') and (id[2] = 'h') |
75 |
and (id[3] >= '0') and (id[3] <= chr(ord('0')+cMaxHHIndex)) then |
|
4 | 76 |
CurrentTeam.Hedgehogs[byte(id[3])-48].Name:= s |
77 |
else OutError(errmsgUnknownVariable + ' "' + id + '"') |
|
78 |
end; |
|
79 |
||
80 |
procedure chGrave(var s: shortstring); |
|
81 |
begin |
|
82 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/grave"', 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.GraveName:= s |
|
86 |
end; |
|
87 |
||
88 |
procedure chFort(var s: shortstring); |
|
89 |
begin |
|
90 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/grave"', true); |
|
91 |
if s[1]='"' then Delete(s, 1, 1); |
|
92 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
93 |
CurrentTeam.FortName:= s |
|
94 |
end; |
|
95 |
||
96 |
procedure chColor(var id: shortstring); |
|
97 |
var c: integer; |
|
98 |
begin |
|
99 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/color"', true); |
|
100 |
val(id, CurrentTeam.Color, c); |
|
189 | 101 |
CurrentTeam.AdjColor:= CurrentTeam.Color; |
102 |
AdjustColor(CurrentTeam.AdjColor) |
|
4 | 103 |
end; |
104 |
||
312 | 105 |
procedure chAddHH(var id: shortstring); |
4 | 106 |
var s: shortstring; |
107 |
c: integer; |
|
108 |
Gear: PGear; |
|
109 |
begin |
|
110 |
if (not isDeveloperMode)or(CurrentTeam=nil) then exit; |
|
312 | 111 |
with CurrentTeam^ do |
112 |
begin |
|
113 |
SplitBySpace(id, s); |
|
114 |
val(id, Hedgehogs[HedgehogsNumber].BotLevel, c); |
|
115 |
Gear:= AddGear(0, 0, gtHedgehog, 0); |
|
116 |
Gear.Hedgehog:= @Hedgehogs[HedgehogsNumber]; |
|
117 |
val(s, Gear.Health, c); |
|
118 |
TryDo(Gear.Health > 0, 'Invalid hedgehog health', true); |
|
119 |
PHedgehog(Gear.Hedgehog).Team:= CurrentTeam; |
|
120 |
Hedgehogs[HedgehogsNumber].AmmoStore:= 0; |
|
121 |
Hedgehogs[HedgehogsNumber].Gear:= Gear; |
|
122 |
inc(HedgehogsNumber) |
|
123 |
end |
|
4 | 124 |
end; |
125 |
||
288 | 126 |
procedure chAddAmmoStore(var descr: shortstring); |
127 |
begin |
|
128 |
AddAmmoStore(descr) |
|
129 |
end; |
|
130 |
||
4 | 131 |
procedure chBind(var id: shortstring); |
132 |
var s: shortstring; |
|
133 |
b: integer; |
|
134 |
begin |
|
135 |
if CurrentTeam = nil then exit; |
|
136 |
SplitBySpace(id, s); |
|
137 |
if s[1]='"' then Delete(s, 1, 1); |
|
138 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
139 |
b:= KeyNameToCode(id); |
|
140 |
if b = 0 then OutError(errmsgUnknownVariable + ' "' + id + '"') |
|
167 | 141 |
else CurrentTeam.Binds[b]:= s |
4 | 142 |
end; |
143 |
||
144 |
procedure chLeft_p(var s: shortstring); |
|
145 |
begin |
|
146 |
if CheckNoTeamOrHH then exit; |
|
176 | 147 |
bShowFinger:= false; |
4 | 148 |
if not CurrentTeam.ExtDriven then SendIPC('L'); |
149 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
150 |
Message:= Message or gm_Left |
|
151 |
end; |
|
152 |
||
153 |
procedure chLeft_m(var s: shortstring); |
|
154 |
begin |
|
155 |
if CheckNoTeamOrHH then exit; |
|
156 |
if not CurrentTeam.ExtDriven then SendIPC('l'); |
|
157 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
158 |
Message:= Message and not gm_Left |
|
159 |
end; |
|
160 |
||
161 |
procedure chRight_p(var s: shortstring); |
|
162 |
begin |
|
163 |
if CheckNoTeamOrHH then exit; |
|
176 | 164 |
bShowFinger:= false; |
4 | 165 |
if not CurrentTeam.ExtDriven then SendIPC('R'); |
166 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
167 |
Message:= Message or gm_Right |
|
168 |
end; |
|
169 |
||
170 |
procedure chRight_m(var s: shortstring); |
|
171 |
begin |
|
172 |
if CheckNoTeamOrHH then exit; |
|
173 |
if not CurrentTeam.ExtDriven then SendIPC('r'); |
|
174 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
175 |
Message:= Message and not gm_Right |
|
176 |
end; |
|
177 |
||
178 |
procedure chUp_p(var s: shortstring); |
|
179 |
begin |
|
180 |
if CheckNoTeamOrHH then exit; |
|
176 | 181 |
bShowFinger:= false; |
4 | 182 |
if not CurrentTeam.ExtDriven then SendIPC('U'); |
183 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
184 |
Message:= Message or gm_Up |
|
185 |
end; |
|
186 |
||
187 |
procedure chUp_m(var s: shortstring); |
|
188 |
begin |
|
189 |
if CheckNoTeamOrHH then exit; |
|
190 |
if not CurrentTeam.ExtDriven then SendIPC('u'); |
|
191 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
192 |
Message:= Message and not gm_Up |
|
193 |
end; |
|
194 |
||
195 |
procedure chDown_p(var s: shortstring); |
|
196 |
begin |
|
197 |
if CheckNoTeamOrHH then exit; |
|
176 | 198 |
bShowFinger:= false; |
4 | 199 |
if not CurrentTeam.ExtDriven then SendIPC('D'); |
200 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
201 |
Message:= Message or gm_Down |
|
202 |
end; |
|
203 |
||
204 |
procedure chDown_m(var s: shortstring); |
|
205 |
begin |
|
206 |
if CheckNoTeamOrHH then exit; |
|
207 |
if not CurrentTeam.ExtDriven then SendIPC('d'); |
|
208 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
209 |
Message:= Message and not gm_Down |
|
210 |
end; |
|
211 |
||
212 |
procedure chLJump(var s: shortstring); |
|
213 |
begin |
|
214 |
if CheckNoTeamOrHH then exit; |
|
176 | 215 |
bShowFinger:= false; |
4 | 216 |
if not CurrentTeam.ExtDriven then SendIPC('j'); |
217 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
218 |
Message:= Message or gm_LJump |
|
219 |
end; |
|
220 |
||
221 |
procedure chHJump(var s: shortstring); |
|
222 |
begin |
|
223 |
if CheckNoTeamOrHH then exit; |
|
176 | 224 |
bShowFinger:= false; |
4 | 225 |
if not CurrentTeam.ExtDriven then SendIPC('J'); |
226 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
227 |
Message:= Message or gm_HJump |
|
228 |
end; |
|
229 |
||
230 |
procedure chAttack_p(var s: shortstring); |
|
231 |
begin |
|
232 |
if CheckNoTeamOrHH then exit; |
|
176 | 233 |
bShowFinger:= false; |
4 | 234 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
235 |
begin |
|
236 |
{$IFDEF DEBUGFILE}AddFileLog('/+attack: Gear.State = '+inttostr(State));{$ENDIF} |
|
237 |
if ((State and gstHHDriven)<>0)and((State and (gstAttacked or gstHHChooseTarget or gstMoving)) = 0) then |
|
238 |
begin |
|
239 |
FollowGear:= CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear; |
|
240 |
if not CurrentTeam.ExtDriven then SendIPC('A'); |
|
241 |
Message:= Message or gm_Attack |
|
242 |
end |
|
243 |
end |
|
244 |
end; |
|
245 |
||
246 |
procedure chAttack_m(var s: shortstring); |
|
247 |
begin |
|
248 |
if CheckNoTeamOrHH then exit; |
|
95 | 249 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
4 | 250 |
begin |
95 | 251 |
if not CurrentTeam.ExtDriven and |
252 |
((Message and gm_Attack) <> 0) then SendIPC('a'); |
|
253 |
Message:= Message and not gm_Attack |
|
4 | 254 |
end |
255 |
end; |
|
256 |
||
257 |
procedure chSwitch(var s: shortstring); |
|
258 |
begin |
|
259 |
if CheckNoTeamOrHH then exit; |
|
260 |
if not CurrentTeam.ExtDriven then SendIPC('S'); |
|
261 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
262 |
Message:= Message or gm_Switch |
|
263 |
end; |
|
264 |
||
265 |
procedure chNextTurn(var s: shortstring); |
|
266 |
begin |
|
267 |
if AllInactive then |
|
268 |
begin |
|
269 |
if not CurrentTeam.ExtDriven then SendIPC('N'); |
|
270 |
{$IFDEF DEBUGFILE}AddFileLog('Doing SwitchHedgehog: time '+inttostr(GameTicks));{$ENDIF} |
|
271 |
SwitchHedgehog; |
|
272 |
end |
|
273 |
end; |
|
274 |
||
275 |
procedure chSay(var s: shortstring); |
|
276 |
begin |
|
277 |
WriteLnToConsole('> ' + s); |
|
278 |
SendIPC('s'+s) |
|
279 |
end; |
|
280 |
||
281 |
procedure chTimer(var s: shortstring); |
|
282 |
begin |
|
283 |
if (s[0] <> #1) or (s[1] < '1') or (s[1] > '5') or (CurrentTeam = nil) then exit; |
|
176 | 284 |
bShowFinger:= false; |
4 | 285 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do |
286 |
if (Ammo[CurSlot, CurAmmo].Propz and ammoprop_Timerable) <> 0 then |
|
287 |
begin |
|
288 |
Ammo[CurSlot, CurAmmo].Timer:= 1000 * (byte(s[1]) - 48); |
|
289 |
with CurrentTeam^ do |
|
70 | 290 |
ApplyAmmoChanges(Hedgehogs[CurrHedgehog]); |
4 | 291 |
if not CurrentTeam.ExtDriven then SendIPC(s); |
292 |
end |
|
293 |
end; |
|
294 |
||
295 |
procedure chSlot(var s: shortstring); |
|
296 |
var slot: LongWord; |
|
297 |
caSlot, caAmmo: PLongword; |
|
298 |
begin |
|
95 | 299 |
if (s[0] <> #1) or CheckNoTeamOrHH then exit; |
176 | 300 |
bShowFinger:= false; |
4 | 301 |
slot:= byte(s[1]) - 49; |
10 | 302 |
if slot > cMaxSlotIndex then exit; |
4 | 303 |
if not CurrentTeam.ExtDriven then SendIPC(char(byte(s[1]) + 79)); |
304 |
with CurrentTeam^ do |
|
305 |
begin |
|
306 |
with Hedgehogs[CurrHedgehog] do |
|
307 |
begin |
|
308 |
if ((Gear.State and (gstAttacking or gstAttacked)) <> 0) or (AttacksNum > 0) |
|
309 |
or ((Gear.State and gstHHDriven) = 0) then exit; // âî âðåìÿ ñòðåëüáû èñêëþ÷àåò ñìåíó îðóæèÿ |
|
310 |
if CurAmmoGear = nil then begin caSlot:= @CurSlot; caAmmo:= @CurAmmo end |
|
311 |
else begin caSlot:= @AltSlot; caAmmo:= @AltAmmo end; |
|
312 |
if caSlot^ = slot then |
|
313 |
begin |
|
314 |
inc(caAmmo^); |
|
10 | 315 |
if (caAmmo^ > cMaxSlotAmmoIndex) or (Ammo[slot, caAmmo^].Count = 0) then caAmmo^:= 0 |
4 | 316 |
end else |
317 |
if Ammo[slot, 0].Count > 0 then |
|
318 |
begin |
|
319 |
caSlot^:= slot; |
|
320 |
caAmmo^:= 0; |
|
321 |
end; |
|
322 |
end; |
|
70 | 323 |
ApplyAmmoChanges(Hedgehogs[CurrHedgehog]) |
4 | 324 |
end |
325 |
end; |
|
326 |
||
327 |
procedure chPut(var s: shortstring); |
|
328 |
begin |
|
329 |
if CheckNoTeamOrHH then exit; |
|
162 | 330 |
if bShowAmmoMenu then |
331 |
begin |
|
332 |
bSelected:= true; |
|
333 |
exit |
|
334 |
end; |
|
263 | 335 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^, |
336 |
CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do |
|
4 | 337 |
if (State and gstHHChooseTarget) <> 0 then |
338 |
begin |
|
339 |
isCursorVisible:= false; |
|
340 |
if not CurrentTeam.ExtDriven then |
|
341 |
begin |
|
342 |
SDL_GetMouseState(@TargetPoint.X, @TargetPoint.Y); |
|
343 |
dec(TargetPoint.X, WorldDx); |
|
344 |
dec(TargetPoint.Y, WorldDy); |
|
154
5667e6f38704
Network protocol uses integers in network byte order
unc0rr
parents:
145
diff
changeset
|
345 |
SendIPCXY('p', TargetPoint.X, TargetPoint.Y); |
4 | 346 |
end; |
347 |
State:= State and not gstHHChooseTarget; |
|
263 | 348 |
if (Ammo[CurSlot, CurAmmo].Propz and ammoprop_AttackingPut) <> 0 then |
349 |
Message:= Message or gm_Attack; |
|
95 | 350 |
end else if CurrentTeam.ExtDriven then OutError('got /put while not being in choose target mode', false) |
4 | 351 |
end; |
352 |
||
353 |
procedure chCapture(var s: shortstring); |
|
354 |
begin |
|
355 |
flagMakeCapture:= true |
|
356 |
end; |
|
357 |
||
48 | 358 |
procedure chSkip(var s: shortstring); |
359 |
begin |
|
360 |
if not CurrentTeam.ExtDriven then SendIPC(','); |
|
361 |
TurnTimeLeft:= 0 |
|
362 |
end; |
|
363 |
||
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
364 |
procedure chSetMap(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
365 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
366 |
if isDeveloperMode then |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
367 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
368 |
Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
369 |
InitStepsFlags:= InitStepsFlags or cifMap |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
370 |
end |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
371 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
372 |
|
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
373 |
procedure chSetTheme(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
374 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
375 |
if isDeveloperMode then |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
376 |
begin |
80 | 377 |
Pathz[ptCurrTheme]:= Pathz[ptThemes] + '/' + s; |
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
378 |
InitStepsFlags:= InitStepsFlags or cifTheme |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
379 |
end |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
380 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
381 |
|
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
382 |
procedure chSetSeed(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
383 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
384 |
if isDeveloperMode then |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
385 |
begin |
102 | 386 |
SetRandomSeed(s); |
81 | 387 |
cSeed:= s; |
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
388 |
InitStepsFlags:= InitStepsFlags or cifRandomize |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
389 |
end |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
390 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
391 |
|
161 | 392 |
procedure chAmmoMenu(var s: shortstring); |
393 |
begin |
|
394 |
if CheckNoTeamOrHH then exit; |
|
395 |
with CurrentTeam^ do |
|
396 |
with Hedgehogs[CurrHedgehog] do |
|
397 |
begin |
|
162 | 398 |
bSelected:= false; |
161 | 399 |
if bShowAmmoMenu then bShowAmmoMenu:= false |
400 |
else if ((Gear.State and (gstAttacking or gstAttacked)) <> 0) or (AttacksNum > 0) |
|
401 |
or ((Gear.State and gstHHDriven) = 0) then else bShowAmmoMenu:= true |
|
402 |
end |
|
403 |
end; |
|
404 |
||
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
405 |
procedure chFullScr(var s: shortstring); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
406 |
var flags: Longword; |
192 | 407 |
{$IFDEF DEBUGFILE} |
408 |
buf: array[byte] of char; |
|
409 |
{$ENDIF} |
|
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
410 |
begin |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
411 |
if Length(s) = 0 then cFullScreen:= not cFullScreen |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
412 |
else cFullScreen:= s = '1'; |
192 | 413 |
|
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
414 |
flags:= SDL_HWSURFACE or SDL_DOUBLEBUF or SDL_HWACCEL; |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
415 |
if cFullScreen then flags:= flags or SDL_FULLSCREEN |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
416 |
else SDL_WM_SetCaption('Hedgewars', nil); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
417 |
SDL_FreeSurface(SDLPrimSurface); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
418 |
SDLPrimSurface:= SDL_SetVideoMode(cScreenWidth, cScreenHeight, cBits, flags); |
192 | 419 |
|
420 |
{$IFDEF DEBUGFILE} |
|
421 |
AddFileLog('SDL video driver: ' + string(SDL_VideoDriverName(buf, sizeof(buf)))); |
|
422 |
{$ENDIF} |
|
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
423 |
TryDo(SDLPrimSurface <> nil, errmsgCreateSurface, true); |
281
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
424 |
PixelFormat:= SDLPrimSurface.format |
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
425 |
end; |
161 | 426 |
|
175 | 427 |
procedure chVol_p(var s: shortstring); |
174 | 428 |
begin |
175 | 429 |
inc(cVolumeDelta, 3) |
174 | 430 |
end; |
431 |
||
175 | 432 |
procedure chVol_m(var s: shortstring); |
174 | 433 |
begin |
175 | 434 |
dec(cVolumeDelta, 3) |
174 | 435 |
end; |
436 |
||
176 | 437 |
procedure chFindhh(var s: shortstring); |
438 |
begin |
|
439 |
if CheckNoTeamOrHH then exit; |
|
440 |
bShowFinger:= true; |
|
441 |
FollowGear:= CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear |
|
442 |
end; |
|
443 |
||
281
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
444 |
procedure chPause(var s: shortstring); |
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
445 |
begin |
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
446 |
isPaused:= not isPaused; |
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
447 |
SDL_ShowCursor(ord(isPaused)) |
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
448 |
end; |
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
449 |