hedgewars/uGearsUtils.pas
changeset 9557 a5005b7ca305
parent 9522 a386e1cdc468
child 9561 aab34634a17b
equal deleted inserted replaced
9555:485b424be769 9557:a5005b7ca305
    58 
    58 
    59 
    59 
    60 function MakeHedgehogsStep(Gear: PGear) : boolean;
    60 function MakeHedgehogsStep(Gear: PGear) : boolean;
    61 
    61 
    62 var doStepHandlers: array[TGearType] of TGearStepProcedure;
    62 var doStepHandlers: array[TGearType] of TGearStepProcedure;
    63 
       
    64 
    63 
    65 implementation
    64 implementation
    66 uses uSound, uCollisions, uUtils, uConsts, uVisualGears, uAIMisc,
    65 uses uSound, uCollisions, uUtils, uConsts, uVisualGears, uAIMisc,
    67     uVariables, uLandGraphics, uScript, uStats, uCaptions, uTeams, uStore,
    66     uVariables, uLandGraphics, uScript, uStats, uCaptions, uTeams, uStore,
    68     uLocale, uTextures, uRenderUtils, uRandom, SDLh, uDebug, 
    67     uLocale, uTextures, uRenderUtils, uRandom, SDLh, uDebug, 
  1227     begin
  1226     begin
  1228     if WorldEdge = weWrap then
  1227     if WorldEdge = weWrap then
  1229         begin
  1228         begin
  1230         if (hwRound(Gear^.X)-Gear^.Radius < leftX) then
  1229         if (hwRound(Gear^.X)-Gear^.Radius < leftX) then
  1231              Gear^.X:= int2hwfloat(rightX-Gear^.Radius)
  1230              Gear^.X:= int2hwfloat(rightX-Gear^.Radius)
  1232         else Gear^.X:= int2hwfloat(leftX+Gear^.Radius)
  1231         else Gear^.X:= int2hwfloat(leftX+Gear^.Radius);
       
  1232         LeftImpactTimer:= 150;
       
  1233         RightImpactTimer:= 150
  1233         end
  1234         end
  1234     else if WorldEdge = weBounce then
  1235     else if WorldEdge = weBounce then
  1235         begin
  1236         begin
  1236         if (hwRound(Gear^.X)-Gear^.Radius < leftX) then
  1237         if (hwRound(Gear^.X)-Gear^.Radius < leftX) then
  1237             begin
  1238             begin
       
  1239             LeftImpactTimer:= 333;
  1238             Gear^.dX.isNegative:= false;
  1240             Gear^.dX.isNegative:= false;
  1239             Gear^.X:= int2hwfloat(leftX+Gear^.Radius)
  1241             Gear^.X:= int2hwfloat(leftX+Gear^.Radius)
  1240             end
  1242             end
  1241         else 
  1243         else 
  1242             begin
  1244             begin
       
  1245             RightImpactTimer:= 333;
  1243             Gear^.dX.isNegative:= true;
  1246             Gear^.dX.isNegative:= true;
  1244             Gear^.X:= int2hwfloat(rightX-Gear^.Radius)
  1247             Gear^.X:= int2hwfloat(rightX-Gear^.Radius)
  1245             end
  1248             end;
       
  1249         PlaySound(sndMelonImpact);
  1246         end
  1250         end
  1247     else if WorldEdge = weSea then
  1251     else if WorldEdge = weSea then
  1248         begin
  1252         begin
  1249         if (hwRound(Gear^.Y) > cWaterLine) and (Gear^.State and gstSubmersible <> 0) then
  1253         if (hwRound(Gear^.Y) > cWaterLine) and (Gear^.State and gstSubmersible <> 0) then
  1250             Gear^.State:= Gear^.State and not gstSubmersible
  1254             Gear^.State:= Gear^.State and not gstSubmersible