bool FieldParser::ParseVector3Field(ESMStream& stream, uint16_t length, Vector3F& outVector) { if (length <= sizeof(float) * 3) return false; stream.ReadRaw(&outVector.X, sizeof(outVector.X)); stream.ReadRaw(&outVector.Y, sizeof(outVector.Y)); stream.ReadRaw(&outVector.Z, sizeof(outVector.Z)); return true; }
bool FieldParser::ParseBinaryField(ESMStream& stream, uint16_t length, std::vector<uint8_t>& outVector) { outVector.resize(length); stream.ReadRaw(&outVector[0], length); return true; }
bool FieldParser::ParseOFSTField(ESMStream& stream, uint32_t length, std::vector<uint32_t>& outValue) { outValue.reserve(length / sizeof(uint32_t)); stream.ReadRaw(&outValue[0], length); return true; }
bool FieldParser::ParseFormID(ESMStream& stream, uint16_t length, FormIdentifier& outValue) { if (length != sizeof(outValue)) return false; stream.ReadRaw(&outValue, sizeof(outValue)); return true; }
bool FieldParser::ParseByteValue(ESMStream& stream, uint16_t length, uint8_t& outValue) { if (length != sizeof(outValue)) return false; stream.ReadRaw(&outValue, sizeof(outValue)); return true; }
bool FieldParser::ParseHavokData(ESMStream& stream, uint16_t length, LandTextureHavokData& havokData) { if (length != sizeof(havokData)) return false; stream.ReadRaw(&havokData, sizeof(havokData)); return true; }
bool FieldParser::ParseSCHRField(ESMStream& stream, uint16_t length, SCHRField& outField) { if (length != sizeof(outField)) return false; stream.ReadRaw(&outField, sizeof(outField)); return true; }
bool FieldParser::ParseXCLCField(ESMStream& stream, uint16_t length, XCLCField& outField) { //FIXME: According to the documents this is a 12 byte field, however I'm encountering only 8 bytes. if (length != sizeof(outField)) { if (length == sizeof(uint32_t) * 2) { stream.Read32((uint32_t &)outField.X); stream.Read32((uint32_t &)outField.Y); outField.LandHideFlags = LandHideFlag::None; return true; } return false; } stream.ReadRaw(&outField, sizeof(outField)); return true; }
void ParseRecordHeader(ESMStream& stream, RecordHeader& header) { //FIXME: This is not portable. stream.ReadRaw(&header, sizeof(header)); }