hedgewars/uGearsHandlersMess.pas
changeset 12719 5a57acce9cae
parent 12717 31f7e0a31736
child 12742 d08afea02908
equal deleted inserted replaced
12718:927b35f59a46 12719:5a57acce9cae
   258 end;
   258 end;
   259 
   259 
   260 
   260 
   261 ////////////////////////////////////////////////////////////////////////////////
   261 ////////////////////////////////////////////////////////////////////////////////
   262 procedure doStepDrowningGear(Gear: PGear);
   262 procedure doStepDrowningGear(Gear: PGear);
   263 var i, d: LongInt;
   263 var i, d, bubbleX, bubbleY: LongInt;
   264     bubble: PVisualGear;
   264     bubble: PVisualGear;
   265 begin
   265 begin
   266 if Gear^.Timer = 0 then
   266 if Gear^.Timer = 0 then
   267     begin
   267     begin
   268     d:= 2 * Gear^.Radius;
   268     d:= 2 * Gear^.Radius;
   290     end
   290     end
   291 else
   291 else
   292     Gear^.X := Gear^.X + Gear^.dX * cDrownSpeed;
   292     Gear^.X := Gear^.X + Gear^.dX * cDrownSpeed;
   293 
   293 
   294 // Create some bubbles (0.5% might be better but causes too few bubbles sometimes)
   294 // Create some bubbles (0.5% might be better but causes too few bubbles sometimes)
       
   295 if (Gear^.Kind = gtHedgehog) and (Gear^.dX.isNegative) then
       
   296     bubbleX:= hwRound(Gear^.X) - Gear^.Radius
       
   297 else
       
   298     bubbleX:= hwRound(Gear^.X) + Gear^.Radius;
       
   299 bubbleY:= hwRound(Gear^.Y) - Gear^.Radius;
   295 if ((not SuddenDeathDmg and (WaterOpacity < $FF))
   300 if ((not SuddenDeathDmg and (WaterOpacity < $FF))
   296 or (SuddenDeathDmg and (SDWaterOpacity < $FF))) and ((GameTicks and $1F) = 0) then
   301 or (SuddenDeathDmg and (SDWaterOpacity < $FF))) and ((GameTicks and $1F) = 0) then
   297     if (Gear^.Kind = gtHedgehog) and (Random(4) = 0) then
   302     if (Gear^.Kind = gtHedgehog) and (Random(4) = 0) then
   298         AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius, vgtBubble)
   303         AddVisualGear(bubbleX, bubbleY, vgtBubble)
   299 else if Random(12) = 0 then
   304 else if Random(12) = 0 then
   300          AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius, vgtBubble);
   305         AddVisualGear(bubbleX, bubbleY, vgtBubble);
   301 if (not SuddenDeathDmg and (WaterOpacity > $FE))
   306 if (not SuddenDeathDmg and (WaterOpacity > $FE))
   302 or (SuddenDeathDmg and (SDWaterOpacity > $FE))
   307 or (SuddenDeathDmg and (SDWaterOpacity > $FE))
   303 or (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then
   308 or (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then
   304     DeleteGear(Gear);
   309     DeleteGear(Gear);
   305 end;
   310 end;