hedgewars/GSHandlers.inc
changeset 5461 3c2d4e46440f
parent 5417 c56a6be662bf
child 5470 b07eb408c5e4
equal deleted inserted replaced
5459:f4f5b710a1ba 5461:3c2d4e46440f
   154                             Gear^.doStep := @doStepDrowningGear;
   154                             Gear^.doStep := @doStepDrowningGear;
   155                             Gear^.State := Gear^.State and (not gstHHDriven);
   155                             Gear^.State := Gear^.State and (not gstHHDriven);
   156                             AddCaption(Format(GetEventString(eidDrowned), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
   156                             AddCaption(Format(GetEventString(eidDrowned), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
   157                             end
   157                             end
   158                         end
   158                         end
   159                     else if Gear^.Kind = gtFlake then
       
   160                         begin
       
   161                         DeleteGear(Gear);
       
   162                         exit
       
   163                         end
       
   164                     else Gear^.doStep := @doStepDrowningGear
   159                     else Gear^.doStep := @doStepDrowningGear
   165                 end;
   160                 end;
   166             if ((not isSubmersible) and (Y < cWaterLine + 64 + Gear^.Radius)) or
   161             if ((not isSubmersible) and (Y < cWaterLine + 64 + Gear^.Radius)) or
   167                (isSubmersible and (Y < cWaterLine + 2 + Gear^.Radius) and ((CurAmmoGear^.Pos = 0) and (CurAmmoGear^.dY < _0_01))) then
   162                (isSubmersible and (Y < cWaterLine + 2 + Gear^.Radius) and ((CurAmmoGear^.Pos = 0) and (CurAmmoGear^.dY < _0_01))) then
   168                 // don't play splash if they are already way past the surface
   163                 // don't play splash if they are already way past the surface
   359        (not isFalling) then
   354        (not isFalling) then
   360         Gear^.State := Gear^.State and not gstMoving
   355         Gear^.State := Gear^.State and not gstMoving
   361     else
   356     else
   362         Gear^.State := Gear^.State or      gstMoving;
   357         Gear^.State := Gear^.State or      gstMoving;
   363 
   358 
   364     if (Gear^.nImpactSounds > 0) then
   359     if (Gear^.nImpactSounds > 0) and (Gear^.ImpactSound <> sndNone) and
   365         if ((Gear^.Damage <> 0) or ((Gear^.State and (gstCollision or gstMoving)) = (gstCollision or
   360        ((Gear^.Damage <> 0) or 
   366            gstMoving))) and
   361           ((Gear^.State and (gstCollision or gstMoving)) = (gstCollision or gstMoving))) and
   367            ((Gear^.dX.QWordValue > _0_1.QWordValue) or (Gear^.dY.QWordValue > _0_1.QWordValue)) then
   362        ((Gear^.dX.QWordValue > _0_1.QWordValue) or 
   368             PlaySound(TSound(ord(Gear^.ImpactSound) + LongInt(GetRandom(Gear^.nImpactSounds))), true
   363           (Gear^.dY.QWordValue > _0_1.QWordValue)) then
   369             );
   364         PlaySound(TSound(ord(Gear^.ImpactSound) + LongInt(GetRandom(Gear^.nImpactSounds))), true);
   370 end;
   365 end;
   371 
   366 
   372 ////////////////////////////////////////////////////////////////////////////////
   367 ////////////////////////////////////////////////////////////////////////////////
   373 procedure doStepBomb(Gear: PGear);
   368 procedure doStepBomb(Gear: PGear);
   374 var 
   369 var 
   593 gun:= (Gear^.State and gstTmpFlag) <> 0;
   588 gun:= (Gear^.State and gstTmpFlag) <> 0;
   594 move:= false;
   589 move:= false;
   595 draw:= false;
   590 draw:= false;
   596 if gun then
   591 if gun then
   597     begin
   592     begin
       
   593     Gear^.State:= Gear^.State and not gstInvisible;
   598     doStepFallingGear(Gear);
   594     doStepFallingGear(Gear);
   599     CheckCollision(Gear);
   595     CheckCollision(Gear);
   600     if ((Gear^.State and gstCollision) <> 0) or ((Gear^.State and gstMoving) = 0) then draw:= true;
   596     if ((Gear^.State and gstCollision) <> 0) or ((Gear^.State and gstMoving) = 0) then draw:= true;
   601     xx:= hwRound(Gear^.X);
   597     xx:= hwRound(Gear^.X);
   602     yy:= hwRound(Gear^.Y);
   598     yy:= hwRound(Gear^.Y);
  4492     
  4488     
  4493     dec(Gear^.Timer);
  4489     dec(Gear^.Timer);
  4494     if Gear^.Timer = 0 then
  4490     if Gear^.Timer = 0 then
  4495         begin
  4491         begin
  4496         dec(Gear^.Health);
  4492         dec(Gear^.Health);
  4497         if (Gear^.Health mod 5) = 0 then
  4493         if (Gear^.Health mod 3) = 0 then
  4498             begin
  4494             begin
  4499             rx := rndSign(getRandom * _0_1);
  4495             rx := rndSign(getRandom * _0_1);
  4500             ry := rndSign(getRandom * _0_1);
  4496             ry := rndSign(getRandom * _0_1);
  4501             speed := (_3 / Gear^.Tag);
  4497             speed := (_3 / Gear^.Tag);
  4502     
  4498