hedgewars/GSHandlers.inc
changeset 14 81f125629b25
parent 13 7a5db822fd3f
child 15 6200cca92480
equal deleted inserted replaced
13:7a5db822fd3f 14:81f125629b25
   584    CalcRotationDirAngle(Gear);
   584    CalcRotationDirAngle(Gear);
   585    AllInactive:= false
   585    AllInactive:= false
   586    end;
   586    end;
   587 if ((Gear.State and gsttmpFlag) <> 0) then
   587 if ((Gear.State and gsttmpFlag) <> 0) then
   588    if ((Gear.State and gstAttacking) = 0) then
   588    if ((Gear.State and gstAttacking) = 0) then
   589       if isGearNear(Gear, gtHedgehog, 46, 32) then Gear.State:= Gear.State or gstAttacking else
   589       begin
   590       else // gstAttacking <> 0
   590       if (Gear.Tag = 0) then
       
   591          begin
       
   592          Gear.Tag:= 10;
       
   593          if isGearNear(Gear, gtHedgehog, 46, 32) then Gear.State:= Gear.State or gstAttacking
       
   594          end else dec(Gear.Tag)
       
   595       end else // gstAttacking <> 0
   591       begin
   596       begin
   592       AllInactive:= false;
   597       AllInactive:= false;
   593       if (Gear.Timer and $1FF) = 0 then PlaySound(sndMineTick);
   598       if (Gear.Timer and $1FF) = 0 then PlaySound(sndMineTick);
   594       if Gear.Timer = 0 then
   599       if Gear.Timer = 0 then
   595          begin
   600          begin
   599          end;
   604          end;
   600       dec(Gear.Timer);
   605       dec(Gear.Timer);
   601       end else // gsttmpFlag = 0
   606       end else // gsttmpFlag = 0
   602    if TurnTimeLeft = 0 then Gear.State:= Gear.State or gsttmpFlag;
   607    if TurnTimeLeft = 0 then Gear.State:= Gear.State or gsttmpFlag;
   603 end;
   608 end;
       
   609 
       
   610 procedure doStepCase(Gear: PGear);
       
   611 begin
       
   612 if (Gear.dY <> 0) or (not TestCollisionY(Gear, 1)) then
       
   613    begin
       
   614    AllInactive:= false;
       
   615    Gear.dY:= Gear.dY + cGravity;
       
   616    Gear.Y:= Gear.Y + Gear.dY;
       
   617    if (Gear.dY < 0) and TestCollisionY(Gear, -1) then Gear.dY:= 0 else
       
   618    if (Gear.dY >= 0) and TestCollisionY(Gear, 1) then
       
   619       begin
       
   620       Gear.dY:= - Gear.dY * Gear.Elasticity;
       
   621       if Gear.dY > - 0.001 then Gear.dY:= 0
       
   622          else if Gear.dY < - 0.03 then PlaySound(sndGraveImpact);
       
   623       end;
       
   624    CheckGearDrowning(Gear);
       
   625    end;
       
   626 
       
   627 if (Gear.CollIndex = High(Longword)) and (Gear.dY = 0) then AddGearCR(Gear)
       
   628    else if (Gear.CollIndex < High(Longword)) and (Gear.dY <> 0) then DeleteCR(Gear);
       
   629 
       
   630 if (Gear.Tag = 0) then
       
   631    begin
       
   632    Gear.Tag:= 10;
       
   633    if isGearNear(Gear, gtHedgehog, 25, 25) then
       
   634       begin
       
   635       ;//give ammo to hedgehog
       
   636       DeleteGear(Gear);
       
   637       SetAllToActive;
       
   638       end;
       
   639    end else dec(Gear.Tag);
       
   640 
       
   641 if Gear.Damage > 0 then
       
   642    begin
       
   643    DeleteGear(Gear);
       
   644    doMakeExplosion(round(Gear.X), round(Gear.Y), 50, EXPLAutoSound)
       
   645    end
       
   646 end;