void Land::load(ESMReader &esm) { mEsm = &esm; mPlugin = mEsm->getIndex(); // Get the grid location esm.getSubNameIs("INTV"); esm.getSubHeaderIs(8); esm.getT<int>(mX); esm.getT<int>(mY); esm.getHNT(mFlags, "DATA"); // Store the file position mContext = esm.getContext(); mHasData = false; // Skip these here. Load the actual data when the cell is loaded. if (esm.isNextSub("VNML")) { esm.skipHSubSize(12675); mDataTypes |= DATA_VNML; } if (esm.isNextSub("VHGT")) { esm.skipHSubSize(4232); mDataTypes |= DATA_VHGT; } if (esm.isNextSub("WNAM")) { esm.skipHSubSize(81); mDataTypes |= DATA_WNAM; } if (esm.isNextSub("VCLR")) { esm.skipHSubSize(12675); mDataTypes |= DATA_VCLR; } if (esm.isNextSub("VTEX")) { esm.skipHSubSize(512); mDataTypes |= DATA_VTEX; } // We need all three of VNML, VHGT and VTEX in order to use the // landscape. (Though Morrowind seems to accept terrain without VTEX/VCLR entries) mHasData = mDataTypes & (DATA_VNML|DATA_VHGT|DATA_WNAM); mDataLoaded = 0; mLandData = NULL; }
void Land::load(ESMReader &esm) { mEsm = &esm; mPlugin = mEsm->getIndex(); // Get the grid location esm.getSubNameIs("INTV"); esm.getSubHeaderIs(8); esm.getT<int>(mX); esm.getT<int>(mY); esm.getHNT(mFlags, "DATA"); // Store the file position mContext = esm.getContext(); // Skip these here. Load the actual data when the cell is loaded. if (esm.isNextSub("VNML")) { esm.skipHSubSize(12675); mDataTypes |= DATA_VNML; } if (esm.isNextSub("VHGT")) { esm.skipHSubSize(4232); mDataTypes |= DATA_VHGT; } if (esm.isNextSub("WNAM")) { esm.skipHSubSize(81); mDataTypes |= DATA_WNAM; } if (esm.isNextSub("VCLR")) { esm.skipHSubSize(12675); mDataTypes |= DATA_VCLR; } if (esm.isNextSub("VTEX")) { esm.skipHSubSize(512); mDataTypes |= DATA_VTEX; } mDataLoaded = 0; mLandData = NULL; }
void Land::load(ESMReader &esm, bool &isDeleted) { isDeleted = false; mPlugin = esm.getIndex(); bool hasLocation = false; bool isLoaded = false; while (!isLoaded && esm.hasMoreSubs()) { esm.getSubName(); switch (esm.retSubName().val) { case ESM::FourCC<'I','N','T','V'>::value: esm.getSubHeaderIs(8); esm.getT<int>(mX); esm.getT<int>(mY); hasLocation = true; break; case ESM::FourCC<'D','A','T','A'>::value: esm.getHT(mFlags); break; case ESM::SREC_DELE: esm.skipHSub(); isDeleted = true; break; default: esm.cacheSubName(); isLoaded = true; break; } } if (!hasLocation) esm.fail("Missing INTV subrecord"); mContext = esm.getContext(); // Skip the land data here. Load it when the cell is loaded. while (esm.hasMoreSubs()) { esm.getSubName(); switch (esm.retSubName().val) { case ESM::FourCC<'V','N','M','L'>::value: esm.skipHSub(); mDataTypes |= DATA_VNML; break; case ESM::FourCC<'V','H','G','T'>::value: esm.skipHSub(); mDataTypes |= DATA_VHGT; break; case ESM::FourCC<'W','N','A','M'>::value: esm.skipHSub(); mDataTypes |= DATA_WNAM; break; case ESM::FourCC<'V','C','L','R'>::value: esm.skipHSub(); mDataTypes |= DATA_VCLR; break; case ESM::FourCC<'V','T','E','X'>::value: esm.skipHSub(); mDataTypes |= DATA_VTEX; break; default: esm.fail("Unknown subrecord"); break; } } mDataLoaded = 0; mLandData = NULL; }