diff --git a/CMakeLists.txt b/CMakeLists.txt index 090313639..0236d8f89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,8 +37,13 @@ set(GAMEINPUT_HEADER apps/openmw/mwinput/inputmanager.hpp) source_group(apps\\openmw\\mwinput FILES ${GAMEINPUT} ${GAMEINPUT_HEADER}) -set(APPS ${GAME} ${GAMEREND} ${GAMEINPUT}) -set(APPS_HEADER ${GAME_HEADER} ${GAMEREND_HEADER} ${GAMEINPUT_HEADER}) +# set(GAMESCRIPT) +set(GAMESCRIPT_HEADER + apps/openmw/mwscript/locals.hpp) +source_group(apps\\openmw\\mwscript FILES ${GAMESCRIPT} ${GAMESCRIPT_HEADER}) + +set(APPS ${GAME} ${GAMEREND} ${GAMEINPUT} ${GAMESCRIPT}) +set(APPS_HEADER ${GAME_HEADER} ${GAMEREND_HEADER} ${GAMEINPUT_HEADER} ${GAMESCRIPT_HEADER}) # source directory: components diff --git a/apps/openmw/mwrender/cellimp.cpp b/apps/openmw/mwrender/cellimp.cpp index ef323b4cd..24512702f 100644 --- a/apps/openmw/mwrender/cellimp.cpp +++ b/apps/openmw/mwrender/cellimp.cpp @@ -13,7 +13,7 @@ void insertObj(CellRenderImp& cellRender, T& liveRef) { cellRender.insertBegin (liveRef.ref); cellRender.insertMesh ("meshes\\" + model); - liveRef.mData.mHandle = cellRender.insertEnd(); + liveRef.mData.setHandle (cellRender.insertEnd()); } } @@ -36,7 +36,7 @@ void insertObj(CellRenderImp& cellRender, ESMS::LiveCellRefdata.radius); cellRender.insertLight(r, g, b, radius); - liveRef.mData.mHandle = cellRender.insertEnd(); + liveRef.mData.setHandle (cellRender.insertEnd()); } } diff --git a/apps/openmw/mwscript/locals.hpp b/apps/openmw/mwscript/locals.hpp new file mode 100644 index 000000000..e5500158f --- /dev/null +++ b/apps/openmw/mwscript/locals.hpp @@ -0,0 +1,30 @@ +#ifndef GAME_SCRIPT_LOCALS_H +#define GAME_SCRIPT_LOCALS_H + +#include + +#include +#include + +namespace MWScript +{ + struct Locals + { + std::vector mShorts; + std::vector mLongs; + std::vector mFloats; + + void configure (const ESM::Script& script) + { + mShorts.clear(); + mShorts.resize (script.data.numShorts, 0); + mLongs.clear(); + mLongs.resize (script.data.numLongs, 0); + mFloats.clear(); + mFloats.resize (script.data.numFloats, 0); + } + }; +} + +#endif + diff --git a/apps/openmw/refdata.hpp b/apps/openmw/refdata.hpp index 8726d2023..8ffe757b7 100644 --- a/apps/openmw/refdata.hpp +++ b/apps/openmw/refdata.hpp @@ -3,14 +3,45 @@ #include +#include "mwscript/locals.hpp" + +namespace ESM +{ + class Script; +} + namespace OMW { - struct RefData + class RefData { - std::string mHandle; + std::string mHandle; + + MWScript::Locals mLocals; // if we find the overhead of heaving a locals + // object in the refdata of refs without a script, + // we can make this a pointer later. - - }; + public: + + std::string getHandle() + { + return mHandle; + } + + void setLocals (const ESM::Script& script) + { + mLocals.configure (script); + } + + void setHandle (const std::string& handle) + { + mHandle = handle; + } + + MWScript::Locals& getLocals() + { + return mLocals; + } + }; } #endif