hedgewars/uGearsHandlersMess.pas
changeset 13602 0d920e370a78
parent 13593 083733ec7941
child 13603 369efa5e01fa
equal deleted inserted replaced
13601:d5f62417f014 13602:0d920e370a78
  5619     tmp:= t^.ar[i];
  5619     tmp:= t^.ar[i];
  5620     if (tmp^.State and gstNoDamage) = 0 then
  5620     if (tmp^.State and gstNoDamage) = 0 then
  5621         if (tmp^.Kind = gtHedgehog) or (tmp^.Kind = gtMine) or (tmp^.Kind = gtExplosives) then
  5621         if (tmp^.Kind = gtHedgehog) or (tmp^.Kind = gtMine) or (tmp^.Kind = gtExplosives) then
  5622             begin
  5622             begin
  5623             dmg:= 0;
  5623             dmg:= 0;
  5624             //tmp^.State:= tmp^.State or gstFlatened;
       
  5625             if (tmp^.Kind <> gtHedgehog) or (tmp^.Hedgehog^.Effects[heInvulnerable] = 0) then
  5624             if (tmp^.Kind <> gtHedgehog) or (tmp^.Hedgehog^.Effects[heInvulnerable] = 0) then
  5626                 begin
  5625                 begin
  5627                 // base damage on remaining health
  5626                 // base damage on remaining health
  5628                 dmg:= (tmp^.Health - tmp^.Damage);
  5627                 dmg:= (tmp^.Health - tmp^.Damage);
  5629                 if dmg > 0 then
  5628                 if dmg > 0 then
  5632                     dmg:= dmg div Gear^.Boom;
  5631                     dmg:= dmg div Gear^.Boom;
  5633 
  5632 
  5634                     if dmg > 0 then
  5633                     if dmg > 0 then
  5635                         ApplyDamage(tmp, CurrentHedgehog, dmg, dsUnknown);
  5634                         ApplyDamage(tmp, CurrentHedgehog, dmg, dsUnknown);
  5636                     end;
  5635                     end;
  5637 		tmp^.dY:= _0_03 * Gear^.Boom
  5636                 if (GameFlags and gfSolidLand) <> 0 then
       
  5637                     tmp^.dY:= _0_03 * Gear^.Boom;
  5638                 end;
  5638                 end;
  5639 
  5639 
  5640             if (tmp^.Kind <> gtHedgehog) or (dmg > 0) or (tmp^.Health > tmp^.Damage) then
  5640             if (tmp^.Kind <> gtHedgehog) or (dmg > 0) or (tmp^.Health > tmp^.Damage) then
  5641                 begin
  5641                 begin
  5642                 //DrawTunnel(tmp^.X, tmp^.Y - _1, _0, _0_5, cHHRadius * 6, cHHRadius * 3);
       
  5643                 tmp2:= AddGear(hwRound(tmp^.X), hwRound(tmp^.Y), gtHammerHit, 0, _0, _0, 0);
  5642                 tmp2:= AddGear(hwRound(tmp^.X), hwRound(tmp^.Y), gtHammerHit, 0, _0, _0, 0);
  5644                 tmp2^.LinkedGear:= tmp;
  5643                 tmp2^.LinkedGear:= tmp;
  5645                 SetAllToActive
  5644                 SetAllToActive
  5646                 end;
  5645                 end;
  5647             end;
  5646             end;
  5679             for j := 1 to 11 do doMakeExplosion(i, hwRound(Gear^.Y) + 3*j, 3, Gear^.Hedgehog, EXPLNoDamage or EXPLDoNotTouchAny or EXPLNoGfx);
  5678             for j := 1 to 11 do doMakeExplosion(i, hwRound(Gear^.Y) + 3*j, 3, Gear^.Hedgehog, EXPLNoDamage or EXPLDoNotTouchAny or EXPLNoGfx);
  5680             inc(i, 1)
  5679             inc(i, 1)
  5681             end;
  5680             end;
  5682 
  5681 
  5683         if CheckLandValue(hwRound(Gear^.X + Gear^.dX + SignAs(_6,Gear^.dX)), hwRound(Gear^.Y + _1_9)
  5682         if CheckLandValue(hwRound(Gear^.X + Gear^.dX + SignAs(_6,Gear^.dX)), hwRound(Gear^.Y + _1_9)
  5684            , lfIndestructible) then
  5683            , lfIndestructible) and ((GameFlags and gfSolidLand) = 0) then
  5685             begin
  5684             Gear^.Y := Gear^.Y + _1_9;
  5686             //Gear^.X := Gear^.X + Gear^.dX;
       
  5687             Gear^.Y := Gear^.Y + _1_9
       
  5688             end;
       
  5689         end;
  5685         end;
  5690     if TestCollisionYwithGear(Gear, 1) <> 0 then
  5686     if TestCollisionYwithGear(Gear, 1) <> 0 then
  5691         begin
  5687         begin
  5692         Gear^.dY := _0;
  5688         Gear^.dY := _0;
  5693         SetLittle(HitGear^.dX);
  5689         SetLittle(HitGear^.dX);
  5694         HitGear^.dY := _0;
  5690         HitGear^.dY := _0;
  5695         end
  5691         end
  5696     else
  5692     else
  5697         begin
  5693         begin
  5698         //Gear^.dY := Gear^.dY + cGravity;
       
  5699         //Gear^.Y := Gear^.Y + Gear^.dY;
       
  5700         if CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y)) then
  5694         if CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y)) then
  5701             Gear^.Timer := 1
  5695             Gear^.Timer := 1
  5702         end;
  5696         end;
  5703 
  5697 
  5704     //Gear^.X := Gear^.X + HitGear^.dX;
       
  5705     HitGear^.X := Gear^.X;
  5698     HitGear^.X := Gear^.X;
  5706     HitGear^.Y := Gear^.Y;
  5699     HitGear^.Y := Gear^.Y;
  5707     SetLittle(HitGear^.dY);
  5700     SetLittle(HitGear^.dY);
  5708     HitGear^.Active:= true;
  5701     HitGear^.Active:= true;
  5709 end;
  5702 end;