hedgewars/uGearsHandlersMess.pas
changeset 15139 0e0b5fc1674e
parent 15056 a9873c81b5e6
child 15150 d47122a0e4b4
equal deleted inserted replaced
15138:73d8cc72239e 15139:0e0b5fc1674e
  3367         ApplyAmmoChanges(HHGear^.Hedgehog^);
  3367         ApplyAmmoChanges(HHGear^.Hedgehog^);
  3368         DeleteGear(Gear);
  3368         DeleteGear(Gear);
  3369         exit
  3369         exit
  3370         end;
  3370         end;
  3371 
  3371 
       
  3372     HHGear := CurrentHedgehog^.Gear;
  3372     if (Gear^.Message and gmSwitch) <> 0 then
  3373     if (Gear^.Message and gmSwitch) <> 0 then
  3373         begin
  3374         begin
  3374         HHGear := CurrentHedgehog^.Gear;
       
  3375         oldUid:= HHGear^.uid;
  3375         oldUid:= HHGear^.uid;
  3376         HHGear^.Message := HHGear^.Message and (not gmSwitch);
  3376         HHGear^.Message := HHGear^.Message and (not gmSwitch);
  3377         Gear^.Message := Gear^.Message and (not gmSwitch);
  3377         Gear^.Message := Gear^.Message and (not gmSwitch);
  3378 
  3378 
  3379         // switching in reverse direction
  3379         // switching in reverse direction
  3384             end
  3384             end
  3385         else
  3385         else
  3386             switchDir:=  1;
  3386             switchDir:=  1;
  3387 
  3387 
  3388         State := HHGear^.State;
  3388         State := HHGear^.State;
  3389         HHGear^.State := 0;
  3389         if (HHGear^.State and gstMoving) = 0 then
       
  3390             HHGear^.Active := false;
       
  3391         HHGear^.State := HHGear^.State and gstMoving;
  3390         HHGear^.Z := cHHZ;
  3392         HHGear^.Z := cHHZ;
  3391         HHGear^.Active := false;
       
  3392         HHGear^.Message:= HHGear^.Message or gmRemoveFromList or gmAddToList;
  3393         HHGear^.Message:= HHGear^.Message or gmRemoveFromList or gmAddToList;
  3393 
  3394 
  3394         PlaySound(sndSwitchHog);
  3395         PlaySound(sndSwitchHog);
  3395 
  3396 
  3396         repeat
  3397         repeat
  3412         HHGear^.Z := cCurrHHZ;
  3413         HHGear^.Z := cCurrHHZ;
  3413         // restore precise key
  3414         // restore precise key
  3414         if (switchDir <> 1) then
  3415         if (switchDir <> 1) then
  3415             HHGear^.Message:= HHGear^.Message or gmPrecise;
  3416             HHGear^.Message:= HHGear^.Message or gmPrecise;
  3416         HHGear^.Message:= HHGear^.Message or gmRemoveFromList or gmAddToList;
  3417         HHGear^.Message:= HHGear^.Message or gmRemoveFromList or gmAddToList;
  3417         Gear^.X := HHGear^.X;
  3418         end;
  3418         Gear^.Y := HHGear^.Y
  3419     doStepHedgehogMoving(HHGear);
  3419         end;
  3420     Gear^.X := HHGear^.X;
       
  3421     Gear^.Y := HHGear^.Y
  3420 end;
  3422 end;
  3421 
  3423 
  3422 procedure doStepSwitcher(Gear: PGear);
  3424 procedure doStepSwitcher(Gear: PGear);
  3423 var
  3425 var
  3424     HHGear: PGear;
  3426     HHGear: PGear;