734 tx:= tx + Gear^.dX + Gear^.dX; |
732 tx:= tx + Gear^.dX + Gear^.dX; |
735 ty:= ty + Gear^.dY + Gear^.dY; |
733 ty:= ty + Gear^.dY + Gear^.dY; |
736 tt:= tt - _2; |
734 tt:= tt - _2; |
737 end; |
735 end; |
738 end; |
736 end; |
|
737 |
739 CheckCollision(Gear); |
738 CheckCollision(Gear); |
|
739 |
740 if (Gear^.State and gstCollision) <> 0 then |
740 if (Gear^.State and gstCollision) <> 0 then |
741 begin |
741 begin |
742 Gear^.doStep:= @doStepRopeWork; |
742 Gear^.doStep:= @doStepRopeWork; |
743 with HHGear^ do State:= State and not gstAttacking; |
743 with HHGear^ do State:= State and not gstAttacking; |
744 if Gear^.Elasticity < _10 then |
744 |
745 Gear^.Elasticity:= _10000; |
745 OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); |
746 end; |
746 ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); |
|
747 |
|
748 if Gear^.Elasticity < _10 then |
|
749 Gear^.Elasticity:= _10000; |
|
750 end; |
747 |
751 |
748 if (Gear^.Elasticity > Gear^.Friction) or ((Gear^.Message and gm_Attack) = 0) then |
752 if (Gear^.Elasticity > Gear^.Friction) or ((Gear^.Message and gm_Attack) = 0) then |
749 begin |
753 begin |
750 with PHedgehog(Gear^.Hedgehog)^.Gear^ do |
754 with PHedgehog(Gear^.Hedgehog)^.Gear^ do |
751 begin |
755 begin |
1091 DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y + _1, _0_5, _0, cHHRadius * 4, 5); |
1095 DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y + _1, _0_5, _0, cHHRadius * 4, 5); |
1092 end; |
1096 end; |
1093 |
1097 |
1094 //////////////////////////////////////////////////////////////////////////////// |
1098 //////////////////////////////////////////////////////////////////////////////// |
1095 |
1099 |
1096 procedure doStepParachute(Gear: PGear); |
1100 procedure doStepParachuteWork(Gear: PGear); |
1097 var HHGear: PGear; |
1101 var HHGear: PGear; |
1098 Timer: Longword; |
1102 begin |
1099 begin |
1103 HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
1100 HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1101 HHGear^.State:= HHGear^.State and not gstAttacking; |
|
1102 DeleteCI(HHGear); |
|
1103 |
1104 |
1104 inc(Gear^.Timer); |
1105 inc(Gear^.Timer); |
1105 |
1106 |
1106 if TestCollisionYwithGear(HHGear, 1) |
1107 if TestCollisionYwithGear(HHGear, 1) |
1107 or ((HHGear^.State and gstHHDriven) = 0) |
1108 or ((HHGear^.State and gstHHDriven) = 0) |
1108 or CheckGearDrowning(HHGear) then |
1109 or CheckGearDrowning(HHGear) |
|
1110 or ((Gear^.Message and gm_Attack) <> 0) then |
1109 begin |
1111 begin |
1110 with HHGear^ do |
1112 with HHGear^ do |
1111 begin |
1113 begin |
1112 Message:= 0; |
1114 Message:= 0; |
1113 SetLittle(dX); |
1115 SetLittle(dX); |
1114 dY:= _0; |
1116 dY:= _0; |
1115 State:= State and not (gstAttacking or gstAttacked); |
|
1116 State:= State or gstMoving; |
1117 State:= State or gstMoving; |
1117 end; |
1118 end; |
1118 Timer:= Gear^.Timer; |
1119 DeleteGear(Gear); |
1119 DeleteGear(Gear); |
|
1120 if Timer > 10 then |
|
1121 begin |
|
1122 OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); |
|
1123 ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^) |
|
1124 end; |
|
1125 exit |
1120 exit |
1126 end; |
1121 end; |
1127 |
1122 |
1128 if not TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then |
1123 if not TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then |
1129 HHGear^.X:= HHGear^.X + cWindSpeed * 200; |
1124 HHGear^.X:= HHGear^.X + cWindSpeed * 200; |
1134 else if (Gear^.Message and gm_Down) <> 0 then HHGear^.Y:= HHGear^.Y + cGravity * 40; |
1129 else if (Gear^.Message and gm_Down) <> 0 then HHGear^.Y:= HHGear^.Y + cGravity * 40; |
1135 |
1130 |
1136 HHGear^.Y:= HHGear^.Y + cGravity * 100; |
1131 HHGear^.Y:= HHGear^.Y + cGravity * 100; |
1137 Gear^.X:= HHGear^.X; |
1132 Gear^.X:= HHGear^.X; |
1138 Gear^.Y:= HHGear^.Y |
1133 Gear^.Y:= HHGear^.Y |
|
1134 end; |
|
1135 |
|
1136 procedure doStepParachute(Gear: PGear); |
|
1137 var HHGear: PGear; |
|
1138 Timer: Longword; |
|
1139 begin |
|
1140 HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1141 |
|
1142 DeleteCI(HHGear); |
|
1143 |
|
1144 OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); |
|
1145 ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); |
|
1146 |
|
1147 HHGear^.State:= HHGear^.State and not (gstAttacking or gstAttacked); |
|
1148 HHGear^.Message:= HHGear^.Message and not gm_Attack; |
|
1149 |
|
1150 Gear^.doStep:= @doStepParachuteWork; |
|
1151 |
|
1152 Gear^.Message:= HHGear^.Message; |
|
1153 doStepParachuteWork(Gear) |
1139 end; |
1154 end; |
1140 |
1155 |
1141 //////////////////////////////////////////////////////////////////////////////// |
1156 //////////////////////////////////////////////////////////////////////////////// |
1142 procedure doStepAirAttackWork(Gear: PGear); |
1157 procedure doStepAirAttackWork(Gear: PGear); |
1143 begin |
1158 begin |