599 end; |
599 end; |
600 |
600 |
601 //Purpose, to reset all transient attributes toggled by a utility. |
601 //Purpose, to reset all transient attributes toggled by a utility. |
602 //If any of these are set as permanent toggles in the frontend, that needs to be checked and skipped here. |
602 //If any of these are set as permanent toggles in the frontend, that needs to be checked and skipped here. |
603 procedure ResetUtilities; |
603 procedure ResetUtilities; |
|
604 var i: LongInt; |
604 begin |
605 begin |
605 cGravity:= cMaxWindSpeed; |
606 cGravity:= cMaxWindSpeed; |
606 cDamageModifier:= _1; |
607 cDamageModifier:= _1; |
607 cLaserSighting:= false; |
608 cLaserSighting:= false; |
608 if (CurrentHedgehog^.Gear <> nil) then |
609 // have to sweep *all* current team hedgehogs since it is theoretically possible if you have enough invulnerabilities and switch turns to make your entire team invulnerable |
609 CurrentHedgehog^.Gear^.Invulnerable:= false; |
610 |
|
611 if (CurrentTeam <> nil) then |
|
612 with CurrentTeam^ do |
|
613 for i:= 0 to cMaxHHIndex do |
|
614 with Hedgehogs[i] do |
|
615 if (Gear <> nil) then |
|
616 Gear^.Invulnerable:= false; |
610 end; |
617 end; |
611 |
618 |
612 procedure SetAllToActive; |
619 procedure SetAllToActive; |
613 var t: PGear; |
620 var t: PGear; |
614 begin |
621 begin |
634 end; |
641 end; |
635 |
642 |
636 procedure DrawHH(Gear: PGear); |
643 procedure DrawHH(Gear: PGear); |
637 var t: LongInt; |
644 var t: LongInt; |
638 amt: TAmmoType; |
645 amt: TAmmoType; |
639 hx, hy, cx, cy, tx, ty, m: LongInt; |
646 hx, hy, cx, cy, tx, ty, sx, sy, m: LongInt; // hedgehog, crosshair, temp, sprite` |
640 lx, ly, dx, dy, aAngle, dAngle: real; |
647 lx, ly, dx, dy, ax, ay, aAngle, dAngle: real; // laser, change |
641 defaultPos, HatVisible: boolean; |
648 defaultPos, HatVisible: boolean; |
642 begin |
649 begin |
643 if (Gear^.State and gstHHDeath) <> 0 then |
650 if (Gear^.State and gstHHDeath) <> 0 then |
644 begin |
651 begin |
645 DrawSprite(sprHHDeath, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 26 + WorldDy, Gear^.Pos); |
652 DrawSprite(sprHHDeath, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 26 + WorldDy, Gear^.Pos); |
699 end else |
717 end else |
700 begin |
718 begin |
701 dAngle:= 180; |
719 dAngle:= 180; |
702 m:= -1 |
720 m:= -1 |
703 end; |
721 end; |
704 DrawHedgehog(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, |
722 sx:= hwRound(Gear^.X) + WorldDx; |
|
723 sy:= hwRound(Gear^.Y) + WorldDy; |
|
724 DrawHedgehog(sx, sy, |
705 m, |
725 m, |
706 1, |
726 1, |
707 0, |
727 0, |
708 DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + dAngle, Gear^.Invulnerable); |
728 DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + dAngle); |
709 defaultPos:= false |
729 defaultPos:= false |
710 end; |
730 end; |
711 gtBlowTorch: begin |
731 gtBlowTorch: begin |
712 DrawRotated(sprBlowTorch, hx, hy, hwSign(Gear^.dX), aangle); |
732 DrawRotated(sprBlowTorch, hx, hy, hwSign(Gear^.dX), aangle); |
713 DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
733 DrawHedgehog(sx, sy, |
714 hwSign(Gear^.dX), |
734 hwSign(Gear^.dX), |
715 3, |
735 3, |
716 PHedgehog(Gear^.Hedgehog)^.visStepPos div 2, |
736 PHedgehog(Gear^.Hedgehog)^.visStepPos div 2, |
717 0, Gear^.Invulnerable); |
737 0); |
718 defaultPos:= false |
738 defaultPos:= false |
719 end; |
739 end; |
720 gtShover: DrawRotated(sprHandBaseball, hx, hy, hwSign(Gear^.dX), aangle + 180); |
740 gtShover: DrawRotated(sprHandBaseball, hx, hy, hwSign(Gear^.dX), aangle + 180); |
721 gtFirePunch: begin |
741 gtFirePunch: begin |
722 DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
742 DrawHedgehog(sx, sy, |
723 hwSign(Gear^.dX), |
743 hwSign(Gear^.dX), |
724 1, |
744 1, |
725 4, |
745 4, |
726 0, Gear^.Invulnerable); |
746 0); |
727 defaultPos:= false |
747 defaultPos:= false |
728 end; |
748 end; |
729 gtPickHammer, |
749 gtPickHammer, |
730 gtTeleport: defaultPos:= false; |
750 gtTeleport: defaultPos:= false; |
731 gtWhip: begin |
751 gtWhip: begin |
732 DrawRotatedF(sprWhip, |
752 DrawRotatedF(sprWhip, |
733 hwRound(Gear^.X) + 1 + WorldDx, |
753 sx, |
734 hwRound(Gear^.Y) - 3 + WorldDy, |
754 sy, |
735 1, |
755 1, |
736 hwSign(Gear^.dX), |
756 hwSign(Gear^.dX), |
737 0); |
757 0); |
738 defaultPos:= false |
758 defaultPos:= false |
739 end; |
759 end; |
740 gtKamikaze: begin |
760 gtKamikaze: begin |
741 if CurAmmoGear^.Pos = 0 then |
761 if CurAmmoGear^.Pos = 0 then |
742 DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
762 DrawHedgehog(sx, sy, |
743 hwSign(Gear^.dX), |
763 hwSign(Gear^.dX), |
744 1, |
764 1, |
745 6, |
765 6, |
746 0, Gear^.Invulnerable) |
766 0) |
747 else |
767 else |
748 DrawRotatedF(sprKamikaze, |
768 DrawRotatedF(sprKamikaze, |
749 hwRound(Gear^.X) + WorldDx, |
769 hwRound(Gear^.X) + WorldDx, |
750 hwRound(Gear^.Y) + WorldDy, |
770 hwRound(Gear^.Y) + WorldDy, |
751 CurAmmoGear^.Pos - 1, |
771 CurAmmoGear^.Pos - 1, |
752 1, |
772 1, |
753 DxDy2Angle(Gear^.dY, Gear^.dX)); |
773 DxDy2Angle(Gear^.dY, Gear^.dX)); |
754 |
|
755 defaultPos:= false |
774 defaultPos:= false |
756 end; |
775 end; |
757 gtSeduction: begin |
776 gtSeduction: begin |
758 if CurAmmoGear^.Pos >= 6 then |
777 if CurAmmoGear^.Pos >= 6 then |
759 DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
778 DrawHedgehog(sx, sy, |
760 hwSign(Gear^.dX), |
779 hwSign(Gear^.dX), |
761 2, |
780 2, |
762 2, |
781 2, |
763 0, Gear^.Invulnerable) |
782 0) |
764 else |
783 else |
765 begin |
784 begin |
766 DrawRotatedF(sprDress, |
785 DrawRotatedF(sprDress, |
767 hwRound(Gear^.X) + WorldDx, |
786 hwRound(Gear^.X) + WorldDx, |
768 hwRound(Gear^.Y) + WorldDy, |
787 hwRound(Gear^.Y) + WorldDy, |
777 |
796 |
778 case CurAmmoGear^.Kind of |
797 case CurAmmoGear^.Kind of |
779 gtShotgunShot, |
798 gtShotgunShot, |
780 gtDEagleShot, |
799 gtDEagleShot, |
781 gtShover: begin |
800 gtShover: begin |
782 DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
801 DrawHedgehog(sx, sy, |
783 hwSign(Gear^.dX), |
802 hwSign(Gear^.dX), |
784 0, |
803 0, |
785 4, |
804 4, |
786 0, Gear^.Invulnerable); |
805 0); |
787 defaultPos:= false |
806 defaultPos:= false |
788 end |
807 end |
789 end |
808 end |
790 end else |
809 end else |
791 |
810 |
792 if ((Gear^.State and gstHHJumping) <> 0) then |
811 if ((Gear^.State and gstHHJumping) <> 0) then |
793 begin |
812 begin |
794 if ((Gear^.State and gstHHHJump) <> 0) then |
813 if ((Gear^.State and gstHHHJump) <> 0) then |
795 DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
814 DrawHedgehog(sx, sy, |
796 - hwSign(Gear^.dX), |
815 - hwSign(Gear^.dX), |
797 1, |
816 1, |
798 1, |
817 1, |
799 0, Gear^.Invulnerable) |
818 0) |
800 else |
819 else |
801 DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
820 DrawHedgehog(sx, sy, |
802 hwSign(Gear^.dX), |
821 hwSign(Gear^.dX), |
803 1, |
822 1, |
804 1, |
823 1, |
805 0, Gear^.Invulnerable); |
824 0); |
806 defaultPos:= false |
825 defaultPos:= false |
807 end else |
826 end else |
808 |
827 |
809 if (Gear^.Message and (gm_Left or gm_Right) <> 0) then |
828 if (Gear^.Message and (gm_Left or gm_Right) <> 0) then |
810 begin |
829 begin |
811 DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
830 DrawHedgehog(sx, sy, |
812 hwSign(Gear^.dX), |
831 hwSign(Gear^.dX), |
813 0, |
832 0, |
814 PHedgehog(Gear^.Hedgehog)^.visStepPos div 2, |
833 PHedgehog(Gear^.Hedgehog)^.visStepPos div 2, |
815 0, Gear^.Invulnerable); |
834 0); |
816 defaultPos:= false; |
835 defaultPos:= false; |
817 HatVisible:= true |
836 HatVisible:= true |
818 end |
837 end |
819 else |
838 else |
820 |
839 |
821 if ((Gear^.State and gstAnimation) <> 0) then |
840 if ((Gear^.State and gstAnimation) <> 0) then |
822 begin |
841 begin |
823 DrawRotatedF(Wavez[TWave(Gear^.Tag)].Sprite, |
842 DrawRotatedF(Wavez[TWave(Gear^.Tag)].Sprite, |
824 hwRound(Gear^.X) + 1 + WorldDx, |
843 sx, |
825 hwRound(Gear^.Y) - 3 + WorldDy, |
844 sy, |
826 Gear^.Pos, |
845 Gear^.Pos, |
827 hwSign(Gear^.dX), |
846 hwSign(Gear^.dX), |
828 0.0); |
847 0.0); |
829 defaultPos:= false |
848 defaultPos:= false |
830 end |
849 end |
847 end; |
866 end; |
848 end; |
867 end; |
849 |
868 |
850 case amt of |
869 case amt of |
851 amAirAttack, |
870 amAirAttack, |
852 amMineStrike: DrawRotated(sprHandAirAttack, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) + WorldDy, hwSign(Gear^.dX), 0); |
871 amMineStrike: DrawRotated(sprHandAirAttack, sx, hwRound(Gear^.Y) + WorldDy, hwSign(Gear^.dX), 0); |
853 amPickHammer: DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
872 amPickHammer: DrawHedgehog(sx, sy, |
854 hwSign(Gear^.dX), |
873 hwSign(Gear^.dX), |
855 1, |
874 1, |
856 2, |
875 2, |
857 0, Gear^.Invulnerable); |
876 0); |
858 amBlowTorch: DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
877 amBlowTorch: DrawHedgehog(sx, sy, |
859 hwSign(Gear^.dX), |
878 hwSign(Gear^.dX), |
860 1, |
879 1, |
861 3, |
880 3, |
862 0, Gear^.Invulnerable); |
881 0); |
863 amTeleport: DrawRotatedF(sprTeleport, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, 0, hwSign(Gear^.dX), 0); |
882 amTeleport: DrawRotatedF(sprTeleport, sx, sy, 0, hwSign(Gear^.dX), 0); |
864 amKamikaze: DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
883 amKamikaze: DrawHedgehog(sx, sy, |
865 hwSign(Gear^.dX), |
884 hwSign(Gear^.dX), |
866 1, |
885 1, |
867 5, |
886 5, |
868 0, Gear^.Invulnerable); |
887 0); |
869 amWhip: DrawRotatedF(sprWhip, |
888 amWhip: DrawRotatedF(sprWhip, |
870 hwRound(Gear^.X) + 1 + WorldDx, |
889 sx, |
871 hwRound(Gear^.Y) - 3 + WorldDy, |
890 sy, |
872 0, |
891 0, |
873 hwSign(Gear^.dX), |
892 hwSign(Gear^.dX), |
874 0); |
893 0); |
875 else |
894 else |
876 DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
895 DrawHedgehog(sx, sy, |
877 hwSign(Gear^.dX), |
896 hwSign(Gear^.dX), |
878 0, |
897 0, |
879 4, |
898 4, |
880 0, Gear^.Invulnerable); |
899 0); |
881 |
900 |
882 HatVisible:= true; |
901 HatVisible:= true; |
883 with PHedgehog(Gear^.Hedgehog)^ do |
902 with PHedgehog(Gear^.Hedgehog)^ do |
884 if (HatTex <> nil) |
903 if (HatTex <> nil) |
885 and (HatVisibility > 0) |
904 and (HatVisibility > 0) then |
886 and (not Gear^.Invulnerable) then |
|
887 DrawTextureF(HatTex, |
905 DrawTextureF(HatTex, |
888 HatVisibility, |
906 HatVisibility, |
889 hwRound(Gear^.X) + 1 + WorldDx, |
907 sx, |
890 hwRound(Gear^.Y) - 8 + WorldDy, |
908 hwRound(Gear^.Y) - 8 + WorldDy, |
891 0, |
909 0, |
892 hwSign(Gear^.dX), |
910 hwSign(Gear^.dX), |
893 32); |
911 32); |
894 end; |
912 end; |
904 end else // not gstHHDriven |
922 end else // not gstHHDriven |
905 begin |
923 begin |
906 if (Gear^.Damage > 0) |
924 if (Gear^.Damage > 0) |
907 and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then |
925 and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then |
908 begin |
926 begin |
909 DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
927 DrawHedgehog(sx, sy, |
910 hwSign(Gear^.dX), |
928 hwSign(Gear^.dX), |
911 2, |
929 2, |
912 1, |
930 1, |
913 Gear^.DirAngle, Gear^.Invulnerable); |
931 Gear^.DirAngle); |
914 defaultPos:= false |
932 defaultPos:= false |
915 end else |
933 end else |
916 |
934 |
917 if ((Gear^.State and gstHHJumping) <> 0) then |
935 if ((Gear^.State and gstHHJumping) <> 0) then |
918 begin |
936 begin |
919 if ((Gear^.State and gstHHHJump) <> 0) then |
937 if ((Gear^.State and gstHHHJump) <> 0) then |
920 DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
938 DrawHedgehog(sx, sy, |
921 - hwSign(Gear^.dX), |
939 - hwSign(Gear^.dX), |
922 1, |
940 1, |
923 1, |
941 1, |
924 0, Gear^.Invulnerable) |
942 0) |
925 else |
943 else |
926 DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, |
944 DrawHedgehog(sx, sy, |
927 hwSign(Gear^.dX), |
945 hwSign(Gear^.dX), |
928 1, |
946 1, |
929 1, |
947 1, |
930 0, Gear^.Invulnerable); |
948 0); |
931 defaultPos:= false |
949 defaultPos:= false |
932 end; |
950 end; |
933 end; |
951 end; |
934 |
952 |
935 with PHedgehog(Gear^.Hedgehog)^ do |
953 with PHedgehog(Gear^.Hedgehog)^ do |
936 begin |
954 begin |
937 if defaultPos then |
955 if defaultPos then |
938 begin |
956 begin |
939 DrawRotatedF(sprHHIdle, |
957 DrawRotatedF(sprHHIdle, |
940 hwRound(Gear^.X) + 1 + WorldDx, |
958 sx, |
941 hwRound(Gear^.Y) - 3 + WorldDy, |
959 sy, |
942 (RealTicks div 128 + Gear^.Pos) mod 19, |
960 (RealTicks div 128 + Gear^.Pos) mod 19, |
943 hwSign(Gear^.dX), |
961 hwSign(Gear^.dX), |
944 0); |
962 0); |
945 HatVisible:= true; |
963 HatVisible:= true; |
946 end; |
964 end; |
951 else |
969 else |
952 else |
970 else |
953 if HatVisibility > 0.0 then |
971 if HatVisibility > 0.0 then |
954 HatVisibility:= HatVisibility - 0.2; |
972 HatVisibility:= HatVisibility - 0.2; |
955 |
973 |
956 if (HatTex <> nil) and (not Gear^.Invulnerable) |
974 if (HatTex <> nil) |
957 and (HatVisibility > 0) then |
975 and (HatVisibility > 0) then |
958 if DefaultPos then |
976 if DefaultPos then |
959 DrawTextureF(HatTex, |
977 DrawTextureF(HatTex, |
960 HatVisibility, |
978 HatVisibility, |
961 hwRound(Gear^.X) + 1 + WorldDx, |
979 sx, |
962 hwRound(Gear^.Y) - 8 + WorldDy, |
980 hwRound(Gear^.Y) - 8 + WorldDy, |
963 (RealTicks div 128 + Gear^.Pos) mod 19, |
981 (RealTicks div 128 + Gear^.Pos) mod 19, |
964 hwSign(Gear^.dX), |
982 hwSign(Gear^.dX), |
965 32) |
983 32) |
966 else |
984 else |
967 DrawTextureF(HatTex, |
985 DrawTextureF(HatTex, |
968 HatVisibility, |
986 HatVisibility, |
969 hwRound(Gear^.X) + 1 + WorldDx, |
987 sx, |
970 hwRound(Gear^.Y) - 8 + WorldDy, |
988 hwRound(Gear^.Y) - 8 + WorldDy, |
971 0, |
989 0, |
972 hwSign(Gear^.dX), |
990 hwSign(Gear^.dX), |
973 32); |
991 32); |
974 end; |
992 end; |
1009 if ShowCrosshair and ((Gear^.State and (gstAttacked or gstAnimation)) = 0) then |
1027 if ShowCrosshair and ((Gear^.State and (gstAttacked or gstAnimation)) = 0) then |
1010 begin |
1028 begin |
1011 (* These calculations are a little complex for a few reasons: |
1029 (* These calculations are a little complex for a few reasons: |
1012 1: I need to draw the laser from weapon origin to nearest land |
1030 1: I need to draw the laser from weapon origin to nearest land |
1013 2: I need to start the beam outside the hedgie for attractiveness. |
1031 2: I need to start the beam outside the hedgie for attractiveness. |
1014 I can't do the calc from there, or it accumulates more error visible in a deagle shot. |
|
1015 3: I need to extend the beam beyond land. |
1032 3: I need to extend the beam beyond land. |
1016 This routine perhaps should be pushed into uStore or somesuch instead of continuuing the increase in size of this function. |
1033 This routine perhaps should be pushed into uStore or somesuch instead of continuuing the increase in size of this function. |
1017 Additionally, using crosshairs, amusingly, makes the laser imprecise to about 0.05% of a deagle shot. This means that if you are firing across an entire 4096px map your laser will be a few pixels off of the the deagle shot. This is still a lot more accurate than real laser sights - feel free to change if it bothers you. |
|
1018 *) |
1034 *) |
|
1035 if ((Gear^.State and gstHHHJump) <> 0) then m:= -1 else m:= 1; |
|
1036 dx:= hwSign(Gear^.dX) * m * Sin(Gear^.Angle * pi / cMaxAngle); |
|
1037 dy:= - Cos(Gear^.Angle * pi / cMaxAngle); |
1019 if cLaserSighting then |
1038 if cLaserSighting then |
1020 begin |
1039 begin |
1021 lx:= hwRound(Gear^.X); |
1040 lx:= hwRound(Gear^.X); |
1022 ly:= hwRound(Gear^.Y); |
1041 ly:= hwRound(Gear^.Y); |
1023 dx:= hwSign(Gear^.dX) * Sin(Gear^.Angle * pi / cMaxAngle); |
|
1024 dy:= - Cos(Gear^.Angle * pi / cMaxAngle); |
|
1025 lx:= lx + dx * 16; |
1042 lx:= lx + dx * 16; |
1026 ly:= ly + dy * 16; |
1043 ly:= ly + dy * 16; |
1027 |
1044 |
1028 dx:= dx * 4; |
1045 ax:= dx * 4; |
1029 dy:= dy * 4; |
1046 ay:= dy * 4; |
1030 |
1047 |
1031 tx:= round(lx); |
1048 tx:= round(lx); |
1032 ty:= round(ly); |
1049 ty:= round(ly); |
1033 hx:= tx; |
1050 hx:= tx; |
1034 hy:= ty; |
1051 hy:= ty; |
1035 while ((ty and LAND_HEIGHT_MASK) = 0) and |
1052 while ((ty and LAND_HEIGHT_MASK) = 0) and |
1036 ((tx and LAND_WIDTH_MASK) = 0) and |
1053 ((tx and LAND_WIDTH_MASK) = 0) and |
1037 (Land[ty, tx] = 0) do |
1054 (Land[ty, tx] = 0) do |
1038 begin |
1055 begin |
1039 lx:= lx + dx; |
1056 lx:= lx + ax; |
1040 ly:= ly + dy; |
1057 ly:= ly + ay; |
1041 tx:= round(lx); |
1058 tx:= round(lx); |
1042 ty:= round(ly) |
1059 ty:= round(ly) |
1043 end; |
1060 end; |
1044 // reached edge of land. assume infinite beam. Extend it way out past camera |
1061 // reached edge of land. assume infinite beam. Extend it way out past camera |
1045 if ((ty and LAND_HEIGHT_MASK) <> 0) or ((tx and LAND_WIDTH_MASK) <> 0) then |
1062 if ((ty and LAND_HEIGHT_MASK) <> 0) or ((tx and LAND_WIDTH_MASK) <> 0) then |
1046 begin |
1063 begin |
1047 tx:= round(lx + dx * (LAND_WIDTH div 4)); |
1064 tx:= round(lx + ax * (LAND_WIDTH div 4)); |
1048 ty:= round(ly + dy * (LAND_WIDTH div 4)); |
1065 ty:= round(ly + ay * (LAND_WIDTH div 4)); |
1049 end; |
1066 end; |
1050 |
1067 |
1051 //if (abs(lx-tx)>8) or (abs(ly-ty)>8) then |
1068 //if (abs(lx-tx)>8) or (abs(ly-ty)>8) then |
1052 begin |
1069 begin |
1053 glDisable(GL_TEXTURE_2D); |
1070 glDisable(GL_TEXTURE_2D); |
1060 glColor4f(1, 1, 1, 1); |
1077 glColor4f(1, 1, 1, 1); |
1061 glEnable(GL_TEXTURE_2D); |
1078 glEnable(GL_TEXTURE_2D); |
1062 glDisable(GL_LINE_SMOOTH); |
1079 glDisable(GL_LINE_SMOOTH); |
1063 end; |
1080 end; |
1064 end; |
1081 end; |
1065 // draw crossahair |
1082 // draw crosshair |
1066 if ((Gear^.State and gstHHHJump) <> 0) then m:= -1 else m:= 1; |
1083 cx:= Round(hwRound(Gear^.X) + dx * 80); |
1067 cx:= Round(hwRound(Gear^.X) + hwSign(Gear^.dX) * m * Sin(Gear^.Angle*pi/cMaxAngle) * 80); |
1084 cy:= Round(hwRound(Gear^.Y) + dy * 80); |
1068 cy:= Round(hwRound(Gear^.Y) - Cos(Gear^.Angle*pi/cMaxAngle) * 80); |
|
1069 DrawRotatedTex(Team^.CrosshairTex, |
1085 DrawRotatedTex(Team^.CrosshairTex, |
1070 12, 12, cx+WorldDx, cy+WorldDy, 0, |
1086 12, 12, cx + WorldDx, cy + WorldDy, 0, |
1071 hwSign(Gear^.dX) * (Gear^.Angle * 180.0) / cMaxAngle); |
1087 hwSign(Gear^.dX) * (Gear^.Angle * 180.0) / cMaxAngle); |
1072 end |
1088 end |
1073 end |
1089 end |
1074 end |
1090 end; |
|
1091 |
|
1092 if Gear^.Invulnerable then |
|
1093 begin |
|
1094 DrawSprite(sprInvulnerable, sx - 24, sy - 24, 0); |
|
1095 end; |
1075 end; |
1096 end; |
1076 |
1097 |
1077 procedure DrawGears; |
1098 procedure DrawGears; |
1078 var Gear, HHGear: PGear; |
1099 var Gear, HHGear: PGear; |
1079 i: Longword; |
1100 i: Longword; |
1300 gtTarget, |
1321 gtTarget, |
1301 gtFlame: begin |
1322 gtFlame: begin |
1302 //{$IFDEF DEBUGFILE}AddFileLog('Damage: ' + inttostr(dmg));{$ENDIF} |
1323 //{$IFDEF DEBUGFILE}AddFileLog('Damage: ' + inttostr(dmg));{$ENDIF} |
1303 if (Mask and EXPLNoDamage) = 0 then |
1324 if (Mask and EXPLNoDamage) = 0 then |
1304 begin |
1325 begin |
1305 if not Gear^.Invulnerable then |
1326 if not Gear^.Invulnerable then |
1306 begin |
1327 begin |
1307 inc(Gear^.Damage, dmg); |
1328 inc(Gear^.Damage, dmg); |
1308 if Gear^.Kind = gtHedgehog then |
1329 if Gear^.Kind = gtHedgehog then |
1309 AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), dmg, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color); |
1330 AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), dmg, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color); |
1310 end; |
1331 end |
|
1332 else |
|
1333 Gear^.State:= Gear^.State or gstWinner; |
1311 end; |
1334 end; |
1312 if ((Mask and EXPLDoNotTouchHH) = 0) or (Gear^.Kind <> gtHedgehog) then |
1335 if ((Mask and EXPLDoNotTouchHH) = 0) or (Gear^.Kind <> gtHedgehog) then |
1313 begin |
1336 begin |
1314 DeleteCI(Gear); |
1337 DeleteCI(Gear); |
1315 Gear^.dX:= Gear^.dX + SignAs(_0_005 * dmg + cHHKick, Gear^.X - int2hwFloat(X)); |
1338 Gear^.dX:= Gear^.dX + SignAs(_0_005 * dmg + cHHKick, Gear^.X - int2hwFloat(X)); |
1316 Gear^.dY:= Gear^.dY + SignAs(_0_005 * dmg + cHHKick, Gear^.Y - int2hwFloat(Y)); |
1339 Gear^.dY:= Gear^.dY + SignAs(_0_005 * dmg + cHHKick, Gear^.Y - int2hwFloat(Y)); |
1317 Gear^.State:= (Gear^.State or gstMoving) and (not gstWinner); |
1340 Gear^.State:= Gear^.State or gstMoving; |
|
1341 if not Gear^.Invulnerable then |
|
1342 Gear^.State:= Gear^.State and (not gstWinner); |
1318 Gear^.Active:= true; |
1343 Gear^.Active:= true; |
1319 FollowGear:= Gear |
1344 FollowGear:= Gear |
1320 end; |
1345 end; |
1321 end; |
1346 end; |
1322 gtGrave: begin |
1347 gtGrave: begin |
1352 if (not t^.Invulnerable) then |
1377 if (not t^.Invulnerable) then |
1353 begin |
1378 begin |
1354 inc(t^.Damage, dmg); |
1379 inc(t^.Damage, dmg); |
1355 if t^.Kind = gtHedgehog then |
1380 if t^.Kind = gtHedgehog then |
1356 AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), dmg, PHedgehog(t^.Hedgehog)^.Team^.Clan^.Color); |
1381 AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), dmg, PHedgehog(t^.Hedgehog)^.Team^.Clan^.Color); |
1357 end; |
1382 end |
|
1383 else |
|
1384 Gear^.State:= Gear^.State or gstWinner; |
1358 |
1385 |
1359 DeleteCI(t); |
1386 DeleteCI(t); |
1360 t^.dX:= t^.dX + Gear^.dX * dmg * _0_01 + SignAs(cHHKick, Gear^.dX); |
1387 t^.dX:= t^.dX + Gear^.dX * dmg * _0_01 + SignAs(cHHKick, Gear^.dX); |
1361 t^.dY:= t^.dY + Gear^.dY * dmg * _0_01; |
1388 t^.dY:= t^.dY + Gear^.dY * dmg * _0_01; |
1362 t^.State:= t^.State or gstMoving; |
1389 t^.State:= t^.State or gstMoving; |
1557 begin |
1586 begin |
1558 if (cCaseFactor = 0) or |
1587 if (cCaseFactor = 0) or |
1559 (CountGears(gtCase) >= 5) or |
1588 (CountGears(gtCase) >= 5) or |
1560 (getrandom(cCaseFactor) <> 0) then exit; |
1589 (getrandom(cCaseFactor) <> 0) then exit; |
1561 |
1590 |
1562 FollowGear:= AddGear(0, 0, gtCase, 0, _0, _0, 0); |
|
1563 case getrandom(20) of |
1591 case getrandom(20) of |
1564 0..6: begin |
1592 0..6: begin |
|
1593 FollowGear:= AddGear(0, 0, gtCase, 0, _0, _0, 0); |
1565 FollowGear^.Health:= 25; |
1594 FollowGear^.Health:= 25; |
1566 FollowGear^.Pos:= posCaseHealth |
1595 FollowGear^.Pos:= posCaseHealth |
1567 end; |
1596 end; |
1568 7..13: begin |
1597 7..13: begin |
1569 t:= 0; |
1598 t:= 0; |
1570 for i:= Low(TAmmoType) to High(TAmmoType) do |
1599 for i:= Low(TAmmoType) to High(TAmmoType) do |
1571 if (Ammoz[i].Ammo.Propz and ammoprop_Utility) = 0 then |
1600 if (Ammoz[i].Ammo.Propz and ammoprop_Utility) = 0 then |
1572 inc(t, Ammoz[i].Probability); |
1601 inc(t, Ammoz[i].Probability); |
1573 t:= GetRandom(t); |
1602 if (t > 0) then |
1574 i:= Low(TAmmoType); |
1603 begin |
1575 if (Ammoz[i].Ammo.Propz and ammoprop_Utility) = 0 then |
1604 FollowGear:= AddGear(0, 0, gtCase, 0, _0, _0, 0); |
1576 dec(t, Ammoz[i].Probability); |
1605 t:= GetRandom(t); |
1577 while t >= 0 do |
1606 i:= Low(TAmmoType); |
1578 begin |
1607 if (Ammoz[i].Ammo.Propz and ammoprop_Utility) = 0 then |
1579 inc(i); |
1608 dec(t, Ammoz[i].Probability); |
1580 if (Ammoz[i].Ammo.Propz and ammoprop_Utility) = 0 then |
1609 while t >= 0 do |
1581 dec(t, Ammoz[i].Probability) |
1610 begin |
1582 end; |
1611 inc(i); |
1583 PlaySound(sndReinforce, false, CurrentTeam^.voicepack); |
1612 if (Ammoz[i].Ammo.Propz and ammoprop_Utility) = 0 then |
1584 FollowGear^.Pos:= posCaseAmmo; |
1613 dec(t, Ammoz[i].Probability) |
1585 FollowGear^.State:= Longword(i) |
1614 end; |
|
1615 FollowGear^.Pos:= posCaseAmmo; |
|
1616 FollowGear^.State:= Longword(i) |
|
1617 end |
1586 end; |
1618 end; |
1587 14..19: begin |
1619 14..19: begin |
1588 t:= 0; |
1620 t:= 0; |
1589 for i:= Low(TAmmoType) to High(TAmmoType) do |
1621 for i:= Low(TAmmoType) to High(TAmmoType) do |
1590 if (Ammoz[i].Ammo.Propz and ammoprop_Utility) <> 0 then |
1622 if (Ammoz[i].Ammo.Propz and ammoprop_Utility) <> 0 then |
1591 inc(t, Ammoz[i].Probability); |
1623 inc(t, Ammoz[i].Probability); |
1592 t:= GetRandom(t); |
1624 if (t > 0) then |
1593 i:= Low(TAmmoType); |
1625 begin |
1594 if (Ammoz[i].Ammo.Propz and ammoprop_Utility) <> 0 then |
1626 FollowGear:= AddGear(0, 0, gtCase, 0, _0, _0, 0); |
1595 dec(t, Ammoz[i].Probability); |
1627 t:= GetRandom(t); |
1596 while t >= 0 do |
1628 i:= Low(TAmmoType); |
1597 begin |
1629 if (Ammoz[i].Ammo.Propz and ammoprop_Utility) <> 0 then |
1598 inc(i); |
1630 dec(t, Ammoz[i].Probability); |
1599 if (Ammoz[i].Ammo.Propz and ammoprop_Utility) <> 0 then |
1631 while t >= 0 do |
1600 dec(t, Ammoz[i].Probability) |
1632 begin |
1601 end; |
1633 inc(i); |
1602 PlaySound(sndReinforce, false, CurrentTeam^.voicepack); |
1634 if (Ammoz[i].Ammo.Propz and ammoprop_Utility) <> 0 then |
1603 FollowGear^.Pos:= posCaseUtility; |
1635 dec(t, Ammoz[i].Probability) |
1604 FollowGear^.State:= Longword(i) |
1636 end; |
|
1637 FollowGear^.Pos:= posCaseUtility; |
|
1638 FollowGear^.State:= Longword(i) |
|
1639 end |
1605 end; |
1640 end; |
1606 end; |
1641 end; |
1607 |
1642 // handles case of no ammo or utility crates - considered also placing booleans in uAmmos and altering probabilities |
1608 FindPlace(FollowGear, true, 0, LAND_WIDTH) |
1643 if (FollowGear <> nil) then |
|
1644 begin |
|
1645 FindPlace(FollowGear, true, 0, LAND_WIDTH); |
|
1646 |
|
1647 if (FollowGear <> nil) then |
|
1648 PlaySound(sndReinforce, false, CurrentTeam^.voicepack) |
|
1649 end |
1609 end; |
1650 end; |
1610 |
1651 |
1611 procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt); |
1652 procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt); |
1612 |
1653 |
1613 function CountNonZeroz(x, y, r: LongInt): LongInt; |
1654 function CountNonZeroz(x, y, r: LongInt): LongInt; |