hedgewars/uGearsHandlersMess.pas
changeset 15235 66dcb7728e01
parent 15234 186c3f272187
child 15237 5c91c5191085
equal deleted inserted replaced
15234:186c3f272187 15235:66dcb7728e01
  3106                 inc(Gear^.WDTimer);
  3106                 inc(Gear^.WDTimer);
  3107             end;
  3107             end;
  3108 
  3108 
  3109         if CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y)) then
  3109         if CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y)) then
  3110             FollowGear^.State:= FollowGear^.State or gstSubmersible;
  3110             FollowGear^.State:= FollowGear^.State or gstSubmersible;
  3111         if (Gear^.SoundChannel <> -1) and (WorldEdge <> weSea) then
       
  3112             begin
       
  3113             StopSoundChan(Gear^.SoundChannel, 4000);
       
  3114             Gear^.SoundChannel := -1;
       
  3115             end;
       
  3116         end;
  3111         end;
  3117 
  3112 
  3118     if (Gear^.Health = 0) then
  3113     if (Gear^.Health = 0) then
  3119         inc(Gear^.FlightTime);
  3114         inc(Gear^.FlightTime);
       
  3115 
       
  3116     if (Gear^.SoundChannel <> -1) and (WorldEdge <> weSea) and (Gear^.FlightTime > 20) then
       
  3117         begin
       
  3118         StopSoundChan(Gear^.SoundChannel, 4000);
       
  3119         Gear^.SoundChannel := -1;
       
  3120         end;
  3120 
  3121 
  3121     // Particles
  3122     // Particles
  3122     if (GameTicks and $3F) = 0 then
  3123     if (GameTicks and $3F) = 0 then
  3123         if CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y)) then
  3124         if CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y)) then
  3124             AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtBubble)
  3125             AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtBubble)
  3125         else
  3126         else
  3126             AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace);
  3127             AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace);
  3127 
  3128 
  3128     // Get rid of gear and cleanup
  3129     // Get rid of gear and cleanup
  3129     if ((WorldEdge = weWrap) and (Gear^.FlightTime >= 4000)) or
  3130     if ((WorldEdge = weWrap) and (Gear^.FlightTime >= 4000)) or
  3130         ((WorldEdge <> weWrap) and (((hwRound(Gear^.X) - Gear^.Radius > (max(LAND_WIDTH,4096)+2048)) or (hwRound(Gear^.X) + Gear^.Radius < -2048) or ((Gear^.Message and gmDestroy) > 0))) then
  3131         ((WorldEdge <> weWrap) and (((hwRound(Gear^.X) - Gear^.Radius > (max(LAND_WIDTH,4096)+2048)) or (hwRound(Gear^.X) + Gear^.Radius < -2048) or ((Gear^.Message and gmDestroy) > 0)))) then
  3131         begin
  3132         begin
  3132         // fail-safe: instanly stop sound if it wasn't disabled before
  3133         // fail-safe: instanly stop sound if it wasn't disabled before
  3133         if (Gear^.SoundChannel <> -1) then
  3134         if (Gear^.SoundChannel <> -1) then
  3134             begin
  3135             begin
  3135             StopSoundChan(Gear^.SoundChannel);
  3136             StopSoundChan(Gear^.SoundChannel);