1 #include "importcellref.hpp" 2 3 #include <components/esm/esmreader.hpp> 4 5 namespace ESSImport 6 { 7 load(ESM::ESMReader & esm)8 void CellRef::load(ESM::ESMReader &esm) 9 { 10 blank(); 11 12 // (FRMR subrecord name is already read by the loop in ConvertCell) 13 esm.getHT(mRefNum.mIndex); // FRMR 14 15 // this is required since openmw supports more than 255 content files 16 int pluginIndex = (mRefNum.mIndex & 0xff000000) >> 24; 17 mRefNum.mContentFile = pluginIndex-1; 18 mRefNum.mIndex &= 0x00ffffff; 19 20 mIndexedRefId = esm.getHNString("NAME"); 21 22 ActorData::load(esm); 23 if (esm.isNextSub("LVCR")) 24 { 25 // occurs on levelled creature spawner references 26 // probably some identifier for the creature that has been spawned? 27 unsigned char lvcr; 28 esm.getHT(lvcr); 29 //std::cout << "LVCR: " << (int)lvcr << std::endl; 30 } 31 32 mEnabled = true; 33 esm.getHNOT(mEnabled, "ZNAM"); 34 35 // DATA should occur for all references, except levelled creature spawners 36 // I've seen DATA *twice* on a creature record, and with the exact same content too! weird 37 // alarmvoi0000.ess 38 esm.getHNOT(mPos, "DATA", 24); 39 esm.getHNOT(mPos, "DATA", 24); 40 41 mDeleted = 0; 42 if (esm.isNextSub("DELE")) 43 { 44 unsigned int deleted; 45 esm.getHT(deleted); 46 mDeleted = ((deleted >> 24) & 0x2) != 0; // the other 3 bytes seem to be uninitialized garbage 47 } 48 49 if (esm.isNextSub("MVRF")) 50 { 51 esm.skipHSub(); 52 esm.getSubName(); 53 esm.skipHSub(); 54 } 55 } 56 57 } 58