hedgewars/uGearsHedgehog.pas
changeset 10435 4c8fc3aa9432
parent 10354 56bd029245fc
child 10443 42dadeb6e8ae
equal deleted inserted replaced
10433:27d34e33dabc 10435:4c8fc3aa9432
   748 end;
   748 end;
   749 
   749 
   750 procedure HedgehogStep(Gear: PGear);
   750 procedure HedgehogStep(Gear: PGear);
   751 var PrevdX: LongInt;
   751 var PrevdX: LongInt;
   752     CurWeapon: PAmmo;
   752     CurWeapon: PAmmo;
       
   753     portals: PGearArrayS;
   753 begin
   754 begin
   754 CurWeapon:= GetCurAmmoEntry(Gear^.Hedgehog^);
   755 CurWeapon:= GetCurAmmoEntry(Gear^.Hedgehog^);
   755 if ((Gear^.State and (gstAttacking or gstMoving)) = 0) then
   756 if ((Gear^.State and (gstAttacking or gstMoving)) = 0) then
   756     begin
   757     begin
   757     if isCursorVisible then
   758     if isCursorVisible then
   810         Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
   811         Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
   811         PlaySoundV(sndJump3, Gear^.Hedgehog^.Team^.voicepack);
   812         PlaySoundV(sndJump3, Gear^.Hedgehog^.Team^.voicepack);
   812         exit
   813         exit
   813         end;
   814         end;
   814 
   815 
       
   816     if (Gear^.Message and (gmLeft or gmRight) <> 0) and (Gear^.State and gstMoving = 0) then
       
   817         begin
       
   818         // slightly inefficient since it doesn't halt after one portal, maybe could add a param to GearsNear for number desired.
       
   819         portals:= GearsNear(Gear^.X, Gear^.Y, gtPortal, 26);
       
   820         if portals.size = 0 then Gear^.PortalCounter:= 0
       
   821         end;
   815     PrevdX:= hwSign(Gear^.dX);
   822     PrevdX:= hwSign(Gear^.dX);
   816     if (Gear^.Message and gmLeft  )<>0 then
   823     if (Gear^.Message and gmLeft  )<>0 then
   817         Gear^.dX:= -cLittle else
   824         Gear^.dX:= -cLittle else
   818     if (Gear^.Message and gmRight )<>0 then
   825     if (Gear^.Message and gmRight )<>0 then
   819         Gear^.dX:=  cLittle
   826         Gear^.dX:=  cLittle