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