293 end; |
306 end; |
294 amRCPlane: begin |
307 amRCPlane: begin |
295 newGear:= AddGear(hwRound(lx), hwRound(ly), gtRCPlane, 0, xx * cMaxPower / cPowerDivisor / 4, yy * cMaxPower / cPowerDivisor / 4, 0); |
308 newGear:= AddGear(hwRound(lx), hwRound(ly), gtRCPlane, 0, xx * cMaxPower / cPowerDivisor / 4, yy * cMaxPower / cPowerDivisor / 4, 0); |
296 newGear^.SoundChannel:= LoopSound(sndRCPlane, nil) |
309 newGear^.SoundChannel:= LoopSound(sndRCPlane, nil) |
297 end; |
310 end; |
298 amKamikaze: newGear:= AddGear(hwRound(lx), hwRound(ly), gtKamikaze, 0, xx * _0_5, yy * _0_5, 0); |
311 amKamikaze: newGear:= AddGear(hwRound(lx), hwRound(ly), gtKamikaze, 0, xx * _0_5, yy * _0_5, 0); |
299 amCake: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 3, hwRound(ly), gtCake, 0, xx, _0, 0); |
312 amCake: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 3, hwRound(ly), gtCake, 0, xx, _0, 0); |
300 amSeduction: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSeduction, 0, _0, _0, 0); |
313 amSeduction: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSeduction, 0, _0, _0, 0); |
301 amWatermelon: newGear:= AddGear(hwRound(lx), hwRound(ly), gtWatermelon, 0, newDx, newDy, CurWeapon^.Timer); |
314 amWatermelon: newGear:= AddGear(hwRound(lx), hwRound(ly), gtWatermelon, 0, newDx, newDy, CurWeapon^.Timer); |
302 amHellishBomb: newGear:= AddGear(hwRound(lx), hwRound(ly), gtHellishBomb, 0, newDx, newDy, 0); |
315 amHellishBomb: newGear:= AddGear(hwRound(lx), hwRound(ly), gtHellishBomb, 0, newDx, newDy, 0); |
303 amDrill: newGear:= AddGear(hwRound(lx), hwRound(ly), gtDrill, 0, newDx, newDy, 0); |
316 amDrill: newGear:= AddGear(hwRound(lx), hwRound(ly), gtDrill, 0, newDx, newDy, 0); |
304 amBallgun: newGear:= AddGear(hwRound(X), hwRound(Y), gtBallgun, 0, xx * _0_5, yy * _0_5, 0); |
317 amBallgun: newGear:= AddGear(hwRound(X), hwRound(Y), gtBallgun, 0, xx * _0_5, yy * _0_5, 0); |
305 amJetpack: newGear:= AddGear(hwRound(lx), hwRound(ly), gtJetpack, 0, _0, _0, 0); |
318 amJetpack: newGear:= AddGear(hwRound(lx), hwRound(ly), gtJetpack, 0, _0, _0, 0); |
306 amBirdy: begin |
319 amBirdy: begin |
307 PlaySound(sndWhistle); |
320 PlaySound(sndWhistle); |
308 newGear:= AddGear(hwRound(lx), hwRound(ly) - 32, gtBirdy, 0, _0, _0, 0); |
321 newGear:= AddGear(hwRound(lx), hwRound(ly) - 32, gtBirdy, 0, _0, _0, 0); |
309 end; |
322 end; |
310 amLowGravity: begin |
323 amLowGravity: begin |
311 PlaySound(sndLowGravity); |
324 PlaySound(sndLowGravity); |
312 cGravity:= cMaxWindSpeed; |
325 cGravity:= cMaxWindSpeed; |
313 cGravityf:= 0.00025 |
326 cGravityf:= 0.00025 |
314 end; |
327 end; |
315 amExtraDamage:begin |
328 amExtraDamage: begin |
316 PlaySound(sndHellishImpact4); |
329 PlaySound(sndHellishImpact4); |
317 cDamageModifier:= _1_5 |
330 cDamageModifier:= _1_5 |
318 end; |
331 end; |
319 amInvulnerable: Invulnerable:= true; |
332 amInvulnerable: Invulnerable:= true; |
320 amExtraTime: begin |
333 amExtraTime: begin |
321 PlaySound(sndSwitchHog); |
334 PlaySound(sndSwitchHog); |
322 TurnTimeLeft:= TurnTimeLeft + 30000 |
335 TurnTimeLeft:= TurnTimeLeft + 30000 |
323 end; |
336 end; |
324 amLaserSight: cLaserSighting:= true; |
337 amLaserSight: cLaserSighting:= true; |
325 amVampiric: begin |
338 amVampiric: begin |
326 PlaySound(sndOw1, Team^.voicepack); |
339 PlaySound(sndOw1, Team^.voicepack); |
327 cVampiric:= true; |
340 cVampiric:= true; |
328 end; |
341 end; |
329 amPiano: begin |
342 amPiano: begin |
330 // Tuck the hedgehog away until the piano attack is completed |
343 // Tuck the hedgehog away until the piano attack is completed |
331 Unplaced:= true; |
344 Unplaced:= true; |
332 X:= _0; |
345 X:= _0; |
333 Y:= _0; |
346 Y:= _0; |
334 newGear:= AddGear(TargetPoint.X, 0, gtPiano, 0, _0, _0, 0); |
347 newGear:= AddGear(TargetPoint.X, 0, gtPiano, 0, _0, _0, 0); |
335 PauseMusic |
348 PauseMusic |
336 end; |
349 end; |
337 amFlamethrower: newGear:= AddGear(hwRound(X), hwRound(Y), gtFlamethrower, 0, xx * _0_5, yy * _0_5, 0); |
350 amFlamethrower: newGear:= AddGear(hwRound(X), hwRound(Y), gtFlamethrower, 0, xx * _0_5, yy * _0_5, 0); |
338 amLandGun: newGear:= AddGear(hwRound(X), hwRound(Y), gtLandGun, 0, xx * _0_5, yy * _0_5, 0); |
351 amLandGun: newGear:= AddGear(hwRound(X), hwRound(Y), gtLandGun, 0, xx * _0_5, yy * _0_5, 0); |
339 amResurrector: begin |
352 amResurrector: begin |
340 newGear:= AddGear(hwRound(lx), hwRound(ly), |
353 newGear:= AddGear(hwRound(lx), hwRound(ly), gtResurrector, 0, _0, _0, 0); |
341 gtResurrector, 0, _0, _0, 0); |
354 newGear^.SoundChannel := LoopSound(sndResurrector); |
342 newGear^.SoundChannel := LoopSound(sndResurrector); |
355 end; |
343 end; |
356 //amMelonStrike: AddGear(CurWeapon^.Pos, 0, gtAirAttack, 4, _0, _0, 0); |
344 //amMelonStrike: AddGear(CurWeapon^.Pos, 0, gtAirAttack, 4, _0, _0, 0); |
357 amStructure: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtStructure, gstWait, SignAs(_0_02, dX), _0, 3000); |
345 amStructure: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtStructure, gstWait, SignAs(_0_02, dX), _0, 3000); |
358 amTardis: newGear:= AddGear(hwRound(X), hwRound(Y), gtTardis, 0, _0, _0, 5000); |
346 amTardis: newGear:= AddGear(hwRound(X), hwRound(Y), gtTardis, 0, _0, _0, 5000); |
359 end; |
347 end; |
360 |
348 case CurAmmoType of |
361 case CurAmmoType of |
349 amGrenade, amMolotov, |
362 amGrenade, amMolotov, |
350 amClusterBomb, amGasBomb, |
363 amClusterBomb, amGasBomb, |
351 amBazooka, amSnowball, |
364 amBazooka, amSnowball, |
352 amBee, amSMine, |
365 amBee, amSMine, |
606 var PrevdX: LongInt; |
640 var PrevdX: LongInt; |
607 CurWeapon: PAmmo; |
641 CurWeapon: PAmmo; |
608 begin |
642 begin |
609 CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^); |
643 CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^); |
610 if ((Gear^.State and (gstAttacking or gstMoving)) = 0) then |
644 if ((Gear^.State and (gstAttacking or gstMoving)) = 0) then |
611 begin |
645 begin |
612 if isCursorVisible then |
646 if isCursorVisible then |
613 with Gear^.Hedgehog^ do |
647 with Gear^.Hedgehog^ do |
614 with CurWeapon^ do |
648 with CurWeapon^ do |
615 begin |
649 begin |
616 if (Gear^.Message and gmLeft ) <> 0 then |
650 if (Gear^.Message and gmLeft ) <> 0 then |
617 Pos:= (Pos - 1 + Ammoz[AmmoType].PosCount) mod Ammoz[AmmoType].PosCount |
651 Pos:= (Pos - 1 + Ammoz[AmmoType].PosCount) mod Ammoz[AmmoType].PosCount |
618 else |
652 else |
619 if (Gear^.Message and gmRight ) <> 0 then |
653 if (Gear^.Message and gmRight ) <> 0 then |
620 Pos:= (Pos + 1) mod Ammoz[AmmoType].PosCount |
654 Pos:= (Pos + 1) mod Ammoz[AmmoType].PosCount |
621 else exit; |
655 else |
622 StepTicks:= 200; |
656 exit; |
623 exit |
657 StepTicks:= 200; |
624 end; |
658 exit |
|
659 end; |
625 |
660 |
626 if ((Gear^.Message and gmAnimate) <> 0) then |
661 if ((Gear^.Message and gmAnimate) <> 0) then |
627 begin |
662 begin |
628 Gear^.Message:= 0; |
663 Gear^.Message:= 0; |
629 Gear^.State:= Gear^.State or gstAnimation; |
664 Gear^.State:= Gear^.State or gstAnimation; |
630 Gear^.Tag:= Gear^.MsgParam; |
665 Gear^.Tag:= Gear^.MsgParam; |
631 Gear^.Timer:= 0; |
666 Gear^.Timer:= 0; |
632 Gear^.Pos:= 0 |
667 Gear^.Pos:= 0 |
633 end; |
668 end; |
634 |
669 |
635 if ((Gear^.Message and gmLJump ) <> 0) then |
670 if ((Gear^.Message and gmLJump ) <> 0) then |
636 begin |
671 begin |
637 Gear^.Message:= Gear^.Message and (not gmLJump); |
672 Gear^.Message:= Gear^.Message and (not gmLJump); |
638 DeleteCI(Gear); |
673 DeleteCI(Gear); |
639 if TestCollisionYwithGear(Gear, -1) = 0 then |
674 if TestCollisionYwithGear(Gear, -1) = 0 then |
640 if not TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _2 else |
675 if not TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) then |
641 if not TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _1; |
676 Gear^.Y:= Gear^.Y - _2 |
642 if not (TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) |
677 else |
643 or (TestCollisionYwithGear(Gear, -1) <> 0)) then |
678 if not TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) then |
644 begin |
679 Gear^.Y:= Gear^.Y - _1; |
645 Gear^.dY:= -_0_15; |
680 if not (TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) |
646 if not cArtillery then Gear^.dX:= SignAs(_0_15, Gear^.dX); |
681 or (TestCollisionYwithGear(Gear, -1) <> 0)) then |
647 Gear^.State:= Gear^.State or gstMoving or gstHHJumping; |
682 begin |
648 PlaySound(sndJump1, Gear^.Hedgehog^.Team^.voicepack); |
683 Gear^.dY:= -_0_15; |
649 exit |
684 if not cArtillery then |
650 end; |
685 Gear^.dX:= SignAs(_0_15, Gear^.dX); |
651 end; |
686 Gear^.State:= Gear^.State or gstMoving or gstHHJumping; |
652 |
687 PlaySound(sndJump1, Gear^.Hedgehog^.Team^.voicepack); |
653 if ((Gear^.Message and gmHJump ) <> 0) then |
688 exit |
654 begin |
689 end; |
655 DeleteCI(Gear); |
690 end; |
656 Gear^.Message:= Gear^.Message and (not gmHJump); |
691 |
657 |
692 if ((Gear^.Message and gmHJump ) <> 0) then |
658 Gear^.dY:= -_0_2; |
693 begin |
659 SetLittle(Gear^.dX); |
694 DeleteCI(Gear); |
660 Gear^.State:= Gear^.State or gstMoving or gstHHJumping; |
695 Gear^.Message:= Gear^.Message and (not gmHJump); |
661 PlaySound(sndJump3, Gear^.Hedgehog^.Team^.voicepack); |
696 |
662 exit |
697 Gear^.dY:= -_0_2; |
663 end; |
698 SetLittle(Gear^.dX); |
664 |
699 Gear^.State:= Gear^.State or gstMoving or gstHHJumping; |
665 PrevdX:= hwSign(Gear^.dX); |
700 PlaySound(sndJump3, Gear^.Hedgehog^.Team^.voicepack); |
666 if (Gear^.Message and gmLeft )<>0 then Gear^.dX:= -cLittle else |
701 exit |
667 if (Gear^.Message and gmRight )<>0 then Gear^.dX:= cLittle else exit; |
702 end; |
668 |
703 |
669 if (Gear^.Message and (gmLeft or gmRight)) <> 0 then |
704 PrevdX:= hwSign(Gear^.dX); |
670 begin |
705 if (Gear^.Message and gmLeft )<>0 then |
671 StepSoundTimer:= cHHStepTicks; |
706 Gear^.dX:= -cLittle else |
672 end; |
707 if (Gear^.Message and gmRight )<>0 then |
|
708 Gear^.dX:= cLittle else exit; |
|
709 |
|
710 if (Gear^.Message and (gmLeft or gmRight)) <> 0 then |
|
711 begin |
|
712 StepSoundTimer:= cHHStepTicks; |
|
713 end; |
673 |
714 |
674 StepTicks:= cHHStepTicks; |
715 StepTicks:= cHHStepTicks; |
675 if PrevdX <> hwSign(Gear^.dX) then |
716 if PrevdX <> hwSign(Gear^.dX) then |
676 begin |
717 begin |
677 FollowGear:= Gear; |
718 FollowGear:= Gear; |
678 exit |
719 exit |
679 end; |
720 end; |
680 DeleteCI(Gear); // must be after exit!! (see previous line) |
721 DeleteCI(Gear); // must be after exit!! (see previous line) |
681 |
722 |
682 Gear^.Hedgehog^.visStepPos:= (Gear^.Hedgehog^.visStepPos + 1) and 7; |
723 Gear^.Hedgehog^.visStepPos:= (Gear^.Hedgehog^.visStepPos + 1) and 7; |
683 if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then |
724 if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then |
684 begin |
725 begin |
685 if not (TestCollisionXwithXYShift(Gear, _0, -6, hwSign(Gear^.dX)) |
726 if not (TestCollisionXwithXYShift(Gear, _0, -6, hwSign(Gear^.dX)) |
686 or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; |
727 or (TestCollisionYwithGear(Gear, -1) <> 0)) then |
687 if not (TestCollisionXwithXYShift(Gear, _0, -5, hwSign(Gear^.dX)) |
728 Gear^.Y:= Gear^.Y - _1; |
688 or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; |
729 if not (TestCollisionXwithXYShift(Gear, _0, -5, hwSign(Gear^.dX)) |
689 if not (TestCollisionXwithXYShift(Gear, _0, -4, hwSign(Gear^.dX)) |
730 or (TestCollisionYwithGear(Gear, -1) <> 0)) then |
690 or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; |
731 Gear^.Y:= Gear^.Y - _1; |
691 if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX)) |
732 if not (TestCollisionXwithXYShift(Gear, _0, -4, hwSign(Gear^.dX)) |
692 or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; |
733 or (TestCollisionYwithGear(Gear, -1) <> 0)) then |
693 if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) |
734 Gear^.Y:= Gear^.Y - _1; |
694 or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; |
735 if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX)) |
695 if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) |
736 or (TestCollisionYwithGear(Gear, -1) <> 0)) then |
696 or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; |
737 Gear^.Y:= Gear^.Y - _1; |
697 end; |
738 if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) |
698 |
739 or (TestCollisionYwithGear(Gear, -1) <> 0)) then |
699 if (not cArtillery) and ((Gear^.Message and gmPrecise) = 0) and (not TestCollisionXwithGear(Gear, hwSign(Gear^.dX))) then |
740 Gear^.Y:= Gear^.Y - _1; |
700 Gear^.X:= Gear^.X + SignAs(_1, Gear^.dX); |
741 if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) |
|
742 or (TestCollisionYwithGear(Gear, -1) <> 0)) then |
|
743 Gear^.Y:= Gear^.Y - _1; |
|
744 end; |
|
745 |
|
746 if (not cArtillery) and ((Gear^.Message and gmPrecise) = 0) and (not TestCollisionXwithGear(Gear, hwSign(Gear^.dX))) then |
|
747 Gear^.X:= Gear^.X + SignAs(_1, Gear^.dX); |
701 |
748 |
702 SetAllHHToActive; |
749 SetAllHHToActive; |
703 |
750 |
704 if TestCollisionYwithGear(Gear, 1) = 0 then |
751 if TestCollisionYwithGear(Gear, 1) = 0 then |
705 begin |
752 begin |
706 Gear^.Y:= Gear^.Y + _1; |
753 Gear^.Y:= Gear^.Y + _1; |
707 if TestCollisionYwithGear(Gear, 1) = 0 then |
754 if TestCollisionYwithGear(Gear, 1) = 0 then |
708 begin |
755 begin |
709 Gear^.Y:= Gear^.Y + _1; |
756 Gear^.Y:= Gear^.Y + _1; |
710 if TestCollisionYwithGear(Gear, 1) = 0 then |
757 if TestCollisionYwithGear(Gear, 1) = 0 then |
711 begin |
758 begin |
712 Gear^.Y:= Gear^.Y + _1; |
759 Gear^.Y:= Gear^.Y + _1; |
713 if TestCollisionYwithGear(Gear, 1) = 0 then |
760 if TestCollisionYwithGear(Gear, 1) = 0 then |
714 begin |
761 begin |
715 Gear^.Y:= Gear^.Y + _1; |
762 Gear^.Y:= Gear^.Y + _1; |
716 if TestCollisionYwithGear(Gear, 1) = 0 then |
763 if TestCollisionYwithGear(Gear, 1) = 0 then |
717 begin |
764 begin |
718 Gear^.Y:= Gear^.Y + _1; |
765 Gear^.Y:= Gear^.Y + _1; |
719 if TestCollisionYwithGear(Gear, 1) = 0 then |
766 if TestCollisionYwithGear(Gear, 1) = 0 then |
720 begin |
767 begin |
721 Gear^.Y:= Gear^.Y + _1; |
768 Gear^.Y:= Gear^.Y + _1; |
722 if TestCollisionYwithGear(Gear, 1) = 0 then |
769 if TestCollisionYwithGear(Gear, 1) = 0 then |
723 begin |
770 begin |
724 Gear^.Y:= Gear^.Y - _6; |
771 Gear^.Y:= Gear^.Y - _6; |
725 Gear^.dY:= _0; |
772 Gear^.dY:= _0; |
726 Gear^.State:= Gear^.State or gstMoving; |
773 Gear^.State:= Gear^.State or gstMoving; |
727 exit |
774 exit |
728 end; |
775 end; |
729 end |
776 end |
730 end |
777 end |
731 end |
778 end |
732 end |
779 end |
733 end |
780 end |
734 end; |
781 end; |
735 AddGearCI(Gear) |
782 AddGearCI(Gear) |
736 end |
783 end |
737 end; |
784 end; |
738 |
785 |
739 procedure HedgehogChAngle(HHGear: PGear); |
786 procedure HedgehogChAngle(HHGear: PGear); |
740 var da: LongWord; |
787 var da: LongWord; |
741 begin |
788 begin |
742 with HHGear^.Hedgehog^ do |
789 with HHGear^.Hedgehog^ do |
743 if ((CurAmmoType = amRope) and |
790 if ((CurAmmoType = amRope) and ((HHGear^.State and (gstMoving or gstHHJumping)) = gstMoving)) |
744 ((HHGear^.State and (gstMoving or gstHHJumping)) = gstMoving)) or |
791 or ((CurAmmoType = amPortalGun) and ((HHGear^.State and gstMoving) <> 0)) then |
745 ((CurAmmoType = amPortalGun) and |
792 da:= 2 |
746 ((HHGear^.State and gstMoving) <> 0)) then da:= 2 |
|
747 else da:= 1; |
793 else da:= 1; |
748 |
794 |
749 if (((HHGear^.Message and gmPrecise) = 0) or ((GameTicks mod 5) = 1)) then |
795 if (((HHGear^.Message and gmPrecise) = 0) or ((GameTicks mod 5) = 1)) then |
750 if ((HHGear^.Message and gmUp) <> 0) and (HHGear^.Angle >= CurMinAngle + da) then dec(HHGear^.Angle, da) |
796 if ((HHGear^.Message and gmUp) <> 0) and (HHGear^.Angle >= CurMinAngle + da) then |
|
797 dec(HHGear^.Angle, da) |
751 else |
798 else |
752 if ((HHGear^.Message and gmDown) <> 0) and (HHGear^.Angle + da <= CurMaxAngle) then inc(HHGear^.Angle, da) |
799 if ((HHGear^.Message and gmDown) <> 0) and (HHGear^.Angle + da <= CurMaxAngle) then |
|
800 inc(HHGear^.Angle, da) |
753 end; |
801 end; |
754 |
802 |
755 |
803 |
756 //////////////////////////////////////////////////////////////////////////////// |
804 //////////////////////////////////////////////////////////////////////////////// |
757 procedure doStepHedgehogMoving(Gear: PGear); |
805 procedure doStepHedgehogMoving(Gear: PGear); |
758 var isFalling, isUnderwater: boolean; |
806 var isFalling, isUnderwater: boolean; |
759 land: Word; |
807 land: Word; |
760 begin |
808 begin |
761 land:= 0; |
809 land:= 0; |
762 isUnderwater:= cWaterLine < hwRound(Gear^.Y) + Gear^.Radius; |
810 isUnderwater:= cWaterLine < hwRound(Gear^.Y) + Gear^.Radius; |
763 if Gear^.dX.QWordValue > 8160437862 then Gear^.dX.QWordValue:= 8160437862; |
811 if Gear^.dX.QWordValue > 8160437862 then |
764 if Gear^.dY.QWordValue > 8160437862 then Gear^.dY.QWordValue:= 8160437862; |
812 Gear^.dX.QWordValue:= 8160437862; |
|
813 if Gear^.dY.QWordValue > 8160437862 then |
|
814 Gear^.dY.QWordValue:= 8160437862; |
765 |
815 |
766 if Gear^.Hedgehog^.Unplaced then |
816 if Gear^.Hedgehog^.Unplaced then |
767 begin |
817 begin |
768 Gear^.dY:= _0; |
818 Gear^.dY:= _0; |
769 Gear^.dX:= _0; |
819 Gear^.dX:= _0; |
770 Gear^.State:= Gear^.State and (not gstMoving); |
820 Gear^.State:= Gear^.State and (not gstMoving); |
771 exit |
821 exit |
772 end; |
822 end; |
773 isFalling:= (Gear^.dY.isNegative) or not TestCollisionYKick(Gear, 1); |
823 isFalling:= (Gear^.dY.isNegative) or not TestCollisionYKick(Gear, 1); |
774 if isFalling then |
824 if isFalling then |
775 begin |
825 begin |
776 if (Gear^.dY.isNegative) and TestCollisionYKick(Gear, -1) then Gear^.dY:= _0; |
826 if (Gear^.dY.isNegative) and TestCollisionYKick(Gear, -1) then |
777 Gear^.State:= Gear^.State or gstMoving; |
827 Gear^.dY:= _0; |
778 if (CurrentHedgehog^.Gear = Gear) |
828 Gear^.State:= Gear^.State or gstMoving; |
|
829 if (CurrentHedgehog^.Gear = Gear) |
779 and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then |
830 and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then |
780 begin |
831 begin |
781 FollowGear:= Gear; |
832 FollowGear:= Gear; |
782 end; |
833 end; |
783 if isUnderwater then Gear^.dY:= Gear^.dY + cGravity / _2 |
834 if isUnderwater then |
784 else |
835 Gear^.dY:= Gear^.dY + cGravity / _2 |
785 begin |
836 else |
786 Gear^.dY:= Gear^.dY + cGravity; |
837 begin |
|
838 Gear^.dY:= Gear^.dY + cGravity; |
787 // this set of circumstances could be less complex if jumping was more clearly identified |
839 // this set of circumstances could be less complex if jumping was more clearly identified |
788 if ((GameFlags and gfMoreWind) <> 0) and |
840 if ((GameFlags and gfMoreWind) <> 0) and (((Gear^.Damage <> 0) |
789 (((Gear^.Damage <> 0) or |
841 or ((CurAmmoGear <> nil) and ((CurAmmoGear^.AmmoType = amJetpack) or (CurAmmoGear^.AmmoType = amBirdy))) |
790 ((CurAmmoGear <> nil) and |
842 or ((Gear^.dY.QWordValue + Gear^.dX.QWordValue) > _0_55.QWordValue))) then |
791 ((CurAmmoGear^.AmmoType = amJetpack) or |
843 Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density |
792 (CurAmmoGear^.AmmoType = amBirdy))) or |
844 end |
793 ((Gear^.dY.QWordValue + Gear^.dX.QWordValue) > _0_55.QWordValue))) |
845 end |
794 then Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density |
|
795 end |
|
796 end |
|
797 else |
846 else |
798 begin |
847 begin |
799 land:= TestCollisionYwithGear(Gear, 1); |
848 land:= TestCollisionYwithGear(Gear, 1); |
800 if ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) < _0_55.QWordValue) and ((land and lfIce) = 0) |
849 if ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) < _0_55.QWordValue) and ((land and lfIce) = 0) |
801 and ((Gear^.State and gstHHJumping) <> 0) then SetLittle(Gear^.dX); |
850 and ((Gear^.State and gstHHJumping) <> 0) then |
802 |
851 SetLittle(Gear^.dX); |
803 if not Gear^.dY.isNegative then |
852 |
804 begin |
853 if not Gear^.dY.isNegative then |
805 CheckHHDamage(Gear); |
854 begin |
806 |
855 CheckHHDamage(Gear); |
807 if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) and |
856 |
808 (Gear^.dX.QWordValue < _0_02.QWordValue) then Gear^.dX.isNegative:= not Gear^.dX.isNegative; // landing after high jump |
857 if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) |
809 |
858 and (Gear^.dX.QWordValue < _0_02.QWordValue) then |
810 Gear^.State:= Gear^.State and (not (gstHHJumping or gstHHHJump)); |
859 Gear^.dX.isNegative:= not Gear^.dX.isNegative; // landing after high jump |
811 Gear^.dY:= _0; |
860 Gear^.State:= Gear^.State and (not (gstHHJumping or gstHHHJump)); |
812 end else Gear^.dY:= Gear^.dY + cGravity; |
861 Gear^.dY:= _0; |
813 |
862 end |
814 if ((Gear^.State and gstMoving) <> 0) then |
863 else |
815 begin |
864 Gear^.dY:= Gear^.dY + cGravity; |
816 if land and lfIce <> 0 then |
865 |
817 begin |
866 if ((Gear^.State and gstMoving) <> 0) then |
818 Gear^.dX:= Gear^.dX * (_1 - (_1 - Gear^.Friction) / _2) |
867 begin |
819 end |
868 if land and lfIce <> 0 then |
820 else Gear^.dX:= Gear^.dX * Gear^.Friction; |
869 begin |
821 end |
870 Gear^.dX:= Gear^.dX * (_1 - (_1 - Gear^.Friction) / _2) |
822 end; |
871 end |
823 |
872 else |
824 if (Gear^.State <> 0) then DeleteCI(Gear); |
873 Gear^.dX:= Gear^.dX * Gear^.Friction; |
|
874 end |
|
875 end; |
|
876 |
|
877 if (Gear^.State <> 0) then |
|
878 DeleteCI(Gear); |
825 |
879 |
826 if isUnderwater then |
880 if isUnderwater then |
827 begin |
881 begin |
828 Gear^.dY:= Gear^.dY * _0_999; |
882 Gear^.dY:= Gear^.dY * _0_999; |
829 Gear^.dX:= Gear^.dX * _0_999; |
883 Gear^.dX:= Gear^.dX * _0_999; |
830 end; |
884 end; |
831 |
885 |
832 if (Gear^.State and gstMoving) <> 0 then |
886 if (Gear^.State and gstMoving) <> 0 then |
833 if TestCollisionXKick(Gear, hwSign(Gear^.dX)) then |
887 if TestCollisionXKick(Gear, hwSign(Gear^.dX)) then |
834 if not isFalling then |
888 if not isFalling then |
835 if hwAbs(Gear^.dX) > _0_01 then |
889 if hwAbs(Gear^.dX) > _0_01 then |
836 if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -1, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_96; Gear^.Y:= Gear^.Y - _1 end else |
890 if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -1, hwSign(Gear^.dX)) then |
837 if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -2, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_93; Gear^.Y:= Gear^.Y - _2 end else |
891 begin |
838 if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -3, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_9 ; Gear^.Y:= Gear^.Y - _3 end else |
892 Gear^.X:= Gear^.X + Gear^.dX; |
839 if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -4, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_87; Gear^.Y:= Gear^.Y - _4 end else |
893 Gear^.dX:= Gear^.dX * _0_96; |
840 if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -5, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_84; Gear^.Y:= Gear^.Y - _5 end else |
894 Gear^.Y:= Gear^.Y - _1 |
841 if hwAbs(Gear^.dX) > _0_02 then Gear^.dX:= -Gear^.Elasticity * Gear^.dX |
895 end |
842 else begin |
896 else |
843 Gear^.State:= Gear^.State and (not gstMoving); |
897 if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -2, hwSign(Gear^.dX)) then |
844 while TestCollisionYWithGear(Gear,1) = 0 do Gear^.Y:= Gear^.Y+_1; |
898 begin |
845 SetLittle(Gear^.dX) |
899 Gear^.X:= Gear^.X + Gear^.dX; |
846 end |
900 Gear^.dX:= Gear^.dX * _0_93; |
847 else begin |
901 Gear^.Y:= Gear^.Y - _2 |
848 Gear^.State:= Gear^.State and (not gstMoving); |
902 end |
849 while TestCollisionYWithGear(Gear,1) = 0 do Gear^.Y:= Gear^.Y+_1; |
903 else |
850 SetLittle(Gear^.dX) |
904 if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -3, hwSign(Gear^.dX)) then |
851 end |
905 begin |
852 else if (hwAbs(Gear^.dX) > cLittle) |
906 Gear^.X:= Gear^.X + Gear^.dX; |
853 and ((Gear^.State and gstHHJumping) = 0) |
907 Gear^.dX:= Gear^.dX * _0_9 ; |
854 then Gear^.dX:= -Gear^.Elasticity * Gear^.dX |
908 Gear^.Y:= Gear^.Y - _3 |
855 else SetLittle(Gear^.dX); |
909 end |
856 |
910 else |
857 if (not isFalling) and |
911 if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -4, hwSign(Gear^.dX)) then |
858 (hwAbs(Gear^.dX) + hwAbs(Gear^.dY) < _0_03) then |
912 begin |
859 begin |
913 Gear^.X:= Gear^.X + Gear^.dX; |
860 Gear^.State:= Gear^.State and (not gstWinner); |
914 Gear^.dX:= Gear^.dX * _0_87; |
861 Gear^.State:= Gear^.State and (not gstMoving); |
915 Gear^.Y:= Gear^.Y - _4 |
862 while TestCollisionYWithGear(Gear,1) = 0 do Gear^.Y:= Gear^.Y+_1; |
916 end |
863 SetLittle(Gear^.dX); |
917 else |
864 Gear^.dY:= _0 |
918 if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -5, hwSign(Gear^.dX)) then |
865 end else Gear^.State:= Gear^.State or gstMoving; |
919 begin |
|
920 Gear^.X:= Gear^.X + Gear^.dX; |
|
921 Gear^.dX:= Gear^.dX * _0_84; |
|
922 Gear^.Y:= Gear^.Y - _5 |
|
923 end |
|
924 else |
|
925 if hwAbs(Gear^.dX) > _0_02 then |
|
926 Gear^.dX:= -Gear^.Elasticity * Gear^.dX |
|
927 else |
|
928 begin |
|
929 Gear^.State:= Gear^.State and (not gstMoving); |
|
930 while TestCollisionYWithGear(Gear,1) = 0 do |
|
931 Gear^.Y:= Gear^.Y+_1; |
|
932 SetLittle(Gear^.dX) |
|
933 end |
|
934 else |
|
935 begin |
|
936 Gear^.State:= Gear^.State and (not gstMoving); |
|
937 while TestCollisionYWithGear(Gear,1) = 0 do |
|
938 Gear^.Y:= Gear^.Y+_1; |
|
939 SetLittle(Gear^.dX) |
|
940 end |
|
941 else if (hwAbs(Gear^.dX) > cLittle) |
|
942 and ((Gear^.State and gstHHJumping) = 0) then |
|
943 Gear^.dX:= -Gear^.Elasticity * Gear^.dX |
|
944 else |
|
945 SetLittle(Gear^.dX); |
|
946 |
|
947 if (not isFalling) |
|
948 and (hwAbs(Gear^.dX) + hwAbs(Gear^.dY) < _0_03) then |
|
949 begin |
|
950 Gear^.State:= Gear^.State and (not gstWinner); |
|
951 Gear^.State:= Gear^.State and (not gstMoving); |
|
952 while TestCollisionYWithGear(Gear,1) = 0 do |
|
953 Gear^.Y:= Gear^.Y+_1; |
|
954 SetLittle(Gear^.dX); |
|
955 Gear^.dY:= _0 |
|
956 end |
|
957 else |
|
958 Gear^.State:= Gear^.State or gstMoving; |
866 |
959 |
867 if (Gear^.State and gstMoving) <> 0 then |
960 if (Gear^.State and gstMoving) <> 0 then |
868 begin |
961 begin |
869 Gear^.State:= Gear^.State and (not gstAnimation); |
962 Gear^.State:= Gear^.State and (not gstAnimation); |
870 // ARTILLERY but not being moved by explosions |
963 // ARTILLERY but not being moved by explosions |
871 Gear^.X:= Gear^.X + Gear^.dX; |
964 Gear^.X:= Gear^.X + Gear^.dX; |
872 Gear^.Y:= Gear^.Y + Gear^.dY; |
965 Gear^.Y:= Gear^.Y + Gear^.dY; |
873 if (not Gear^.dY.isNegative) and |
966 if (not Gear^.dY.isNegative) and (not TestCollisionYKick(Gear, 1)) |
874 (not TestCollisionYKick(Gear, 1)) and |
967 and TestCollisionYwithXYShift(Gear, 0, 1, 1) then |
875 TestCollisionYwithXYShift(Gear, 0, 1, 1) then |
968 begin |
876 begin |
969 CheckHHDamage(Gear); |
877 CheckHHDamage(Gear); |
970 Gear^.dY:= _0; |
878 Gear^.dY:= _0; |
971 Gear^.Y:= Gear^.Y + _1 |
879 Gear^.Y:= Gear^.Y + _1 |
972 end; |
880 end; |
973 CheckGearDrowning(Gear); |
881 CheckGearDrowning(Gear); |
974 // hide target cursor if current hog is drowning |
882 // hide target cursor if current hog is drowning |
975 if (Gear^.State and gstDrowning) <> 0 then |
883 if (Gear^.State and gstDrowning) <> 0 then |
976 if (CurrentHedgehog^.Gear = Gear) then |
884 if (CurrentHedgehog^.Gear = Gear) then |
977 isCursorVisible:= false |
885 isCursorVisible:= false |
978 end; |
886 end; |
|
887 |
979 |
888 if (hwAbs(Gear^.dY) > _0) and (Gear^.FlightTime > 0) and ((GameFlags and gfLowGravity) = 0) then |
980 if (hwAbs(Gear^.dY) > _0) and (Gear^.FlightTime > 0) and ((GameFlags and gfLowGravity) = 0) then |
889 begin |
981 begin |
890 inc(Gear^.FlightTime); |
982 inc(Gear^.FlightTime); |
891 if Gear^.FlightTime = 3000 then |
983 if Gear^.FlightTime = 3000 then |
941 end; |
1036 end; |
942 exit |
1037 exit |
943 end; |
1038 end; |
944 |
1039 |
945 if ((HHGear^.State and gstMoving) <> 0) |
1040 if ((HHGear^.State and gstMoving) <> 0) |
946 or (StepTicks = cHHStepTicks) |
1041 or (StepTicks = cHHStepTicks) |
947 or (CurAmmoGear <> nil) then // we are moving |
1042 or (CurAmmoGear <> nil) then // we are moving |
948 begin |
1043 begin |
949 with Hedgehog^ do |
1044 with Hedgehog^ do |
950 if (CurAmmoGear = nil) |
1045 if (CurAmmoGear = nil) |
951 and (HHGear^.dY > _0_39) |
1046 and (HHGear^.dY > _0_39) |
952 and (CurAmmoType = amParachute) then HHGear^.Message:= HHGear^.Message or gmAttack; |
1047 and (CurAmmoType = amParachute) then |
|
1048 HHGear^.Message:= HHGear^.Message or gmAttack; |
953 // check for case with ammo |
1049 // check for case with ammo |
954 t:= CheckGearNear(HHGear, gtCase, 36, 36); |
1050 t:= CheckGearNear(HHGear, gtCase, 36, 36); |
955 if t <> nil then |
1051 if t <> nil then |
956 PickUp(HHGear, t) |
1052 PickUp(HHGear, t) |
957 end; |
1053 end; |
958 |
1054 |
959 if (CurAmmoGear = nil) then |
1055 if (CurAmmoGear = nil) then |
960 if (((HHGear^.Message and gmAttack) <> 0) |
1056 if (((HHGear^.Message and gmAttack) <> 0) |
961 or ((HHGear^.State and gstAttacking) <> 0)) then |
1057 or ((HHGear^.State and gstAttacking) <> 0)) then |
962 Attack(HHGear) // should be before others to avoid desync with '/put' msg and changing weapon msgs |
1058 Attack(HHGear) // should be before others to avoid desync with '/put' msg and changing weapon msgs |
963 else |
1059 else |
964 else |
1060 else |
965 with Hedgehog^ do |
1061 with Hedgehog^ do |
966 if ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) |
1062 if ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) |
967 and ((HHGear^.Message and gmLJump) <> 0) |
1063 and ((HHGear^.Message and gmLJump) <> 0) |
968 and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then |
1064 and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then |
969 begin |
1065 begin |
970 Attack(HHGear); |
1066 Attack(HHGear); |
971 HHGear^.Message:= HHGear^.Message and (not gmLJump) |
1067 HHGear^.Message:= HHGear^.Message and (not gmLJump) |
972 end; |
1068 end; |
973 |
1069 |
974 if (CurAmmoGear = nil) |
1070 if (CurAmmoGear = nil) |
975 or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) |
1071 or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) |
976 or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) then |
1072 or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) then |
977 begin |
1073 begin |
978 if ((HHGear^.Message and gmSlot) <> 0) then |
1074 if ((HHGear^.Message and gmSlot) <> 0) then |
979 if ChangeAmmo(HHGear) then ApplyAmmoChanges(Hedgehog^); |
1075 if ChangeAmmo(HHGear) then ApplyAmmoChanges(Hedgehog^); |
980 |
1076 |
981 if ((HHGear^.Message and gmWeapon) <> 0) then HHSetWeapon(HHGear); |
1077 if ((HHGear^.Message and gmWeapon) <> 0) then |
982 |
1078 HHSetWeapon(HHGear); |
983 if ((HHGear^.Message and gmTimer) <> 0) then HHSetTimer(HHGear); |
1079 |
|
1080 if ((HHGear^.Message and gmTimer) <> 0) then |
|
1081 HHSetTimer(HHGear); |
984 end; |
1082 end; |
985 |
1083 |
986 if CurAmmoGear <> nil then |
1084 if CurAmmoGear <> nil then |
987 begin |
1085 begin |
988 CurAmmoGear^.Message:= HHGear^.Message; |
1086 CurAmmoGear^.Message:= HHGear^.Message; |
989 exit |
1087 exit |
990 end; |
1088 end; |
991 |
1089 |
992 if not isInMultiShoot then |
1090 if not isInMultiShoot then |
993 HedgehogChAngle(HHGear); |
1091 HedgehogChAngle(HHGear); |
994 |
1092 |
995 if (HHGear^.State and gstMoving) <> 0 then |
1093 if (HHGear^.State and gstMoving) <> 0 then |
996 begin |
1094 begin |
997 wasJumping:= ((HHGear^.State and gstHHJumping) <> 0); |
1095 wasJumping:= ((HHGear^.State and gstHHJumping) <> 0); |
998 |
1096 |
999 if ((HHGear^.Message and gmHJump) <> 0) and |
1097 if ((HHGear^.Message and gmHJump) <> 0) and wasJumping and ((HHGear^.State and gstHHHJump) = 0) then |
1000 wasJumping and |
|
1001 ((HHGear^.State and gstHHHJump) = 0) then |
|
1002 if (not (hwAbs(HHGear^.dX) > cLittle)) and (HHGear^.dY < -_0_02) then |
1098 if (not (hwAbs(HHGear^.dX) > cLittle)) and (HHGear^.dY < -_0_02) then |
1003 begin |
1099 begin |
1004 HHGear^.State:= HHGear^.State or gstHHHJump; |
1100 HHGear^.State:= HHGear^.State or gstHHHJump; |
1005 HHGear^.dY:= -_0_25; |
1101 HHGear^.dY:= -_0_25; |
1006 if not cArtillery then HHGear^.dX:= -SignAs(_0_02, HHGear^.dX); |
1102 if not cArtillery then |
|
1103 HHGear^.dX:= -SignAs(_0_02, HHGear^.dX); |
1007 PlaySound(sndJump2, Hedgehog^.Team^.voicepack) |
1104 PlaySound(sndJump2, Hedgehog^.Team^.voicepack) |
1008 end; |
1105 end; |
1009 |
1106 |
1010 HHGear^.Message:= HHGear^.Message and (not (gmLJump or gmHJump)); |
1107 HHGear^.Message:= HHGear^.Message and (not (gmLJump or gmHJump)); |
1011 |
1108 |
1012 if (not cArtillery) and wasJumping and |
1109 if (not cArtillery) and wasJumping and TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then |
1013 TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then SetLittle(HHGear^.dX); |
1110 SetLittle(HHGear^.dX); |
1014 |
1111 |
1015 if Hedgehog^.Gear <> nil then doStepHedgehogMoving(HHGear); |
1112 if Hedgehog^.Gear <> nil then |
|
1113 doStepHedgehogMoving(HHGear); |
1016 |
1114 |
1017 if ((HHGear^.State and (gstMoving or gstDrowning)) = 0) then |
1115 if ((HHGear^.State and (gstMoving or gstDrowning)) = 0) then |
1018 begin |
1116 begin |
1019 AddGearCI(HHGear); |
1117 AddGearCI(HHGear); |
1020 if wasJumping then |
1118 if wasJumping then |