mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-30 09:36:43 +00:00
Added LAND and LTEX to esm_store
This commit is contained in:
parent
d36fa3deda
commit
30f2d4fdd4
4 changed files with 82 additions and 11 deletions
|
@ -25,8 +25,9 @@ struct Land
|
||||||
{
|
{
|
||||||
// Get the grid location
|
// Get the grid location
|
||||||
esm.getSubNameIs("INTV");
|
esm.getSubNameIs("INTV");
|
||||||
esm.getT(X);
|
esm.getSubHeaderIs(8);
|
||||||
esm.getT(Y);
|
esm.getT<int>(X);
|
||||||
|
esm.getT<int>(Y);
|
||||||
|
|
||||||
esm.getHNT(flags, "DATA");
|
esm.getHNT(flags, "DATA");
|
||||||
|
|
||||||
|
|
|
@ -23,12 +23,11 @@ namespace ESM {
|
||||||
|
|
||||||
struct LandTexture
|
struct LandTexture
|
||||||
{
|
{
|
||||||
std::string name, texture;
|
std::string id, texture;
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
void load(ESMReader &esm)
|
void load(ESMReader &esm)
|
||||||
{
|
{
|
||||||
name = esm.getHNString("NAME");
|
|
||||||
esm.getHNT(index, "INTV");
|
esm.getHNT(index, "INTV");
|
||||||
texture = esm.getHNString("DATA");
|
texture = esm.getHNString("DATA");
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,6 +149,79 @@ namespace ESMS
|
||||||
int getSize() { return list.size(); }
|
int getSize() { return list.size(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Land textures are indexed by an integer number
|
||||||
|
*/
|
||||||
|
struct LTexList : RecList
|
||||||
|
{
|
||||||
|
// TODO: For multiple ESM/ESP files we need one list per file.
|
||||||
|
std::vector<LandTexture> ltex;
|
||||||
|
int count;
|
||||||
|
|
||||||
|
LTexList() : count(0)
|
||||||
|
{
|
||||||
|
// More than enough to hold Morrowind.esm.
|
||||||
|
ltex.reserve(128);
|
||||||
|
}
|
||||||
|
|
||||||
|
int getSize() { return count; }
|
||||||
|
|
||||||
|
void load(ESMReader &esm, const std::string &id)
|
||||||
|
{
|
||||||
|
LandTexture lt;
|
||||||
|
lt.load(esm);
|
||||||
|
lt.id = id;
|
||||||
|
|
||||||
|
// Make sure we have room for the structure
|
||||||
|
if(lt.index + 1 > (int)ltex.size())
|
||||||
|
ltex.resize(lt.index+1);
|
||||||
|
|
||||||
|
// Store it
|
||||||
|
ltex[lt.index] = lt;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Landscapes are indexed by the X,Y coordinates of the exterior
|
||||||
|
cell they belong to.
|
||||||
|
*/
|
||||||
|
struct LandList : RecList
|
||||||
|
{
|
||||||
|
// Map containing all landscapes
|
||||||
|
typedef std::map<int, Land*> LandsCol;
|
||||||
|
typedef std::map<int, LandsCol> Lands;
|
||||||
|
Lands lands;
|
||||||
|
|
||||||
|
int count;
|
||||||
|
LandList() : count(0) {}
|
||||||
|
int getSize() { return count; }
|
||||||
|
|
||||||
|
// Find land for the given coordinates. Return null if no data.
|
||||||
|
const Land *search(int x, int y) const
|
||||||
|
{
|
||||||
|
Lands::const_iterator it = lands.find(x);
|
||||||
|
if(it==lands.end())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
LandsCol::const_iterator it2 = it->second.find(y);
|
||||||
|
if(it2 == it->second.end())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return it2->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(ESMReader &esm, const std::string &id)
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
|
||||||
|
// Create the structure and load it. This actually skips the
|
||||||
|
// landscape data and remembers the file position for later.
|
||||||
|
Land *land = new Land;
|
||||||
|
land->load(esm);
|
||||||
|
|
||||||
|
// Store the structure
|
||||||
|
lands[land->X][land->Y] = land;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Cells aren't simply indexed by name. Exterior cells are treated
|
// Cells aren't simply indexed by name. Exterior cells are treated
|
||||||
// separately.
|
// separately.
|
||||||
// TODO: case handling (cell names are case-insensitive, but they are also showen to the
|
// TODO: case handling (cell names are case-insensitive, but they are also showen to the
|
||||||
|
@ -243,8 +316,6 @@ namespace ESMS
|
||||||
|
|
||||||
void load(ESMReader &esm, const std::string &id)
|
void load(ESMReader &esm, const std::string &id)
|
||||||
{
|
{
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
// All cells have a name record, even nameless exterior cells.
|
// All cells have a name record, even nameless exterior cells.
|
||||||
|
|
|
@ -69,10 +69,10 @@ namespace ESMS
|
||||||
// Lists that need special rules
|
// Lists that need special rules
|
||||||
CellList cells;
|
CellList cells;
|
||||||
RecIDListT<GameSetting> gameSettings;
|
RecIDListT<GameSetting> gameSettings;
|
||||||
//RecListT<Land> lands;
|
LandList lands;
|
||||||
//RecListT<LandTexture> landTexts;
|
LTexList landTexts;
|
||||||
|
ScriptListT<Script> scripts;
|
||||||
//RecListT<MagicEffect> magicEffects;
|
//RecListT<MagicEffect> magicEffects;
|
||||||
ScriptListT<Script> scripts;
|
|
||||||
//RecListT<Skill> skills;
|
//RecListT<Skill> skills;
|
||||||
//RecListT<PathGrid> pathgrids;
|
//RecListT<PathGrid> pathgrids;
|
||||||
|
|
||||||
|
@ -112,12 +112,12 @@ namespace ESMS
|
||||||
recLists[REC_GLOB] = &globals;
|
recLists[REC_GLOB] = &globals;
|
||||||
recLists[REC_GMST] = &gameSettings;
|
recLists[REC_GMST] = &gameSettings;
|
||||||
recLists[REC_INGR] = &ingreds;
|
recLists[REC_INGR] = &ingreds;
|
||||||
//recLists[REC_LAND] = &lands;
|
recLists[REC_LAND] = &lands;
|
||||||
recLists[REC_LEVC] = &creatureLists;
|
recLists[REC_LEVC] = &creatureLists;
|
||||||
recLists[REC_LEVI] = &itemLists;
|
recLists[REC_LEVI] = &itemLists;
|
||||||
recLists[REC_LIGH] = &lights;
|
recLists[REC_LIGH] = &lights;
|
||||||
recLists[REC_LOCK] = &lockpicks;
|
recLists[REC_LOCK] = &lockpicks;
|
||||||
//recLists[REC_LTEX] = &landTexts;
|
recLists[REC_LTEX] = &landTexts;
|
||||||
//recLists[REC_MGEF] = &magicEffects;
|
//recLists[REC_MGEF] = &magicEffects;
|
||||||
recLists[REC_MISC] = &miscItems;
|
recLists[REC_MISC] = &miscItems;
|
||||||
recLists[REC_NPC_] = &npcs;
|
recLists[REC_NPC_] = &npcs;
|
||||||
|
|
Loading…
Reference in a new issue