hedgewars/uGearsHedgehog.pas
changeset 7719 eeae1cb6b6bf
parent 7671 43f38923bc6e
child 7730 2013733f9ca9
equal deleted inserted replaced
7718:97ba379164ec 7719:eeae1cb6b6bf
   739     if (Gear^.Message and gmRight )<>0 then
   739     if (Gear^.Message and gmRight )<>0 then
   740         Gear^.dX:=  cLittle 
   740         Gear^.dX:=  cLittle 
   741         else exit;
   741         else exit;
   742 
   742 
   743     StepSoundTimer:= cHHStepTicks;
   743     StepSoundTimer:= cHHStepTicks;
   744    
   744 
   745     GHStepTicks:= cHHStepTicks;
   745     GHStepTicks:= cHHStepTicks;
   746     if PrevdX <> hwSign(Gear^.dX) then
   746     if PrevdX <> hwSign(Gear^.dX) then
   747         begin
   747         begin
   748         FollowGear:= Gear;
   748         FollowGear:= Gear;
   749         exit
   749         exit
   750         end;
   750         end;
   751     DeleteCI(Gear); // must be after exit!! (see previous line)
   751     DeleteCI(Gear); // must be after exit!! (see previous line)
   752 
   752 
   753     Gear^.Hedgehog^.visStepPos:= (Gear^.Hedgehog^.visStepPos + 1) and 7;
   753     Gear^.Hedgehog^.visStepPos:= (Gear^.Hedgehog^.visStepPos + 1) and 7;
   754 
   754 
   755     if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
   755     if (not cArtillery) and ((Gear^.Message and gmPrecise) = 0) then
   756         begin
   756         MakeHedgehogsStep(Gear);
   757         Gear^.Y:= Gear^.Y - _1;
   757 
   758     if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
   758     SetAllHHToActive;
   759         begin
       
   760         Gear^.Y:= Gear^.Y - _1;
       
   761     if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
       
   762         begin
       
   763         Gear^.Y:= Gear^.Y - _1;
       
   764     if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
       
   765         begin
       
   766         Gear^.Y:= Gear^.Y - _1;
       
   767     if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
       
   768         begin
       
   769         Gear^.Y:= Gear^.Y - _1;
       
   770     if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then if (TestCollisionYwithGear(Gear, -1) = 0) then
       
   771         begin
       
   772         Gear^.Y:= Gear^.Y - _1;
       
   773         if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
       
   774             Gear^.Y:= Gear^.Y + _6
       
   775         end else Gear^.Y:= Gear^.Y + _5 else
       
   776         end else Gear^.Y:= Gear^.Y + _4 else
       
   777         end else Gear^.Y:= Gear^.Y + _3 else
       
   778         end else Gear^.Y:= Gear^.Y + _2 else
       
   779         end else Gear^.Y:= Gear^.Y + _1
       
   780         end;
       
   781 
       
   782     if (not cArtillery) and ((Gear^.Message and gmPrecise) = 0) and (not TestCollisionXwithGear(Gear, hwSign(Gear^.dX))) then
       
   783         Gear^.X:= Gear^.X + SignAs(_1, Gear^.dX);
       
   784 
       
   785    SetAllHHToActive;
       
   786 
       
   787     if TestCollisionYwithGear(Gear, 1) = 0 then
       
   788         begin
       
   789         Gear^.Y:= Gear^.Y + _1;
       
   790     if TestCollisionYwithGear(Gear, 1) = 0 then
       
   791         begin
       
   792         Gear^.Y:= Gear^.Y + _1;
       
   793     if TestCollisionYwithGear(Gear, 1) = 0 then
       
   794         begin
       
   795         Gear^.Y:= Gear^.Y + _1;
       
   796     if TestCollisionYwithGear(Gear, 1) = 0 then
       
   797         begin
       
   798         Gear^.Y:= Gear^.Y + _1;
       
   799     if TestCollisionYwithGear(Gear, 1) = 0 then
       
   800         begin
       
   801         Gear^.Y:= Gear^.Y + _1;
       
   802     if TestCollisionYwithGear(Gear, 1) = 0 then
       
   803         begin
       
   804         Gear^.Y:= Gear^.Y + _1;
       
   805     if TestCollisionYwithGear(Gear, 1) = 0 then
       
   806         begin
       
   807         Gear^.Y:= Gear^.Y - _6;
       
   808         Gear^.dY:= _0;
       
   809         Gear^.State:= Gear^.State or gstMoving;
       
   810         exit
       
   811         end;
       
   812         end
       
   813         end
       
   814         end
       
   815         end
       
   816         end
       
   817         end;
       
   818     AddGearCI(Gear)
   759     AddGearCI(Gear)
   819     end
   760     end
   820 end;
   761 end;
   821 
   762 
   822 procedure HedgehogChAngle(HHGear: PGear);
   763 procedure HedgehogChAngle(HHGear: PGear);