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