--- a/hedgewars/HHHandlers.inc Fri Mar 05 02:57:34 2010 +0000
+++ b/hedgewars/HHHandlers.inc Fri Mar 05 15:54:23 2010 +0000
@@ -408,6 +408,11 @@
if (Gear^.Message and gm_Left )<>0 then Gear^.dX:= -cLittle else
if (Gear^.Message and gm_Right )<>0 then Gear^.dX:= cLittle else exit;
+ if (Gear^.Message and (gm_Left or gm_Right)) <> 0 then
+ begin
+ StepSoundTimer:= cHHStepTicks;
+ end;
+
StepTicks:= cHHStepTicks;
if PrevdX <> hwSign(Gear^.dX) then
begin
--- a/hedgewars/uGears.pas Fri Mar 05 02:57:34 2010 +0000
+++ b/hedgewars/uGears.pas Fri Mar 05 15:54:23 2010 +0000
@@ -71,6 +71,8 @@
TrainingTargetGear: PGear;
skipFlag: boolean;
PlacingHogs: boolean; // a convenience flag to indicate placement of hogs is still in progress
+ StepSoundTimer: LongInt;
+ StepSoundChannel: LongInt;
procedure init_uGears;
procedure free_uGears;
@@ -582,6 +584,21 @@
PrvInactive:= AllInactive;
AllInactive:= true;
+if (StepSoundTimer > 0) and (StepSoundChannel < 0) then
+ begin
+ WriteLnToConsole('playsteps ...');
+ StepSoundChannel:= LoopSound(sndSteps)
+ end
+else if (StepSoundTimer = 0) and (StepSoundChannel > -1) then
+ begin
+ WriteLnToConsole('stopsteps ...');
+ StopSound(StepSoundChannel);
+ StepSoundChannel:= -1;
+ end;
+
+if StepSoundTimer > 0 then
+ dec(StepSoundTimer, 1);
+
t:= GearsList;
while t <> nil do
begin
@@ -856,7 +873,6 @@
lx, ly, dx, dy, ax, ay, aAngle, dAngle, hAngle: real; // laser, change
defaultPos, HatVisible: boolean;
VertexBuffer: array [0..1] of TVertex2f;
- stepSounds: boolean;
begin
if PHedgehog(Gear^.Hedgehog)^.Unplaced then exit;
@@ -870,7 +886,6 @@
defaultPos:= true;
HatVisible:= false;
-stepSounds:= false;
sx:= hwRound(Gear^.X) + 1 + WorldDx;
sy:= hwRound(Gear^.Y) - 3 + WorldDy;
@@ -1046,7 +1061,6 @@
hwSign(Gear^.dX),
32,
32);
- stepSounds:= true;
defaultPos:= false
end;
gtShover: DrawRotated(sprHandBaseball, hx, hy, hwSign(Gear^.dX), aangle + 180);
@@ -1143,7 +1157,6 @@
0,
PHedgehog(Gear^.Hedgehog)^.visStepPos div 2,
0);
- stepSounds:= true;
defaultPos:= false;
HatVisible:= true
end
@@ -1381,14 +1394,6 @@
DrawSprite(sprVampiric, sx - 24, sy - 24, 0);
glColor4f(1, 1, 1, 1);
end;
-
- if stepSounds and (Gear^.SoundChannel < 0) then
- Gear^.SoundChannel:= LoopSound(sndSteps)
- else if not stepSounds and (Gear^.SoundChannel > -1) then
- begin
- StopSound(Gear^.SoundChannel);
- Gear^.SoundChannel:= -1;
- end;
end;
procedure DrawRopeLinesRQ(Gear: PGear);