hedgewars/uGearsHandlersMess.pas
changeset 10582 672e7028b1b6
parent 10580 17560eb73b4c
child 10586 dbb77726f0c6
equal deleted inserted replaced
10580:17560eb73b4c 10582:672e7028b1b6
  5542         HedgehogChAngle(HHGear);
  5542         HedgehogChAngle(HHGear);
  5543         ndX:= SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _4;
  5543         ndX:= SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _4;
  5544         ndY:= -AngleCos(HHGear^.Angle) * _4;
  5544         ndY:= -AngleCos(HHGear^.Angle) * _4;
  5545         if (ndX <> dX) or (ndY <> dY) or
  5545         if (ndX <> dX) or (ndY <> dY) or
  5546            ((Target.X <> NoPointX) and (Target.X and LAND_WIDTH_MASK = 0) and
  5546            ((Target.X <> NoPointX) and (Target.X and LAND_WIDTH_MASK = 0) and
  5547              (Target.Y and LAND_HEIGHT_MASK = 0) and ((Land[Target.Y, Target.X] = 0))) then
  5547              (Target.Y and LAND_HEIGHT_MASK = 0) and ((Land[Target.Y, Target.X] = 0)) and
       
  5548              (not CheckCoordInWater(Target.X, Target.Y))) then
  5548             begin
  5549             begin
  5549             updateTarget(Gear, ndX, ndY);
  5550             updateTarget(Gear, ndX, ndY);
  5550             Timer := iceWaitCollision;
  5551             Timer := iceWaitCollision;
  5551             end
  5552             end
  5552         else
  5553         else
  5566                         begin
  5567                         begin
  5567                         Timer := iceCollideWithGround;
  5568                         Timer := iceCollideWithGround;
  5568                         Power := GameTicks;
  5569                         Power := GameTicks;
  5569                         end
  5570                         end
  5570                     end
  5571                     end
  5571                 else if (Target.Y >= cWaterLine) or
  5572                 else if CheckCoordInWater(Target.X, Target.Y) or
  5572                         ((Target.X and LAND_WIDTH_MASK = 0) and
  5573                         ((Target.X and LAND_WIDTH_MASK  = 0) and
  5573                          (Target.Y+iceHeight+4 >= cWaterLine) and
  5574                          (Target.Y and LAND_HEIGHT_MASK = 0) and
  5574                          (Land[Target.Y, Target.X] = lfIce)) then
  5575                          (Land[Target.Y, Target.X] = lfIce) and
       
  5576                          ((Target.Y+iceHeight+5 > cWaterLine) or
       
  5577                           ((WorldEdge = weSea) and
       
  5578                            ((Target.X+iceHeight+5 > LongInt(rightX)) or
       
  5579                             (Target.X-iceHeight-5 < LongInt(leftX)))))
       
  5580                          ) then
  5575                     begin
  5581                     begin
  5576                     if Timer = iceWaitCollision then
  5582                     if Timer = iceWaitCollision then
  5577                         begin
  5583                         begin
  5578                         Timer := iceCollideWithWater;
  5584                         Timer := iceCollideWithWater;
  5579                         Power := GameTicks;
  5585                         Power := GameTicks;
  5649                     end;
  5655                     end;
  5650 
  5656 
  5651                 if (Timer = iceCollideWithWater) and ((GameTicks - Power) > groundFreezingTime div 2) then
  5657                 if (Timer = iceCollideWithWater) and ((GameTicks - Power) > groundFreezingTime div 2) then
  5652                     begin
  5658                     begin
  5653                     PlaySound(sndHogFreeze);
  5659                     PlaySound(sndHogFreeze);
  5654                     DrawIceBreak(Target.X, cWaterLine - iceHeight, iceRadius, iceHeight);
  5660                     if CheckCoordInWater(Target.X, Target.Y) then
       
  5661                         DrawIceBreak(Target.X, Target.Y, iceRadius, iceHeight)
       
  5662                     else if Target.Y+iceHeight+5 > cWaterLine then
       
  5663                         DrawIceBreak(Target.X, Target.Y+iceHeight+5, iceRadius, iceHeight)
       
  5664                     else if Target.X+iceHeight+5 > LongInt(rightX) then
       
  5665                         DrawIceBreak(Target.X+iceHeight+5, Target.Y, iceRadius, iceHeight)
       
  5666                     else
       
  5667                         DrawIceBreak(Target.X-iceHeight-5, Target.Y, iceRadius, iceHeight);
  5655                     SetAllHHToActive;
  5668                     SetAllHHToActive;
  5656                     Timer := iceWaitCollision;
  5669                     Timer := iceWaitCollision;
  5657                     end;
  5670                     end;
  5658 (*
  5671 (*
  5659  Any ideas for something that would look good here?
  5672  Any ideas for something that would look good here?
  5687                                     PlaySound(sndHogFreeze);
  5700                                     PlaySound(sndHogFreeze);
  5688                                     end;
  5701                                     end;
  5689                                 end;
  5702                                 end;
  5690                 inc(Pos)
  5703                 inc(Pos)
  5691                 end
  5704                 end
  5692             else if (t > 400) and ((gY > cWaterLine) or
  5705             else if (t > 400) and (CheckCoordInWater(gX, gY) or
  5693                     (((gX and LAND_WIDTH_MASK = 0) and (gY and LAND_HEIGHT_MASK = 0))
  5706                     (((gX and LAND_WIDTH_MASK = 0) and (gY and LAND_HEIGHT_MASK = 0))
  5694                         and (Land[gY, gX] <> 0))) then
  5707                         and (Land[gY, gX] <> 0))) then
  5695                 begin
  5708                 begin
  5696                 Target.X:= gX;
  5709                 Target.X:= gX;
  5697                 Target.Y:= gY;
  5710                 Target.Y:= gY;