Engine:
authorsmxx
Tue, 23 Feb 2010 15:41:37 +0000
changeset 2852 c6dff591f564
parent 2851 a9a5ce1d9f23
child 2853 953a6d71396f
Engine: * Added step sounds for hedgehogs (needs some tweaking after jumps)
hedgewars/uConsts.pas
hedgewars/uGears.pas
share/hedgewars/Data/Sounds/steps.ogg
--- a/hedgewars/uConsts.pas	Tue Feb 23 03:57:27 2010 +0000
+++ b/hedgewars/uConsts.pas	Tue Feb 23 15:41:37 2010 +0000
@@ -106,7 +106,7 @@
 			sndVaporize, sndWarp, sndSuddenDeath, sndMortar, sndShutter,
 			sndHomerun, sndMolotov, sndWalking, sndCover, sndUhOh,
 			sndOops, sndNooo, sndHello, sndRopeShot, sndRopeAttach,
-			sndRopeRelease, sndSwitchHog, sndVictory, sndSniperReload);
+			sndRopeRelease, sndSwitchHog, sndVictory, sndSniperReload, sndSteps);
 
 	TAmmoType  = (amNothing, amGrenade, amClusterBomb, amBazooka, amUFO, amShotgun, amPickHammer,
 			amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip,
@@ -758,7 +758,8 @@
 			(FileName:                         ''; Path: ptSounds),// sndRopeRelease
 			(FileName:            'switchhog.ogg'; Path: ptSounds),// sndSwitchHog
 			(FileName:              'victory.ogg'; Path: ptVoices),// sndVictory
-			(FileName:         'sniperreload.ogg'; Path: ptSounds) // sndSniperReload
+			(FileName:         'sniperreload.ogg'; Path: ptSounds),// sndSniperReload
+			(FileName:                'steps.ogg'; Path: ptSounds) // sndSteps
 			);
 
 	Ammoz: array [TAmmoType] of record
--- a/hedgewars/uGears.pas	Tue Feb 23 03:57:27 2010 +0000
+++ b/hedgewars/uGears.pas	Tue Feb 23 15:41:37 2010 +0000
@@ -847,8 +847,10 @@
 	hx, hy, cx, cy, tx, ty, sx, sy, m: LongInt;  // hedgehog, crosshair, temp, sprite, direction
 	lx, ly, dx, dy, ax, ay, aAngle, dAngle, hAngle: real;  // laser, change
 	defaultPos, HatVisible: boolean;
-    VertexBuffer: array [0..1] of TVertex2f;
+	VertexBuffer: array [0..1] of TVertex2f;
+	stepSounds: boolean;
 begin
+
 if PHedgehog(Gear^.Hedgehog)^.Unplaced then exit;
 m:= 1;
 if ((Gear^.State and gstHHHJump) <> 0) and not cArtillery then m:= -1;
@@ -860,6 +862,7 @@
 
 defaultPos:= true;
 HatVisible:= false;
+stepSounds:= false;
 
 sx:= hwRound(Gear^.X) + 1 + WorldDx;
 sy:= hwRound(Gear^.Y) - 3 + WorldDy;
@@ -1025,6 +1028,7 @@
 						3,
 						PHedgehog(Gear^.Hedgehog)^.visStepPos div 2,
 						0);
+				stepSounds:= true;
 				defaultPos:= false
 				end;
 			gtShover: DrawRotated(sprHandBaseball, hx, hy, hwSign(Gear^.dX), aangle + 180);
@@ -1121,6 +1125,7 @@
 			0,
 			PHedgehog(Gear^.Hedgehog)^.visStepPos div 2,
 			0);
+		stepSounds:= true;
 		defaultPos:= false;
 		HatVisible:= true
 		end
@@ -1363,6 +1368,14 @@
     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);
Binary file share/hedgewars/Data/Sounds/steps.ogg has changed