]> git.localhorst.tv Git - blank.git/blobdiff - src/io/WorldSave.cpp
treat head pitch and yaw as entity state
[blank.git] / src / io / WorldSave.cpp
index f45410b8d75b2eb0a2cbb145958584b2402d845c..86532787653d1b24deef8baec749501eab3377ff 100644 (file)
@@ -130,6 +130,10 @@ void WorldSave::Read(Player &player) const {
                        in.ReadVec(state.block_pos);
                } else if (name == "orientation") {
                        in.ReadQuat(state.orient);
+               } else if (name == "pitch") {
+                       state.pitch = in.GetFloat();
+               } else if (name == "yaw") {
+                       state.yaw = in.GetFloat();
                } else if (name == "slot") {
                        int slot;
                        in.ReadNumber(slot);
@@ -151,6 +155,8 @@ void WorldSave::Write(const Player &player) const {
        out << "chunk = " << state.chunk_pos << ';' << endl;
        out << "position = " << state.block_pos << ';' << endl;
        out << "orientation = " << state.orient << ';' << endl;
+       out << "pitch = " << state.pitch << ';' << endl;
+       out << "yaw = " << state.yaw << ';' << endl;
        out << "slot = " << player.GetInventorySlot() << ';' << endl;
 }
 
@@ -177,7 +183,7 @@ void WorldSave::Read(Chunk &chunk) const {
        if (gzclose(file) != Z_OK) {
                throw runtime_error("failed to read chunk file");
        }
-       chunk.InvalidateModel();
+       chunk.InvalidateMesh();
        chunk.ClearSave();
 }