author | unc0rr |
Thu, 26 Oct 2006 16:08:29 +0000 | |
changeset 205 | 8d9aff55e6ab |
parent 192 | b644f61e803f |
child 263 | 36379e6abcdd |
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 |
||
105 |
procedure chAdd(var id: shortstring); |
|
106 |
var s: shortstring; |
|
107 |
c: integer; |
|
108 |
Gear: PGear; |
|
109 |
b: byte; |
|
110 |
begin |
|
111 |
if (not isDeveloperMode)or(CurrentTeam=nil) then exit; |
|
112 |
SplitBySpace(id, s); |
|
113 |
if (id[1]='h')and(id[2]='h')and(id[3]>='0')and(id[3]<='7') then |
|
114 |
begin |
|
115 |
b:= byte(id[3])-48; |
|
116 |
val(s, CurrentTeam.Hedgehogs[b].BotLevel, c); |
|
117 |
Gear:= AddGear(0, 0, gtHedgehog, 0); |
|
118 |
Gear.Hedgehog:= @CurrentTeam.Hedgehogs[b]; |
|
119 |
PHedgehog(Gear.Hedgehog).Team:= CurrentTeam; |
|
120 |
CurrentTeam.Hedgehogs[b].Gear:= Gear |
|
121 |
end |
|
122 |
else OutError(errmsgUnknownVariable + ' "' + id + '"', true) |
|
123 |
end; |
|
124 |
||
125 |
procedure chBind(var id: shortstring); |
|
126 |
var s: shortstring; |
|
127 |
b: integer; |
|
128 |
begin |
|
129 |
if CurrentTeam = nil then exit; |
|
130 |
SplitBySpace(id, s); |
|
131 |
if s[1]='"' then Delete(s, 1, 1); |
|
132 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
133 |
b:= KeyNameToCode(id); |
|
134 |
if b = 0 then OutError(errmsgUnknownVariable + ' "' + id + '"') |
|
167 | 135 |
else CurrentTeam.Binds[b]:= s |
4 | 136 |
end; |
137 |
||
138 |
procedure chLeft_p(var s: shortstring); |
|
139 |
begin |
|
140 |
if CheckNoTeamOrHH then exit; |
|
176 | 141 |
bShowFinger:= false; |
4 | 142 |
if not CurrentTeam.ExtDriven then SendIPC('L'); |
143 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
144 |
Message:= Message or gm_Left |
|
145 |
end; |
|
146 |
||
147 |
procedure chLeft_m(var s: shortstring); |
|
148 |
begin |
|
149 |
if CheckNoTeamOrHH then exit; |
|
150 |
if not CurrentTeam.ExtDriven then SendIPC('l'); |
|
151 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
152 |
Message:= Message and not gm_Left |
|
153 |
end; |
|
154 |
||
155 |
procedure chRight_p(var s: shortstring); |
|
156 |
begin |
|
157 |
if CheckNoTeamOrHH then exit; |
|
176 | 158 |
bShowFinger:= false; |
4 | 159 |
if not CurrentTeam.ExtDriven then SendIPC('R'); |
160 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
161 |
Message:= Message or gm_Right |
|
162 |
end; |
|
163 |
||
164 |
procedure chRight_m(var s: shortstring); |
|
165 |
begin |
|
166 |
if CheckNoTeamOrHH then exit; |
|
167 |
if not CurrentTeam.ExtDriven then SendIPC('r'); |
|
168 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
169 |
Message:= Message and not gm_Right |
|
170 |
end; |
|
171 |
||
172 |
procedure chUp_p(var s: shortstring); |
|
173 |
begin |
|
174 |
if CheckNoTeamOrHH then exit; |
|
176 | 175 |
bShowFinger:= false; |
4 | 176 |
if not CurrentTeam.ExtDriven then SendIPC('U'); |
177 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
178 |
Message:= Message or gm_Up |
|
179 |
end; |
|
180 |
||
181 |
procedure chUp_m(var s: shortstring); |
|
182 |
begin |
|
183 |
if CheckNoTeamOrHH then exit; |
|
184 |
if not CurrentTeam.ExtDriven then SendIPC('u'); |
|
185 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
186 |
Message:= Message and not gm_Up |
|
187 |
end; |
|
188 |
||
189 |
procedure chDown_p(var s: shortstring); |
|
190 |
begin |
|
191 |
if CheckNoTeamOrHH then exit; |
|
176 | 192 |
bShowFinger:= false; |
4 | 193 |
if not CurrentTeam.ExtDriven then SendIPC('D'); |
194 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
195 |
Message:= Message or gm_Down |
|
196 |
end; |
|
197 |
||
198 |
procedure chDown_m(var s: shortstring); |
|
199 |
begin |
|
200 |
if CheckNoTeamOrHH then exit; |
|
201 |
if not CurrentTeam.ExtDriven then SendIPC('d'); |
|
202 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
203 |
Message:= Message and not gm_Down |
|
204 |
end; |
|
205 |
||
206 |
procedure chLJump(var s: shortstring); |
|
207 |
begin |
|
208 |
if CheckNoTeamOrHH then exit; |
|
176 | 209 |
bShowFinger:= false; |
4 | 210 |
if not CurrentTeam.ExtDriven then SendIPC('j'); |
211 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
212 |
Message:= Message or gm_LJump |
|
213 |
end; |
|
214 |
||
215 |
procedure chHJump(var s: shortstring); |
|
216 |
begin |
|
217 |
if CheckNoTeamOrHH then exit; |
|
176 | 218 |
bShowFinger:= false; |
4 | 219 |
if not CurrentTeam.ExtDriven then SendIPC('J'); |
220 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
221 |
Message:= Message or gm_HJump |
|
222 |
end; |
|
223 |
||
224 |
procedure chAttack_p(var s: shortstring); |
|
225 |
begin |
|
226 |
if CheckNoTeamOrHH then exit; |
|
176 | 227 |
bShowFinger:= false; |
4 | 228 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
229 |
begin |
|
230 |
{$IFDEF DEBUGFILE}AddFileLog('/+attack: Gear.State = '+inttostr(State));{$ENDIF} |
|
231 |
if ((State and gstHHDriven)<>0)and((State and (gstAttacked or gstHHChooseTarget or gstMoving)) = 0) then |
|
232 |
begin |
|
233 |
FollowGear:= CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear; |
|
234 |
if not CurrentTeam.ExtDriven then SendIPC('A'); |
|
235 |
Message:= Message or gm_Attack |
|
236 |
end |
|
237 |
end |
|
238 |
end; |
|
239 |
||
240 |
procedure chAttack_m(var s: shortstring); |
|
241 |
begin |
|
242 |
if CheckNoTeamOrHH then exit; |
|
95 | 243 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
4 | 244 |
begin |
95 | 245 |
if not CurrentTeam.ExtDriven and |
246 |
((Message and gm_Attack) <> 0) then SendIPC('a'); |
|
247 |
Message:= Message and not gm_Attack |
|
4 | 248 |
end |
249 |
end; |
|
250 |
||
251 |
procedure chSwitch(var s: shortstring); |
|
252 |
begin |
|
253 |
if CheckNoTeamOrHH then exit; |
|
254 |
if not CurrentTeam.ExtDriven then SendIPC('S'); |
|
255 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
256 |
Message:= Message or gm_Switch |
|
257 |
end; |
|
258 |
||
259 |
procedure chNextTurn(var s: shortstring); |
|
260 |
begin |
|
261 |
if AllInactive then |
|
262 |
begin |
|
263 |
if not CurrentTeam.ExtDriven then SendIPC('N'); |
|
264 |
{$IFDEF DEBUGFILE}AddFileLog('Doing SwitchHedgehog: time '+inttostr(GameTicks));{$ENDIF} |
|
265 |
SwitchHedgehog; |
|
266 |
end |
|
267 |
end; |
|
268 |
||
269 |
procedure chSay(var s: shortstring); |
|
270 |
begin |
|
271 |
WriteLnToConsole('> ' + s); |
|
272 |
SendIPC('s'+s) |
|
273 |
end; |
|
274 |
||
275 |
procedure chTimer(var s: shortstring); |
|
276 |
begin |
|
277 |
if (s[0] <> #1) or (s[1] < '1') or (s[1] > '5') or (CurrentTeam = nil) then exit; |
|
176 | 278 |
bShowFinger:= false; |
4 | 279 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do |
280 |
if (Ammo[CurSlot, CurAmmo].Propz and ammoprop_Timerable) <> 0 then |
|
281 |
begin |
|
282 |
Ammo[CurSlot, CurAmmo].Timer:= 1000 * (byte(s[1]) - 48); |
|
283 |
with CurrentTeam^ do |
|
70 | 284 |
ApplyAmmoChanges(Hedgehogs[CurrHedgehog]); |
4 | 285 |
if not CurrentTeam.ExtDriven then SendIPC(s); |
286 |
end |
|
287 |
end; |
|
288 |
||
289 |
procedure chSlot(var s: shortstring); |
|
290 |
var slot: LongWord; |
|
291 |
caSlot, caAmmo: PLongword; |
|
292 |
begin |
|
95 | 293 |
if (s[0] <> #1) or CheckNoTeamOrHH then exit; |
176 | 294 |
bShowFinger:= false; |
4 | 295 |
slot:= byte(s[1]) - 49; |
10 | 296 |
if slot > cMaxSlotIndex then exit; |
4 | 297 |
if not CurrentTeam.ExtDriven then SendIPC(char(byte(s[1]) + 79)); |
298 |
with CurrentTeam^ do |
|
299 |
begin |
|
300 |
with Hedgehogs[CurrHedgehog] do |
|
301 |
begin |
|
302 |
if ((Gear.State and (gstAttacking or gstAttacked)) <> 0) or (AttacksNum > 0) |
|
303 |
or ((Gear.State and gstHHDriven) = 0) then exit; // âî âðåìÿ ñòðåëüáû èñêëþ÷àåò ñìåíó îðóæèÿ |
|
304 |
if CurAmmoGear = nil then begin caSlot:= @CurSlot; caAmmo:= @CurAmmo end |
|
305 |
else begin caSlot:= @AltSlot; caAmmo:= @AltAmmo end; |
|
306 |
if caSlot^ = slot then |
|
307 |
begin |
|
308 |
inc(caAmmo^); |
|
10 | 309 |
if (caAmmo^ > cMaxSlotAmmoIndex) or (Ammo[slot, caAmmo^].Count = 0) then caAmmo^:= 0 |
4 | 310 |
end else |
311 |
if Ammo[slot, 0].Count > 0 then |
|
312 |
begin |
|
313 |
caSlot^:= slot; |
|
314 |
caAmmo^:= 0; |
|
315 |
end; |
|
316 |
end; |
|
70 | 317 |
ApplyAmmoChanges(Hedgehogs[CurrHedgehog]) |
4 | 318 |
end |
319 |
end; |
|
320 |
||
321 |
procedure chPut(var s: shortstring); |
|
322 |
begin |
|
323 |
if CheckNoTeamOrHH then exit; |
|
162 | 324 |
if bShowAmmoMenu then |
325 |
begin |
|
326 |
bSelected:= true; |
|
327 |
exit |
|
328 |
end; |
|
4 | 329 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
330 |
if (State and gstHHChooseTarget) <> 0 then |
|
331 |
begin |
|
332 |
isCursorVisible:= false; |
|
333 |
if not CurrentTeam.ExtDriven then |
|
334 |
begin |
|
335 |
SDL_GetMouseState(@TargetPoint.X, @TargetPoint.Y); |
|
336 |
dec(TargetPoint.X, WorldDx); |
|
337 |
dec(TargetPoint.Y, WorldDy); |
|
154
5667e6f38704
Network protocol uses integers in network byte order
unc0rr
parents:
145
diff
changeset
|
338 |
SendIPCXY('p', TargetPoint.X, TargetPoint.Y); |
4 | 339 |
end; |
340 |
State:= State and not gstHHChooseTarget; |
|
95 | 341 |
end else if CurrentTeam.ExtDriven then OutError('got /put while not being in choose target mode', false) |
4 | 342 |
end; |
343 |
||
344 |
procedure chCapture(var s: shortstring); |
|
345 |
begin |
|
346 |
flagMakeCapture:= true |
|
347 |
end; |
|
348 |
||
48 | 349 |
procedure chSkip(var s: shortstring); |
350 |
begin |
|
351 |
if not CurrentTeam.ExtDriven then SendIPC(','); |
|
352 |
TurnTimeLeft:= 0 |
|
353 |
end; |
|
354 |
||
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
355 |
procedure chSetMap(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
356 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
357 |
if isDeveloperMode then |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
358 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
359 |
Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
360 |
InitStepsFlags:= InitStepsFlags or cifMap |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
361 |
end |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
362 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
363 |
|
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
364 |
procedure chSetTheme(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 |
80 | 368 |
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
|
369 |
InitStepsFlags:= InitStepsFlags or cifTheme |
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 chSetSeed(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 |
102 | 377 |
SetRandomSeed(s); |
81 | 378 |
cSeed:= 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 cifRandomize |
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 |
|
161 | 383 |
procedure chAmmoMenu(var s: shortstring); |
384 |
begin |
|
385 |
if CheckNoTeamOrHH then exit; |
|
386 |
with CurrentTeam^ do |
|
387 |
with Hedgehogs[CurrHedgehog] do |
|
388 |
begin |
|
162 | 389 |
bSelected:= false; |
161 | 390 |
if bShowAmmoMenu then bShowAmmoMenu:= false |
391 |
else if ((Gear.State and (gstAttacking or gstAttacked)) <> 0) or (AttacksNum > 0) |
|
392 |
or ((Gear.State and gstHHDriven) = 0) then else bShowAmmoMenu:= true |
|
393 |
end |
|
394 |
end; |
|
395 |
||
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
396 |
procedure chFullScr(var s: shortstring); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
397 |
var flags: Longword; |
192 | 398 |
{$IFDEF DEBUGFILE} |
399 |
buf: array[byte] of char; |
|
400 |
{$ENDIF} |
|
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
401 |
begin |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
402 |
if Length(s) = 0 then cFullScreen:= not cFullScreen |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
403 |
else cFullScreen:= s = '1'; |
192 | 404 |
|
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
405 |
flags:= SDL_HWSURFACE or SDL_DOUBLEBUF or SDL_HWACCEL; |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
406 |
if cFullScreen then flags:= flags or SDL_FULLSCREEN |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
407 |
else SDL_WM_SetCaption('Hedgewars', nil); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
408 |
SDL_FreeSurface(SDLPrimSurface); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
409 |
SDLPrimSurface:= SDL_SetVideoMode(cScreenWidth, cScreenHeight, cBits, flags); |
192 | 410 |
|
411 |
{$IFDEF DEBUGFILE} |
|
412 |
AddFileLog('SDL video driver: ' + string(SDL_VideoDriverName(buf, sizeof(buf)))); |
|
413 |
{$ENDIF} |
|
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
414 |
TryDo(SDLPrimSurface <> nil, errmsgCreateSurface, true); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
415 |
PixelFormat:= SDLPrimSurface.format; |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
416 |
SDL_ShowCursor(0) |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
417 |
end; |
161 | 418 |
|
175 | 419 |
procedure chVol_p(var s: shortstring); |
174 | 420 |
begin |
175 | 421 |
inc(cVolumeDelta, 3) |
174 | 422 |
end; |
423 |
||
175 | 424 |
procedure chVol_m(var s: shortstring); |
174 | 425 |
begin |
175 | 426 |
dec(cVolumeDelta, 3) |
174 | 427 |
end; |
428 |
||
176 | 429 |
procedure chFindhh(var s: shortstring); |
430 |
begin |
|
431 |
if CheckNoTeamOrHH then exit; |
|
432 |
bShowFinger:= true; |
|
433 |
FollowGear:= CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear |
|
434 |
end; |
|
435 |