mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-29 21:45:33 +00:00
Load ESM4::Tree and ESM4::Furniture
This commit is contained in:
parent
599265eea7
commit
1b669db017
13 changed files with 48 additions and 10 deletions
|
@ -61,9 +61,11 @@ namespace MWClass
|
|||
ESM4Named<ESM4::Clothing>::registerSelf();
|
||||
ESM4Named<ESM4::Container>::registerSelf();
|
||||
ESM4Named<ESM4::Door>::registerSelf();
|
||||
ESM4Named<ESM4::Furniture>::registerSelf();
|
||||
ESM4Named<ESM4::Ingredient>::registerSelf();
|
||||
ESM4Named<ESM4::MiscItem>::registerSelf();
|
||||
ESM4Static::registerSelf();
|
||||
ESM4Tree::registerSelf();
|
||||
ESM4Named<ESM4::Weapon>::registerSelf();
|
||||
ESM4Light::registerSelf();
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define GAME_MWCLASS_ESM4BASE_H
|
||||
|
||||
#include <components/esm4/loadstat.hpp>
|
||||
#include <components/esm4/loadtree.hpp>
|
||||
#include <components/misc/strings/algorithm.hpp>
|
||||
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
@ -88,6 +89,15 @@ namespace MWClass
|
|||
}
|
||||
};
|
||||
|
||||
class ESM4Tree final : public MWWorld::RegisteredClass<ESM4Tree, ESM4Base<ESM4::Tree>>
|
||||
{
|
||||
friend MWWorld::RegisteredClass<ESM4Tree, ESM4Base<ESM4::Tree>>;
|
||||
ESM4Tree()
|
||||
: MWWorld::RegisteredClass<ESM4Tree, ESM4Base<ESM4::Tree>>(ESM4::Tree::sRecordId)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// For records with `mFullName` that should be shown as a tooltip.
|
||||
// All objects with a tooltip can be activated (activation can be handled in Lua).
|
||||
template <typename Record>
|
||||
|
|
|
@ -188,6 +188,9 @@ namespace MWLua
|
|||
case ESM::REC_DOOR4:
|
||||
cell.mStore->template forEachType<ESM4::Door>(visitor);
|
||||
break;
|
||||
case ESM::REC_FURN4:
|
||||
cell.mStore->template forEachType<ESM4::Furniture>(visitor);
|
||||
break;
|
||||
case ESM::REC_INGR4:
|
||||
cell.mStore->template forEachType<ESM4::Ingredient>(visitor);
|
||||
break;
|
||||
|
@ -203,6 +206,9 @@ namespace MWLua
|
|||
case ESM::REC_STAT4:
|
||||
cell.mStore->template forEachType<ESM4::Static>(visitor);
|
||||
break;
|
||||
case ESM::REC_TREE4:
|
||||
cell.mStore->template forEachType<ESM4::Tree>(visitor);
|
||||
break;
|
||||
case ESM::REC_WEAP4:
|
||||
cell.mStore->template forEachType<ESM4::Weapon>(visitor);
|
||||
break;
|
||||
|
|
|
@ -40,11 +40,13 @@ namespace MWLua
|
|||
constexpr std::string_view ESM4Clothing = "ESM4Clothing";
|
||||
constexpr std::string_view ESM4Container = "ESM4Container";
|
||||
constexpr std::string_view ESM4Door = "ESM4Door";
|
||||
constexpr std::string_view ESM4Furniture = "ESM4Furniture";
|
||||
constexpr std::string_view ESM4Ingredient = "ESM4Ingredient";
|
||||
constexpr std::string_view ESM4Light = "ESM4Light";
|
||||
constexpr std::string_view ESM4MiscItem = "ESM4Miscellaneous";
|
||||
constexpr std::string_view ESM4Potion = "ESM4Potion";
|
||||
constexpr std::string_view ESM4Static = "ESM4Static";
|
||||
constexpr std::string_view ESM4Tree = "ESM4Tree";
|
||||
constexpr std::string_view ESM4Weapon = "ESM4Weapon";
|
||||
}
|
||||
|
||||
|
@ -79,11 +81,13 @@ namespace MWLua
|
|||
{ ESM::REC_CLOT4, ObjectTypeName::ESM4Clothing },
|
||||
{ ESM::REC_CONT4, ObjectTypeName::ESM4Container },
|
||||
{ ESM::REC_DOOR4, ObjectTypeName::ESM4Door },
|
||||
{ ESM::REC_FURN4, ObjectTypeName::ESM4Furniture },
|
||||
{ ESM::REC_INGR4, ObjectTypeName::ESM4Ingredient },
|
||||
{ ESM::REC_LIGH4, ObjectTypeName::ESM4Light },
|
||||
{ ESM::REC_MISC4, ObjectTypeName::ESM4MiscItem },
|
||||
{ ESM::REC_ALCH4, ObjectTypeName::ESM4Potion },
|
||||
{ ESM::REC_STAT4, ObjectTypeName::ESM4Static },
|
||||
{ ESM::REC_TREE4, ObjectTypeName::ESM4Tree },
|
||||
{ ESM::REC_WEAP4, ObjectTypeName::ESM4Weapon },
|
||||
};
|
||||
}
|
||||
|
@ -210,11 +214,13 @@ namespace MWLua
|
|||
addType(ObjectTypeName::ESM4Clothing, { ESM::REC_CLOT4 });
|
||||
addType(ObjectTypeName::ESM4Container, { ESM::REC_CONT4 });
|
||||
addESM4DoorBindings(addType(ObjectTypeName::ESM4Door, { ESM::REC_DOOR4 }), context);
|
||||
addType(ObjectTypeName::ESM4Furniture, { ESM::REC_FURN4 });
|
||||
addType(ObjectTypeName::ESM4Ingredient, { ESM::REC_INGR4 });
|
||||
addType(ObjectTypeName::ESM4Light, { ESM::REC_LIGH4 });
|
||||
addType(ObjectTypeName::ESM4MiscItem, { ESM::REC_MISC4 });
|
||||
addType(ObjectTypeName::ESM4Potion, { ESM::REC_ALCH4 });
|
||||
addType(ObjectTypeName::ESM4Static, { ESM::REC_STAT4 });
|
||||
addType(ObjectTypeName::ESM4Tree, { ESM::REC_TREE4 });
|
||||
addType(ObjectTypeName::ESM4Weapon, { ESM::REC_WEAP4 });
|
||||
|
||||
sol::table typeToPackage = getTypeToPackageTable(context.mLua->sol());
|
||||
|
|
|
@ -68,8 +68,10 @@ namespace ESM4
|
|||
struct Clothing;
|
||||
struct Container;
|
||||
struct Door;
|
||||
struct Furniture;
|
||||
struct Ingredient;
|
||||
struct MiscItem;
|
||||
struct Tree;
|
||||
struct Weapon;
|
||||
}
|
||||
|
||||
|
@ -87,8 +89,8 @@ namespace MWWorld
|
|||
|
||||
CellRefList<ESM4::Static>, CellRefList<ESM4::Light>, CellRefList<ESM4::Activator>, CellRefList<ESM4::Potion>,
|
||||
CellRefList<ESM4::Ammunition>, CellRefList<ESM4::Armor>, CellRefList<ESM4::Book>, CellRefList<ESM4::Clothing>,
|
||||
CellRefList<ESM4::Container>, CellRefList<ESM4::Door>, CellRefList<ESM4::Ingredient>,
|
||||
CellRefList<ESM4::MiscItem>, CellRefList<ESM4::Weapon>>;
|
||||
CellRefList<ESM4::Container>, CellRefList<ESM4::Door>, CellRefList<ESM4::Ingredient>, CellRefList<ESM4::Tree>,
|
||||
CellRefList<ESM4::MiscItem>, CellRefList<ESM4::Weapon>, CellRefList<ESM4::Furniture>>;
|
||||
|
||||
/// \brief Mutable state of a cell
|
||||
class CellStore
|
||||
|
|
|
@ -286,8 +286,10 @@ namespace MWWorld
|
|||
case ESM::REC_BOOK4:
|
||||
case ESM::REC_CONT4:
|
||||
case ESM::REC_DOOR4:
|
||||
case ESM::REC_FURN4:
|
||||
case ESM::REC_INGR4:
|
||||
case ESM::REC_MISC4:
|
||||
case ESM::REC_TREE4:
|
||||
case ESM::REC_WEAP4:
|
||||
return true;
|
||||
break;
|
||||
|
|
|
@ -39,8 +39,10 @@ namespace ESM4
|
|||
struct Clothing;
|
||||
struct Container;
|
||||
struct Door;
|
||||
struct Furniture;
|
||||
struct Ingredient;
|
||||
struct MiscItem;
|
||||
struct Tree;
|
||||
struct Weapon;
|
||||
struct World;
|
||||
struct Land;
|
||||
|
@ -122,7 +124,7 @@ namespace MWWorld
|
|||
Store<ESM4::Static>, Store<ESM4::Cell>, Store<ESM4::Light>, Store<ESM4::Reference>, Store<ESM4::Activator>,
|
||||
Store<ESM4::Potion>, Store<ESM4::Ammunition>, Store<ESM4::Armor>, Store<ESM4::Book>, Store<ESM4::Clothing>,
|
||||
Store<ESM4::Container>, Store<ESM4::Door>, Store<ESM4::Ingredient>, Store<ESM4::MiscItem>,
|
||||
Store<ESM4::Weapon>, Store<ESM4::World>, Store<ESM4::Land>>;
|
||||
Store<ESM4::Tree>, Store<ESM4::Weapon>, Store<ESM4::World>, Store<ESM4::Furniture>, Store<ESM4::Land>>;
|
||||
|
||||
private:
|
||||
template <typename T>
|
||||
|
|
|
@ -1298,9 +1298,11 @@ template class MWWorld::TypedDynamicStore<ESM4::Book>;
|
|||
template class MWWorld::TypedDynamicStore<ESM4::Clothing>;
|
||||
template class MWWorld::TypedDynamicStore<ESM4::Container>;
|
||||
template class MWWorld::TypedDynamicStore<ESM4::Door>;
|
||||
template class MWWorld::TypedDynamicStore<ESM4::Furniture>;
|
||||
template class MWWorld::TypedDynamicStore<ESM4::Ingredient>;
|
||||
template class MWWorld::TypedDynamicStore<ESM4::MiscItem>;
|
||||
template class MWWorld::TypedDynamicStore<ESM4::Static>;
|
||||
template class MWWorld::TypedDynamicStore<ESM4::Tree>;
|
||||
template class MWWorld::TypedDynamicStore<ESM4::Light>;
|
||||
template class MWWorld::TypedDynamicStore<ESM4::Reference, ESM::FormId>;
|
||||
template class MWWorld::TypedDynamicStore<ESM4::Cell>;
|
||||
|
|
|
@ -52,11 +52,13 @@
|
|||
#include <components/esm4/loadclot.hpp>
|
||||
#include <components/esm4/loadcont.hpp>
|
||||
#include <components/esm4/loaddoor.hpp>
|
||||
#include <components/esm4/loadfurn.hpp>
|
||||
#include <components/esm4/loadingr.hpp>
|
||||
#include <components/esm4/loadligh.hpp>
|
||||
#include <components/esm4/loadmisc.hpp>
|
||||
#include <components/esm4/loadrefr.hpp>
|
||||
#include <components/esm4/loadstat.hpp>
|
||||
#include <components/esm4/loadtree.hpp>
|
||||
#include <components/esm4/loadweap.hpp>
|
||||
|
||||
#include "defs.hpp"
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
|
||||
void ESM4::Furniture::load(ESM4::Reader& reader)
|
||||
{
|
||||
mFormId = reader.hdr().record.getFormId();
|
||||
reader.adjustFormId(mFormId);
|
||||
mId = reader.getRefIdFromHeader();
|
||||
mFlags = reader.hdr().record.flags;
|
||||
|
||||
while (reader.getSubRecordHeader())
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
#include <components/esm/defs.hpp>
|
||||
#include <components/esm/refid.hpp>
|
||||
|
||||
#include "formid.hpp"
|
||||
|
||||
namespace ESM4
|
||||
|
@ -39,7 +42,7 @@ namespace ESM4
|
|||
|
||||
struct Furniture
|
||||
{
|
||||
FormId mFormId; // from the header
|
||||
ESM::RefId mId; // from the header
|
||||
std::uint32_t mFlags; // from the header, see enum type RecordFlag for details
|
||||
|
||||
std::string mEditorId;
|
||||
|
@ -55,6 +58,7 @@ namespace ESM4
|
|||
// void save(ESM4::Writer& writer) const;
|
||||
|
||||
// void blank();
|
||||
static constexpr ESM::RecNameInts sRecordId = ESM::RecNameInts::REC_FURN4;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
|
||||
void ESM4::Tree::load(ESM4::Reader& reader)
|
||||
{
|
||||
mFormId = reader.hdr().record.getFormId();
|
||||
reader.adjustFormId(mFormId);
|
||||
mId = reader.getRefIdFromHeader();
|
||||
mFlags = reader.hdr().record.flags;
|
||||
|
||||
while (reader.getSubRecordHeader())
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
#include "formid.hpp"
|
||||
#include <components/esm/defs.hpp>
|
||||
#include <components/esm/refid.hpp>
|
||||
|
||||
namespace ESM4
|
||||
{
|
||||
|
@ -39,7 +40,7 @@ namespace ESM4
|
|||
|
||||
struct Tree
|
||||
{
|
||||
FormId mFormId; // from the header
|
||||
ESM::RefId mId; // from the header
|
||||
std::uint32_t mFlags; // from the header, see enum type RecordFlag for details
|
||||
|
||||
std::string mEditorId;
|
||||
|
@ -53,6 +54,7 @@ namespace ESM4
|
|||
// void save(ESM4::Writer& writer) const;
|
||||
|
||||
// void blank();
|
||||
static constexpr ESM::RecNameInts sRecordId = ESM::RecNameInts::REC_TREE4;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue