author | unc0rr |
Tue, 23 Sep 2008 06:27:53 +0000 | |
changeset 1286 | a02a5345b91e |
parent 1285 | 993845ea5c8d |
child 1294 | 50198e5c7f02 |
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 |
1286 | 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)); |
|
1002 | 718 |
|
1286 | 719 |
defaultPos:= false |
720 |
end; |
|
721 |
gtSeduction: begin |
|
722 |
if CurAmmoGear^.Pos >= 6 then |
|
723 |
DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
|
724 |
hwSign(Gear^.dX), |
|
725 |
2, |
|
726 |
2, |
|
727 |
0) |
|
728 |
else |
|
729 |
begin |
|
730 |
DrawRotatedF(sprDress, |
|
731 |
hwRound(Gear^.X) + WorldDx, |
|
732 |
hwRound(Gear^.Y) + WorldDy, |
|
733 |
CurAmmoGear^.Pos, |
|
734 |
hwSign(Gear^.dX), |
|
735 |
0); |
|
736 |
DrawSprite(sprCensored, hwRound(Gear^.X) - 32 + WorldDx, hwRound(Gear^.Y) - 20 + WorldDy, 0) |
|
737 |
end; |
|
738 |
defaultPos:= false |
|
739 |
end; |
|
1002 | 740 |
end; |
741 |
||
742 |
case CurAmmoGear^.Kind of |
|
743 |
gtShotgunShot, |
|
744 |
gtDEagleShot, |
|
745 |
gtShover: begin |
|
746 |
DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
|
747 |
hwSign(Gear^.dX), |
|
748 |
0, |
|
749 |
4, |
|
750 |
0); |
|
751 |
defaultPos:= false |
|
752 |
end |
|
753 |
end |
|
754 |
end else |
|
876 | 755 |
|
1002 | 756 |
if ((Gear^.State and gstHHJumping) <> 0) then |
757 |
begin |
|
758 |
if ((Gear^.State and gstHHHJump) <> 0) then |
|
759 |
DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
|
760 |
- hwSign(Gear^.dX), |
|
761 |
1, |
|
762 |
1, |
|
763 |
0) |
|
764 |
else |
|
765 |
DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
|
766 |
hwSign(Gear^.dX), |
|
767 |
1, |
|
768 |
1, |
|
769 |
0); |
|
770 |
defaultPos:= false |
|
771 |
end else |
|
874 | 772 |
|
1002 | 773 |
if (Gear^.Message and (gm_Left or gm_Right) <> 0) then |
824 | 774 |
begin |
1002 | 775 |
DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
776 |
hwSign(Gear^.dX), |
|
777 |
0, |
|
778 |
PHedgehog(Gear^.Hedgehog)^.visStepPos div 2, |
|
779 |
0); |
|
1257 | 780 |
defaultPos:= false; |
781 |
HatVisible:= true |
|
1002 | 782 |
end |
783 |
else |
|
784 |
||
1033 | 785 |
if ((Gear^.State and gstAnimation) <> 0) then |
786 |
begin |
|
1034 | 787 |
DrawRotatedF(Wavez[TWave(Gear^.Tag)].Sprite, |
1033 | 788 |
hwRound(Gear^.X) + 1 + WorldDx, |
789 |
hwRound(Gear^.Y) - 3 + WorldDy, |
|
790 |
Gear^.Pos, |
|
791 |
hwSign(Gear^.dX), |
|
792 |
0.0); |
|
793 |
defaultPos:= false |
|
794 |
end |
|
795 |
else |
|
1002 | 796 |
if ((Gear^.State and gstAttacked) = 0) then |
797 |
begin |
|
798 |
amt:= CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].AmmoType; |
|
799 |
case amt of |
|
800 |
amBazooka, |
|
801 |
amMortar: DrawRotated(sprHandBazooka, hx, hy, hwSign(Gear^.dX), aangle); |
|
802 |
amRope: DrawRotated(sprHandRope, hx, hy, hwSign(Gear^.dX), aangle); |
|
803 |
amShotgun: DrawRotated(sprHandShotgun, hx, hy, hwSign(Gear^.dX), aangle); |
|
804 |
amDEagle: DrawRotated(sprHandDEagle, hx, hy, hwSign(Gear^.dX), aangle); |
|
805 |
amBlowTorch: DrawRotated(sprHandBlowTorch, hx, hy, hwSign(Gear^.dX), aangle); |
|
806 |
end; |
|
807 |
||
808 |
case amt of |
|
809 |
amAirAttack, |
|
810 |
amMineStrike: DrawRotated(sprHandAirAttack, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) + WorldDy, hwSign(Gear^.dX), 0); |
|
811 |
amPickHammer: DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
|
812 |
hwSign(Gear^.dX), |
|
813 |
1, |
|
814 |
2, |
|
815 |
0); |
|
816 |
amBlowTorch: DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
|
817 |
hwSign(Gear^.dX), |
|
818 |
1, |
|
819 |
3, |
|
820 |
0); |
|
821 |
amTeleport: DrawRotatedF(sprTeleport, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, 0, hwSign(Gear^.dX), 0); |
|
822 |
amKamikaze: DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
|
823 |
hwSign(Gear^.dX), |
|
824 |
1, |
|
825 |
5, |
|
826 |
0); |
|
1221 | 827 |
amWhip: DrawRotatedF(sprWhip, |
1010 | 828 |
hwRound(Gear^.X) + 1 + WorldDx, |
829 |
hwRound(Gear^.Y) - 3 + WorldDy, |
|
830 |
0, |
|
831 |
hwSign(Gear^.dX), |
|
832 |
0); |
|
1002 | 833 |
else |
822 | 834 |
DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
835 |
hwSign(Gear^.dX), |
|
836 |
0, |
|
1002 | 837 |
4, |
822 | 838 |
0); |
1253 | 839 |
|
840 |
HatVisible:= true; |
|
841 |
with PHedgehog(Gear^.Hedgehog)^ do |
|
842 |
if HatVisibility > 0 then |
|
843 |
DrawTextureF(HatTex, |
|
844 |
HatVisibility, |
|
845 |
hwRound(Gear^.X) + 1 + WorldDx, |
|
846 |
hwRound(Gear^.Y) - 8 + WorldDy, |
|
847 |
0, |
|
848 |
hwSign(Gear^.dX), |
|
849 |
32); |
|
1002 | 850 |
end; |
966 | 851 |
|
1002 | 852 |
case amt of |
853 |
amBaseballBat: DrawRotated(sprHandBaseball, |
|
854 |
hwRound(Gear^.X) + 1 - 4 * hwSign(Gear^.dX) + WorldDx, |
|
855 |
hwRound(Gear^.Y) + 6 + WorldDy, hwSign(Gear^.dX), aangle); |
|
856 |
end; |
|
966 | 857 |
|
1002 | 858 |
defaultPos:= false |
859 |
end |
|
860 |
end else // not gstHHDriven |
|
1012 | 861 |
begin |
1014
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
862 |
if (Gear^.Damage > 0) |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
863 |
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
|
864 |
begin |
1012 | 865 |
DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
866 |
hwSign(Gear^.dX), |
|
1014
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
867 |
2, |
1012 | 868 |
1, |
1014
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
869 |
Gear^.DirAngle); |
1012 | 870 |
defaultPos:= false |
1020 | 871 |
end else |
1014
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
872 |
|
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
873 |
if ((Gear^.State and gstHHJumping) <> 0) then |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
874 |
begin |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
875 |
if ((Gear^.State and gstHHHJump) <> 0) then |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
876 |
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
|
877 |
- hwSign(Gear^.dX), |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
878 |
1, |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
879 |
1, |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
880 |
0) |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
881 |
else |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
882 |
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
|
883 |
hwSign(Gear^.dX), |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
884 |
1, |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
885 |
1, |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
886 |
0); |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
887 |
defaultPos:= false |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
888 |
end; |
1012 | 889 |
end; |
834 | 890 |
|
1251 | 891 |
with PHedgehog(Gear^.Hedgehog)^ do |
970 | 892 |
begin |
1251 | 893 |
if defaultPos then |
894 |
begin |
|
895 |
DrawRotatedF(sprHHIdle, |
|
896 |
hwRound(Gear^.X) + 1 + WorldDx, |
|
897 |
hwRound(Gear^.Y) - 3 + WorldDy, |
|
898 |
(RealTicks div 128 + Gear^.Pos) mod 19, |
|
899 |
hwSign(Gear^.dX), |
|
900 |
0); |
|
1253 | 901 |
HatVisible:= true; |
902 |
end; |
|
903 |
||
904 |
if HatVisible then |
|
1251 | 905 |
if HatVisibility < 1.0 then |
1254 | 906 |
HatVisibility:= HatVisibility + 0.2 |
1253 | 907 |
else |
1251 | 908 |
else |
909 |
if HatVisibility > 0.0 then |
|
1254 | 910 |
HatVisibility:= HatVisibility - 0.2; |
1253 | 911 |
|
1251 | 912 |
if HatVisibility > 0 then |
1255 | 913 |
if DefaultPos then |
914 |
DrawTextureF(HatTex, |
|
915 |
HatVisibility, |
|
916 |
hwRound(Gear^.X) + 1 + WorldDx, |
|
917 |
hwRound(Gear^.Y) - 8 + WorldDy, |
|
918 |
(RealTicks div 128 + Gear^.Pos) mod 19, |
|
919 |
hwSign(Gear^.dX), |
|
920 |
32) |
|
921 |
else |
|
922 |
DrawTextureF(HatTex, |
|
923 |
HatVisibility, |
|
924 |
hwRound(Gear^.X) + 1 + WorldDx, |
|
925 |
hwRound(Gear^.Y) - 8 + WorldDy, |
|
926 |
0, |
|
927 |
hwSign(Gear^.dX), |
|
928 |
32); |
|
970 | 929 |
end; |
292 | 930 |
|
1251 | 931 |
|
351 | 932 |
with PHedgehog(Gear^.Hedgehog)^ do |
994 | 933 |
begin |
1011 | 934 |
if ((Gear^.State and not gstWinner) = 0) |
994 | 935 |
or (bShowFinger and ((Gear^.State and gstHHDriven) <> 0)) then |
958 | 936 |
begin |
976 | 937 |
t:= hwRound(Gear^.Y) - cHHRadius - 12 + WorldDy; |
958 | 938 |
if (cTagsMask and 1) <> 0 then |
939 |
begin |
|
940 |
dec(t, HealthTagTex^.h + 2); |
|
941 |
DrawCentered(hwRound(Gear^.X) + WorldDx, t, HealthTagTex) |
|
942 |
end; |
|
943 |
if (cTagsMask and 2) <> 0 then |
|
944 |
begin |
|
945 |
dec(t, NameTagTex^.h + 2); |
|
946 |
DrawCentered(hwRound(Gear^.X) + WorldDx, t, NameTagTex) |
|
947 |
end; |
|
948 |
if (cTagsMask and 4) <> 0 then |
|
949 |
begin |
|
950 |
dec(t, Team^.NameTagTex^.h + 2); |
|
951 |
DrawCentered(hwRound(Gear^.X) + WorldDx, t, Team^.NameTagTex) |
|
952 |
end |
|
994 | 953 |
end; |
954 |
if (Gear^.State and gstHHDriven) <> 0 then // Current hedgehog |
|
958 | 955 |
begin |
956 |
if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then |
|
957 |
DrawSprite(sprFinger, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 64 + WorldDy, |
|
958 |
GameTicks div 32 mod 16); |
|
821
e6c0408b54ed
Use 'regular standing' and 'rope swing' hedgehog sprites
unc0rr
parents:
815
diff
changeset
|
959 |
|
958 | 960 |
if (Gear^.State and gstDrowning) = 0 then |
961 |
if (Gear^.State and gstHHThinking) <> 0 then |
|
962 |
DrawSprite(sprQuestion, hwRound(Gear^.X) - 10 + WorldDx, hwRound(Gear^.Y) - cHHRadius - 34 + WorldDy, 0) |
|
963 |
else |
|
1033 | 964 |
if ShowCrosshair and ((Gear^.State and (gstAttacked or gstAnimation)) = 0) then |
958 | 965 |
begin |
966 |
if ((Gear^.State and gstHHHJump) <> 0) then m:= -1 else m:= 1; |
|
967 |
DrawRotatedTex(Team^.CrosshairTex, |
|
968 |
12, 12, |
|
1283
a1e99d1e4fd3
Enable back the ability to see chosen team color in team widget
unc0rr
parents:
1279
diff
changeset
|
969 |
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
|
970 |
Round(hwRound(Gear^.Y) - Cos(Gear^.Angle*pi/cMaxAngle) * 80) + WorldDy, 0, |
958 | 971 |
hwSign(Gear^.dX) * (Gear^.Angle * 180.0) / cMaxAngle) |
972 |
end |
|
994 | 973 |
end |
974 |
end |
|
292 | 975 |
end; |
976 |
||
956 | 977 |
procedure DrawGears; |
853 | 978 |
var Gear, HHGear: PGear; |
4 | 979 |
i: Longword; |
371 | 980 |
roplen: LongInt; |
4 | 981 |
|
371 | 982 |
procedure DrawRopeLine(X1, Y1, X2, Y2: LongInt); |
983 |
var eX, eY, dX, dY: LongInt; |
|
984 |
i, sX, sY, x, y, d: LongInt; |
|
366 | 985 |
b: boolean; |
4 | 986 |
begin |
37 | 987 |
if (X1 = X2) and (Y1 = Y2) then |
988 |
begin |
|
351 | 989 |
OutError('WARNING: zero length rope line!', false); |
37 | 990 |
exit |
991 |
end; |
|
366 | 992 |
eX:= 0; |
993 |
eY:= 0; |
|
994 |
dX:= X2 - X1; |
|
995 |
dY:= Y2 - Y1; |
|
996 |
||
997 |
if (dX > 0) then sX:= 1 |
|
998 |
else |
|
999 |
if (dX < 0) then |
|
1000 |
begin |
|
1001 |
sX:= -1; |
|
1002 |
dX:= -dX |
|
1003 |
end else sX:= dX; |
|
1004 |
||
1005 |
if (dY > 0) then sY:= 1 |
|
1006 |
else |
|
1007 |
if (dY < 0) then |
|
4 | 1008 |
begin |
366 | 1009 |
sY:= -1; |
1010 |
dY:= -dY |
|
1011 |
end else sY:= dY; |
|
1012 |
||
1013 |
if (dX > dY) then d:= dX |
|
1014 |
else d:= dY; |
|
1015 |
||
1016 |
x:= X1; |
|
1017 |
y:= Y1; |
|
1018 |
||
1019 |
for i:= 0 to d do |
|
1020 |
begin |
|
1021 |
inc(eX, dX); |
|
1022 |
inc(eY, dY); |
|
1023 |
b:= false; |
|
1024 |
if (eX > d) then |
|
35 | 1025 |
begin |
366 | 1026 |
dec(eX, d); |
1027 |
inc(x, sX); |
|
1028 |
b:= true |
|
35 | 1029 |
end; |
366 | 1030 |
if (eY > d) then |
35 | 1031 |
begin |
366 | 1032 |
dec(eY, d); |
1033 |
inc(y, sY); |
|
1034 |
b:= true |
|
35 | 1035 |
end; |
366 | 1036 |
if b then |
1037 |
begin |
|
1038 |
inc(roplen); |
|
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1039 |
if (roplen mod 4) = 0 then DrawSprite(sprRopeNode, x - 2, y - 2, 0) |
366 | 1040 |
end |
4 | 1041 |
end |
366 | 1042 |
end; |
4 | 1043 |
|
1044 |
begin |
|
1045 |
Gear:= GearsList; |
|
1046 |
while Gear<>nil do |
|
1047 |
begin |
|
351 | 1048 |
case Gear^.Kind of |
822 | 1049 |
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
|
1050 |
gtHedgehog: DrawHH(Gear); |
822 | 1051 |
gtAmmo_Grenade: DrawRotated(sprGrenade, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
522 | 1052 |
gtHealthTag, |
762 | 1053 |
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
|
1054 |
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
|
1055 |
gtUFO: DrawSprite(sprUFO, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, (GameTicks shr 7) mod 4); |
848 | 1056 |
gtPickHammer: DrawSprite(sprPHammer, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 50 + LongInt(((GameTicks shr 5) and 1) * 2) + WorldDy, 0); |
4 | 1057 |
gtRope: begin |
35 | 1058 |
roplen:= 0; |
4 | 1059 |
if RopePoints.Count > 0 then |
1060 |
begin |
|
1061 |
i:= 0; |
|
1062 |
while i < Pred(RopePoints.Count) do |
|
1063 |
begin |
|
351 | 1064 |
DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy, |
1065 |
hwRound(RopePoints.ar[Succ(i)].X) + WorldDx, hwRound(RopePoints.ar[Succ(i)].Y) + WorldDy); |
|
4 | 1066 |
inc(i) |
1067 |
end; |
|
351 | 1068 |
DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy, |
1069 |
hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy); |
|
1070 |
DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, |
|
1071 |
hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X) + WorldDx, hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y) + WorldDy); |
|
822 | 1072 |
DrawRotated(sprRopeHook, hwRound(RopePoints.ar[0].X) + WorldDx, hwRound(RopePoints.ar[0].Y) + WorldDy, 1, RopePoints.HookAngle) |
4 | 1073 |
end else |
35 | 1074 |
begin |
351 | 1075 |
DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, |
1076 |
hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X) + WorldDx, hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y) + WorldDy); |
|
822 | 1077 |
DrawRotated(sprRopeHook, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
35 | 1078 |
end; |
4 | 1079 |
end; |
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1080 |
gtSmokeTrace: if Gear^.State < 8 then DrawSprite(sprSmokeTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State); |
1012 | 1081 |
gtExplosion: DrawSprite(sprExplosion50, hwRound(Gear^.X) - 32 + WorldDx, hwRound(Gear^.Y) - 32 + WorldDy, Gear^.State); |
351 | 1082 |
gtMine: if ((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420) |
822 | 1083 |
then DrawRotated(sprMineOff, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle) |
1084 |
else DrawRotated(sprMineOn, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
|
351 | 1085 |
gtCase: case Gear^.Pos of |
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1086 |
posCaseAmmo : DrawSprite(sprCase, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, 0); |
1009 | 1087 |
posCaseHealth: begin |
1088 |
i:= (GameTicks shr 6) mod 64; |
|
1089 |
if i > 12 then i:= 0; |
|
1090 |
DrawSprite(sprFAid, hwRound(Gear^.X) - 24 + WorldDx, hwRound(Gear^.Y) - 24 + WorldDy, i); |
|
1091 |
end; |
|
42 | 1092 |
end; |
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1093 |
gtDynamite: DrawSprite2(sprDynamite, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 25 + WorldDy, Gear^.Tag and 1, Gear^.Tag shr 1); |
822 | 1094 |
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
|
1095 |
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
|
1096 |
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
|
1097 |
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
|
1098 |
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
|
1099 |
else DrawSprite(sprAirplane, hwRound(Gear^.X) - 60 + WorldDx, hwRound(Gear^.Y) - 25 + WorldDy, 1); |
822 | 1100 |
gtAirBomb: DrawRotated(sprAirBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
853 | 1101 |
gtTeleport: begin |
1102 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1103 |
DrawRotatedF(sprTeleport, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, Gear^.Pos, hwSign(HHGear^.dX), 0); |
|
1104 |
DrawRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0); |
|
1105 |
end; |
|
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1106 |
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
|
1107 |
gtTarget: DrawSprite(sprTarget, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, 0); |
959 | 1108 |
gtMortar: DrawRotated(sprMortar, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1108 | 1109 |
gtCake: if Gear^.Pos = 6 then |
1110 |
DrawRotatedf(sprCakeWalk, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, (GameTicks div 40) mod 6, hwSign(Gear^.dX), Gear^.DirAngle + hwSign(Gear^.dX) * 90) |
|
1111 |
else |
|
1262 | 1112 |
DrawRotatedf(sprCakeDown, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 5 - Gear^.Pos, hwSign(Gear^.dX), 0); |
1286 | 1113 |
gtSeduction: if Gear^.Pos >= 6 then DrawSprite(sprSeduction, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, 0); |
1262 | 1114 |
gtWatermelon: DrawRotatedf(sprWatermelon, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 0, Gear^.DirAngle); |
1115 |
gtMelonPiece: DrawRotatedf(sprWatermelon, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 1, 0, Gear^.DirAngle); |
|
1263 | 1116 |
gtHellishBomb: DrawRotated(sprHellishBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
1117 |
gtEvilTrace: if Gear^.State < 8 then DrawSprite(sprEvilTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State); |
|
1118 |
end; |
|
351 | 1119 |
Gear:= Gear^.NextGear |
4 | 1120 |
end; |
1121 |
end; |
|
1122 |
||
1123 |
procedure FreeGearsList; |
|
1124 |
var t, tt: PGear; |
|
1125 |
begin |
|
1126 |
tt:= GearsList; |
|
1127 |
GearsList:= nil; |
|
1128 |
while tt<>nil do |
|
1129 |
begin |
|
1130 |
t:= tt; |
|
351 | 1131 |
tt:= tt^.NextGear; |
4 | 1132 |
Dispose(t) |
1133 |
end; |
|
1134 |
end; |
|
1135 |
||
10 | 1136 |
procedure AddMiscGears; |
371 | 1137 |
var i: LongInt; |
4 | 1138 |
begin |
498 | 1139 |
AddGear(0, 0, gtATStartGame, 0, _0, _0, 2000); |
22 | 1140 |
if (GameFlags and gfForts) = 0 then |
622 | 1141 |
for i:= 0 to Pred(cLandAdditions) do |
498 | 1142 |
FindPlace(AddGear(0, 0, gtMine, 0, _0, _0, 0), false, 0, 2048); |
4 | 1143 |
end; |
1144 |
||
371 | 1145 |
procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord); |
4 | 1146 |
var Gear: PGear; |
506 | 1147 |
dmg, dmgRadius: LongInt; |
4 | 1148 |
begin |
1149 |
TargetPoint.X:= NoPointX; |
|
1150 |
{$IFDEF DEBUGFILE}if Radius > 3 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');{$ENDIF} |
|
1049 | 1151 |
if (Radius > 10) then AddGear(X, Y, gtExplosion, 0, _0, _0, 0); |
355 | 1152 |
if (Mask and EXPLAutoSound) <> 0 then PlaySound(sndExplosion, false); |
506 | 1153 |
if (Mask and EXPLAllDamageInRadius)=0 then dmgRadius:= Radius shl 1 |
1154 |
else dmgRadius:= Radius; |
|
4 | 1155 |
Gear:= GearsList; |
1156 |
while Gear <> nil do |
|
1200 | 1157 |
begin |
1158 |
dmg:= dmgRadius + cHHRadius div 2 - hwRound(Distance(Gear^.X - int2hwFloat(X), Gear^.Y - int2hwFloat(Y))); |
|
1159 |
if (dmg > 1) and |
|
1160 |
((Gear^.State and gstNoDamage) = 0) then |
|
1161 |
begin |
|
1162 |
dmg:= min(dmg div 2, Radius); |
|
1163 |
case Gear^.Kind of |
|
1164 |
gtHedgehog, |
|
1165 |
gtMine, |
|
1166 |
gtCase, |
|
1167 |
gtTarget, |
|
1168 |
gtFlame: begin |
|
1169 |
{$IFDEF DEBUGFILE}AddFileLog('Damage: ' + inttostr(dmg));{$ENDIF} |
|
1170 |
if (Mask and EXPLNoDamage) = 0 then |
|
1171 |
begin |
|
1172 |
inc(Gear^.Damage, dmg); |
|
1173 |
if Gear^.Kind = gtHedgehog then |
|
1174 |
AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), dmg, Gear) |
|
1175 |
end; |
|
1176 |
if ((Mask and EXPLDoNotTouchHH) = 0) or (Gear^.Kind <> gtHedgehog) then |
|
1177 |
begin |
|
1178 |
DeleteCI(Gear); |
|
1179 |
Gear^.dX:= Gear^.dX + SignAs(_0_005 * dmg + cHHKick, Gear^.X - int2hwFloat(X)); |
|
1180 |
Gear^.dY:= Gear^.dY + SignAs(_0_005 * dmg + cHHKick, Gear^.Y - int2hwFloat(Y)); |
|
1181 |
Gear^.State:= (Gear^.State or gstMoving) and (not gstWinner); |
|
1182 |
Gear^.Active:= true; |
|
1183 |
FollowGear:= Gear |
|
1184 |
end; |
|
1185 |
end; |
|
1186 |
gtGrave: begin |
|
1187 |
Gear^.dY:= - _0_004 * dmg; |
|
1188 |
Gear^.Active:= true; |
|
1189 |
end; |
|
1190 |
end; |
|
1191 |
end; |
|
1192 |
Gear:= Gear^.NextGear |
|
1193 |
end; |
|
1194 |
||
621 | 1195 |
if (Mask and EXPLDontDraw) = 0 then |
1200 | 1196 |
if (GameFlags and gfSolidLand) = 0 then DrawExplosion(X, Y, Radius); |
1197 |
||
498 | 1198 |
uAIMisc.AwareOfExplosion(0, 0, 0) |
4 | 1199 |
end; |
1200 |
||
506 | 1201 |
procedure ShotgunShot(Gear: PGear); |
1202 |
var t: PGear; |
|
955 | 1203 |
dmg: LongInt; |
506 | 1204 |
begin |
509 | 1205 |
Gear^.Radius:= cShotgunRadius; |
506 | 1206 |
t:= GearsList; |
1207 |
while t <> nil do |
|
1286 | 1208 |
begin |
1209 |
dmg:= min(Gear^.Radius + t^.Radius - hwRound(Distance(Gear^.X - t^.X, Gear^.Y - t^.Y)), 25); |
|
1210 |
if dmg > 0 then |
|
1211 |
case t^.Kind of |
|
1212 |
gtHedgehog, |
|
1213 |
gtMine, |
|
1214 |
gtCase, |
|
1215 |
gtTarget: begin |
|
1216 |
inc(t^.Damage, dmg); |
|
867 | 1217 |
|
1286 | 1218 |
if t^.Kind = gtHedgehog then |
1219 |
AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), dmg, t); |
|
867 | 1220 |
|
1286 | 1221 |
DeleteCI(t); |
1222 |
t^.dX:= t^.dX + Gear^.dX * dmg * _0_01 + SignAs(cHHKick, Gear^.dX); |
|
1223 |
t^.dY:= t^.dY + Gear^.dY * dmg * _0_01; |
|
1224 |
t^.State:= t^.State or gstMoving; |
|
1225 |
t^.Active:= true; |
|
1226 |
FollowGear:= t |
|
1227 |
end; |
|
1228 |
gtGrave: begin |
|
1229 |
t^.dY:= - _0_1; |
|
1230 |
t^.Active:= true |
|
1231 |
end; |
|
1232 |
end; |
|
1233 |
t:= t^.NextGear |
|
1234 |
end; |
|
621 | 1235 |
if (GameFlags and gfSolidLand) = 0 then DrawExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), cShotgunRadius) |
506 | 1236 |
end; |
1237 |
||
371 | 1238 |
procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); |
53 | 1239 |
var t: PGearArray; |
371 | 1240 |
i: LongInt; |
38 | 1241 |
begin |
53 | 1242 |
t:= CheckGearsCollision(Ammo); |
351 | 1243 |
i:= t^.Count; |
53 | 1244 |
while i > 0 do |
981 | 1245 |
begin |
1246 |
dec(i); |
|
1247 |
if (t^.ar[i]^.State and gstNoDamage) = 0 then |
|
1248 |
case t^.ar[i]^.Kind of |
|
1249 |
gtHedgehog, |
|
1250 |
gtMine, |
|
1251 |
gtTarget, |
|
1252 |
gtCase: begin |
|
1253 |
inc(t^.ar[i]^.Damage, Damage); |
|
1254 |
||
1284 | 1255 |
if (t^.ar[i]^.Kind = gtHedgehog) and (Damage > 0) then |
981 | 1256 |
AddDamageTag(hwRound(t^.ar[i]^.X), hwRound(t^.ar[i]^.Y), Damage, t^.ar[i]); |
867 | 1257 |
|
981 | 1258 |
DeleteCI(t^.ar[i]); |
1259 |
t^.ar[i]^.dX:= Ammo^.dX * Power * _0_01; |
|
1260 |
t^.ar[i]^.dY:= Ammo^.dY * Power * _0_01; |
|
1261 |
t^.ar[i]^.Active:= true; |
|
1262 |
t^.ar[i]^.State:= t^.ar[i]^.State or gstMoving; |
|
867 | 1263 |
|
982 | 1264 |
if TestCollisionXwithGear(t^.ar[i], hwSign(t^.ar[i]^.dX)) then |
981 | 1265 |
begin |
1266 |
if not (TestCollisionXwithXYShift(t^.ar[i], _0, -3, hwSign(t^.ar[i]^.dX)) |
|
1267 |
or TestCollisionYwithGear(t^.ar[i], -1)) then t^.ar[i]^.Y:= t^.ar[i]^.Y - _1; |
|
1268 |
if not (TestCollisionXwithXYShift(t^.ar[i], _0, -2, hwSign(t^.ar[i]^.dX)) |
|
1269 |
or TestCollisionYwithGear(t^.ar[i], -1)) then t^.ar[i]^.Y:= t^.ar[i]^.Y - _1; |
|
1270 |
if not (TestCollisionXwithXYShift(t^.ar[i], _0, -1, hwSign(t^.ar[i]^.dX)) |
|
1271 |
or TestCollisionYwithGear(t^.ar[i], -1)) then t^.ar[i]^.Y:= t^.ar[i]^.Y - _1; |
|
1272 |
end; |
|
982 | 1273 |
|
981 | 1274 |
FollowGear:= t^.ar[i] |
1275 |
end; |
|
1276 |
end |
|
1277 |
end; |
|
126 | 1278 |
SetAllToActive |
38 | 1279 |
end; |
1280 |
||
4 | 1281 |
procedure AssignHHCoords; |
955 | 1282 |
var i, t, p, j: LongInt; |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1283 |
ar: array[0..Pred(cMaxHHs)] of PGear; |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1284 |
Count: Longword; |
4 | 1285 |
begin |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1286 |
if (GameFlags and gfForts) <> 0 then |
955 | 1287 |
begin |
1288 |
t:= 0; |
|
1289 |
for p:= 0 to 1 do |
|
1290 |
begin |
|
1291 |
with ClansArray[p]^ do |
|
1292 |
for j:= 0 to Pred(TeamsNumber) do |
|
1293 |
with Teams[j]^ do |
|
1294 |
for i:= 0 to cMaxHHIndex do |
|
1295 |
with Hedgehogs[i] do |
|
958 | 1296 |
if (Gear <> nil) and (Gear^.X.QWordValue = 0) then |
1297 |
begin |
|
1298 |
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
|
1299 |
Gear^.Pos:= GetRandom(19); |
8dcf263c9e8f
In forts mode, hedgehogs on the left look at the right, and vice-versa
unc0rr
parents:
997
diff
changeset
|
1300 |
Gear^.dX.isNegative:= p = 1; |
958 | 1301 |
end; |
955 | 1302 |
inc(t, 1024) |
1303 |
end |
|
1304 |
end else // mix hedgehogs |
|
1305 |
begin |
|
1306 |
Count:= 0; |
|
1307 |
for p:= 0 to Pred(TeamsCount) do |
|
1308 |
with TeamsArray[p]^ do |
|
1309 |
begin |
|
1310 |
for i:= 0 to cMaxHHIndex do |
|
1311 |
with Hedgehogs[i] do |
|
1312 |
if (Gear <> nil) and (Gear^.X.QWordValue = 0) then |
|
1313 |
begin |
|
1314 |
ar[Count]:= Gear; |
|
1315 |
inc(Count) |
|
1316 |
end; |
|
1317 |
end; |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1318 |
|
955 | 1319 |
while (Count > 0) do |
1320 |
begin |
|
1321 |
i:= GetRandom(Count); |
|
1322 |
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
|
1323 |
ar[i]^.dX.isNegative:= ar[i]^.X > _1024; |
959 | 1324 |
ar[i]^.Pos:= GetRandom(19); |
955 | 1325 |
ar[i]:= ar[Count - 1]; |
1326 |
dec(Count) |
|
1327 |
end |
|
1328 |
end |
|
4 | 1329 |
end; |
1330 |
||
371 | 1331 |
function CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear; |
10 | 1332 |
var t: PGear; |
1333 |
begin |
|
1334 |
t:= GearsList; |
|
1335 |
rX:= sqr(rX); |
|
1336 |
rY:= sqr(rY); |
|
1337 |
while t <> nil do |
|
1338 |
begin |
|
351 | 1339 |
if (t <> Gear) and (t^.Kind = Kind) then |
498 | 1340 |
if not((hwSqr(Gear^.X - t^.X) / rX + hwSqr(Gear^.Y - t^.Y) / rY) > _1) then |
351 | 1341 |
exit(t); |
1342 |
t:= t^.NextGear |
|
10 | 1343 |
end; |
351 | 1344 |
CheckGearNear:= nil |
15 | 1345 |
end; |
1346 |
||
79 | 1347 |
procedure AmmoFlameWork(Ammo: PGear); |
1348 |
var t: PGear; |
|
1349 |
begin |
|
1350 |
t:= GearsList; |
|
1351 |
while t <> nil do |
|
1352 |
begin |
|
351 | 1353 |
if (t^.Kind = gtHedgehog) and (t^.Y < Ammo^.Y) then |
498 | 1354 |
if not (hwSqr(Ammo^.X - t^.X) + hwSqr(Ammo^.Y - t^.Y - int2hwFloat(cHHRadius)) * 2 > _2) then |
79 | 1355 |
begin |
351 | 1356 |
inc(t^.Damage, 5); |
1357 |
t^.dX:= t^.dX + (t^.X - Ammo^.X) * _0_02; |
|
1358 |
t^.dY:= - _0_25; |
|
1359 |
t^.Active:= true; |
|
79 | 1360 |
DeleteCI(t); |
1361 |
FollowGear:= t |
|
1362 |
end; |
|
351 | 1363 |
t:= t^.NextGear |
79 | 1364 |
end; |
1365 |
end; |
|
1366 |
||
371 | 1367 |
function CheckGearsNear(mX, mY: LongInt; Kind: TGearsType; rX, rY: LongInt): PGear; |
16 | 1368 |
var t: PGear; |
1369 |
begin |
|
1370 |
t:= GearsList; |
|
1371 |
rX:= sqr(rX); |
|
1372 |
rY:= sqr(rY); |
|
1373 |
while t <> nil do |
|
1374 |
begin |
|
351 | 1375 |
if t^.Kind in Kind then |
498 | 1376 |
if not (hwSqr(int2hwFloat(mX) - t^.X) / rX + hwSqr(int2hwFloat(mY) - t^.Y) / rY > _1) then |
351 | 1377 |
exit(t); |
1378 |
t:= t^.NextGear |
|
16 | 1379 |
end; |
351 | 1380 |
CheckGearsNear:= nil |
16 | 1381 |
end; |
1382 |
||
1383 |
function CountGears(Kind: TGearType): Longword; |
|
1384 |
var t: PGear; |
|
351 | 1385 |
Result: Longword; |
16 | 1386 |
begin |
1387 |
Result:= 0; |
|
1388 |
t:= GearsList; |
|
1389 |
while t <> nil do |
|
1390 |
begin |
|
351 | 1391 |
if t^.Kind = Kind then inc(Result); |
1392 |
t:= t^.NextGear |
|
16 | 1393 |
end; |
351 | 1394 |
CountGears:= Result |
16 | 1395 |
end; |
1396 |
||
15 | 1397 |
procedure SpawnBoxOfSmth; |
394
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1398 |
var t: LongInt; |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1399 |
i: TAmmoType; |
15 | 1400 |
begin |
614 | 1401 |
if (cCaseFactor = 0) or |
1402 |
(CountGears(gtCase) >= 5) or |
|
1403 |
(getrandom(cCaseFactor) <> 0) then exit; |
|
498 | 1404 |
FollowGear:= AddGear(0, 0, gtCase, 0, _0, _0, 0); |
295 | 1405 |
case getrandom(2) of |
1406 |
0: begin |
|
351 | 1407 |
FollowGear^.Health:= 25; |
1408 |
FollowGear^.Pos:= posCaseHealth |
|
295 | 1409 |
end; |
1410 |
1: begin |
|
394
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1411 |
t:= 0; |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1412 |
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
|
1413 |
inc(t, Ammoz[i].Probability); |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1414 |
t:= GetRandom(t); |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1415 |
i:= Low(TAmmoType); |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1416 |
dec(t, Ammoz[i].Probability); |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1417 |
while t >= 0 do |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1418 |
begin |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1419 |
inc(i); |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1420 |
dec(t, Ammoz[i].Probability) |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1421 |
end; |
865 | 1422 |
PlaySound(sndReinforce, false); |
351 | 1423 |
FollowGear^.Pos:= posCaseAmmo; |
394
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1424 |
FollowGear^.State:= Longword(i) |
295 | 1425 |
end; |
1426 |
end; |
|
70 | 1427 |
FindPlace(FollowGear, true, 0, 2048) |
1428 |
end; |
|
1429 |
||
371 | 1430 |
procedure FindPlace(Gear: PGear; withFall: boolean; Left, Right: LongInt); |
70 | 1431 |
|
371 | 1432 |
function CountNonZeroz(x, y, r: LongInt): LongInt; |
1433 |
var i: LongInt; |
|
1434 |
Result: LongInt; |
|
70 | 1435 |
begin |
1436 |
Result:= 0; |
|
701 | 1437 |
if (y and $FFFFFC00) = 0 then |
1438 |
for i:= max(x - r, 0) to min(x + r, 2043) do |
|
351 | 1439 |
if Land[y, i] <> 0 then inc(Result); |
1440 |
CountNonZeroz:= Result |
|
70 | 1441 |
end; |
1442 |
||
495 | 1443 |
var x: LongInt; |
371 | 1444 |
y, sy: LongInt; |
386 | 1445 |
ar: array[0..511] of TPoint; |
1446 |
ar2: array[0..1023] of TPoint; |
|
392 | 1447 |
cnt, cnt2: Longword; |
1448 |
delta: LongInt; |
|
70 | 1449 |
begin |
386 | 1450 |
delta:= 250; |
1451 |
cnt2:= 0; |
|
16 | 1452 |
repeat |
392 | 1453 |
x:= Left + LongInt(GetRandom(Delta)); |
70 | 1454 |
repeat |
386 | 1455 |
inc(x, Delta); |
70 | 1456 |
cnt:= 0; |
351 | 1457 |
y:= -Gear^.Radius * 2; |
70 | 1458 |
while y < 1023 do |
16 | 1459 |
begin |
70 | 1460 |
repeat |
701 | 1461 |
inc(y, 2); |
351 | 1462 |
until (y > 1023) or (CountNonZeroz(x, y, Gear^.Radius - 1) = 0); |
70 | 1463 |
sy:= y; |
1464 |
repeat |
|
1465 |
inc(y); |
|
351 | 1466 |
until (y > 1023) or (CountNonZeroz(x, y, Gear^.Radius - 1) <> 0); |
1467 |
if (y - sy > Gear^.Radius * 2) |
|
70 | 1468 |
and (y < 1023) |
351 | 1469 |
and (CheckGearsNear(x, y - Gear^.Radius, [gtHedgehog, gtMine, gtCase], 110, 110) = nil) then |
70 | 1470 |
begin |
1471 |
ar[cnt].X:= x; |
|
351 | 1472 |
if withFall then ar[cnt].Y:= sy + Gear^.Radius |
1473 |
else ar[cnt].Y:= y - Gear^.Radius; |
|
70 | 1474 |
inc(cnt) |
1475 |
end; |
|
386 | 1476 |
inc(y, 45) |
16 | 1477 |
end; |
70 | 1478 |
if cnt > 0 then |
1479 |
with ar[GetRandom(cnt)] do |
|
1480 |
begin |
|
386 | 1481 |
ar2[cnt2].x:= x; |
1482 |
ar2[cnt2].y:= y; |
|
1483 |
inc(cnt2) |
|
70 | 1484 |
end |
386 | 1485 |
until (x + Delta > Right); |
1486 |
dec(Delta, 60) |
|
1487 |
until (cnt2 > 0) or (Delta < 70); |
|
1488 |
if cnt2 > 0 then |
|
1489 |
with ar2[GetRandom(cnt2)] do |
|
1490 |
begin |
|
498 | 1491 |
Gear^.X:= int2hwFloat(x); |
1492 |
Gear^.Y:= int2hwFloat(y); |
|
386 | 1493 |
{$IFDEF DEBUGFILE} |
1494 |
AddFileLog('Assigned Gear coordinates (' + inttostr(x) + ',' + inttostr(y) + ')'); |
|
1495 |
{$ENDIF} |
|
1496 |
end |
|
1497 |
else |
|
1498 |
begin |
|
1499 |
OutError('Can''t find place for Gear', false); |
|
1500 |
DeleteGear(Gear) |
|
1501 |
end |
|
10 | 1502 |
end; |
1503 |
||
4 | 1504 |
initialization |
1505 |
||
1506 |
finalization |
|
95 | 1507 |
FreeGearsList; |
4 | 1508 |
|
1509 |
end. |