hedgewars/HHHandlers.inc
changeset 408 6c3da4907d00
parent 394 4c017ae1226a
child 409 4f1841929ccc
equal deleted inserted replaced
407:c7890ba9ed6e 408:6c3da4907d00
    46         if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0 then
    46         if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0 then
    47            begin
    47            begin
    48            StopSound(sndThrowPowerUp);
    48            StopSound(sndThrowPowerUp);
    49            PlaySound(sndThrowRelease, false);
    49            PlaySound(sndThrowRelease, false);
    50            end;
    50            end;
    51 //        xx:= hwSign(dX)*Sin(Angle*pi/cMaxAngle);
       
    52 //        yy:= -Cos(Angle*pi/cMaxAngle);
       
    53         xx:= AngleSin(Angle);
    51         xx:= AngleSin(Angle);
    54         xx.isNegative:= dX.isNegative;
    52         xx.isNegative:= dX.isNegative;
    55         yy:= -AngleCos(Angle);
    53         yy:= -AngleCos(Angle);
    56              case Ammo^[CurSlot, CurAmmo].AmmoType of
    54              case Ammo^[CurSlot, CurAmmo].AmmoType of
    57                       amGrenade: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtAmmo_Bomb,    0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, Ammo^[CurSlot, CurAmmo].Timer);
    55                       amGrenade: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtAmmo_Bomb,    0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, Ammo^[CurSlot, CurAmmo].Timer);
    69                        amDEagle: AddGear(hwRound(X), hwRound(Y), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0);
    67                        amDEagle: AddGear(hwRound(X), hwRound(Y), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0);
    70                      amDynamite: AddGear(hwRound(X) + hwSign(dX) * 7, hwRound(Y), gtDynamite, 0, hwSign(dX) * _0_03, 0, 5000);
    68                      amDynamite: AddGear(hwRound(X) + hwSign(dX) * 7, hwRound(Y), gtDynamite, 0, hwSign(dX) * _0_03, 0, 5000);
    71                   amBaseballBat: AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtShover, 0, xx * _0_5, yy * _0_5, 0)^.Radius:= 20;
    69                   amBaseballBat: AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtShover, 0, xx * _0_5, yy * _0_5, 0)^.Radius:= 20;
    72                     amFirePunch: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtFirePunch, 0, 0, 0, 0);
    70                     amFirePunch: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtFirePunch, 0, 0, 0, 0);
    73                     amParachute: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtParachute, 0, 0, 0, 0);
    71                     amParachute: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtParachute, 0, 0, 0, 0);
    74                     amAirAttack: AddGear(0, 0, gtAirAttack, 0, 0, 0, 0);
    72                     amAirAttack: AddGear(Ammo^[CurSlot, CurAmmo].Pos, 0, gtAirAttack, 0, 0, 0, 0);
    75                    amMineStrike: AddGear(0, 0, gtAirAttack, 1, 0, 0, 0);
    73                    amMineStrike: AddGear(Ammo^[CurSlot, CurAmmo].Pos, 0, gtAirAttack, 1, 0, 0, 0);
    76                     amBlowTorch: CurAmmoGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtBlowTorch, 0, hwSign(Gear^.dX) * _0_5, 0, 0);
    74                     amBlowTorch: CurAmmoGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtBlowTorch, 0, hwSign(Gear^.dX) * _0_5, 0, 0);
    77                   end;
    75                   end;
    78         Power:= 0;
    76         Power:= 0;
    79         if CurAmmoGear <> nil then
    77         if CurAmmoGear <> nil then
    80            begin
    78            begin
   135 procedure HedgehogStep(Gear: PGear);
   133 procedure HedgehogStep(Gear: PGear);
   136 var PrevdX: LongInt;
   134 var PrevdX: LongInt;
   137 begin
   135 begin
   138 if ((Gear^.State and (gstAttacking or gstMoving or gstFalling)) = 0) then
   136 if ((Gear^.State and (gstAttacking or gstMoving or gstFalling)) = 0) then
   139    begin
   137    begin
       
   138    if isCursorVisible then
       
   139       with PHedgehog(Gear^.Hedgehog)^ do
       
   140         with Ammo^[CurSlot, CurAmmo] do
       
   141           begin
       
   142           if (Gear^.Message and gm_Left  )<>0 then
       
   143              Pos:= (Pos + Ammoz[AmmoType].PosCount - 1) mod Ammoz[AmmoType].PosCount
       
   144           else
       
   145           if (Gear^.Message and gm_Right )<>0 then
       
   146              Pos:= (Pos + 1) mod Ammoz[AmmoType].PosCount
       
   147           else exit;
       
   148           StepTicks:= 350;
       
   149           exit
       
   150           end;
   140    if ((Gear^.Message and gm_LJump ) <> 0) then
   151    if ((Gear^.Message and gm_LJump ) <> 0) then
   141       begin
   152       begin
   142       Gear^.Message:= 0;
   153       Gear^.Message:= 0;
   143       if not TestCollisionYwithGear(Gear, -1) then
   154       if not TestCollisionYwithGear(Gear, -1) then
   144          if not TestCollisionXwithXYShift(Gear, 0, -2, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - 2 else
   155          if not TestCollisionXwithXYShift(Gear, 0, -2, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - 2 else