1423 end |
1424 end |
1424 else if (GameTicks and $3F) = 25 then |
1425 else if (GameTicks and $3F) = 25 then |
1425 doStepFallingGear(Gear); |
1426 doStepFallingGear(Gear); |
1426 if (Gear^.Health = 0) then |
1427 if (Gear^.Health = 0) then |
1427 begin |
1428 begin |
1428 if (Gear^.dY > _0_2) and (TestCollisionYwithGear(Gear, 1) <> 0) then |
1429 dxdy:= hwAbs(Gear^.dX)+hwAbs(Gear^.dY); |
1429 inc(Gear^.Damage, hwRound(Gear^.dY * _70)) |
1430 if (dxdy > _0_3) and |
1430 else if (Gear^.dX > _0_2) and TestCollisionXwithGear(Gear, 1) then |
1431 ((TestCollisionYwithGear(Gear, 1) <> 0) or |
1431 inc(Gear^.Damage, hwRound(Gear^.dX * _70)) |
1432 TestCollisionXwithGear(Gear, 1) or |
1432 else if (Gear^.dY < -_0_2) and (TestCollisionYwithGear(Gear, -1) <> 0) then |
1433 (TestCollisionYwithGear(Gear, -1) <> 0) or |
1433 inc(Gear^.Damage, hwRound(Gear^.dY * -_70)) |
1434 TestCollisionXwithGear(Gear, -1)) then |
1434 else if (Gear^.dX < -_0_2) and TestCollisionXwithGear(Gear, -1) then |
1435 inc(Gear^.Damage, hwRound(dxdy * _25)); |
1435 inc(Gear^.Damage, hwRound(Gear^.dX * -_70)); |
|
1436 |
1436 |
1437 if ((GameTicks and $FF) = 0) and (Gear^.Damage > random(30)) then |
1437 if ((GameTicks and $FF) = 0) and (Gear^.Damage > random(30)) then |
1438 begin |
1438 begin |
1439 vg:= AddVisualGear(hwRound(Gear^.X) - 4 + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke); |
1439 vg:= AddVisualGear(hwRound(Gear^.X) - 4 + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke); |
1440 if vg <> nil then |
1440 if vg <> nil then |
1573 *) |
1573 *) |
1574 procedure doStepRollingBarrel(Gear: PGear); |
1574 procedure doStepRollingBarrel(Gear: PGear); |
1575 var |
1575 var |
1576 i: LongInt; |
1576 i: LongInt; |
1577 particle: PVisualGear; |
1577 particle: PVisualGear; |
|
1578 dxdy: hwFloat; |
1578 begin |
1579 begin |
1579 if (Gear^.dY.QWordValue = 0) and (Gear^.dY.QWordValue = 0) and (TestCollisionYwithGear(Gear, 1) = 0) then |
1580 if (Gear^.dY.QWordValue = 0) and (Gear^.dY.QWordValue = 0) and (TestCollisionYwithGear(Gear, 1) = 0) then |
1580 SetLittle(Gear^.dY); |
1581 SetLittle(Gear^.dY); |
1581 Gear^.State := Gear^.State or gstAnimation; |
1582 Gear^.State := Gear^.State or gstAnimation; |
1582 |
1583 |
1583 if ((Gear^.dX.QWordValue <> 0) |
1584 if ((Gear^.dX.QWordValue <> 0) |
1584 or (Gear^.dY.QWordValue <> 0)) then |
1585 or (Gear^.dY.QWordValue <> 0)) then |
1585 begin |
1586 begin |
1586 DeleteCI(Gear); |
1587 DeleteCI(Gear); |
1587 AllInactive := false; |
1588 AllInactive := false; |
1588 if (Gear^.dY > _0_2) and (TestCollisionYwithGear(Gear, 1) <> 0) then |
1589 dxdy:= hwAbs(Gear^.dX)+hwAbs(Gear^.dY); |
1589 begin |
1590 if (dxdy > _0_3) then |
1590 Gear^.State := Gear^.State or gsttmpFlag; |
1591 begin |
1591 inc(Gear^.Damage, hwRound(Gear^.dY * _70)); |
1592 if (TestCollisionYwithGear(Gear, 1) <> 0) then |
1592 for i:= min(12, hwRound(Gear^.dY*_10)) downto 0 do |
|
1593 begin |
1593 begin |
1594 particle := AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12,vgtDust); |
1594 Gear^.State := Gear^.State or gsttmpFlag; |
1595 if particle <> nil then |
1595 inc(Gear^.Damage, hwRound(dxdy * _25)); |
1596 particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480) |
1596 for i:= min(12, hwRound(dxdy*_10)) downto 0 do |
|
1597 begin |
|
1598 particle := AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12,vgtDust); |
|
1599 if particle <> nil then |
|
1600 particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480) |
|
1601 end |
1597 end |
1602 end |
1598 end |
1603 else if TestCollisionXwithGear(Gear, 1) or (TestCollisionYwithGear(Gear, -1) <> 0) or TestCollisionXwithGear(Gear, -1) then |
1599 else if (Gear^.dX > _0_2) and TestCollisionXwithGear(Gear, 1) then |
1604 inc(Gear^.Damage, hwRound(dxdy * _25)) |
1600 inc(Gear^.Damage, hwRound(Gear^.dX * _70)) |
1605 end; |
1601 |
|
1602 else if (Gear^.dY < -_0_2) and (TestCollisionYwithGear(Gear, -1) <> 0) then |
|
1603 inc(Gear^.Damage, hwRound(Gear^.dY * -_70)) |
|
1604 |
|
1605 else if (Gear^.dX < -_0_2) and TestCollisionXwithGear(Gear, -1) then |
|
1606 inc(Gear^.Damage, hwRound(Gear^.dX * -_70)); |
|
1607 |
|
1608 doStepFallingGear(Gear); |
1606 doStepFallingGear(Gear); |
1609 CalcRotationDirAngle(Gear); |
1607 CalcRotationDirAngle(Gear); |
1610 //CheckGearDrowning(Gear) |
1608 //CheckGearDrowning(Gear) |
1611 end |
1609 end |
1612 else |
1610 else |
1676 |
1674 |
1677 if k = gtExplosives then |
1675 if k = gtExplosives then |
1678 begin |
1676 begin |
1679 //if V > _0_03 then Gear^.State:= Gear^.State or gstAnimation; |
1677 //if V > _0_03 then Gear^.State:= Gear^.State or gstAnimation; |
1680 if (hwAbs(Gear^.dX) > _0_15) or ((hwAbs(Gear^.dY) > _0_15) and (hwAbs(Gear^.dX) > _0_02)) then |
1678 if (hwAbs(Gear^.dX) > _0_15) or ((hwAbs(Gear^.dY) > _0_15) and (hwAbs(Gear^.dX) > _0_02)) then |
1681 Gear^.doStep := @doStepRollingBarrel; |
1679 Gear^.doStep := @doStepRollingBarrel |
|
1680 else Gear^.dX:= _0; |
1682 |
1681 |
1683 if (Gear^.Health > 0) and ((Gear^.Health * 100 div cBarrelHealth) < random(90)) and ((GameTicks and $FF) = 0) then |
1682 if (Gear^.Health > 0) and ((Gear^.Health * 100 div cBarrelHealth) < random(90)) and ((GameTicks and $FF) = 0) then |
1684 if (cBarrelHealth div Gear^.Health) > 2 then |
1683 if (cBarrelHealth div Gear^.Health) > 2 then |
1685 AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmoke) |
1684 AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmoke) |
1686 else |
1685 else |