hedgewars/uGearsHandlersMess.pas
changeset 12277 da65acd5dc9d
parent 12205 d52af905437b
child 12292 93434ab299a0
equal deleted inserted replaced
12276:12f28d866c76 12277:da65acd5dc9d
  6374     if Gear^.Pos = 0 then
  6374     if Gear^.Pos = 0 then
  6375         doStepFallingGear(Gear);
  6375         doStepFallingGear(Gear);
  6376 
  6376 
  6377     (* Check if duck is near water surface
  6377     (* Check if duck is near water surface
  6378            (Karma is distance from water) *)
  6378            (Karma is distance from water) *)
  6379     if (not (Gear^.Pos in [1, 2])) and (cWaterLine <= hwRound(Gear^.Y) + Gear^.Karma) then
  6379     if (Gear^.Pos <> 1) and (Gear^.Pos <> 2) and (cWaterLine <= hwRound(Gear^.Y) + Gear^.Karma) then
  6380         begin
  6380         begin
  6381         if cWaterLine = hwRound(Gear^.Y) + Gear^.Karma then
  6381         if cWaterLine = hwRound(Gear^.Y) + Gear^.Karma then
  6382             begin
  6382             begin
  6383             // Let's make that duck swim!
  6383             // Let's make that duck swim!
  6384             // Does the duck come FROM the Sea edge? (left or right)
  6384             // Does the duck come FROM the Sea edge? (left or right)
  6385             if ((Gear^.Pos in [3, 7]) and (cWindSpeed > _0)) or ((Gear^.Pos in [4, 8]) and (cWindSpeed < _0)) then
  6385             if (((Gear^.Pos = 3) or (Gear^.Pos = 7)) and (cWindSpeed > _0)) or (((Gear^.Pos = 4) or (Gear^.Pos = 8)) and (cWindSpeed < _0)) then
  6386                 begin
  6386                 begin
  6387                 PlaySound(sndDuckWater);
  6387                 PlaySound(sndDuckWater);
  6388                 Gear^.Angle:= 0;
  6388                 Gear^.Angle:= 0;
  6389                 Gear^.Pos:= 1;
  6389                 Gear^.Pos:= 1;
  6390                 Gear^.dY:= _0;
  6390                 Gear^.dY:= _0;
  6391                 end;
  6391                 end;
  6392 
  6392 
  6393             // Duck comes either falling (usual case) or was rising from below
  6393             // Duck comes either falling (usual case) or was rising from below
  6394             if Gear^.Pos in [0, 5, 6] then
  6394             if (Gear^.Pos = 0) or (Gear^.Pos = 5) or (Gear^.Pos = 6) then
  6395                 begin
  6395                 begin
  6396                 PlaySound(sndDroplet2);
  6396                 PlaySound(sndDroplet2);
  6397                 if Gear^.dY > _0_4 then
  6397                 if Gear^.dY > _0_4 then
  6398                     PlaySound(sndDuckWater);
  6398                     PlaySound(sndDuckWater);
  6399                 Gear^.Pos:= 1;
  6399                 Gear^.Pos:= 1;
  6451         Gear^.dY:= -(cWindSpeed / 4) * Gear^.Damage;
  6451         Gear^.dY:= -(cWindSpeed / 4) * Gear^.Damage;
  6452         end;
  6452         end;
  6453  
  6453  
  6454     
  6454     
  6455     // Rotate duck and change direction when reaching Sea world edge (Pos 3 or 4)
  6455     // Rotate duck and change direction when reaching Sea world edge (Pos 3 or 4)
  6456     if (WorldEdge = weSea) and (not (Gear^.Pos in [3,4])) then
  6456     if (WorldEdge = weSea) and (Gear^.Pos <> 3) and (Gear^.Pos <> 4) then
  6457         // Swimming TOWARDS left edge
  6457         // Swimming TOWARDS left edge
  6458         if (LeftX >= hwRound(Gear^.X) - Gear^.Karma) and ((cWindSpeed < _0) or (Gear^.Pos in [0, 7])) then
  6458         if (LeftX >= hwRound(Gear^.X) - Gear^.Karma) and ((cWindSpeed < _0) or ((Gear^.Pos = 0) or (Gear^.Pos = 7))) then
  6459             begin
  6459             begin
  6460             // Turn duck when reaching edge the first time
  6460             // Turn duck when reaching edge the first time
  6461             if not (Gear^.Pos in [3,7]) then
  6461             if (Gear^.Pos <> 3) and (Gear^.Pos <> 7) then
  6462                 begin
  6462                 begin
  6463                 if Gear^.Tag = 1 then
  6463                 if Gear^.Tag = 1 then
  6464                     Gear^.Angle:= 90 
  6464                     Gear^.Angle:= 90 
  6465                 else
  6465                 else
  6466                     Gear^.Angle:= 270;
  6466                     Gear^.Angle:= 270;
  6479                 Gear^.Pos:= 7;
  6479                 Gear^.Pos:= 7;
  6480 
  6480 
  6481             end
  6481             end
  6482 
  6482 
  6483         // Swimming TOWARDS right edge (similar to left edge)
  6483         // Swimming TOWARDS right edge (similar to left edge)
  6484         else if (RightX <= hwRound(Gear^.X) + Gear^.Karma) and ((cWindSpeed > _0) or (Gear^.Pos in [0, 8])) then
  6484         else if (RightX <= hwRound(Gear^.X) + Gear^.Karma) and ((cWindSpeed > _0) or ((Gear^.Pos = 0) or (Gear^.Pos = 8))) then
  6485             begin
  6485             begin
  6486             if not (Gear^.Pos in [4,8]) then
  6486             if (Gear^.Pos <> 4) and (Gear^.Pos <> 8) then
  6487                 begin
  6487                 begin
  6488                 if Gear^.Tag = 1 then
  6488                 if Gear^.Tag = 1 then
  6489                     Gear^.Angle:= 270 
  6489                     Gear^.Angle:= 270 
  6490                 else
  6490                 else
  6491                     Gear^.Angle:= 90;
  6491                     Gear^.Angle:= 90;