author | displacer |
Fri, 23 Feb 2007 13:15:04 +0000 | |
changeset 484 | 3583f6289eee |
parent 431 | 79ac59673df3 |
child 495 | 62c1c2b4414c |
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) |
431 | 314 |
or ((Gear^.State and gstHHDriven) = 0) then exit; |
315 |
Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump); |
|
4 | 316 |
if CurAmmoGear = nil then begin caSlot:= @CurSlot; caAmmo:= @CurAmmo end |
317 |
else begin caSlot:= @AltSlot; caAmmo:= @AltAmmo end; |
|
318 |
if caSlot^ = slot then |
|
319 |
begin |
|
320 |
inc(caAmmo^); |
|
351 | 321 |
if (caAmmo^ > cMaxSlotAmmoIndex) or (Ammo^[slot, caAmmo^].Count = 0) then caAmmo^:= 0 |
4 | 322 |
end else |
351 | 323 |
if Ammo^[slot, 0].Count > 0 then |
4 | 324 |
begin |
325 |
caSlot^:= slot; |
|
326 |
caAmmo^:= 0; |
|
327 |
end; |
|
328 |
end; |
|
70 | 329 |
ApplyAmmoChanges(Hedgehogs[CurrHedgehog]) |
4 | 330 |
end |
331 |
end; |
|
332 |
||
333 |
procedure chPut(var s: shortstring); |
|
334 |
begin |
|
335 |
if CheckNoTeamOrHH then exit; |
|
162 | 336 |
if bShowAmmoMenu then |
337 |
begin |
|
338 |
bSelected:= true; |
|
339 |
exit |
|
340 |
end; |
|
351 | 341 |
with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^, |
342 |
CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog] do |
|
4 | 343 |
if (State and gstHHChooseTarget) <> 0 then |
344 |
begin |
|
345 |
isCursorVisible:= false; |
|
351 | 346 |
if not CurrentTeam^.ExtDriven then |
4 | 347 |
begin |
348 |
SDL_GetMouseState(@TargetPoint.X, @TargetPoint.Y); |
|
349 |
dec(TargetPoint.X, WorldDx); |
|
350 |
dec(TargetPoint.Y, WorldDy); |
|
154
5667e6f38704
Network protocol uses integers in network byte order
unc0rr
parents:
145
diff
changeset
|
351 |
SendIPCXY('p', TargetPoint.X, TargetPoint.Y); |
4 | 352 |
end; |
353 |
State:= State and not gstHHChooseTarget; |
|
351 | 354 |
if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_AttackingPut) <> 0 then |
263 | 355 |
Message:= Message or gm_Attack; |
351 | 356 |
end else if CurrentTeam^.ExtDriven then OutError('got /put while not being in choose target mode', false) |
4 | 357 |
end; |
358 |
||
359 |
procedure chCapture(var s: shortstring); |
|
360 |
begin |
|
361 |
flagMakeCapture:= true |
|
362 |
end; |
|
363 |
||
48 | 364 |
procedure chSkip(var s: shortstring); |
365 |
begin |
|
351 | 366 |
if not CurrentTeam^.ExtDriven then SendIPC(','); |
48 | 367 |
TurnTimeLeft:= 0 |
368 |
end; |
|
369 |
||
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
370 |
procedure chSetMap(var s: shortstring); |
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 |
if isDeveloperMode then |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
373 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
374 |
Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
375 |
InitStepsFlags:= InitStepsFlags or cifMap |
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 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
378 |
|
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
379 |
procedure chSetTheme(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
380 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
381 |
if isDeveloperMode then |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
382 |
begin |
80 | 383 |
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
|
384 |
InitStepsFlags:= InitStepsFlags or cifTheme |
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 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
387 |
|
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
388 |
procedure chSetSeed(var s: shortstring); |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
389 |
begin |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
390 |
if isDeveloperMode then |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
391 |
begin |
102 | 392 |
SetRandomSeed(s); |
81 | 393 |
cSeed:= s; |
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
394 |
InitStepsFlags:= InitStepsFlags or cifRandomize |
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 |
end; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
48
diff
changeset
|
397 |
|
161 | 398 |
procedure chAmmoMenu(var s: shortstring); |
399 |
begin |
|
400 |
if CheckNoTeamOrHH then exit; |
|
401 |
with CurrentTeam^ do |
|
402 |
with Hedgehogs[CurrHedgehog] do |
|
403 |
begin |
|
162 | 404 |
bSelected:= false; |
161 | 405 |
if bShowAmmoMenu then bShowAmmoMenu:= false |
351 | 406 |
else if ((Gear^.State and (gstAttacking or gstAttacked)) <> 0) or (AttacksNum > 0) |
407 |
or ((Gear^.State and gstHHDriven) = 0) then else bShowAmmoMenu:= true |
|
161 | 408 |
end |
409 |
end; |
|
410 |
||
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
411 |
procedure chFullScr(var s: shortstring); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
412 |
var flags: Longword; |
192 | 413 |
{$IFDEF DEBUGFILE} |
414 |
buf: array[byte] of char; |
|
415 |
{$ENDIF} |
|
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
416 |
begin |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
417 |
if Length(s) = 0 then cFullScreen:= not cFullScreen |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
418 |
else cFullScreen:= s = '1'; |
192 | 419 |
|
358 | 420 |
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
|
421 |
if cFullScreen then flags:= flags or SDL_FULLSCREEN |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
422 |
else SDL_WM_SetCaption('Hedgewars', nil); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
423 |
SDL_FreeSurface(SDLPrimSurface); |
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
424 |
SDLPrimSurface:= SDL_SetVideoMode(cScreenWidth, cScreenHeight, cBits, flags); |
192 | 425 |
|
426 |
{$IFDEF DEBUGFILE} |
|
427 |
AddFileLog('SDL video driver: ' + string(SDL_VideoDriverName(buf, sizeof(buf)))); |
|
428 |
{$ENDIF} |
|
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
429 |
TryDo(SDLPrimSurface <> nil, errmsgCreateSurface, true); |
351 | 430 |
PixelFormat:= SDLPrimSurface^.format |
166
2920ab2bf329
Switching between fullscreen and windowed modes on 'F' key
unc0rr
parents:
162
diff
changeset
|
431 |
end; |
161 | 432 |
|
175 | 433 |
procedure chVol_p(var s: shortstring); |
174 | 434 |
begin |
175 | 435 |
inc(cVolumeDelta, 3) |
174 | 436 |
end; |
437 |
||
175 | 438 |
procedure chVol_m(var s: shortstring); |
174 | 439 |
begin |
175 | 440 |
dec(cVolumeDelta, 3) |
174 | 441 |
end; |
442 |
||
176 | 443 |
procedure chFindhh(var s: shortstring); |
444 |
begin |
|
445 |
if CheckNoTeamOrHH then exit; |
|
446 |
bShowFinger:= true; |
|
351 | 447 |
FollowGear:= CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear |
176 | 448 |
end; |
449 |
||
281
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
450 |
procedure chPause(var s: shortstring); |
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
451 |
begin |
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
452 |
isPaused:= not isPaused; |
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
453 |
SDL_ShowCursor(ord(isPaused)) |
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
263
diff
changeset
|
454 |
end; |