# HG changeset patch
# User Clonkonaut
# Date 1318047395 -3600
# Node ID 394fafffe35de4dfd8e2b5630e5a76b5ff336047
# Parent  9f17343bd2fd8587b591280f240c75df6e6caa6e
imported patch Footsteps.diff

diff --git a/planet/Objects.ocd/Clonk.ocd/Script.c b/planet/Objects.ocd/Clonk.ocd/Script.c
--- a/planet/Objects.ocd/Clonk.ocd/Script.c
+++ b/planet/Objects.ocd/Clonk.ocd/Script.c
@@ -793,6 +793,19 @@
 	return Clonk_WalkRun;
 }
 
+func Footstep()
+{
+	if (GetMaterialVal("DigFree", "Material", GetMaterial(0,10)) == 0)
+		Sound("StepHard*.ogg");
+	else
+	{
+		var dir = GetXDir() / Abs(GetXDir());
+		var clr = GetAverageTextureColor(GetTexture(0,10));
+		CreateParticle("Dust", dir*-4, 9, dir*-2, -1, 15+Random(5), DoRGBaValue(clr,-200,0));
+		Sound("StepSoft*.ogg");
+	}
+}
+
 func GetWalkAnimationPosition(string anim, int pos)
 {
 	var dir = -1;
@@ -873,6 +886,7 @@
 	// The clonk has to stand, not making a pause animation yet and not doing other actions with the hands (e.g. loading the bow)
 	else if(anim == Clonk_WalkStand && !GetHandAction())
 	{
+		if (effect.footstop_time) effect.footstep_time = 0;
 		if(!effect.idle_animation_time)
 		{
 			effect.idle_time++;
@@ -894,6 +908,16 @@
 			effect.animation_name = nil;
 			effect.idle_animation_time = 0;
 		}
+		if (anim == Clonk_WalkRun)
+		{
+			effect.footstep_time++;
+			if (effect.footstep_time == 12)
+			{
+				Footstep();
+				effect.footstep_time = 0;
+			}
+		}
+		else if(effect.footstep_time) effect.footstep_time = 0;
 	}
 }
 
diff --git a/planet/Objects.ocd/Clonk.ocd/StepHard1.ogg b/planet/Objects.ocd/Clonk.ocd/StepHard1.ogg
new file mode 100644
index 0000000000000000000000000000000000000000..a8aa8fd5b4d18a68e3e7850025ab789187246556
GIT binary patch
diff --git a/planet/Objects.ocd/Clonk.ocd/StepHard2.ogg b/planet/Objects.ocd/Clonk.ocd/StepHard2.ogg
new file mode 100644
index 0000000000000000000000000000000000000000..16586b140944ec3d91bb511033a066164537f862
GIT binary patch
diff --git a/planet/Objects.ocd/Clonk.ocd/StepHard3.ogg b/planet/Objects.ocd/Clonk.ocd/StepHard3.ogg
new file mode 100644
index 0000000000000000000000000000000000000000..0b3d2dc9d7cc0b9a14533a26908d2d35cd3cc5e5
GIT binary patch
diff --git a/planet/Objects.ocd/Clonk.ocd/StepHard4.ogg b/planet/Objects.ocd/Clonk.ocd/StepHard4.ogg
new file mode 100644
index 0000000000000000000000000000000000000000..4695e87f6615ae1f24232e14c1098e1814b2efd7
GIT binary patch
diff --git a/planet/Objects.ocd/Clonk.ocd/StepHard5.ogg b/planet/Objects.ocd/Clonk.ocd/StepHard5.ogg
new file mode 100644
index 0000000000000000000000000000000000000000..caa11b0f9b2ff468c8f4401f608384872a9d4d4a
GIT binary patch
diff --git a/planet/Objects.ocd/Clonk.ocd/StepSoft1.ogg b/planet/Objects.ocd/Clonk.ocd/StepSoft1.ogg
new file mode 100644
index 0000000000000000000000000000000000000000..54a401416623aadc4b1c720a814fbc8047c6f4b1
GIT binary patch
diff --git a/planet/Objects.ocd/Clonk.ocd/StepSoft2.ogg b/planet/Objects.ocd/Clonk.ocd/StepSoft2.ogg
new file mode 100644
index 0000000000000000000000000000000000000000..26f0202641e85f3276d601421c96fbd1898bdefe
GIT binary patch
diff --git a/planet/Objects.ocd/Clonk.ocd/StepSoft3.ogg b/planet/Objects.ocd/Clonk.ocd/StepSoft3.ogg
new file mode 100644
index 0000000000000000000000000000000000000000..b55a1be91e862465690fff290264a5078f4ab266
GIT binary patch
diff --git a/planet/Objects.ocd/Clonk.ocd/StepSoft4.ogg b/planet/Objects.ocd/Clonk.ocd/StepSoft4.ogg
new file mode 100644
index 0000000000000000000000000000000000000000..4ae1a02dd378ff3a78444cec6cd3604f2f558e4e
GIT binary patch
diff --git a/planet/Objects.ocd/Clonk.ocd/StepSoft5.ogg b/planet/Objects.ocd/Clonk.ocd/StepSoft5.ogg
new file mode 100644
index 0000000000000000000000000000000000000000..e9b9c4b60c20de99229d7edc2b21f04c7aa20594
GIT binary patch
diff --git a/planet/Objects.ocd/Clonk.ocd/StepSoft6.ogg b/planet/Objects.ocd/Clonk.ocd/StepSoft6.ogg
new file mode 100644
index 0000000000000000000000000000000000000000..d44b8079b4bbbc98e93d986ebb6d9d3068052a6a
GIT binary patch
diff --git a/planet/Objects.ocd/Clonk.ocd/authors.txt b/planet/Objects.ocd/Clonk.ocd/authors.txt
--- a/planet/Objects.ocd/Clonk.ocd/authors.txt
+++ b/planet/Objects.ocd/Clonk.ocd/authors.txt
@@ -1,1 +1,2 @@
-All sounds by Pat (http://www.freesound.org/people/pwausc1/sounds/118259/), License: CC Attribution 3.0
\ No newline at end of file
+Roll.ogg, Rustle1.ogg, Rustle2.ogg, Rustle3.ogg, Rustle4.ogg, RustleLand.ogg by Pat (http://www.freesound.org/people/pwausc1/sounds/118259/), License: CC Attribution 3.0
+StepSoft1.ogg, StepSoft2.ogg, StepSoft3.ogg, StepSoft4.ogg, StepSoft5.ogg, StepSoft6.ogg, StepHard1.ogg, StepHard2.ogg, StepHard3.ogg, StepHard4.ogg, StepHard5.ogg by bevangoldswain (http://www.freesound.org/people/bevangoldswain/sounds/54778/ and http://www.freesound.org/people/bevangoldswain/sounds/54779/), License: CC Sampling Plus 1.0
\ No newline at end of file
