forked from mirror/openmw-tes3mp
added local variables to ref data
This commit is contained in:
parent
5c91ba74b8
commit
a06b84ac86
4 changed files with 74 additions and 8 deletions
|
@ -37,8 +37,13 @@ set(GAMEINPUT_HEADER
|
||||||
apps/openmw/mwinput/inputmanager.hpp)
|
apps/openmw/mwinput/inputmanager.hpp)
|
||||||
source_group(apps\\openmw\\mwinput FILES ${GAMEINPUT} ${GAMEINPUT_HEADER})
|
source_group(apps\\openmw\\mwinput FILES ${GAMEINPUT} ${GAMEINPUT_HEADER})
|
||||||
|
|
||||||
set(APPS ${GAME} ${GAMEREND} ${GAMEINPUT})
|
# set(GAMESCRIPT)
|
||||||
set(APPS_HEADER ${GAME_HEADER} ${GAMEREND_HEADER} ${GAMEINPUT_HEADER})
|
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
|
# source directory: components
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ void insertObj(CellRenderImp& cellRender, T& liveRef)
|
||||||
{
|
{
|
||||||
cellRender.insertBegin (liveRef.ref);
|
cellRender.insertBegin (liveRef.ref);
|
||||||
cellRender.insertMesh ("meshes\\" + model);
|
cellRender.insertMesh ("meshes\\" + model);
|
||||||
liveRef.mData.mHandle = cellRender.insertEnd();
|
liveRef.mData.setHandle (cellRender.insertEnd());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ void insertObj(CellRenderImp& cellRender, ESMS::LiveCellRef<ESM::Light, OMW::Ref
|
||||||
const float radius = float(liveRef.base->data.radius);
|
const float radius = float(liveRef.base->data.radius);
|
||||||
cellRender.insertLight(r, g, b, radius);
|
cellRender.insertLight(r, g, b, radius);
|
||||||
|
|
||||||
liveRef.mData.mHandle = cellRender.insertEnd();
|
liveRef.mData.setHandle (cellRender.insertEnd());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
30
apps/openmw/mwscript/locals.hpp
Normal file
30
apps/openmw/mwscript/locals.hpp
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#ifndef GAME_SCRIPT_LOCALS_H
|
||||||
|
#define GAME_SCRIPT_LOCALS_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <components/esm/loadscpt.hpp>
|
||||||
|
#include <components/interpreter/types.hpp>
|
||||||
|
|
||||||
|
namespace MWScript
|
||||||
|
{
|
||||||
|
struct Locals
|
||||||
|
{
|
||||||
|
std::vector<Interpreter::Type_Short> mShorts;
|
||||||
|
std::vector<Interpreter::Type_Integer> mLongs;
|
||||||
|
std::vector<Interpreter::Type_Float> 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
|
||||||
|
|
|
@ -3,14 +3,45 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "mwscript/locals.hpp"
|
||||||
|
|
||||||
|
namespace ESM
|
||||||
|
{
|
||||||
|
class Script;
|
||||||
|
}
|
||||||
|
|
||||||
namespace OMW
|
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
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue