]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Animation/Joint.cpp
Removed lots of unused code from Math folder, renamed Quaternion file to XYZ
[lugaru.git] / Source / Animation / Joint.cpp
index 760e49b2cde1fd1d381079afc999baf56b6653cb..f615bfe690dec038ccd52ead1f700e7a230bfd79 100644 (file)
@@ -18,7 +18,9 @@ You should have received a copy of the GNU General Public License
 along with Lugaru.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "Animation/Joint.h"
+#include "Animation/Joint.hpp"
+
+#include "Utils/binio.h"
 
 Joint::Joint() :
     blurred(0),
@@ -31,8 +33,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;
+}