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