hedgewars/GSHandlers.inc
changeset 2955 fb361d137524
parent 2948 3f21a9dc93d0
child 2963 0f0789204802
equal deleted inserted replaced
2954:55d272e34f9a 2955:fb361d137524
  1254     begin
  1254     begin
  1255     DeleteCI(Gear);
  1255     DeleteCI(Gear);
  1256     AllInactive:= false;
  1256     AllInactive:= false;
  1257     if not Gear^.dY.isNegative and (Gear^.dY > _0_03) and TestCollisionYwithGear(Gear, 1) then
  1257     if not Gear^.dY.isNegative and (Gear^.dY > _0_03) and TestCollisionYwithGear(Gear, 1) then
  1258         begin
  1258         begin
  1259         inc(Gear^.Damage, hwRound(Gear^.dY * _30));
  1259         Gear^.State:= Gear^.State or gsttmpFlag;
       
  1260         inc(Gear^.Damage, hwRound(Gear^.dY * _40));
  1260         for i:= min(12, hwRound(Gear^.dY*_10)) downto 0 do 
  1261         for i:= min(12, hwRound(Gear^.dY*_10)) downto 0 do 
  1261             begin
  1262             begin
  1262             particle:= AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust);
  1263             particle:= AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust);
  1263             if particle <> nil then particle^.dX := particle^.dX + (Gear^.dX / 5)
  1264             if particle <> nil then particle^.dX := particle^.dX + (Gear^.dX / 5)
  1264             end
  1265             end
  1265         end
  1266         end
  1266     else if not Gear^.dX.isNegative and (Gear^.dX > _0_03) and TestCollisionXwithGear(Gear, 1) then
  1267     else if not Gear^.dX.isNegative and (Gear^.dX > _0_03) and TestCollisionXwithGear(Gear, 1) then
  1267         inc(Gear^.Damage, hwRound(Gear^.dX * _30))
  1268         inc(Gear^.Damage, hwRound(Gear^.dX * _40))
  1268     else if Gear^.dY.isNegative and (Gear^.dY < -_0_03) and TestCollisionYwithGear(Gear, -1) then
  1269     else if Gear^.dY.isNegative and (Gear^.dY < -_0_03) and TestCollisionYwithGear(Gear, -1) then
  1269         inc(Gear^.Damage, hwRound(Gear^.dY * -_30))
  1270         inc(Gear^.Damage, hwRound(Gear^.dY * -_40))
  1270     else if Gear^.dX.isNegative and (Gear^.dX < -_0_03) and TestCollisionXwithGear(Gear, -1) then
  1271     else if Gear^.dX.isNegative and (Gear^.dX < -_0_03) and TestCollisionXwithGear(Gear, -1) then
  1271         inc(Gear^.Damage, hwRound(Gear^.dX * -_30));
  1272         inc(Gear^.Damage, hwRound(Gear^.dX * -_40));
  1272     if Gear^.Damage <> 0 then PlaySound(sndGraveImpact);
  1273     if Gear^.Damage <> 0 then PlaySound(sndGraveImpact);
  1273     doStepFallingGear(Gear);
  1274     doStepFallingGear(Gear);
  1274     CalcRotationDirAngle(Gear);
  1275     CalcRotationDirAngle(Gear);
  1275     CheckGearDrowning(Gear)
  1276     CheckGearDrowning(Gear)
  1276     end
  1277     end
  1374     if (not Gear^.dY.isNegative) and (Gear^.dY > _0_001) then SetAllHHToActive;
  1375     if (not Gear^.dY.isNegative) and (Gear^.dY > _0_001) then SetAllHHToActive;
  1375     if (Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0;
  1376     if (Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0;
  1376     if (not Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, 1) then
  1377     if (not Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, 1) then
  1377         begin
  1378         begin
  1378         if (Gear^.dY > _0_02) and (k = gtExplosives) then
  1379         if (Gear^.dY > _0_02) and (k = gtExplosives) then
  1379             inc(Gear^.Damage, hwRound(Gear^.dY * _30));
  1380             inc(Gear^.Damage, hwRound(Gear^.dY * _40));
  1380 
  1381 
  1381         if Gear^.dY > _0_2 then
  1382         if Gear^.dY > _0_2 then
  1382             for i:= min(12, hwRound(Gear^.dY*_10)) downto 0 do 
  1383             for i:= min(12, hwRound(Gear^.dY*_10)) downto 0 do 
  1383                 AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust);
  1384                 AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust);
  1384         Gear^.dY:= - Gear^.dY * Gear^.Elasticity;
  1385         Gear^.dY:= - Gear^.dY * Gear^.Elasticity;