99 end; |
99 end; |
100 end; |
100 end; |
101 end; |
101 end; |
102 gi := gi^.NextGear |
102 gi := gi^.NextGear |
103 end; |
103 end; |
|
104 end; |
|
105 |
|
106 procedure HideHog(HH: PHedgehog); |
|
107 begin |
|
108 ScriptCall('onHogHide', HH^.Gear^.Uid); |
|
109 DeleteCI(HH^.Gear); |
|
110 if FollowGear = HH^.Gear then FollowGear:= nil; |
|
111 if lastGearByUID = HH^.Gear then lastGearByUID := nil; |
|
112 RemoveGearFromList(HH^.Gear); |
|
113 with HH^.Gear^ do |
|
114 begin |
|
115 Z := cHHZ; |
|
116 Active := false; |
|
117 State:= State and not (gstHHDriven or gstAttacking or gstAttacked); |
|
118 Message := Message and not gmAttack; |
|
119 end; |
|
120 HH^.GearHidden:= HH^.Gear; |
|
121 HH^.Gear:= nil; |
|
122 end; |
|
123 |
|
124 procedure RestoreHog(HH: PHedgehog); |
|
125 begin |
|
126 HH^.Gear:=HH^.GearHidden; |
|
127 HH^.GearHidden:= nil; |
|
128 InsertGearToList(HH^.Gear); |
|
129 HH^.Gear^.State:= (HH^.Gear^.State and not (gstHHDriven or gstInvisible or gstAttacking)) or gstAttacked; |
|
130 AddGearCI(HH^.Gear); |
|
131 HH^.Gear^.Active:= true; |
|
132 ScriptCall('onHogRestore', HH^.Gear^.Uid) |
104 end; |
133 end; |
105 |
134 |
106 //////////////////////////////////////////////////////////////////////////////// |
135 //////////////////////////////////////////////////////////////////////////////// |
107 procedure doStepDrowningGear(Gear: PGear); |
136 procedure doStepDrowningGear(Gear: PGear); |
108 forward; |
137 forward; |
764 |
793 |
765 //////////////////////////////////////////////////////////////////////////////// |
794 //////////////////////////////////////////////////////////////////////////////// |
766 procedure doStepBeeWork(Gear: PGear); |
795 procedure doStepBeeWork(Gear: PGear); |
767 var |
796 var |
768 t: hwFloat; |
797 t: hwFloat; |
769 gX,gY: LongInt; |
798 gX,gY,i: LongInt; |
770 nuw: boolean; |
799 nuw: boolean; |
|
800 flower: PVisualGear; |
771 |
801 |
772 const uw: boolean = false; |
802 const uw: boolean = false; |
773 begin |
803 begin |
774 AllInactive := false; |
804 AllInactive := false; |
775 gX := hwRound(Gear^.X); |
805 gX := hwRound(Gear^.X); |
814 dec(Gear^.Timer); |
844 dec(Gear^.Timer); |
815 if ((Gear^.State and gstCollision) <> 0) or (Gear^.Timer = 0) then |
845 if ((Gear^.State and gstCollision) <> 0) or (Gear^.Timer = 0) then |
816 begin |
846 begin |
817 StopSound(Gear^.SoundChannel); |
847 StopSound(Gear^.SoundChannel); |
818 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound); |
848 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound); |
|
849 for i:= 0 to 31 do |
|
850 begin |
|
851 flower:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot); |
|
852 if flower <> nil then |
|
853 with flower^ do |
|
854 begin |
|
855 Scale:= 0.75; |
|
856 dx:= 0.001 * (random(200)); |
|
857 dy:= 0.001 * (random(200)); |
|
858 if random(2) = 0 then dx := -dx; |
|
859 if random(2) = 0 then dy := -dy; |
|
860 FrameTicks:= random(250) + 250; |
|
861 State:= ord(sprTargetBee); |
|
862 end; |
|
863 end; |
819 DeleteGear(Gear); |
864 DeleteGear(Gear); |
820 end; |
865 end; |
821 end; |
866 end; |
822 |
867 |
823 procedure doStepBee(Gear: PGear); |
868 procedure doStepBee(Gear: PGear); |
1108 HHGear: PGear; |
1153 HHGear: PGear; |
1109 begin |
1154 begin |
1110 AllInactive := false; |
1155 AllInactive := false; |
1111 HHGear := Gear^.Hedgehog^.Gear; |
1156 HHGear := Gear^.Hedgehog^.Gear; |
1112 dec(Gear^.Timer); |
1157 dec(Gear^.Timer); |
1113 if (Gear^.Timer = 0)or((Gear^.Message and gmDestroy) <> 0)or((HHGear^.State and gstHHDriven) = |
1158 if ((GameFlags and gfInfAttack) <> 0) and (TurnTimeLeft > 0) then dec(TurnTimeLeft); |
|
1159 if (TurnTimeLeft = 0) or (Gear^.Timer = 0)or((Gear^.Message and gmDestroy) <> 0)or((HHGear^.State and gstHHDriven) = |
1114 0) then |
1160 0) then |
1115 begin |
1161 begin |
1116 StopSound(Gear^.SoundChannel); |
1162 StopSound(Gear^.SoundChannel); |
1117 DeleteGear(Gear); |
1163 DeleteGear(Gear); |
1118 AfterAttack; |
1164 AfterAttack; |
1284 DrawTunnel(HHGear^.X - Gear^.dX * cHHRadius, HHGear^.Y - _4 - Gear^.dY * cHHRadius + hwAbs( |
1332 DrawTunnel(HHGear^.X - Gear^.dX * cHHRadius, HHGear^.Y - _4 - Gear^.dY * cHHRadius + hwAbs( |
1285 Gear^.dY) * 7, |
1333 Gear^.dY) * 7, |
1286 Gear^.dX, Gear^.dY, |
1334 Gear^.dX, Gear^.dY, |
1287 cHHRadius * 5, cHHRadius * 2 + 7); |
1335 cHHRadius * 5, cHHRadius * 2 + 7); |
1288 |
1336 |
1289 if (Gear^.Timer = 0) or ((HHGear^.Message and gmAttack) <> 0) then |
1337 if (TurnTimeLeft = 0) or (Gear^.Timer = 0) or ((HHGear^.Message and gmAttack) <> 0) then |
1290 begin |
1338 begin |
1291 HHGear^.Message := 0; |
1339 HHGear^.Message := 0; |
1292 HHGear^.State := HHGear^.State and (not gstNotKickable); |
1340 HHGear^.State := HHGear^.State and (not gstNotKickable); |
1293 DeleteGear(Gear); |
1341 DeleteGear(Gear); |
1294 AfterAttack |
1342 AfterAttack |
2882 Gear^.DirAngle := DxDy2Angle(tdx, tdy); |
2930 Gear^.DirAngle := DxDy2Angle(tdx, tdy); |
2883 end; |
2931 end; |
2884 |
2932 |
2885 dec(Gear^.Health); |
2933 dec(Gear^.Health); |
2886 Gear^.Timer := Gear^.Health*10; |
2934 Gear^.Timer := Gear^.Health*10; |
2887 Gear^.PortalCounter:= 0; |
2935 if Gear^.Health mod 100 = 0 then Gear^.PortalCounter:= 0; |
2888 // This is not seconds, but at least it is *some* feedback |
2936 // This is not seconds, but at least it is *some* feedback |
2889 if (Gear^.Health = 0) or ((Gear^.Message and gmAttack) <> 0) then |
2937 if (Gear^.Health = 0) or ((Gear^.Message and gmAttack) <> 0) then |
2890 begin |
2938 begin |
2891 FollowGear := Gear; |
2939 FollowGear := Gear; |
2892 Gear^.RenderTimer := false; |
2940 Gear^.RenderTimer := false; |
3017 dx:= 0.001 * (random(200)); |
3065 dx:= 0.001 * (random(200)); |
3018 dy:= 0.001 * (random(200)); |
3066 dy:= 0.001 * (random(200)); |
3019 if random(2) = 0 then dx := -dx; |
3067 if random(2) = 0 then dx := -dx; |
3020 if random(2) = 0 then dy := -dy; |
3068 if random(2) = 0 then dy := -dy; |
3021 FrameTicks:= random(750) + 1000; |
3069 FrameTicks:= random(750) + 1000; |
3022 heart^.State:= ord(sprSeduction) |
3070 State:= ord(sprSeduction) |
3023 end; |
3071 end; |
3024 end; |
3072 end; |
3025 |
3073 |
3026 if Gear^.Pos = 15 then |
3074 if Gear^.Pos = 15 then |
3027 Gear^.doStep := @doStepSeductionWork |
3075 Gear^.doStep := @doStepSeductionWork |
3923 else |
3971 else |
3924 ny.isNegative := not ny.isNegative; |
3972 ny.isNegative := not ny.isNegative; |
3925 |
3973 |
3926 // inverse cake's normal movement direction, |
3974 // inverse cake's normal movement direction, |
3927 // as if it just walked through a hole |
3975 // as if it just walked through a hole |
3928 if iscake then |
3976 //if iscake then nspeed.isNegative:= not nspeed.isNegative; |
3929 nspeed.isNegative:= not nspeed.isNegative; |
|
3930 |
3977 |
3931 //AddFileLog('poffs:'+cstr(poffs)+' noffs:'+cstr(noffs)+' pspeed:'+cstr(pspeed)+' nspeed:'+cstr(nspeed)); |
3978 //AddFileLog('poffs:'+cstr(poffs)+' noffs:'+cstr(noffs)+' pspeed:'+cstr(pspeed)+' nspeed:'+cstr(nspeed)); |
3932 iterator^.dX := -pspeed * conPortal^.dX + nspeed * nx; |
3979 iterator^.dX := -pspeed * conPortal^.dX + nspeed * nx; |
3933 iterator^.dY := -pspeed * conPortal^.dY + nspeed * ny; |
3980 iterator^.dY := -pspeed * conPortal^.dY + nspeed * ny; |
3934 |
3981 |
3975 |
4022 |
3976 if iterator^.Radius > 1 then |
4023 if iterator^.Radius > 1 then |
3977 iterator^.Radius := iterator^.Radius - 1; |
4024 iterator^.Radius := iterator^.Radius - 1; |
3978 |
4025 |
3979 // check front |
4026 // check front |
3980 isCollision := TestCollisionYwithGear(iterator, sy) |
4027 isCollision := TestCollisionY(iterator, sy) |
3981 or TestCollisionXwithGear(iterator, sx); |
4028 or TestCollisionX(iterator, sx); |
3982 |
4029 |
3983 if not isCollision then |
4030 if not isCollision then |
3984 begin |
4031 begin |
3985 // check center area (with half the radius so that the |
4032 // check center area (with half the radius so that the |
3986 // the square check won't check more pixels than we want to) |
4033 // the square check won't check more pixels than we want to) |
3987 iterator^.Radius := 1 + resetr div 2; |
4034 iterator^.Radius := 1 + resetr div 2; |
3988 rh := resetr div 4; |
4035 rh := resetr div 4; |
3989 isCollision := TestCollisionYwithXYShift(iterator, 0, -sy * rh, sy) |
4036 isCollision := TestCollisionYwithXYShift(iterator, 0, -sy * rh, sy, false) |
3990 or TestCollisionXwithXYShift(iterator, ox * rh, 0, sx); |
4037 or TestCollisionXwithXYShift(iterator, ox * rh, 0, sx, false); |
3991 end; |
4038 end; |
3992 |
4039 |
3993 iterator^.Radius := resetr; |
4040 iterator^.Radius := resetr; |
3994 |
4041 |
3995 if isCollision then |
4042 if isCollision then |
4006 // |
4053 // |
4007 // You're now officially portaled! |
4054 // You're now officially portaled! |
4008 // |
4055 // |
4009 |
4056 |
4010 // Until loops are reliably broken |
4057 // Until loops are reliably broken |
4011 inc(iterator^.PortalCounter); |
4058 if iscake then iterator^.PortalCounter:= 33 |
|
4059 else inc(iterator^.PortalCounter); |
4012 |
4060 |
4013 if not isbullet and (iterator^.Kind <> gtFlake) then |
4061 if not isbullet and (iterator^.Kind <> gtFlake) then |
4014 FollowGear := iterator; |
4062 FollowGear := iterator; |
4015 |
4063 |
4016 // This jiggles gears, to ensure a portal connection just placed under a gear takes effect. |
4064 // This jiggles gears, to ensure a portal connection just placed under a gear takes effect. |
4919 begin |
4967 begin |
4920 |
4968 |
4921 HH:= Gear^.Hedgehog; |
4969 HH:= Gear^.Hedgehog; |
4922 if Gear^.Pos = 2 then |
4970 if Gear^.Pos = 2 then |
4923 begin |
4971 begin |
|
4972 StopSound(Gear^.SoundChannel); |
4924 if (Gear^.Timer = 0) then |
4973 if (Gear^.Timer = 0) then |
4925 begin |
4974 begin |
4926 if (HH^.Gear <> nil) and (HH^.Gear^.State and gstInvisible = 0) then |
4975 if (HH^.Gear <> nil) and (HH^.Gear^.State and gstInvisible = 0) then |
4927 begin |
4976 begin |
4928 AfterAttack; |
4977 AfterAttack; |
4929 if Gear = CurAmmoGear then CurAmmoGear := nil; |
4978 if Gear = CurAmmoGear then CurAmmoGear := nil; |
4930 DeleteCI(HH^.Gear); |
4979 HideHog(HH) |
4931 RemoveGearFromList(HH^.Gear); |
|
4932 with HH^.Gear^ do |
|
4933 begin |
|
4934 Z := cHHZ; |
|
4935 Active := false; |
|
4936 State:= State and not (gstHHDriven or gstAttacking or gstAttacked); |
|
4937 Message := Message and not gmAttack; |
|
4938 end; |
|
4939 HH^.GearHidden:= HH^.Gear; |
|
4940 HH^.Gear:= nil |
|
4941 end |
4980 end |
4942 else if (HH^.Gear <> nil) and (HH^.Gear^.State and gstInvisible <> 0) then |
4981 //else if (HH^.Gear <> nil) and (HH^.Gear^.State and gstInvisible <> 0) then |
4943 begin |
4982 else if (HH^.GearHidden <> nil) then// and (HH^.Gear^.State and gstInvisible <> 0) then |
4944 InsertGearToList(HH^.Gear); |
4983 RestoreHog(HH) |
4945 HH^.Gear^.State:= HH^.Gear^.State and not (gstHHDriven or gstInvisible); |
|
4946 AddGearCI(HH^.Gear); |
|
4947 HH^.Gear^.Active:= true |
|
4948 end; |
|
4949 end; |
4984 end; |
4950 |
4985 |
4951 inc(Gear^.Timer); |
4986 inc(Gear^.Timer); |
4952 if (Gear^.Timer > 2000) and ((GameTicks mod 2000) = 1000) then |
4987 if (Gear^.Timer > 2000) and ((GameTicks mod 2000) = 1000) then |
4953 begin |
4988 begin |
4954 Gear^.Pos:= 3; |
4989 Gear^.SoundChannel := LoopSound(sndTardis); |
4955 end; |
4990 Gear^.Pos:= 3 |
|
4991 end |
4956 end; |
4992 end; |
4957 |
4993 |
4958 if (Gear^.Pos = 1) and (GameTicks and $1F = 0) and (Gear^.Power < 255) then inc(Gear^.Power); |
4994 if (Gear^.Pos = 1) and (GameTicks and $1F = 0) and (Gear^.Power < 255) then inc(Gear^.Power); |
4959 if (Gear^.Pos = 3) and (GameTicks and $1F = 0) and (Gear^.Power > 0) then dec(Gear^.Power); |
4995 if (Gear^.Pos = 3) and (GameTicks and $1F = 0) and (Gear^.Power > 0) then dec(Gear^.Power); |
4960 if (Gear^.Pos = 1) and (Gear^.Power = 255) and ((GameTicks mod 2000) = 1000) then Gear^.Pos:= 2; |
4996 if (Gear^.Pos = 1) and (Gear^.Power = 255) and ((GameTicks mod 2000) = 1000) then Gear^.Pos:= 2; |
4961 if (Gear^.Pos = 3) and (Gear^.Power = 0) then |
4997 if (Gear^.Pos = 3) and (Gear^.Power = 0) then |
4962 begin |
4998 begin |
|
4999 StopSound(Gear^.SoundChannel); |
4963 if HH^.GearHidden = nil then |
5000 if HH^.GearHidden = nil then |
4964 begin |
5001 begin |
4965 DeleteGear(Gear); |
5002 DeleteGear(Gear); |
4966 exit |
5003 exit |
4967 end; |
5004 end; |
4979 ((HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.State and gstDrowning) = 0) and |
5016 ((HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.State and gstDrowning) = 0) and |
4980 (HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Health > |
5017 (HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Health > |
4981 HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Damage) then inc(cnt); |
5018 HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Damage) then inc(cnt); |
4982 if (cnt = 0) or SuddenDeathDmg or (Gear^.Timer = 0) then |
5019 if (cnt = 0) or SuddenDeathDmg or (Gear^.Timer = 0) then |
4983 begin |
5020 begin |
|
5021 Gear^.SoundChannel := LoopSound(sndTardis); |
4984 Gear^.Pos:= 1; |
5022 Gear^.Pos:= 1; |
4985 Gear^.Power:= 0; |
5023 Gear^.Power:= 0; |
4986 Gear^.Timer:= 0; |
5024 Gear^.Timer:= 0; |
4987 if HH^.GearHidden <> nil then FindPlace(HH^.GearHidden, false, 0, LAND_WIDTH,true); |
5025 if HH^.GearHidden <> nil then FindPlace(HH^.GearHidden, false, 0, LAND_WIDTH,true); |
4988 if HH^.GearHidden <> nil then |
5026 if HH^.GearHidden <> nil then |
4989 begin |
5027 begin |
4990 HH^.Gear:=HH^.GearHidden; |
5028 Gear^.X:= HH^.GearHidden^.X; |
4991 HH^.GearHidden:= nil; |
5029 Gear^.Y:= HH^.GearHidden^.Y; |
4992 HH^.Gear^.State:= HH^.Gear^.State or gstInvisible; |
5030 //HH^.Gear:=HH^.GearHidden; |
4993 Gear^.X:= HH^.Gear^.X; |
5031 //HH^.GearHidden:= nil; |
4994 Gear^.Y:= HH^.Gear^.Y; |
5032 //HH^.Gear^.State:= HH^.Gear^.State or gstInvisible; |
4995 end |
5033 end |
4996 end |
5034 end |
4997 else dec(Gear^.Timer); |
5035 else dec(Gear^.Timer); |
4998 end; |
5036 end; |
4999 |
5037 |