1023 if Gear^.AmmoType = amDEagle then |
1023 if Gear^.AmmoType = amDEagle then |
1024 AmmoShove(Gear, 7, 20) |
1024 AmmoShove(Gear, 7, 20) |
1025 else |
1025 else |
1026 AmmoShove(Gear, Gear^.Timer, 20); |
1026 AmmoShove(Gear, Gear^.Timer, 20); |
1027 CheckGearDrowning(Gear); |
1027 CheckGearDrowning(Gear); |
1028 dec(i) until (i = 0) or (Gear^.Damage > Gear^.Health) or ((Gear^.State and gstDrowning) <> 0); |
1028 dec(i) |
|
1029 until (i = 0) or (Gear^.Damage > Gear^.Health) or ((Gear^.State and gstDrowning) <> 0); |
|
1030 |
1029 if Gear^.Damage > 0 then |
1031 if Gear^.Damage > 0 then |
1030 begin |
1032 begin |
1031 DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 82 - i, 1); |
1033 DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 82 - i, 1); |
1032 dec(Gear^.Health, Gear^.Damage); |
1034 dec(Gear^.Health, Gear^.Damage); |
1033 Gear^.Damage := 0 |
1035 Gear^.Damage := 0 |
2110 if Gear^.Health <= 0 then |
2112 if Gear^.Health <= 0 then |
2111 exBoom := true; |
2113 exBoom := true; |
2112 end |
2114 end |
2113 else |
2115 else |
2114 begin |
2116 begin |
2115 if Gear^.Timer = 0 then |
2117 if Gear^.Timer = 500 then |
2116 begin |
2118 begin |
2117 (* Can't make sparkles team coloured without working out what the next team is going to be. This should be solved, really, since it also screws up |
2119 (* Can't make sparkles team coloured without working out what the next team is going to be. This should be solved, really, since it also screws up |
2118 voices. Reinforcements voices is heard for active team, not team-to-be. Either that or change crate spawn from end of turn to start, although that |
2120 voices. Reinforcements voices is heard for active team, not team-to-be. Either that or change crate spawn from end of turn to start, although that |
2119 has its own complexities. *) |
2121 has its own complexities. *) |
2120 sparkles:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust, 1); |
2122 // Abuse a couple of gear values to track origin |
2121 if sparkles <> nil then |
2123 Gear^.Angle:= hwRound(Gear^.X); |
2122 begin |
2124 Gear^.Power:= hwRound(Gear^.Y); |
2123 sparkles^.Tint:= $FAB22CFF |
2125 Gear^.Tag:= random(2); |
|
2126 inc(Gear^.Timer) |
|
2127 end; |
|
2128 if Gear^.Timer < 1833 then inc(Gear^.Timer); |
|
2129 if Gear^.Timer = 1000 then |
|
2130 begin |
|
2131 sparkles:= AddVisualGear(Gear^.Angle, Gear^.Power, vgtDust, 1); |
|
2132 if sparkles <> nil then |
|
2133 begin |
|
2134 sparkles^.dX:= 0; |
|
2135 sparkles^.dY:= 0; |
|
2136 sparkles^.Angle:= 270; |
|
2137 if Gear^.Tag = 1 then |
|
2138 sparkles^.Tint:= $3744D7FF |
|
2139 else sparkles^.Tint:= $FAB22CFF |
|
2140 end; |
|
2141 end; |
|
2142 if Gear^.Timer < 1000 then |
|
2143 begin |
|
2144 AllInactive:= false; |
|
2145 exit |
2124 end |
2146 end |
2125 end; |
|
2126 if (GameTicks and $1 = 0) and (Gear^.Timer < 255) then inc(Gear^.Timer) |
|
2127 end; |
2147 end; |
2128 |
2148 |
2129 if (Gear^.Damage > 0) or exBoom then |
2149 if (Gear^.Damage > 0) or exBoom then |
2130 begin |
2150 begin |
2131 x := hwRound(Gear^.X); |
2151 x := hwRound(Gear^.X); |
2764 |
2784 |
2765 repeat |
2785 repeat |
2766 CurrentTeam^.CurrHedgehog := Succ(CurrentTeam^.CurrHedgehog) mod (CurrentTeam^.HedgehogsNumber); |
2786 CurrentTeam^.CurrHedgehog := Succ(CurrentTeam^.CurrHedgehog) mod (CurrentTeam^.HedgehogsNumber); |
2767 until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^.Damage = 0); |
2787 until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^.Damage = 0); |
2768 |
2788 |
2769 CurrentHedgehog := @CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]; |
2789 SwitchCurrentHedgehog(@CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]); |
2770 AmmoMenuInvalidated:= true; |
2790 AmmoMenuInvalidated:= true; |
2771 |
2791 |
2772 HHGear := CurrentHedgehog^.Gear; |
2792 HHGear := CurrentHedgehog^.Gear; |
2773 HHGear^.State := State; |
2793 HHGear^.State := State; |
2774 HHGear^.Active := true; |
2794 HHGear^.Active := true; |
3436 AddGear(gx, gy, gtBall, 0, SignAs(AngleSin(HHGear^.Angle) * _0_8, HHGear^.dX) + rx, AngleCos(HHGear^.Angle) * ( - _0_8) + ry, 0); |
3455 AddGear(gx, gy, gtBall, 0, SignAs(AngleSin(HHGear^.Angle) * _0_8, HHGear^.dX) + rx, AngleCos(HHGear^.Angle) * ( - _0_8) + ry, 0); |
3437 |
3456 |
3438 PlaySound(sndGun); |
3457 PlaySound(sndGun); |
3439 end; |
3458 end; |
3440 |
3459 |
3441 if (Gear^.Timer = 0) or (HHGear^.Damage <> 0) then |
3460 if (Gear^.Timer = 0) or ((HHGear^.State and gstHHDriven) = 0) then |
3442 begin |
3461 begin |
3443 DeleteGear(Gear); |
3462 DeleteGear(Gear); |
3444 AfterAttack |
3463 AfterAttack |
3445 end |
3464 end |
3446 end; |
3465 end; |
4022 |
4041 |
4023 if Gear^.Timer < 10000 then |
4042 if Gear^.Timer < 10000 then |
4024 gear^.RenderTimer := true; |
4043 gear^.RenderTimer := true; |
4025 |
4044 |
4026 // abort if there is no other portal connected to this one |
4045 // abort if there is no other portal connected to this one |
4027 if (Gear^.IntersectGear = nil) then |
4046 if (Gear^.LinkedGear = nil) then |
4028 exit; |
4047 exit; |
4029 if ((Gear^.IntersectGear^.Tag and 1) = 0) then // or if it's still moving; |
4048 if ((Gear^.LinkedGear^.Tag and 1) = 0) then // or if it's still moving; |
4030 exit; |
4049 exit; |
4031 |
4050 |
4032 conPortal := Gear^.IntersectGear; |
4051 conPortal := Gear^.LinkedGear; |
4033 |
4052 |
4034 // check all gears for stuff to port through |
4053 // check all gears for stuff to port through |
4035 iterator := nil; |
4054 iterator := nil; |
4036 while true do |
4055 while true do |
4037 begin |
4056 begin |
4410 |
4429 |
4411 Gear^.DirAngle := DxDy2Angle(-Gear^.dY,Gear^.dX); |
4430 Gear^.DirAngle := DxDy2Angle(-Gear^.dY,Gear^.dX); |
4412 if not Gear^.dX.isNegative then |
4431 if not Gear^.dX.isNegative then |
4413 Gear^.DirAngle := 180-Gear^.DirAngle; |
4432 Gear^.DirAngle := 180-Gear^.DirAngle; |
4414 |
4433 |
4415 if ((Gear^.IntersectGear = nil) |
4434 if ((Gear^.LinkedGear = nil) |
4416 or (hwRound(Distance(Gear^.X - Gear^.IntersectGear^.X,Gear^.Y-Gear^.IntersectGear^.Y)) >=Gear^.Radius*2)) then |
4435 or (hwRound(Distance(Gear^.X - Gear^.LinkedGear^.X,Gear^.Y-Gear^.LinkedGear^.Y)) >=Gear^.Radius*2)) then |
4417 begin |
4436 begin |
4418 loadNewPortalBall(Gear, false); |
4437 loadNewPortalBall(Gear, false); |
4419 inc(Gear^.Tag); |
4438 inc(Gear^.Tag); |
4420 Gear^.doStep := @doStepPortal; |
4439 Gear^.doStep := @doStepPortal; |
4421 end |
4440 end |
4453 // to the scaler) |
4472 // to the scaler) |
4454 s := (_2 * s + (newPortal^.dX * CurrentHedgehog^.Gear^.dX + newPortal^.dY * CurrentHedgehog^.Gear^.dY ) / s) / s; |
4473 s := (_2 * s + (newPortal^.dX * CurrentHedgehog^.Gear^.dX + newPortal^.dY * CurrentHedgehog^.Gear^.dY ) / s) / s; |
4455 newPortal^.dX := newPortal^.dX * s; |
4474 newPortal^.dX := newPortal^.dX * s; |
4456 newPortal^.dY := newPortal^.dY * s; |
4475 newPortal^.dY := newPortal^.dY * s; |
4457 |
4476 |
4458 newPortal^.IntersectGear := nil; |
4477 newPortal^.LinkedGear := nil; |
4459 |
4478 |
4460 if CurrentHedgehog <> nil then |
4479 if CurrentHedgehog <> nil then |
4461 with CurrentHedgehog^ do |
4480 with CurrentHedgehog^ do |
4462 begin |
4481 begin |
4463 CurWeapon:= GetCurAmmoEntry(CurrentHedgehog^); |
4482 CurWeapon:= GetCurAmmoEntry(CurrentHedgehog^); |
4482 iterator^.Timer:= 0; |
4501 iterator^.Timer:= 0; |
4483 end |
4502 end |
4484 else |
4503 else |
4485 begin |
4504 begin |
4486 // link portals with each other |
4505 // link portals with each other |
4487 newPortal^.IntersectGear := iterator; |
4506 newPortal^.LinkedGear := iterator; |
4488 iterator^.IntersectGear := newPortal; |
4507 iterator^.LinkedGear := newPortal; |
4489 iterator^.Health := newPortal^.Health; |
4508 iterator^.Health := newPortal^.Health; |
4490 end; |
4509 end; |
4491 end; |
4510 end; |
4492 iterator^.PortalCounter:= 0; |
4511 iterator^.PortalCounter:= 0; |
4493 iterator := iterator^.NextGear |
4512 iterator := iterator^.NextGear |
4736 end; |
4755 end; |
4737 |
4756 |
4738 //////////////////////////////////////////////////////////////////////////////// |
4757 //////////////////////////////////////////////////////////////////////////////// |
4739 procedure doStepFlamethrowerWork(Gear: PGear); |
4758 procedure doStepFlamethrowerWork(Gear: PGear); |
4740 var |
4759 var |
4741 HHGear: PGear; |
4760 HHGear, flame: PGear; |
4742 rx, ry, speed: hwFloat; |
4761 rx, ry, speed: hwFloat; |
4743 i, gX, gY: LongInt; |
4762 i, gX, gY: LongInt; |
4744 begin |
4763 begin |
4745 AllInactive := false; |
4764 AllInactive := false; |
4746 HHGear := Gear^.Hedgehog^.Gear; |
4765 HHGear := Gear^.Hedgehog^.Gear; |
4774 begin |
4793 begin |
4775 rx := rndSign(getRandomf * _0_1); |
4794 rx := rndSign(getRandomf * _0_1); |
4776 ry := rndSign(getRandomf * _0_1); |
4795 ry := rndSign(getRandomf * _0_1); |
4777 speed := _0_5 * (_10 / Gear^.Tag); |
4796 speed := _0_5 * (_10 / Gear^.Tag); |
4778 |
4797 |
4779 AddGear(gx, gy, gtFlame, gstTmpFlag, |
4798 flame:= AddGear(gx, gy, gtFlame, gstTmpFlag, |
4780 SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, |
4799 SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, |
4781 AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
4800 AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
|
4801 flame^.CollisionMask:= $FF7F; |
4782 |
4802 |
4783 if (Gear^.Health mod 30) = 0 then |
4803 if (Gear^.Health mod 30) = 0 then |
4784 AddGear(gx, gy, gtFlame, 0, |
4804 begin |
|
4805 flame:= AddGear(gx, gy, gtFlame, 0, |
4785 SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, |
4806 SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, |
4786 AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
4807 AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
|
4808 flame^.CollisionMask:= $FF7F; |
|
4809 end |
4787 end; |
4810 end; |
4788 Gear^.Timer:= Gear^.Tag |
4811 Gear^.Timer:= Gear^.Tag |
4789 end; |
4812 end; |
4790 |
4813 |
4791 if (Gear^.Health = 0) or (HHGear^.Damage <> 0) then |
4814 if (Gear^.Health = 0) or (HHGear^.Damage <> 0) then |
4817 end; |
4840 end; |
4818 |
4841 |
4819 //////////////////////////////////////////////////////////////////////////////// |
4842 //////////////////////////////////////////////////////////////////////////////// |
4820 procedure doStepLandGunWork(Gear: PGear); |
4843 procedure doStepLandGunWork(Gear: PGear); |
4821 var |
4844 var |
4822 HHGear: PGear; |
4845 HHGear, land: PGear; |
4823 rx, ry, speed: hwFloat; |
4846 rx, ry, speed: hwFloat; |
4824 i, gX, gY: LongInt; |
4847 i, gX, gY: LongInt; |
4825 begin |
4848 begin |
4826 AllInactive := false; |
4849 AllInactive := false; |
4827 HHGear := Gear^.Hedgehog^.Gear; |
4850 HHGear := Gear^.Hedgehog^.Gear; |
4854 |
4877 |
4855 rx := rndSign(getRandomf * _0_1); |
4878 rx := rndSign(getRandomf * _0_1); |
4856 ry := rndSign(getRandomf * _0_1); |
4879 ry := rndSign(getRandomf * _0_1); |
4857 speed := (_3 / Gear^.Tag); |
4880 speed := (_3 / Gear^.Tag); |
4858 |
4881 |
4859 AddGear(gx, gy, gtFlake, gstTmpFlag, |
4882 land:= AddGear(gx, gy, gtFlake, gstTmpFlag, |
4860 SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, |
4883 SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, |
4861 AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
4884 AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
|
4885 land^.CollisionMask:= $FF7F; |
4862 |
4886 |
4863 Gear^.Timer:= Gear^.Tag |
4887 Gear^.Timer:= Gear^.Tag |
4864 end; |
4888 end; |
4865 |
4889 |
4866 if (Gear^.Health = 0) or (HHGear^.Damage <> 0) or ((HHGear^.Message and gmAttack) <> 0) then |
4890 if (Gear^.Health = 0) or (HHGear^.Damage <> 0) or ((HHGear^.Message and gmAttack) <> 0) then |
4936 //tmp^.State:= tmp^.State or gstFlatened; |
4960 //tmp^.State:= tmp^.State or gstFlatened; |
4937 if not tmp^.Invulnerable then |
4961 if not tmp^.Invulnerable then |
4938 ApplyDamage(tmp, CurrentHedgehog, tmp^.Health div 3, dsUnknown); |
4962 ApplyDamage(tmp, CurrentHedgehog, tmp^.Health div 3, dsUnknown); |
4939 //DrawTunnel(tmp^.X, tmp^.Y - _1, _0, _0_5, cHHRadius * 6, cHHRadius * 3); |
4963 //DrawTunnel(tmp^.X, tmp^.Y - _1, _0, _0_5, cHHRadius * 6, cHHRadius * 3); |
4940 tmp2:= AddGear(hwRound(tmp^.X), hwRound(tmp^.Y), gtHammerHit, 0, _0, _0, 0); |
4964 tmp2:= AddGear(hwRound(tmp^.X), hwRound(tmp^.Y), gtHammerHit, 0, _0, _0, 0); |
4941 tmp2^.IntersectGear:= tmp; |
4965 tmp2^.LinkedGear:= tmp; |
4942 SetAllToActive |
4966 SetAllToActive |
4943 end |
4967 end |
4944 else |
4968 else |
4945 begin |
4969 begin |
4946 end |
4970 end |