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