author | unc0rr |
Wed, 27 Sep 2006 20:52:22 +0000 | |
changeset 175 | d226d976d836 |
parent 174 | 0b2c5b22f644 |
child 176 | 533d03041dcd |
permissions | -rw-r--r-- |
4 | 1 |
(* |
2 |
* Hedgewars, a worms-like game |
|
3 |
* Copyright (c) 2004, 2005 Andrey Korotaev <unC0Rr@gmail.com> |
|
4 |
* |
|
5 |
* Distributed under the terms of the BSD-modified licence: |
|
6 |
* |
|
7 |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
|
8 |
* of this software and associated documentation files (the "Software"), to deal |
|
9 |
* with the Software without restriction, including without limitation the |
|
10 |
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
|
11 |
* sell copies of the Software, and to permit persons to whom the Software is |
|
12 |
* furnished to do so, subject to the following conditions: |
|
13 |
* |
|
14 |
* 1. Redistributions of source code must retain the above copyright notice, |
|
15 |
* this list of conditions and the following disclaimer. |
|
16 |
* 2. Redistributions in binary form must reproduce the above copyright notice, |
|
17 |
* this list of conditions and the following disclaimer in the documentation |
|
18 |
* and/or other materials provided with the distribution. |
|
19 |
* 3. The name of the author may not be used to endorse or promote products |
|
20 |
* derived from this software without specific prior written permission. |
|
21 |
* |
|
22 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
|
23 |
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
24 |
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
|
25 |
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
26 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
|
27 |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
|
28 |
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
|
29 |
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|
30 |
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
|
31 |
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
32 |
*) |
|
33 |
||
34 |
function CheckNoTeamOrHH: boolean; |
|
35 |
begin |
|
36 |
Result:= (CurrentTeam=nil) or (CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear = nil); |
|
37 |
{$IFDEF DEBUGFILE} |
|
38 |
if Result then |
|
39 |
if CurrentTeam = nil then AddFileLog('CONSOLE: CurTeam = nil') |
|
40 |
else AddFileLog('CONSOLE: CurTeam <> nil, Gear = nil') |
|
41 |
{$ENDIF} |
|
42 |
end; |
|
43 |
//////////////////////////////////////////////////////////////////////////////// |
|
44 |
procedure chQuit(var s: shortstring); |
|
45 |
begin |
|
46 |
GameState:= gsExit |
|
47 |
end; |
|
48 |
||
49 |
procedure chAddTeam(var s: shortstring); |
|
145 | 50 |
const TeamsCount: Longword = 0; |
4 | 51 |
begin |
145 | 52 |
if isDeveloperMode then |
53 |
begin |
|
54 |
inc(TeamsCount); |
|
55 |
TryDo(TeamsCount <= 5, 'Too many teams', true); |
|
56 |
AddTeam |
|
57 |
end; |
|
58 |
||
72 | 59 |
if GameType in [gmtDemo, gmtSave] then CurrentTeam.ExtDriven:= true |
4 | 60 |
end; |
61 |
||
62 |
procedure chTeamLocal(var s: shortstring); |
|
63 |
begin |
|
64 |
if not isDeveloperMode then exit; |
|
65 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/rdriven"', true); |
|
66 |
CurrentTeam.ExtDriven:= true |
|
67 |
end; |
|
68 |
||
69 |
procedure chName(var id: shortstring); |
|
70 |
var s: shortstring; |
|
71 |
begin |
|
72 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/name"', true); |
|
73 |
SplitBySpace(id, s); |
|
74 |
if s[1]='"' then Delete(s, 1, 1); |
|
75 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
76 |
if id = 'team' then CurrentTeam.TeamName:= s |
|
83 | 77 |
else if (id[1] = 'h') and (id[2] = 'h') |
78 |
and (id[3] >= '0') and (id[3] <= chr(ord('0')+cMaxHHIndex)) then |
|
4 | 79 |
CurrentTeam.Hedgehogs[byte(id[3])-48].Name:= s |
80 |
else OutError(errmsgUnknownVariable + ' "' + id + '"') |
|
81 |
end; |
|
82 |
||
83 |
procedure chGrave(var s: shortstring); |
|
84 |
begin |
|
85 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/grave"', true); |
|
86 |
if s[1]='"' then Delete(s, 1, 1); |
|
87 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
88 |
CurrentTeam.GraveName:= s |
|
89 |
end; |
|
90 |
||
91 |
procedure chFort(var s: shortstring); |
|
92 |
begin |
|
93 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/grave"', true); |
|
94 |
if s[1]='"' then Delete(s, 1, 1); |
|
95 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
96 |
CurrentTeam.FortName:= s |
|
97 |
end; |
|
98 |
||
99 |
procedure chColor(var id: shortstring); |
|
100 |
var c: integer; |
|
101 |
begin |
|
102 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/color"', true); |
|
103 |
val(id, CurrentTeam.Color, c); |
|
104 |
AdjustColor(CurrentTeam.Color) |
|
105 |
end; |
|
106 |
||
107 |
procedure chAdd(var id: shortstring); |
|
108 |
var s: shortstring; |
|
109 |
c: integer; |
|
110 |
Gear: PGear; |
|
111 |
b: byte; |
|
112 |
begin |
|
113 |
if (not isDeveloperMode)or(CurrentTeam=nil) then exit; |
|
114 |
SplitBySpace(id, s); |
|
115 |
if (id[1]='h')and(id[2]='h')and(id[3]>='0')and(id[3]<='7') then |
|
116 |
begin |
|
117 |
b:= byte(id[3])-48; |
|
118 |
val(s, CurrentTeam.Hedgehogs[b].BotLevel, c); |
|
119 |
Gear:= AddGear(0, 0, gtHedgehog, 0); |
|
120 |
Gear.Hedgehog:= @CurrentTeam.Hedgehogs[b]; |
|
121 |
PHedgehog(Gear.Hedgehog).Team:= CurrentTeam; |
|
122 |
CurrentTeam.Hedgehogs[b].Gear:= Gear |
|
123 |
end |
|
124 |
else OutError(errmsgUnknownVariable + ' "' + id + '"', true) |
|
125 |
end; |
|
126 |
||
127 |
procedure chBind(var id: shortstring); |
|
128 |
var s: shortstring; |
|
129 |
b: integer; |
|
130 |
begin |
|
131 |
if CurrentTeam = nil then exit; |
|
132 |
SplitBySpace(id, s); |
|
133 |
if s[1]='"' then Delete(s, 1, 1); |
|
134 |
if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1); |
|
135 |
b:= KeyNameToCode(id); |
|
136 |
if b = 0 then OutError(errmsgUnknownVariable + ' "' + id + '"') |
|
167 | 137 |
else CurrentTeam.Binds[b]:= s |
4 | 138 |
end; |
139 |
||
140 |
procedure chLeft_p(var s: shortstring); |
|
141 |
begin |
|
142 |
if CheckNoTeamOrHH then exit; |
|
143 |
if not CurrentTeam.ExtDriven then SendIPC('L'); |
|
144 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
145 |
Message:= Message or gm_Left |
|
146 |
end; |
|
147 |
||
148 |
procedure chLeft_m(var s: shortstring); |
|
149 |
begin |
|
150 |
if CheckNoTeamOrHH then exit; |
|
151 |
if not CurrentTeam.ExtDriven then SendIPC('l'); |
|
152 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
153 |
Message:= Message and not gm_Left |
|
154 |
end; |
|
155 |
||
156 |
procedure chRight_p(var s: shortstring); |
|
157 |
begin |
|
158 |
if CheckNoTeamOrHH then exit; |
|
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; |
|
175 |
if not CurrentTeam.ExtDriven then SendIPC('U'); |
|
176 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
177 |
Message:= Message or gm_Up |
|
178 |
end; |
|
179 |
||
180 |
procedure chUp_m(var s: shortstring); |
|
181 |
begin |
|
182 |
if CheckNoTeamOrHH then exit; |
|
183 |
if not CurrentTeam.ExtDriven then SendIPC('u'); |
|
184 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
185 |
Message:= Message and not gm_Up |
|
186 |
end; |
|
187 |
||
188 |
procedure chDown_p(var s: shortstring); |
|
189 |
begin |
|
190 |
if CheckNoTeamOrHH then exit; |
|
191 |
if not CurrentTeam.ExtDriven then SendIPC('D'); |
|
192 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
193 |
Message:= Message or gm_Down |
|
194 |
end; |
|
195 |
||
196 |
procedure chDown_m(var s: shortstring); |
|
197 |
begin |
|
198 |
if CheckNoTeamOrHH then exit; |
|
199 |
if not CurrentTeam.ExtDriven then SendIPC('d'); |
|
200 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
201 |
Message:= Message and not gm_Down |
|
202 |
end; |
|
203 |
||
204 |
procedure chLJump(var s: shortstring); |
|
205 |
begin |
|
206 |
if CheckNoTeamOrHH then exit; |
|
207 |
if not CurrentTeam.ExtDriven then SendIPC('j'); |
|
208 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
209 |
Message:= Message or gm_LJump |
|
210 |
end; |
|
211 |
||
212 |
procedure chHJump(var s: shortstring); |
|
213 |
begin |
|
214 |
if CheckNoTeamOrHH then exit; |
|
215 |
if not CurrentTeam.ExtDriven then SendIPC('J'); |
|
216 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
217 |
Message:= Message or gm_HJump |
|
218 |
end; |
|
219 |
||
220 |
procedure chAttack_p(var s: shortstring); |
|
221 |
begin |
|
222 |
if CheckNoTeamOrHH then exit; |
|
223 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
224 |
begin |
|
225 |
{$IFDEF DEBUGFILE}AddFileLog('/+attack: Gear.State = '+inttostr(State));{$ENDIF} |
|
226 |
if ((State and gstHHDriven)<>0)and((State and (gstAttacked or gstHHChooseTarget or gstMoving)) = 0) then |
|
227 |
begin |
|
228 |
FollowGear:= CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear; |
|
229 |
if not CurrentTeam.ExtDriven then SendIPC('A'); |
|
230 |
Message:= Message or gm_Attack |
|
231 |
end |
|
232 |
end |
|
233 |
end; |
|
234 |
||
235 |
procedure chAttack_m(var s: shortstring); |
|
236 |
begin |
|
237 |
if CheckNoTeamOrHH then exit; |
|
95 | 238 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
4 | 239 |
begin |
95 | 240 |
if not CurrentTeam.ExtDriven and |
241 |
((Message and gm_Attack) <> 0) then SendIPC('a'); |
|
242 |
Message:= Message and not gm_Attack |
|
4 | 243 |
end |
244 |
end; |
|
245 |
||
246 |
procedure chSwitch(var s: shortstring); |
|
247 |
begin |
|
248 |
if CheckNoTeamOrHH then exit; |
|
249 |
if not CurrentTeam.ExtDriven then SendIPC('S'); |
|
250 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
|
251 |
Message:= Message or gm_Switch |
|
252 |
end; |
|
253 |
||
254 |
procedure chNextTurn(var s: shortstring); |
|
255 |
begin |
|
256 |
if AllInactive then |
|
257 |
begin |
|
258 |
if not CurrentTeam.ExtDriven then SendIPC('N'); |
|
259 |
{$IFDEF DEBUGFILE}AddFileLog('Doing SwitchHedgehog: time '+inttostr(GameTicks));{$ENDIF} |
|
260 |
SwitchHedgehog; |
|
261 |
end |
|
262 |
end; |
|
263 |
||
264 |
procedure chSay(var s: shortstring); |
|
265 |
begin |
|
266 |
WriteLnToConsole('> ' + s); |
|
267 |
SendIPC('s'+s) |
|
268 |
end; |
|
269 |
||
270 |
procedure chTimer(var s: shortstring); |
|
271 |
begin |
|
272 |
if (s[0] <> #1) or (s[1] < '1') or (s[1] > '5') or (CurrentTeam = nil) then exit; |
|
273 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do |
|
274 |
if (Ammo[CurSlot, CurAmmo].Propz and ammoprop_Timerable) <> 0 then |
|
275 |
begin |
|
276 |
Ammo[CurSlot, CurAmmo].Timer:= 1000 * (byte(s[1]) - 48); |
|
277 |
with CurrentTeam^ do |
|
70 | 278 |
ApplyAmmoChanges(Hedgehogs[CurrHedgehog]); |
4 | 279 |
if not CurrentTeam.ExtDriven then SendIPC(s); |
280 |
end |
|
281 |
end; |
|
282 |
||
283 |
procedure chSlot(var s: shortstring); |
|
284 |
var slot: LongWord; |
|
285 |
caSlot, caAmmo: PLongword; |
|
286 |
begin |
|
95 | 287 |
if (s[0] <> #1) or CheckNoTeamOrHH then exit; |
4 | 288 |
slot:= byte(s[1]) - 49; |
10 | 289 |
if slot > cMaxSlotIndex then exit; |
4 | 290 |
if not CurrentTeam.ExtDriven then SendIPC(char(byte(s[1]) + 79)); |
291 |
with CurrentTeam^ do |
|
292 |
begin |
|
293 |
with Hedgehogs[CurrHedgehog] do |
|
294 |
begin |
|
295 |
if ((Gear.State and (gstAttacking or gstAttacked)) <> 0) or (AttacksNum > 0) |
|
296 |
or ((Gear.State and gstHHDriven) = 0) then exit; // âî âðåìÿ ñòðåëüáû èñêëþ÷àåò ñìåíó îðóæèÿ |
|
297 |
if CurAmmoGear = nil then begin caSlot:= @CurSlot; caAmmo:= @CurAmmo end |
|
298 |
else begin caSlot:= @AltSlot; caAmmo:= @AltAmmo end; |
|
299 |
if caSlot^ = slot then |
|
300 |
begin |
|
301 |
inc(caAmmo^); |
|
10 | 302 |
if (caAmmo^ > cMaxSlotAmmoIndex) or (Ammo[slot, caAmmo^].Count = 0) then caAmmo^:= 0 |
4 | 303 |
end else |
304 |
if Ammo[slot, 0].Count > 0 then |
|
305 |
begin |
|
306 |
caSlot^:= slot; |
|
307 |
caAmmo^:= 0; |
|
308 |
end; |
|
309 |
end; |
|
70 | 310 |
ApplyAmmoChanges(Hedgehogs[CurrHedgehog]) |
4 | 311 |
end |
312 |
end; |
|
313 |
||
314 |
procedure chPut(var s: shortstring); |
|
315 |
begin |
|
316 |
if CheckNoTeamOrHH then exit; |
|
162 | 317 |
if bShowAmmoMenu then |
318 |
begin |
|
319 |
bSelected:= true; |
|
320 |
exit |
|
321 |
end; |
|
4 | 322 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do |
323 |
if (State and gstHHChooseTarget) <> 0 then |
|
324 |
begin |
|
325 |
isCursorVisible:= false; |
|
326 |
if not CurrentTeam.ExtDriven then |
|
327 |
begin |
|
328 |
SDL_GetMouseState(@TargetPoint.X, @TargetPoint.Y); |
|
329 |
dec(TargetPoint.X, WorldDx); |
|
330 |
dec(TargetPoint.Y, WorldDy); |
|
154
5667e6f38704
Network protocol uses integers in network byte order
unc0rr
parents:
145
diff
changeset
|
331 |
SendIPCXY('p', TargetPoint.X, TargetPoint.Y); |
4 | 332 |
end; |
333 |
State:= State and not gstHHChooseTarget; |
|
95 | 334 |
end else if CurrentTeam.ExtDriven then OutError('got /put while not being in choose target mode', false) |
4 | 335 |
end; |
336 |
||
337 |
procedure chCapture(var s: shortstring); |
|
338 |
begin |
|
339 |
flagMakeCapture:= true |
|
340 |
end; |
|
341 |
||
48 | 342 |
procedure chSkip(var s: shortstring); |
343 |
begin |
|
344 |
if not CurrentTeam.ExtDriven then SendIPC(','); |
|
345 |
TurnTimeLeft:= 0 |
|
346 |
end; |
|
347 |
||
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
348 |
procedure chSetMap(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
349 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
350 |
if isDeveloperMode then |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
351 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
352 |
Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
353 |
InitStepsFlags:= InitStepsFlags or cifMap |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
354 |
end |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
355 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
356 |
|
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
357 |
procedure chSetTheme(var s: shortstring); |
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 |
if isDeveloperMode then |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
360 |
begin |
80 | 361 |
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
|
362 |
InitStepsFlags:= InitStepsFlags or cifTheme |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
363 |
end |
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 |
|
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
366 |
procedure chSetSeed(var s: shortstring); |
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 |
if isDeveloperMode then |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
369 |
begin |
102 | 370 |
SetRandomSeed(s); |
81 | 371 |
cSeed:= 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 cifRandomize |
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 |
|
161 | 376 |
procedure chAmmoMenu(var s: shortstring); |
377 |
begin |
|
378 |
if CheckNoTeamOrHH then exit; |
|
379 |
with CurrentTeam^ do |
|
380 |
with Hedgehogs[CurrHedgehog] do |
|
381 |
begin |
|
162 | 382 |
bSelected:= false; |
161 | 383 |
if bShowAmmoMenu then bShowAmmoMenu:= false |
384 |
else if ((Gear.State and (gstAttacking or gstAttacked)) <> 0) or (AttacksNum > 0) |
|
385 |
or ((Gear.State and gstHHDriven) = 0) then else bShowAmmoMenu:= true |
|
386 |
end |
|
387 |
end; |
|
388 |
||
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
389 |
procedure chFullScr(var s: shortstring); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
390 |
var flags: Longword; |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
391 |
begin |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
392 |
if Length(s) = 0 then cFullScreen:= not cFullScreen |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
393 |
else cFullScreen:= s = '1'; |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
394 |
|
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
395 |
flags:= SDL_HWSURFACE or SDL_DOUBLEBUF or SDL_HWACCEL; |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
396 |
if cFullScreen then flags:= flags or SDL_FULLSCREEN |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
397 |
else SDL_WM_SetCaption('Hedgewars', nil); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
398 |
SDL_FreeSurface(SDLPrimSurface); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
399 |
SDLPrimSurface:= SDL_SetVideoMode(cScreenWidth, cScreenHeight, cBits, flags); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
400 |
TryDo(SDLPrimSurface <> nil, errmsgCreateSurface, true); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
401 |
PixelFormat:= SDLPrimSurface.format; |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
402 |
SDL_ShowCursor(0) |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
403 |
end; |
161 | 404 |
|
175 | 405 |
procedure chVol_p(var s: shortstring); |
174 | 406 |
begin |
175 | 407 |
inc(cVolumeDelta, 3) |
174 | 408 |
end; |
409 |
||
175 | 410 |
procedure chVol_m(var s: shortstring); |
174 | 411 |
begin |
175 | 412 |
dec(cVolumeDelta, 3) |
174 | 413 |
end; |
414 |