]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Animation/Joint.cpp
Replaced muscles and joints in Skeleton by vectors
[lugaru.git] / Source / Animation / Joint.cpp
index 760e49b2cde1fd1d381079afc999baf56b6653cb..96f94c97ac6d5a03546017cd8ff63e54cd0ed1b6 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),
@@ -36,3 +37,22 @@ Joint::Joint() :
     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;
+}