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