]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/object_properties.cpp
Perform mesh animation only once per frame.
[dragonfireclient.git] / src / object_properties.cpp
index 7fad25cceda3c84a8aff4abc01395e2508570768..f4e4953babe6380f9037ca0f632341ccdff3b847 100644 (file)
@@ -19,12 +19,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "object_properties.h"
 #include "irrlichttypes_bloated.h"
+#include "exceptions.h"
 #include "util/serialize.h"
+#include "util/basic_macros.h"
 #include <sstream>
-#include <map>
-
-#define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")"
-#define PP2(x) "("<<(x).X<<","<<(x).Y<<")"
 
 ObjectProperties::ObjectProperties():
        hp_max(1),
@@ -41,7 +39,12 @@ ObjectProperties::ObjectProperties():
        makes_footstep_sound(false),
        automatic_rotate(0),
        stepheight(0),
-       automatic_face_movement_dir(false)
+       automatic_face_movement_dir(false),
+       automatic_face_movement_dir_offset(0.0),
+       backface_culling(true),
+       nametag(""),
+       nametag_color(255, 255, 255, 255),
+       automatic_face_movement_max_rotation_per_sec(-1)
 {
        textures.push_back("unknown_object.png");
        colors.push_back(video::SColor(255,255,255,255));
@@ -73,6 +76,10 @@ std::string ObjectProperties::dump()
        os<<", is_visible="<<is_visible;
        os<<", makes_footstep_sound="<<makes_footstep_sound;
        os<<", automatic_rotate="<<automatic_rotate;
+       os<<", backface_culling="<<backface_culling;
+       os << ", nametag=" << nametag;
+       os << ", nametag_color=" << "\"" << nametag_color.getAlpha() << "," << nametag_color.getRed()
+                       << "," << nametag_color.getGreen() << "," << nametag_color.getBlue() << "\" ";
        return os.str();
 }
 
@@ -104,6 +111,13 @@ void ObjectProperties::serialize(std::ostream &os) const
        writeU8(os, collideWithObjects);
        writeF1000(os,stepheight);
        writeU8(os, automatic_face_movement_dir);
+       writeF1000(os, automatic_face_movement_dir_offset);
+       writeU8(os, backface_culling);
+       os << serializeString(nametag);
+       writeARGB8(os, nametag_color);
+       writeF1000(os, automatic_face_movement_max_rotation_per_sec);
+       os << serializeString(infotext);
+
        // Add stuff only at the bottom.
        // Never remove anything, because we don't want new versions of this
 }
@@ -139,6 +153,12 @@ void ObjectProperties::deSerialize(std::istream &is)
                        collideWithObjects = readU8(is);
                        stepheight = readF1000(is);
                        automatic_face_movement_dir = readU8(is);
+                       automatic_face_movement_dir_offset = readF1000(is);
+                       backface_culling = readU8(is);
+                       nametag = deSerializeString(is);
+                       nametag_color = readARGB8(is);
+                       automatic_face_movement_max_rotation_per_sec = readF1000(is);
+                       infotext = deSerializeString(is);
                }catch(SerializationError &e){}
        }
        else
@@ -146,4 +166,3 @@ void ObjectProperties::deSerialize(std::istream &is)
                throw SerializationError("unsupported ObjectProperties version");
        }
 }
-