author | displacer |
Sat, 25 Nov 2006 17:08:39 +0000 | |
changeset 277 | 04a613bab65c |
parent 263 | 36379e6abcdd |
child 281 | 5b483aa9f2ab |
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; |
|
263 | 329 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^, |
330 |
CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do |
|
4 | 331 |
if (State and gstHHChooseTarget) <> 0 then |
332 |
begin |
|
333 |
isCursorVisible:= false; |
|
334 |
if not CurrentTeam.ExtDriven then |
|
335 |
begin |
|
336 |
SDL_GetMouseState(@TargetPoint.X, @TargetPoint.Y); |
|
337 |
dec(TargetPoint.X, WorldDx); |
|
338 |
dec(TargetPoint.Y, WorldDy); |
|
154
5667e6f38704
Network protocol uses integers in network byte order
unc0rr
parents:
145
diff
changeset
|
339 |
SendIPCXY('p', TargetPoint.X, TargetPoint.Y); |
4 | 340 |
end; |
341 |
State:= State and not gstHHChooseTarget; |
|
263 | 342 |
if (Ammo[CurSlot, CurAmmo].Propz and ammoprop_AttackingPut) <> 0 then |
343 |
Message:= Message or gm_Attack; |
|
95 | 344 |
end else if CurrentTeam.ExtDriven then OutError('got /put while not being in choose target mode', false) |
4 | 345 |
end; |
346 |
||
347 |
procedure chCapture(var s: shortstring); |
|
348 |
begin |
|
349 |
flagMakeCapture:= true |
|
350 |
end; |
|
351 |
||
48 | 352 |
procedure chSkip(var s: shortstring); |
353 |
begin |
|
354 |
if not CurrentTeam.ExtDriven then SendIPC(','); |
|
355 |
TurnTimeLeft:= 0 |
|
356 |
end; |
|
357 |
||
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
358 |
procedure chSetMap(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
359 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
360 |
if isDeveloperMode then |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
361 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
362 |
Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
363 |
InitStepsFlags:= InitStepsFlags or cifMap |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
364 |
end |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
365 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
366 |
|
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
367 |
procedure chSetTheme(var s: shortstring); |
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 |
if isDeveloperMode then |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
370 |
begin |
80 | 371 |
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
|
372 |
InitStepsFlags:= InitStepsFlags or cifTheme |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
373 |
end |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
374 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
375 |
|
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
376 |
procedure chSetSeed(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
377 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
378 |
if isDeveloperMode then |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
379 |
begin |
102 | 380 |
SetRandomSeed(s); |
81 | 381 |
cSeed:= s; |
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
382 |
InitStepsFlags:= InitStepsFlags or cifRandomize |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
383 |
end |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
384 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
385 |
|
161 | 386 |
procedure chAmmoMenu(var s: shortstring); |
387 |
begin |
|
388 |
if CheckNoTeamOrHH then exit; |
|
389 |
with CurrentTeam^ do |
|
390 |
with Hedgehogs[CurrHedgehog] do |
|
391 |
begin |
|
162 | 392 |
bSelected:= false; |
161 | 393 |
if bShowAmmoMenu then bShowAmmoMenu:= false |
394 |
else if ((Gear.State and (gstAttacking or gstAttacked)) <> 0) or (AttacksNum > 0) |
|
395 |
or ((Gear.State and gstHHDriven) = 0) then else bShowAmmoMenu:= true |
|
396 |
end |
|
397 |
end; |
|
398 |
||
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
399 |
procedure chFullScr(var s: shortstring); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
400 |
var flags: Longword; |
192 | 401 |
{$IFDEF DEBUGFILE} |
402 |
buf: array[byte] of char; |
|
403 |
{$ENDIF} |
|
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
404 |
begin |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
405 |
if Length(s) = 0 then cFullScreen:= not cFullScreen |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
406 |
else cFullScreen:= s = '1'; |
192 | 407 |
|
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
408 |
flags:= SDL_HWSURFACE or SDL_DOUBLEBUF or SDL_HWACCEL; |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
409 |
if cFullScreen then flags:= flags or SDL_FULLSCREEN |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
410 |
else SDL_WM_SetCaption('Hedgewars', nil); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
411 |
SDL_FreeSurface(SDLPrimSurface); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
412 |
SDLPrimSurface:= SDL_SetVideoMode(cScreenWidth, cScreenHeight, cBits, flags); |
192 | 413 |
|
414 |
{$IFDEF DEBUGFILE} |
|
415 |
AddFileLog('SDL video driver: ' + string(SDL_VideoDriverName(buf, sizeof(buf)))); |
|
416 |
{$ENDIF} |
|
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
417 |
TryDo(SDLPrimSurface <> nil, errmsgCreateSurface, true); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
418 |
PixelFormat:= SDLPrimSurface.format; |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
419 |
SDL_ShowCursor(0) |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
420 |
end; |
161 | 421 |
|
175 | 422 |
procedure chVol_p(var s: shortstring); |
174 | 423 |
begin |
175 | 424 |
inc(cVolumeDelta, 3) |
174 | 425 |
end; |
426 |
||
175 | 427 |
procedure chVol_m(var s: shortstring); |
174 | 428 |
begin |
175 | 429 |
dec(cVolumeDelta, 3) |
174 | 430 |
end; |
431 |
||
176 | 432 |
procedure chFindhh(var s: shortstring); |
433 |
begin |
|
434 |
if CheckNoTeamOrHH then exit; |
|
435 |
bShowFinger:= true; |
|
436 |
FollowGear:= CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear |
|
437 |
end; |
|
438 |