hedgewars/GSHandlers.inc
changeset 3359 d17b9f6adae5
parent 3358 546e75f839ce
child 3378 4f2185ed8ca8
equal deleted inserted replaced
3358:546e75f839ce 3359:d17b9f6adae5
    63         (hwAbs(Gear^.dX) > skipAngle * hwAbs(Gear^.dY)) then
    63         (hwAbs(Gear^.dX) > skipAngle * hwAbs(Gear^.dY)) then
    64        begin
    64        begin
    65        Gear^.dY.isNegative:= true;
    65        Gear^.dY.isNegative:= true;
    66        Gear^.dY:= Gear^.dY * skipDecay;
    66        Gear^.dY:= Gear^.dY * skipDecay;
    67        Gear^.dX:= Gear^.dX * skipDecay;
    67        Gear^.dX:= Gear^.dX * skipDecay;
    68        CheckGearDrowning:= false
    68        CheckGearDrowning:= false;
       
    69        PlaySound(sndSkip)
    69        end
    70        end
    70     else
    71     else
    71         begin
    72         begin
    72         CheckGearDrowning:= true;
    73         CheckGearDrowning:= true;
    73         Gear^.State:= gstDrowning;
    74         Gear^.State:= gstDrowning;
    76           Gear^.doStep:= @doStepDrowningGear;
    77           Gear^.doStep:= @doStepDrowningGear;
    77         if Gear^.Kind = gtHedgehog then
    78         if Gear^.Kind = gtHedgehog then
    78             begin
    79             begin
    79             Gear^.State:= Gear^.State and (not gstHHDriven);
    80             Gear^.State:= Gear^.State and (not gstHHDriven);
    80             AddCaption(Format(GetEventString(eidDrowned), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage);
    81             AddCaption(Format(GetEventString(eidDrowned), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage);
    81             end
    82             end;
    82         end;
    83         PlaySound(sndSplash)
    83     PlaySound(sndSplash);
    84         end;
    84     
    85     
    85     if not cReducedQuality then 
    86     if not cReducedQuality then 
    86         begin
    87         begin
    87         AddVisualGear(hwRound(Gear^.X), cWaterLine, vgtSplash);
    88         AddVisualGear(hwRound(Gear^.X), cWaterLine, vgtSplash);
    88        
    89        
    96                 particle^.dY := particle^.dY - (Gear^.dY / 5)
    97                 particle^.dY := particle^.dY - (Gear^.dY / 5)
    97                 end
    98                 end
    98             end
    99             end
    99         end;
   100         end;
   100     end
   101     end
   101     else
   102 else
   102     CheckGearDrowning:= false
   103     CheckGearDrowning:= false
   103 end;
   104 end;
   104 
   105 
   105 procedure CheckCollision(Gear: PGear);
   106 procedure CheckCollision(Gear: PGear);
   106 begin
   107 begin
   176 Gear^.State:= Gear^.State and not gstCollision;
   177 Gear^.State:= Gear^.State and not gstCollision;
   177 collV:= 0; 
   178 collV:= 0; 
   178 collH:= 0;
   179 collH:= 0;
   179 tdX:= Gear^.dX;
   180 tdX:= Gear^.dX;
   180 tdY:= Gear^.dY;
   181 tdY:= Gear^.dY;
       
   182 
       
   183 // might need some testing/adjustments - just to avoid projectiles to fly forever (accelerated by wind/skips)
       
   184 if (hwRound(Gear^.X) < LAND_WIDTH div -2) or (hwRound(Gear^.X) > LAND_WIDTH * 3 div 2) then
       
   185     begin
       
   186     Gear^.State:= Gear^.State or gstCollision;
       
   187     exit
       
   188     end;
   181 
   189 
   182 if Gear^.dY.isNegative then
   190 if Gear^.dY.isNegative then
   183     begin
   191     begin
   184     isFalling:= true;
   192     isFalling:= true;
   185     if TestCollisionYwithGear(Gear, -1) then
   193     if TestCollisionYwithGear(Gear, -1) then