]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/sound.h
Merge pull request #35 from arydevy/patch-1
[dragonfireclient.git] / src / sound.h
index 81d918c81aee86ffeb5977104a8532eb143325f3..6f7b0a1af23616983f745e66b156fc1baed01586 100644 (file)
@@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include <set>
 #include <string>
+#include "util/serialize.h"
 #include "irrlichttypes_bloated.h"
 
 struct SimpleSoundSpec
@@ -34,6 +35,26 @@ struct SimpleSoundSpec
 
        bool exists() const { return !name.empty(); }
 
+       // Take cf_version from ContentFeatures::serialize to
+       // keep in sync with item definitions
+       void serialize(std::ostream &os, u8 cf_version) const
+       {
+               os << serializeString16(name);
+               writeF32(os, gain);
+               writeF32(os, pitch);
+               writeF32(os, fade);
+               // if (cf_version < ?)
+               //     return;
+       }
+
+       void deSerialize(std::istream &is, u8 cf_version)
+       {
+               name = deSerializeString16(is);
+               gain = readF32(is);
+               pitch = readF32(is);
+               fade = readF32(is);
+       }
+
        std::string name;
        float gain = 1.0f;
        float fade = 0.0f;