author | unc0rr |
Tue, 23 Sep 2008 06:09:13 +0000 | |
changeset 1285 | 993845ea5c8d |
parent 1284 | 21916b5de218 |
child 1286 | a02a5345b91e |
permissions | -rw-r--r-- |
4 | 1 |
(* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
883 | 3 |
* Copyright (c) 2004-2008 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 |
|
351 | 21 |
uses SDLh, uConsts, uFloat; |
4 | 22 |
{$INCLUDE options.inc} |
23 |
const AllInactive: boolean = false; |
|
868 | 24 |
PrvInactive: boolean = false; |
4 | 25 |
|
26 |
type PGear = ^TGear; |
|
1259 | 27 |
TGearStepProcedure = procedure (Gear: PGear); |
28 |
TGear = record |
|
29 |
NextGear, PrevGear: PGear; |
|
30 |
Active: Boolean; |
|
31 |
Ammo : PAmmo; |
|
32 |
State : Longword; |
|
33 |
X : hwFloat; |
|
34 |
Y : hwFloat; |
|
35 |
dX: hwFloat; |
|
36 |
dY: hwFloat; |
|
37 |
Kind: TGearType; |
|
38 |
Pos: Longword; |
|
39 |
doStep: TGearStepProcedure; |
|
40 |
Radius: LongInt; |
|
41 |
Angle, Power : Longword; |
|
42 |
DirAngle: real; |
|
43 |
Timer : LongWord; |
|
44 |
Elasticity: hwFloat; |
|
45 |
Friction : hwFloat; |
|
46 |
Message, MsgParam : Longword; |
|
47 |
Hedgehog: pointer; |
|
48 |
Health, Damage: LongInt; |
|
49 |
CollisionIndex: LongInt; |
|
50 |
Tag: LongInt; |
|
51 |
Tex: PTexture; |
|
52 |
Z: Longword; |
|
53 |
IntersectGear: PGear; |
|
54 |
TriggerId: Longword; |
|
55 |
end; |
|
4 | 56 |
|
371 | 57 |
function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
4 | 58 |
procedure ProcessGears; |
59 |
procedure SetAllToActive; |
|
60 |
procedure SetAllHHToActive; |
|
956 | 61 |
procedure DrawGears; |
4 | 62 |
procedure FreeGearsList; |
10 | 63 |
procedure AddMiscGears; |
4 | 64 |
procedure AssignHHCoords; |
294 | 65 |
procedure InsertGearToList(Gear: PGear); |
66 |
procedure RemoveGearFromList(Gear: PGear); |
|
4 | 67 |
|
68 |
var CurAmmoGear: PGear = nil; |
|
68 | 69 |
GearsList: PGear = nil; |
307 | 70 |
KilledHHs: Longword = 0; |
70 | 71 |
|
4 | 72 |
implementation |
81 | 73 |
uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, |
1259 | 74 |
uLand, uIO, uLandGraphics, uAIMisc, uLocale, uAI, uAmmos, uTriggers, GL, |
75 |
uStats, uVisualGears; |
|
789 | 76 |
|
1207
ceaab010269e
Some adjusting... it still doesn't solve problem fully
unc0rr
parents:
1200
diff
changeset
|
77 |
const MAXROPEPOINTS = 384; |
68 | 78 |
var RopePoints: record |
4 | 79 |
Count: Longword; |
776
8fc7e59d9cb4
Convert the rest of rotated sprites to be rotated by OpenGL
unc0rr
parents:
775
diff
changeset
|
80 |
HookAngle: GLfloat; |
789 | 81 |
ar: array[0..MAXROPEPOINTS] of record |
351 | 82 |
X, Y: hwFloat; |
83 |
dLen: hwFloat; |
|
4 | 84 |
b: boolean; |
85 |
end; |
|
86 |
end; |
|
87 |
||
88 |
procedure DeleteGear(Gear: PGear); forward; |
|
371 | 89 |
procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord); forward; |
90 |
procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward; |
|
79 | 91 |
procedure AmmoFlameWork(Ammo: PGear); forward; |
371 | 92 |
function CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear; forward; |
15 | 93 |
procedure SpawnBoxOfSmth; forward; |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
24
diff
changeset
|
94 |
procedure AfterAttack; forward; |
371 | 95 |
procedure FindPlace(Gear: PGear; withFall: boolean; Left, Right: LongInt); forward; |
302 | 96 |
procedure HedgehogStep(Gear: PGear); forward; |
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
97 |
procedure HedgehogChAngle(Gear: PGear); forward; |
506 | 98 |
procedure ShotgunShot(Gear: PGear); forward; |
522 | 99 |
procedure AddDamageTag(X, Y, Damage: LongWord; Gear: PGear); forward; |
4 | 100 |
|
101 |
{$INCLUDE GSHandlers.inc} |
|
102 |
{$INCLUDE HHHandlers.inc} |
|
103 |
||
104 |
const doStepHandlers: array[TGearType] of TGearStepProcedure = ( |
|
1259 | 105 |
@doStepBomb, |
106 |
@doStepHedgehog, |
|
107 |
@doStepGrenade, |
|
108 |
@doStepHealthTag, |
|
109 |
@doStepGrave, |
|
110 |
@doStepUFO, |
|
111 |
@doStepShotgunShot, |
|
112 |
@doStepPickHammer, |
|
113 |
@doStepRope, |
|
114 |
@doStepSmokeTrace, |
|
115 |
@doStepExplosion, |
|
116 |
@doStepMine, |
|
117 |
@doStepCase, |
|
118 |
@doStepDEagleShot, |
|
119 |
@doStepDynamite, |
|
120 |
@doStepTeamHealthSorter, |
|
121 |
@doStepBomb, |
|
122 |
@doStepCluster, |
|
123 |
@doStepShover, |
|
124 |
@doStepFlame, |
|
125 |
@doStepFirePunch, |
|
126 |
@doStepActionTimer, |
|
127 |
@doStepActionTimer, |
|
128 |
@doStepActionTimer, |
|
129 |
@doStepParachute, |
|
130 |
@doStepAirAttack, |
|
131 |
@doStepAirBomb, |
|
132 |
@doStepBlowTorch, |
|
133 |
@doStepGirder, |
|
134 |
@doStepTeleport, |
|
135 |
@doStepHealthTag, |
|
136 |
@doStepSwitcher, |
|
137 |
@doStepCase, |
|
138 |
@doStepMortar, |
|
139 |
@doStepWhip, |
|
140 |
@doStepKamikaze, |
|
141 |
@doStepCake, |
|
1261 | 142 |
@doStepSeduction, |
1279 | 143 |
@doStepWatermelon, |
1263 | 144 |
@doStepCluster, |
145 |
@doStepBomb, |
|
146 |
@doStepSmokeTrace |
|
1259 | 147 |
); |
4 | 148 |
|
294 | 149 |
procedure InsertGearToList(Gear: PGear); |
803 | 150 |
var tmp, ptmp: PGear; |
294 | 151 |
begin |
152 |
if GearsList = nil then |
|
153 |
GearsList:= Gear |
|
154 |
else begin |
|
155 |
tmp:= GearsList; |
|
803 | 156 |
ptmp:= GearsList; |
157 |
while (tmp <> nil) and (tmp^.Z <= Gear^.Z) do |
|
158 |
begin |
|
159 |
ptmp:= tmp; |
|
160 |
tmp:= tmp^.NextGear |
|
161 |
end; |
|
294 | 162 |
|
803 | 163 |
if ptmp <> nil then |
164 |
begin |
|
165 |
Gear^.NextGear:= ptmp^.NextGear; |
|
166 |
Gear^.PrevGear:= ptmp; |
|
167 |
if ptmp^.NextGear <> nil then ptmp^.NextGear^.PrevGear:= Gear; |
|
168 |
ptmp^.NextGear:= Gear |
|
169 |
end |
|
170 |
else GearsList:= Gear |
|
294 | 171 |
end |
172 |
end; |
|
173 |
||
174 |
procedure RemoveGearFromList(Gear: PGear); |
|
175 |
begin |
|
351 | 176 |
if Gear^.NextGear <> nil then Gear^.NextGear^.PrevGear:= Gear^.PrevGear; |
177 |
if Gear^.PrevGear <> nil then Gear^.PrevGear^.NextGear:= Gear^.NextGear |
|
809 | 178 |
else GearsList:= Gear^.NextGear |
294 | 179 |
end; |
180 |
||
371 | 181 |
function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
79 | 182 |
const Counter: Longword = 0; |
351 | 183 |
var Result: PGear; |
4 | 184 |
begin |
79 | 185 |
inc(Counter); |
108 | 186 |
{$IFDEF DEBUGFILE}AddFileLog('AddGear: ('+inttostr(x)+','+inttostr(y)+'), d('+floattostr(dX)+','+floattostr(dY)+')');{$ENDIF} |
4 | 187 |
New(Result); |
357 | 188 |
{$IFDEF DEBUGFILE}AddFileLog('AddGear: type = ' + inttostr(ord(Kind)));{$ENDIF} |
4 | 189 |
FillChar(Result^, sizeof(TGear), 0); |
498 | 190 |
Result^.X:= int2hwFloat(X); |
191 |
Result^.Y:= int2hwFloat(Y); |
|
351 | 192 |
Result^.Kind := Kind; |
193 |
Result^.State:= State; |
|
194 |
Result^.Active:= true; |
|
195 |
Result^.dX:= dX; |
|
196 |
Result^.dY:= dY; |
|
197 |
Result^.doStep:= doStepHandlers[Kind]; |
|
511 | 198 |
Result^.CollisionIndex:= -1; |
351 | 199 |
Result^.Timer:= Timer; |
1270 | 200 |
Result^.Z:= cUsualZ; |
505
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
503
diff
changeset
|
201 |
|
4 | 202 |
if CurrentTeam <> nil then |
505
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
503
diff
changeset
|
203 |
begin |
602 | 204 |
Result^.Hedgehog:= CurrentHedgehog; |
205 |
Result^.IntersectGear:= CurrentHedgehog^.Gear |
|
505
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
503
diff
changeset
|
206 |
end; |
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
789
diff
changeset
|
207 |
|
4 | 208 |
case Kind of |
915 | 209 |
gtAmmo_Bomb, |
210 |
gtClusterBomb: begin |
|
351 | 211 |
Result^.Radius:= 4; |
212 |
Result^.Elasticity:= _0_6; |
|
997 | 213 |
Result^.Friction:= _0_96; |
4 | 214 |
end; |
1261 | 215 |
gtWatermelon: begin |
216 |
Result^.Radius:= 4; |
|
217 |
Result^.Elasticity:= _0_8; |
|
218 |
Result^.Friction:= _0_995; |
|
219 |
end; |
|
4 | 220 |
gtHedgehog: begin |
351 | 221 |
Result^.Radius:= cHHRadius; |
222 |
Result^.Elasticity:= _0_35; |
|
223 |
Result^.Friction:= _0_999; |
|
224 |
Result^.Angle:= cMaxAngle div 2; |
|
225 |
Result^.Z:= cHHZ; |
|
4 | 226 |
end; |
227 |
gtAmmo_Grenade: begin |
|
351 | 228 |
Result^.Radius:= 4; |
4 | 229 |
end; |
230 |
gtHealthTag: begin |
|
351 | 231 |
Result^.Timer:= 1500; |
522 | 232 |
Result^.Z:= 2001; |
4 | 233 |
end; |
234 |
gtGrave: begin |
|
351 | 235 |
Result^.Radius:= 10; |
236 |
Result^.Elasticity:= _0_6; |
|
4 | 237 |
end; |
238 |
gtUFO: begin |
|
351 | 239 |
Result^.Radius:= 5; |
240 |
Result^.Timer:= 500; |
|
241 |
Result^.Elasticity:= _0_9 |
|
4 | 242 |
end; |
243 |
gtShotgunShot: begin |
|
351 | 244 |
Result^.Timer:= 900; |
245 |
Result^.Radius:= 2 |
|
4 | 246 |
end; |
247 |
gtPickHammer: begin |
|
351 | 248 |
Result^.Radius:= 10; |
249 |
Result^.Timer:= 4000 |
|
4 | 250 |
end; |
1263 | 251 |
gtSmokeTrace, |
252 |
gtEvilTrace: begin |
|
498 | 253 |
Result^.X:= Result^.X - _16; |
254 |
Result^.Y:= Result^.Y - _16; |
|
1270 | 255 |
Result^.State:= 8; |
256 |
Result^.Z:= cSmokeZ |
|
4 | 257 |
end; |
258 |
gtRope: begin |
|
351 | 259 |
Result^.Radius:= 3; |
498 | 260 |
Result^.Friction:= _450; |
4 | 261 |
RopePoints.Count:= 0; |
262 |
end; |
|
9 | 263 |
gtExplosion: begin |
1012 | 264 |
Result^.X:= Result^.X; |
265 |
Result^.Y:= Result^.Y; |
|
9 | 266 |
end; |
10 | 267 |
gtMine: begin |
503 | 268 |
Result^.State:= Result^.State or gstMoving; |
915 | 269 |
Result^.Radius:= 2; |
351 | 270 |
Result^.Elasticity:= _0_55; |
271 |
Result^.Friction:= _0_995; |
|
272 |
Result^.Timer:= 3000; |
|
10 | 273 |
end; |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
10
diff
changeset
|
274 |
gtCase: begin |
351 | 275 |
Result^.Radius:= 16; |
601
78a68cc4d846
Special game mode allowing the only clan on map for training mode
unc0rr
parents:
595
diff
changeset
|
276 |
Result^.Elasticity:= _0_3 |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
10
diff
changeset
|
277 |
end; |
37 | 278 |
gtDEagleShot: begin |
351 | 279 |
Result^.Radius:= 1; |
280 |
Result^.Health:= 50 |
|
37 | 281 |
end; |
39 | 282 |
gtDynamite: begin |
351 | 283 |
Result^.Radius:= 3; |
284 |
Result^.Elasticity:= _0_55; |
|
285 |
Result^.Friction:= _0_03; |
|
286 |
Result^.Timer:= 5000; |
|
39 | 287 |
end; |
910 | 288 |
gtCluster: Result^.Radius:= 2; |
878 | 289 |
gtShover: Result^.Radius:= 20; |
79 | 290 |
gtFlame: begin |
351 | 291 |
Result^.Angle:= Counter mod 64; |
292 |
Result^.Radius:= 1; |
|
293 |
Result^.Health:= 2; |
|
294 |
Result^.dY:= (getrandom - _0_8) * _0_03; |
|
295 |
Result^.dX:= (getrandom - _0_5) * _0_4 |
|
79 | 296 |
end; |
82 | 297 |
gtFirePunch: begin |
351 | 298 |
Result^.Radius:= 15; |
299 |
Result^.Tag:= Y |
|
82 | 300 |
end; |
302 | 301 |
gtAirBomb: begin |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
302 |
Result^.Radius:= 5; |
302 | 303 |
end; |
304 |
gtBlowTorch: begin |
|
511 | 305 |
Result^.Radius:= cHHRadius + cBlowTorchC; |
351 | 306 |
Result^.Timer:= 7500; |
302 | 307 |
end; |
522 | 308 |
gtSmallDamage: begin |
309 |
Result^.Timer:= 1100; |
|
310 |
Result^.Z:= 2000; |
|
311 |
end; |
|
540 | 312 |
gtSwitcher: begin |
313 |
Result^.Z:= cCurrHHZ |
|
314 |
end; |
|
593 | 315 |
gtTarget: begin |
601
78a68cc4d846
Special game mode allowing the only clan on map for training mode
unc0rr
parents:
595
diff
changeset
|
316 |
Result^.Radius:= 16; |
78a68cc4d846
Special game mode allowing the only clan on map for training mode
unc0rr
parents:
595
diff
changeset
|
317 |
Result^.Elasticity:= _0_3 |
593 | 318 |
end; |
924 | 319 |
gtMortar: begin |
994 | 320 |
Result^.Radius:= 4; |
924 | 321 |
Result^.Elasticity:= _0_2; |
322 |
Result^.Friction:= _0_08 |
|
323 |
end; |
|
925 | 324 |
gtWhip: Result^.Radius:= 20; |
984 | 325 |
gtKamikaze: begin |
326 |
Result^.Health:= 2048; |
|
327 |
Result^.Radius:= 20 |
|
328 |
end; |
|
1089 | 329 |
gtCake: begin |
1261 | 330 |
Result^.Health:= 2048; |
1103 | 331 |
Result^.Radius:= 7; |
1109 | 332 |
Result^.Z:= cOnHHZ; |
1089 | 333 |
if hwSign(dX) > 0 then Result^.Angle:= 1 else Result^.Angle:= 3 |
334 |
end; |
|
1263 | 335 |
gtHellishBomb: begin |
336 |
Result^.Radius:= 4; |
|
337 |
Result^.Elasticity:= _0_5; |
|
338 |
Result^.Friction:= _0_96; |
|
339 |
end; |
|
4 | 340 |
end; |
351 | 341 |
InsertGearToList(Result); |
342 |
AddGear:= Result |
|
4 | 343 |
end; |
344 |
||
345 |
procedure DeleteGear(Gear: PGear); |
|
48 | 346 |
var team: PTeam; |
307 | 347 |
t: Longword; |
4 | 348 |
begin |
503 | 349 |
DeleteCI(Gear); |
762 | 350 |
|
351 |
if Gear^.Tex <> nil then |
|
522 | 352 |
begin |
762 | 353 |
FreeTexture(Gear^.Tex); |
354 |
Gear^.Tex:= nil |
|
522 | 355 |
end; |
762 | 356 |
|
351 | 357 |
if Gear^.Kind = gtHedgehog then |
4 | 358 |
if CurAmmoGear <> nil then |
359 |
begin |
|
351 | 360 |
Gear^.Message:= gm_Destroy; |
361 |
CurAmmoGear^.Message:= gm_Destroy; |
|
4 | 362 |
exit |
47 | 363 |
end else |
364 |
begin |
|
498 | 365 |
if not (hwRound(Gear^.Y) < cWaterLine) then |
307 | 366 |
begin |
351 | 367 |
t:= max(Gear^.Damage, Gear^.Health); |
867 | 368 |
Gear^.Damage:= t; |
498 | 369 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtHealthTag, t, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; |
867 | 370 |
uStats.HedgehogDamaged(Gear) |
307 | 371 |
end; |
351 | 372 |
team:= PHedgehog(Gear^.Hedgehog)^.Team; |
602 | 373 |
if CurrentHedgehog^.Gear = Gear then |
145 | 374 |
FreeActionsList; // to avoid ThinkThread on drawned gear |
351 | 375 |
PHedgehog(Gear^.Hedgehog)^.Gear:= nil; |
307 | 376 |
inc(KilledHHs); |
48 | 377 |
RecountTeamHealth(team); |
47 | 378 |
end; |
357 | 379 |
{$IFDEF DEBUGFILE}AddFileLog('DeleteGear');{$ENDIF} |
595
5ee863f2f568
Triggers PoC: targets are spawned right after the previous damaged
unc0rr
parents:
593
diff
changeset
|
380 |
if Gear^.TriggerId <> 0 then TickTrigger(Gear^.TriggerId); |
82 | 381 |
if CurAmmoGear = Gear then CurAmmoGear:= nil; |
4 | 382 |
if FollowGear = Gear then FollowGear:= nil; |
294 | 383 |
RemoveGearFromList(Gear); |
4 | 384 |
Dispose(Gear) |
385 |
end; |
|
386 |
||
387 |
function CheckNoDamage: boolean; // returns TRUE in case of no damaged hhs |
|
388 |
var Gear: PGear; |
|
389 |
begin |
|
351 | 390 |
CheckNoDamage:= true; |
4 | 391 |
Gear:= GearsList; |
392 |
while Gear <> nil do |
|
867 | 393 |
begin |
394 |
if Gear^.Kind = gtHedgehog then |
|
395 |
if Gear^.Damage <> 0 then |
|
396 |
begin |
|
397 |
CheckNoDamage:= false; |
|
398 |
uStats.HedgehogDamaged(Gear); |
|
351 | 399 |
|
867 | 400 |
if Gear^.Health < Gear^.Damage then |
401 |
Gear^.Health:= 0 |
|
402 |
else |
|
403 |
dec(Gear^.Health, Gear^.Damage); |
|
404 |
||
405 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y) - cHHRadius - 12, |
|
406 |
gtHealthTag, Gear^.Damage, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; |
|
407 |
RenderHealth(PHedgehog(Gear^.Hedgehog)^); |
|
408 |
RecountTeamHealth(PHedgehog(Gear^.Hedgehog)^.Team); |
|
409 |
||
410 |
Gear^.Damage:= 0 |
|
411 |
end; |
|
412 |
Gear:= Gear^.NextGear |
|
413 |
end; |
|
4 | 414 |
end; |
415 |
||
1054 | 416 |
procedure HealthMachine; |
417 |
var Gear: PGear; |
|
418 |
begin |
|
419 |
Gear:= GearsList; |
|
420 |
||
421 |
while Gear <> nil do |
|
422 |
begin |
|
423 |
if Gear^.Kind = gtHedgehog then |
|
424 |
Gear^.Damage:= min(cHealthDecrease, Gear^.Health - 1); |
|
425 |
||
426 |
Gear:= Gear^.NextGear |
|
427 |
end; |
|
428 |
end; |
|
429 |
||
1055
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
430 |
function WaterMachine: boolean; |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
431 |
const |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
432 |
decStep: Longword = 0; |
1070 | 433 |
LastTurn: LongInt = 0; |
1055
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
434 |
var i: LongWord; |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
435 |
begin |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
436 |
if (decStep = 0) and (LastTurn < FinishedTurnsTotal) then |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
437 |
begin |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
438 |
LastTurn:= FinishedTurnsTotal; |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
439 |
decStep:= 40 |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
440 |
end; |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
441 |
|
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
442 |
if decStep <> 0 then |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
443 |
begin |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
444 |
dec(decStep); |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
445 |
dec(cWaterLine); |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
446 |
for i:= 0 to 2047 do |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
447 |
Land[cWaterLine, i]:= 0; |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
448 |
SetAllToActive |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
449 |
end; |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
450 |
|
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
451 |
WaterMachine:= decStep <> 0; |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
452 |
end; |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
453 |
|
522 | 454 |
procedure AddDamageTag(X, Y, Damage: LongWord; Gear: PGear); |
455 |
begin |
|
529 | 456 |
if cAltDamage then |
457 |
AddGear(X, Y, gtSmallDamage, Damage, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; |
|
522 | 458 |
end; |
459 |
||
4 | 460 |
procedure ProcessGears; |
614 | 461 |
const delay: LongWord = 0; |
869 | 462 |
step: (stDelay, stChDmg, stTurnReact, |
1055
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
463 |
stAfterDelay, stChWin, stWater, stHealth, |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
464 |
stSpawn, stNTurn) = stDelay; |
1054 | 465 |
|
4 | 466 |
var Gear, t: PGear; |
467 |
begin |
|
868 | 468 |
PrvInactive:= AllInactive; |
4 | 469 |
AllInactive:= true; |
470 |
t:= GearsList; |
|
1054 | 471 |
while t <> nil do |
4 | 472 |
begin |
473 |
Gear:= t; |
|
351 | 474 |
t:= Gear^.NextGear; |
475 |
if Gear^.Active then Gear^.doStep(Gear); |
|
4 | 476 |
end; |
89 | 477 |
|
4 | 478 |
if AllInactive then |
15 | 479 |
case step of |
480 |
stDelay: begin |
|
481 |
if delay = 0 then |
|
482 |
delay:= cInactDelay |
|
614 | 483 |
else |
484 |
dec(delay); |
|
485 |
||
486 |
if delay = 0 then |
|
487 |
inc(step) |
|
15 | 488 |
end; |
489 |
stChDmg: if CheckNoDamage then inc(step) else step:= stDelay; |
|
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
809
diff
changeset
|
490 |
stTurnReact: begin |
1054 | 491 |
if (not bBetweenTurns) and (not isInMultiShoot) then |
855
8842c71d16bf
- Fix too long delay between shotgun and deagle shots
unc0rr
parents:
854
diff
changeset
|
492 |
begin |
8842c71d16bf
- Fix too long delay between shotgun and deagle shots
unc0rr
parents:
854
diff
changeset
|
493 |
uStats.TurnReaction; |
8842c71d16bf
- Fix too long delay between shotgun and deagle shots
unc0rr
parents:
854
diff
changeset
|
494 |
inc(step) |
8842c71d16bf
- Fix too long delay between shotgun and deagle shots
unc0rr
parents:
854
diff
changeset
|
495 |
end else |
8842c71d16bf
- Fix too long delay between shotgun and deagle shots
unc0rr
parents:
854
diff
changeset
|
496 |
inc(step, 2); |
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
809
diff
changeset
|
497 |
end; |
815 | 498 |
stAfterDelay: begin |
499 |
if delay = 0 then |
|
500 |
delay:= cInactDelay |
|
501 |
else |
|
502 |
dec(delay); |
|
503 |
||
504 |
if delay = 0 then |
|
505 |
inc(step) |
|
506 |
end; |
|
1058
c53c5c4e7b48
- Proper turns counting, split SwitchHedgehog into two functions
unc0rr
parents:
1056
diff
changeset
|
507 |
stChWin: if not CheckForWin then |
c53c5c4e7b48
- Proper turns counting, split SwitchHedgehog into two functions
unc0rr
parents:
1056
diff
changeset
|
508 |
begin |
1064
9e0701c56fb3
Fix another regression arising from splitting switchhedgehog
unc0rr
parents:
1063
diff
changeset
|
509 |
if not (bBetweenTurns or isInMultiShoot) then |
1060 | 510 |
begin |
1061 | 511 |
ParseCommand('/nextturn', true); |
1060 | 512 |
SwitchHedgehog; |
513 |
end; |
|
1058
c53c5c4e7b48
- Proper turns counting, split SwitchHedgehog into two functions
unc0rr
parents:
1056
diff
changeset
|
514 |
inc(step) |
c53c5c4e7b48
- Proper turns counting, split SwitchHedgehog into two functions
unc0rr
parents:
1056
diff
changeset
|
515 |
end else step:= stDelay; |
1055
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
516 |
stWater: begin |
1058
c53c5c4e7b48
- Proper turns counting, split SwitchHedgehog into two functions
unc0rr
parents:
1056
diff
changeset
|
517 |
if TotalRounds = 17 then bWaterRising:= true; |
1055
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
518 |
|
1056 | 519 |
if not bWaterRising then |
520 |
inc(step) |
|
1055
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
521 |
else |
1056 | 522 |
begin |
523 |
if delay = 0 then |
|
524 |
delay:= 17 |
|
525 |
else |
|
526 |
dec(delay); |
|
1055
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
527 |
|
1056 | 528 |
if delay = 0 then |
529 |
if not WaterMachine then inc(step) |
|
530 |
end |
|
1055
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
531 |
end; |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
532 |
stHealth: begin |
1063 | 533 |
if (TotalRounds = 15) and (cHealthDecrease = 0) then |
534 |
begin |
|
535 |
cHealthDecrease:= 5; |
|
536 |
AddCaption(trmsg[sidSuddenDeath], $FFFFFF, capgrpGameState) |
|
537 |
end; |
|
1055
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
538 |
|
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
539 |
if (cHealthDecrease = 0) |
1054 | 540 |
or bBetweenTurns |
541 |
or isInMultiShoot |
|
1058
c53c5c4e7b48
- Proper turns counting, split SwitchHedgehog into two functions
unc0rr
parents:
1056
diff
changeset
|
542 |
or (TotalRounds = 0) then inc(step) |
1054 | 543 |
else begin |
544 |
bBetweenTurns:= true; |
|
545 |
HealthMachine; |
|
546 |
step:= stChDmg |
|
1055
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
547 |
end |
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
548 |
end; |
15 | 549 |
stSpawn: begin |
550 |
if not isInMultiShoot then SpawnBoxOfSmth; |
|
551 |
inc(step) |
|
552 |
end; |
|
553 |
stNTurn: begin |
|
554 |
if isInMultiShoot then isInMultiShoot:= false |
|
307 | 555 |
else begin |
1058
c53c5c4e7b48
- Proper turns counting, split SwitchHedgehog into two functions
unc0rr
parents:
1056
diff
changeset
|
556 |
AfterSwitchHedgehog; |
1054 | 557 |
bBetweenTurns:= false |
307 | 558 |
end; |
15 | 559 |
step:= Low(step) |
560 |
end; |
|
561 |
end; |
|
562 |
||
4 | 563 |
if TurnTimeLeft > 0 then |
870 | 564 |
if CurrentHedgehog^.Gear <> nil then |
565 |
if ((CurrentHedgehog^.Gear^.State and gstAttacking) = 0) |
|
566 |
and not isInMultiShoot then |
|
567 |
begin |
|
568 |
if (TurnTimeLeft = 5000) |
|
569 |
and (CurrentHedgehog^.Gear <> nil) |
|
570 |
and ((CurrentHedgehog^.Gear^.State and gstAttacked) = 0) then PlaySound(sndHurry, false); |
|
571 |
dec(TurnTimeLeft) |
|
572 |
end; |
|
351 | 573 |
|
651 | 574 |
if (not CurrentTeam^.ExtDriven) and |
917 | 575 |
((GameTicks and $FFFF) = $FFFF) then |
576 |
begin |
|
577 |
SendIPCTimeInc; |
|
578 |
inc(hiTicks) // we do not recieve a message for this |
|
579 |
end; |
|
656
6d6d9d7b1054
Fix network game bug caused by recent protocol changes
unc0rr
parents:
651
diff
changeset
|
580 |
|
515 | 581 |
inc(GameTicks) |
4 | 582 |
end; |
583 |
||
584 |
procedure SetAllToActive; |
|
585 |
var t: PGear; |
|
586 |
begin |
|
587 |
AllInactive:= false; |
|
588 |
t:= GearsList; |
|
351 | 589 |
while t <> nil do |
4 | 590 |
begin |
351 | 591 |
t^.Active:= true; |
592 |
t:= t^.NextGear |
|
4 | 593 |
end |
594 |
end; |
|
595 |
||
596 |
procedure SetAllHHToActive; |
|
597 |
var t: PGear; |
|
598 |
begin |
|
599 |
AllInactive:= false; |
|
600 |
t:= GearsList; |
|
351 | 601 |
while t <> nil do |
4 | 602 |
begin |
351 | 603 |
if t^.Kind = gtHedgehog then t^.Active:= true; |
604 |
t:= t^.NextGear |
|
4 | 605 |
end |
606 |
end; |
|
607 |
||
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
608 |
procedure DrawHH(Gear: PGear); |
371 | 609 |
var t: LongInt; |
822 | 610 |
amt: TAmmoType; |
862 | 611 |
hx, hy, m: LongInt; |
612 |
aAngle, dAngle: real; |
|
1253 | 613 |
defaultPos, HatVisible: boolean; |
292 | 614 |
begin |
868 | 615 |
if (Gear^.State and gstHHDeath) <> 0 then |
616 |
begin |
|
617 |
DrawSprite(sprHHDeath, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 26 + WorldDy, Gear^.Pos); |
|
618 |
exit |
|
619 |
end; |
|
1002 | 620 |
|
824 | 621 |
defaultPos:= true; |
1253 | 622 |
HatVisible:= false; |
847 | 623 |
|
1002 | 624 |
if (Gear^.State and gstDrowning) <> 0 then |
625 |
begin |
|
626 |
DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
|
627 |
hwSign(Gear^.dX), |
|
628 |
1, |
|
629 |
7, |
|
630 |
0); |
|
631 |
defaultPos:= false |
|
632 |
end else |
|
633 |
||
1011 | 634 |
if (Gear^.State and gstWinner) <> 0 then |
635 |
begin |
|
636 |
DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
|
637 |
hwSign(Gear^.dX), |
|
638 |
2, |
|
639 |
0, |
|
640 |
0); |
|
641 |
defaultPos:= false |
|
642 |
end else |
|
643 |
||
821
e6c0408b54ed
Use 'regular standing' and 'rope swing' hedgehog sprites
unc0rr
parents:
815
diff
changeset
|
644 |
if (Gear^.State and gstHHDriven) <> 0 then |
966 | 645 |
begin |
1002 | 646 |
hx:= hwRound(Gear^.X) + 1 + 8 * hwSign(Gear^.dX) + WorldDx; |
647 |
hy:= hwRound(Gear^.Y) - 2 + WorldDy; |
|
648 |
aangle:= Gear^.Angle * 180 / cMaxAngle - 90; |
|
874 | 649 |
|
1002 | 650 |
if CurAmmoGear <> nil then |
651 |
begin |
|
652 |
case CurAmmoGear^.Kind of |
|
653 |
gtShotgunShot: if (CurAmmoGear^.State and gstAnimation <> 0) then |
|
654 |
DrawRotated(sprShotgun, hx, hy, hwSign(Gear^.dX), aangle) |
|
655 |
else |
|
656 |
DrawRotated(sprHandShotgun, hx, hy, hwSign(Gear^.dX), aangle); |
|
657 |
gtDEagleShot: DrawRotated(sprDEagle, hx, hy, hwSign(Gear^.dX), aangle); |
|
658 |
gtRope: begin |
|
659 |
if Gear^.X < CurAmmoGear^.X then |
|
660 |
begin |
|
661 |
dAngle:= 0; |
|
662 |
m:= 1 |
|
663 |
end else |
|
664 |
begin |
|
665 |
dAngle:= 180; |
|
666 |
m:= -1 |
|
966 | 667 |
end; |
1002 | 668 |
DrawHedgehog(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, |
669 |
m, |
|
670 |
1, |
|
671 |
0, |
|
672 |
DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + dAngle); |
|
673 |
defaultPos:= false |
|
674 |
end; |
|
675 |
gtBlowTorch: begin |
|
676 |
DrawRotated(sprBlowTorch, hx, hy, hwSign(Gear^.dX), aangle); |
|
677 |
DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
|
678 |
hwSign(Gear^.dX), |
|
679 |
3, |
|
1113 | 680 |
PHedgehog(Gear^.Hedgehog)^.visStepPos div 2, |
1002 | 681 |
0); |
682 |
defaultPos:= false |
|
683 |
end; |
|
684 |
gtShover: DrawRotated(sprHandBaseball, hx, hy, hwSign(Gear^.dX), aangle + 180); |
|
685 |
gtFirePunch: begin |
|
686 |
DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
|
687 |
hwSign(Gear^.dX), |
|
688 |
1, |
|
689 |
4, |
|
690 |
0); |
|
691 |
defaultPos:= false |
|
692 |
end; |
|
693 |
gtPickHammer, |
|
694 |
gtTeleport: defaultPos:= false; |
|
1010 | 695 |
gtWhip: begin |
696 |
DrawRotatedF(sprWhip, |
|
697 |
hwRound(Gear^.X) + 1 + WorldDx, |
|
698 |
hwRound(Gear^.Y) - 3 + WorldDy, |
|
699 |
1, |
|
700 |
hwSign(Gear^.dX), |
|
701 |
0); |
|
702 |
defaultPos:= false |
|
703 |
end; |
|
1002 | 704 |
gtKamikaze: begin |
705 |
if CurAmmoGear^.Pos = 0 then |
|
706 |
DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
|
707 |
hwSign(Gear^.dX), |
|
708 |
1, |
|
709 |
6, |
|
710 |
0) |
|
711 |
else |
|
712 |
DrawRotatedF(sprKamikaze, |
|
713 |
hwRound(Gear^.X) + WorldDx, |
|
714 |
hwRound(Gear^.Y) + WorldDy, |
|
715 |
CurAmmoGear^.Pos - 1, |
|
716 |
1, |
|
717 |
DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
718 |
||
719 |
defaultPos:= false |
|
720 |
end; |
|
721 |
end; |
|
722 |
||
723 |
case CurAmmoGear^.Kind of |
|
724 |
gtShotgunShot, |
|
725 |
gtDEagleShot, |
|
726 |
gtShover: begin |
|
727 |
DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
|
728 |
hwSign(Gear^.dX), |
|
729 |
0, |
|
730 |
4, |
|
731 |
0); |
|
732 |
defaultPos:= false |
|
733 |
end |
|
734 |
end |
|
735 |
end else |
|
876 | 736 |
|
1002 | 737 |
if ((Gear^.State and gstHHJumping) <> 0) then |
738 |
begin |
|
739 |
if ((Gear^.State and gstHHHJump) <> 0) then |
|
740 |
DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
|
741 |
- hwSign(Gear^.dX), |
|
742 |
1, |
|
743 |
1, |
|
744 |
0) |
|
745 |
else |
|
746 |
DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
|
747 |
hwSign(Gear^.dX), |
|
748 |
1, |
|
749 |
1, |
|
750 |
0); |
|
751 |
defaultPos:= false |
|
752 |
end else |
|
874 | 753 |
|
1002 | 754 |
if (Gear^.Message and (gm_Left or gm_Right) <> 0) then |
824 | 755 |
begin |
1002 | 756 |
DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
757 |
hwSign(Gear^.dX), |
|
758 |
0, |
|
759 |
PHedgehog(Gear^.Hedgehog)^.visStepPos div 2, |
|
760 |
0); |
|
1257 | 761 |
defaultPos:= false; |
762 |
HatVisible:= true |
|
1002 | 763 |
end |
764 |
else |
|
765 |
||
1033 | 766 |
if ((Gear^.State and gstAnimation) <> 0) then |
767 |
begin |
|
1034 | 768 |
DrawRotatedF(Wavez[TWave(Gear^.Tag)].Sprite, |
1033 | 769 |
hwRound(Gear^.X) + 1 + WorldDx, |
770 |
hwRound(Gear^.Y) - 3 + WorldDy, |
|
771 |
Gear^.Pos, |
|
772 |
hwSign(Gear^.dX), |
|
773 |
0.0); |
|
774 |
defaultPos:= false |
|
775 |
end |
|
776 |
else |
|
1002 | 777 |
if ((Gear^.State and gstAttacked) = 0) then |
778 |
begin |
|
779 |
amt:= CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].AmmoType; |
|
780 |
case amt of |
|
781 |
amBazooka, |
|
782 |
amMortar: DrawRotated(sprHandBazooka, hx, hy, hwSign(Gear^.dX), aangle); |
|
783 |
amRope: DrawRotated(sprHandRope, hx, hy, hwSign(Gear^.dX), aangle); |
|
784 |
amShotgun: DrawRotated(sprHandShotgun, hx, hy, hwSign(Gear^.dX), aangle); |
|
785 |
amDEagle: DrawRotated(sprHandDEagle, hx, hy, hwSign(Gear^.dX), aangle); |
|
786 |
amBlowTorch: DrawRotated(sprHandBlowTorch, hx, hy, hwSign(Gear^.dX), aangle); |
|
787 |
end; |
|
788 |
||
789 |
case amt of |
|
790 |
amAirAttack, |
|
791 |
amMineStrike: DrawRotated(sprHandAirAttack, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) + WorldDy, hwSign(Gear^.dX), 0); |
|
792 |
amPickHammer: DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
|
793 |
hwSign(Gear^.dX), |
|
794 |
1, |
|
795 |
2, |
|
796 |
0); |
|
797 |
amBlowTorch: DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
|
798 |
hwSign(Gear^.dX), |
|
799 |
1, |
|
800 |
3, |
|
801 |
0); |
|
802 |
amTeleport: DrawRotatedF(sprTeleport, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, 0, hwSign(Gear^.dX), 0); |
|
803 |
amKamikaze: DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
|
804 |
hwSign(Gear^.dX), |
|
805 |
1, |
|
806 |
5, |
|
807 |
0); |
|
1221 | 808 |
amWhip: DrawRotatedF(sprWhip, |
1010 | 809 |
hwRound(Gear^.X) + 1 + WorldDx, |
810 |
hwRound(Gear^.Y) - 3 + WorldDy, |
|
811 |
0, |
|
812 |
hwSign(Gear^.dX), |
|
813 |
0); |
|
1221 | 814 |
amSeduction: DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
815 |
hwSign(Gear^.dX), |
|
816 |
2, |
|
817 |
2, |
|
818 |
0); |
|
1002 | 819 |
else |
822 | 820 |
DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
821 |
hwSign(Gear^.dX), |
|
822 |
0, |
|
1002 | 823 |
4, |
822 | 824 |
0); |
1253 | 825 |
|
826 |
HatVisible:= true; |
|
827 |
with PHedgehog(Gear^.Hedgehog)^ do |
|
828 |
if HatVisibility > 0 then |
|
829 |
DrawTextureF(HatTex, |
|
830 |
HatVisibility, |
|
831 |
hwRound(Gear^.X) + 1 + WorldDx, |
|
832 |
hwRound(Gear^.Y) - 8 + WorldDy, |
|
833 |
0, |
|
834 |
hwSign(Gear^.dX), |
|
835 |
32); |
|
1002 | 836 |
end; |
966 | 837 |
|
1002 | 838 |
case amt of |
839 |
amBaseballBat: DrawRotated(sprHandBaseball, |
|
840 |
hwRound(Gear^.X) + 1 - 4 * hwSign(Gear^.dX) + WorldDx, |
|
841 |
hwRound(Gear^.Y) + 6 + WorldDy, hwSign(Gear^.dX), aangle); |
|
842 |
end; |
|
966 | 843 |
|
1002 | 844 |
defaultPos:= false |
845 |
end |
|
846 |
end else // not gstHHDriven |
|
1012 | 847 |
begin |
1014
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
848 |
if (Gear^.Damage > 0) |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
849 |
and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
850 |
begin |
1012 | 851 |
DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
852 |
hwSign(Gear^.dX), |
|
1014
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
853 |
2, |
1012 | 854 |
1, |
1014
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
855 |
Gear^.DirAngle); |
1012 | 856 |
defaultPos:= false |
1020 | 857 |
end else |
1014
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
858 |
|
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
859 |
if ((Gear^.State and gstHHJumping) <> 0) then |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
860 |
begin |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
861 |
if ((Gear^.State and gstHHHJump) <> 0) then |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
862 |
DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
863 |
- hwSign(Gear^.dX), |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
864 |
1, |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
865 |
1, |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
866 |
0) |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
867 |
else |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
868 |
DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
869 |
hwSign(Gear^.dX), |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
870 |
1, |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
871 |
1, |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
872 |
0); |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
873 |
defaultPos:= false |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
874 |
end; |
1012 | 875 |
end; |
834 | 876 |
|
1251 | 877 |
with PHedgehog(Gear^.Hedgehog)^ do |
970 | 878 |
begin |
1251 | 879 |
if defaultPos then |
880 |
begin |
|
881 |
DrawRotatedF(sprHHIdle, |
|
882 |
hwRound(Gear^.X) + 1 + WorldDx, |
|
883 |
hwRound(Gear^.Y) - 3 + WorldDy, |
|
884 |
(RealTicks div 128 + Gear^.Pos) mod 19, |
|
885 |
hwSign(Gear^.dX), |
|
886 |
0); |
|
1253 | 887 |
HatVisible:= true; |
888 |
end; |
|
889 |
||
890 |
if HatVisible then |
|
1251 | 891 |
if HatVisibility < 1.0 then |
1254 | 892 |
HatVisibility:= HatVisibility + 0.2 |
1253 | 893 |
else |
1251 | 894 |
else |
895 |
if HatVisibility > 0.0 then |
|
1254 | 896 |
HatVisibility:= HatVisibility - 0.2; |
1253 | 897 |
|
1251 | 898 |
if HatVisibility > 0 then |
1255 | 899 |
if DefaultPos then |
900 |
DrawTextureF(HatTex, |
|
901 |
HatVisibility, |
|
902 |
hwRound(Gear^.X) + 1 + WorldDx, |
|
903 |
hwRound(Gear^.Y) - 8 + WorldDy, |
|
904 |
(RealTicks div 128 + Gear^.Pos) mod 19, |
|
905 |
hwSign(Gear^.dX), |
|
906 |
32) |
|
907 |
else |
|
908 |
DrawTextureF(HatTex, |
|
909 |
HatVisibility, |
|
910 |
hwRound(Gear^.X) + 1 + WorldDx, |
|
911 |
hwRound(Gear^.Y) - 8 + WorldDy, |
|
912 |
0, |
|
913 |
hwSign(Gear^.dX), |
|
914 |
32); |
|
970 | 915 |
end; |
292 | 916 |
|
1251 | 917 |
|
351 | 918 |
with PHedgehog(Gear^.Hedgehog)^ do |
994 | 919 |
begin |
1011 | 920 |
if ((Gear^.State and not gstWinner) = 0) |
994 | 921 |
or (bShowFinger and ((Gear^.State and gstHHDriven) <> 0)) then |
958 | 922 |
begin |
976 | 923 |
t:= hwRound(Gear^.Y) - cHHRadius - 12 + WorldDy; |
958 | 924 |
if (cTagsMask and 1) <> 0 then |
925 |
begin |
|
926 |
dec(t, HealthTagTex^.h + 2); |
|
927 |
DrawCentered(hwRound(Gear^.X) + WorldDx, t, HealthTagTex) |
|
928 |
end; |
|
929 |
if (cTagsMask and 2) <> 0 then |
|
930 |
begin |
|
931 |
dec(t, NameTagTex^.h + 2); |
|
932 |
DrawCentered(hwRound(Gear^.X) + WorldDx, t, NameTagTex) |
|
933 |
end; |
|
934 |
if (cTagsMask and 4) <> 0 then |
|
935 |
begin |
|
936 |
dec(t, Team^.NameTagTex^.h + 2); |
|
937 |
DrawCentered(hwRound(Gear^.X) + WorldDx, t, Team^.NameTagTex) |
|
938 |
end |
|
994 | 939 |
end; |
940 |
if (Gear^.State and gstHHDriven) <> 0 then // Current hedgehog |
|
958 | 941 |
begin |
942 |
if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then |
|
943 |
DrawSprite(sprFinger, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 64 + WorldDy, |
|
944 |
GameTicks div 32 mod 16); |
|
821
e6c0408b54ed
Use 'regular standing' and 'rope swing' hedgehog sprites
unc0rr
parents:
815
diff
changeset
|
945 |
|
958 | 946 |
if (Gear^.State and gstDrowning) = 0 then |
947 |
if (Gear^.State and gstHHThinking) <> 0 then |
|
948 |
DrawSprite(sprQuestion, hwRound(Gear^.X) - 10 + WorldDx, hwRound(Gear^.Y) - cHHRadius - 34 + WorldDy, 0) |
|
949 |
else |
|
1033 | 950 |
if ShowCrosshair and ((Gear^.State and (gstAttacked or gstAnimation)) = 0) then |
958 | 951 |
begin |
952 |
if ((Gear^.State and gstHHHJump) <> 0) then m:= -1 else m:= 1; |
|
953 |
DrawRotatedTex(Team^.CrosshairTex, |
|
954 |
12, 12, |
|
1283
a1e99d1e4fd3
Enable back the ability to see chosen team color in team widget
unc0rr
parents:
1279
diff
changeset
|
955 |
Round(hwRound(Gear^.X) + hwSign(Gear^.dX) * m * Sin(Gear^.Angle*pi/cMaxAngle) * 80) + WorldDx, |
a1e99d1e4fd3
Enable back the ability to see chosen team color in team widget
unc0rr
parents:
1279
diff
changeset
|
956 |
Round(hwRound(Gear^.Y) - Cos(Gear^.Angle*pi/cMaxAngle) * 80) + WorldDy, 0, |
958 | 957 |
hwSign(Gear^.dX) * (Gear^.Angle * 180.0) / cMaxAngle) |
958 |
end |
|
994 | 959 |
end |
960 |
end |
|
292 | 961 |
end; |
962 |
||
956 | 963 |
procedure DrawGears; |
853 | 964 |
var Gear, HHGear: PGear; |
4 | 965 |
i: Longword; |
371 | 966 |
roplen: LongInt; |
4 | 967 |
|
371 | 968 |
procedure DrawRopeLine(X1, Y1, X2, Y2: LongInt); |
969 |
var eX, eY, dX, dY: LongInt; |
|
970 |
i, sX, sY, x, y, d: LongInt; |
|
366 | 971 |
b: boolean; |
4 | 972 |
begin |
37 | 973 |
if (X1 = X2) and (Y1 = Y2) then |
974 |
begin |
|
351 | 975 |
OutError('WARNING: zero length rope line!', false); |
37 | 976 |
exit |
977 |
end; |
|
366 | 978 |
eX:= 0; |
979 |
eY:= 0; |
|
980 |
dX:= X2 - X1; |
|
981 |
dY:= Y2 - Y1; |
|
982 |
||
983 |
if (dX > 0) then sX:= 1 |
|
984 |
else |
|
985 |
if (dX < 0) then |
|
986 |
begin |
|
987 |
sX:= -1; |
|
988 |
dX:= -dX |
|
989 |
end else sX:= dX; |
|
990 |
||
991 |
if (dY > 0) then sY:= 1 |
|
992 |
else |
|
993 |
if (dY < 0) then |
|
4 | 994 |
begin |
366 | 995 |
sY:= -1; |
996 |
dY:= -dY |
|
997 |
end else sY:= dY; |
|
998 |
||
999 |
if (dX > dY) then d:= dX |
|
1000 |
else d:= dY; |
|
1001 |
||
1002 |
x:= X1; |
|
1003 |
y:= Y1; |
|
1004 |
||
1005 |
for i:= 0 to d do |
|
1006 |
begin |
|
1007 |
inc(eX, dX); |
|
1008 |
inc(eY, dY); |
|
1009 |
b:= false; |
|
1010 |
if (eX > d) then |
|
35 | 1011 |
begin |
366 | 1012 |
dec(eX, d); |
1013 |
inc(x, sX); |
|
1014 |
b:= true |
|
35 | 1015 |
end; |
366 | 1016 |
if (eY > d) then |
35 | 1017 |
begin |
366 | 1018 |
dec(eY, d); |
1019 |
inc(y, sY); |
|
1020 |
b:= true |
|
35 | 1021 |
end; |
366 | 1022 |
if b then |
1023 |
begin |
|
1024 |
inc(roplen); |
|
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1025 |
if (roplen mod 4) = 0 then DrawSprite(sprRopeNode, x - 2, y - 2, 0) |
366 | 1026 |
end |
4 | 1027 |
end |
366 | 1028 |
end; |
4 | 1029 |
|
1030 |
begin |
|
1031 |
Gear:= GearsList; |
|
1032 |
while Gear<>nil do |
|
1033 |
begin |
|
351 | 1034 |
case Gear^.Kind of |
822 | 1035 |
gtAmmo_Bomb: DrawRotated(sprBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1036 |
gtHedgehog: DrawHH(Gear); |
822 | 1037 |
gtAmmo_Grenade: DrawRotated(sprGrenade, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
522 | 1038 |
gtHealthTag, |
762 | 1039 |
gtSmallDamage: if Gear^.Tex <> nil then DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex); |
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1040 |
gtGrave: DrawSurfSprite(hwRound(Gear^.X) + WorldDx - 16, hwRound(Gear^.Y) + WorldDy - 16, 32, (GameTicks shr 7) and 7, PHedgehog(Gear^.Hedgehog)^.Team^.GraveTex); |
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1041 |
gtUFO: DrawSprite(sprUFO, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, (GameTicks shr 7) mod 4); |
848 | 1042 |
gtPickHammer: DrawSprite(sprPHammer, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 50 + LongInt(((GameTicks shr 5) and 1) * 2) + WorldDy, 0); |
4 | 1043 |
gtRope: begin |
35 | 1044 |
roplen:= 0; |
4 | 1045 |
if RopePoints.Count > 0 then |
1046 |
begin |
|
1047 |
i:= 0; |
|
1048 |
while i < Pred(RopePoints.Count) do |
|
1049 |
begin |
|
351 | 1050 |
DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy, |
1051 |
hwRound(RopePoints.ar[Succ(i)].X) + WorldDx, hwRound(RopePoints.ar[Succ(i)].Y) + WorldDy); |
|
4 | 1052 |
inc(i) |
1053 |
end; |
|
351 | 1054 |
DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy, |
1055 |
hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy); |
|
1056 |
DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, |
|
1057 |
hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X) + WorldDx, hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y) + WorldDy); |
|
822 | 1058 |
DrawRotated(sprRopeHook, hwRound(RopePoints.ar[0].X) + WorldDx, hwRound(RopePoints.ar[0].Y) + WorldDy, 1, RopePoints.HookAngle) |
4 | 1059 |
end else |
35 | 1060 |
begin |
351 | 1061 |
DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, |
1062 |
hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X) + WorldDx, hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y) + WorldDy); |
|
822 | 1063 |
DrawRotated(sprRopeHook, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
35 | 1064 |
end; |
4 | 1065 |
end; |
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1066 |
gtSmokeTrace: if Gear^.State < 8 then DrawSprite(sprSmokeTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State); |
1012 | 1067 |
gtExplosion: DrawSprite(sprExplosion50, hwRound(Gear^.X) - 32 + WorldDx, hwRound(Gear^.Y) - 32 + WorldDy, Gear^.State); |
351 | 1068 |
gtMine: if ((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420) |
822 | 1069 |
then DrawRotated(sprMineOff, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle) |
1070 |
else DrawRotated(sprMineOn, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
|
351 | 1071 |
gtCase: case Gear^.Pos of |
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1072 |
posCaseAmmo : DrawSprite(sprCase, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, 0); |
1009 | 1073 |
posCaseHealth: begin |
1074 |
i:= (GameTicks shr 6) mod 64; |
|
1075 |
if i > 12 then i:= 0; |
|
1076 |
DrawSprite(sprFAid, hwRound(Gear^.X) - 24 + WorldDx, hwRound(Gear^.Y) - 24 + WorldDy, i); |
|
1077 |
end; |
|
42 | 1078 |
end; |
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1079 |
gtDynamite: DrawSprite2(sprDynamite, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 25 + WorldDy, Gear^.Tag and 1, Gear^.Tag shr 1); |
822 | 1080 |
gtClusterBomb: DrawRotated(sprClusterBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1081 |
gtCluster: DrawSprite(sprClusterParticle, hwRound(Gear^.X) - 8 + WorldDx, hwRound(Gear^.Y) - 8 + WorldDy, 0); |
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1082 |
gtFlame: DrawSprite(sprFlame, hwRound(Gear^.X) - 8 + WorldDx, hwRound(Gear^.Y) - 8 + WorldDy,(GameTicks div 128 + Gear^.Angle) mod 8); |
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1083 |
gtParachute: DrawSprite(sprParachute, hwRound(Gear^.X) - 24 + WorldDx, hwRound(Gear^.Y) - 48 + WorldDy, 0); |
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1084 |
gtAirAttack: if Gear^.Tag > 0 then DrawSprite(sprAirplane, hwRound(Gear^.X) - 60 + WorldDx, hwRound(Gear^.Y) - 25 + WorldDy, 0) |
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1085 |
else DrawSprite(sprAirplane, hwRound(Gear^.X) - 60 + WorldDx, hwRound(Gear^.Y) - 25 + WorldDy, 1); |
822 | 1086 |
gtAirBomb: DrawRotated(sprAirBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
853 | 1087 |
gtTeleport: begin |
1088 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1089 |
DrawRotatedF(sprTeleport, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, Gear^.Pos, hwSign(HHGear^.dX), 0); |
|
1090 |
DrawRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0); |
|
1091 |
end; |
|
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1092 |
gtSwitcher: DrawSprite(sprSwitch, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 56 + WorldDy, (GameTicks shr 6) mod 12); |
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1093 |
gtTarget: DrawSprite(sprTarget, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, 0); |
959 | 1094 |
gtMortar: DrawRotated(sprMortar, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1108 | 1095 |
gtCake: if Gear^.Pos = 6 then |
1096 |
DrawRotatedf(sprCakeWalk, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, (GameTicks div 40) mod 6, hwSign(Gear^.dX), Gear^.DirAngle + hwSign(Gear^.dX) * 90) |
|
1097 |
else |
|
1262 | 1098 |
DrawRotatedf(sprCakeDown, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 5 - Gear^.Pos, hwSign(Gear^.dX), 0); |
1285 | 1099 |
gtSeduction: DrawSprite(sprSeduction, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, 0); |
1262 | 1100 |
gtWatermelon: DrawRotatedf(sprWatermelon, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 0, Gear^.DirAngle); |
1101 |
gtMelonPiece: DrawRotatedf(sprWatermelon, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 1, 0, Gear^.DirAngle); |
|
1263 | 1102 |
gtHellishBomb: DrawRotated(sprHellishBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
1103 |
gtEvilTrace: if Gear^.State < 8 then DrawSprite(sprEvilTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State); |
|
1104 |
end; |
|
351 | 1105 |
Gear:= Gear^.NextGear |
4 | 1106 |
end; |
1107 |
end; |
|
1108 |
||
1109 |
procedure FreeGearsList; |
|
1110 |
var t, tt: PGear; |
|
1111 |
begin |
|
1112 |
tt:= GearsList; |
|
1113 |
GearsList:= nil; |
|
1114 |
while tt<>nil do |
|
1115 |
begin |
|
1116 |
t:= tt; |
|
351 | 1117 |
tt:= tt^.NextGear; |
4 | 1118 |
Dispose(t) |
1119 |
end; |
|
1120 |
end; |
|
1121 |
||
10 | 1122 |
procedure AddMiscGears; |
371 | 1123 |
var i: LongInt; |
4 | 1124 |
begin |
498 | 1125 |
AddGear(0, 0, gtATStartGame, 0, _0, _0, 2000); |
22 | 1126 |
if (GameFlags and gfForts) = 0 then |
622 | 1127 |
for i:= 0 to Pred(cLandAdditions) do |
498 | 1128 |
FindPlace(AddGear(0, 0, gtMine, 0, _0, _0, 0), false, 0, 2048); |
4 | 1129 |
end; |
1130 |
||
371 | 1131 |
procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord); |
4 | 1132 |
var Gear: PGear; |
506 | 1133 |
dmg, dmgRadius: LongInt; |
4 | 1134 |
begin |
1135 |
TargetPoint.X:= NoPointX; |
|
1136 |
{$IFDEF DEBUGFILE}if Radius > 3 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');{$ENDIF} |
|
1049 | 1137 |
if (Radius > 10) then AddGear(X, Y, gtExplosion, 0, _0, _0, 0); |
355 | 1138 |
if (Mask and EXPLAutoSound) <> 0 then PlaySound(sndExplosion, false); |
506 | 1139 |
if (Mask and EXPLAllDamageInRadius)=0 then dmgRadius:= Radius shl 1 |
1140 |
else dmgRadius:= Radius; |
|
4 | 1141 |
Gear:= GearsList; |
1142 |
while Gear <> nil do |
|
1200 | 1143 |
begin |
1144 |
dmg:= dmgRadius + cHHRadius div 2 - hwRound(Distance(Gear^.X - int2hwFloat(X), Gear^.Y - int2hwFloat(Y))); |
|
1145 |
if (dmg > 1) and |
|
1146 |
((Gear^.State and gstNoDamage) = 0) then |
|
1147 |
begin |
|
1148 |
dmg:= min(dmg div 2, Radius); |
|
1149 |
case Gear^.Kind of |
|
1150 |
gtHedgehog, |
|
1151 |
gtMine, |
|
1152 |
gtCase, |
|
1153 |
gtTarget, |
|
1154 |
gtFlame: begin |
|
1155 |
{$IFDEF DEBUGFILE}AddFileLog('Damage: ' + inttostr(dmg));{$ENDIF} |
|
1156 |
if (Mask and EXPLNoDamage) = 0 then |
|
1157 |
begin |
|
1158 |
inc(Gear^.Damage, dmg); |
|
1159 |
if Gear^.Kind = gtHedgehog then |
|
1160 |
AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), dmg, Gear) |
|
1161 |
end; |
|
1162 |
if ((Mask and EXPLDoNotTouchHH) = 0) or (Gear^.Kind <> gtHedgehog) then |
|
1163 |
begin |
|
1164 |
DeleteCI(Gear); |
|
1165 |
Gear^.dX:= Gear^.dX + SignAs(_0_005 * dmg + cHHKick, Gear^.X - int2hwFloat(X)); |
|
1166 |
Gear^.dY:= Gear^.dY + SignAs(_0_005 * dmg + cHHKick, Gear^.Y - int2hwFloat(Y)); |
|
1167 |
Gear^.State:= (Gear^.State or gstMoving) and (not gstWinner); |
|
1168 |
Gear^.Active:= true; |
|
1169 |
FollowGear:= Gear |
|
1170 |
end; |
|
1171 |
end; |
|
1172 |
gtGrave: begin |
|
1173 |
Gear^.dY:= - _0_004 * dmg; |
|
1174 |
Gear^.Active:= true; |
|
1175 |
end; |
|
1176 |
end; |
|
1177 |
end; |
|
1178 |
Gear:= Gear^.NextGear |
|
1179 |
end; |
|
1180 |
||
621 | 1181 |
if (Mask and EXPLDontDraw) = 0 then |
1200 | 1182 |
if (GameFlags and gfSolidLand) = 0 then DrawExplosion(X, Y, Radius); |
1183 |
||
498 | 1184 |
uAIMisc.AwareOfExplosion(0, 0, 0) |
4 | 1185 |
end; |
1186 |
||
506 | 1187 |
procedure ShotgunShot(Gear: PGear); |
1188 |
var t: PGear; |
|
955 | 1189 |
dmg: LongInt; |
506 | 1190 |
begin |
509 | 1191 |
Gear^.Radius:= cShotgunRadius; |
506 | 1192 |
t:= GearsList; |
1193 |
while t <> nil do |
|
1194 |
begin |
|
1195 |
dmg:= min(Gear^.Radius + t^.Radius - hwRound(Distance(Gear^.X - t^.X, Gear^.Y - t^.Y)), 25); |
|
538 | 1196 |
if dmg > 0 then |
506 | 1197 |
case t^.Kind of |
1198 |
gtHedgehog, |
|
1199 |
gtMine, |
|
593 | 1200 |
gtCase, |
1201 |
gtTarget: begin |
|
506 | 1202 |
inc(t^.Damage, dmg); |
867 | 1203 |
|
522 | 1204 |
if t^.Kind = gtHedgehog then |
531 | 1205 |
AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), dmg, t); |
867 | 1206 |
|
506 | 1207 |
DeleteCI(t); |
856 | 1208 |
t^.dX:= t^.dX + Gear^.dX * dmg * _0_01 + SignAs(cHHKick, Gear^.dX); |
506 | 1209 |
t^.dY:= t^.dY + Gear^.dY * dmg * _0_01; |
1210 |
t^.State:= t^.State or gstMoving; |
|
1211 |
t^.Active:= true; |
|
1212 |
FollowGear:= t |
|
1213 |
end; |
|
1214 |
gtGrave: begin |
|
1215 |
t^.dY:= - _0_1; |
|
1216 |
t^.Active:= true |
|
1217 |
end; |
|
1218 |
end; |
|
1219 |
t:= t^.NextGear |
|
1220 |
end; |
|
621 | 1221 |
if (GameFlags and gfSolidLand) = 0 then DrawExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), cShotgunRadius) |
506 | 1222 |
end; |
1223 |
||
371 | 1224 |
procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); |
53 | 1225 |
var t: PGearArray; |
371 | 1226 |
i: LongInt; |
38 | 1227 |
begin |
53 | 1228 |
t:= CheckGearsCollision(Ammo); |
351 | 1229 |
i:= t^.Count; |
53 | 1230 |
while i > 0 do |
981 | 1231 |
begin |
1232 |
dec(i); |
|
1233 |
if (t^.ar[i]^.State and gstNoDamage) = 0 then |
|
1234 |
case t^.ar[i]^.Kind of |
|
1235 |
gtHedgehog, |
|
1236 |
gtMine, |
|
1237 |
gtTarget, |
|
1238 |
gtCase: begin |
|
1239 |
inc(t^.ar[i]^.Damage, Damage); |
|
1240 |
||
1284 | 1241 |
if (t^.ar[i]^.Kind = gtHedgehog) and (Damage > 0) then |
981 | 1242 |
AddDamageTag(hwRound(t^.ar[i]^.X), hwRound(t^.ar[i]^.Y), Damage, t^.ar[i]); |
867 | 1243 |
|
981 | 1244 |
DeleteCI(t^.ar[i]); |
1245 |
t^.ar[i]^.dX:= Ammo^.dX * Power * _0_01; |
|
1246 |
t^.ar[i]^.dY:= Ammo^.dY * Power * _0_01; |
|
1247 |
t^.ar[i]^.Active:= true; |
|
1248 |
t^.ar[i]^.State:= t^.ar[i]^.State or gstMoving; |
|
867 | 1249 |
|
982 | 1250 |
if TestCollisionXwithGear(t^.ar[i], hwSign(t^.ar[i]^.dX)) then |
981 | 1251 |
begin |
1252 |
if not (TestCollisionXwithXYShift(t^.ar[i], _0, -3, hwSign(t^.ar[i]^.dX)) |
|
1253 |
or TestCollisionYwithGear(t^.ar[i], -1)) then t^.ar[i]^.Y:= t^.ar[i]^.Y - _1; |
|
1254 |
if not (TestCollisionXwithXYShift(t^.ar[i], _0, -2, hwSign(t^.ar[i]^.dX)) |
|
1255 |
or TestCollisionYwithGear(t^.ar[i], -1)) then t^.ar[i]^.Y:= t^.ar[i]^.Y - _1; |
|
1256 |
if not (TestCollisionXwithXYShift(t^.ar[i], _0, -1, hwSign(t^.ar[i]^.dX)) |
|
1257 |
or TestCollisionYwithGear(t^.ar[i], -1)) then t^.ar[i]^.Y:= t^.ar[i]^.Y - _1; |
|
1258 |
end; |
|
982 | 1259 |
|
981 | 1260 |
FollowGear:= t^.ar[i] |
1261 |
end; |
|
1262 |
end |
|
1263 |
end; |
|
126 | 1264 |
SetAllToActive |
38 | 1265 |
end; |
1266 |
||
4 | 1267 |
procedure AssignHHCoords; |
955 | 1268 |
var i, t, p, j: LongInt; |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1269 |
ar: array[0..Pred(cMaxHHs)] of PGear; |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1270 |
Count: Longword; |
4 | 1271 |
begin |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1272 |
if (GameFlags and gfForts) <> 0 then |
955 | 1273 |
begin |
1274 |
t:= 0; |
|
1275 |
for p:= 0 to 1 do |
|
1276 |
begin |
|
1277 |
with ClansArray[p]^ do |
|
1278 |
for j:= 0 to Pred(TeamsNumber) do |
|
1279 |
with Teams[j]^ do |
|
1280 |
for i:= 0 to cMaxHHIndex do |
|
1281 |
with Hedgehogs[i] do |
|
958 | 1282 |
if (Gear <> nil) and (Gear^.X.QWordValue = 0) then |
1283 |
begin |
|
1284 |
FindPlace(Gear, false, t, t + 1024); |
|
999
8dcf263c9e8f
In forts mode, hedgehogs on the left look at the right, and vice-versa
unc0rr
parents:
997
diff
changeset
|
1285 |
Gear^.Pos:= GetRandom(19); |
8dcf263c9e8f
In forts mode, hedgehogs on the left look at the right, and vice-versa
unc0rr
parents:
997
diff
changeset
|
1286 |
Gear^.dX.isNegative:= p = 1; |
958 | 1287 |
end; |
955 | 1288 |
inc(t, 1024) |
1289 |
end |
|
1290 |
end else // mix hedgehogs |
|
1291 |
begin |
|
1292 |
Count:= 0; |
|
1293 |
for p:= 0 to Pred(TeamsCount) do |
|
1294 |
with TeamsArray[p]^ do |
|
1295 |
begin |
|
1296 |
for i:= 0 to cMaxHHIndex do |
|
1297 |
with Hedgehogs[i] do |
|
1298 |
if (Gear <> nil) and (Gear^.X.QWordValue = 0) then |
|
1299 |
begin |
|
1300 |
ar[Count]:= Gear; |
|
1301 |
inc(Count) |
|
1302 |
end; |
|
1303 |
end; |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1304 |
|
955 | 1305 |
while (Count > 0) do |
1306 |
begin |
|
1307 |
i:= GetRandom(Count); |
|
1308 |
FindPlace(ar[i], false, 0, 2048); |
|
1000
e7b204880318
Hedgehogs on the left side of the map look to the right and vice-versa
unc0rr
parents:
999
diff
changeset
|
1309 |
ar[i]^.dX.isNegative:= ar[i]^.X > _1024; |
959 | 1310 |
ar[i]^.Pos:= GetRandom(19); |
955 | 1311 |
ar[i]:= ar[Count - 1]; |
1312 |
dec(Count) |
|
1313 |
end |
|
1314 |
end |
|
4 | 1315 |
end; |
1316 |
||
371 | 1317 |
function CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear; |
10 | 1318 |
var t: PGear; |
1319 |
begin |
|
1320 |
t:= GearsList; |
|
1321 |
rX:= sqr(rX); |
|
1322 |
rY:= sqr(rY); |
|
1323 |
while t <> nil do |
|
1324 |
begin |
|
351 | 1325 |
if (t <> Gear) and (t^.Kind = Kind) then |
498 | 1326 |
if not((hwSqr(Gear^.X - t^.X) / rX + hwSqr(Gear^.Y - t^.Y) / rY) > _1) then |
351 | 1327 |
exit(t); |
1328 |
t:= t^.NextGear |
|
10 | 1329 |
end; |
351 | 1330 |
CheckGearNear:= nil |
15 | 1331 |
end; |
1332 |
||
79 | 1333 |
procedure AmmoFlameWork(Ammo: PGear); |
1334 |
var t: PGear; |
|
1335 |
begin |
|
1336 |
t:= GearsList; |
|
1337 |
while t <> nil do |
|
1338 |
begin |
|
351 | 1339 |
if (t^.Kind = gtHedgehog) and (t^.Y < Ammo^.Y) then |
498 | 1340 |
if not (hwSqr(Ammo^.X - t^.X) + hwSqr(Ammo^.Y - t^.Y - int2hwFloat(cHHRadius)) * 2 > _2) then |
79 | 1341 |
begin |
351 | 1342 |
inc(t^.Damage, 5); |
1343 |
t^.dX:= t^.dX + (t^.X - Ammo^.X) * _0_02; |
|
1344 |
t^.dY:= - _0_25; |
|
1345 |
t^.Active:= true; |
|
79 | 1346 |
DeleteCI(t); |
1347 |
FollowGear:= t |
|
1348 |
end; |
|
351 | 1349 |
t:= t^.NextGear |
79 | 1350 |
end; |
1351 |
end; |
|
1352 |
||
371 | 1353 |
function CheckGearsNear(mX, mY: LongInt; Kind: TGearsType; rX, rY: LongInt): PGear; |
16 | 1354 |
var t: PGear; |
1355 |
begin |
|
1356 |
t:= GearsList; |
|
1357 |
rX:= sqr(rX); |
|
1358 |
rY:= sqr(rY); |
|
1359 |
while t <> nil do |
|
1360 |
begin |
|
351 | 1361 |
if t^.Kind in Kind then |
498 | 1362 |
if not (hwSqr(int2hwFloat(mX) - t^.X) / rX + hwSqr(int2hwFloat(mY) - t^.Y) / rY > _1) then |
351 | 1363 |
exit(t); |
1364 |
t:= t^.NextGear |
|
16 | 1365 |
end; |
351 | 1366 |
CheckGearsNear:= nil |
16 | 1367 |
end; |
1368 |
||
1369 |
function CountGears(Kind: TGearType): Longword; |
|
1370 |
var t: PGear; |
|
351 | 1371 |
Result: Longword; |
16 | 1372 |
begin |
1373 |
Result:= 0; |
|
1374 |
t:= GearsList; |
|
1375 |
while t <> nil do |
|
1376 |
begin |
|
351 | 1377 |
if t^.Kind = Kind then inc(Result); |
1378 |
t:= t^.NextGear |
|
16 | 1379 |
end; |
351 | 1380 |
CountGears:= Result |
16 | 1381 |
end; |
1382 |
||
15 | 1383 |
procedure SpawnBoxOfSmth; |
394
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1384 |
var t: LongInt; |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1385 |
i: TAmmoType; |
15 | 1386 |
begin |
614 | 1387 |
if (cCaseFactor = 0) or |
1388 |
(CountGears(gtCase) >= 5) or |
|
1389 |
(getrandom(cCaseFactor) <> 0) then exit; |
|
498 | 1390 |
FollowGear:= AddGear(0, 0, gtCase, 0, _0, _0, 0); |
295 | 1391 |
case getrandom(2) of |
1392 |
0: begin |
|
351 | 1393 |
FollowGear^.Health:= 25; |
1394 |
FollowGear^.Pos:= posCaseHealth |
|
295 | 1395 |
end; |
1396 |
1: begin |
|
394
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1397 |
t:= 0; |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1398 |
for i:= Low(TAmmoType) to High(TAmmoType) do |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1399 |
inc(t, Ammoz[i].Probability); |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1400 |
t:= GetRandom(t); |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1401 |
i:= Low(TAmmoType); |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1402 |
dec(t, Ammoz[i].Probability); |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1403 |
while t >= 0 do |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1404 |
begin |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1405 |
inc(i); |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1406 |
dec(t, Ammoz[i].Probability) |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1407 |
end; |
865 | 1408 |
PlaySound(sndReinforce, false); |
351 | 1409 |
FollowGear^.Pos:= posCaseAmmo; |
394
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1410 |
FollowGear^.State:= Longword(i) |
295 | 1411 |
end; |
1412 |
end; |
|
70 | 1413 |
FindPlace(FollowGear, true, 0, 2048) |
1414 |
end; |
|
1415 |
||
371 | 1416 |
procedure FindPlace(Gear: PGear; withFall: boolean; Left, Right: LongInt); |
70 | 1417 |
|
371 | 1418 |
function CountNonZeroz(x, y, r: LongInt): LongInt; |
1419 |
var i: LongInt; |
|
1420 |
Result: LongInt; |
|
70 | 1421 |
begin |
1422 |
Result:= 0; |
|
701 | 1423 |
if (y and $FFFFFC00) = 0 then |
1424 |
for i:= max(x - r, 0) to min(x + r, 2043) do |
|
351 | 1425 |
if Land[y, i] <> 0 then inc(Result); |
1426 |
CountNonZeroz:= Result |
|
70 | 1427 |
end; |
1428 |
||
495 | 1429 |
var x: LongInt; |
371 | 1430 |
y, sy: LongInt; |
386 | 1431 |
ar: array[0..511] of TPoint; |
1432 |
ar2: array[0..1023] of TPoint; |
|
392 | 1433 |
cnt, cnt2: Longword; |
1434 |
delta: LongInt; |
|
70 | 1435 |
begin |
386 | 1436 |
delta:= 250; |
1437 |
cnt2:= 0; |
|
16 | 1438 |
repeat |
392 | 1439 |
x:= Left + LongInt(GetRandom(Delta)); |
70 | 1440 |
repeat |
386 | 1441 |
inc(x, Delta); |
70 | 1442 |
cnt:= 0; |
351 | 1443 |
y:= -Gear^.Radius * 2; |
70 | 1444 |
while y < 1023 do |
16 | 1445 |
begin |
70 | 1446 |
repeat |
701 | 1447 |
inc(y, 2); |
351 | 1448 |
until (y > 1023) or (CountNonZeroz(x, y, Gear^.Radius - 1) = 0); |
70 | 1449 |
sy:= y; |
1450 |
repeat |
|
1451 |
inc(y); |
|
351 | 1452 |
until (y > 1023) or (CountNonZeroz(x, y, Gear^.Radius - 1) <> 0); |
1453 |
if (y - sy > Gear^.Radius * 2) |
|
70 | 1454 |
and (y < 1023) |
351 | 1455 |
and (CheckGearsNear(x, y - Gear^.Radius, [gtHedgehog, gtMine, gtCase], 110, 110) = nil) then |
70 | 1456 |
begin |
1457 |
ar[cnt].X:= x; |
|
351 | 1458 |
if withFall then ar[cnt].Y:= sy + Gear^.Radius |
1459 |
else ar[cnt].Y:= y - Gear^.Radius; |
|
70 | 1460 |
inc(cnt) |
1461 |
end; |
|
386 | 1462 |
inc(y, 45) |
16 | 1463 |
end; |
70 | 1464 |
if cnt > 0 then |
1465 |
with ar[GetRandom(cnt)] do |
|
1466 |
begin |
|
386 | 1467 |
ar2[cnt2].x:= x; |
1468 |
ar2[cnt2].y:= y; |
|
1469 |
inc(cnt2) |
|
70 | 1470 |
end |
386 | 1471 |
until (x + Delta > Right); |
1472 |
dec(Delta, 60) |
|
1473 |
until (cnt2 > 0) or (Delta < 70); |
|
1474 |
if cnt2 > 0 then |
|
1475 |
with ar2[GetRandom(cnt2)] do |
|
1476 |
begin |
|
498 | 1477 |
Gear^.X:= int2hwFloat(x); |
1478 |
Gear^.Y:= int2hwFloat(y); |
|
386 | 1479 |
{$IFDEF DEBUGFILE} |
1480 |
AddFileLog('Assigned Gear coordinates (' + inttostr(x) + ',' + inttostr(y) + ')'); |
|
1481 |
{$ENDIF} |
|
1482 |
end |
|
1483 |
else |
|
1484 |
begin |
|
1485 |
OutError('Can''t find place for Gear', false); |
|
1486 |
DeleteGear(Gear) |
|
1487 |
end |
|
10 | 1488 |
end; |
1489 |
||
4 | 1490 |
initialization |
1491 |
||
1492 |
finalization |
|
95 | 1493 |
FreeGearsList; |
4 | 1494 |
|
1495 |
end. |