179 Gear^.Hedgehog^ do |
179 Gear^.Hedgehog^ do |
180 begin |
180 begin |
181 if ((State and gstHHDriven) <> 0)and |
181 if ((State and gstHHDriven) <> 0)and |
182 ((State and (gstAttacked or gstHHChooseTarget)) = 0) and |
182 ((State and (gstAttacked or gstHHChooseTarget)) = 0) and |
183 (((State and gstMoving) = 0) or |
183 (((State and gstMoving) = 0) or |
|
184 (Power > 0) or |
184 (CurAmmoType = amTeleport) or |
185 (CurAmmoType = amTeleport) or |
185 // Allow attacks while moving on ammo with AltAttack |
186 // Allow attacks while moving on ammo with AltAttack |
186 ((CurAmmoGear <> nil) and ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0)) or |
187 ((CurAmmoGear <> nil) and ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0)) or |
187 ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackInMove) <> 0)) and |
188 ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackInMove) <> 0)) and |
188 ((TargetPoint.X <> NoPointX) or ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) = 0)) then |
189 ((TargetPoint.X <> NoPointX) or ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) = 0)) then |
353 amGrenade, amMolotov, |
354 amGrenade, amMolotov, |
354 amClusterBomb, amGasBomb, |
355 amClusterBomb, amGasBomb, |
355 amBazooka, amSnowball, |
356 amBazooka, amSnowball, |
356 amBee, amSMine, |
357 amBee, amSMine, |
357 amMortar, amWatermelon, |
358 amMortar, amWatermelon, |
358 amHellishBomb, amDrill, |
359 amHellishBomb, amDrill: FollowGear:= newGear; |
359 amPiano: FollowGear:= newGear; |
|
360 |
360 |
361 amShotgun, amPickHammer, |
361 amShotgun, amPickHammer, |
362 amRope, amDEagle, |
362 amRope, amDEagle, |
363 amSineGun, amSniperRifle, |
363 amSineGun, amSniperRifle, |
364 amFirePunch, amWhip, |
364 amFirePunch, amWhip, |
369 amKamikaze, amCake, |
369 amKamikaze, amCake, |
370 amSeduction, amBallgun, |
370 amSeduction, amBallgun, |
371 amJetpack, amBirdy, |
371 amJetpack, amBirdy, |
372 amFlamethrower, amLandGun, |
372 amFlamethrower, amLandGun, |
373 amResurrector, amStructure, |
373 amResurrector, amStructure, |
374 amTardis: CurAmmoGear:= newGear; |
374 amTardis, amPiano: CurAmmoGear:= newGear; |
375 end; |
375 end; |
376 if (CurAmmoType = amMine) or (CurAmmoType = amSMine) and (GameFlags and gfInfAttack <> 0) then newGear^.FlightTime:= GameTicks + 1000; |
376 if (CurAmmoType = amMine) or (CurAmmoType = amSMine) and (GameFlags and gfInfAttack <> 0) then newGear^.FlightTime:= GameTicks + 1000; |
377 if Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0 then |
377 if Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0 then |
378 begin |
378 begin |
379 newGear^.Target.X:= TargetPoint.X; |
379 newGear^.Target.X:= TargetPoint.X; |
814 Gear^.dY:= _0; |
815 Gear^.dY:= _0; |
815 end else Gear^.dY:= Gear^.dY + cGravity; |
816 end else Gear^.dY:= Gear^.dY + cGravity; |
816 |
817 |
817 if ((Gear^.State and gstMoving) <> 0) then |
818 if ((Gear^.State and gstMoving) <> 0) then |
818 begin |
819 begin |
819 if land and lfIce <> 0 then Gear^.dX:= Gear^.dX * (_1 - (_1 - Gear^.Friction) / _2) |
820 if land and lfIce <> 0 then |
|
821 begin |
|
822 Gear^.dX:= Gear^.dX * (_1 - (_1 - Gear^.Friction) / _2) |
|
823 end |
820 else Gear^.dX:= Gear^.dX * Gear^.Friction; |
824 else Gear^.dX:= Gear^.dX * Gear^.Friction; |
821 end |
825 end |
822 end; |
826 end; |
823 |
827 |
824 if (Gear^.State <> 0) then DeleteCI(Gear); |
828 if (Gear^.State <> 0) then DeleteCI(Gear); |
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 |
843 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 |
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 |
844 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 |
841 if hwAbs(Gear^.dX) > _0_02 then Gear^.dX:= -Gear^.Elasticity * Gear^.dX |
845 if hwAbs(Gear^.dX) > _0_02 then Gear^.dX:= -Gear^.Elasticity * Gear^.dX |
842 else begin |
846 else begin |
843 Gear^.State:= Gear^.State and not gstMoving; |
847 Gear^.State:= Gear^.State and not gstMoving; |
|
848 while TestCollisionYWithGear(Gear,1) = 0 do Gear^.Y:= Gear^.Y+_1; |
844 SetLittle(Gear^.dX) |
849 SetLittle(Gear^.dX) |
845 end |
850 end |
846 else begin |
851 else begin |
847 Gear^.State:= Gear^.State and not gstMoving; |
852 Gear^.State:= Gear^.State and not gstMoving; |
|
853 while TestCollisionYWithGear(Gear,1) = 0 do Gear^.Y:= Gear^.Y+_1; |
848 SetLittle(Gear^.dX) |
854 SetLittle(Gear^.dX) |
849 end |
855 end |
850 else if (hwAbs(Gear^.dX) > cLittle) |
856 else if (hwAbs(Gear^.dX) > cLittle) |
851 and ((Gear^.State and gstHHJumping) = 0) |
857 and ((Gear^.State and gstHHJumping) = 0) |
852 then Gear^.dX:= -Gear^.Elasticity * Gear^.dX |
858 then Gear^.dX:= -Gear^.Elasticity * Gear^.dX |
855 if (not isFalling) and |
861 if (not isFalling) and |
856 (hwAbs(Gear^.dX) + hwAbs(Gear^.dY) < _0_03) then |
862 (hwAbs(Gear^.dX) + hwAbs(Gear^.dY) < _0_03) then |
857 begin |
863 begin |
858 Gear^.State:= Gear^.State and not gstWinner; |
864 Gear^.State:= Gear^.State and not gstWinner; |
859 Gear^.State:= Gear^.State and not gstMoving; |
865 Gear^.State:= Gear^.State and not gstMoving; |
|
866 while TestCollisionYWithGear(Gear,1) = 0 do Gear^.Y:= Gear^.Y+_1; |
860 SetLittle(Gear^.dX); |
867 SetLittle(Gear^.dX); |
861 Gear^.dY:= _0 |
868 Gear^.dY:= _0 |
862 end else Gear^.State:= Gear^.State or gstMoving; |
869 end else Gear^.State:= Gear^.State or gstMoving; |
863 |
870 |
864 if (Gear^.State and gstMoving) <> 0 then |
871 if (Gear^.State and gstMoving) <> 0 then |
874 CheckHHDamage(Gear); |
881 CheckHHDamage(Gear); |
875 Gear^.dY:= _0; |
882 Gear^.dY:= _0; |
876 Gear^.Y:= Gear^.Y + _1 |
883 Gear^.Y:= Gear^.Y + _1 |
877 end; |
884 end; |
878 CheckGearDrowning(Gear); |
885 CheckGearDrowning(Gear); |
879 if (Gear^.State and gstDrowning) <> 0 then isCursorVisible:= false |
886 // hide target cursor if current hog is drowning |
|
887 if (Gear^.State and gstDrowning) <> 0 then |
|
888 if (CurrentHedgehog^.Gear = Gear) then |
|
889 isCursorVisible:= false |
880 end; |
890 end; |
881 |
891 |
882 if (hwAbs(Gear^.dY) > _0) and (Gear^.FlightTime > 0) and ((GameFlags and gfLowGravity) = 0) then |
892 if (hwAbs(Gear^.dY) > _0) and (Gear^.FlightTime > 0) and ((GameFlags and gfLowGravity) = 0) then |
883 begin |
893 begin |
884 inc(Gear^.FlightTime); |
894 inc(Gear^.FlightTime); |
1096 |
1106 |
1097 //////////////////////////////////////////////////////////////////////////////// |
1107 //////////////////////////////////////////////////////////////////////////////// |
1098 procedure doStepHedgehog(Gear: PGear); |
1108 procedure doStepHedgehog(Gear: PGear); |
1099 (* |
1109 (* |
1100 var x,y,tx,ty: LongInt; |
1110 var x,y,tx,ty: LongInt; |
1101 tdX, tdY, slope: hwFloat; *) |
1111 tdX, tdY, slope: hwFloat; |
|
1112 land: Word; *) |
|
1113 var slope: hwFloat; |
1102 begin |
1114 begin |
1103 if (Gear^.Message and gmDestroy) <> 0 then |
1115 if (Gear^.Message and gmDestroy) <> 0 then |
1104 begin |
1116 begin |
1105 DeleteGear(Gear); |
1117 DeleteGear(Gear); |
1106 exit |
1118 exit |
1114 if Team^.hasGone then |
1126 if Team^.hasGone then |
1115 TeamGoneEffect(Team^) |
1127 TeamGoneEffect(Team^) |
1116 else |
1128 else |
1117 doStepHedgehogDriven(Gear) |
1129 doStepHedgehogDriven(Gear) |
1118 end; |
1130 end; |
1119 |
1131 if (Gear^.Message and (gmAllStoppable or gmLJump or gmHJump) = 0) and |
1120 if ((GameTicks mod 50) = 0) and (Gear^.State and (gstMoving or gstHHJumping or gstHHHJump) = 0) and ((Gear^.Message and gmAllStoppable) = 0) and |
1132 (Gear^.State and (gstHHJumping or gstHHHJump or gstAttacking) = 0) and |
1121 (TestCollisionYwithGear(Gear, 1) and lfIce <> 0) then |
1133 not Gear^.dY.isNegative and |
1122 begin |
1134 (GameTicks mod (100*hwRound(cMaxWindSpeed/(cGravity/2))) = 0) and |
1123 if CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y)+cHHRadius, lfIce) then |
1135 (TestCollisionYwithGear(Gear, 1) and lfIce <> 0) then |
1124 begin |
1136 begin |
1125 Gear^.dX.QWordValue:= Gear^.dX.QWordValue + cGravity.QWordValue * 75; |
1137 slope:= CalcSlopeBelowGear(Gear); |
1126 Gear^.State:= Gear^.State or gstMoving; |
1138 Gear^.dX:=Gear^.dX+slope*_0_07; |
1127 end |
1139 if slope.QWordValue <> 0 then Gear^.State:= Gear^.State or gstMoving; |
1128 (* |
1140 (* |
1129 // check land slope, and impart a dX based on it |
1141 x:= hwRound(Gear^.X); |
1130 tdX:= Gear^.dX; |
1142 y:= hwRound(Gear^.Y); |
1131 tdY:= Gear^.dY; |
1143 AddVisualGear(x, y, vgtSmokeTrace); |
1132 Gear^.dX:= _0; |
1144 AddVisualGear(x - hwRound(_5*slope), y + hwRound(_5*slope), vgtSmokeTrace); |
1133 Gear^.dY:= _1; |
1145 AddVisualGear(x + hwRound(_5*slope), y - hwRound(_5*slope), vgtSmokeTrace); |
1134 x := hwRound(Gear^.X); |
1146 AddVisualGear(x - hwRound(_20 * slope), y + hwRound(_20 * slope), vgtSmokeTrace); |
1135 y := hwRound(Gear^.Y); |
1147 AddVisualGear(x + hwRound(_20 * slope), y - hwRound(_20 * slope), vgtSmokeTrace); |
1136 tx := 0; |
1148 AddVisualGear(x - hwRound(_30 * slope), y + hwRound(_30 * slope), vgtSmokeTrace); |
1137 ty := 0; |
1149 AddVisualGear(x + hwRound(_30 * slope), y - hwRound(_30 * slope), vgtSmokeTrace); |
1138 if not CalcSlopeTangent(Gear, x, y+cHHRadius, tx, ty, 255) then |
1150 AddVisualGear(x - hwRound(_40 * slope), y + hwRound(_40 * slope), vgtSmokeTrace); |
1139 begin |
1151 AddVisualGear(x + hwRound(_40 * slope), y - hwRound(_40 * slope), vgtSmokeTrace); |
1140 slope:= _1/DistanceI(tx,ty); |
1152 AddVisualGear(x - hwRound(_50 * slope), y + hwRound(_50 * slope), vgtSmokeTrace); |
1141 AddFileLog(FloatToStr(tdX)+ ' == '+FloatToStr(slope)); |
1153 AddVisualGear(x + hwRound(_50 * slope), y - hwRound(_50 * slope), vgtSmokeTrace); *) |
1142 tdX:= tdX + (cGravity * slope / _10) // this will need tuning |
1154 end |
1143 end; |
1155 end; |
1144 Gear^.dX:= tdX; |
|
1145 Gear^.dY:= tdY *) |
|
1146 end; |
|
1147 end; |
|