695 x := hwRound(Gear^.X); |
695 x := hwRound(Gear^.X); |
696 y := hwRound(Gear^.Y); |
696 y := hwRound(Gear^.Y); |
697 if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) |
697 if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) |
698 and (Land[y, x] <> 0) then inc(Gear^.Damage); |
698 and (Land[y, x] <> 0) then inc(Gear^.Damage); |
699 if Gear^.Damage > 5 then |
699 if Gear^.Damage > 5 then |
700 if Gear^.Ammo^.AmmoType = amDEagle then |
700 if Gear^.AmmoType = amDEagle then |
701 AmmoShove(Gear, 7, 20) |
701 AmmoShove(Gear, 7, 20) |
702 else |
702 else |
703 AmmoShove(Gear, Gear^.Timer, 20); |
703 AmmoShove(Gear, Gear^.Timer, 20); |
704 CheckGearDrowning(Gear); |
704 CheckGearDrowning(Gear); |
705 dec(i) |
705 dec(i) |
725 or (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0) |
725 or (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0) |
726 or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then |
726 or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then |
727 begin |
727 begin |
728 if (Gear^.Kind = gtSniperRifleShot) and ((GameFlags and gfLaserSight) = 0) then |
728 if (Gear^.Kind = gtSniperRifleShot) and ((GameFlags and gfLaserSight) = 0) then |
729 cLaserSighting := false; |
729 cLaserSighting := false; |
730 if (Gear^.Ammo^.NumPerTurn <= CurrentHedgehog^.MultiShootAttacks) and |
730 if (Ammoz[Gear^.AmmoType].Ammo.NumPerTurn <= CurrentHedgehog^.MultiShootAttacks) and |
731 ((GameFlags and gfArtillery) = 0) then cArtillery := false; |
731 ((GameFlags and gfArtillery) = 0) then cArtillery := false; |
732 Gear^.doStep := @doStepShotIdle |
732 Gear^.doStep := @doStepShotIdle |
733 end; |
733 end; |
734 end; |
734 end; |
735 |
735 |
1268 if (Gear^.Message and gm_Attack) <> 0 then |
1268 if (Gear^.Message and gm_Attack) <> 0 then |
1269 if (Gear^.State and gsttmpFlag) <> 0 then |
1269 if (Gear^.State and gsttmpFlag) <> 0 then |
1270 with PHedgehog(Gear^.Hedgehog)^ do |
1270 with PHedgehog(Gear^.Hedgehog)^ do |
1271 begin |
1271 begin |
1272 PlaySound(sndRopeRelease); |
1272 PlaySound(sndRopeRelease); |
1273 if Ammo^[CurSlot, CurAmmo].AmmoType <> amParachute then |
1273 if CurAmmoType <> amParachute then |
1274 WaitCollision |
1274 WaitCollision |
1275 else |
1275 else |
1276 DeleteMe |
1276 DeleteMe |
1277 end |
1277 end |
1278 else |
1278 else |
3264 end; |
3264 end; |
3265 end; |
3265 end; |
3266 |
3266 |
3267 //////////////////////////////////////////////////////////////////////////////// |
3267 //////////////////////////////////////////////////////////////////////////////// |
3268 procedure doPortalColorSwitch(); |
3268 procedure doPortalColorSwitch(); |
3269 var |
3269 var flags: LongWord; |
3270 flags: LongWord; |
3270 CurWeapon: PAmmo; |
3271 begin |
3271 begin |
3272 if (CurrentHedgehog <> nil) |
3272 if (CurrentHedgehog <> nil) |
3273 and (CurrentHedgehog^.Gear <> nil) |
3273 and (CurrentHedgehog^.Gear <> nil) |
3274 and ((CurrentHedgehog^.Gear^.Message and gm_Switch) <> 0) then |
3274 and ((CurrentHedgehog^.Gear^.Message and gm_Switch) <> 0) then |
3275 With CurrentHedgehog^ do |
3275 With CurrentHedgehog^ do |
3276 if (Ammo^[CurSlot, CurAmmo].AmmoType = amPortalGun) then |
3276 if (CurAmmoType = amPortalGun) then |
3277 begin |
3277 begin |
3278 CurrentHedgehog^.Gear^.Message := CurrentHedgehog^.Gear^.Message and not gm_Switch; |
3278 CurrentHedgehog^.Gear^.Message := CurrentHedgehog^.Gear^.Message and not gm_Switch; |
3279 |
3279 |
3280 flags := Ammo^[CurSlot, CurAmmo].Timer and not 2; |
3280 CurWeapon:= GetAmmoEntry(CurrentHedgehog^); |
|
3281 flags := CurWeapon^.Timer and not 2; |
3281 if (flags and 1) = 0 then |
3282 if (flags and 1) = 0 then |
3282 Ammo^[CurSlot, CurAmmo].Timer := flags or 1 |
3283 CurWeapon^.Timer := flags or 1 |
3283 else |
3284 else |
3284 Ammo^[CurSlot, CurAmmo].Timer := flags and not 1; |
3285 CurWeapon^.Timer := flags and not 1; |
3285 end; |
3286 end; |
3286 end; |
3287 end; |
3287 |
3288 |
3288 procedure doStepPortal(Gear: PGear); |
3289 procedure doStepPortal(Gear: PGear); |
3289 var |
3290 var |
3446 |
3447 |
3447 if Gear^.Health > 1 then dec(Gear^.Health); |
3448 if Gear^.Health > 1 then dec(Gear^.Health); |
3448 |
3449 |
3449 { // breaks (some) loops |
3450 { // breaks (some) loops |
3450 if Distance(iterator^.dX, iterator^.dY) > _0_96 then |
3451 if Distance(iterator^.dX, iterator^.dY) > _0_96 then |
3451 begin |
3452 begin |
3452 iterator^.dX := iterator^.dX + signAs(cGravity * getRandom(1000),iterator^.dX); |
3453 iterator^.dX := iterator^.dX + signAs(cGravity * getRandom(1000),iterator^.dX); |
3453 iterator^.dY := iterator^.dY + signAs(cGravity * getRandom(1000),iterator^.dY); |
3454 iterator^.dY := iterator^.dY + signAs(cGravity * getRandom(1000),iterator^.dY); |
3454 s := _0_96 / Distance(iterator^.dX, iterator^.dY); |
3455 s := _0_96 / Distance(iterator^.dX, iterator^.dY); |
3455 iterator^.dX := s * iterator^.dX; |
3456 iterator^.dX := s * iterator^.dX; |
3456 iterator^.dY := s * iterator^.dX; |
3457 iterator^.dY := s * iterator^.dX; |
3457 end; |
3458 end; |
3458 } |
3459 } |
3459 end; |
3460 end; |
3460 end; |
3461 end; |
3461 |
3462 |
3462 procedure doStepMovingPortal_real(Gear: PGear); |
3463 procedure doStepMovingPortal_real(Gear: PGear); |
3465 s: hwFloat; |
3466 s: hwFloat; |
3466 |
3467 |
3467 procedure loadNewPortalBall(oldPortal: PGear; destroyGear: Boolean); |
3468 procedure loadNewPortalBall(oldPortal: PGear; destroyGear: Boolean); |
3468 var |
3469 var |
3469 flags: LongWord; |
3470 flags: LongWord; |
|
3471 CurWeapon: PAmmo; |
3470 begin |
3472 begin |
3471 if CurrentHedgehog <> nil then |
3473 if CurrentHedgehog <> nil then |
3472 With CurrentHedgehog^ do |
3474 with CurrentHedgehog^ do |
3473 if (Ammo^[CurSlot, CurAmmo].AmmoType = amPortalGun) then |
|
3474 begin |
3475 begin |
3475 flags := Ammo^[CurSlot, CurAmmo].Timer; |
3476 CurWeapon:= GetAmmoEntry(CurrentHedgehog^); |
|
3477 if (CurAmmoType = amPortalGun) then |
|
3478 begin |
|
3479 flags := CurWeapon^.Timer; |
3476 |
3480 |
3477 if destroyGear xor ((oldPortal^.Tag and 2) = 0) then |
3481 if destroyGear xor ((oldPortal^.Tag and 2) = 0) then |
3478 flags := flags or 1 |
3482 flags := flags or 1 |
3479 else |
3483 else |
3480 flags := flags and not 1; |
3484 flags := flags and not 1; |
3481 |
3485 |
3482 Ammo^[CurSlot, CurAmmo].Timer := flags and not 2; |
3486 CurWeapon^.Timer := flags and not 2; |
3483 // make the ball visible |
3487 // make the ball visible |
|
3488 end |
3484 end; |
3489 end; |
3485 |
3490 |
3486 if destroyGear then oldPortal^.Timer:= 0; |
3491 if destroyGear then oldPortal^.Timer:= 0; |
3487 end; |
3492 end; |
3488 |
3493 |
3556 newPortal^.IntersectGear := nil; |
3562 newPortal^.IntersectGear := nil; |
3557 |
3563 |
3558 if CurrentHedgehog <> nil then |
3564 if CurrentHedgehog <> nil then |
3559 With CurrentHedgehog^ do |
3565 With CurrentHedgehog^ do |
3560 begin |
3566 begin |
|
3567 CurWeapon:= GetAmmoEntry(CurrentHedgehog^); |
3561 // let's save the HH's dX's direction so we can decide where the "top" of the portal hole |
3568 // let's save the HH's dX's direction so we can decide where the "top" of the portal hole |
3562 newPortal^.Elasticity.isNegative := CurrentHedgehog^.Gear^.dX.isNegative; |
3569 newPortal^.Elasticity.isNegative := CurrentHedgehog^.Gear^.dX.isNegative; |
3563 // when doing a backjump the dx is the opposite of the facing direction |
3570 // when doing a backjump the dx is the opposite of the facing direction |
3564 if ((Gear^.State and gstHHHJump) <> 0) and not cArtillery then |
3571 if ((Gear^.State and gstHHHJump) <> 0) and not cArtillery then |
3565 newPortal^.Elasticity.isNegative := not newPortal^.Elasticity.isNegative; |
3572 newPortal^.Elasticity.isNegative := not newPortal^.Elasticity.isNegative; |
3566 |
3573 |
3567 // make portal gun look unloaded |
3574 // make portal gun look unloaded |
3568 Ammo^[CurSlot, CurAmmo].Timer := Ammo^[CurSlot, CurAmmo].Timer or 2; |
3575 CurWeapon^.Timer := CurWeapon^.Timer or 2; |
3569 |
3576 |
3570 // set portal to the currently chosen color |
3577 // set portal to the currently chosen color |
3571 if ((Ammo^[CurSlot, CurAmmo].Timer and 1) <> 0) then |
3578 if ((CurWeapon^.Timer and 1) <> 0) then |
3572 newPortal^.Tag := newPortal^.Tag or 2; |
3579 newPortal^.Tag := newPortal^.Tag or 2; |
3573 |
3580 |
3574 iterator := GearsList; |
3581 iterator := GearsList; |
3575 while iterator <> nil do |
3582 while iterator <> nil do |
3576 begin |
3583 begin |