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 |
592 var StoppedSteps: boolean; |
593 var Gear, t: PGear; |
593 var Gear, t: PGear; |
594 begin |
594 begin |
595 PrvInactive:= AllInactive; |
595 PrvInactive:= AllInactive; |
596 AllInactive:= true; |
596 AllInactive:= true; |
|
597 StoppedSteps:= false; |
597 |
598 |
598 if (StepSoundTimer > 0) and (StepSoundChannel < 0) then |
599 if (StepSoundTimer > 0) and (StepSoundChannel < 0) then |
599 StepSoundChannel:= LoopSound(sndSteps) |
600 StepSoundChannel:= LoopSound(sndSteps) |
600 else if (StepSoundTimer = 0) and (StepSoundChannel > -1) then |
601 else if (StepSoundTimer = 0) and (StepSoundChannel > -1) then |
601 begin |
602 begin |
602 StopSound(StepSoundChannel); |
603 StopSound(StepSoundChannel); |
603 StepSoundChannel:= -1; |
604 StepSoundChannel:= -1; |
|
605 StoppedSteps:= true |
604 end; |
606 end; |
605 |
607 |
606 if StepSoundTimer > 0 then |
608 if StepSoundTimer > 0 then |
607 dec(StepSoundTimer, 1); |
609 dec(StepSoundTimer, 1); |
608 |
610 |
609 t:= GearsList; |
611 t:= GearsList; |
610 while t <> nil do |
612 while t <> nil do |
611 begin |
613 begin |
612 Gear:= t; |
614 Gear:= t; |
613 t:= Gear^.NextGear; |
615 t:= Gear^.NextGear; |
|
616 if (Gear = CurrentHedgehog^.Gear) and (StoppedSteps) then Gear^.Timer:= 10; |
614 if Gear^.Active then |
617 if Gear^.Active then |
615 begin |
618 begin |
616 if Gear^.RenderTimer and (Gear^.Timer > 500) and ((Gear^.Timer mod 1000) = 0) then |
619 if Gear^.RenderTimer and (Gear^.Timer > 500) and ((Gear^.Timer mod 1000) = 0) then |
617 begin |
620 begin |
618 if Gear^.Tex <> nil then FreeTexture(Gear^.Tex); |
621 if Gear^.Tex <> nil then FreeTexture(Gear^.Tex); |
1179 0.0); |
1182 0.0); |
1180 defaultPos:= false |
1183 defaultPos:= false |
1181 end |
1184 end |
1182 else |
1185 else |
1183 if ((Gear^.State and gstAttacked) = 0) then |
1186 if ((Gear^.State and gstAttacked) = 0) then |
1184 begin |
1187 begin |
|
1188 if Gear^.Timer > 0 then |
|
1189 begin |
|
1190 // There must be a tidier way to do this. Anyone? |
|
1191 if aangle <= 90 then aangle:= aangle+360; |
|
1192 if Gear^.dX > _0 then aangle:= aangle-((aangle-240)*Gear^.Timer/10) |
|
1193 else aangle:= aangle+((240-aangle)*Gear^.Timer/10); |
|
1194 dec(Gear^.Timer) |
|
1195 end; |
1185 amt:= CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].AmmoType; |
1196 amt:= CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].AmmoType; |
1186 case amt of |
1197 case amt of |
1187 //, sprHandCake, sprHandConstruction, sprHandGrenade, sprHandMelon, sprHandMortar, sprHandSkip, sprHandCluster, sprHandDynamite, sprHandHellish, sprHandMine, sprHandSeduction, sprHandVamp |
|
1188 amBazooka: DrawRotated(sprHandBazooka, hx, hy, hwSign(Gear^.dX), aangle); |
1198 amBazooka: DrawRotated(sprHandBazooka, hx, hy, hwSign(Gear^.dX), aangle); |
1189 amMortar: DrawRotated(sprHandMortar, hx, hy, hwSign(Gear^.dX), aangle); |
1199 amMortar: DrawRotated(sprHandMortar, hx, hy, hwSign(Gear^.dX), aangle); |
1190 amMolotov: DrawRotated(sprHandMolotov, hx, hy, hwSign(Gear^.dX), aangle); |
1200 amMolotov: DrawRotated(sprHandMolotov, hx, hy, hwSign(Gear^.dX), aangle); |
1191 amBallgun: DrawRotated(sprHandBallgun, hx, hy, hwSign(Gear^.dX), aangle); |
1201 amBallgun: DrawRotated(sprHandBallgun, hx, hy, hwSign(Gear^.dX), aangle); |
1192 amDrill: DrawRotated(sprHandDrill, hx, hy, hwSign(Gear^.dX), aangle); |
1202 amDrill: DrawRotated(sprHandDrill, hx, hy, hwSign(Gear^.dX), aangle); |