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