hedgewars/GSHandlers.inc
changeset 3710 411f5c2b5292
parent 3706 a79784328c03
child 3712 de2026031833
equal deleted inserted replaced
3709:c7849b74748d 3710:411f5c2b5292
  1434     else // gsttmpFlag = 0
  1434     else // gsttmpFlag = 0
  1435         if TurnTimeLeft = 0 then Gear^.State := Gear^.State or gsttmpFlag;
  1435         if TurnTimeLeft = 0 then Gear^.State := Gear^.State or gsttmpFlag;
  1436 end;
  1436 end;
  1437 
  1437 
  1438 ////////////////////////////////////////////////////////////////////////////////
  1438 ////////////////////////////////////////////////////////////////////////////////
       
  1439 procedure doStepSMine(Gear: PGear);
       
  1440 begin
       
  1441     if (Gear^.State and gstMoving) <> 0 then
       
  1442     begin
       
  1443         if ((Gear^.State and gstCollision) <> 0) and (Gear^.dX < _0_2) and (Gear^.dY < _0_2) then
       
  1444         begin
       
  1445             Gear^.dX := _0;
       
  1446             Gear^.dY := _0
       
  1447             // TODO: calc attach dir
       
  1448         end
       
  1449         else
       
  1450             CalcRotationDirAngle(Gear);
       
  1451 
       
  1452         DeleteCI(Gear);
       
  1453         doStepFallingGear(Gear);
       
  1454         if (Gear^.State and gstMoving) = 0 then
       
  1455             AddGearCI(Gear);
       
  1456         AllInactive := false
       
  1457     end
       
  1458     else
       
  1459     begin
       
  1460         if ((GameTicks and $3F) = 25) then
       
  1461             doStepFallingGear(Gear);
       
  1462     end;
       
  1463 
       
  1464     if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then
       
  1465         if ((Gear^.State and gstAttacking) = 0) then
       
  1466         begin
       
  1467             if ((GameTicks and $1F) = 0) then
       
  1468                 if CheckGearNear(Gear, gtHedgehog, 46, 32) <> nil then Gear^.State := Gear^.State or
       
  1469                                                                                       gstAttacking
       
  1470         end
       
  1471     else // gstAttacking <> 0
       
  1472     begin
       
  1473         AllInactive := false;
       
  1474         if (Gear^.Timer and $FF) = 0 then PlaySound(sndMineTick);
       
  1475         if Gear^.Timer = 0 then
       
  1476         begin
       
  1477             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
       
  1478             DeleteGear(Gear);
       
  1479             exit
       
  1480         end;
       
  1481         dec(Gear^.Timer);
       
  1482     end
       
  1483     else // gsttmpFlag = 0
       
  1484         if TurnTimeLeft = 0 then Gear^.State := Gear^.State or gsttmpFlag;
       
  1485 end;
       
  1486 
       
  1487 ////////////////////////////////////////////////////////////////////////////////
  1439 procedure doStepDynamite(Gear: PGear);
  1488 procedure doStepDynamite(Gear: PGear);
  1440 begin
  1489 begin
  1441     doStepFallingGear(Gear);
  1490     doStepFallingGear(Gear);
  1442     AllInactive := false;
  1491     AllInactive := false;
  1443     if Gear^.Timer mod 166 = 0 then inc(Gear^.Tag);
  1492     if Gear^.Timer mod 166 = 0 then inc(Gear^.Tag);