hedgewars/GSHandlers.inc
changeset 3399 885304636abf
parent 3398 ede254e24545
child 3401 d5d31d16eccc
equal deleted inserted replaced
3398:ede254e24545 3399:885304636abf
    77         if Gear^.Kind = gtHedgehog then
    77         if Gear^.Kind = gtHedgehog then
    78             begin
    78             begin
    79             Gear^.State:= Gear^.State and (not gstHHDriven);
    79             Gear^.State:= Gear^.State and (not gstHHDriven);
    80             AddCaption(Format(GetEventString(eidDrowned), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage);
    80             AddCaption(Format(GetEventString(eidDrowned), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage);
    81             end;
    81             end;
    82         PlaySound(sndSplash)
    82         if hwRound(Gear^.Y) < cWaterLine + 64 + Gear^.Radius then // don't play splash if they are already way past the surface
       
    83             PlaySound(sndSplash)
    83         end;
    84         end;
    84     
    85     
    85     if not cReducedQuality then 
    86     if not cReducedQuality and (hwRound(Gear^.Y) < cWaterLine + 64 + Gear^.Radius) then 
    86         begin
    87         begin
    87         AddVisualGear(hwRound(Gear^.X), cWaterLine, vgtSplash);
    88         AddVisualGear(hwRound(Gear^.X), cWaterLine, vgtSplash);
    88        
    89        
    89         maxDrops := (Gear^.Radius div 2) + hwRound(Gear^.dX * Gear^.Radius * 2) + hwRound(Gear^.dY * Gear^.Radius * 2);
    90         maxDrops := (Gear^.Radius div 2) + hwRound(Gear^.dX * Gear^.Radius * 2) + hwRound(Gear^.dY * Gear^.Radius * 2);
    90         for i:= max(maxDrops div 3, min(32, Random(maxDrops))) downto 0 do 
    91         for i:= max(maxDrops div 3, min(32, Random(maxDrops))) downto 0 do 
  3156     end;
  3157     end;
  3157 
  3158 
  3158 doStepFallingGear(Gear);
  3159 doStepFallingGear(Gear);
  3159 
  3160 
  3160 if (Gear^.State and gstDrowning) <> 0 then
  3161 if (Gear^.State and gstDrowning) <> 0 then
       
  3162     begin
       
  3163     if CurrentHedgehog^.Gear <> nil then
       
  3164         begin
       
  3165         // Drown the hedgehog.  Could also just delete it, but hey, this gets a caption
       
  3166         CurrentHedgehog^.Gear^.Active:= true;
       
  3167         CurrentHedgehog^.Gear^.X:= Gear^.X;
       
  3168         CurrentHedgehog^.Gear^.Y:=int2hwFloat(cWaterLine+cVisibleWater)+_128;
       
  3169         CurrentHedgehog^.Unplaced:= false
       
  3170         end;
  3161     ResumeMusic
  3171     ResumeMusic
       
  3172     end
  3162 else if (Gear^.State and gstCollision) <> 0 then
  3173 else if (Gear^.State and gstCollision) <> 0 then
  3163     begin
  3174     begin
  3164     r0:= GetRandom(21);
  3175     r0:= GetRandom(21);
  3165     r1:= GetRandom(21);
  3176     r1:= GetRandom(21);
  3166     doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 80 + r0, EXPLAutoSound);
  3177     doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 80 + r0, EXPLAutoSound);