hedgewars/HHHandlers.inc
changeset 70 82d93eeecebe
parent 68 cbb93eb90304
child 73 fe1c62875a19
equal deleted inserted replaced
69:d8a526934b9f 70:82d93eeecebe
   122 
   122 
   123 procedure doStepHedgehog(Gear: PGear); forward;
   123 procedure doStepHedgehog(Gear: PGear); forward;
   124 ////////////////////////////////////////////////////////////////////////////////
   124 ////////////////////////////////////////////////////////////////////////////////
   125 procedure doStepHedgehogDriven(Gear: PGear);
   125 procedure doStepHedgehogDriven(Gear: PGear);
   126 const StepTicks: LongWord = 0;
   126 const StepTicks: LongWord = 0;
   127       cStepTicks = 38;
       
   128 var t: PGear;
   127 var t: PGear;
   129 begin
   128 begin
   130 if isinMultiShoot and (Gear.Damage = 0) then
   129 if isInMultiShoot and (Gear.Damage = 0) then
   131    begin
   130    begin
   132    exit
   131    exit
   133    end;
   132    end;
   134 AllInactive:= false;
   133 AllInactive:= false;
   135 DeleteCI(Gear);
   134 DeleteCI(Gear);
   140    Gear.State:= Gear.State and not gstHHDriven;
   139    Gear.State:= Gear.State and not gstHHDriven;
   141    if Gear.Damage > 0 then
   140    if Gear.Damage > 0 then
   142       Gear.State:= Gear.State and not gstHHJumping;
   141       Gear.State:= Gear.State and not gstHHJumping;
   143    exit
   142    exit
   144    end;
   143    end;
   145 if ((Gear.State and gstFalling) <> 0) or (StepTicks = cStepTicks)
   144 if ((Gear.State and gstFalling) <> 0) or (StepTicks = cHHStepTicks)
   146    or (CurAmmoGear <> nil) then // we're moving
   145    or (CurAmmoGear <> nil) then // we're moving
   147    begin
   146    begin
   148    // check for case with ammo
   147    // check for case with ammo
   149    t:= CheckGearNear(Gear, gtCase, 36, 36);
   148    t:= CheckGearNear(Gear, gtCase, 36, 36);
   150    if t <> nil then
   149    if t <> nil then
   249          end;
   248          end;
   250       end;
   249       end;
   251    if (Gear.Message and gm_Left  )<>0 then Gear.dX:= -1.0 else
   250    if (Gear.Message and gm_Left  )<>0 then Gear.dX:= -1.0 else
   252    if (Gear.Message and gm_Right )<>0 then Gear.dX:=  1.0 else exit;
   251    if (Gear.Message and gm_Right )<>0 then Gear.dX:=  1.0 else exit;
   253    PHedgehog(Gear.Hedgehog).visStepPos:= (PHedgehog(Gear.Hedgehog).visStepPos + 1) and 7;
   252    PHedgehog(Gear.Hedgehog).visStepPos:= (PHedgehog(Gear.Hedgehog).visStepPos + 1) and 7;
   254    StepTicks:= cStepTicks;
   253    StepTicks:= cHHStepTicks;
   255    if TestCollisionXwithGear(Gear, Sign(Gear.dX)) then
   254    if TestCollisionXwithGear(Gear, Sign(Gear.dX)) then
   256       begin
   255       begin
   257       if not (TestCollisionXwithXYShift(Gear, 0, -6, Sign(Gear.dX))
   256       if not (TestCollisionXwithXYShift(Gear, 0, -6, Sign(Gear.dX))
   258          or TestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1;
   257          or TestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1;
   259       if not (TestCollisionXwithXYShift(Gear, 0, -5, Sign(Gear.dX))
   258       if not (TestCollisionXwithXYShift(Gear, 0, -5, Sign(Gear.dX))