]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Animation/Joint.cpp
Improve formatting of devtools docs
[lugaru.git] / Source / Animation / Joint.cpp
index 760e49b2cde1fd1d381079afc999baf56b6653cb..4d3dd7c3e98d110bf0c1070ebe412148bd1e3156 100644 (file)
@@ -19,6 +19,7 @@ along with Lugaru.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "Animation/Joint.h"
+#include "binio.h"
 
 Joint::Joint() :
     blurred(0),
@@ -31,8 +32,27 @@ Joint::Joint() :
     visible(false),
     parent(nullptr),
     sametwist(false),
-    label(0),
+    label(head),
     hasgun(0),
     delay(0)
 {
 }
+
+void Joint::load(FILE* tfile, std::vector<Joint>& joints)
+{
+    int parentID;
+
+    funpackf(tfile, "Bf Bf Bf Bf Bf", &position.x, &position.y, &position.z, &length, &mass);
+    funpackf(tfile, "Bb Bb", &hasparent, &locked);
+    funpackf(tfile, "Bi", &modelnum);
+    funpackf(tfile, "Bb Bb", &visible, &sametwist);
+    funpackf(tfile, "Bi Bi", &label, &hasgun);
+    funpackf(tfile, "Bb", &lower);
+    funpackf(tfile, "Bi", &parentID);
+    if (hasparent) {
+        parent = &joints[parentID];
+    }
+    velocity = 0;
+    oldposition = position;
+    startpos = position;
+}