author | unc0rr |
Mon, 15 Jan 2007 23:25:44 +0000 | |
changeset 344 | a98ade8c99b6 |
parent 307 | 96b428ac11f2 |
child 351 | 29bc9c36ad5f |
permissions | -rw-r--r-- |
4 | 1 |
(* |
2 |
* Hedgewars, a worms-like game |
|
47 | 3 |
* Copyright (c) 2004, 2005, 2006 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 |
unit uGears; |
|
20 |
interface |
|
21 |
uses SDLh, uConsts; |
|
22 |
{$INCLUDE options.inc} |
|
23 |
const AllInactive: boolean = false; |
|
24 |
||
25 |
type PGear = ^TGear; |
|
26 |
TGearStepProcedure = procedure (Gear: PGear); |
|
27 |
TGear = record |
|
28 |
NextGear, PrevGear: PGear; |
|
29 |
Active: Boolean; |
|
188 | 30 |
State : Longword; |
108 | 31 |
X : Double; |
32 |
Y : Double; |
|
33 |
dX: Double; |
|
34 |
dY: Double; |
|
42 | 35 |
Kind: TGearType; |
36 |
Pos: Longword; |
|
4 | 37 |
doStep: TGearStepProcedure; |
53 | 38 |
Radius: integer; |
188 | 39 |
Angle, Power : Longword; |
107 | 40 |
DirAngle: Double; |
4 | 41 |
Timer : LongWord; |
108 | 42 |
Elasticity: Double; |
43 |
Friction : Double; |
|
4 | 44 |
Message : Longword; |
45 |
Hedgehog: pointer; |
|
38 | 46 |
Health, Damage: integer; |
4 | 47 |
CollIndex: Longword; |
6 | 48 |
Tag: integer; |
95 | 49 |
Surf: PSDL_Surface; |
293 | 50 |
Z: Longword; |
4 | 51 |
end; |
52 |
||
188 | 53 |
function AddGear(X, Y: integer; Kind: TGearType; State: Longword; const dX: Double=0.0; dY: Double=0.0; Timer: LongWord=0): PGear; |
4 | 54 |
procedure ProcessGears; |
55 |
procedure SetAllToActive; |
|
56 |
procedure SetAllHHToActive; |
|
57 |
procedure DrawGears(Surface: PSDL_Surface); |
|
58 |
procedure FreeGearsList; |
|
10 | 59 |
procedure AddMiscGears; |
293 | 60 |
procedure AddClouds; |
4 | 61 |
procedure AssignHHCoords; |
294 | 62 |
procedure InsertGearToList(Gear: PGear); |
63 |
procedure RemoveGearFromList(Gear: PGear); |
|
4 | 64 |
|
65 |
var CurAmmoGear: PGear = nil; |
|
68 | 66 |
GearsList: PGear = nil; |
307 | 67 |
KilledHHs: Longword = 0; |
70 | 68 |
|
4 | 69 |
implementation |
81 | 70 |
uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, |
295 | 71 |
uLand, uIO, uLandGraphics, uAIMisc, uLocale, uAI, uAmmos; |
68 | 72 |
var RopePoints: record |
4 | 73 |
Count: Longword; |
74 |
HookAngle: integer; |
|
75 |
ar: array[0..300] of record |
|
107 | 76 |
X, Y: Double; |
77 |
dLen: Double; |
|
4 | 78 |
b: boolean; |
79 |
end; |
|
80 |
end; |
|
307 | 81 |
StepDamage: Longword = 0; |
4 | 82 |
|
83 |
procedure DeleteGear(Gear: PGear); forward; |
|
84 |
procedure doMakeExplosion(X, Y, Radius: integer; Mask: LongWord); forward; |
|
75 | 85 |
procedure AmmoShove(Ammo: PGear; Damage, Power: integer); forward; |
79 | 86 |
procedure AmmoFlameWork(Ammo: PGear); forward; |
17 | 87 |
function CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: integer): PGear; forward; |
15 | 88 |
procedure SpawnBoxOfSmth; forward; |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
24
diff
changeset
|
89 |
procedure AfterAttack; forward; |
70 | 90 |
procedure FindPlace(Gear: PGear; withFall: boolean; Left, Right: integer); forward; |
302 | 91 |
procedure HedgehogStep(Gear: PGear); forward; |
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
92 |
procedure HedgehogChAngle(Gear: PGear); forward; |
4 | 93 |
|
94 |
{$INCLUDE GSHandlers.inc} |
|
95 |
{$INCLUDE HHHandlers.inc} |
|
96 |
||
97 |
const doStepHandlers: array[TGearType] of TGearStepProcedure = ( |
|
98 |
doStepCloud, |
|
99 |
doStepBomb, |
|
100 |
doStepHedgehog, |
|
101 |
doStepGrenade, |
|
102 |
doStepHealthTag, |
|
103 |
doStepGrave, |
|
104 |
doStepUFO, |
|
105 |
doStepShotgunShot, |
|
106 |
doStepPickHammer, |
|
107 |
doStepRope, |
|
9 | 108 |
doStepSmokeTrace, |
10 | 109 |
doStepExplosion, |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
10
diff
changeset
|
110 |
doStepMine, |
37 | 111 |
doStepCase, |
39 | 112 |
doStepDEagleShot, |
49 | 113 |
doStepDynamite, |
78 | 114 |
doStepTeamHealthSorter, |
115 |
doStepBomb, |
|
79 | 116 |
doStepCluster, |
117 |
doStepShover, |
|
82 | 118 |
doStepFlame, |
83 | 119 |
doStepFirePunch, |
120 |
doStepActionTimer, |
|
121 |
doStepActionTimer, |
|
211 | 122 |
doStepActionTimer, |
263 | 123 |
doStepParachute, |
124 |
doStepAirAttack, |
|
302 | 125 |
doStepAirBomb, |
126 |
doStepBlowTorch |
|
4 | 127 |
); |
128 |
||
294 | 129 |
procedure InsertGearToList(Gear: PGear); |
130 |
var tmp: PGear; |
|
131 |
begin |
|
132 |
if GearsList = nil then |
|
133 |
GearsList:= Gear |
|
134 |
else begin |
|
135 |
// WARNING: this code assumes that the first gears added to the list are clouds (have maximal Z) |
|
136 |
tmp:= GearsList; |
|
137 |
while (tmp <> nil) and (tmp.Z < Gear.Z) do |
|
138 |
tmp:= tmp.NextGear; |
|
139 |
||
140 |
if tmp.PrevGear <> nil then tmp.PrevGear.NextGear:= Gear; |
|
141 |
Gear.PrevGear:= tmp.PrevGear; |
|
142 |
tmp.PrevGear:= Gear; |
|
143 |
Gear.NextGear:= tmp; |
|
144 |
if GearsList = tmp then GearsList:= Gear |
|
145 |
end |
|
146 |
end; |
|
147 |
||
148 |
procedure RemoveGearFromList(Gear: PGear); |
|
149 |
begin |
|
150 |
if Gear.NextGear <> nil then Gear.NextGear.PrevGear:= Gear.PrevGear; |
|
151 |
if Gear.PrevGear <> nil then Gear.PrevGear.NextGear:= Gear.NextGear |
|
152 |
else begin |
|
153 |
GearsList:= Gear.NextGear; |
|
154 |
if GearsList <> nil then GearsList.PrevGear:= nil |
|
155 |
end; |
|
156 |
end; |
|
157 |
||
188 | 158 |
function AddGear(X, Y: integer; Kind: TGearType; State: Longword; const dX: Double=0.0; dY: Double=0.0; Timer: LongWord=0): PGear; |
79 | 159 |
const Counter: Longword = 0; |
4 | 160 |
begin |
79 | 161 |
inc(Counter); |
108 | 162 |
{$IFDEF DEBUGFILE}AddFileLog('AddGear: ('+inttostr(x)+','+inttostr(y)+'), d('+floattostr(dX)+','+floattostr(dY)+')');{$ENDIF} |
4 | 163 |
New(Result); |
293 | 164 |
{$IFDEF DEBUGFILE}AddFileLog('AddGear: type = '+inttostr(ord(Kind))+'; handle = '+inttostr(integer(Result)));{$ENDIF} |
4 | 165 |
FillChar(Result^, sizeof(TGear), 0); |
166 |
Result.X:= X; |
|
167 |
Result.Y:= Y; |
|
168 |
Result.Kind := Kind; |
|
169 |
Result.State:= State; |
|
170 |
Result.Active:= true; |
|
171 |
Result.dX:= dX; |
|
172 |
Result.dY:= dY; |
|
173 |
Result.doStep:= doStepHandlers[Kind]; |
|
174 |
Result.CollIndex:= High(Longword); |
|
83 | 175 |
Result.Timer:= Timer; |
4 | 176 |
if CurrentTeam <> nil then |
177 |
Result.Hedgehog:= @CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog]; |
|
178 |
case Kind of |
|
293 | 179 |
gtCloud: Result.Z:= High(Result.Z); |
4 | 180 |
gtAmmo_Bomb: begin |
53 | 181 |
Result.Radius:= 4; |
4 | 182 |
Result.Elasticity:= 0.6; |
183 |
Result.Friction:= 0.995; |
|
184 |
end; |
|
185 |
gtHedgehog: begin |
|
53 | 186 |
Result.Radius:= cHHRadius; |
149 | 187 |
Result.Elasticity:= 0.35; |
70 | 188 |
Result.Friction:= 0.999; |
64 | 189 |
Result.Angle:= cMaxAngle div 2; |
294 | 190 |
Result.Z:= cHHZ; |
4 | 191 |
end; |
192 |
gtAmmo_Grenade: begin |
|
53 | 193 |
Result.Radius:= 4; |
4 | 194 |
end; |
195 |
gtHealthTag: begin |
|
196 |
Result.Timer:= 1500; |
|
293 | 197 |
Result.Z:= 2000; |
4 | 198 |
end; |
199 |
gtGrave: begin |
|
53 | 200 |
Result.Radius:= 10; |
4 | 201 |
Result.Elasticity:= 0.6; |
202 |
end; |
|
203 |
gtUFO: begin |
|
53 | 204 |
Result.Radius:= 5; |
4 | 205 |
Result.Timer:= 500; |
206 |
Result.Elasticity:= 0.9 |
|
207 |
end; |
|
208 |
gtShotgunShot: begin |
|
209 |
Result.Timer:= 900; |
|
53 | 210 |
Result.Radius:= 2 |
4 | 211 |
end; |
212 |
gtPickHammer: begin |
|
53 | 213 |
Result.Radius:= 10; |
4 | 214 |
Result.Timer:= 4000 |
215 |
end; |
|
216 |
gtSmokeTrace: begin |
|
9 | 217 |
Result.X:= Result.X - 16; |
218 |
Result.Y:= Result.Y - 16; |
|
219 |
Result.State:= 8 |
|
4 | 220 |
end; |
221 |
gtRope: begin |
|
53 | 222 |
Result.Radius:= 3; |
4 | 223 |
Result.Friction:= 500; |
224 |
RopePoints.Count:= 0; |
|
225 |
end; |
|
9 | 226 |
gtExplosion: begin |
227 |
Result.X:= Result.X - 25; |
|
228 |
Result.Y:= Result.Y - 25; |
|
229 |
end; |
|
10 | 230 |
gtMine: begin |
53 | 231 |
Result.Radius:= 3; |
10 | 232 |
Result.Elasticity:= 0.55; |
233 |
Result.Friction:= 0.995; |
|
234 |
Result.Timer:= 3000; |
|
235 |
end; |
|
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
10
diff
changeset
|
236 |
gtCase: begin |
75 | 237 |
Result.Radius:= 16; |
145 | 238 |
Result.Elasticity:= 0.4 |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
10
diff
changeset
|
239 |
end; |
37 | 240 |
gtDEagleShot: begin |
53 | 241 |
Result.Radius:= 1; |
242 |
Result.Radius:= 1; |
|
38 | 243 |
Result.Health:= 50 |
37 | 244 |
end; |
39 | 245 |
gtDynamite: begin |
53 | 246 |
Result.Radius:= 3; |
56 | 247 |
Result.Elasticity:= 0.55; |
39 | 248 |
Result.Friction:= 0.03; |
249 |
Result.Timer:= 5000; |
|
250 |
end; |
|
78 | 251 |
gtClusterBomb: begin |
252 |
Result.Radius:= 4; |
|
253 |
Result.Elasticity:= 0.6; |
|
254 |
Result.Friction:= 0.995; |
|
255 |
end; |
|
79 | 256 |
gtFlame: begin |
257 |
Result.Angle:= Counter mod 64; |
|
258 |
Result.Radius:= 1; |
|
259 |
Result.Health:= 2; |
|
260 |
Result.dY:= (getrandom - 0.8) * 0.03; |
|
261 |
Result.dX:= (getrandom - 0.5) * 0.4 |
|
262 |
end; |
|
82 | 263 |
gtFirePunch: begin |
264 |
Result.Radius:= 15; |
|
265 |
Result.Tag:= Y |
|
266 |
end; |
|
302 | 267 |
gtAirBomb: begin |
268 |
Result.Radius:= 10; |
|
269 |
end; |
|
270 |
gtBlowTorch: begin |
|
306 | 271 |
Result.Radius:= cHHRadius; |
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
272 |
Result.Timer:= 7500; |
302 | 273 |
end; |
4 | 274 |
end; |
294 | 275 |
InsertGearToList(Result) |
4 | 276 |
end; |
277 |
||
278 |
procedure DeleteGear(Gear: PGear); |
|
48 | 279 |
var team: PTeam; |
307 | 280 |
t: Longword; |
4 | 281 |
begin |
53 | 282 |
if Gear.CollIndex < High(Longword) then DeleteCI(Gear); |
95 | 283 |
if Gear.Surf <> nil then SDL_FreeSurface(Gear.Surf); |
4 | 284 |
if Gear.Kind = gtHedgehog then |
285 |
if CurAmmoGear <> nil then |
|
286 |
begin |
|
287 |
{$IFDEF DEBUGFILE}AddFileLog('DeleteGear: Sending gm_Destroy, hh handle = '+inttostr(integer(Gear)));{$ENDIF} |
|
288 |
Gear.Message:= gm_Destroy; |
|
289 |
CurAmmoGear.Message:= gm_Destroy; |
|
290 |
exit |
|
47 | 291 |
end else |
292 |
begin |
|
263 | 293 |
if Gear.Y >= cWaterLine then |
307 | 294 |
begin |
295 |
t:= max(Gear.Damage, Gear.Health); |
|
296 |
AddGear(Round(Gear.X), Round(Gear.Y), gtHealthTag, t).Hedgehog:= Gear.Hedgehog; |
|
297 |
inc(StepDamage, t) |
|
298 |
end; |
|
48 | 299 |
team:= PHedgehog(Gear.Hedgehog).Team; |
145 | 300 |
if CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear = Gear then |
301 |
FreeActionsList; // to avoid ThinkThread on drawned gear |
|
263 | 302 |
PHedgehog(Gear.Hedgehog).Gear:= nil; |
307 | 303 |
inc(KilledHHs); |
48 | 304 |
RecountTeamHealth(team); |
47 | 305 |
end; |
95 | 306 |
{$IFDEF DEBUGFILE}AddFileLog('DeleteGear: handle = '+inttostr(integer(Gear)));{$ENDIF} |
82 | 307 |
if CurAmmoGear = Gear then CurAmmoGear:= nil; |
4 | 308 |
if FollowGear = Gear then FollowGear:= nil; |
294 | 309 |
RemoveGearFromList(Gear); |
4 | 310 |
Dispose(Gear) |
311 |
end; |
|
312 |
||
313 |
function CheckNoDamage: boolean; // returns TRUE in case of no damaged hhs |
|
314 |
var Gear: PGear; |
|
315 |
begin |
|
316 |
Result:= true; |
|
317 |
Gear:= GearsList; |
|
318 |
while Gear <> nil do |
|
319 |
begin |
|
320 |
if Gear.Kind = gtHedgehog then |
|
321 |
if Gear.Damage <> 0 then |
|
322 |
begin |
|
323 |
Result:= false; |
|
307 | 324 |
inc(StepDamage, Gear.Damage); |
4 | 325 |
if Gear.Health < Gear.Damage then Gear.Health:= 0 |
326 |
else dec(Gear.Health, Gear.Damage); |
|
293 | 327 |
AddGear(Round(Gear.X), round(Gear.Y) - cHHRadius - 12 - PHedgehog(Gear.Hedgehog)^.HealthTag.h, |
328 |
gtHealthTag, Gear.Damage).Hedgehog:= Gear.Hedgehog; |
|
4 | 329 |
RenderHealth(PHedgehog(Gear.Hedgehog)^); |
47 | 330 |
RecountTeamHealth(PHedgehog(Gear.Hedgehog)^.Team); |
4 | 331 |
|
332 |
Gear.Damage:= 0 |
|
333 |
end; |
|
334 |
Gear:= Gear.NextGear |
|
83 | 335 |
end; |
4 | 336 |
end; |
337 |
||
338 |
procedure ProcessGears; |
|
339 |
const delay: integer = cInactDelay; |
|
92
0c359a7a2356
- Fix win message to appear only after all hedgehogs death
unc0rr
parents:
89
diff
changeset
|
340 |
step: (stDelay, stChDmg, stChWin, stSpawn, stNTurn) = stDelay; |
4 | 341 |
var Gear, t: PGear; |
342 |
{$IFDEF COUNTTICKS} |
|
343 |
tickcntA, tickcntB: LongWord; |
|
344 |
const cntSecTicks: LongWord = 0; |
|
345 |
{$ENDIF} |
|
346 |
begin |
|
347 |
{$IFDEF COUNTTICKS} |
|
348 |
asm |
|
349 |
push eax |
|
350 |
push edx |
|
351 |
rdtsc |
|
352 |
mov tickcntA, eax |
|
353 |
mov tickcntB, edx |
|
354 |
pop edx |
|
355 |
pop eax |
|
356 |
end; |
|
357 |
{$ENDIF} |
|
358 |
AllInactive:= true; |
|
359 |
t:= GearsList; |
|
360 |
while t<>nil do |
|
361 |
begin |
|
362 |
Gear:= t; |
|
363 |
t:= Gear.NextGear; |
|
364 |
if Gear.Active then Gear.doStep(Gear); |
|
365 |
end; |
|
89 | 366 |
|
4 | 367 |
if AllInactive then |
15 | 368 |
case step of |
369 |
stDelay: begin |
|
370 |
dec(delay); |
|
371 |
if delay = 0 then |
|
372 |
begin |
|
373 |
inc(step); |
|
374 |
delay:= cInactDelay |
|
375 |
end |
|
376 |
end; |
|
377 |
stChDmg: if CheckNoDamage then inc(step) else step:= stDelay; |
|
92
0c359a7a2356
- Fix win message to appear only after all hedgehogs death
unc0rr
parents:
89
diff
changeset
|
378 |
stChWin: if not CheckForWin then inc(step) else step:= stDelay; |
15 | 379 |
stSpawn: begin |
380 |
if not isInMultiShoot then SpawnBoxOfSmth; |
|
381 |
inc(step) |
|
382 |
end; |
|
383 |
stNTurn: begin |
|
74 | 384 |
AwareOfExplosion(0, 0, 0); |
15 | 385 |
if isInMultiShoot then isInMultiShoot:= false |
307 | 386 |
else begin |
387 |
with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do |
|
388 |
if MaxStepDamage < StepDamage then MaxStepDamage:= StepDamage; |
|
389 |
StepDamage:= 0; |
|
390 |
ParseCommand('/nextturn'); |
|
391 |
end; |
|
15 | 392 |
step:= Low(step) |
393 |
end; |
|
394 |
end; |
|
395 |
||
4 | 396 |
if TurnTimeLeft > 0 then |
397 |
if CurrentTeam <> nil then |
|
398 |
if CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear <> nil then |
|
399 |
if ((CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear.State and gstAttacking) = 0) |
|
400 |
and not isInMultiShoot then dec(TurnTimeLeft); |
|
74 | 401 |
|
4 | 402 |
inc(GameTicks); |
403 |
{$IFDEF COUNTTICKS} |
|
404 |
asm |
|
405 |
push eax |
|
406 |
push edx |
|
407 |
rdtsc |
|
408 |
sub eax, [tickcntA] |
|
409 |
sbb edx, [tickcntB] |
|
410 |
add [cntSecTicks], eax |
|
411 |
pop edx |
|
412 |
pop eax |
|
413 |
end; |
|
414 |
if (GameTicks and 1023) = 0 then |
|
415 |
begin |
|
416 |
cntTicks:= cntSecTicks shr 10; |
|
417 |
{$IFDEF DEBUGFILE} |
|
418 |
AddFileLog('<' + inttostr(cntTicks) + '>x1024 ticks'); |
|
419 |
{$ENDIF} |
|
420 |
cntSecTicks:= 0 |
|
421 |
end; |
|
422 |
{$ENDIF} |
|
423 |
end; |
|
424 |
||
425 |
procedure SetAllToActive; |
|
426 |
var t: PGear; |
|
427 |
begin |
|
428 |
AllInactive:= false; |
|
429 |
t:= GearsList; |
|
430 |
while t<>nil do |
|
431 |
begin |
|
432 |
t.Active:= true; |
|
433 |
t:= t.NextGear |
|
434 |
end |
|
435 |
end; |
|
436 |
||
437 |
procedure SetAllHHToActive; |
|
438 |
var t: PGear; |
|
439 |
begin |
|
440 |
AllInactive:= false; |
|
441 |
t:= GearsList; |
|
442 |
while t<>nil do |
|
443 |
begin |
|
444 |
if t.Kind = gtHedgehog then t.Active:= true; |
|
445 |
t:= t.NextGear |
|
446 |
end |
|
447 |
end; |
|
448 |
||
292 | 449 |
procedure DrawHH(Gear: PGear; Surface: PSDL_Surface); |
450 |
var t: integer; |
|
451 |
begin |
|
452 |
DrawHedgehog(Round(Gear.X) - 14 + WorldDx, Round(Gear.Y) - 18 + WorldDy, |
|
453 |
hwSign(Gear.dX), 0, |
|
454 |
PHedgehog(Gear.Hedgehog).visStepPos div 2, |
|
455 |
Surface); |
|
456 |
||
457 |
with PHedgehog(Gear.Hedgehog)^ do |
|
458 |
if Gear.State = 0 then |
|
459 |
begin |
|
460 |
t:= round(Gear.Y) - cHHRadius - 10 + WorldDy; |
|
461 |
dec(t, HealthTag.h + 2); |
|
462 |
DrawCentered(round(Gear.X) + WorldDx, t, HealthTag, Surface); |
|
463 |
dec(t, NameTag.h + 2); |
|
464 |
DrawCentered(round(Gear.X) + WorldDx, t, NameTag, Surface); |
|
465 |
dec(t, Team.NameTag.h + 2); |
|
466 |
DrawCentered(round(Gear.X) + WorldDx, t, Team.NameTag, Surface) |
|
467 |
end else // Current hedgehog |
|
468 |
begin |
|
469 |
if bShowFinger and ((Gear.State and gstHHDriven) <> 0) then |
|
470 |
DrawSprite(sprFinger, round(Gear.X) - 16 + WorldDx, round(Gear.Y) - 64 + WorldDy, |
|
471 |
GameTicks div 32 mod 16, Surface); |
|
472 |
if (Gear.State and (gstMoving or gstDrowning or gstFalling)) = 0 then |
|
473 |
if (Gear.State and gstHHThinking) <> 0 then |
|
474 |
DrawGear(sQuestion, Round(Gear.X) - 10 + WorldDx, Round(Gear.Y) - cHHRadius - 34 + WorldDy, Surface) |
|
475 |
else |
|
476 |
if ShowCrosshair and ((Gear.State and gstAttacked) = 0) then |
|
477 |
DrawSurfSprite(Round(Gear.X + hwSign(Gear.dX) * Sin(Gear.Angle*pi/cMaxAngle)*60) + WorldDx - 11, |
|
478 |
Round(Gear.Y - Cos(Gear.Angle*pi/cMaxAngle)*60) + WorldDy - 12, |
|
479 |
24, (18 + hwSign(Gear.dX) * integer(((Gear.Angle * 72 div cMaxAngle) + 1) div 2) mod 18) mod 18, |
|
480 |
Team.CrosshairSurf, Surface); |
|
481 |
end; |
|
482 |
end; |
|
483 |
||
4 | 484 |
procedure DrawGears(Surface: PSDL_Surface); |
485 |
var Gear: PGear; |
|
486 |
i: Longword; |
|
107 | 487 |
roplen: Double; |
4 | 488 |
|
489 |
procedure DrawRopeLine(X1, Y1, X2, Y2: integer); |
|
35 | 490 |
const nodlen = 5; |
491 |
var i, x, y: integer; |
|
107 | 492 |
t, k, ladd: Double; |
4 | 493 |
begin |
37 | 494 |
if (X1 = X2) and (Y1 = Y2) then |
495 |
begin |
|
83 | 496 |
OutError('WARNING: zero length rope line!'); |
37 | 497 |
exit |
498 |
end; |
|
4 | 499 |
if abs(X1 - X2) > abs(Y1 - Y2) then |
500 |
begin |
|
501 |
if X1 > X2 then |
|
502 |
begin |
|
503 |
i:= X1; |
|
504 |
X1:= X2; |
|
505 |
X2:= i; |
|
506 |
i:= Y1; |
|
507 |
Y1:= Y2; |
|
508 |
Y2:= i |
|
509 |
end; |
|
510 |
k:= (Y2 - Y1) / (X2 - X1); |
|
35 | 511 |
ladd:= sqrt(1 + sqr(k)); |
4 | 512 |
if X1 < 0 then |
513 |
begin |
|
514 |
t:= Y1 - 2 - k * X1; |
|
515 |
X1:= 0 |
|
516 |
end else t:= Y1 - 2; |
|
517 |
if X2 > cScreenWidth then X2:= cScreenWidth; |
|
35 | 518 |
for x:= X1 to X2 do |
519 |
begin |
|
520 |
roplen:= roplen + ladd; |
|
521 |
if roplen > nodlen then |
|
522 |
begin |
|
523 |
DrawGear(sRopeNode, x - 2, round(t) - 2, Surface); |
|
524 |
roplen:= roplen - nodlen; |
|
525 |
end; |
|
526 |
t:= t + k; |
|
527 |
end; |
|
4 | 528 |
end else |
529 |
begin |
|
530 |
if Y1 > Y2 then |
|
531 |
begin |
|
532 |
i:= X1; |
|
533 |
X1:= X2; |
|
534 |
X2:= i; |
|
535 |
i:= Y1; |
|
536 |
Y1:= Y2; |
|
537 |
Y2:= i |
|
538 |
end; |
|
539 |
k:= (X2 - X1) / (Y2 - Y1); |
|
35 | 540 |
ladd:= sqrt(1 + sqr(k)); |
4 | 541 |
if Y1 < 0 then |
542 |
begin |
|
543 |
t:= X1 - 2 - k * Y1; |
|
544 |
Y1:= 0 |
|
545 |
end else t:= X1 - 2; |
|
546 |
if Y2 > cScreenHeight then Y2:= cScreenHeight; |
|
35 | 547 |
for y:= Y1 to Y2 do |
548 |
begin |
|
549 |
roplen:= roplen + ladd; |
|
550 |
if roplen > nodlen then |
|
551 |
begin |
|
552 |
DrawGear(sRopeNode, round(t) - 2, y - 2, Surface); |
|
553 |
roplen:= roplen - nodlen; |
|
554 |
end; |
|
555 |
t:= t + k; |
|
556 |
end; |
|
4 | 557 |
end |
558 |
end; |
|
559 |
||
560 |
begin |
|
561 |
Gear:= GearsList; |
|
562 |
while Gear<>nil do |
|
563 |
begin |
|
564 |
case Gear.Kind of |
|
565 |
gtCloud: DrawSprite(sprCloud , Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, Gear.State, Surface); |
|
566 |
gtAmmo_Bomb: DrawSprite(sprBomb , Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, trunc(Gear.DirAngle), Surface); |
|
292 | 567 |
gtHedgehog: DrawHH(Gear, Surface); |
4 | 568 |
gtAmmo_Grenade: DrawSprite(sprGrenade , Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, DxDy2Angle32(Gear.dY, Gear.dX), Surface); |
95 | 569 |
gtHealthTag: if Gear.Surf <> nil then DrawCentered(Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, Gear.Surf, Surface); |
4 | 570 |
gtGrave: DrawSpriteFromRect(PHedgehog(Gear.Hedgehog).Team.GraveRect, Round(Gear.X) + WorldDx - 16, Round(Gear.Y) + WorldDy - 16, 32, (GameTicks shr 7) and 7, Surface); |
571 |
gtUFO: DrawSprite(sprUFO, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, (GameTicks shr 7) mod 4, Surface); |
|
9 | 572 |
gtSmokeTrace: if Gear.State < 8 then DrawSprite(sprSmokeTrace, Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, Gear.State, Surface); |
4 | 573 |
gtRope: begin |
35 | 574 |
roplen:= 0; |
4 | 575 |
if RopePoints.Count > 0 then |
576 |
begin |
|
577 |
i:= 0; |
|
578 |
while i < Pred(RopePoints.Count) do |
|
579 |
begin |
|
580 |
DrawRopeLine(Round(RopePoints.ar[i].X) + WorldDx, Round(RopePoints.ar[i].Y) + WorldDy, |
|
581 |
Round(RopePoints.ar[Succ(i)].X) + WorldDx, Round(RopePoints.ar[Succ(i)].Y) + WorldDy); |
|
582 |
inc(i) |
|
583 |
end; |
|
584 |
DrawRopeLine(Round(RopePoints.ar[i].X) + WorldDx, Round(RopePoints.ar[i].Y) + WorldDy, |
|
585 |
Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy); |
|
35 | 586 |
DrawRopeLine(Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, |
587 |
Round(PHedgehog(Gear.Hedgehog).Gear.X) + WorldDx, Round(PHedgehog(Gear.Hedgehog).Gear.Y) + WorldDy); |
|
4 | 588 |
DrawSprite(sprRopeHook, Round(RopePoints.ar[0].X) + WorldDx - 16, Round(RopePoints.ar[0].Y) + WorldDy - 16, RopePoints.HookAngle, Surface); |
589 |
end else |
|
35 | 590 |
begin |
591 |
DrawRopeLine(Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, |
|
592 |
Round(PHedgehog(Gear.Hedgehog).Gear.X) + WorldDx, Round(PHedgehog(Gear.Hedgehog).Gear.Y) + WorldDy); |
|
4 | 593 |
DrawSprite(sprRopeHook, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, DxDy2Angle32(Gear.dY, Gear.dX), Surface); |
35 | 594 |
end; |
4 | 595 |
end; |
9 | 596 |
gtExplosion: DrawSprite(sprExplosion50, Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, Gear.State, Surface); |
10 | 597 |
gtMine: if ((Gear.State and gstAttacking) = 0)or((Gear.Timer and $3FF) < 420) |
598 |
then DrawSprite(sprMineOff , Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, trunc(Gear.DirAngle), Surface) |
|
599 |
else DrawSprite(sprMineOn , Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, trunc(Gear.DirAngle), Surface); |
|
46 | 600 |
gtDynamite: DrawSprite2(sprDynamite, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 25 + WorldDy, Gear.Tag and 1, Gear.Tag shr 1, Surface); |
42 | 601 |
gtCase: case Gear.Pos of |
602 |
posCaseAmmo : DrawSprite(sprCase, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, 0, Surface); |
|
75 | 603 |
posCaseHealth: DrawSprite(sprFAid, Round(Gear.X) - 24 + WorldDx, Round(Gear.Y) - 24 + WorldDy, (GameTicks shr 6) mod 13, Surface); |
42 | 604 |
end; |
78 | 605 |
gtClusterBomb: DrawSprite(sprClusterBomb, Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, trunc(Gear.DirAngle), Surface); |
606 |
gtCluster: DrawSprite(sprClusterParticle, Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, 0, Surface); |
|
79 | 607 |
gtFlame: DrawSprite(sprFlame, Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy,(GameTicks div 128 + Gear.Angle) mod 8, Surface); |
263 | 608 |
gtAirBomb: DrawSprite(sprAirBomb , Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, DxDy2Angle32(Gear.dY, Gear.dX), Surface); |
283 | 609 |
gtAirAttack: DrawSprite(sprAirplane, Round(Gear.X) - 60 + WorldDx, Round(Gear.Y) - 25 + WorldDy, 0, Surface); |
4 | 610 |
end; |
611 |
Gear:= Gear.NextGear |
|
612 |
end; |
|
613 |
end; |
|
614 |
||
615 |
procedure FreeGearsList; |
|
616 |
var t, tt: PGear; |
|
617 |
begin |
|
618 |
tt:= GearsList; |
|
619 |
GearsList:= nil; |
|
620 |
while tt<>nil do |
|
621 |
begin |
|
622 |
t:= tt; |
|
623 |
tt:= tt.NextGear; |
|
624 |
Dispose(t) |
|
625 |
end; |
|
626 |
end; |
|
627 |
||
10 | 628 |
procedure AddMiscGears; |
70 | 629 |
var i: integer; |
4 | 630 |
begin |
83 | 631 |
AddGear(0, 0, gtATStartGame, 0, 0, 0, 2000); |
22 | 632 |
if (GameFlags and gfForts) = 0 then |
633 |
for i:= 0 to 3 do |
|
70 | 634 |
FindPlace(AddGear(0, 0, gtMine, 0), false, 0, 2048); |
4 | 635 |
end; |
636 |
||
293 | 637 |
procedure AddClouds; |
638 |
var i: integer; |
|
639 |
begin |
|
640 |
for i:= 0 to cCloudsNumber do |
|
641 |
AddGear( - cScreenWidth + i * ((cScreenWidth * 2 + 2304) div cCloudsNumber), -140, gtCloud, random(4), |
|
642 |
(0.5-random)*0.1, ((i mod 2) * 2 - 1) * (0.005 + 0.015*random)) |
|
643 |
end; |
|
644 |
||
4 | 645 |
procedure doMakeExplosion(X, Y, Radius: integer; Mask: LongWord); |
646 |
var Gear: PGear; |
|
647 |
dmg: integer; |
|
648 |
begin |
|
649 |
TargetPoint.X:= NoPointX; |
|
650 |
{$IFDEF DEBUGFILE}if Radius > 3 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');{$ENDIF} |
|
305 | 651 |
if (Mask and EXPLDontDraw) = 0 then DrawExplosion(X, Y, Radius); |
9 | 652 |
if Radius = 50 then AddGear(X, Y, gtExplosion, 0); |
4 | 653 |
if (Mask and EXPLAutoSound)<>0 then PlaySound(sndExplosion); |
654 |
if (Mask and EXPLAllDamageInRadius)=0 then Radius:= Radius shl 1; |
|
655 |
Gear:= GearsList; |
|
656 |
while Gear <> nil do |
|
657 |
begin |
|
658 |
dmg:= Radius - Round(sqrt(sqr(Gear.X - X) + sqr(Gear.Y - Y))); |
|
659 |
if dmg > 0 then |
|
660 |
begin |
|
661 |
dmg:= dmg shr 1; |
|
662 |
case Gear.Kind of |
|
10 | 663 |
gtHedgehog, |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
10
diff
changeset
|
664 |
gtMine, |
79 | 665 |
gtCase, |
666 |
gtFlame: begin |
|
39 | 667 |
if (Mask and EXPLNoDamage) = 0 then inc(Gear.Damage, dmg); |
42 | 668 |
if ((Mask and EXPLDoNotTouchHH) = 0) or (Gear.Kind <> gtHedgehog) then |
669 |
begin |
|
300 | 670 |
Gear.dX:= Gear.dX + (dmg / 200 + cHHKick)* hwSign(Gear.X - X); |
671 |
Gear.dY:= Gear.dY + (dmg / 200 + cHHKick)* hwSign(Gear.Y - Y); |
|
42 | 672 |
Gear.Active:= true; |
673 |
FollowGear:= Gear |
|
674 |
end; |
|
4 | 675 |
end; |
51 | 676 |
gtGrave: begin |
677 |
Gear.dY:= - dmg / 250; |
|
678 |
Gear.Active:= true; |
|
679 |
end; |
|
4 | 680 |
end; |
681 |
end; |
|
682 |
Gear:= Gear.NextGear |
|
80 | 683 |
end; |
684 |
uAIMisc.AwareOfExplosion(0, 0, 0) |
|
4 | 685 |
end; |
686 |
||
75 | 687 |
procedure AmmoShove(Ammo: PGear; Damage, Power: integer); |
53 | 688 |
var t: PGearArray; |
689 |
i: integer; |
|
307 | 690 |
hh: PHedgehog; |
38 | 691 |
begin |
53 | 692 |
t:= CheckGearsCollision(Ammo); |
693 |
i:= t.Count; |
|
307 | 694 |
hh:= Ammo.Hedgehog; |
53 | 695 |
while i > 0 do |
696 |
begin |
|
697 |
dec(i); |
|
79 | 698 |
if (t.ar[i].State and gstNoDamage) = 0 then |
699 |
case t.ar[i].Kind of |
|
53 | 700 |
gtHedgehog, |
701 |
gtMine, |
|
702 |
gtCase: begin |
|
75 | 703 |
inc(t.ar[i].Damage, Damage); |
307 | 704 |
inc(hh.DamageGiven, Damage); |
53 | 705 |
t.ar[i].dX:= Ammo.dX * Power * 0.01; |
706 |
t.ar[i].dY:= Ammo.dY * Power * 0.01; |
|
707 |
t.ar[i].Active:= true; |
|
708 |
DeleteCI(t.ar[i]); |
|
709 |
FollowGear:= t.ar[i] |
|
710 |
end; |
|
711 |
end |
|
126 | 712 |
end; |
713 |
SetAllToActive |
|
38 | 714 |
end; |
715 |
||
4 | 716 |
procedure AssignHHCoords; |
82 | 717 |
var Team: PTeam; |
718 |
i, t: integer; |
|
4 | 719 |
begin |
82 | 720 |
Team:= TeamsList; |
721 |
t:= 0; |
|
722 |
while Team <> nil do |
|
4 | 723 |
begin |
82 | 724 |
for i:= 0 to cMaxHHIndex do |
725 |
with Team.Hedgehogs[i] do |
|
726 |
if Gear <> nil then |
|
727 |
if (GameFlags and gfForts) = 0 then FindPlace(Gear, false, 0, 2048) |
|
728 |
else FindPlace(Gear, false, t, t + 1024); |
|
729 |
inc(t, 1024); |
|
730 |
Team:= Team.Next |
|
4 | 731 |
end |
732 |
end; |
|
733 |
||
15 | 734 |
function CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: integer): PGear; |
10 | 735 |
var t: PGear; |
736 |
begin |
|
737 |
t:= GearsList; |
|
738 |
rX:= sqr(rX); |
|
739 |
rY:= sqr(rY); |
|
740 |
while t <> nil do |
|
741 |
begin |
|
742 |
if (t <> Gear) and (t.Kind = Kind) then |
|
743 |
if sqr(Gear.X - t.X) / rX + sqr(Gear.Y - t.Y) / rY <= 1 then |
|
744 |
begin |
|
15 | 745 |
Result:= t; |
10 | 746 |
exit |
747 |
end; |
|
748 |
t:= t.NextGear |
|
749 |
end; |
|
15 | 750 |
Result:= nil |
751 |
end; |
|
752 |
||
79 | 753 |
procedure AmmoFlameWork(Ammo: PGear); |
754 |
var t: PGear; |
|
755 |
begin |
|
756 |
t:= GearsList; |
|
757 |
while t <> nil do |
|
758 |
begin |
|
759 |
if (t.Kind = gtHedgehog) and (t.Y < Ammo.Y) then |
|
760 |
if sqr(Ammo.X - t.X) + sqr(Ammo.Y - t.Y - cHHRadius) * 2 <= sqr(4) then |
|
761 |
begin |
|
762 |
inc(t.Damage, 5); |
|
763 |
t.dX:= t.dX + (t.X - Ammo.X) * 0.02; |
|
764 |
t.dY:= - 0.25; |
|
765 |
t.Active:= true; |
|
766 |
DeleteCI(t); |
|
767 |
FollowGear:= t |
|
768 |
end; |
|
769 |
t:= t.NextGear |
|
770 |
end; |
|
771 |
end; |
|
772 |
||
16 | 773 |
function CheckGearsNear(mX, mY: integer; Kind: TGearsType; rX, rY: integer): PGear; |
774 |
var t: PGear; |
|
775 |
begin |
|
776 |
t:= GearsList; |
|
777 |
rX:= sqr(rX); |
|
778 |
rY:= sqr(rY); |
|
779 |
while t <> nil do |
|
780 |
begin |
|
781 |
if t.Kind in Kind then |
|
782 |
if sqr(mX - t.X) / rX + sqr(mY - t.Y) / rY <= 1 then |
|
783 |
begin |
|
784 |
Result:= t; |
|
785 |
exit |
|
786 |
end; |
|
787 |
t:= t.NextGear |
|
788 |
end; |
|
789 |
Result:= nil |
|
790 |
end; |
|
791 |
||
792 |
function CountGears(Kind: TGearType): Longword; |
|
793 |
var t: PGear; |
|
794 |
begin |
|
795 |
Result:= 0; |
|
796 |
t:= GearsList; |
|
797 |
while t <> nil do |
|
798 |
begin |
|
799 |
if t.Kind = Kind then inc(Result); |
|
800 |
t:= t.NextGear |
|
801 |
end; |
|
802 |
end; |
|
803 |
||
15 | 804 |
procedure SpawnBoxOfSmth; |
805 |
begin |
|
295 | 806 |
if (CountGears(gtCase) >= 5) or (getrandom(cCaseFactor) <> 0) then exit; |
70 | 807 |
FollowGear:= AddGear(0, 0, gtCase, 0); |
295 | 808 |
case getrandom(2) of |
809 |
0: begin |
|
810 |
FollowGear.Health:= 25; |
|
811 |
FollowGear.Pos:= posCaseHealth |
|
812 |
end; |
|
813 |
1: begin |
|
814 |
FollowGear.Pos:= posCaseAmmo; |
|
815 |
FollowGear.State:= Longword(amMineStrike) |
|
816 |
end; |
|
817 |
end; |
|
70 | 818 |
FindPlace(FollowGear, true, 0, 2048) |
819 |
end; |
|
820 |
||
821 |
procedure FindPlace(Gear: PGear; withFall: boolean; Left, Right: integer); |
|
822 |
||
823 |
function CountNonZeroz(x, y, r: integer): integer; |
|
824 |
var i: integer; |
|
825 |
begin |
|
826 |
Result:= 0; |
|
827 |
if (y and $FFFFFC00) <> 0 then exit; |
|
828 |
for i:= max(x - r, 0) to min(x + r, 2043) do |
|
829 |
if Land[y, i] <> 0 then inc(Result) |
|
830 |
end; |
|
831 |
||
832 |
var fx, x: integer; |
|
833 |
y, sy: integer; |
|
834 |
ar: array[0..512] of TPoint; |
|
835 |
cnt, delta: Longword; |
|
836 |
begin |
|
837 |
fx:= Left + integer(GetRandom(Right - Left)); |
|
838 |
x:= fx; |
|
839 |
delta:= 130; |
|
16 | 840 |
repeat |
70 | 841 |
repeat |
842 |
inc(x, Gear.Radius); |
|
843 |
if x > Right then x:= Left + (x mod (Right - left)); |
|
844 |
cnt:= 0; |
|
845 |
y:= -Gear.Radius * 2; |
|
846 |
while y < 1023 do |
|
16 | 847 |
begin |
70 | 848 |
repeat |
849 |
inc(y, 2); |
|
850 |
until (y > 1023) or (CountNonZeroz(x, y, Gear.Radius - 1) = 0); |
|
851 |
sy:= y; |
|
852 |
repeat |
|
853 |
inc(y); |
|
854 |
until (y > 1023) or (CountNonZeroz(x, y, Gear.Radius - 1) <> 0); |
|
855 |
if (y - sy > Gear.Radius * 2) |
|
856 |
and (y < 1023) |
|
857 |
and (CheckGearsNear(x, y - Gear.Radius, [gtHedgehog, gtMine, gtCase], 110, 110) = nil) then |
|
858 |
begin |
|
859 |
ar[cnt].X:= x; |
|
860 |
if withFall then ar[cnt].Y:= sy + Gear.Radius |
|
861 |
else ar[cnt].Y:= y - Gear.Radius; |
|
862 |
inc(cnt) |
|
863 |
end; |
|
864 |
inc(y, 80) |
|
16 | 865 |
end; |
70 | 866 |
if cnt > 0 then |
867 |
with ar[GetRandom(cnt)] do |
|
868 |
begin |
|
869 |
Gear.X:= x; |
|
870 |
Gear.Y:= y; |
|
871 |
{$IFDEF DEBUGFILE} |
|
872 |
AddFileLog('Assigned Gear ' + inttostr(integer(Gear)) + |
|
873 |
' coordinates (' + inttostr(x) + |
|
874 |
',' + inttostr(y) + ')'); |
|
875 |
{$ENDIF} |
|
876 |
exit |
|
877 |
end |
|
878 |
until (x - Gear.Radius < fx) and (x + Gear.Radius > fx); |
|
879 |
dec(Delta, 20) |
|
880 |
until (Delta < 70); |
|
881 |
OutError('Couldn''t find place for Gear ' + inttostr(integer(Gear)), false); |
|
882 |
DeleteGear(Gear) |
|
10 | 883 |
end; |
884 |
||
4 | 885 |
initialization |
886 |
||
887 |
finalization |
|
95 | 888 |
FreeGearsList; |
4 | 889 |
|
890 |
end. |