hedgewars/HHHandlers.inc
changeset 39 b78e7185ed13
parent 38 c1ec4b15d70e
child 42 72ffe21f027c
equal deleted inserted replaced
38:c1ec4b15d70e 39:b78e7185ed13
    52             (y < t.Y + t.HalfHeight) and (t.Y - t.HalfHeight < yh) then
    52             (y < t.Y + t.HalfHeight) and (t.Y - t.HalfHeight < yh) then
    53             if t.Kind = gtHedgehog then
    53             if t.Kind = gtHedgehog then
    54                begin
    54                begin
    55                ar[cnt]:= t;
    55                ar[cnt]:= t;
    56                inc(cnt)
    56                inc(cnt)
    57                end else b:= true;
    57                end else
       
    58                if not (t.Kind in [gtGrave, gtMine]) then b:= true;
    58       t:= t.NextGear
    59       t:= t.NextGear
    59       end;
    60       end;
    60 ar[cnt]:= Gear;
    61 ar[cnt]:= Gear;
    61 inc(cnt);
    62 inc(cnt);
    62 if b then
    63 if b then
   133                                  end;
   134                                  end;
   134                          amSkip: TurnTimeLeft:= 0;
   135                          amSkip: TurnTimeLeft:= 0;
   135                    amPickHammer: CurAmmoGear:= AddGear(round(Gear.X), round(Gear.Y) + cHHHalfHeight, gtPickHammer, 0);
   136                    amPickHammer: CurAmmoGear:= AddGear(round(Gear.X), round(Gear.Y) + cHHHalfHeight, gtPickHammer, 0);
   136                          amRope: CurAmmoGear:= AddGear(round(Gear.X), round(Gear.Y), gtRope, 0, xx, yy);
   137                          amRope: CurAmmoGear:= AddGear(round(Gear.X), round(Gear.Y), gtRope, 0, xx, yy);
   137                          amMine: AddGear(round(X) + Sign(dX) * 7, round(Y), gtMine, 0, Sign(dX) * 0.01, 0, 3000);
   138                          amMine: AddGear(round(X) + Sign(dX) * 7, round(Y), gtMine, 0, Sign(dX) * 0.01, 0, 3000);
       
   139                      amDynamite: AddGear(round(X) + Sign(dX) * 7, round(Y), gtDynamite, 0, Sign(dX) * 0.01, 0, 5000); 
   138                   end;
   140                   end;
   139         Power:= 0;
   141         Power:= 0;
   140         if CurAmmoGear <> nil then
   142         if CurAmmoGear <> nil then
   141            begin
   143            begin
       
   144            Gear.Message:= Gear.Message or gm_Attack;
   142            CurAmmoGear.Message:= Gear.Message;
   145            CurAmmoGear.Message:= Gear.Message;
   143            exit
   146            exit
   144            end else
   147            end else
   145            begin
   148            begin
   146            Message:= Message and not gm_Attack;
   149            Message:= Message and not gm_Attack;
   174 ////////////////////////////////////////////////////////////////////////////////
   177 ////////////////////////////////////////////////////////////////////////////////
   175 procedure doStepHedgehogDriven(Gear: PGear);
   178 procedure doStepHedgehogDriven(Gear: PGear);
   176 const StepTicks: LongWord = 0;
   179 const StepTicks: LongWord = 0;
   177 var t: PGear;
   180 var t: PGear;
   178 begin
   181 begin
   179 if isinMultiShoot and (Gear.Damage = 0) then exit;
   182 if isinMultiShoot and (Gear.Damage = 0) then
       
   183    begin
       
   184    if Gear.CollIndex = High(Longword) then AddIntersectorsCR(Gear);
       
   185    exit
       
   186    end;
   180 AllInactive:= false;
   187 AllInactive:= false;
   181 if (TurnTimeLeft = 0) or (Gear.Damage > 0) then
   188 if (TurnTimeLeft = 0) or (Gear.Damage > 0) then
   182    begin
   189    begin
   183    if ((Gear.State and (gstMoving or gstFalling)) = 0)
   190    if ((Gear.State and (gstMoving or gstFalling)) = 0)
   184       and (CurAmmoGear = nil) then Gear.dX:= 0.0000001 * Sign(Gear.dX);
   191       and (CurAmmoGear = nil) then Gear.dX:= 0.0000001 * Sign(Gear.dX);
   249       begin
   256       begin
   250       CheckHHDamage(Gear);
   257       CheckHHDamage(Gear);
   251       if ((abs(Gear.dX) + abs(Gear.dY)) < 0.55)
   258       if ((abs(Gear.dX) + abs(Gear.dY)) < 0.55)
   252          and ((Gear.State and gstHHJumping) <> 0) then Gear.dX:= 0.0000001 * Sign(Gear.dX);
   259          and ((Gear.State and gstHHJumping) <> 0) then Gear.dX:= 0.0000001 * Sign(Gear.dX);
   253       Gear.State:= Gear.State and not (gstFalling or gstHHJumping);
   260       Gear.State:= Gear.State and not (gstFalling or gstHHJumping);
   254       StepTicks:= 300;   writelntoconsole(inttostr(gameticks)+'ooo');
   261       StepTicks:= 300; 
   255       Gear.dY:= 0
   262       Gear.dY:= 0
   256       end;
   263       end;
   257    CheckGearDrowning(Gear);
   264    CheckGearDrowning(Gear);
   258    exit
   265    exit
   259    end else if Gear.CollIndex = High(Longword) then AddIntersectorsCR(Gear);
   266    end else if Gear.CollIndex = High(Longword) then AddIntersectorsCR(Gear);