author | unc0rr |
Sat, 17 Mar 2007 18:17:19 +0000 | |
changeset 498 | 9c8b385dc9a1 |
parent 495 | 62c1c2b4414c |
child 520 | e83dfb7ffead |
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); |
|
102 |
begin |
|
103 |
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/color"', true); |
|
495 | 104 |
val(id, CurrentTeam^.Color); |
351 | 105 |
CurrentTeam^.AdjColor:= CurrentTeam^.Color; |
106 |
AdjustColor(CurrentTeam^.AdjColor) |
|
4 | 107 |
end; |
108 |
||
312 | 109 |
procedure chAddHH(var id: shortstring); |
4 | 110 |
var s: shortstring; |
111 |
Gear: PGear; |
|
112 |
begin |
|
394
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
113 |
if (not isDeveloperMode) or (CurrentTeam = nil) then exit; |
312 | 114 |
with CurrentTeam^ do |
115 |
begin |
|
116 |
SplitBySpace(id, s); |
|
495 | 117 |
val(id, Hedgehogs[HedgehogsNumber].BotLevel); |
498 | 118 |
Gear:= AddGear(0, 0, gtHedgehog, 0, _0, _0, 0); |
351 | 119 |
Gear^.Hedgehog:= @Hedgehogs[HedgehogsNumber]; |
495 | 120 |
val(s, Gear^.Health); |
351 | 121 |
TryDo(Gear^.Health > 0, 'Invalid hedgehog health', true); |
122 |
PHedgehog(Gear^.Hedgehog)^.Team:= CurrentTeam; |
|
394
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
123 |
Hedgehogs[HedgehogsNumber].AmmoStore:= TeamsCount - 1; |
312 | 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) |
431 | 312 |
or ((Gear^.State and gstHHDriven) = 0) then exit; |
313 |
Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump); |
|
4 | 314 |
if CurAmmoGear = nil then begin caSlot:= @CurSlot; caAmmo:= @CurAmmo end |
315 |
else begin caSlot:= @AltSlot; caAmmo:= @AltAmmo end; |
|
316 |
if caSlot^ = slot then |
|
317 |
begin |
|
318 |
inc(caAmmo^); |
|
351 | 319 |
if (caAmmo^ > cMaxSlotAmmoIndex) or (Ammo^[slot, caAmmo^].Count = 0) then caAmmo^:= 0 |
4 | 320 |
end else |
351 | 321 |
if Ammo^[slot, 0].Count > 0 then |
4 | 322 |
begin |
323 |
caSlot^:= slot; |
|
324 |
caAmmo^:= 0; |
|
325 |
end; |
|
326 |
end; |
|
70 | 327 |
ApplyAmmoChanges(Hedgehogs[CurrHedgehog]) |
4 | 328 |
end |
329 |
end; |
|
330 |
||
331 |
procedure chPut(var s: shortstring); |
|
332 |
begin |
|
333 |
if CheckNoTeamOrHH then exit; |
|
162 | 334 |
if bShowAmmoMenu then |
335 |
begin |
|
336 |
bSelected:= true; |
|
337 |
exit |
|
338 |
end; |
|
351 | 339 |
with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^, |
340 |
CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog] do |
|
4 | 341 |
if (State and gstHHChooseTarget) <> 0 then |
342 |
begin |
|
343 |
isCursorVisible:= false; |
|
351 | 344 |
if not CurrentTeam^.ExtDriven then |
4 | 345 |
begin |
346 |
SDL_GetMouseState(@TargetPoint.X, @TargetPoint.Y); |
|
347 |
dec(TargetPoint.X, WorldDx); |
|
348 |
dec(TargetPoint.Y, WorldDy); |
|
154
5667e6f38704
Network protocol uses integers in network byte order
unc0rr
parents:
145
diff
changeset
|
349 |
SendIPCXY('p', TargetPoint.X, TargetPoint.Y); |
4 | 350 |
end; |
351 |
State:= State and not gstHHChooseTarget; |
|
351 | 352 |
if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_AttackingPut) <> 0 then |
263 | 353 |
Message:= Message or gm_Attack; |
351 | 354 |
end else if CurrentTeam^.ExtDriven then OutError('got /put while not being in choose target mode', false) |
4 | 355 |
end; |
356 |
||
357 |
procedure chCapture(var s: shortstring); |
|
358 |
begin |
|
359 |
flagMakeCapture:= true |
|
360 |
end; |
|
361 |
||
48 | 362 |
procedure chSkip(var s: shortstring); |
363 |
begin |
|
351 | 364 |
if not CurrentTeam^.ExtDriven then SendIPC(','); |
48 | 365 |
TurnTimeLeft:= 0 |
366 |
end; |
|
367 |
||
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
368 |
procedure chSetMap(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
369 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
370 |
if isDeveloperMode then |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
371 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
372 |
Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
373 |
InitStepsFlags:= InitStepsFlags or cifMap |
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 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
376 |
|
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
377 |
procedure chSetTheme(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
378 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
379 |
if isDeveloperMode then |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
380 |
begin |
80 | 381 |
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
|
382 |
InitStepsFlags:= InitStepsFlags or cifTheme |
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 |
|
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
386 |
procedure chSetSeed(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
387 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
388 |
if isDeveloperMode then |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
389 |
begin |
102 | 390 |
SetRandomSeed(s); |
81 | 391 |
cSeed:= s; |
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
392 |
InitStepsFlags:= InitStepsFlags or cifRandomize |
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 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
395 |
|
161 | 396 |
procedure chAmmoMenu(var s: shortstring); |
397 |
begin |
|
398 |
if CheckNoTeamOrHH then exit; |
|
399 |
with CurrentTeam^ do |
|
400 |
with Hedgehogs[CurrHedgehog] do |
|
401 |
begin |
|
162 | 402 |
bSelected:= false; |
161 | 403 |
if bShowAmmoMenu then bShowAmmoMenu:= false |
351 | 404 |
else if ((Gear^.State and (gstAttacking or gstAttacked)) <> 0) or (AttacksNum > 0) |
405 |
or ((Gear^.State and gstHHDriven) = 0) then else bShowAmmoMenu:= true |
|
161 | 406 |
end |
407 |
end; |
|
408 |
||
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
409 |
procedure chFullScr(var s: shortstring); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
410 |
var flags: Longword; |
192 | 411 |
{$IFDEF DEBUGFILE} |
412 |
buf: array[byte] of char; |
|
413 |
{$ENDIF} |
|
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
414 |
begin |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
415 |
if Length(s) = 0 then cFullScreen:= not cFullScreen |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
416 |
else cFullScreen:= s = '1'; |
192 | 417 |
|
358 | 418 |
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
|
419 |
if cFullScreen then flags:= flags or SDL_FULLSCREEN |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
420 |
else SDL_WM_SetCaption('Hedgewars', nil); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
421 |
SDL_FreeSurface(SDLPrimSurface); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
422 |
SDLPrimSurface:= SDL_SetVideoMode(cScreenWidth, cScreenHeight, cBits, flags); |
192 | 423 |
|
424 |
{$IFDEF DEBUGFILE} |
|
425 |
AddFileLog('SDL video driver: ' + string(SDL_VideoDriverName(buf, sizeof(buf)))); |
|
426 |
{$ENDIF} |
|
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
427 |
TryDo(SDLPrimSurface <> nil, errmsgCreateSurface, true); |
351 | 428 |
PixelFormat:= SDLPrimSurface^.format |
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
429 |
end; |
161 | 430 |
|
175 | 431 |
procedure chVol_p(var s: shortstring); |
174 | 432 |
begin |
175 | 433 |
inc(cVolumeDelta, 3) |
174 | 434 |
end; |
435 |
||
175 | 436 |
procedure chVol_m(var s: shortstring); |
174 | 437 |
begin |
175 | 438 |
dec(cVolumeDelta, 3) |
174 | 439 |
end; |
440 |
||
176 | 441 |
procedure chFindhh(var s: shortstring); |
442 |
begin |
|
443 |
if CheckNoTeamOrHH then exit; |
|
444 |
bShowFinger:= true; |
|
351 | 445 |
FollowGear:= CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear |
176 | 446 |
end; |
447 |
||
281
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
448 |
procedure chPause(var s: shortstring); |
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
449 |
begin |
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
450 |
isPaused:= not isPaused; |
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
451 |
SDL_ShowCursor(ord(isPaused)) |
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
452 |
end; |