forked from mirror/openmw-tes3mp
moved PlayerPos class from MWRender to MWWorld and renamed it to Player
This commit is contained in:
parent
f3ae1ea737
commit
4a12be11bf
13 changed files with 71 additions and 68 deletions
|
@ -14,7 +14,6 @@ set(GAMEREND
|
||||||
mwrender/cellimp.cpp
|
mwrender/cellimp.cpp
|
||||||
mwrender/interior.cpp
|
mwrender/interior.cpp
|
||||||
mwrender/exterior.cpp
|
mwrender/exterior.cpp
|
||||||
mwrender/playerpos.cpp
|
|
||||||
mwrender/sky.cpp)
|
mwrender/sky.cpp)
|
||||||
set(GAMEREND_HEADER
|
set(GAMEREND_HEADER
|
||||||
mwrender/cell.hpp
|
mwrender/cell.hpp
|
||||||
|
@ -22,7 +21,6 @@ set(GAMEREND_HEADER
|
||||||
mwrender/mwscene.hpp
|
mwrender/mwscene.hpp
|
||||||
mwrender/interior.hpp
|
mwrender/interior.hpp
|
||||||
mwrender/exterior.hpp
|
mwrender/exterior.hpp
|
||||||
mwrender/playerpos.hpp
|
|
||||||
mwrender/sky.hpp)
|
mwrender/sky.hpp)
|
||||||
source_group(apps\\openmw\\mwrender FILES ${GAMEREND} ${GAMEREND_HEADER})
|
source_group(apps\\openmw\\mwrender FILES ${GAMEREND} ${GAMEREND_HEADER})
|
||||||
|
|
||||||
|
@ -120,6 +118,7 @@ set(GAMEWORLD
|
||||||
mwworld/actiontalk.cpp
|
mwworld/actiontalk.cpp
|
||||||
mwworld/actiontake.cpp
|
mwworld/actiontake.cpp
|
||||||
mwworld/containerutil.cpp
|
mwworld/containerutil.cpp
|
||||||
|
mwworld/player.cpp
|
||||||
)
|
)
|
||||||
set(GAMEWORLD_HEADER
|
set(GAMEWORLD_HEADER
|
||||||
mwworld/refdata.hpp
|
mwworld/refdata.hpp
|
||||||
|
@ -137,6 +136,7 @@ set(GAMEWORLD_HEADER
|
||||||
mwworld/containerstore.hpp
|
mwworld/containerstore.hpp
|
||||||
mwworld/manualref.hpp
|
mwworld/manualref.hpp
|
||||||
mwworld/containerutil.hpp
|
mwworld/containerutil.hpp
|
||||||
|
mwworld/player.hpp
|
||||||
)
|
)
|
||||||
source_group(apps\\openmw\\mwworld FILES ${GAMEWORLD} ${GAMEWORLD_HEADER})
|
source_group(apps\\openmw\\mwworld FILES ${GAMEWORLD} ${GAMEWORLD_HEADER})
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "mwworld/ptr.hpp"
|
#include "mwworld/ptr.hpp"
|
||||||
#include "mwworld/environment.hpp"
|
#include "mwworld/environment.hpp"
|
||||||
#include "mwworld/class.hpp"
|
#include "mwworld/class.hpp"
|
||||||
|
#include "mwworld/player.hpp"
|
||||||
|
|
||||||
#include "mwclass/classes.hpp"
|
#include "mwclass/classes.hpp"
|
||||||
|
|
||||||
|
@ -77,7 +78,7 @@ bool OMW::Engine::frameStarted(const Ogre::FrameEvent& evt)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MWWorld::Ptr::CellStore *current = mEnvironment.mWorld->getPlayerPos().getPlayer().getCell();
|
MWWorld::Ptr::CellStore *current = mEnvironment.mWorld->getPlayer().getPlayer().getCell();
|
||||||
//If the region has changed
|
//If the region has changed
|
||||||
if(!(current->cell->data.flags & current->cell->Interior) && timer.elapsed() >= 10){
|
if(!(current->cell->data.flags & current->cell->Interior) && timer.elapsed() >= 10){
|
||||||
timer.restart();
|
timer.restart();
|
||||||
|
@ -377,7 +378,7 @@ void OMW::Engine::go()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets up the input system
|
// Sets up the input system
|
||||||
MWInput::MWInputManager input(mOgre, mEnvironment.mWorld->getPlayerPos(),
|
MWInput::MWInputManager input(mOgre, mEnvironment.mWorld->getPlayer(),
|
||||||
*mEnvironment.mWindowManager, mDebug, *this);
|
*mEnvironment.mWindowManager, mDebug, *this);
|
||||||
mEnvironment.mInputManager = &input;
|
mEnvironment.mInputManager = &input;
|
||||||
|
|
||||||
|
@ -439,7 +440,7 @@ void OMW::Engine::activate()
|
||||||
&ptr.getRefData().getLocals(), ptr);
|
&ptr.getRefData().getLocals(), ptr);
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> action =
|
boost::shared_ptr<MWWorld::Action> action =
|
||||||
MWWorld::Class::get (ptr).activate (ptr, mEnvironment.mWorld->getPlayerPos().getPlayer(),
|
MWWorld::Class::get (ptr).activate (ptr, mEnvironment.mWorld->getPlayer().getPlayer(),
|
||||||
mEnvironment);
|
mEnvironment);
|
||||||
|
|
||||||
interpreterContext.activate (ptr, action);
|
interpreterContext.activate (ptr, action);
|
||||||
|
|
|
@ -5,8 +5,7 @@
|
||||||
|
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
#include "../mwrender/playerpos.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/nullaction.hpp"
|
#include "../mwworld/nullaction.hpp"
|
||||||
#include "../mwworld/actionteleport.hpp"
|
#include "../mwworld/actionteleport.hpp"
|
||||||
|
@ -65,7 +64,7 @@ namespace MWClass
|
||||||
if (ref->ref.teleport)
|
if (ref->ref.teleport)
|
||||||
{
|
{
|
||||||
// teleport door
|
// teleport door
|
||||||
if (environment.mWorld->getPlayerPos().getPlayer()==actor)
|
if (environment.mWorld->getPlayer().getPlayer()==actor)
|
||||||
{
|
{
|
||||||
// the player is using the door
|
// the player is using the door
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "../mwworld/environment.hpp"
|
#include "../mwworld/environment.hpp"
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
#include "../mwworld/refdata.hpp"
|
#include "../mwworld/refdata.hpp"
|
||||||
|
#include "../mwworld/player.hpp"
|
||||||
|
|
||||||
#include "../mwinput/inputmanager.hpp"
|
#include "../mwinput/inputmanager.hpp"
|
||||||
|
|
||||||
|
@ -225,7 +226,7 @@ namespace MWDialogue
|
||||||
|
|
||||||
// check cell
|
// check cell
|
||||||
if (!info.cell.empty())
|
if (!info.cell.empty())
|
||||||
if (mEnvironment.mWorld->getPlayerPos().getPlayer().getCell()->cell->name != info.cell)
|
if (mEnvironment.mWorld->getPlayer().getPlayer().getCell()->cell->name != info.cell)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// TODO check DATAstruct
|
// TODO check DATAstruct
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwgui/window_manager.hpp"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
using namespace Widgets;
|
using namespace Widgets;
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,11 @@
|
||||||
#include <mangle/input/filters/eventlist.hpp>
|
#include <mangle/input/filters/eventlist.hpp>
|
||||||
|
|
||||||
#include <libs/platform/strings.h>
|
#include <libs/platform/strings.h>
|
||||||
#include "../mwrender/playerpos.hpp"
|
|
||||||
|
|
||||||
#include "../engine.hpp"
|
#include "../engine.hpp"
|
||||||
|
|
||||||
|
#include "../mwworld/player.hpp"
|
||||||
|
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <OgreRoot.h>
|
#include <OgreRoot.h>
|
||||||
|
@ -58,7 +59,7 @@ namespace MWInput
|
||||||
OEngine::Input::Poller poller;
|
OEngine::Input::Poller poller;
|
||||||
OEngine::Render::MouseLookEventPtr mouse;
|
OEngine::Render::MouseLookEventPtr mouse;
|
||||||
OEngine::GUI::EventInjectorPtr guiEvents;
|
OEngine::GUI::EventInjectorPtr guiEvents;
|
||||||
MWRender::PlayerPos &player;
|
MWWorld::Player &player;
|
||||||
MWGui::WindowManager &windows;
|
MWGui::WindowManager &windows;
|
||||||
OMW::Engine& mEngine;
|
OMW::Engine& mEngine;
|
||||||
|
|
||||||
|
@ -124,7 +125,7 @@ namespace MWInput
|
||||||
|
|
||||||
public:
|
public:
|
||||||
InputImpl(OEngine::Render::OgreRenderer &_ogre,
|
InputImpl(OEngine::Render::OgreRenderer &_ogre,
|
||||||
MWRender::PlayerPos &_player,
|
MWWorld::Player &_player,
|
||||||
MWGui::WindowManager &_windows,
|
MWGui::WindowManager &_windows,
|
||||||
bool debug,
|
bool debug,
|
||||||
OMW::Engine& engine)
|
OMW::Engine& engine)
|
||||||
|
@ -286,7 +287,7 @@ namespace MWInput
|
||||||
};
|
};
|
||||||
|
|
||||||
MWInputManager::MWInputManager(OEngine::Render::OgreRenderer &ogre,
|
MWInputManager::MWInputManager(OEngine::Render::OgreRenderer &ogre,
|
||||||
MWRender::PlayerPos &player,
|
MWWorld::Player &player,
|
||||||
MWGui::WindowManager &windows,
|
MWGui::WindowManager &windows,
|
||||||
bool debug,
|
bool debug,
|
||||||
OMW::Engine& engine)
|
OMW::Engine& engine)
|
||||||
|
@ -300,7 +301,7 @@ namespace MWInput
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWInputManager::setGuiMode(MWGui::GuiMode mode)
|
void MWInputManager::setGuiMode(MWGui::GuiMode mode)
|
||||||
{
|
{
|
||||||
impl->setGuiMode(mode);
|
impl->setGuiMode(mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,9 @@ namespace OEngine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MWRender
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
class PlayerPos;
|
class Player;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
|
@ -42,7 +42,7 @@ namespace MWInput
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MWInputManager(OEngine::Render::OgreRenderer &_ogre,
|
MWInputManager(OEngine::Render::OgreRenderer &_ogre,
|
||||||
MWRender::PlayerPos &_player,
|
MWWorld::Player&_player,
|
||||||
MWGui::WindowManager &_windows,
|
MWGui::WindowManager &_windows,
|
||||||
bool debug,
|
bool debug,
|
||||||
OMW::Engine& engine);
|
OMW::Engine& engine);
|
||||||
|
|
|
@ -8,12 +8,13 @@
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
#include "../mwworld/environment.hpp"
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
#include "../mwworld/player.hpp"
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
void MechanicsManager::buildPlayer()
|
void MechanicsManager::buildPlayer()
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = mEnvironment.mWorld->getPlayerPos().getPlayer();
|
MWWorld::Ptr ptr = mEnvironment.mWorld->getPlayer().getPlayer();
|
||||||
|
|
||||||
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
||||||
MWMechanics::NpcStats& npcStats = MWWorld::Class::get (ptr).getNpcStats (ptr);
|
MWMechanics::NpcStats& npcStats = MWWorld::Class::get (ptr).getNpcStats (ptr);
|
||||||
|
@ -33,9 +34,9 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
const ESM::Race *race =
|
const ESM::Race *race =
|
||||||
mEnvironment.mWorld->getStore().races.find (
|
mEnvironment.mWorld->getStore().races.find (
|
||||||
mEnvironment.mWorld->getPlayerPos().getRace());
|
mEnvironment.mWorld->getPlayer().getRace());
|
||||||
|
|
||||||
bool male = mEnvironment.mWorld->getPlayerPos().isMale();
|
bool male = mEnvironment.mWorld->getPlayer().isMale();
|
||||||
|
|
||||||
for (int i=0; i<8; ++i)
|
for (int i=0; i<8; ++i)
|
||||||
{
|
{
|
||||||
|
@ -75,11 +76,11 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
|
|
||||||
// birthsign
|
// birthsign
|
||||||
if (!mEnvironment.mWorld->getPlayerPos().getBirthsign().empty())
|
if (!mEnvironment.mWorld->getPlayer().getBirthsign().empty())
|
||||||
{
|
{
|
||||||
const ESM::BirthSign *sign =
|
const ESM::BirthSign *sign =
|
||||||
mEnvironment.mWorld->getStore().birthSigns.find (
|
mEnvironment.mWorld->getStore().birthSigns.find (
|
||||||
mEnvironment.mWorld->getPlayerPos().getBirthsign());
|
mEnvironment.mWorld->getPlayer().getBirthsign());
|
||||||
|
|
||||||
for (std::vector<std::string>::const_iterator iter (sign->powers.list.begin());
|
for (std::vector<std::string>::const_iterator iter (sign->powers.list.begin());
|
||||||
iter!=sign->powers.list.end(); ++iter)
|
iter!=sign->powers.list.end(); ++iter)
|
||||||
|
@ -91,7 +92,7 @@ namespace MWMechanics
|
||||||
// class
|
// class
|
||||||
if (mClassSelected)
|
if (mClassSelected)
|
||||||
{
|
{
|
||||||
const ESM::Class& class_ = mEnvironment.mWorld->getPlayerPos().getClass();
|
const ESM::Class& class_ = mEnvironment.mWorld->getPlayer().getClass();
|
||||||
|
|
||||||
for (int i=0; i<2; ++i)
|
for (int i=0; i<2; ++i)
|
||||||
{
|
{
|
||||||
|
@ -330,12 +331,12 @@ namespace MWMechanics
|
||||||
if (mUpdatePlayer)
|
if (mUpdatePlayer)
|
||||||
{
|
{
|
||||||
// basic player profile; should not change anymore after the creation phase is finished.
|
// basic player profile; should not change anymore after the creation phase is finished.
|
||||||
mEnvironment.mWindowManager->setValue ("name", mEnvironment.mWorld->getPlayerPos().getName());
|
mEnvironment.mWindowManager->setValue ("name", mEnvironment.mWorld->getPlayer().getName());
|
||||||
mEnvironment.mWindowManager->setValue ("race",
|
mEnvironment.mWindowManager->setValue ("race",
|
||||||
mEnvironment.mWorld->getStore().races.find (mEnvironment.mWorld->getPlayerPos().
|
mEnvironment.mWorld->getStore().races.find (mEnvironment.mWorld->getPlayer().
|
||||||
getRace())->name);
|
getRace())->name);
|
||||||
mEnvironment.mWindowManager->setValue ("class",
|
mEnvironment.mWindowManager->setValue ("class",
|
||||||
mEnvironment.mWorld->getPlayerPos().getClass().name);
|
mEnvironment.mWorld->getPlayer().getClass().name);
|
||||||
mUpdatePlayer = false;
|
mUpdatePlayer = false;
|
||||||
|
|
||||||
MWGui::WindowManager::SkillList majorSkills (5);
|
MWGui::WindowManager::SkillList majorSkills (5);
|
||||||
|
@ -343,8 +344,8 @@ namespace MWMechanics
|
||||||
|
|
||||||
for (int i=0; i<5; ++i)
|
for (int i=0; i<5; ++i)
|
||||||
{
|
{
|
||||||
minorSkills[i] = mEnvironment.mWorld->getPlayerPos().getClass().data.skills[i][0];
|
minorSkills[i] = mEnvironment.mWorld->getPlayer().getClass().data.skills[i][0];
|
||||||
majorSkills[i] = mEnvironment.mWorld->getPlayerPos().getClass().data.skills[i][1];
|
majorSkills[i] = mEnvironment.mWorld->getPlayer().getClass().data.skills[i][1];
|
||||||
}
|
}
|
||||||
|
|
||||||
mEnvironment.mWindowManager->configureSkills (majorSkills, minorSkills);
|
mEnvironment.mWindowManager->configureSkills (majorSkills, minorSkills);
|
||||||
|
@ -353,14 +354,14 @@ namespace MWMechanics
|
||||||
|
|
||||||
void MechanicsManager::setPlayerName (const std::string& name)
|
void MechanicsManager::setPlayerName (const std::string& name)
|
||||||
{
|
{
|
||||||
mEnvironment.mWorld->getPlayerPos().setName (name);
|
mEnvironment.mWorld->getPlayer().setName (name);
|
||||||
mUpdatePlayer = true;
|
mUpdatePlayer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MechanicsManager::setPlayerRace (const std::string& race, bool male)
|
void MechanicsManager::setPlayerRace (const std::string& race, bool male)
|
||||||
{
|
{
|
||||||
mEnvironment.mWorld->getPlayerPos().setGender (male);
|
mEnvironment.mWorld->getPlayer().setGender (male);
|
||||||
mEnvironment.mWorld->getPlayerPos().setRace (race);
|
mEnvironment.mWorld->getPlayer().setRace (race);
|
||||||
mRaceSelected = true;
|
mRaceSelected = true;
|
||||||
buildPlayer();
|
buildPlayer();
|
||||||
mUpdatePlayer = true;
|
mUpdatePlayer = true;
|
||||||
|
@ -368,14 +369,14 @@ namespace MWMechanics
|
||||||
|
|
||||||
void MechanicsManager::setPlayerBirthsign (const std::string& id)
|
void MechanicsManager::setPlayerBirthsign (const std::string& id)
|
||||||
{
|
{
|
||||||
mEnvironment.mWorld->getPlayerPos().setBirthsign (id);
|
mEnvironment.mWorld->getPlayer().setBirthsign (id);
|
||||||
buildPlayer();
|
buildPlayer();
|
||||||
mUpdatePlayer = true;
|
mUpdatePlayer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MechanicsManager::setPlayerClass (const std::string& id)
|
void MechanicsManager::setPlayerClass (const std::string& id)
|
||||||
{
|
{
|
||||||
mEnvironment.mWorld->getPlayerPos().setClass (*mEnvironment.mWorld->getStore().classes.find (id));
|
mEnvironment.mWorld->getPlayer().setClass (*mEnvironment.mWorld->getStore().classes.find (id));
|
||||||
mClassSelected = true;
|
mClassSelected = true;
|
||||||
buildPlayer();
|
buildPlayer();
|
||||||
mUpdatePlayer = true;
|
mUpdatePlayer = true;
|
||||||
|
@ -383,7 +384,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
void MechanicsManager::setPlayerClass (const ESM::Class& class_)
|
void MechanicsManager::setPlayerClass (const ESM::Class& class_)
|
||||||
{
|
{
|
||||||
mEnvironment.mWorld->getPlayerPos().setClass (class_);
|
mEnvironment.mWorld->getPlayer().setClass (class_);
|
||||||
mClassSelected = true;
|
mClassSelected = true;
|
||||||
buildPlayer();
|
buildPlayer();
|
||||||
mUpdatePlayer = true;
|
mUpdatePlayer = true;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
|
|
||||||
#include "playerpos.hpp"
|
#include "player.hpp"
|
||||||
|
|
||||||
#include "../mwworld/world.hpp"
|
#include "world.hpp"
|
||||||
|
|
||||||
namespace MWRender
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
PlayerPos::PlayerPos (Ogre::Camera *cam, const ESM::NPC *player, MWWorld::World& world) :
|
Player::Player (Ogre::Camera *cam, const ESM::NPC *player, MWWorld::World& world) :
|
||||||
mCellStore (0), camera(cam), mWorld (world), mClass (0)
|
mCellStore (0), camera(cam), mWorld (world), mClass (0)
|
||||||
{
|
{
|
||||||
mPlayer.base = player;
|
mPlayer.base = player;
|
||||||
|
@ -16,12 +16,12 @@ namespace MWRender
|
||||||
mClass = new ESM::Class (*world.getStore().classes.find (player->cls));
|
mClass = new ESM::Class (*world.getStore().classes.find (player->cls));
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerPos::~PlayerPos()
|
Player::~Player()
|
||||||
{
|
{
|
||||||
delete mClass;
|
delete mClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerPos::setPos(float x, float y, float z, bool updateCamera)
|
void Player::setPos(float x, float y, float z, bool updateCamera)
|
||||||
{
|
{
|
||||||
mWorld.moveObject (getPlayer(), x, y, z);
|
mWorld.moveObject (getPlayer(), x, y, z);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ namespace MWRender
|
||||||
-mPlayer.ref.pos.pos[1]));
|
-mPlayer.ref.pos.pos[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerPos::setClass (const ESM::Class& class_)
|
void Player::setClass (const ESM::Class& class_)
|
||||||
{
|
{
|
||||||
ESM::Class *new_class = new ESM::Class (class_);
|
ESM::Class *new_class = new ESM::Class (class_);
|
||||||
delete mClass;
|
delete mClass;
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _MWRENDER_PLAYERPOS_H
|
#ifndef GAME_MWWORLD_PLAYER_H
|
||||||
#define _MWRENDER_PLAYERPOS_H
|
#define GAME_MWWORLD_PLAYER_H
|
||||||
|
|
||||||
#include "OgreCamera.h"
|
#include "OgreCamera.h"
|
||||||
|
|
||||||
|
@ -13,12 +13,9 @@ namespace MWWorld
|
||||||
class World;
|
class World;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MWRender
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
// This class keeps track of the player position. It takes care of
|
class Player
|
||||||
// camera movement, sound listener updates, and collision handling
|
|
||||||
// (to be done).
|
|
||||||
class PlayerPos
|
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> mPlayer;
|
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> mPlayer;
|
||||||
MWWorld::Ptr::CellStore *mCellStore;
|
MWWorld::Ptr::CellStore *mCellStore;
|
||||||
|
@ -32,9 +29,9 @@ namespace MWRender
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PlayerPos(Ogre::Camera *cam, const ESM::NPC *player, MWWorld::World& world);
|
Player(Ogre::Camera *cam, const ESM::NPC *player, MWWorld::World& world);
|
||||||
|
|
||||||
~PlayerPos();
|
~Player();
|
||||||
|
|
||||||
// Set the player position. Uses Morrowind coordinates.
|
// Set the player position. Uses Morrowind coordinates.
|
||||||
void setPos(float _x, float _y, float _z, bool updateCamera = false);
|
void setPos(float _x, float _y, float _z, bool updateCamera = false);
|
|
@ -17,7 +17,7 @@
|
||||||
#include "ptr.hpp"
|
#include "ptr.hpp"
|
||||||
#include "environment.hpp"
|
#include "environment.hpp"
|
||||||
#include "class.hpp"
|
#include "class.hpp"
|
||||||
|
#include "player.hpp"
|
||||||
|
|
||||||
#include "refdata.hpp"
|
#include "refdata.hpp"
|
||||||
#include "globals.hpp"
|
#include "globals.hpp"
|
||||||
|
@ -296,12 +296,12 @@ namespace MWWorld
|
||||||
|
|
||||||
void World::playerCellChange (Ptr::CellStore *cell, const ESM::Position& position)
|
void World::playerCellChange (Ptr::CellStore *cell, const ESM::Position& position)
|
||||||
{
|
{
|
||||||
mPlayerPos->setPos (position.pos[0], position.pos[1], position.pos[2], true);
|
mPlayer->setPos (position.pos[0], position.pos[1], position.pos[2], true);
|
||||||
mPlayerPos->setCell (cell);
|
mPlayer->setCell (cell);
|
||||||
// TODO orientation
|
// TODO orientation
|
||||||
|
|
||||||
mEnvironment.mMechanicsManager->addActor (mPlayerPos->getPlayer());
|
mEnvironment.mMechanicsManager->addActor (mPlayer->getPlayer());
|
||||||
mEnvironment.mMechanicsManager->watchActor (mPlayerPos->getPlayer());
|
mEnvironment.mMechanicsManager->watchActor (mPlayer->getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ namespace MWWorld
|
||||||
|
|
||||||
World::World (OEngine::Render::OgreRenderer& renderer, const boost::filesystem::path& dataDir,
|
World::World (OEngine::Render::OgreRenderer& renderer, const boost::filesystem::path& dataDir,
|
||||||
const std::string& master, bool newGame, Environment& environment)
|
const std::string& master, bool newGame, Environment& environment)
|
||||||
: mSkyManager (0), mScene (renderer), mPlayerPos (0), mCurrentCell (0), mGlobalVariables (0),
|
: mSkyManager (0), mScene (renderer), mPlayer (0), mCurrentCell (0), mGlobalVariables (0),
|
||||||
mSky (false), mCellChanged (false), mEnvironment (environment)
|
mSky (false), mCellChanged (false), mEnvironment (environment)
|
||||||
{
|
{
|
||||||
boost::filesystem::path masterPath (dataDir);
|
boost::filesystem::path masterPath (dataDir);
|
||||||
|
@ -329,7 +329,7 @@ namespace MWWorld
|
||||||
mEsm.open (masterPath.file_string());
|
mEsm.open (masterPath.file_string());
|
||||||
mStore.load (mEsm);
|
mStore.load (mEsm);
|
||||||
|
|
||||||
mPlayerPos = new MWRender::PlayerPos (mScene.getCamera(), mStore.npcs.find ("player"), *this);
|
mPlayer = new MWWorld::Player (mScene.getCamera(), mStore.npcs.find ("player"), *this);
|
||||||
|
|
||||||
// global variables
|
// global variables
|
||||||
mGlobalVariables = new Globals (mStore);
|
mGlobalVariables = new Globals (mStore);
|
||||||
|
@ -354,14 +354,14 @@ namespace MWWorld
|
||||||
iter!=mBufferedCells.end(); ++iter)
|
iter!=mBufferedCells.end(); ++iter)
|
||||||
delete iter->second;
|
delete iter->second;
|
||||||
|
|
||||||
delete mPlayerPos;
|
delete mPlayer;
|
||||||
delete mSkyManager;
|
delete mSkyManager;
|
||||||
delete mGlobalVariables;
|
delete mGlobalVariables;
|
||||||
}
|
}
|
||||||
|
|
||||||
MWRender::PlayerPos& World::getPlayerPos()
|
MWWorld::Player& World::getPlayer()
|
||||||
{
|
{
|
||||||
return *mPlayerPos;
|
return *mPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
ESMS::ESMStore& World::getStore()
|
ESMS::ESMStore& World::getStore()
|
||||||
|
@ -394,7 +394,7 @@ namespace MWWorld
|
||||||
// the player is always in an active cell.
|
// the player is always in an active cell.
|
||||||
if (name=="player")
|
if (name=="player")
|
||||||
{
|
{
|
||||||
return mPlayerPos->getPlayer();
|
return mPlayer->getPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
// active cells
|
// active cells
|
||||||
|
@ -763,7 +763,7 @@ namespace MWWorld
|
||||||
ptr.getCellRef().pos.pos[1] = y;
|
ptr.getCellRef().pos.pos[1] = y;
|
||||||
ptr.getCellRef().pos.pos[2] = z;
|
ptr.getCellRef().pos.pos[2] = z;
|
||||||
|
|
||||||
if (ptr==mPlayerPos->getPlayer())
|
if (ptr==mPlayer->getPlayer())
|
||||||
{
|
{
|
||||||
if (mCurrentCell)
|
if (mCurrentCell)
|
||||||
{
|
{
|
||||||
|
@ -777,7 +777,7 @@ namespace MWWorld
|
||||||
|
|
||||||
if (mCurrentCell->cell->data.gridX!=cellX || mCurrentCell->cell->data.gridY!=cellY)
|
if (mCurrentCell->cell->data.gridX!=cellX || mCurrentCell->cell->data.gridY!=cellY)
|
||||||
{
|
{
|
||||||
changeCell (cellX, cellY, mPlayerPos->getPlayer().getCellRef().pos);
|
changeCell (cellX, cellY, mPlayer->getPlayer().getCellRef().pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -800,7 +800,7 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void World::positionToIndex (float x, float y, int &cellX, int &cellY) const
|
void World::positionToIndex (float x, float y, int &cellX, int &cellY) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
#include "../mwrender/playerpos.hpp"
|
|
||||||
#include "../mwrender/mwscene.hpp"
|
#include "../mwrender/mwscene.hpp"
|
||||||
|
|
||||||
#include "refdata.hpp"
|
#include "refdata.hpp"
|
||||||
|
@ -34,12 +33,13 @@ namespace MWRender
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
class Environment;
|
class Environment;
|
||||||
|
class Player;
|
||||||
|
|
||||||
/// \brief The game world and its visual representation
|
/// \brief The game world and its visual representation
|
||||||
|
|
||||||
class World
|
class World
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef std::list<std::pair<std::string, Ptr> > ScriptList;
|
typedef std::list<std::pair<std::string, Ptr> > ScriptList;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ namespace MWWorld
|
||||||
|
|
||||||
MWRender::SkyManager* mSkyManager;
|
MWRender::SkyManager* mSkyManager;
|
||||||
MWRender::MWScene mScene;
|
MWRender::MWScene mScene;
|
||||||
MWRender::PlayerPos *mPlayerPos;
|
MWWorld::Player *mPlayer;
|
||||||
Ptr::CellStore *mCurrentCell; // the cell, the player is in
|
Ptr::CellStore *mCurrentCell; // the cell, the player is in
|
||||||
CellRenderCollection mActiveCells;
|
CellRenderCollection mActiveCells;
|
||||||
CellRenderCollection mBufferedCells; // loaded, but not active (buffering not implementd yet)
|
CellRenderCollection mBufferedCells; // loaded, but not active (buffering not implementd yet)
|
||||||
|
@ -94,7 +94,7 @@ namespace MWWorld
|
||||||
|
|
||||||
~World();
|
~World();
|
||||||
|
|
||||||
MWRender::PlayerPos& getPlayerPos();
|
MWWorld::Player& getPlayer();
|
||||||
|
|
||||||
ESMS::ESMStore& getStore();
|
ESMS::ESMStore& getStore();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue