From 7d979a2dfcd87e915abc21a947f33a31dac9ae38 Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Thu, 9 May 2024 16:35:31 +0300 Subject: [PATCH] Place ESM4 static collections to the scene --- apps/openmw/mwclass/classes.cpp | 2 ++ apps/openmw/mwlua/cellbindings.cpp | 4 ++++ apps/openmw/mwlua/types/types.cpp | 3 +++ apps/openmw/mwworld/cellstore.cpp | 1 + apps/openmw/mwworld/cellstore.hpp | 3 ++- apps/openmw/mwworld/esmstore.cpp | 1 + apps/openmw/mwworld/esmstore.hpp | 4 +++- apps/openmw/mwworld/store.cpp | 1 + components/esm/records.hpp | 1 + components/esm4/loadscol.cpp | 4 +++- components/esm4/loadscol.hpp | 1 + files/lua_api/openmw/types.lua | 3 +++ 12 files changed, 25 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwclass/classes.cpp b/apps/openmw/mwclass/classes.cpp index f96c73e529..e7d5cf394b 100644 --- a/apps/openmw/mwclass/classes.cpp +++ b/apps/openmw/mwclass/classes.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -92,6 +93,7 @@ namespace MWClass ESM4Npc::registerSelf(); ESM4Named::registerSelf(); ESM4Static::registerSelf(); + ESM4Named::registerSelf(); ESM4Named::registerSelf(); ESM4Tree::registerSelf(); ESM4Named::registerSelf(); diff --git a/apps/openmw/mwlua/cellbindings.cpp b/apps/openmw/mwlua/cellbindings.cpp index 963a437f62..2bc8f57ee2 100644 --- a/apps/openmw/mwlua/cellbindings.cpp +++ b/apps/openmw/mwlua/cellbindings.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -260,6 +261,9 @@ namespace MWLua case ESM::REC_ALCH4: cell.mStore->template forEachType(visitor); break; + case ESM::REC_SCOL4: + cell.mStore->template forEachType(visitor); + break; case ESM::REC_STAT4: cell.mStore->template forEachType(visitor); break; diff --git a/apps/openmw/mwlua/types/types.cpp b/apps/openmw/mwlua/types/types.cpp index 632b70938b..47db953b04 100644 --- a/apps/openmw/mwlua/types/types.cpp +++ b/apps/openmw/mwlua/types/types.cpp @@ -51,6 +51,7 @@ namespace MWLua constexpr std::string_view ESM4MovableStatic = "ESM4MovableStatic"; constexpr std::string_view ESM4Potion = "ESM4Potion"; constexpr std::string_view ESM4Static = "ESM4Static"; + constexpr std::string_view ESM4StaticCollection = "ESM4StaticCollection"; constexpr std::string_view ESM4Terminal = "ESM4Terminal"; constexpr std::string_view ESM4Tree = "ESM4Tree"; constexpr std::string_view ESM4Weapon = "ESM4Weapon"; @@ -97,6 +98,7 @@ namespace MWLua { ESM::REC_MSTT4, ObjectTypeName::ESM4MovableStatic }, { ESM::REC_ALCH4, ObjectTypeName::ESM4Potion }, { ESM::REC_STAT4, ObjectTypeName::ESM4Static }, + { ESM::REC_SCOL4, ObjectTypeName::ESM4StaticCollection }, { ESM::REC_TERM4, ObjectTypeName::ESM4Terminal }, { ESM::REC_TREE4, ObjectTypeName::ESM4Tree }, { ESM::REC_WEAP4, ObjectTypeName::ESM4Weapon }, @@ -244,6 +246,7 @@ namespace MWLua addType(ObjectTypeName::ESM4MovableStatic, { ESM::REC_MSTT4 }); addType(ObjectTypeName::ESM4Potion, { ESM::REC_ALCH4 }); addType(ObjectTypeName::ESM4Static, { ESM::REC_STAT4 }); + addType(ObjectTypeName::ESM4StaticCollection, { ESM::REC_SCOL4 }); addESM4TerminalBindings(addType(ObjectTypeName::ESM4Terminal, { ESM::REC_TERM4 }), context); addType(ObjectTypeName::ESM4Tree, { ESM::REC_TREE4 }); addType(ObjectTypeName::ESM4Weapon, { ESM::REC_WEAP4 }); diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index fd24bb7271..70e8be7d16 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -61,6 +61,7 @@ #include #include #include +#include #include #include #include diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp index 0a78746479..097053e2e0 100644 --- a/apps/openmw/mwworld/cellstore.hpp +++ b/apps/openmw/mwworld/cellstore.hpp @@ -75,6 +75,7 @@ namespace ESM4 struct ItemMod; struct MiscItem; struct MovableStatic; + struct StaticCollection; struct Terminal; struct Tree; struct Weapon; @@ -99,7 +100,7 @@ namespace MWWorld CellRefList, CellRefList, CellRefList, CellRefList, CellRefList, CellRefList, CellRefList, CellRefList, CellRefList, CellRefList, CellRefList, - CellRefList, CellRefList>; + CellRefList, CellRefList, CellRefList>; /// \brief Mutable state of a cell class CellStore diff --git a/apps/openmw/mwworld/esmstore.cpp b/apps/openmw/mwworld/esmstore.cpp index ff3c73311e..79970ee394 100644 --- a/apps/openmw/mwworld/esmstore.cpp +++ b/apps/openmw/mwworld/esmstore.cpp @@ -374,6 +374,7 @@ namespace MWWorld case ESM::REC_MISC4: case ESM::REC_MSTT4: case ESM::REC_NPC_4: + case ESM::REC_SCOL4: case ESM::REC_STAT4: case ESM::REC_TERM4: case ESM::REC_TREE4: diff --git a/apps/openmw/mwworld/esmstore.hpp b/apps/openmw/mwworld/esmstore.hpp index c6271a4428..69c4502533 100644 --- a/apps/openmw/mwworld/esmstore.hpp +++ b/apps/openmw/mwworld/esmstore.hpp @@ -106,6 +106,7 @@ namespace ESM4 struct Race; struct Reference; struct Static; + struct StaticCollection; struct Terminal; struct Tree; struct Weapon; @@ -145,7 +146,8 @@ namespace MWWorld Store, Store, Store, Store, Store, Store, Store, Store, Store, Store, Store, Store, Store, - Store, Store, Store, Store, Store>; + Store, Store, Store, Store, Store, + Store>; private: template diff --git a/apps/openmw/mwworld/store.cpp b/apps/openmw/mwworld/store.cpp index 10d9fb3f3b..6c617c1f77 100644 --- a/apps/openmw/mwworld/store.cpp +++ b/apps/openmw/mwworld/store.cpp @@ -1376,6 +1376,7 @@ template class MWWorld::TypedDynamicStore; template class MWWorld::TypedDynamicStore; template class MWWorld::TypedDynamicStore; template class MWWorld::TypedDynamicStore; +template class MWWorld::TypedDynamicStore; template class MWWorld::TypedDynamicStore; template class MWWorld::TypedDynamicStore; template class MWWorld::TypedDynamicStore; diff --git a/components/esm/records.hpp b/components/esm/records.hpp index ded4b92a92..0b60b44cf0 100644 --- a/components/esm/records.hpp +++ b/components/esm/records.hpp @@ -73,6 +73,7 @@ #include #include #include +#include #include #include #include diff --git a/components/esm4/loadscol.cpp b/components/esm4/loadscol.cpp index 00775edaa5..8748f24f07 100644 --- a/components/esm4/loadscol.cpp +++ b/components/esm4/loadscol.cpp @@ -49,12 +49,14 @@ void ESM4::StaticCollection::load(ESM4::Reader& reader) case ESM::fourCC("FULL"): reader.getLocalizedString(mFullName); break; - case ESM::fourCC("OBND"): case ESM::fourCC("MODL"): // Model data start + reader.getZString(mModel); + break; case ESM::fourCC("MODT"): case ESM::fourCC("MODC"): case ESM::fourCC("MODS"): case ESM::fourCC("MODF"): // Model data end + case ESM::fourCC("OBND"): case ESM::fourCC("ONAM"): case ESM::fourCC("DATA"): case ESM::fourCC("FLTR"): // FO4 diff --git a/components/esm4/loadscol.hpp b/components/esm4/loadscol.hpp index f3ae3a622e..88ceb6ed1e 100644 --- a/components/esm4/loadscol.hpp +++ b/components/esm4/loadscol.hpp @@ -47,6 +47,7 @@ namespace ESM4 std::string mEditorId; std::string mFullName; + std::string mModel; void load(ESM4::Reader& reader); // void save(ESM4::Writer& writer) const; diff --git a/files/lua_api/openmw/types.lua b/files/lua_api/openmw/types.lua index a92df7aa46..3be2a97379 100644 --- a/files/lua_api/openmw/types.lua +++ b/files/lua_api/openmw/types.lua @@ -2246,6 +2246,9 @@ --- Functions for @{#ESM4Static} objects -- @field [parent=#types] #ESM4Static ESM4Static +--- Functions for @{#ESM4StaticCollection} objects +-- @field [parent=#types] #ESM4StaticCollection ESM4StaticCollection + --- Functions for @{#ESM4Weapon} objects -- @field [parent=#types] #ESM4Weapon ESM4Weapon