1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 10:23:51 +00:00

added a CellStore pointer to PlayerPos

This commit is contained in:
Marc Zinnschlag 2010-07-26 18:59:50 +08:00 committed by apreiml
parent d54cd377cd
commit e7abbbedda
2 changed files with 10 additions and 1 deletions

View file

@ -6,6 +6,7 @@
#include <components/esm_store/cell_store.hpp> #include <components/esm_store/cell_store.hpp>
#include "../mwworld/refdata.hpp" #include "../mwworld/refdata.hpp"
#include "../mwworld/ptr.hpp"
namespace MWRender namespace MWRender
{ {
@ -15,11 +16,12 @@ namespace MWRender
class PlayerPos class PlayerPos
{ {
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> mPlayer; ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> mPlayer;
MWWorld::Ptr::CellStore *mCellStore;
Ogre::Camera *camera; Ogre::Camera *camera;
public: public:
PlayerPos(Ogre::Camera *cam, const ESM::NPC *player) : PlayerPos(Ogre::Camera *cam, const ESM::NPC *player) :
camera(cam) mCellStore (0), camera(cam)
{ {
mPlayer.base = player; mPlayer.base = player;
mPlayer.ref.pos.pos[0] = mPlayer.ref.pos.pos[1] = mPlayer.ref.pos.pos[2] = 0; mPlayer.ref.pos.pos[0] = mPlayer.ref.pos.pos[1] = mPlayer.ref.pos.pos[2] = 0;
@ -41,6 +43,11 @@ namespace MWRender
// TODO: Update sound listener // TODO: Update sound listener
} }
void setCell (MWWorld::Ptr::CellStore *cellStore)
{
mCellStore = cellStore;
}
Ogre::Camera *getCamera() { return camera; } Ogre::Camera *getCamera() { return camera; }
// Move the player relative to her own position and // Move the player relative to her own position and

View file

@ -183,6 +183,7 @@ namespace MWWorld
insertInteriorScripts (mInteriors[startCell]); insertInteriorScripts (mInteriors[startCell]);
mPlayerPos = new MWRender::PlayerPos (mScene.getCamera(), mStore.npcs.find ("player")); mPlayerPos = new MWRender::PlayerPos (mScene.getCamera(), mStore.npcs.find ("player"));
mPlayerPos->setCell (&mInteriors[startCell]);
// global variables // global variables
mGlobalVariables = new Globals (mStore); mGlobalVariables = new Globals (mStore);
@ -444,6 +445,7 @@ namespace MWWorld
insertInteriorScripts (mInteriors[cellName]); insertInteriorScripts (mInteriors[cellName]);
mPlayerPos->setPos (position.pos[0], position.pos[1], position.pos[2]); mPlayerPos->setPos (position.pos[0], position.pos[1], position.pos[2]);
mPlayerPos->setCell (&mInteriors[cellName]);
// TODO orientation // TODO orientation
// This connects the cell data with the rendering scene. // This connects the cell data with the rendering scene.