diff options
author | Perttu Ahola <celeron55@gmail.com> | 2012-03-23 20:23:03 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-03-24 04:24:26 +0200 |
commit | 6c14025b2d416105915440e114de927c26e925ac (patch) | |
tree | 64396513416935f2c0eaf50115a61856bbc0f7f2 /src/nodedef.cpp | |
parent | e53794868eaa33199a1f1011b2d5f517b6f68057 (diff) | |
download | minetest-6c14025b2d416105915440e114de927c26e925ac.tar.gz minetest-6c14025b2d416105915440e114de927c26e925ac.tar.bz2 minetest-6c14025b2d416105915440e114de927c26e925ac.zip |
Add event manager and use it to trigger sounds
Diffstat (limited to 'src/nodedef.cpp')
-rw-r--r-- | src/nodedef.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/nodedef.cpp b/src/nodedef.cpp index f1946830f..2a21136bf 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -79,6 +79,22 @@ void MaterialSpec::deSerialize(std::istream &is) } /* + SimpleSoundSpec serialization +*/ + +static void serializeSimpleSoundSpec(const SimpleSoundSpec &ss, + std::ostream &os) +{ + os<<serializeString(ss.name); + writeF1000(os, ss.gain); +} +static void deSerializeSimpleSoundSpec(SimpleSoundSpec &ss, std::istream &is) +{ + ss.name = deSerializeString(is); + ss.gain = readF1000(is); +} + +/* ContentFeatures */ @@ -139,6 +155,7 @@ void ContentFeatures::reset() selection_box = NodeBox(); legacy_facedir_simple = false; legacy_wallmounted = false; + sound_footstep = SimpleSoundSpec(); } void ContentFeatures::serialize(std::ostream &os) @@ -185,6 +202,7 @@ void ContentFeatures::serialize(std::ostream &os) selection_box.serialize(os); writeU8(os, legacy_facedir_simple); writeU8(os, legacy_wallmounted); + serializeSimpleSoundSpec(sound_footstep, os); } void ContentFeatures::deSerialize(std::istream &is) @@ -236,6 +254,9 @@ void ContentFeatures::deSerialize(std::istream &is) selection_box.deSerialize(is); legacy_facedir_simple = readU8(is); legacy_wallmounted = readU8(is); + try{ + deSerializeSimpleSoundSpec(sound_footstep, is); + }catch(SerializationError &e) {}; } /* |