7270 and (distX.Round < 500) |
7270 and (distX.Round < 500) |
7271 and (hwAbs(distY) < hwAbs(distX * _1_5)) |
7271 and (hwAbs(distY) < hwAbs(distX * _1_5)) |
7272 and (TraceAttackPath(Sentry^.X, Sentry^.Y, targetX, targetY, _4, lfLandMask) <= 18); |
7272 and (TraceAttackPath(Sentry^.X, Sentry^.Y, targetX, targetY, _4, lfLandMask) <= 18); |
7273 end; |
7273 end; |
7274 |
7274 |
|
7275 procedure ResetSentryState(Gear: PGear; state, timer: LongInt); |
|
7276 begin |
|
7277 Gear^.Timer := timer; |
|
7278 Gear^.Tag := state; |
|
7279 Gear^.Target.X := 0; |
|
7280 Gear^.Target.Y := 0; |
|
7281 if Gear^.Karma <> 0 then |
|
7282 begin |
|
7283 ClearGlobalHitOrderLeq(Gear^.Karma); |
|
7284 Gear^.Karma := 0; |
|
7285 end; |
|
7286 end; |
|
7287 |
7275 procedure doStepSentry(Gear: PGear); |
7288 procedure doStepSentry(Gear: PGear); |
7276 var HHGear, bullet: PGear; |
7289 var HHGear, bullet: PGear; |
7277 distX, distY, invDistance: HwFloat; |
7290 distX, distY, invDistance: HwFloat; |
7278 const sentry_Idle = 0; |
7291 const sentry_Idle = 0; |
7279 sentry_Walking = 1; |
7292 sentry_Walking = 1; |
7284 HHGear:= nil; |
7297 HHGear:= nil; |
7285 |
7298 |
7286 if CheckGearDrowning(Gear) then |
7299 if CheckGearDrowning(Gear) then |
7287 exit; |
7300 exit; |
7288 |
7301 |
7289 dec(Gear^.Health, Gear^.Damage); |
7302 if Gear^.Damage > 0 then |
7290 Gear^.Damage := 0; |
|
7291 if Gear^.Health <= 0 then |
|
7292 begin |
7303 begin |
7293 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
7304 dec(Gear^.Health, Gear^.Damage); |
7294 DeleteGear(Gear); |
7305 Gear^.Damage := 0; |
7295 exit; |
7306 if Gear^.Health <= 0 then |
|
7307 begin |
|
7308 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
|
7309 DeleteGear(Gear); |
|
7310 exit; |
|
7311 end; |
|
7312 |
|
7313 ResetSentryState(Gear, sentry_Reloading, 10000) |
7296 end; |
7314 end; |
7297 |
7315 |
7298 if ((Gear^.Health * 100) < random(cSentryHealth * 90)) and ((GameTicks and $FF) = 0) then |
7316 if ((Gear^.Health * 100) < random(cSentryHealth * 90)) and ((GameTicks and $FF) = 0) then |
7299 if Gear^.Health * 2 < cSentryHealth then |
7317 if Gear^.Health * 2 < cSentryHealth then |
7300 AddVisualGear(hwRound(Gear^.X) - 8 + Random(16), hwRound(Gear^.Y) - 2, vgtSmoke) |
7318 AddVisualGear(hwRound(Gear^.X) - 8 + Random(16), hwRound(Gear^.Y) - 2, vgtSmoke) |
7302 AddVisualGear(hwRound(Gear^.X) - 8 + Random(16), hwRound(Gear^.Y) - 2, vgtSmokeWhite); |
7320 AddVisualGear(hwRound(Gear^.X) - 8 + Random(16), hwRound(Gear^.Y) - 2, vgtSmokeWhite); |
7303 |
7321 |
7304 if Gear^.dY.isNegative or (TestCollisionYwithGear(Gear, 1) = 0) then |
7322 if Gear^.dY.isNegative or (TestCollisionYwithGear(Gear, 1) = 0) then |
7305 begin |
7323 begin |
7306 doStepFallingGear(Gear); |
7324 doStepFallingGear(Gear); |
7307 if Gear^.Tag <> sentry_Idle then |
7325 if not (Gear^.Tag in [sentry_Idle, sentry_Reloading]) then |
7308 begin |
7326 ResetSentryState(Gear, sentry_Idle, 1000); |
7309 Gear^.Timer := 0; |
|
7310 Gear^.Tag := sentry_Idle; |
|
7311 Gear^.Target.X := 0; |
|
7312 Gear^.Target.Y := 0; |
|
7313 if Gear^.Karma <> 0 then |
|
7314 begin |
|
7315 ClearGlobalHitOrderLeq(Gear^.Karma); |
|
7316 Gear^.Karma := 0; |
|
7317 end; |
|
7318 end; |
|
7319 exit; |
7327 exit; |
7320 end; |
7328 end; |
7321 |
7329 |
7322 if Gear^.Timer > 0 then dec(Gear^.Timer); |
7330 if Gear^.Timer > 0 then dec(Gear^.Timer); |
7323 |
7331 |