From fa50bbc77b3fd98996cc00de50518f117c6c4a68 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Mon, 26 Jul 2010 12:59:50 +0200 Subject: [PATCH] added a CellStore pointer to PlayerPos --- apps/openmw/mwrender/playerpos.hpp | 9 ++++++++- apps/openmw/mwworld/world.cpp | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwrender/playerpos.hpp b/apps/openmw/mwrender/playerpos.hpp index 0eed8b7b4d..3501850b63 100644 --- a/apps/openmw/mwrender/playerpos.hpp +++ b/apps/openmw/mwrender/playerpos.hpp @@ -6,6 +6,7 @@ #include #include "../mwworld/refdata.hpp" +#include "../mwworld/ptr.hpp" namespace MWRender { @@ -15,11 +16,12 @@ namespace MWRender class PlayerPos { ESMS::LiveCellRef mPlayer; + MWWorld::Ptr::CellStore *mCellStore; Ogre::Camera *camera; public: PlayerPos(Ogre::Camera *cam, const ESM::NPC *player) : - camera(cam) + mCellStore (0), camera(cam) { mPlayer.base = player; mPlayer.ref.pos.pos[0] = mPlayer.ref.pos.pos[1] = mPlayer.ref.pos.pos[2] = 0; @@ -40,6 +42,11 @@ namespace MWRender // TODO: Update sound listener } + + void setCell (MWWorld::Ptr::CellStore *cellStore) + { + mCellStore = cellStore; + } Ogre::Camera *getCamera() { return camera; } diff --git a/apps/openmw/mwworld/world.cpp b/apps/openmw/mwworld/world.cpp index 944d18f872..f2b8aa7e9c 100644 --- a/apps/openmw/mwworld/world.cpp +++ b/apps/openmw/mwworld/world.cpp @@ -183,6 +183,7 @@ namespace MWWorld insertInteriorScripts (mInteriors[startCell]); mPlayerPos = new MWRender::PlayerPos (mScene.getCamera(), mStore.npcs.find ("player")); + mPlayerPos->setCell (&mInteriors[startCell]); // global variables mGlobalVariables = new Globals (mStore); @@ -444,6 +445,7 @@ namespace MWWorld insertInteriorScripts (mInteriors[cellName]); mPlayerPos->setPos (position.pos[0], position.pos[1], position.pos[2]); + mPlayerPos->setCell (&mInteriors[cellName]); // TODO orientation // This connects the cell data with the rendering scene.