hedgewars/uGears.pas
changeset 2993 d83edb74e92d
parent 2991 142ea64ce8a2
child 2994 7ae3067546f2
equal deleted inserted replaced
2992:5ef18e26f183 2993:d83edb74e92d
   587 procedure ProcessGears;
   587 procedure ProcessGears;
   588 const delay: LongWord = 0;
   588 const delay: LongWord = 0;
   589     step: (stDelay, stChDmg, stSweep, stTurnReact,
   589     step: (stDelay, stChDmg, stSweep, stTurnReact,
   590             stAfterDelay, stChWin, stWater, stChWin2, stHealth,
   590             stAfterDelay, stChWin, stWater, stChWin2, stHealth,
   591             stSpawn, stNTurn) = stDelay;
   591             stSpawn, stNTurn) = stDelay;
   592 var StoppedSteps: boolean;
       
   593 var Gear, t: PGear;
   592 var Gear, t: PGear;
   594 begin
   593 begin
   595 PrvInactive:= AllInactive;
   594 PrvInactive:= AllInactive;
   596 AllInactive:= true;
   595 AllInactive:= true;
   597 StoppedSteps:= false;
       
   598 
   596 
   599 if (StepSoundTimer > 0) and (StepSoundChannel < 0) then
   597 if (StepSoundTimer > 0) and (StepSoundChannel < 0) then
   600     StepSoundChannel:= LoopSound(sndSteps)
   598     StepSoundChannel:= LoopSound(sndSteps)
   601 else if (StepSoundTimer = 0) and (StepSoundChannel > -1) then
   599 else if (StepSoundTimer = 0) and (StepSoundChannel > -1) then
   602     begin
   600     begin
   603     StopSound(StepSoundChannel);
   601     StopSound(StepSoundChannel);
   604     StepSoundChannel:= -1;
   602     StepSoundChannel:= -1
   605     StoppedSteps:= true
       
   606     end;
   603     end;
   607 
   604 
   608 if StepSoundTimer > 0 then
   605 if StepSoundTimer > 0 then
   609     dec(StepSoundTimer, 1);
   606     dec(StepSoundTimer, 1);
   610 
   607 
   611 t:= GearsList;
   608 t:= GearsList;
   612 while t <> nil do
   609 while t <> nil do
   613     begin
   610     begin
   614     Gear:= t;
   611     Gear:= t;
   615     t:= Gear^.NextGear;
   612     t:= Gear^.NextGear;
   616     if (Gear = CurrentHedgehog^.Gear) and (StoppedSteps) then Gear^.Timer:= 10;
       
   617     if Gear^.Active then
   613     if Gear^.Active then
   618         begin
   614         begin
   619         if Gear^.RenderTimer and (Gear^.Timer > 500) and ((Gear^.Timer mod 1000) = 0) then
   615         if Gear^.RenderTimer and (Gear^.Timer > 500) and ((Gear^.Timer mod 1000) = 0) then
   620             begin
   616             begin
   621             if Gear^.Tex <> nil then FreeTexture(Gear^.Tex);
   617             if Gear^.Tex <> nil then FreeTexture(Gear^.Tex);