1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 16:49:55 +00:00
openmw-tes3mp/components/esm/loadcrea.cpp
2012-04-06 21:04:30 +02:00

56 lines
1.2 KiB
C++

#include "loadcrea.hpp"
namespace ESM {
void Creature::load(ESMReader &esm, const std::string& id)
{
mId = id;
model = esm.getHNString("MODL");
original = esm.getHNOString("CNAM");
name = esm.getHNOString("FNAM");
script = esm.getHNOString("SCRI");
esm.getHNT(data, "NPDT", 96);
esm.getHNT(flags, "FLAG");
scale = 1.0;
esm.getHNOT(scale, "XSCL");
inventory.load(esm);
// More subrecords:
// AIDT - data (12 bytes, unknown)
// AI_W - wander (14 bytes, i don't understand it)
// short distance
// byte duration
// byte timeOfDay
// byte idle[10]
//
// Rest is optional:
// AI_T - travel?
// AI_F - follow?
// AI_E - escort?
// AI_A - activate?
esm.skipRecord();
}
void Creature::save(ESMWriter &esm)
{
esm.writeHNString("MODL", model);
if (!original.empty())
esm.writeHNString("CNAM", original);
if (!name.empty())
esm.writeHNString("FNAM", name);
if (!script.empty())
esm.writeHNString("SCRI", script);
esm.writeHNT("NPDT", data, 96);
esm.writeHNT("FLAG", flags);
if (scale != 1.0)
esm.writeHNT("XSCL", scale);
inventory.save(esm);
}
}