diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index 045f504a7..9534ecc90 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -47,10 +47,10 @@ add_openmw_dir (mwsound ) add_openmw_dir (mwworld - refdata world physicssystem scene globals class action nullaction actionteleport + refdata worldimp physicssystem scene globals class action nullaction actionteleport containerstore actiontalk actiontake manualref player cellfunctors cells localscripts customdata weather inventorystore ptr actionopen actionread - actionequip timestamp actionalchemy + actionequip timestamp actionalchemy cellstore ) add_openmw_dir (mwclass @@ -64,7 +64,7 @@ add_openmw_dir (mwmechanics ) add_openmw_dir (mwbase - environment + environment world ) # Main executable diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 5c5a586af..45b4ab514 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -15,7 +15,6 @@ #include #include -#include #include #include #include @@ -39,9 +38,10 @@ #include "mwsound/soundmanager.hpp" -#include "mwworld/world.hpp" #include "mwworld/class.hpp" #include "mwworld/player.hpp" +#include "mwworld/cellstore.hpp" +#include "mwworld/worldimp.hpp" #include "mwclass/classes.hpp" @@ -51,6 +51,7 @@ #include "mwmechanics/mechanicsmanager.hpp" #include "mwbase/environment.hpp" +#include "mwbase/world.hpp" void OMW::Engine::executeLocalScripts() diff --git a/apps/openmw/mwbase/environment.cpp b/apps/openmw/mwbase/environment.cpp index 792e240f4..7218f22eb 100644 --- a/apps/openmw/mwbase/environment.cpp +++ b/apps/openmw/mwbase/environment.cpp @@ -9,13 +9,13 @@ #include "../mwsound/soundmanager.hpp" -#include "../mwworld/world.hpp" - #include "../mwdialogue/dialoguemanager.hpp" #include "../mwdialogue/journal.hpp" #include "../mwmechanics/mechanicsmanager.hpp" +#include "world.hpp" + MWBase::Environment *MWBase::Environment::sThis = 0; MWBase::Environment::Environment() @@ -32,7 +32,7 @@ MWBase::Environment::~Environment() sThis = 0; } -void MWBase::Environment::setWorld (MWWorld::World *world) +void MWBase::Environment::setWorld (World *world) { mWorld = world; } @@ -77,7 +77,7 @@ void MWBase::Environment::setFrameDuration (float duration) mFrameDuration = duration; } -MWWorld::World *MWBase::Environment::getWorld() const +MWBase::World *MWBase::Environment::getWorld() const { assert (mWorld); return mWorld; diff --git a/apps/openmw/mwbase/environment.hpp b/apps/openmw/mwbase/environment.hpp index 521beee0a..ad5a6f655 100644 --- a/apps/openmw/mwbase/environment.hpp +++ b/apps/openmw/mwbase/environment.hpp @@ -32,13 +32,10 @@ namespace MWInput struct MWInputManager; } -namespace MWWorld +namespace MWBase { class World; -} -namespace MWBase -{ /// \brief Central hub for mw-subsystems /// /// This class allows each mw-subsystem to access any others subsystem's top-level manager class. @@ -49,7 +46,7 @@ namespace MWBase { static Environment *sThis; - MWWorld::World *mWorld; + World *mWorld; MWSound::SoundManager *mSoundManager; MWScript::ScriptManager *mScriptManager; MWGui::WindowManager *mWindowManager; @@ -71,7 +68,7 @@ namespace MWBase ~Environment(); - void setWorld (MWWorld::World *world); + void setWorld (World *world); void setSoundManager (MWSound::SoundManager *soundManager); @@ -90,7 +87,7 @@ namespace MWBase void setFrameDuration (float duration); ///< Set length of current frame in seconds. - MWWorld::World *getWorld() const; + World *getWorld() const; MWSound::SoundManager *getSoundManager() const; diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp new file mode 100644 index 000000000..b2c19ab35 --- /dev/null +++ b/apps/openmw/mwbase/world.hpp @@ -0,0 +1,245 @@ +#ifndef GAME_MWBASE_WORLD_H +#define GAME_MWBASE_WORLD_H + +#include +#include +#include + +#include + +#include "../mwworld/globals.hpp" + +namespace Ogre +{ + class Vector2; + class Vector3; +} + +namespace OEngine +{ + namespace Render + { + class Fader; + } +} + +namespace ESM +{ + class ESMReader; + struct Position; + struct Cell; + struct Class; + struct Potion; +} + +namespace ESMS +{ + struct ESMStore; +} + +namespace MWWorld +{ + class CellStore; + class Player; + class LocalScripts; + class Ptr; + class TimeStamp; +} + +namespace MWBase +{ + class World + { + World (const World&); + ///< not implemented + + World& operator= (const World&); + ///< not implemented + + public: + + enum RenderMode + { + Render_CollisionDebug, + Render_Wireframe, + Render_Pathgrid, + Render_Compositors + }; + + World() {} + + virtual ~World() {} + + virtual OEngine::Render::Fader* getFader() = 0; + ///< \ŧodo remove this function. Rendering details should not be exposed. + + virtual MWWorld::CellStore *getExterior (int x, int y) = 0; + + virtual MWWorld::CellStore *getInterior (const std::string& name) = 0; + + virtual void setWaterHeight(const float height) = 0; + + virtual void toggleWater() = 0; + + virtual void adjustSky() = 0; + + virtual void getTriangleBatchCount(unsigned int &triangles, unsigned int &batches) = 0; + + virtual void setFallbackValues (const std::map& fallbackMap) = 0; + + virtual std::string getFallback (const std::string& key) const = 0; + + virtual std::string getFallback (const std::string& key, const std::string& def) const = 0; + + virtual MWWorld::Player& getPlayer() = 0; + + virtual const ESMS::ESMStore& getStore() const = 0; + + virtual ESM::ESMReader& getEsmReader() = 0; + + virtual MWWorld::LocalScripts& getLocalScripts() = 0; + + virtual bool hasCellChanged() const = 0; + ///< Has the player moved to a different cell, since the last frame? + + virtual bool isCellExterior() const = 0; + + virtual bool isCellQuasiExterior() const = 0; + + virtual Ogre::Vector2 getNorthVector (MWWorld::CellStore* cell) = 0; + ///< get north vector (OGRE coordinates) for given interior cell + + virtual MWWorld::Globals::Data& getGlobalVariable (const std::string& name) = 0; + + virtual MWWorld::Globals::Data getGlobalVariable (const std::string& name) const = 0; + + virtual char getGlobalVariableType (const std::string& name) const = 0; + ///< Return ' ', if there is no global variable with this name. + + virtual MWWorld::Ptr getPtr (const std::string& name, bool activeOnly) = 0; + ///< Return a pointer to a liveCellRef with the given name. + /// \param activeOnly do non search inactive cells. + + virtual MWWorld::Ptr getPtrViaHandle (const std::string& handle) = 0; + ///< Return a pointer to a liveCellRef with the given Ogre handle. + + /// \todo enable reference in the OGRE scene + virtual void enable (const MWWorld::Ptr& ptr) = 0; + + /// \todo disable reference in the OGRE scene + virtual void disable (const MWWorld::Ptr& ptr) = 0; + + virtual void advanceTime (double hours) = 0; + ///< Advance in-game time. + + virtual void setHour (double hour) = 0; + ///< Set in-game time hour. + + virtual void setMonth (int month) = 0; + ///< Set in-game time month. + + virtual void setDay (int day) = 0; + ///< Set in-game time day. + + virtual MWWorld::TimeStamp getTimeStamp() const = 0; + ///< Return current in-game time stamp. + + virtual bool toggleSky() = 0; + ///< \return Resulting mode + + virtual void changeWeather(const std::string& region, unsigned int id) = 0; + + virtual int getCurrentWeather() const = 0; + + virtual int getMasserPhase() const = 0; + + virtual int getSecundaPhase() const = 0; + + virtual void setMoonColour (bool red) = 0; + + virtual float getTimeScaleFactor() const = 0; + + virtual void changeToInteriorCell (const std::string& cellName, + const ESM::Position& position) = 0; + ///< Move to interior cell. + + virtual void changeToExteriorCell (const ESM::Position& position) = 0; + ///< Move to exterior cell. + + virtual const ESM::Cell *getExterior (const std::string& cellName) const = 0; + ///< Return a cell matching the given name or a 0-pointer, if there is no such cell. + + virtual void markCellAsUnchanged() = 0; + + virtual std::string getFacedHandle() = 0; + ///< Return handle of the object the player is looking at + + virtual void deleteObject (const MWWorld::Ptr& ptr) = 0; + + virtual void moveObject (const MWWorld::Ptr& ptr, float x, float y, float z) = 0; + + virtual void indexToPosition (int cellX, int cellY, float &x, float &y, bool centre = false) + const = 0; + ///< Convert cell numbers to position. + + virtual void positionToIndex (float x, float y, int &cellX, int &cellY) const = 0; + ///< Convert position to cell numbers + + virtual void doPhysics (const std::vector >& actors, + float duration) = 0; + ///< Run physics simulation and modify \a world accordingly. + + virtual bool toggleCollisionMode() = 0; + ///< Toggle collision mode for player. If disabled player object should ignore + /// collisions and gravity. + ///< \return Resulting mode + + virtual bool toggleRenderMode (RenderMode mode) = 0; + ///< Toggle a render mode. + ///< \return Resulting mode + + virtual std::pair createRecord (const ESM::Potion& record) + = 0; + ///< Create a new recrod (of type potion) in the ESM store. + /// \return ID, pointer to created record + + virtual std::pair createRecord (const ESM::Class& record) + = 0; + ///< Create a new recrod (of type class) in the ESM store. + /// \return ID, pointer to created record + + virtual const ESM::Cell *createRecord (const ESM::Cell& record) = 0; + ///< Create a new recrod (of type cell) in the ESM store. + /// \return ID, pointer to created record + + virtual void playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName, + int mode, int number = 1) = 0; + ///< Run animation for a MW-reference. Calls to this function for references that are + /// currently not in the rendered scene should be ignored. + /// + /// \param mode: 0 normal, 1 immediate start, 2 immediate loop + /// \param number How offen the animation should be run + + virtual void skipAnimation (const MWWorld::Ptr& ptr) = 0; + ///< Skip the animation for the given MW-reference for one frame. Calls to this function for + /// references that are currently not in the rendered scene should be ignored. + + virtual void update (float duration) = 0; + + virtual bool placeObject(const MWWorld::Ptr& object, float cursorX, float cursorY) = 0; + ///< place an object into the gameworld at the specified cursor position + /// @param object + /// @param cursor X (relative 0-1) + /// @param cursor Y (relative 0-1) + /// @return true if the object was placed, or false if it was rejected because the position is too far away + + virtual void dropObjectOnGround (const MWWorld::Ptr& object) = 0; + + virtual bool canPlaceObject (float cursorX, float cursorY) = 0; + ///< @return true if it is possible to place on object at specified cursor location + + virtual void processChangedSettings (const Settings::CategorySettingVector& settings) = 0; + }; +} + +#endif diff --git a/apps/openmw/mwclass/activator.cpp b/apps/openmw/mwclass/activator.cpp index 505f61f4c..81a47ccb0 100644 --- a/apps/openmw/mwclass/activator.cpp +++ b/apps/openmw/mwclass/activator.cpp @@ -3,18 +3,23 @@ #include -#include +#include "../mwbase/environment.hpp" +#include "../mwworld//cellstore.hpp" #include "../mwworld/ptr.hpp" +#include "../mwworld/physicssystem.hpp" + #include "../mwrender/objects.hpp" -#include "../mwbase/environment.hpp" +#include "../mwrender/renderinginterface.hpp" + #include "../mwgui/window_manager.hpp" +#include "../mwgui/tooltips.hpp" namespace MWClass { void Activator::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); @@ -30,7 +35,7 @@ namespace MWClass void Activator::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); @@ -44,7 +49,7 @@ namespace MWClass std::string Activator::getName (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->name; @@ -52,7 +57,7 @@ namespace MWClass std::string Activator::getScript (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->script; @@ -67,7 +72,7 @@ namespace MWClass bool Activator::hasToolTip (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return (ref->base->name != ""); @@ -75,7 +80,7 @@ namespace MWClass MWGui::ToolTipInfo Activator::getToolTipInfo (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); MWGui::ToolTipInfo info; diff --git a/apps/openmw/mwclass/apparatus.cpp b/apps/openmw/mwclass/apparatus.cpp index 6945f3c27..7e3c3b8f9 100644 --- a/apps/openmw/mwclass/apparatus.cpp +++ b/apps/openmw/mwclass/apparatus.cpp @@ -3,16 +3,17 @@ #include -#include - #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" #include "../mwworld/actionalchemy.hpp" -#include "../mwworld/world.hpp" +#include "../mwworld/cellstore.hpp" +#include "../mwworld/physicssystem.hpp" #include "../mwrender/objects.hpp" +#include "../mwrender/renderinginterface.hpp" #include "../mwgui/window_manager.hpp" #include "../mwgui/tooltips.hpp" @@ -23,7 +24,7 @@ namespace MWClass { void Apparatus::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); @@ -39,7 +40,7 @@ namespace MWClass void Apparatus::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); @@ -53,7 +54,7 @@ namespace MWClass std::string Apparatus::getName (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->name; @@ -70,7 +71,7 @@ namespace MWClass std::string Apparatus::getScript (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->script; @@ -78,7 +79,7 @@ namespace MWClass int Apparatus::getValue (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->data.value; @@ -103,7 +104,7 @@ namespace MWClass std::string Apparatus::getInventoryIcon (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->icon; @@ -111,7 +112,7 @@ namespace MWClass bool Apparatus::hasToolTip (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return (ref->base->name != ""); @@ -119,7 +120,7 @@ namespace MWClass MWGui::ToolTipInfo Apparatus::getToolTipInfo (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); MWGui::ToolTipInfo info; diff --git a/apps/openmw/mwclass/armor.cpp b/apps/openmw/mwclass/armor.cpp index 83c0120c7..380c596d7 100644 --- a/apps/openmw/mwclass/armor.cpp +++ b/apps/openmw/mwclass/armor.cpp @@ -5,19 +5,21 @@ #include #include -#include +#include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" #include "../mwworld/actionequip.hpp" #include "../mwworld/inventorystore.hpp" -#include "../mwworld/world.hpp" - -#include "../mwbase/environment.hpp" +#include "../mwworld/cellstore.hpp" +#include "../mwworld/physicssystem.hpp" #include "../mwrender/objects.hpp" +#include "../mwrender/renderinginterface.hpp" #include "../mwgui/window_manager.hpp" +#include "../mwgui/tooltips.hpp" #include "../mwsound/soundmanager.hpp" @@ -25,7 +27,7 @@ namespace MWClass { void Armor::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); @@ -41,7 +43,7 @@ namespace MWClass void Armor::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); const std::string &model = ref->base->model; @@ -54,7 +56,7 @@ namespace MWClass std::string Armor::getName (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->name; @@ -76,7 +78,7 @@ namespace MWClass int Armor::getItemMaxHealth (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->data.health; @@ -84,7 +86,7 @@ namespace MWClass std::string Armor::getScript (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->script; @@ -92,7 +94,7 @@ namespace MWClass std::pair, bool> Armor::getEquipmentSlots (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); std::vector slots; @@ -126,7 +128,7 @@ namespace MWClass int Armor::getEquipmentSkill (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); std::string typeGmst; @@ -164,7 +166,7 @@ namespace MWClass int Armor::getValue (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->data.value; @@ -201,7 +203,7 @@ namespace MWClass std::string Armor::getInventoryIcon (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->icon; @@ -209,7 +211,7 @@ namespace MWClass bool Armor::hasToolTip (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return (ref->base->name != ""); @@ -217,7 +219,7 @@ namespace MWClass MWGui::ToolTipInfo Armor::getToolTipInfo (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); MWGui::ToolTipInfo info; @@ -260,7 +262,7 @@ namespace MWClass std::string Armor::getEnchantment (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->enchant; diff --git a/apps/openmw/mwclass/book.cpp b/apps/openmw/mwclass/book.cpp index a107d9b21..a37da0fd7 100644 --- a/apps/openmw/mwclass/book.cpp +++ b/apps/openmw/mwclass/book.cpp @@ -3,17 +3,19 @@ #include -#include - #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actionread.hpp" -#include "../mwworld/world.hpp" +#include "../mwworld/cellstore.hpp" +#include "../mwworld/physicssystem.hpp" #include "../mwrender/objects.hpp" +#include "../mwrender/renderinginterface.hpp" #include "../mwgui/window_manager.hpp" +#include "../mwgui/tooltips.hpp" #include "../mwsound/soundmanager.hpp" @@ -21,7 +23,7 @@ namespace MWClass { void Book::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); @@ -37,7 +39,7 @@ namespace MWClass void Book::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); @@ -51,7 +53,7 @@ namespace MWClass std::string Book::getName (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->name; @@ -66,7 +68,7 @@ namespace MWClass std::string Book::getScript (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->script; @@ -74,7 +76,7 @@ namespace MWClass int Book::getValue (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->data.value; @@ -99,7 +101,7 @@ namespace MWClass std::string Book::getInventoryIcon (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->icon; @@ -107,7 +109,7 @@ namespace MWClass bool Book::hasToolTip (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return (ref->base->name != ""); @@ -115,7 +117,7 @@ namespace MWClass MWGui::ToolTipInfo Book::getToolTipInfo (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); MWGui::ToolTipInfo info; @@ -143,7 +145,7 @@ namespace MWClass std::string Book::getEnchantment (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->enchant; diff --git a/apps/openmw/mwclass/clothing.cpp b/apps/openmw/mwclass/clothing.cpp index 11b515faf..6c34b5e56 100644 --- a/apps/openmw/mwclass/clothing.cpp +++ b/apps/openmw/mwclass/clothing.cpp @@ -3,20 +3,21 @@ #include -#include - #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" #include "../mwworld/actionequip.hpp" #include "../mwworld/inventorystore.hpp" -#include "../mwworld/world.hpp" +#include "../mwworld/cellstore.hpp" +#include "../mwworld/physicssystem.hpp" #include "../mwgui/tooltips.hpp" #include "../mwgui/window_manager.hpp" #include "../mwrender/objects.hpp" +#include "../mwrender/renderinginterface.hpp" #include "../mwsound/soundmanager.hpp" @@ -24,7 +25,7 @@ namespace MWClass { void Clothing::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); @@ -40,7 +41,7 @@ namespace MWClass void Clothing::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); @@ -54,7 +55,7 @@ namespace MWClass std::string Clothing::getName (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->name; @@ -71,7 +72,7 @@ namespace MWClass std::string Clothing::getScript (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->script; @@ -79,7 +80,7 @@ namespace MWClass std::pair, bool> Clothing::getEquipmentSlots (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); std::vector slots; @@ -119,7 +120,7 @@ namespace MWClass int Clothing::getEquipmentSkill (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); if (ref->base->data.type==ESM::Clothing::Shoes) @@ -130,7 +131,7 @@ namespace MWClass int Clothing::getValue (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->data.value; @@ -145,7 +146,7 @@ namespace MWClass std::string Clothing::getUpSoundId (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); if (ref->base->data.type == 8) @@ -157,7 +158,7 @@ namespace MWClass std::string Clothing::getDownSoundId (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); if (ref->base->data.type == 8) @@ -169,7 +170,7 @@ namespace MWClass std::string Clothing::getInventoryIcon (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->icon; @@ -177,7 +178,7 @@ namespace MWClass bool Clothing::hasToolTip (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return (ref->base->name != ""); @@ -185,7 +186,7 @@ namespace MWClass MWGui::ToolTipInfo Clothing::getToolTipInfo (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); MWGui::ToolTipInfo info; @@ -213,7 +214,7 @@ namespace MWClass std::string Clothing::getEnchantment (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->enchant; diff --git a/apps/openmw/mwclass/container.cpp b/apps/openmw/mwclass/container.cpp index 99a32fc32..8dd27db42 100644 --- a/apps/openmw/mwclass/container.cpp +++ b/apps/openmw/mwclass/container.cpp @@ -3,21 +3,22 @@ #include -#include - #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/nullaction.hpp" #include "../mwworld/containerstore.hpp" #include "../mwworld/customdata.hpp" -#include "../mwworld/world.hpp" +#include "../mwworld/cellstore.hpp" +#include "../mwworld/actionopen.hpp" +#include "../mwworld/physicssystem.hpp" #include "../mwgui/window_manager.hpp" #include "../mwgui/tooltips.hpp" #include "../mwrender/objects.hpp" -#include "../mwworld/actionopen.hpp" +#include "../mwrender/renderinginterface.hpp" #include "../mwsound/soundmanager.hpp" @@ -53,7 +54,7 @@ namespace MWClass void Container::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); @@ -69,7 +70,7 @@ namespace MWClass void Container::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); @@ -117,7 +118,7 @@ namespace MWClass std::string Container::getName (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->name; @@ -133,7 +134,7 @@ namespace MWClass std::string Container::getScript (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->script; @@ -148,7 +149,7 @@ namespace MWClass bool Container::hasToolTip (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return (ref->base->name != ""); @@ -156,7 +157,7 @@ namespace MWClass MWGui::ToolTipInfo Container::getToolTipInfo (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); MWGui::ToolTipInfo info; @@ -182,7 +183,7 @@ namespace MWClass float Container::getCapacity (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->weight; diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index c9b43896b..a5a4f337a 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -13,8 +13,12 @@ #include "../mwworld/actiontalk.hpp" #include "../mwworld/customdata.hpp" #include "../mwworld/containerstore.hpp" +#include "../mwworld/physicssystem.hpp" + +#include "../mwrender/renderinginterface.hpp" #include "../mwgui/window_manager.hpp" +#include "../mwgui/tooltips.hpp" namespace { @@ -40,7 +44,7 @@ namespace MWClass { std::auto_ptr data (new CustomData); - ESMS::LiveCellRef *ref = ptr.get(); + MWWorld::LiveCellRef *ref = ptr.get(); // creature stats data->mCreatureStats.mAttributes[0].set (ref->base->data.strength); @@ -69,7 +73,7 @@ namespace MWClass std::string Creature::getId (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->mId; @@ -83,7 +87,7 @@ namespace MWClass void Creature::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); const std::string &model = ref->base->model; @@ -97,7 +101,7 @@ namespace MWClass std::string Creature::getName (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->name; @@ -126,7 +130,7 @@ namespace MWClass std::string Creature::getScript (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->script; @@ -148,7 +152,7 @@ namespace MWClass MWGui::ToolTipInfo Creature::getToolTipInfo (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); MWGui::ToolTipInfo info; diff --git a/apps/openmw/mwclass/door.cpp b/apps/openmw/mwclass/door.cpp index 7041de1c6..b0bba2c03 100644 --- a/apps/openmw/mwclass/door.cpp +++ b/apps/openmw/mwclass/door.cpp @@ -3,20 +3,21 @@ #include -#include - #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/player.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/nullaction.hpp" #include "../mwworld/actionteleport.hpp" -#include "../mwworld/world.hpp" +#include "../mwworld/cellstore.hpp" +#include "../mwworld/physicssystem.hpp" #include "../mwgui/window_manager.hpp" #include "../mwgui/tooltips.hpp" #include "../mwrender/objects.hpp" +#include "../mwrender/renderinginterface.hpp" #include "../mwsound/soundmanager.hpp" @@ -24,7 +25,7 @@ namespace MWClass { void Door::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); @@ -40,7 +41,7 @@ namespace MWClass void Door::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); const std::string &model = ref->base->model; @@ -52,7 +53,7 @@ namespace MWClass std::string Door::getName (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); if (ref->ref.teleport && !ref->ref.destCell.empty()) // TODO doors that lead to exteriors @@ -64,7 +65,7 @@ namespace MWClass boost::shared_ptr Door::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); const std::string &openSound = ref->base->openSound; @@ -134,7 +135,7 @@ namespace MWClass std::string Door::getScript (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->script; @@ -149,7 +150,7 @@ namespace MWClass bool Door::hasToolTip (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return (ref->base->name != ""); @@ -157,7 +158,7 @@ namespace MWClass MWGui::ToolTipInfo Door::getToolTipInfo (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); MWGui::ToolTipInfo info; diff --git a/apps/openmw/mwclass/ingredient.cpp b/apps/openmw/mwclass/ingredient.cpp index 0c7fa7e69..01146fe67 100644 --- a/apps/openmw/mwclass/ingredient.cpp +++ b/apps/openmw/mwclass/ingredient.cpp @@ -3,18 +3,19 @@ #include -#include - #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" -#include "../mwworld/world.hpp" +#include "../mwworld/cellstore.hpp" +#include "../mwworld/physicssystem.hpp" #include "../mwgui/window_manager.hpp" #include "../mwgui/tooltips.hpp" #include "../mwrender/objects.hpp" +#include "../mwrender/renderinginterface.hpp" #include "../mwsound/soundmanager.hpp" @@ -22,7 +23,7 @@ namespace MWClass { void Ingredient::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); @@ -38,7 +39,7 @@ namespace MWClass void Ingredient::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); const std::string &model = ref->base->model; @@ -50,7 +51,7 @@ namespace MWClass std::string Ingredient::getName (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->name; @@ -67,7 +68,7 @@ namespace MWClass std::string Ingredient::getScript (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->script; @@ -75,7 +76,7 @@ namespace MWClass int Ingredient::getValue (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->data.value; @@ -100,7 +101,7 @@ namespace MWClass std::string Ingredient::getInventoryIcon (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->icon; @@ -108,7 +109,7 @@ namespace MWClass bool Ingredient::hasToolTip (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return (ref->base->name != ""); @@ -116,7 +117,7 @@ namespace MWClass MWGui::ToolTipInfo Ingredient::getToolTipInfo (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); MWGui::ToolTipInfo info; diff --git a/apps/openmw/mwclass/light.cpp b/apps/openmw/mwclass/light.cpp index 154033433..15cd89ac2 100644 --- a/apps/openmw/mwclass/light.cpp +++ b/apps/openmw/mwclass/light.cpp @@ -3,16 +3,16 @@ #include -#include - #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" #include "../mwworld/actionequip.hpp" #include "../mwworld/nullaction.hpp" #include "../mwworld/inventorystore.hpp" -#include "../mwworld/world.hpp" +#include "../mwworld/cellstore.hpp" +#include "../mwworld/physicssystem.hpp" #include "../mwgui/window_manager.hpp" #include "../mwgui/tooltips.hpp" @@ -20,12 +20,13 @@ #include "../mwsound/soundmanager.hpp" #include "../mwrender/objects.hpp" +#include "../mwrender/renderinginterface.hpp" namespace MWClass { void Light::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); @@ -47,7 +48,7 @@ namespace MWClass void Light::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); @@ -65,7 +66,7 @@ namespace MWClass std::string Light::getName (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); if (ref->base->model.empty()) @@ -77,7 +78,7 @@ namespace MWClass boost::shared_ptr Light::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); if (!(ref->base->data.flags & ESM::Light::Carry)) @@ -91,7 +92,7 @@ namespace MWClass std::string Light::getScript (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->script; @@ -99,7 +100,7 @@ namespace MWClass std::pair, bool> Light::getEquipmentSlots (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); std::vector slots; @@ -112,7 +113,7 @@ namespace MWClass int Light::getValue (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->data.value; @@ -138,7 +139,7 @@ namespace MWClass std::string Light::getInventoryIcon (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->icon; @@ -146,7 +147,7 @@ namespace MWClass bool Light::hasToolTip (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return (ref->base->name != ""); @@ -154,7 +155,7 @@ namespace MWClass MWGui::ToolTipInfo Light::getToolTipInfo (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); MWGui::ToolTipInfo info; diff --git a/apps/openmw/mwclass/lockpick.cpp b/apps/openmw/mwclass/lockpick.cpp index 27e292bc0..d3d60315f 100644 --- a/apps/openmw/mwclass/lockpick.cpp +++ b/apps/openmw/mwclass/lockpick.cpp @@ -3,19 +3,21 @@ #include -#include - #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" #include "../mwworld/actionequip.hpp" #include "../mwworld/inventorystore.hpp" -#include "../mwworld/world.hpp" +#include "../mwworld/cellstore.hpp" +#include "../mwworld/physicssystem.hpp" + #include "../mwgui/window_manager.hpp" #include "../mwgui/tooltips.hpp" #include "../mwrender/objects.hpp" +#include "../mwrender/renderinginterface.hpp" #include "../mwsound/soundmanager.hpp" @@ -23,7 +25,7 @@ namespace MWClass { void Lockpick::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); @@ -39,7 +41,7 @@ namespace MWClass void Lockpick::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); @@ -54,7 +56,7 @@ namespace MWClass std::string Lockpick::getName (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->name; @@ -71,7 +73,7 @@ namespace MWClass std::string Lockpick::getScript (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->script; @@ -88,7 +90,7 @@ namespace MWClass int Lockpick::getValue (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->data.value; @@ -113,7 +115,7 @@ namespace MWClass std::string Lockpick::getInventoryIcon (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->icon; @@ -121,7 +123,7 @@ namespace MWClass bool Lockpick::hasToolTip (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return (ref->base->name != ""); @@ -129,7 +131,7 @@ namespace MWClass MWGui::ToolTipInfo Lockpick::getToolTipInfo (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); MWGui::ToolTipInfo info; diff --git a/apps/openmw/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp index d8e0553b9..8484a5dd1 100644 --- a/apps/openmw/mwclass/misc.cpp +++ b/apps/openmw/mwclass/misc.cpp @@ -5,18 +5,19 @@ #include -#include - #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" -#include "../mwworld/world.hpp" +#include "../mwworld/cellstore.hpp" +#include "../mwworld/physicssystem.hpp" #include "../mwgui/window_manager.hpp" #include "../mwgui/tooltips.hpp" #include "../mwrender/objects.hpp" +#include "../mwrender/renderinginterface.hpp" #include "../mwsound/soundmanager.hpp" @@ -26,7 +27,7 @@ namespace MWClass { void Miscellaneous::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); @@ -42,7 +43,7 @@ namespace MWClass void Miscellaneous::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); @@ -56,7 +57,7 @@ namespace MWClass std::string Miscellaneous::getName (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->name; @@ -73,7 +74,7 @@ namespace MWClass std::string Miscellaneous::getScript (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->script; @@ -81,7 +82,7 @@ namespace MWClass int Miscellaneous::getValue (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->data.value; @@ -96,7 +97,7 @@ namespace MWClass std::string Miscellaneous::getUpSoundId (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); if (ref->base->name == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str) @@ -108,7 +109,7 @@ namespace MWClass std::string Miscellaneous::getDownSoundId (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); if (ref->base->name == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str) @@ -120,7 +121,7 @@ namespace MWClass std::string Miscellaneous::getInventoryIcon (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->icon; @@ -128,7 +129,7 @@ namespace MWClass bool Miscellaneous::hasToolTip (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return (ref->base->name != ""); @@ -136,7 +137,7 @@ namespace MWClass MWGui::ToolTipInfo Miscellaneous::getToolTipInfo (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); MWGui::ToolTipInfo info; diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index f30e164f9..d4f711885 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -9,6 +9,9 @@ #include +#include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" + #include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/movement.hpp" @@ -16,13 +19,15 @@ #include "../mwworld/ptr.hpp" #include "../mwworld/actiontalk.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/inventorystore.hpp" #include "../mwworld/customdata.hpp" +#include "../mwworld/physicssystem.hpp" -#include "../mwgui/window_manager.hpp" +#include "../mwrender/actors.hpp" +#include "../mwrender/renderinginterface.hpp" -#include "../mwbase/environment.hpp" +#include "../mwgui/window_manager.hpp" +#include "../mwgui/tooltips.hpp" namespace { @@ -53,7 +58,7 @@ namespace MWClass { std::auto_ptr data (new CustomData); - ESMS::LiveCellRef *ref = ptr.get(); + MWWorld::LiveCellRef *ref = ptr.get(); // NPC stats if (!ref->base->faction.empty()) @@ -107,7 +112,7 @@ namespace MWClass std::string Npc::getId (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->mId; @@ -120,7 +125,7 @@ namespace MWClass void Npc::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); @@ -138,7 +143,7 @@ namespace MWClass std::string Npc::getName (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->name; @@ -182,7 +187,7 @@ namespace MWClass std::string Npc::getScript (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->script; @@ -302,7 +307,7 @@ namespace MWClass MWGui::ToolTipInfo Npc::getToolTipInfo (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); MWGui::ToolTipInfo info; diff --git a/apps/openmw/mwclass/potion.cpp b/apps/openmw/mwclass/potion.cpp index 157af01f5..5b446fbe9 100644 --- a/apps/openmw/mwclass/potion.cpp +++ b/apps/openmw/mwclass/potion.cpp @@ -3,18 +3,19 @@ #include -#include - #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" -#include "../mwworld/world.hpp" +#include "../mwworld/cellstore.hpp" +#include "../mwworld/physicssystem.hpp" #include "../mwgui/window_manager.hpp" #include "../mwgui/tooltips.hpp" #include "../mwrender/objects.hpp" +#include "../mwrender/renderinginterface.hpp" #include "../mwsound/soundmanager.hpp" @@ -22,7 +23,7 @@ namespace MWClass { void Potion::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); @@ -38,7 +39,7 @@ namespace MWClass void Potion::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); @@ -52,7 +53,7 @@ namespace MWClass std::string Potion::getName (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->name; @@ -69,7 +70,7 @@ namespace MWClass std::string Potion::getScript (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->script; @@ -77,7 +78,7 @@ namespace MWClass int Potion::getValue (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->data.value; @@ -102,7 +103,7 @@ namespace MWClass std::string Potion::getInventoryIcon (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->icon; @@ -110,7 +111,7 @@ namespace MWClass bool Potion::hasToolTip (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return (ref->base->name != ""); @@ -118,7 +119,7 @@ namespace MWClass MWGui::ToolTipInfo Potion::getToolTipInfo (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); MWGui::ToolTipInfo info; diff --git a/apps/openmw/mwclass/probe.cpp b/apps/openmw/mwclass/probe.cpp index 0b256d729..f3a8406f5 100644 --- a/apps/openmw/mwclass/probe.cpp +++ b/apps/openmw/mwclass/probe.cpp @@ -3,19 +3,21 @@ #include -#include - #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" #include "../mwworld/actionequip.hpp" #include "../mwworld/inventorystore.hpp" -#include "../mwworld/world.hpp" +#include "../mwworld/cellstore.hpp" +#include "../mwworld/physicssystem.hpp" + #include "../mwgui/window_manager.hpp" #include "../mwgui/tooltips.hpp" #include "../mwrender/objects.hpp" +#include "../mwrender/renderinginterface.hpp" #include "../mwsound/soundmanager.hpp" @@ -23,7 +25,7 @@ namespace MWClass { void Probe::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); @@ -39,7 +41,7 @@ namespace MWClass void Probe::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); @@ -54,7 +56,7 @@ namespace MWClass std::string Probe::getName (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->name; @@ -70,7 +72,7 @@ namespace MWClass std::string Probe::getScript (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->script; @@ -87,7 +89,7 @@ namespace MWClass int Probe::getValue (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->data.value; @@ -112,7 +114,7 @@ namespace MWClass std::string Probe::getInventoryIcon (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->icon; @@ -120,7 +122,7 @@ namespace MWClass bool Probe::hasToolTip (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return (ref->base->name != ""); @@ -128,7 +130,7 @@ namespace MWClass MWGui::ToolTipInfo Probe::getToolTipInfo (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); MWGui::ToolTipInfo info; diff --git a/apps/openmw/mwclass/repair.cpp b/apps/openmw/mwclass/repair.cpp index 5666a95a5..464ba1091 100644 --- a/apps/openmw/mwclass/repair.cpp +++ b/apps/openmw/mwclass/repair.cpp @@ -3,17 +3,19 @@ #include -#include - #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" -#include "../mwworld/world.hpp" +#include "../mwworld/cellstore.hpp" +#include "../mwworld/physicssystem.hpp" + #include "../mwgui/window_manager.hpp" #include "../mwgui/tooltips.hpp" #include "../mwrender/objects.hpp" +#include "../mwrender/renderinginterface.hpp" #include "../mwsound/soundmanager.hpp" @@ -21,7 +23,7 @@ namespace MWClass { void Repair::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); @@ -37,7 +39,7 @@ namespace MWClass void Repair::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); @@ -51,7 +53,7 @@ namespace MWClass std::string Repair::getName (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->name; @@ -68,7 +70,7 @@ namespace MWClass std::string Repair::getScript (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->script; @@ -76,7 +78,7 @@ namespace MWClass int Repair::getValue (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->data.value; @@ -101,7 +103,7 @@ namespace MWClass std::string Repair::getInventoryIcon (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->icon; @@ -109,7 +111,7 @@ namespace MWClass bool Repair::hasToolTip (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return (ref->base->name != ""); @@ -117,7 +119,7 @@ namespace MWClass MWGui::ToolTipInfo Repair::getToolTipInfo (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); MWGui::ToolTipInfo info; diff --git a/apps/openmw/mwclass/static.cpp b/apps/openmw/mwclass/static.cpp index 4a4136816..9b166b076 100644 --- a/apps/openmw/mwclass/static.cpp +++ b/apps/openmw/mwclass/static.cpp @@ -4,14 +4,16 @@ #include #include "../mwworld/ptr.hpp" +#include "../mwworld/physicssystem.hpp" #include "../mwrender/objects.hpp" +#include "../mwrender/renderinginterface.hpp" namespace MWClass { void Static::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); @@ -27,7 +29,7 @@ namespace MWClass void Static::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); diff --git a/apps/openmw/mwclass/weapon.cpp b/apps/openmw/mwclass/weapon.cpp index 482d618b0..099312d2c 100644 --- a/apps/openmw/mwclass/weapon.cpp +++ b/apps/openmw/mwclass/weapon.cpp @@ -3,20 +3,21 @@ #include -#include - #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" #include "../mwworld/actionequip.hpp" #include "../mwworld/inventorystore.hpp" -#include "../mwworld/world.hpp" +#include "../mwworld/cellstore.hpp" +#include "../mwworld/physicssystem.hpp" #include "../mwgui/window_manager.hpp" #include "../mwgui/tooltips.hpp" #include "../mwrender/objects.hpp" +#include "../mwrender/renderinginterface.hpp" #include "../mwsound/soundmanager.hpp" @@ -24,7 +25,7 @@ namespace MWClass { void Weapon::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); @@ -40,7 +41,7 @@ namespace MWClass void Weapon::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); @@ -54,7 +55,7 @@ namespace MWClass std::string Weapon::getName (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->name; @@ -76,7 +77,7 @@ namespace MWClass int Weapon::getItemMaxHealth (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->data.health; @@ -84,7 +85,7 @@ namespace MWClass std::string Weapon::getScript (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->script; @@ -92,7 +93,7 @@ namespace MWClass std::pair, bool> Weapon::getEquipmentSlots (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); std::vector slots; @@ -116,7 +117,7 @@ namespace MWClass int Weapon::getEquipmentSkill (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); const int size = 12; @@ -146,7 +147,7 @@ namespace MWClass int Weapon::getValue (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->data.value; @@ -161,7 +162,7 @@ namespace MWClass std::string Weapon::getUpSoundId (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); int type = ref->base->data.type; @@ -207,7 +208,7 @@ namespace MWClass std::string Weapon::getDownSoundId (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); int type = ref->base->data.type; @@ -253,7 +254,7 @@ namespace MWClass std::string Weapon::getInventoryIcon (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->icon; @@ -261,7 +262,7 @@ namespace MWClass bool Weapon::hasToolTip (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return (ref->base->name != ""); @@ -269,7 +270,7 @@ namespace MWClass MWGui::ToolTipInfo Weapon::getToolTipInfo (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); MWGui::ToolTipInfo info; @@ -351,7 +352,7 @@ namespace MWClass std::string Weapon::getEnchantment (const MWWorld::Ptr& ptr) const { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); return ref->base->enchant; diff --git a/apps/openmw/mwdialogue/dialoguemanager.cpp b/apps/openmw/mwdialogue/dialoguemanager.cpp index 45e2c8cb3..98562c053 100644 --- a/apps/openmw/mwdialogue/dialoguemanager.cpp +++ b/apps/openmw/mwdialogue/dialoguemanager.cpp @@ -10,9 +10,9 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/class.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/refdata.hpp" #include "../mwworld/player.hpp" #include "../mwworld/containerstore.hpp" @@ -121,24 +121,24 @@ namespace } template - bool checkGlobal (char comp, const std::string& name, T value, MWWorld::World& world) + bool checkGlobal (char comp, const std::string& name, T value) { - switch (world.getGlobalVariableType (name)) + switch (MWBase::Environment::get().getWorld()->getGlobalVariableType (name)) { case 's': - return selectCompare (comp, world.getGlobalVariable (name).mShort, value); + return selectCompare (comp, MWBase::Environment::get().getWorld()->getGlobalVariable (name).mShort, value); case 'l': - return selectCompare (comp, world.getGlobalVariable (name).mLong, value); + return selectCompare (comp, MWBase::Environment::get().getWorld()->getGlobalVariable (name).mLong, value); case 'f': - return selectCompare (comp, world.getGlobalVariable (name).mFloat, value); + return selectCompare (comp, MWBase::Environment::get().getWorld()->getGlobalVariable (name).mFloat, value); case ' ': - world.getGlobalVariable (name); // trigger exception + MWBase::Environment::get().getWorld()->getGlobalVariable (name); // trigger exception break; default: @@ -309,12 +309,12 @@ namespace MWDialogue if (select.type==ESM::VT_Short || select.type==ESM::VT_Int || select.type==ESM::VT_Long) { - if (!checkGlobal (comp, toLower (name), select.i, *MWBase::Environment::get().getWorld())) + if (!checkGlobal (comp, toLower (name), select.i)) return false; } else if (select.type==ESM::VT_Float) { - if (!checkGlobal (comp, toLower (name), select.f, *MWBase::Environment::get().getWorld())) + if (!checkGlobal (comp, toLower (name), select.f)) return false; } else @@ -392,7 +392,7 @@ namespace MWDialogue if(select.type==ESM::VT_Int) { - ESMS::LiveCellRef* npc = actor.get(); + MWWorld::LiveCellRef* npc = actor.get(); int isFaction = int(toLower(npc->base->faction) == toLower(name)); if(selectCompare(comp,!isFaction,select.i)) return false; @@ -409,7 +409,7 @@ namespace MWDialogue if(select.type==ESM::VT_Int) { - ESMS::LiveCellRef* npc = actor.get(); + MWWorld::LiveCellRef* npc = actor.get(); int isClass = int(toLower(npc->base->cls) == toLower(name)); if(selectCompare(comp,!isClass,select.i)) return false; @@ -426,7 +426,7 @@ namespace MWDialogue if(select.type==ESM::VT_Int) { - ESMS::LiveCellRef* npc = actor.get(); + MWWorld::LiveCellRef* npc = actor.get(); int isRace = int(toLower(npc->base->race) == toLower(name)); if(selectCompare(comp,!isRace,select.i)) return false; @@ -493,7 +493,7 @@ namespace MWDialogue if (isCreature) return false; - ESMS::LiveCellRef *cellRef = actor.get(); + MWWorld::LiveCellRef *cellRef = actor.get(); if (!cellRef) return false; @@ -508,7 +508,7 @@ namespace MWDialogue if (isCreature) return false; - ESMS::LiveCellRef *cellRef = actor.get(); + MWWorld::LiveCellRef *cellRef = actor.get(); if (!cellRef) return false; @@ -558,7 +558,7 @@ namespace MWDialogue //check gender if (!isCreature) { - ESMS::LiveCellRef* npc = actor.get(); + MWWorld::LiveCellRef* npc = actor.get(); if(npc->base->flags&npc->base->Female) { if(static_cast (info.data.gender)==0) return false; @@ -771,13 +771,13 @@ namespace MWDialogue int services = 0; if (mActor.getTypeName() == typeid(ESM::NPC).name()) { - ESMS::LiveCellRef* ref = mActor.get(); + MWWorld::LiveCellRef* ref = mActor.get(); if (ref->base->hasAI) services = ref->base->AI.services; } else if (mActor.getTypeName() == typeid(ESM::Creature).name()) { - ESMS::LiveCellRef* ref = mActor.get(); + MWWorld::LiveCellRef* ref = mActor.get(); if (ref->base->hasAI) services = ref->base->AI.services; } diff --git a/apps/openmw/mwdialogue/journal.cpp b/apps/openmw/mwdialogue/journal.cpp index eb828a76c..ad10be3aa 100644 --- a/apps/openmw/mwdialogue/journal.cpp +++ b/apps/openmw/mwdialogue/journal.cpp @@ -2,12 +2,11 @@ #include "journal.hpp" #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwgui/window_manager.hpp" #include "../mwgui/messagebox.hpp" -#include "../mwworld/world.hpp" - namespace MWDialogue { Quest& Journal::getQuest (const std::string& id) @@ -30,14 +29,13 @@ namespace MWDialogue void Journal::addEntry (const std::string& id, int index) { - StampedJournalEntry entry = - StampedJournalEntry::makeFromQuest (id, index, *MWBase::Environment::get().getWorld()); + StampedJournalEntry entry = StampedJournalEntry::makeFromQuest (id, index); mJournal.push_back (entry); Quest& quest = getQuest (id); - quest.addEntry (entry, *MWBase::Environment::get().getWorld()); // we are doing slicing on purpose here + quest.addEntry (entry); // we are doing slicing on purpose here std::vector empty; std::string notification = MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sJournalEntry")->str; @@ -48,7 +46,7 @@ namespace MWDialogue { Quest& quest = getQuest (id); - quest.setIndex (index, *MWBase::Environment::get().getWorld()); + quest.setIndex (index); } void Journal::addTopic (const std::string& topicId, const std::string& infoId) @@ -63,7 +61,7 @@ namespace MWDialogue iter = result.first; } - iter->second.addEntry (JournalEntry (topicId, infoId), *MWBase::Environment::get().getWorld()); + iter->second.addEntry (JournalEntry (topicId, infoId)); } int Journal::getJournalIndex (const std::string& id) const diff --git a/apps/openmw/mwdialogue/journalentry.cpp b/apps/openmw/mwdialogue/journalentry.cpp index 4eb6b8001..9d58687e1 100644 --- a/apps/openmw/mwdialogue/journalentry.cpp +++ b/apps/openmw/mwdialogue/journalentry.cpp @@ -5,7 +5,8 @@ #include -#include "../mwworld/world.hpp" +#include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" namespace MWDialogue { @@ -27,16 +28,14 @@ namespace MWDialogue throw std::runtime_error ("unknown info ID " + mInfoId + " for topic " + mTopic); } - JournalEntry JournalEntry::makeFromQuest (const std::string& topic, int index, - const MWWorld::World& world) + JournalEntry JournalEntry::makeFromQuest (const std::string& topic, int index) { - return JournalEntry (topic, idFromIndex (topic, index, world)); + return JournalEntry (topic, idFromIndex (topic, index)); } - std::string JournalEntry::idFromIndex (const std::string& topic, int index, - const MWWorld::World& world) + std::string JournalEntry::idFromIndex (const std::string& topic, int index) { - const ESM::Dialogue *dialogue = world.getStore().dialogs.find (topic); + const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (topic); for (std::vector::const_iterator iter (dialogue->mInfo.begin()); iter!=dialogue->mInfo.end(); ++iter) @@ -57,13 +56,12 @@ namespace MWDialogue : JournalEntry (topic, infoId), mDay (day), mMonth (month), mDayOfMonth (dayOfMonth) {} - StampedJournalEntry StampedJournalEntry::makeFromQuest (const std::string& topic, int index, - const MWWorld::World& world) + StampedJournalEntry StampedJournalEntry::makeFromQuest (const std::string& topic, int index) { - int day = world.getGlobalVariable ("dayspassed").mLong; - int month = world.getGlobalVariable ("day").mLong; - int dayOfMonth = world.getGlobalVariable ("month").mLong; + int day = MWBase::Environment::get().getWorld()->getGlobalVariable ("dayspassed").mLong; + int month = MWBase::Environment::get().getWorld()->getGlobalVariable ("day").mLong; + int dayOfMonth = MWBase::Environment::get().getWorld()->getGlobalVariable ("month").mLong; - return StampedJournalEntry (topic, idFromIndex (topic, index, world), day, month, dayOfMonth); + return StampedJournalEntry (topic, idFromIndex (topic, index), day, month, dayOfMonth); } } diff --git a/apps/openmw/mwdialogue/journalentry.hpp b/apps/openmw/mwdialogue/journalentry.hpp index 11b715630..9a3270439 100644 --- a/apps/openmw/mwdialogue/journalentry.hpp +++ b/apps/openmw/mwdialogue/journalentry.hpp @@ -8,11 +8,6 @@ namespace ESMS struct ESMStore; } -namespace MWWorld -{ - class World; -} - namespace MWDialogue { /// \brief A quest or dialogue entry @@ -27,11 +22,9 @@ namespace MWDialogue std::string getText (const ESMS::ESMStore& store) const; - static JournalEntry makeFromQuest (const std::string& topic, int index, - const MWWorld::World& world); + static JournalEntry makeFromQuest (const std::string& topic, int index); - static std::string idFromIndex (const std::string& topic, int index, - const MWWorld::World& world); + static std::string idFromIndex (const std::string& topic, int index); }; /// \biref A quest entry with a timestamp. @@ -46,8 +39,7 @@ namespace MWDialogue StampedJournalEntry (const std::string& topic, const std::string& infoId, int day, int month, int dayOfMonth); - static StampedJournalEntry makeFromQuest (const std::string& topic, int index, - const MWWorld::World& world); + static StampedJournalEntry makeFromQuest (const std::string& topic, int index); }; } diff --git a/apps/openmw/mwdialogue/quest.cpp b/apps/openmw/mwdialogue/quest.cpp index 1f387e862..484c2c19c 100644 --- a/apps/openmw/mwdialogue/quest.cpp +++ b/apps/openmw/mwdialogue/quest.cpp @@ -3,7 +3,8 @@ #include -#include "../mwworld/world.hpp" +#include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" namespace MWDialogue { @@ -15,9 +16,9 @@ namespace MWDialogue : Topic (topic), mIndex (0), mFinished (false) {} - const std::string Quest::getName (const MWWorld::World& world) const + const std::string Quest::getName() const { - const ESM::Dialogue *dialogue = world.getStore().dialogs.find (mTopic); + const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (mTopic); for (std::vector::const_iterator iter (dialogue->mInfo.begin()); iter!=dialogue->mInfo.end(); ++iter) @@ -32,9 +33,9 @@ namespace MWDialogue return mIndex; } - void Quest::setIndex (int index, const MWWorld::World& world) + void Quest::setIndex (int index) { - const ESM::Dialogue *dialogue = world.getStore().dialogs.find (mTopic); + const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (mTopic); for (std::vector::const_iterator iter (dialogue->mInfo.begin()); iter!=dialogue->mInfo.end(); ++iter) @@ -58,11 +59,11 @@ namespace MWDialogue return mFinished; } - void Quest::addEntry (const JournalEntry& entry, const MWWorld::World& world) + void Quest::addEntry (const JournalEntry& entry) { int index = -1; - const ESM::Dialogue *dialogue = world.getStore().dialogs.find (entry.mTopic); + const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (entry.mTopic); for (std::vector::const_iterator iter (dialogue->mInfo.begin()); iter!=dialogue->mInfo.end(); ++iter) @@ -75,7 +76,7 @@ namespace MWDialogue if (index==-1) throw std::runtime_error ("unknown journal entry for topic " + mTopic); - setIndex (index, world); + setIndex (index); for (TEntryIter iter (mEntries.begin()); iter!=mEntries.end(); ++iter) if (*iter==entry.mInfoId) diff --git a/apps/openmw/mwdialogue/quest.hpp b/apps/openmw/mwdialogue/quest.hpp index c162c03f4..5fcc894ea 100644 --- a/apps/openmw/mwdialogue/quest.hpp +++ b/apps/openmw/mwdialogue/quest.hpp @@ -17,17 +17,17 @@ namespace MWDialogue Quest (const std::string& topic); - const std::string getName (const MWWorld::World& world) const; + const std::string getName() const; ///< May be an empty string int getIndex() const; - void setIndex (int index, const MWWorld::World& world); + void setIndex (int index); ///< Calling this function with a non-existant index while throw an exception. bool isFinished() const; - virtual void addEntry (const JournalEntry& entry, const MWWorld::World& world); + virtual void addEntry (const JournalEntry& entry); ///< Add entry and adjust index accordingly. /// /// \note Redundant entries are ignored, but the index is still adjusted. diff --git a/apps/openmw/mwdialogue/topic.cpp b/apps/openmw/mwdialogue/topic.cpp index 8f165d3c8..8c1dfafb8 100644 --- a/apps/openmw/mwdialogue/topic.cpp +++ b/apps/openmw/mwdialogue/topic.cpp @@ -3,8 +3,6 @@ #include -#include "../mwworld/world.hpp" - namespace MWDialogue { Topic::Topic() @@ -17,7 +15,7 @@ namespace MWDialogue Topic::~Topic() {} - void Topic::addEntry (const JournalEntry& entry, const MWWorld::World& world) + void Topic::addEntry (const JournalEntry& entry) { if (entry.mTopic!=mTopic) throw std::runtime_error ("topic does not match: " + mTopic); diff --git a/apps/openmw/mwdialogue/topic.hpp b/apps/openmw/mwdialogue/topic.hpp index c085f1ed9..3ad15903f 100644 --- a/apps/openmw/mwdialogue/topic.hpp +++ b/apps/openmw/mwdialogue/topic.hpp @@ -6,11 +6,6 @@ #include "journalentry.hpp" -namespace MWWorld -{ - class World; -} - namespace MWDialogue { /// \brief Collection of seen responses for a topic @@ -34,7 +29,7 @@ namespace MWDialogue virtual ~Topic(); - virtual void addEntry (const JournalEntry& entry, const MWWorld::World& world); + virtual void addEntry (const JournalEntry& entry); ///< Add entry /// /// \note Redundant entries are ignored. diff --git a/apps/openmw/mwgui/alchemywindow.cpp b/apps/openmw/mwgui/alchemywindow.cpp index 423678eed..9d691d371 100644 --- a/apps/openmw/mwgui/alchemywindow.cpp +++ b/apps/openmw/mwgui/alchemywindow.cpp @@ -3,10 +3,12 @@ #include #include "../mwbase/environment.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" + #include "../mwworld/player.hpp" #include "../mwworld/manualref.hpp" #include "../mwworld/containerstore.hpp" + #include "../mwsound/soundmanager.hpp" #include "window_manager.hpp" @@ -27,7 +29,7 @@ namespace namespace MWGui { AlchemyWindow::AlchemyWindow(WindowManager& parWindowManager) - : WindowBase("openmw_alchemy_window_layout.xml", parWindowManager) + : WindowBase("openmw_alchemy_window.layout", parWindowManager) , ContainerBase(0) { getWidget(mCreateButton, "CreateButton"); @@ -275,7 +277,7 @@ namespace MWGui for (MWWorld::ContainerStoreIterator it(store.begin(MWWorld::ContainerStore::Type_Apparatus)); it != store.end(); ++it) { - ESMS::LiveCellRef* ref = it->get(); + MWWorld::LiveCellRef* ref = it->get(); if (ref->base->data.type == ESM::Apparatus::Albemic && (bestAlbemic.isEmpty() || ref->base->data.quality > bestAlbemic.get()->base->data.quality)) bestAlbemic = *it; @@ -420,7 +422,7 @@ namespace MWGui continue; // add the effects of this ingredient to list of effects - ESMS::LiveCellRef* ref = ingredient->getUserData()->get(); + MWWorld::LiveCellRef* ref = ingredient->getUserData()->get(); for (int i=0; i<4; ++i) { if (ref->base->data.effectID[i] < 0) diff --git a/apps/openmw/mwgui/alchemywindow.hpp b/apps/openmw/mwgui/alchemywindow.hpp index c01a18e41..81c33a96d 100644 --- a/apps/openmw/mwgui/alchemywindow.hpp +++ b/apps/openmw/mwgui/alchemywindow.hpp @@ -3,6 +3,7 @@ #include "window_base.hpp" #include "container.hpp" +#include "widgets.hpp" namespace MWGui { diff --git a/apps/openmw/mwgui/birth.cpp b/apps/openmw/mwgui/birth.cpp index 49f90d1a0..69056759d 100644 --- a/apps/openmw/mwgui/birth.cpp +++ b/apps/openmw/mwgui/birth.cpp @@ -10,7 +10,7 @@ using namespace MWGui; using namespace Widgets; BirthDialog::BirthDialog(WindowManager& parWindowManager) - : WindowBase("openmw_chargen_birth_layout.xml", parWindowManager) + : WindowBase("openmw_chargen_birth.layout", parWindowManager) { // Centre dialog center(); diff --git a/apps/openmw/mwgui/birth.hpp b/apps/openmw/mwgui/birth.hpp index b5f7db774..e61be736a 100644 --- a/apps/openmw/mwgui/birth.hpp +++ b/apps/openmw/mwgui/birth.hpp @@ -5,7 +5,7 @@ /* This file contains the dialog for choosing a birth sign. - Layout is defined by resources/mygui/openmw_chargen_race_layout.xml. + Layout is defined by resources/mygui/openmw_chargen_race.layout. */ namespace MWGui diff --git a/apps/openmw/mwgui/bookwindow.cpp b/apps/openmw/mwgui/bookwindow.cpp index a9dcd4555..1ea3da839 100644 --- a/apps/openmw/mwgui/bookwindow.cpp +++ b/apps/openmw/mwgui/bookwindow.cpp @@ -13,7 +13,7 @@ using namespace MWGui; BookWindow::BookWindow (WindowManager& parWindowManager) : - WindowBase("openmw_book_layout.xml", parWindowManager) + WindowBase("openmw_book.layout", parWindowManager) { getWidget(mCloseButton, "CloseButton"); mCloseButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BookWindow::onCloseButtonClicked); @@ -55,8 +55,7 @@ void BookWindow::open (MWWorld::Ptr book) MWBase::Environment::get().getSoundManager()->playSound ("book open", 1.0, 1.0); - ESMS::LiveCellRef *ref = - mBook.get(); + MWWorld::LiveCellRef *ref = mBook.get(); BookTextParser parser; std::vector results = parser.split(ref->base->text, mLeftPage->getSize().width, mLeftPage->getSize().height); diff --git a/apps/openmw/mwgui/charactercreation.hpp b/apps/openmw/mwgui/charactercreation.hpp index 02b48ffe2..e9c90877e 100644 --- a/apps/openmw/mwgui/charactercreation.hpp +++ b/apps/openmw/mwgui/charactercreation.hpp @@ -3,10 +3,12 @@ #include "window_manager.hpp" +#include + +#include "../mwbase/world.hpp" + #include "../mwmechanics/mechanicsmanager.hpp" #include "../mwmechanics/stat.hpp" -#include "../mwworld/world.hpp" -#include namespace MWGui { diff --git a/apps/openmw/mwgui/class.cpp b/apps/openmw/mwgui/class.cpp index 0961f6327..d0f21f945 100644 --- a/apps/openmw/mwgui/class.cpp +++ b/apps/openmw/mwgui/class.cpp @@ -19,7 +19,7 @@ using namespace MWGui; /* GenerateClassResultDialog */ GenerateClassResultDialog::GenerateClassResultDialog(WindowManager& parWindowManager) - : WindowBase("openmw_chargen_generate_class_result_layout.xml", parWindowManager) + : WindowBase("openmw_chargen_generate_class_result.layout", parWindowManager) { // Centre dialog center(); @@ -77,7 +77,7 @@ void GenerateClassResultDialog::onBackClicked(MyGUI::Widget* _sender) /* PickClassDialog */ PickClassDialog::PickClassDialog(WindowManager& parWindowManager) - : WindowBase("openmw_chargen_class_layout.xml", parWindowManager) + : WindowBase("openmw_chargen_class.layout", parWindowManager) { // Centre dialog center(); @@ -283,7 +283,7 @@ void InfoBoxDialog::layoutVertically(MyGUI::WidgetPtr widget, int margin) } InfoBoxDialog::InfoBoxDialog(WindowManager& parWindowManager) - : WindowBase("openmw_infobox_layout.xml", parWindowManager) + : WindowBase("openmw_infobox.layout", parWindowManager) , currentButton(-1) { getWidget(textBox, "TextBox"); @@ -381,7 +381,7 @@ ClassChoiceDialog::ClassChoiceDialog(WindowManager& parWindowManager) /* CreateClassDialog */ CreateClassDialog::CreateClassDialog(WindowManager& parWindowManager) - : WindowBase("openmw_chargen_create_class_layout.xml", parWindowManager) + : WindowBase("openmw_chargen_create_class.layout", parWindowManager) , specDialog(nullptr) , attribDialog(nullptr) , skillDialog(nullptr) @@ -703,7 +703,7 @@ void CreateClassDialog::onBackClicked(MyGUI::Widget* _sender) /* SelectSpecializationDialog */ SelectSpecializationDialog::SelectSpecializationDialog(WindowManager& parWindowManager) - : WindowBase("openmw_chargen_select_specialization_layout.xml", parWindowManager) + : WindowBase("openmw_chargen_select_specialization.layout", parWindowManager) { // Centre dialog center(); @@ -768,7 +768,7 @@ void SelectSpecializationDialog::onCancelClicked(MyGUI::Widget* _sender) /* SelectAttributeDialog */ SelectAttributeDialog::SelectAttributeDialog(WindowManager& parWindowManager) - : WindowBase("openmw_chargen_select_attribute_layout.xml", parWindowManager) + : WindowBase("openmw_chargen_select_attribute.layout", parWindowManager) { // Centre dialog center(); @@ -820,7 +820,7 @@ void SelectAttributeDialog::onCancelClicked(MyGUI::Widget* _sender) /* SelectSkillDialog */ SelectSkillDialog::SelectSkillDialog(WindowManager& parWindowManager) - : WindowBase("openmw_chargen_select_skill_layout.xml", parWindowManager) + : WindowBase("openmw_chargen_select_skill.layout", parWindowManager) { // Centre dialog center(); @@ -916,7 +916,7 @@ void SelectSkillDialog::onCancelClicked(MyGUI::Widget* _sender) /* DescriptionDialog */ DescriptionDialog::DescriptionDialog(WindowManager& parWindowManager) - : WindowBase("openmw_chargen_class_description_layout.xml", parWindowManager) + : WindowBase("openmw_chargen_class_description.layout", parWindowManager) { // Centre dialog center(); diff --git a/apps/openmw/mwgui/class.hpp b/apps/openmw/mwgui/class.hpp index 868052800..c9e7aef7b 100644 --- a/apps/openmw/mwgui/class.hpp +++ b/apps/openmw/mwgui/class.hpp @@ -7,7 +7,7 @@ /* This file contains the dialogs for choosing a class. - Layout is defined by resources/mygui/openmw_chargen_class_layout.xml. + Layout is defined by resources/mygui/openmw_chargen_class.layout. */ namespace MWGui diff --git a/apps/openmw/mwgui/confirmationdialog.cpp b/apps/openmw/mwgui/confirmationdialog.cpp index 5e12c3296..00bdca638 100644 --- a/apps/openmw/mwgui/confirmationdialog.cpp +++ b/apps/openmw/mwgui/confirmationdialog.cpp @@ -3,12 +3,12 @@ #include #include "../mwbase/environment.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" namespace MWGui { ConfirmationDialog::ConfirmationDialog(WindowManager& parWindowManager) : - WindowBase("openmw_confirmation_dialog_layout.xml", parWindowManager) + WindowBase("openmw_confirmation_dialog.layout", parWindowManager) { getWidget(mMessage, "Message"); getWidget(mOkButton, "OkButton"); diff --git a/apps/openmw/mwgui/console.cpp b/apps/openmw/mwgui/console.cpp index 8115835f4..4101165c1 100644 --- a/apps/openmw/mwgui/console.cpp +++ b/apps/openmw/mwgui/console.cpp @@ -3,6 +3,9 @@ #include +#include +#include + #include #include "../mwscript/extensions.hpp" @@ -103,7 +106,7 @@ namespace MWGui } Console::Console(int w, int h, const Compiler::Extensions& extensions) - : Layout("openmw_console_layout.xml"), + : Layout("openmw_console.layout"), mCompilerContext (MWScript::CompilerContext::Type_Console) { setCoord(10,10, w-10, h/2); diff --git a/apps/openmw/mwgui/container.cpp b/apps/openmw/mwgui/container.cpp index 36ed16b0e..44cb12d2d 100644 --- a/apps/openmw/mwgui/container.cpp +++ b/apps/openmw/mwgui/container.cpp @@ -3,19 +3,23 @@ #include #include #include -#include +#include #include #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" + #include "../mwworld/manualref.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/containerstore.hpp" #include "../mwworld/class.hpp" #include "../mwworld/player.hpp" + #include "../mwclass/container.hpp" + #include "../mwinput/inputmanager.hpp" + #include "../mwsound/soundmanager.hpp" #include "window_manager.hpp" @@ -273,7 +277,7 @@ void ContainerBase::onContainerClicked(MyGUI::Widget* _sender) // check the container's Organic flag (if this is a container). container with Organic flag doesn't allow putting items inside if (mPtr.getTypeName() == typeid(ESM::Container).name()) { - ESMS::LiveCellRef* ref = mPtr.get(); + MWWorld::LiveCellRef* ref = mPtr.get(); if (ref->base->flags & ESM::Container::Organic) { // user notification @@ -556,7 +560,7 @@ void ContainerBase::addItem(MWWorld::Ptr item, int count) { MWWorld::ContainerStore& containerStore = MWWorld::Class::get(mPtr).getContainerStore(mPtr); - int origCount = item.getRefData().getCount(); + int origCount = item.getRefData().getCount(); item.getRefData().setCount(count); MWWorld::ContainerStoreIterator it = containerStore.add(item); @@ -592,7 +596,7 @@ MWWorld::ContainerStore& ContainerBase::getContainerStore() ContainerWindow::ContainerWindow(WindowManager& parWindowManager,DragAndDrop* dragAndDrop) : ContainerBase(dragAndDrop) - , WindowBase("openmw_container_window_layout.xml", parWindowManager) + , WindowBase("openmw_container_window.layout", parWindowManager) { getWidget(mTakeButton, "TakeButton"); getWidget(mCloseButton, "CloseButton"); @@ -612,12 +616,9 @@ ContainerWindow::ContainerWindow(WindowManager& parWindowManager,DragAndDrop* dr mCloseButton->setCoord(600-20-closeButtonWidth, mCloseButton->getCoord().top, closeButtonWidth, mCloseButton->getCoord().height); mTakeButton->setCoord(600-20-closeButtonWidth-takeButtonWidth-8, mTakeButton->getCoord().top, takeButtonWidth, mTakeButton->getCoord().height); - int w = MyGUI::RenderManager::getInstance().getViewSize().width; - //int h = MyGUI::RenderManager::getInstance().getViewSize().height; - static_cast(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &ContainerWindow::onWindowResize); - setCoord(w-600,0,600,300); + setCoord(200,0,600,300); } ContainerWindow::~ContainerWindow() diff --git a/apps/openmw/mwgui/countdialog.cpp b/apps/openmw/mwgui/countdialog.cpp index e0a9bb908..07f1acb73 100644 --- a/apps/openmw/mwgui/countdialog.cpp +++ b/apps/openmw/mwgui/countdialog.cpp @@ -3,12 +3,12 @@ #include #include "../mwbase/environment.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" namespace MWGui { CountDialog::CountDialog(WindowManager& parWindowManager) : - WindowBase("openmw_count_window_layout.xml", parWindowManager) + WindowBase("openmw_count_window.layout", parWindowManager) { getWidget(mSlider, "CountSlider"); getWidget(mItemEdit, "ItemEdit"); @@ -77,7 +77,7 @@ namespace MWGui { if (_sender->getCaption() == "") return; - + unsigned int count; try { diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp index 55bd49beb..acf0bf130 100644 --- a/apps/openmw/mwgui/dialogue.cpp +++ b/apps/openmw/mwgui/dialogue.cpp @@ -43,7 +43,7 @@ std::string::size_type find_str_ci(const std::string& str, const std::string& su DialogueWindow::DialogueWindow(WindowManager& parWindowManager) - : WindowBase("openmw_dialogue_window_layout.xml", parWindowManager) + : WindowBase("openmw_dialogue_window.layout", parWindowManager) , mEnabled(true) , mShowTrade(false) { diff --git a/apps/openmw/mwgui/dialogue.hpp b/apps/openmw/mwgui/dialogue.hpp index aa66cd579..5d808b5a7 100644 --- a/apps/openmw/mwgui/dialogue.hpp +++ b/apps/openmw/mwgui/dialogue.hpp @@ -19,7 +19,7 @@ namespace MWGui /* This file contains the dialouge window - Layout is defined by resources/mygui/openmw_dialogue_window_layout.xml. + Layout is defined by resources/mygui/openmw_dialogue_window.layout. */ namespace MWGui diff --git a/apps/openmw/mwgui/hud.cpp b/apps/openmw/mwgui/hud.cpp index 4ad9845f0..d20a11009 100644 --- a/apps/openmw/mwgui/hud.cpp +++ b/apps/openmw/mwgui/hud.cpp @@ -7,11 +7,15 @@ #include #include "../mwbase/environment.hpp" -#include "../mwsound/soundmanager.hpp" +#include "../mwbase/world.hpp" + #include "../mwworld/class.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/player.hpp" +#include "../mwsound/soundmanager.hpp" + +#include "../mwgui/widgets.hpp" + #include "inventorywindow.hpp" #include "window_manager.hpp" #include "container.hpp" @@ -20,7 +24,7 @@ using namespace MWGui; HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop) - : Layout("openmw_hud_layout.xml") + : Layout("openmw_hud.layout") , health(NULL) , magicka(NULL) , stamina(NULL) @@ -239,7 +243,7 @@ void HUD::onWorldClicked(MyGUI::Widget* _sender) // drop item into the gameworld MWWorld::Ptr object = *mDragAndDrop->mDraggedWidget->getUserData(); - MWWorld::World* world = MWBase::Environment::get().getWorld(); + MWBase::World* world = MWBase::Environment::get().getWorld(); MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize(); MyGUI::IntPoint cursorPosition = MyGUI::InputManager::getInstance().getMousePosition(); @@ -308,7 +312,7 @@ void HUD::onWorldMouseOver(MyGUI::Widget* _sender, int x, int y) float mouseX = cursorPosition.left / float(viewSize.width); float mouseY = cursorPosition.top / float(viewSize.height); - MWWorld::World* world = MWBase::Environment::get().getWorld(); + MWBase::World* world = MWBase::Environment::get().getWorld(); // if we can't drop the object at the wanted position, show the "drop on ground" cursor. bool canDrop = world->canPlaceObject(mouseX, mouseY); diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index a26a958bd..dc5728283 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -3,21 +3,24 @@ #include #include #include -#include -#include +#include #include -#include "../mwclass/container.hpp" +#include "../mwbase/world.hpp" +#include "../mwbase/environment.hpp" + #include "../mwworld/containerstore.hpp" #include "../mwworld/class.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/player.hpp" -#include "../mwbase/environment.hpp" #include "../mwworld/manualref.hpp" #include "../mwworld/actiontake.hpp" +#include "../mwworld/inventorystore.hpp" + #include "../mwsound/soundmanager.hpp" +#include "../mwclass/container.hpp" + #include "window_manager.hpp" #include "widgets.hpp" #include "bookwindow.hpp" @@ -42,7 +45,7 @@ namespace MWGui InventoryWindow::InventoryWindow(WindowManager& parWindowManager,DragAndDrop* dragAndDrop) : ContainerBase(dragAndDrop) - , WindowPinnableBase("openmw_inventory_window_layout.xml", parWindowManager) + , WindowPinnableBase("openmw_inventory_window.layout", parWindowManager) , mTrading(false) { static_cast(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &InventoryWindow::onWindowResize); @@ -171,7 +174,7 @@ namespace MWGui /// \todo scripts boost::shared_ptr action = MWWorld::Class::get(ptr).use(ptr); - + action->execute(); // this is necessary for books/scrolls: if they are already in the player's inventory, diff --git a/apps/openmw/mwgui/journalwindow.cpp b/apps/openmw/mwgui/journalwindow.cpp index 7f9000bc7..75b546c7b 100644 --- a/apps/openmw/mwgui/journalwindow.cpp +++ b/apps/openmw/mwgui/journalwindow.cpp @@ -1,11 +1,14 @@ #include "journalwindow.hpp" -#include "window_manager.hpp" -#include "../mwdialogue/journal.hpp" + #include "../mwbase/environment.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" + +#include "../mwdialogue/journal.hpp" #include "../mwsound/soundmanager.hpp" +#include "window_manager.hpp" + namespace { struct book @@ -80,7 +83,7 @@ book formatText(std::string text,book mBook,int maxLine, int lineSize) MWGui::JournalWindow::JournalWindow (WindowManager& parWindowManager) - : WindowBase("openmw_journal_layout.xml", parWindowManager) + : WindowBase("openmw_journal.layout", parWindowManager) , lastPos(0) , mVisible(false) { diff --git a/apps/openmw/mwgui/mainmenu.hpp b/apps/openmw/mwgui/mainmenu.hpp index b32f2d900..06c59396f 100644 --- a/apps/openmw/mwgui/mainmenu.hpp +++ b/apps/openmw/mwgui/mainmenu.hpp @@ -7,7 +7,7 @@ namespace MWGui { public: MainMenu(int w, int h) - : Layout("openmw_mainmenu_layout.xml") + : Layout("openmw_mainmenu.layout") { setCoord(0,0,w,h); } diff --git a/apps/openmw/mwgui/map_window.cpp b/apps/openmw/mwgui/map_window.cpp index a51b66e2b..4ebeb3874 100644 --- a/apps/openmw/mwgui/map_window.cpp +++ b/apps/openmw/mwgui/map_window.cpp @@ -155,7 +155,7 @@ void LocalMapBase::setPlayerDir(const float x, const float y) // ------------------------------------------------------------------------------------------ MapWindow::MapWindow(WindowManager& parWindowManager) : - MWGui::WindowPinnableBase("openmw_map_window_layout.xml", parWindowManager), + MWGui::WindowPinnableBase("openmw_map_window.layout", parWindowManager), mGlobal(false) { setCoord(500,0,320,300); diff --git a/apps/openmw/mwgui/messagebox.cpp b/apps/openmw/mwgui/messagebox.cpp index 007f966aa..68326a3c3 100644 --- a/apps/openmw/mwgui/messagebox.cpp +++ b/apps/openmw/mwgui/messagebox.cpp @@ -147,7 +147,7 @@ int MessageBoxManager::readPressedButton () MessageBox::MessageBox(MessageBoxManager& parMessageBoxManager, const std::string& message) - : Layout("openmw_messagebox_layout.xml") + : Layout("openmw_messagebox.layout") , mMessageBoxManager(parMessageBoxManager) , cMessage(message) { @@ -177,7 +177,7 @@ MessageBox::MessageBox(MessageBoxManager& parMessageBoxManager, const std::strin size.height = mHeight = textSize.height + 20; // this is the padding between the text and the box mMainWidget->setSize(size); - size.width -= 15; // this is to center the text (see messagebox_layout.xml, Widget type="Edit" position="-2 -3 0 0") + size.width -= 15; // this is to center the text (see messagebox.layout, Widget type="Edit" position="-2 -3 0 0") mMessageWidget->setSize(size); } @@ -205,7 +205,7 @@ int MessageBox::getHeight () InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector& buttons) - : Layout("openmw_interactive_messagebox_layout.xml") + : Layout("openmw_interactive_messagebox.layout") , mMessageBoxManager(parMessageBoxManager) , mButtonPressed(-1) { diff --git a/apps/openmw/mwgui/race.cpp b/apps/openmw/mwgui/race.cpp index dea365ac2..9ae453016 100644 --- a/apps/openmw/mwgui/race.cpp +++ b/apps/openmw/mwgui/race.cpp @@ -17,7 +17,7 @@ using namespace MWGui; using namespace Widgets; RaceDialog::RaceDialog(WindowManager& parWindowManager) - : WindowBase("openmw_chargen_race_layout.xml", parWindowManager) + : WindowBase("openmw_chargen_race.layout", parWindowManager) , genderIndex(0) , faceIndex(0) , hairIndex(0) diff --git a/apps/openmw/mwgui/race.hpp b/apps/openmw/mwgui/race.hpp index bcd3b5185..217ce15aa 100644 --- a/apps/openmw/mwgui/race.hpp +++ b/apps/openmw/mwgui/race.hpp @@ -14,7 +14,7 @@ namespace MWGui /* This file contains the dialog for choosing a race. - Layout is defined by resources/mygui/openmw_chargen_race_layout.xml. + Layout is defined by resources/mygui/openmw_chargen_race.layout. */ namespace MWGui diff --git a/apps/openmw/mwgui/referenceinterface.cpp b/apps/openmw/mwgui/referenceinterface.cpp index c6e710952..f891b3338 100644 --- a/apps/openmw/mwgui/referenceinterface.cpp +++ b/apps/openmw/mwgui/referenceinterface.cpp @@ -1,9 +1,10 @@ #include "referenceinterface.hpp" -#include "../mwworld/player.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" #include "../mwbase/environment.hpp" +#include "../mwworld/player.hpp" + namespace MWGui { ReferenceInterface::ReferenceInterface() diff --git a/apps/openmw/mwgui/referenceinterface.hpp b/apps/openmw/mwgui/referenceinterface.hpp index 40844b238..aba9071f3 100644 --- a/apps/openmw/mwgui/referenceinterface.hpp +++ b/apps/openmw/mwgui/referenceinterface.hpp @@ -22,7 +22,7 @@ namespace MWGui MWWorld::Ptr mPtr; private: - MWWorld::Ptr::CellStore* mCurrentPlayerCell; + MWWorld::CellStore* mCurrentPlayerCell; }; } diff --git a/apps/openmw/mwgui/review.cpp b/apps/openmw/mwgui/review.cpp index 97a3a6e15..f9792ea34 100644 --- a/apps/openmw/mwgui/review.cpp +++ b/apps/openmw/mwgui/review.cpp @@ -20,7 +20,7 @@ using namespace Widgets; const int ReviewDialog::lineHeight = 18; ReviewDialog::ReviewDialog(WindowManager& parWindowManager) - : WindowBase("openmw_chargen_review_layout.xml", parWindowManager) + : WindowBase("openmw_chargen_review.layout", parWindowManager) , lastPos(0) { // Centre dialog diff --git a/apps/openmw/mwgui/review.hpp b/apps/openmw/mwgui/review.hpp index 6118168d5..454a6c5a5 100644 --- a/apps/openmw/mwgui/review.hpp +++ b/apps/openmw/mwgui/review.hpp @@ -12,7 +12,7 @@ namespace MWGui /* This file contains the dialog for reviewing the generated character. -Layout is defined by resources/mygui/openmw_chargen_review_layout.xml. +Layout is defined by resources/mygui/openmw_chargen_review.layout. */ namespace MWGui diff --git a/apps/openmw/mwgui/scrollwindow.cpp b/apps/openmw/mwgui/scrollwindow.cpp index 92b18d953..e6ff71a14 100644 --- a/apps/openmw/mwgui/scrollwindow.cpp +++ b/apps/openmw/mwgui/scrollwindow.cpp @@ -11,7 +11,7 @@ using namespace MWGui; ScrollWindow::ScrollWindow (WindowManager& parWindowManager) : - WindowBase("openmw_scroll_layout.xml", parWindowManager) + WindowBase("openmw_scroll.layout", parWindowManager) { getWidget(mTextView, "TextView"); @@ -31,8 +31,7 @@ void ScrollWindow::open (MWWorld::Ptr scroll) mScroll = scroll; - ESMS::LiveCellRef *ref = - mScroll.get(); + MWWorld::LiveCellRef *ref = mScroll.get(); BookTextParser parser; MyGUI::IntSize size = parser.parse(ref->base->text, mTextView, 390); diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index 6ceed664e..5e25d5ece 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -11,8 +11,12 @@ #include #include "../mwbase/environment.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" + +#include "../mwrender/renderingmanager.hpp" + #include "../mwsound/soundmanager.hpp" + #include "../mwinput/inputmanager.hpp" #include "window_manager.hpp" @@ -45,7 +49,7 @@ namespace void parseResolution (int &x, int &y, const std::string& str) { std::vector split; - boost::algorithm::split (split, str, boost::is_any_of("x@")); + boost::algorithm::split (split, str, boost::is_any_of("@(x")); assert (split.size() >= 2); boost::trim(split[0]); boost::trim(split[1]); @@ -75,7 +79,7 @@ namespace namespace MWGui { SettingsWindow::SettingsWindow(WindowManager& parWindowManager) : - WindowBase("openmw_settings_window_layout.xml", parWindowManager) + WindowBase("openmw_settings_window.layout", parWindowManager) { getWidget(mOkButton, "OkButton"); getWidget(mResolutionList, "ResolutionList"); diff --git a/apps/openmw/mwgui/spellwindow.cpp b/apps/openmw/mwgui/spellwindow.cpp index 909798f1a..f6e7d3b77 100644 --- a/apps/openmw/mwgui/spellwindow.cpp +++ b/apps/openmw/mwgui/spellwindow.cpp @@ -4,13 +4,18 @@ #include #include -#include "../mwworld/world.hpp" +#include + +#include "../mwbase/world.hpp" +#include "../mwbase/environment.hpp" + #include "../mwworld/player.hpp" #include "../mwworld/inventorystore.hpp" -#include "../mwbase/environment.hpp" + #include "../mwmechanics/spells.hpp" #include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/spellsuccess.hpp" + #include "../mwsound/soundmanager.hpp" #include "window_manager.hpp" @@ -39,7 +44,7 @@ namespace namespace MWGui { SpellWindow::SpellWindow(WindowManager& parWindowManager) - : WindowPinnableBase("openmw_spell_window_layout.xml", parWindowManager) + : WindowPinnableBase("openmw_spell_window.layout", parWindowManager) , mHeight(0) , mWidth(0) { diff --git a/apps/openmw/mwgui/stats_window.cpp b/apps/openmw/mwgui/stats_window.cpp index 3584af7c7..0f8b41b28 100644 --- a/apps/openmw/mwgui/stats_window.cpp +++ b/apps/openmw/mwgui/stats_window.cpp @@ -6,10 +6,13 @@ #include -#include "../mwmechanics/mechanicsmanager.hpp" -#include "../mwworld/world.hpp" -#include "../mwworld/player.hpp" #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" + +#include "../mwworld/player.hpp" +#include "../mwworld/class.hpp" + +#include "../mwmechanics/mechanicsmanager.hpp" #include "window_manager.hpp" #include "tooltips.hpp" @@ -19,7 +22,7 @@ using namespace MWGui; const int StatsWindow::lineHeight = 18; StatsWindow::StatsWindow (WindowManager& parWindowManager) - : WindowPinnableBase("openmw_stats_window_layout.xml", parWindowManager) + : WindowPinnableBase("openmw_stats_window.layout", parWindowManager) , skillAreaWidget(NULL) , skillClientWidget(NULL) , skillScrollerWidget(NULL) @@ -539,7 +542,7 @@ void StatsWindow::updateSkillArea() skillWidgets[skillWidgets.size()-1-i]->setUserString("ToolTipLayout", "TextToolTip"); skillWidgets[skillWidgets.size()-1-i]->setUserString("Caption_Text", "#{sSkillsMenuReputationHelp}"); } - + addValueItem(mWindowManager.getGameSettingString("sBounty", "Bounty"), boost::lexical_cast(static_cast(bounty)), "normal", coord1, coord2); diff --git a/apps/openmw/mwgui/text_input.cpp b/apps/openmw/mwgui/text_input.cpp index 7d84a9b9f..17852ba5a 100644 --- a/apps/openmw/mwgui/text_input.cpp +++ b/apps/openmw/mwgui/text_input.cpp @@ -4,7 +4,7 @@ using namespace MWGui; TextInputDialog::TextInputDialog(WindowManager& parWindowManager) - : WindowBase("openmw_text_input_layout.xml", parWindowManager) + : WindowBase("openmw_text_input.layout", parWindowManager) { // Centre dialog center(); diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index 7ec444168..7920d88a3 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -1,20 +1,24 @@ #include "tooltips.hpp" -#include "window_manager.hpp" -#include "widgets.hpp" -#include "../mwworld/class.hpp" -#include "../mwworld/world.hpp" -#include "../mwbase/environment.hpp" - #include +#include + #include +#include "../mwbase/world.hpp" +#include "../mwbase/environment.hpp" + +#include "../mwworld/class.hpp" + +#include "window_manager.hpp" +#include "widgets.hpp" + using namespace MWGui; using namespace MyGUI; ToolTips::ToolTips(WindowManager* windowManager) : - Layout("openmw_tooltips.xml") + Layout("openmw_tooltips.layout") , mGameMode(true) , mWindowManager(windowManager) , mFullHelp(false) @@ -392,7 +396,7 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info) /** * \todo - * the various potion effects should appear in the tooltip depending if the player + * the various potion effects should appear in the tooltip depending if the player * has enough skill in alchemy to know about the effects of this potion. */ @@ -564,8 +568,6 @@ void ToolTips::createAttributeToolTip(MyGUI::Widget* widget, int attributeId) if (attributeId == -1) return; - const ESM::Attribute* attr = MWBase::Environment::get().getWorld()->getStore().attributes.search(attributeId); - assert(attr); std::string icon = ESM::Attribute::attributeIcons[attributeId]; std::string name = ESM::Attribute::gmstAttributeIds[attributeId]; std::string desc = ESM::Attribute::gmstAttributeDescIds[attributeId]; diff --git a/apps/openmw/mwgui/tradewindow.cpp b/apps/openmw/mwgui/tradewindow.cpp index a42da60d1..d9f9692ff 100644 --- a/apps/openmw/mwgui/tradewindow.cpp +++ b/apps/openmw/mwgui/tradewindow.cpp @@ -3,7 +3,8 @@ #include #include "../mwbase/environment.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" + #include "../mwworld/inventorystore.hpp" #include "../mwworld/manualref.hpp" #include "../mwsound/soundmanager.hpp" @@ -14,7 +15,7 @@ namespace MWGui { TradeWindow::TradeWindow(WindowManager& parWindowManager) : - WindowBase("openmw_trade_window_layout.xml", parWindowManager) + WindowBase("openmw_trade_window.layout", parWindowManager) , ContainerBase(NULL) // no drag&drop , mCurrentBalance(0) { @@ -86,7 +87,7 @@ namespace MWGui offerButtonWidth, mOfferButton->getHeight()); - setCoord(400, 0, 400, 300); + setCoord(400, 0, 400, 300); static_cast(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &TradeWindow::onWindowResize); } @@ -161,7 +162,7 @@ namespace MWGui int merchantgold; if (mPtr.getTypeName() == typeid(ESM::NPC).name()) { - ESMS::LiveCellRef* ref = mPtr.get(); + MWWorld::LiveCellRef* ref = mPtr.get(); if (ref->base->npdt52.gold == -10) merchantgold = ref->base->npdt12.gold; else @@ -169,7 +170,7 @@ namespace MWGui } else // ESM::Creature { - ESMS::LiveCellRef* ref = mPtr.get(); + MWWorld::LiveCellRef* ref = mPtr.get(); merchantgold = ref->base->data.gold; } if (mCurrentBalance > 0 && merchantgold < mCurrentBalance) @@ -244,7 +245,7 @@ namespace MWGui int merchantgold; if (mPtr.getTypeName() == typeid(ESM::NPC).name()) { - ESMS::LiveCellRef* ref = mPtr.get(); + MWWorld::LiveCellRef* ref = mPtr.get(); if (ref->base->npdt52.gold == -10) merchantgold = ref->base->npdt12.gold; else @@ -252,7 +253,7 @@ namespace MWGui } else // ESM::Creature { - ESMS::LiveCellRef* ref = mPtr.get(); + MWWorld::LiveCellRef* ref = mPtr.get(); merchantgold = ref->base->data.gold; } @@ -289,13 +290,13 @@ namespace MWGui int services = 0; if (mPtr.getTypeName() == typeid(ESM::NPC).name()) { - ESMS::LiveCellRef* ref = mPtr.get(); + MWWorld::LiveCellRef* ref = mPtr.get(); if (ref->base->hasAI) services = ref->base->AI.services; } else if (mPtr.getTypeName() == typeid(ESM::Creature).name()) { - ESMS::LiveCellRef* ref = mPtr.get(); + MWWorld::LiveCellRef* ref = mPtr.get(); if (ref->base->hasAI) services = ref->base->AI.services; } diff --git a/apps/openmw/mwgui/window_manager.cpp b/apps/openmw/mwgui/window_manager.cpp index f62a3fa0f..62207d7d7 100644 --- a/apps/openmw/mwgui/window_manager.cpp +++ b/apps/openmw/mwgui/window_manager.cpp @@ -26,14 +26,16 @@ #include "../mwbase/environment.hpp" +#include "../mwworld/ptr.hpp" +#include "../mwworld/cellstore.hpp" + #include "console.hpp" #include "journalwindow.hpp" #include "charactercreation.hpp" #include -#include -#include +#include #include using namespace MWGui; @@ -82,7 +84,7 @@ WindowManager::WindowManager( // Set up the GUI system mGuiManager = new OEngine::GUI::MyGUIManager(mOgre->getWindow(), mOgre->getScene(), false, logpath); gui = mGuiManager->getGui(); - + //Register own widgets with MyGUI MyGUI::FactoryManager::getInstance().registerFactory("Widget"); MyGUI::FactoryManager::getInstance().registerFactory("Widget"); @@ -638,6 +640,9 @@ void WindowManager::processChangedSettings(const Settings::CategorySettingVector hud->onResChange(x, y); console->onResChange(x, y); mSettingsWindow->center(); + mAlchemyWindow->center(); + mScrollWindow->center(); + mBookWindow->center(); mDragAndDrop->mDragAndDropWidget->setSize(MyGUI::IntSize(x, y)); } } diff --git a/apps/openmw/mwgui/window_manager.hpp b/apps/openmw/mwgui/window_manager.hpp index fd1e61021..03ffa6b59 100644 --- a/apps/openmw/mwgui/window_manager.hpp +++ b/apps/openmw/mwgui/window_manager.hpp @@ -22,7 +22,6 @@ #include #include "../mwmechanics/stat.hpp" -#include "../mwworld/ptr.hpp" #include "mode.hpp" @@ -39,7 +38,8 @@ namespace Compiler namespace MWWorld { - class World; + class Ptr; + class CellStore; } namespace MWMechanics @@ -181,7 +181,7 @@ namespace MWGui void setBounty (int bounty); ///< set the current bounty value void updateSkillArea(); ///< update display of skills, factions, birth sign, reputation and bounty - void changeCell(MWWorld::Ptr::CellStore* cell); ///< change the active cell + void changeCell(MWWorld::CellStore* cell); ///< change the active cell void setPlayerPos(const float x, const float y); ///< set player position in map space void setPlayerDir(const float x, const float y); ///< set player view direction in map space @@ -302,7 +302,7 @@ namespace MWGui /** * Called when MyGUI tries to retrieve a tag. This usually corresponds to a GMST string, - * so this method will retrieve the GMST with the name \a _tag and place the result in \a _result + * so this method will retrieve the GMST with the name \a _tag and place the result in \a _result */ void onRetrieveTag(const MyGUI::UString& _tag, MyGUI::UString& _result); }; diff --git a/apps/openmw/mwmechanics/activespells.cpp b/apps/openmw/mwmechanics/activespells.cpp index ced2a5c3f..aedfcd2ea 100644 --- a/apps/openmw/mwmechanics/activespells.cpp +++ b/apps/openmw/mwmechanics/activespells.cpp @@ -3,9 +3,10 @@ #include -#include "../mwbase/environment.hpp" +#include -#include "../mwworld/world.hpp" +#include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" namespace MWMechanics { diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 8f8fd6871..95747dbbf 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -3,6 +3,8 @@ #include +#include + #include #include "../mwworld/class.hpp" diff --git a/apps/openmw/mwmechanics/actors.hpp b/apps/openmw/mwmechanics/actors.hpp index 1be29463f..82f8a943c 100644 --- a/apps/openmw/mwmechanics/actors.hpp +++ b/apps/openmw/mwmechanics/actors.hpp @@ -5,13 +5,17 @@ #include #include -#include "../mwworld/ptr.hpp" - namespace Ogre { class Vector3; } +namespace MWWorld +{ + class Ptr; + class CellStore; +} + namespace MWMechanics { class Actors @@ -35,7 +39,7 @@ namespace MWMechanics /// /// \note Ignored, if \a ptr is not a registered actor. - void dropActors (const MWWorld::Ptr::CellStore *cellStore); + void dropActors (const MWWorld::CellStore *cellStore); ///< Deregister all actors in the given cell. void update (std::vector >& movement, diff --git a/apps/openmw/mwmechanics/mechanicsmanager.cpp b/apps/openmw/mwmechanics/mechanicsmanager.cpp index 331074ef7..13052d064 100644 --- a/apps/openmw/mwmechanics/mechanicsmanager.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanager.cpp @@ -3,14 +3,14 @@ #include -#include "../mwgui/window_manager.hpp" - #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/class.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/player.hpp" +#include "../mwgui/window_manager.hpp" + namespace MWMechanics { void MechanicsManager::buildPlayer() diff --git a/apps/openmw/mwmechanics/mechanicsmanager.hpp b/apps/openmw/mwmechanics/mechanicsmanager.hpp index 62bb4cf7e..97bb369fd 100644 --- a/apps/openmw/mwmechanics/mechanicsmanager.hpp +++ b/apps/openmw/mwmechanics/mechanicsmanager.hpp @@ -15,6 +15,11 @@ namespace Ogre class Vector3; } +namespace MWWorld +{ + class CellStore; +} + namespace MWMechanics { class MechanicsManager @@ -43,7 +48,7 @@ namespace MWMechanics void removeActor (const MWWorld::Ptr& ptr); ///< Deregister an actor for stats management - void dropActors (const MWWorld::Ptr::CellStore *cellStore); + void dropActors (const MWWorld::CellStore *cellStore); ///< Deregister all actors in the given cell. void watchActor (const MWWorld::Ptr& ptr); diff --git a/apps/openmw/mwmechanics/spells.cpp b/apps/openmw/mwmechanics/spells.cpp index 70eb78639..5d21d96d0 100644 --- a/apps/openmw/mwmechanics/spells.cpp +++ b/apps/openmw/mwmechanics/spells.cpp @@ -1,11 +1,12 @@ #include "spells.hpp" +#include + #include #include "../mwbase/environment.hpp" - -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" #include "magiceffects.hpp" diff --git a/apps/openmw/mwmechanics/spellsuccess.hpp b/apps/openmw/mwmechanics/spellsuccess.hpp index 11ac7cda7..54172a72a 100644 --- a/apps/openmw/mwmechanics/spellsuccess.hpp +++ b/apps/openmw/mwmechanics/spellsuccess.hpp @@ -1,9 +1,11 @@ #ifndef MWMECHANICS_SPELLSUCCESS_H #define MWMECHANICS_SPELLSUCCESS_H -#include "../mwworld/ptr.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" #include "../mwbase/environment.hpp" + +#include "../mwworld/ptr.hpp" +#include "../mwworld/class.hpp" #include "../mwmechanics/creaturestats.hpp" #include "npcstats.hpp" diff --git a/apps/openmw/mwrender/actors.cpp b/apps/openmw/mwrender/actors.cpp index 152cf3277..b37921b0c 100644 --- a/apps/openmw/mwrender/actors.cpp +++ b/apps/openmw/mwrender/actors.cpp @@ -1,7 +1,7 @@ #include "actors.hpp" -#include - +#include +#include using namespace Ogre; diff --git a/apps/openmw/mwrender/actors.hpp b/apps/openmw/mwrender/actors.hpp index 432bcc297..63cd3baa1 100644 --- a/apps/openmw/mwrender/actors.hpp +++ b/apps/openmw/mwrender/actors.hpp @@ -1,26 +1,29 @@ #ifndef _GAME_RENDER_ACTORS_H #define _GAME_RENDER_ACTORS_H -#include "components/esm_store/cell_store.hpp" #include #include - - #include #include "components/nifogre/ogre_nif_loader.hpp" #include "../mwworld/refdata.hpp" -#include "../mwworld/ptr.hpp" #include "../mwworld/actiontalk.hpp" + #include "npcanimation.hpp" #include "creatureanimation.hpp" #include +namespace MWWorld +{ + class Ptr; + class CellStore; +} + namespace MWRender{ class Actors{ OEngine::Render::OgreRenderer &mRend; - std::map mCellSceneNodes; + std::map mCellSceneNodes; Ogre::SceneNode* mMwRoot; std::map mAllActors; @@ -36,7 +39,7 @@ namespace MWRender{ bool deleteObject (const MWWorld::Ptr& ptr); ///< \return found? - void removeCell(MWWorld::Ptr::CellStore* store); + void removeCell(MWWorld::CellStore* store); void playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName, int mode, int number = 1); diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index fc6258208..f0a6ab683 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -1,5 +1,10 @@ #include "animation.hpp" +#include +#include +#include +#include +#include namespace MWRender{ std::map Animation::mUniqueIDs; diff --git a/apps/openmw/mwrender/creatureanimation.cpp b/apps/openmw/mwrender/creatureanimation.cpp index 9ca3ed731..e1fa7868c 100644 --- a/apps/openmw/mwrender/creatureanimation.cpp +++ b/apps/openmw/mwrender/creatureanimation.cpp @@ -1,7 +1,12 @@ #include "creatureanimation.hpp" + +#include +#include +#include + #include "renderconst.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" using namespace Ogre; using namespace NifOgre; @@ -12,7 +17,7 @@ CreatureAnimation::~CreatureAnimation(){ } CreatureAnimation::CreatureAnimation(const MWWorld::Ptr& ptr, OEngine::Render::OgreRenderer& _rend): Animation(_rend){ insert = ptr.getRefData().getBaseNode(); - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); diff --git a/apps/openmw/mwrender/debugging.cpp b/apps/openmw/mwrender/debugging.cpp index 9086a9bc4..91b217a36 100644 --- a/apps/openmw/mwrender/debugging.cpp +++ b/apps/openmw/mwrender/debugging.cpp @@ -1,18 +1,23 @@ #include "debugging.hpp" -#include +#include #include #include #include #include +#include -#include "../mwworld/world.hpp" // these includes can be removed once the static-hack is gone -#include "../mwbase/environment.hpp" -#include "../mwworld/ptr.hpp" #include #include +#include + +#include "../mwbase/world.hpp" // these includes can be removed once the static-hack is gone +#include "../mwbase/environment.hpp" + +#include "../mwworld/ptr.hpp" + #include "player.hpp" using namespace Ogre; @@ -162,11 +167,11 @@ Debugging::~Debugging() bool Debugging::toggleRenderMode (int mode){ switch (mode) { - case MWWorld::World::Render_CollisionDebug: + case MWBase::World::Render_CollisionDebug: return mEngine->toggleDebugRendering(); - case MWWorld::World::Render_Pathgrid: + case MWBase::World::Render_Pathgrid: togglePathgrid(); return mPathgridEnabled; } diff --git a/apps/openmw/mwrender/debugging.hpp b/apps/openmw/mwrender/debugging.hpp index e12c0647c..d312b6d54 100644 --- a/apps/openmw/mwrender/debugging.hpp +++ b/apps/openmw/mwrender/debugging.hpp @@ -4,11 +4,15 @@ #include #include #include -#include "../mwworld/ptr.hpp" #include #include +namespace ESM +{ + struct Pathgrid; +} + namespace Ogre { class Camera; @@ -22,7 +26,8 @@ namespace Ogre namespace MWWorld { - class World; + class Ptr; + class CellStore; } namespace MWRender @@ -39,7 +44,7 @@ namespace MWRender void togglePathgrid(); - typedef std::vector CellList; + typedef std::vector CellList; CellList mActiveCells; Ogre::SceneNode *mMwRoot; @@ -50,8 +55,8 @@ namespace MWRender ExteriorPathgridNodes mExteriorPathgridNodes; Ogre::SceneNode *mInteriorPathgridNode; - void enableCellPathgrid(MWWorld::Ptr::CellStore *store); - void disableCellPathgrid(MWWorld::Ptr::CellStore *store); + void enableCellPathgrid(MWWorld::CellStore *store); + void disableCellPathgrid(MWWorld::CellStore *store); // utility void destroyCellPathgridNode(Ogre::SceneNode *node); @@ -70,8 +75,8 @@ namespace MWRender ~Debugging(); bool toggleRenderMode (int mode); - void cellAdded(MWWorld::Ptr::CellStore* store); - void cellRemoved(MWWorld::Ptr::CellStore* store); + void cellAdded(MWWorld::CellStore* store); + void cellRemoved(MWWorld::CellStore* store); }; diff --git a/apps/openmw/mwrender/localmap.cpp b/apps/openmw/mwrender/localmap.cpp index 2442700bb..dd0351721 100644 --- a/apps/openmw/mwrender/localmap.cpp +++ b/apps/openmw/mwrender/localmap.cpp @@ -1,13 +1,16 @@ #include "localmap.hpp" -#include "renderingmanager.hpp" + +#include +#include +#include #include "../mwbase/environment.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" + #include "../mwgui/window_manager.hpp" -#include "renderconst.hpp" -#include -#include +#include "renderconst.hpp" +#include "renderingmanager.hpp" using namespace MWRender; using namespace Ogre; diff --git a/apps/openmw/mwrender/localmap.hpp b/apps/openmw/mwrender/localmap.hpp index 9e03988f3..c5cd908fc 100644 --- a/apps/openmw/mwrender/localmap.hpp +++ b/apps/openmw/mwrender/localmap.hpp @@ -1,10 +1,15 @@ #ifndef _GAME_RENDER_LOCALMAP_H #define _GAME_RENDER_LOCALMAP_H -#include "../mwworld/ptr.hpp" - #include +#include + +namespace MWWorld +{ + class CellStore; +} + namespace MWRender { class RenderingManager; @@ -24,7 +29,7 @@ namespace MWRender * or rendered if it is not already cached. * @param exterior cell */ - void requestMap (MWWorld::Ptr::CellStore* cell); + void requestMap (MWWorld::CellStore* cell); /** * Request the local map for an interior cell. @@ -33,7 +38,7 @@ namespace MWRender * @param interior cell * @param bounding box of the cell */ - void requestMap (MWWorld::Ptr::CellStore* cell, + void requestMap (MWWorld::CellStore* cell, Ogre::AxisAlignedBox bounds); /** @@ -51,7 +56,7 @@ namespace MWRender * new cell, as well as when the game is quit. * @param current cell */ - void saveFogOfWar(MWWorld::Ptr::CellStore* cell); + void saveFogOfWar(MWWorld::CellStore* cell); private: OEngine::Render::OgreRenderer* mRendering; diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 5ceafca36..fa88b7277 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -1,8 +1,15 @@ #include "npcanimation.hpp" -#include "../mwworld/world.hpp" -#include "renderconst.hpp" + +#include +#include +#include + +#include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" + +#include "renderconst.hpp" using namespace Ogre; using namespace NifOgre; @@ -38,7 +45,7 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, OEngine::Render::OgreRendere lfoot(0), rfoot(0) { - ESMS::LiveCellRef *ref = + MWWorld::LiveCellRef *ref = ptr.get(); Ogre::Entity* blank = 0; std::vector* blankshape = 0; diff --git a/apps/openmw/mwrender/objects.cpp b/apps/openmw/mwrender/objects.cpp index b9efcd3f5..fb2bfb3c5 100644 --- a/apps/openmw/mwrender/objects.cpp +++ b/apps/openmw/mwrender/objects.cpp @@ -1,9 +1,17 @@ #include "objects.hpp" #include +#include +#include +#include +#include +#include #include #include + +#include "../mwworld/ptr.hpp" + #include "renderconst.hpp" using namespace MWRender; @@ -56,7 +64,7 @@ void Objects::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_) insert->setPosition(f[0], f[1], f[2]); insert->setScale(ptr.getCellRef().scale, ptr.getCellRef().scale, ptr.getCellRef().scale); - + // Convert MW rotation to a quaternion: f = ptr.getCellRef().pos.rot; @@ -194,8 +202,7 @@ void Objects::insertLight (const MWWorld::Ptr& ptr, float r, float g, float b, f Ogre::Light *light = mRenderer.getScene()->createLight(); light->setDiffuseColour (r, g, b); - ESMS::LiveCellRef *ref = - ptr.get(); + MWWorld::LiveCellRef *ref = ptr.get(); LightInfo info; info.name = light->getName(); @@ -307,7 +314,7 @@ void Objects::removeCell(MWWorld::Ptr::CellStore* store) mBounds.erase(store); } -void Objects::buildStaticGeometry(ESMS::CellStore& cell) +void Objects::buildStaticGeometry(MWWorld::Ptr::CellStore& cell) { if(mStaticGeometry.find(&cell) != mStaticGeometry.end()) { diff --git a/apps/openmw/mwrender/objects.hpp b/apps/openmw/mwrender/objects.hpp index 6132879e6..e240b11c9 100644 --- a/apps/openmw/mwrender/objects.hpp +++ b/apps/openmw/mwrender/objects.hpp @@ -1,12 +1,15 @@ #ifndef _GAME_RENDER_OBJECTS_H #define _GAME_RENDER_OBJECTS_H -#include +#include -#include +#include -#include "../mwworld/refdata.hpp" -#include "../mwworld/ptr.hpp" +namespace MWWorld +{ + class Ptr; + class CellStore; +} namespace MWRender{ @@ -47,10 +50,10 @@ struct LightInfo class Objects{ OEngine::Render::OgreRenderer &mRenderer; - std::map mCellSceneNodes; - std::map mStaticGeometry; - std::map mStaticGeometrySmall; - std::map mBounds; + std::map mCellSceneNodes; + std::map mStaticGeometry; + std::map mStaticGeometrySmall; + std::map mBounds; std::vector mLights; Ogre::SceneNode* mMwRoot; bool mIsStatic; @@ -81,14 +84,14 @@ public: void update (const float dt); ///< per-frame update - Ogre::AxisAlignedBox getDimensions(MWWorld::Ptr::CellStore*); + Ogre::AxisAlignedBox getDimensions(MWWorld::CellStore*); ///< get a bounding box that encloses all objects in the specified cell bool deleteObject (const MWWorld::Ptr& ptr); ///< \return found? - void removeCell(MWWorld::Ptr::CellStore* store); - void buildStaticGeometry(ESMS::CellStore &cell); + void removeCell(MWWorld::CellStore* store); + void buildStaticGeometry(MWWorld::CellStore &cell); void setMwRoot(Ogre::SceneNode* root); }; } diff --git a/apps/openmw/mwrender/player.cpp b/apps/openmw/mwrender/player.cpp index d6baac4b5..27ae28e14 100644 --- a/apps/openmw/mwrender/player.cpp +++ b/apps/openmw/mwrender/player.cpp @@ -1,6 +1,8 @@ #include "player.hpp" +#include + namespace MWRender { Player::Player (Ogre::Camera *camera, Ogre::SceneNode* node) @@ -24,4 +26,9 @@ namespace MWRender pitchNode->setOrientation(xr); yawNode->setOrientation(yr); } + + std::string Player::getHandle() const + { + return mNode->getName(); + } } diff --git a/apps/openmw/mwrender/player.hpp b/apps/openmw/mwrender/player.hpp index 406bedb0a..0ba936f6f 100644 --- a/apps/openmw/mwrender/player.hpp +++ b/apps/openmw/mwrender/player.hpp @@ -1,12 +1,12 @@ #ifndef GAME_MWRENDER_PLAYER_H #define GAME_MWRENDER_PLAYER_H -#include -#include +#include namespace Ogre { class Camera; + class SceneNode; } namespace MWRender @@ -26,7 +26,7 @@ namespace MWRender /// Set where the player is looking at. Uses Morrowind (euler) angles void setRot(float x, float y, float z); - std::string getHandle() const { return mNode->getName(); } + std::string getHandle() const; Ogre::SceneNode* getNode() {return mNode;} }; } diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 1029b5b60..5b76f5ae2 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -1,20 +1,30 @@ #include "renderingmanager.hpp" -#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#include "OgreRoot.h" -#include "OgreRenderWindow.h" -#include "OgreSceneManager.h" -#include "OgreViewport.h" -#include "OgreCamera.h" -#include "OgreTextureManager.h" +#include +#include + +#include "../mwbase/world.hpp" // these includes can be removed once the static-hack is gone +#include "../mwbase/environment.hpp" -#include "../mwworld/world.hpp" // these includes can be removed once the static-hack is gone #include "../mwworld/ptr.hpp" #include "../mwworld/player.hpp" -#include "../mwbase/environment.hpp" -#include -#include + +#include "../mwgui/window_manager.hpp" // FIXME +#include "../mwinput/inputmanager.hpp" // FIXME #include "shadows.hpp" #include "shaderhelper.hpp" @@ -22,9 +32,6 @@ #include "water.hpp" #include "compositors.hpp" -#include "../mwgui/window_manager.hpp" // FIXME -#include "../mwinput/inputmanager.hpp" // FIXME - using namespace MWRender; using namespace Ogre; @@ -298,9 +305,9 @@ void RenderingManager::skySetMoonColour (bool red){ bool RenderingManager::toggleRenderMode(int mode) { - if (mode == MWWorld::World::Render_CollisionDebug || mode == MWWorld::World::Render_Pathgrid) + if (mode == MWBase::World::Render_CollisionDebug || mode == MWBase::World::Render_Pathgrid) return mDebugging->toggleRenderMode(mode); - else if (mode == MWWorld::World::Render_Wireframe) + else if (mode == MWBase::World::Render_Wireframe) { if (mRendering.getCamera()->getPolygonMode() == PM_SOLID) { @@ -323,7 +330,7 @@ bool RenderingManager::toggleRenderMode(int mode) } } -void RenderingManager::configureFog(ESMS::CellStore &mCell) +void RenderingManager::configureFog(MWWorld::Ptr::CellStore &mCell) { Ogre::ColourValue color; color.setAsABGR (mCell.cell->ambi.fog); @@ -372,7 +379,7 @@ void RenderingManager::setAmbientMode() } } -void RenderingManager::configureAmbient(ESMS::CellStore &mCell) +void RenderingManager::configureAmbient(MWWorld::Ptr::CellStore &mCell) { mAmbientColor.setAsABGR (mCell.cell->ambi.ambient); setAmbientMode(); diff --git a/apps/openmw/mwrender/renderingmanager.hpp b/apps/openmw/mwrender/renderingmanager.hpp index 20f22fcca..9aaba3803 100644 --- a/apps/openmw/mwrender/renderingmanager.hpp +++ b/apps/openmw/mwrender/renderingmanager.hpp @@ -20,8 +20,6 @@ #include #include -#include "../mwworld/ptr.hpp" - #include #include "renderinginterface.hpp" @@ -41,7 +39,8 @@ namespace Ogre namespace MWWorld { - class World; + class Ptr; + class CellStore; } namespace MWRender @@ -79,18 +78,18 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList OEngine::Render::Fader* getFader(); - void removeCell (MWWorld::Ptr::CellStore *store); + void removeCell (MWWorld::CellStore *store); /// \todo this function should be removed later. Instead the rendering subsystems should track /// when rebatching is needed and update automatically at the end of each frame. - void cellAdded (MWWorld::Ptr::CellStore *store); - void waterAdded(MWWorld::Ptr::CellStore *store); + void cellAdded (MWWorld::CellStore *store); + void waterAdded(MWWorld::CellStore *store); void removeWater(); static const bool useMRT(); - void preCellChange (MWWorld::Ptr::CellStore* store); + void preCellChange (MWWorld::CellStore* store); ///< this event is fired immediately before changing cell void addObject (const MWWorld::Ptr& ptr); @@ -105,7 +104,7 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList void toggleWater(); /// \param store Cell the object was in previously (\a ptr has already been updated to the new cell). - void moveObjectToCell (const MWWorld::Ptr& ptr, const Ogre::Vector3& position, MWWorld::Ptr::CellStore *store); + void moveObjectToCell (const MWWorld::Ptr& ptr, const Ogre::Vector3& position, MWWorld::CellStore *store); void update (float duration); @@ -136,13 +135,13 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList int skyGetMasserPhase() const; int skyGetSecundaPhase() const; void skySetMoonColour (bool red); - void configureAmbient(ESMS::CellStore &mCell); + void configureAmbient(MWWorld::CellStore &mCell); - void requestMap (MWWorld::Ptr::CellStore* cell); + void requestMap (MWWorld::CellStore* cell); ///< request the local map for a cell /// configure fog according to cell - void configureFog(ESMS::CellStore &mCell); + void configureFog(MWWorld::CellStore &mCell); /// configure fog manually void configureFog(const float density, const Ogre::ColourValue& colour); diff --git a/apps/openmw/mwrender/shaderhelper.cpp b/apps/openmw/mwrender/shaderhelper.cpp index 59154a295..1f9086db4 100644 --- a/apps/openmw/mwrender/shaderhelper.cpp +++ b/apps/openmw/mwrender/shaderhelper.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index 19e45c189..45e48240b 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -4,14 +4,22 @@ #include #include #include +#include #include #include #include +#include +#include +#include +#include +#include +#include #include #include "../mwbase/environment.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" + #include "renderconst.hpp" #include "renderingmanager.hpp" diff --git a/apps/openmw/mwrender/terrain.cpp b/apps/openmw/mwrender/terrain.cpp index 4dac750c7..f14db34e6 100644 --- a/apps/openmw/mwrender/terrain.cpp +++ b/apps/openmw/mwrender/terrain.cpp @@ -1,16 +1,21 @@ +#include + #include #include -#include +#include -#include "../mwworld/world.hpp" +#include + +#include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "terrainmaterial.hpp" #include "terrain.hpp" #include "renderconst.hpp" #include "shadows.hpp" -#include +#include "renderingmanager.hpp" using namespace Ogre; diff --git a/apps/openmw/mwrender/terrain.hpp b/apps/openmw/mwrender/terrain.hpp index 273ede084..7ac48047d 100644 --- a/apps/openmw/mwrender/terrain.hpp +++ b/apps/openmw/mwrender/terrain.hpp @@ -3,9 +3,10 @@ #include #include -#include "terrainmaterial.hpp" -#include "../mwworld/ptr.hpp" +#include + +#include "terrainmaterial.hpp" namespace Ogre{ class SceneManager; @@ -14,8 +15,15 @@ namespace Ogre{ class Terrain; } +namespace MWWorld +{ + class CellStore; +} + namespace MWRender{ + class RenderingManager; + /** * Implements the Morrowind terrain using the Ogre Terrain Component * @@ -30,8 +38,8 @@ namespace MWRender{ void setDiffuse(const Ogre::ColourValue& diffuse); void setAmbient(const Ogre::ColourValue& ambient); - void cellAdded(MWWorld::Ptr::CellStore* store); - void cellRemoved(MWWorld::Ptr::CellStore* store); + void cellAdded(MWWorld::CellStore* store); + void cellRemoved(MWWorld::CellStore* store); private: Ogre::TerrainGlobalOptions* mTerrainGlobals; Ogre::TerrainGroup mTerrainGroup; diff --git a/apps/openmw/mwrender/water.cpp b/apps/openmw/mwrender/water.cpp index dc9e1fbee..94fb3d6d9 100644 --- a/apps/openmw/mwrender/water.cpp +++ b/apps/openmw/mwrender/water.cpp @@ -1,5 +1,14 @@ #include "water.hpp" +#include +#include +#include +#include +#include +#include +#include +#include + #include "sky.hpp" #include "renderingmanager.hpp" #include "compositors.hpp" diff --git a/apps/openmw/mwrender/water.hpp b/apps/openmw/mwrender/water.hpp index 4d617ea47..71f261f2b 100644 --- a/apps/openmw/mwrender/water.hpp +++ b/apps/openmw/mwrender/water.hpp @@ -1,19 +1,34 @@ #ifndef GAME_MWRENDER_WATER_H #define GAME_MWRENDER_WATER_H -#include +#include +#include +#include +#include +#include +#include + #include #include #include "renderconst.hpp" +namespace Ogre +{ + class Camera; + class SceneManager; + class SceneNode; + class Entity; + class Vector3; + struct RenderTargetEvent; +}; namespace MWRender { class SkyManager; class RenderingManager; - /// Water rendering + /// Water rendering class Water : public Ogre::RenderTargetListener, public Ogre::RenderQueueListener { static const int CELL_SIZE = 8192; diff --git a/apps/openmw/mwscript/aiextensions.cpp b/apps/openmw/mwscript/aiextensions.cpp index 08b1f6f8c..924a0e9dd 100644 --- a/apps/openmw/mwscript/aiextensions.cpp +++ b/apps/openmw/mwscript/aiextensions.cpp @@ -7,6 +7,8 @@ #include #include +#include "../mwworld/class.hpp" + #include "../mwmechanics/creaturestats.hpp" #include "interpretercontext.hpp" diff --git a/apps/openmw/mwscript/animationextensions.cpp b/apps/openmw/mwscript/animationextensions.cpp index 864a2bf1d..6f9253e5d 100644 --- a/apps/openmw/mwscript/animationextensions.cpp +++ b/apps/openmw/mwscript/animationextensions.cpp @@ -9,7 +9,7 @@ #include #include -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" #include "interpretercontext.hpp" #include "ref.hpp" diff --git a/apps/openmw/mwscript/cellextensions.cpp b/apps/openmw/mwscript/cellextensions.cpp index a5db5fd5f..c1d09fac4 100644 --- a/apps/openmw/mwscript/cellextensions.cpp +++ b/apps/openmw/mwscript/cellextensions.cpp @@ -1,6 +1,8 @@ #include "cellextensions.hpp" +#include + #include #include @@ -8,8 +10,8 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/player.hpp" #include "interpretercontext.hpp" diff --git a/apps/openmw/mwscript/compilercontext.cpp b/apps/openmw/mwscript/compilercontext.cpp index 0a6ffd0c7..57e786b11 100644 --- a/apps/openmw/mwscript/compilercontext.cpp +++ b/apps/openmw/mwscript/compilercontext.cpp @@ -1,9 +1,13 @@ #include "compilercontext.hpp" +#include + #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" -#include "../mwworld/world.hpp" +#include "../mwworld/ptr.hpp" +#include "../mwworld/class.hpp" #include "scriptmanager.hpp" diff --git a/apps/openmw/mwscript/controlextensions.cpp b/apps/openmw/mwscript/controlextensions.cpp index 1a7b45246..1f5bdcafb 100644 --- a/apps/openmw/mwscript/controlextensions.cpp +++ b/apps/openmw/mwscript/controlextensions.cpp @@ -10,6 +10,7 @@ #include "../mwbase/environment.hpp" #include "../mwworld/player.hpp" +#include "../mwworld/class.hpp" #include "../mwmechanics/npcstats.hpp" diff --git a/apps/openmw/mwscript/globalscripts.cpp b/apps/openmw/mwscript/globalscripts.cpp index eb96ba5e2..3f4cec723 100644 --- a/apps/openmw/mwscript/globalscripts.cpp +++ b/apps/openmw/mwscript/globalscripts.cpp @@ -3,6 +3,9 @@ #include +#include +#include + #include "interpretercontext.hpp" #include "scriptmanager.hpp" diff --git a/apps/openmw/mwscript/interpretercontext.cpp b/apps/openmw/mwscript/interpretercontext.cpp index 152fcf85c..5da512778 100644 --- a/apps/openmw/mwscript/interpretercontext.cpp +++ b/apps/openmw/mwscript/interpretercontext.cpp @@ -3,13 +3,13 @@ #include #include -#include #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" -#include "../mwworld/world.hpp" +#include "../mwworld/class.hpp" #include "../mwgui/window_manager.hpp" diff --git a/apps/openmw/mwscript/interpretercontext.hpp b/apps/openmw/mwscript/interpretercontext.hpp index 9fdc3c21a..6d97f7949 100644 --- a/apps/openmw/mwscript/interpretercontext.hpp +++ b/apps/openmw/mwscript/interpretercontext.hpp @@ -5,8 +5,9 @@ #include +#include "../mwbase/world.hpp" + #include "../mwworld/ptr.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/action.hpp" namespace MWSound diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index c7569ccdd..0c328e0da 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -1,6 +1,8 @@ #include "miscextensions.hpp" +#include + #include #include @@ -102,7 +104,7 @@ namespace MWScript static_cast (runtime.getContext()); bool enabled = - MWBase::Environment::get().getWorld()->toggleRenderMode (MWWorld::World::Render_CollisionDebug); + MWBase::Environment::get().getWorld()->toggleRenderMode (MWBase::World::Render_CollisionDebug); context.report (enabled ? "Collision Mesh Rendering -> On" : "Collision Mesh Rendering -> Off"); @@ -119,7 +121,7 @@ namespace MWScript static_cast (runtime.getContext()); bool enabled = - MWBase::Environment::get().getWorld()->toggleRenderMode (MWWorld::World::Render_Wireframe); + MWBase::Environment::get().getWorld()->toggleRenderMode (MWBase::World::Render_Wireframe); context.report (enabled ? "Wireframe Rendering -> On" : "Wireframe Rendering -> Off"); @@ -135,7 +137,7 @@ namespace MWScript static_cast (runtime.getContext()); bool enabled = - MWBase::Environment::get().getWorld()->toggleRenderMode (MWWorld::World::Render_Pathgrid); + MWBase::Environment::get().getWorld()->toggleRenderMode (MWBase::World::Render_Pathgrid); context.report (enabled ? "Path Grid rendering -> On" : "Path Grid Rendering -> Off"); diff --git a/apps/openmw/mwscript/ref.hpp b/apps/openmw/mwscript/ref.hpp index 28093c4e5..81b1d5ef9 100644 --- a/apps/openmw/mwscript/ref.hpp +++ b/apps/openmw/mwscript/ref.hpp @@ -6,9 +6,9 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" -#include "../mwworld/world.hpp" #include "interpretercontext.hpp" diff --git a/apps/openmw/mwscript/soundextensions.cpp b/apps/openmw/mwscript/soundextensions.cpp index c2b45641a..3e05d72d3 100644 --- a/apps/openmw/mwscript/soundextensions.cpp +++ b/apps/openmw/mwscript/soundextensions.cpp @@ -8,8 +8,7 @@ #include #include "../mwbase/environment.hpp" - -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" #include "../mwsound/soundmanager.hpp" diff --git a/apps/openmw/mwscript/statsextensions.cpp b/apps/openmw/mwscript/statsextensions.cpp index 7f749185c..15519b3a6 100644 --- a/apps/openmw/mwscript/statsextensions.cpp +++ b/apps/openmw/mwscript/statsextensions.cpp @@ -3,6 +3,8 @@ #include +#include + #include #include diff --git a/apps/openmw/mwsound/soundmanager.cpp b/apps/openmw/mwsound/soundmanager.cpp index ff618ac33..29563ecc1 100644 --- a/apps/openmw/mwsound/soundmanager.cpp +++ b/apps/openmw/mwsound/soundmanager.cpp @@ -9,10 +9,12 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/player.hpp" +#include "../mwrender/player.hpp" + #include "sound_output.hpp" #include "sound_decoder.hpp" #include "sound.hpp" diff --git a/apps/openmw/mwsound/soundmanager.hpp b/apps/openmw/mwsound/soundmanager.hpp index 562b2af00..ff360122b 100644 --- a/apps/openmw/mwsound/soundmanager.hpp +++ b/apps/openmw/mwsound/soundmanager.hpp @@ -130,7 +130,7 @@ namespace MWSound void stopSound3D(MWWorld::Ptr reference); ///< Stop the given object from playing all sounds. - void stopSound(const MWWorld::Ptr::CellStore *cell); + void stopSound(const MWWorld::CellStore *cell); ///< Stop all sounds for the given cell. void stopSound(const std::string& soundId); diff --git a/apps/openmw/mwworld/actionequip.cpp b/apps/openmw/mwworld/actionequip.cpp index f3bb256fd..52b9437fd 100644 --- a/apps/openmw/mwworld/actionequip.cpp +++ b/apps/openmw/mwworld/actionequip.cpp @@ -1,9 +1,11 @@ #include "actionequip.hpp" #include "../mwbase/environment.hpp" -#include "../mwworld/world.hpp" -#include "../mwworld/inventorystore.hpp" -#include "../mwworld/player.hpp" +#include "../mwbase/world.hpp" + +#include "inventorystore.hpp" +#include "player.hpp" +#include "class.hpp" namespace MWWorld { @@ -14,7 +16,7 @@ namespace MWWorld void ActionEquip::execute () { MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); - MWWorld::InventoryStore& invStore = static_cast(MWWorld::Class::get(player).getContainerStore(player)); + MWWorld::InventoryStore& invStore = MWWorld::Class::get(player).getInventoryStore(player); // slots that this item can be equipped in std::pair, bool> slots = MWWorld::Class::get(mObject).getEquipmentSlots(mObject); @@ -51,4 +53,3 @@ namespace MWWorld } } } - diff --git a/apps/openmw/mwworld/actionopen.cpp b/apps/openmw/mwworld/actionopen.cpp index dd36487dc..a70773af9 100644 --- a/apps/openmw/mwworld/actionopen.cpp +++ b/apps/openmw/mwworld/actionopen.cpp @@ -1,13 +1,14 @@ #include "actionopen.hpp" #include "../mwbase/environment.hpp" -#include "class.hpp" -#include "world.hpp" -#include "containerstore.hpp" + #include "../mwclass/container.hpp" #include "../mwgui/window_manager.hpp" #include "../mwgui/container.hpp" +#include "class.hpp" +#include "containerstore.hpp" + namespace MWWorld { ActionOpen::ActionOpen (const MWWorld::Ptr& container) : mContainer (container) { diff --git a/apps/openmw/mwworld/actionread.cpp b/apps/openmw/mwworld/actionread.cpp index 34e95cbd0..1e03230c7 100644 --- a/apps/openmw/mwworld/actionread.cpp +++ b/apps/openmw/mwworld/actionread.cpp @@ -13,8 +13,7 @@ namespace MWWorld void ActionRead::execute () { - ESMS::LiveCellRef *ref = - mObject.get(); + LiveCellRef *ref = mObject.get(); if (ref->base->data.isScroll) { @@ -28,4 +27,3 @@ namespace MWWorld } } } - diff --git a/apps/openmw/mwworld/actiontake.cpp b/apps/openmw/mwworld/actiontake.cpp index 9cff42812..39544b35d 100644 --- a/apps/openmw/mwworld/actiontake.cpp +++ b/apps/openmw/mwworld/actiontake.cpp @@ -2,10 +2,11 @@ #include "actiontake.hpp" #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" + #include "../mwgui/window_manager.hpp" #include "class.hpp" -#include "world.hpp" #include "containerstore.hpp" namespace MWWorld diff --git a/apps/openmw/mwworld/actionteleport.cpp b/apps/openmw/mwworld/actionteleport.cpp index 6ebbd7b7f..8ae3244f8 100644 --- a/apps/openmw/mwworld/actionteleport.cpp +++ b/apps/openmw/mwworld/actionteleport.cpp @@ -2,8 +2,7 @@ #include "actionteleport.hpp" #include "../mwbase/environment.hpp" - -#include "world.hpp" +#include "../mwbase/world.hpp" namespace MWWorld { diff --git a/apps/openmw/mwworld/cells.cpp b/apps/openmw/mwworld/cells.cpp index 3d6042e46..74a91f25f 100644 --- a/apps/openmw/mwworld/cells.cpp +++ b/apps/openmw/mwworld/cells.cpp @@ -4,7 +4,11 @@ #include -#include "world.hpp" +#include + +#include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" + #include "class.hpp" #include "containerstore.hpp" @@ -39,7 +43,7 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getCellStore (const ESM::Cell *cell) void MWWorld::Cells::fillContainers (Ptr::CellStore& cellStore) { - for (ESMS::CellRefList::List::iterator iter ( + for (CellRefList::List::iterator iter ( cellStore.containers.list.begin()); iter!=cellStore.containers.list.end(); ++iter) { @@ -49,7 +53,7 @@ void MWWorld::Cells::fillContainers (Ptr::CellStore& cellStore) iter->base->inventory, mStore); } - for (ESMS::CellRefList::List::iterator iter ( + for (CellRefList::List::iterator iter ( cellStore.creatures.list.begin()); iter!=cellStore.creatures.list.end(); ++iter) { @@ -59,7 +63,7 @@ void MWWorld::Cells::fillContainers (Ptr::CellStore& cellStore) iter->base->inventory, mStore); } - for (ESMS::CellRefList::List::iterator iter ( + for (CellRefList::List::iterator iter ( cellStore.npcs.list.begin()); iter!=cellStore.npcs.list.end(); ++iter) { @@ -85,8 +89,8 @@ MWWorld::Ptr MWWorld::Cells::getPtrAndCache (const std::string& name, Ptr::CellS return ptr; } -MWWorld::Cells::Cells (const ESMS::ESMStore& store, ESM::ESMReader& reader, MWWorld::World& world) -: mStore (store), mReader (reader), mWorld (world), +MWWorld::Cells::Cells (const ESMS::ESMStore& store, ESM::ESMReader& reader) +: mStore (store), mReader (reader), mIdCache (20, std::pair ("", 0)), /// \todo make cache size configurable mIdCacheIndex (0) {} @@ -111,11 +115,11 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getExterior (int x, int y) record.water = 0; record.mapColor = 0; - cell = mWorld.createRecord (record); + cell = MWBase::Environment::get().getWorld()->createRecord (record); } result = mExteriors.insert (std::make_pair ( - std::make_pair (x, y), Ptr::CellStore (cell))).first; + std::make_pair (x, y), CellStore (cell))).first; } if (result->second.mState!=Ptr::CellStore::State_Loaded) @@ -168,64 +172,64 @@ MWWorld::Ptr MWWorld::Cells::getPtr (const std::string& name, Ptr::CellStore& ce return Ptr(); } - if (ESMS::LiveCellRef *ref = cell.activators.find (name)) + if (MWWorld::LiveCellRef *ref = cell.activators.find (name)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = cell.potions.find (name)) + if (MWWorld::LiveCellRef *ref = cell.potions.find (name)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = cell.appas.find (name)) + if (MWWorld::LiveCellRef *ref = cell.appas.find (name)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = cell.armors.find (name)) + if (MWWorld::LiveCellRef *ref = cell.armors.find (name)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = cell.books.find (name)) + if (MWWorld::LiveCellRef *ref = cell.books.find (name)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = cell.clothes.find (name)) + if (MWWorld::LiveCellRef *ref = cell.clothes.find (name)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = cell.containers.find (name)) + if (MWWorld::LiveCellRef *ref = cell.containers.find (name)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = cell.creatures.find (name)) + if (MWWorld::LiveCellRef *ref = cell.creatures.find (name)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = cell.doors.find (name)) + if (MWWorld::LiveCellRef *ref = cell.doors.find (name)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = cell.ingreds.find (name)) + if (MWWorld::LiveCellRef *ref = cell.ingreds.find (name)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = cell.creatureLists.find (name)) + if (MWWorld::LiveCellRef *ref = cell.creatureLists.find (name)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = cell.itemLists.find (name)) + if (MWWorld::LiveCellRef *ref = cell.itemLists.find (name)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = cell.lights.find (name)) + if (MWWorld::LiveCellRef *ref = cell.lights.find (name)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = cell.lockpicks.find (name)) + if (MWWorld::LiveCellRef *ref = cell.lockpicks.find (name)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = cell.miscItems.find (name)) + if (MWWorld::LiveCellRef *ref = cell.miscItems.find (name)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = cell.npcs.find (name)) + if (MWWorld::LiveCellRef *ref = cell.npcs.find (name)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = cell.probes.find (name)) + if (MWWorld::LiveCellRef *ref = cell.probes.find (name)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = cell.repairs.find (name)) + if (MWWorld::LiveCellRef *ref = cell.repairs.find (name)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = cell.statics.find (name)) + if (MWWorld::LiveCellRef *ref = cell.statics.find (name)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = cell.weapons.find (name)) + if (MWWorld::LiveCellRef *ref = cell.weapons.find (name)) return Ptr (ref, &cell); return Ptr(); diff --git a/apps/openmw/mwworld/cells.hpp b/apps/openmw/mwworld/cells.hpp index 05367138f..3e1383166 100644 --- a/apps/openmw/mwworld/cells.hpp +++ b/apps/openmw/mwworld/cells.hpp @@ -18,39 +18,36 @@ namespace ESM namespace MWWorld { - class World; - /// \brief Cell container class Cells { const ESMS::ESMStore& mStore; ESM::ESMReader& mReader; - std::map mInteriors; - std::map, Ptr::CellStore> mExteriors; - MWWorld::World& mWorld; - std::vector > mIdCache; + std::map mInteriors; + std::map, CellStore> mExteriors; + std::vector > mIdCache; std::size_t mIdCacheIndex; Cells (const Cells&); Cells& operator= (const Cells&); - Ptr::CellStore *getCellStore (const ESM::Cell *cell); + CellStore *getCellStore (const ESM::Cell *cell); - void fillContainers (Ptr::CellStore& cellStore); + void fillContainers (CellStore& cellStore); - Ptr getPtrAndCache (const std::string& name, Ptr::CellStore& cellStore); + Ptr getPtrAndCache (const std::string& name, CellStore& cellStore); public: - Cells (const ESMS::ESMStore& store, ESM::ESMReader& reader, MWWorld::World& world); + Cells (const ESMS::ESMStore& store, ESM::ESMReader& reader); ///< \todo pass the dynamic part of the ESMStore isntead (once it is written) of the whole /// world - Ptr::CellStore *getExterior (int x, int y); + CellStore *getExterior (int x, int y); - Ptr::CellStore *getInterior (const std::string& name); + CellStore *getInterior (const std::string& name); - Ptr getPtr (const std::string& name, Ptr::CellStore& cellStore); + Ptr getPtr (const std::string& name, CellStore& cellStore); Ptr getPtr (const std::string& name); }; diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp new file mode 100644 index 000000000..60a7eb6e1 --- /dev/null +++ b/apps/openmw/mwworld/cellstore.cpp @@ -0,0 +1,124 @@ + +#include "cellstore.hpp" + +#include + +#include + +namespace MWWorld +{ + CellStore::CellStore (const ESM::Cell *cell_) : cell (cell_), mState (State_Unloaded) + { + mWaterLevel = cell->water; + } + + void CellStore::load (const ESMS::ESMStore &store, ESM::ESMReader &esm) + { + if (mState!=State_Loaded) + { + if (mState==State_Preloaded) + mIds.clear(); + + std::cout << "loading cell " << cell->getDescription() << std::endl; + + loadRefs (store, esm); + + mState = State_Loaded; + } + } + + void CellStore::preload (const ESMS::ESMStore &store, ESM::ESMReader &esm) + { + if (mState==State_Unloaded) + { + listRefs (store, esm); + + mState = State_Preloaded; + } + } + + void CellStore::listRefs(const ESMS::ESMStore &store, ESM::ESMReader &esm) + { + assert (cell); + + if (cell->context.filename.empty()) + return; // this is a dynamically generated cell -> skipping. + + // Reopen the ESM reader and seek to the right position. + cell->restore (esm); + + ESM::CellRef ref; + + // Get each reference in turn + while (cell->getNextRef (esm, ref)) + { + std::string lowerCase; + + std::transform (ref.refID.begin(), ref.refID.end(), std::back_inserter (lowerCase), + (int(*)(int)) std::tolower); + + mIds.push_back (lowerCase); + } + + std::sort (mIds.begin(), mIds.end()); + } + + void CellStore::loadRefs(const ESMS::ESMStore &store, ESM::ESMReader &esm) + { + assert (cell); + + if (cell->context.filename.empty()) + return; // this is a dynamically generated cell -> skipping. + + // Reopen the ESM reader and seek to the right position. + cell->restore(esm); + + ESM::CellRef ref; + + // Get each reference in turn + while(cell->getNextRef(esm, ref)) + { + std::string lowerCase; + + std::transform (ref.refID.begin(), ref.refID.end(), std::back_inserter (lowerCase), + (int(*)(int)) std::tolower); + + int rec = store.find(ref.refID); + + ref.refID = lowerCase; + + /* We can optimize this further by storing the pointer to the + record itself in store.all, so that we don't need to look it + up again here. However, never optimize. There are infinite + opportunities to do that later. + */ + switch(rec) + { + case ESM::REC_ACTI: activators.find(ref, store.activators); break; + case ESM::REC_ALCH: potions.find(ref, store.potions); break; + case ESM::REC_APPA: appas.find(ref, store.appas); break; + case ESM::REC_ARMO: armors.find(ref, store.armors); break; + case ESM::REC_BOOK: books.find(ref, store.books); break; + case ESM::REC_CLOT: clothes.find(ref, store.clothes); break; + case ESM::REC_CONT: containers.find(ref, store.containers); break; + case ESM::REC_CREA: creatures.find(ref, store.creatures); break; + case ESM::REC_DOOR: doors.find(ref, store.doors); break; + case ESM::REC_INGR: ingreds.find(ref, store.ingreds); break; + case ESM::REC_LEVC: creatureLists.find(ref, store.creatureLists); break; + case ESM::REC_LEVI: itemLists.find(ref, store.itemLists); break; + case ESM::REC_LIGH: lights.find(ref, store.lights); break; + case ESM::REC_LOCK: lockpicks.find(ref, store.lockpicks); break; + case ESM::REC_MISC: miscItems.find(ref, store.miscItems); break; + case ESM::REC_NPC_: npcs.find(ref, store.npcs); break; + case ESM::REC_PROB: probes.find(ref, store.probes); break; + case ESM::REC_REPA: repairs.find(ref, store.repairs); break; + case ESM::REC_STAT: statics.find(ref, store.statics); break; + case ESM::REC_WEAP: weapons.find(ref, store.weapons); break; + + case 0: std::cout << "Cell reference " + ref.refID + " not found!\n"; break; + default: + std::cout << "WARNING: Ignoring reference '" << ref.refID << "' of unhandled type\n"; + } + } + } +} diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp new file mode 100644 index 000000000..8253f3f0b --- /dev/null +++ b/apps/openmw/mwworld/cellstore.hpp @@ -0,0 +1,174 @@ +#ifndef GAME_MWWORLD_CELLSTORE_H +#define GAME_MWWORLD_CELLSTORE_H + +#include + +#include +#include +#include +#include +#include + +#include "refdata.hpp" + +namespace ESMS +{ + struct ESMStore; +} + +namespace MWWorld +{ + /// A reference to one object (of any type) in a cell. + /// + /// Constructing this with a CellRef instance in the constructor means that + /// in practice (where D is RefData) the possibly mutable data is copied + /// across to mData. If later adding data (such as position) to CellRef + /// this would have to be manually copied across. + template + struct LiveCellRef + { + LiveCellRef(const ESM::CellRef& cref, const X* b = NULL) : base(b), ref(cref), + mData(ref) {} + + + LiveCellRef(const X* b = NULL) : base(b), mData(ref) {} + + // The object that this instance is based on. + const X* base; + + /* Information about this instance, such as 3D location and + rotation and individual type-dependent data. + */ + ESM::CellRef ref; + + /// runtime-data + RefData mData; + }; + + /// A list of cell references + template + struct CellRefList + { + typedef LiveCellRef LiveRef; + typedef std::list List; + List list; + + // Search for the given reference in the given reclist from + // ESMStore. Insert the reference into the list if a match is + // found. If not, throw an exception. + template + void find(ESM::CellRef &ref, const Y& recList) + { + const X* obj = recList.find(ref.refID); + if(obj == NULL) + throw std::runtime_error("Error resolving cell reference " + ref.refID); + + list.push_back(LiveRef(ref, obj)); + } + + LiveRef *find (const std::string& name) + { + for (typename std::list::iterator iter (list.begin()); iter!=list.end(); ++iter) + { + if (iter->ref.refID==name) + return &*iter; + } + + return 0; + } + }; + + /// A storage struct for one single cell reference. + class CellStore + { + public: + + enum State + { + State_Unloaded, State_Preloaded, State_Loaded + }; + + CellStore (const ESM::Cell *cell_); + + const ESM::Cell *cell; + State mState; + std::vector mIds; + + float mWaterLevel; + + // Lists for each individual object type + CellRefList activators; + CellRefList potions; + CellRefList appas; + CellRefList armors; + CellRefList books; + CellRefList clothes; + CellRefList containers; + CellRefList creatures; + CellRefList doors; + CellRefList ingreds; + CellRefList creatureLists; + CellRefList itemLists; + CellRefList lights; + CellRefList lockpicks; + CellRefList miscItems; + CellRefList npcs; + CellRefList probes; + CellRefList repairs; + CellRefList statics; + CellRefList weapons; + + void load (const ESMS::ESMStore &store, ESM::ESMReader &esm); + + void preload (const ESMS::ESMStore &store, ESM::ESMReader &esm); + + /// Call functor (ref) for each reference. functor must return a bool. Returning + /// false will abort the iteration. + /// \return Iteration completed? + template + bool forEach (Functor& functor) + { + return + forEachImp (functor, activators) && + forEachImp (functor, potions) && + forEachImp (functor, appas) && + forEachImp (functor, armors) && + forEachImp (functor, books) && + forEachImp (functor, clothes) && + forEachImp (functor, containers) && + forEachImp (functor, creatures) && + forEachImp (functor, doors) && + forEachImp (functor, ingreds) && + forEachImp (functor, creatureLists) && + forEachImp (functor, itemLists) && + forEachImp (functor, lights) && + forEachImp (functor, lockpicks) && + forEachImp (functor, miscItems) && + forEachImp (functor, npcs) && + forEachImp (functor, probes) && + forEachImp (functor, repairs) && + forEachImp (functor, statics) && + forEachImp (functor, weapons); + } + + private: + + template + bool forEachImp (Functor& functor, List& list) + { + for (typename List::List::iterator iter (list.list.begin()); iter!=list.list.end(); + ++iter) + if (!functor (iter->ref, iter->mData)) + return false; + + return true; + } + + /// Run through references and store IDs + void listRefs(const ESMS::ESMStore &store, ESM::ESMReader &esm); + + void loadRefs(const ESMS::ESMStore &store, ESM::ESMReader &esm); + }; +} + +#endif diff --git a/apps/openmw/mwworld/class.cpp b/apps/openmw/mwworld/class.cpp index fe39406fe..13b40ddbb 100644 --- a/apps/openmw/mwworld/class.cpp +++ b/apps/openmw/mwworld/class.cpp @@ -9,6 +9,8 @@ #include "nullaction.hpp" #include "containerstore.hpp" +#include "../mwgui/tooltips.hpp" + namespace MWWorld { std::map > Class::sClasses; diff --git a/apps/openmw/mwworld/class.hpp b/apps/openmw/mwworld/class.hpp index 46781d516..fe7b5dc80 100644 --- a/apps/openmw/mwworld/class.hpp +++ b/apps/openmw/mwworld/class.hpp @@ -8,11 +8,6 @@ #include #include "action.hpp" -#include "refdata.hpp" -#include "physicssystem.hpp" - -#include "../mwrender/renderinginterface.hpp" -#include "../mwgui/tooltips.hpp" namespace Ogre { @@ -21,7 +16,7 @@ namespace Ogre namespace MWRender { - class CellRenderImp; + class RenderingInterface; } namespace MWMechanics @@ -31,11 +26,17 @@ namespace MWMechanics struct Movement; } +namespace MWGui +{ + struct ToolTipInfo; +} + namespace MWWorld { class Ptr; class ContainerStore; class InventoryStore; + class PhysicsSystem; /// \brief Base class for referenceable esm records class Class diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index 3304d0e6d..1d473246c 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -5,12 +5,12 @@ #include #include -#include +#include #include #include "../mwbase/environment.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" #include "manualref.hpp" #include "refdata.hpp" @@ -19,11 +19,11 @@ namespace { template - float getTotalWeight (const ESMS::CellRefList& cellRefList) + float getTotalWeight (const MWWorld::CellRefList& cellRefList) { float sum = 0; - for (typename ESMS::CellRefList::List::const_iterator iter ( + for (typename MWWorld::CellRefList::List::const_iterator iter ( cellRefList.list.begin()); iter!=cellRefList.list.end(); ++iter) @@ -78,7 +78,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& ptr) // this ensures that gold piles of different sizes stack with each other (also, several scripts rely on Gold_001 for detecting player gold) if (MWWorld::Class::get(ptr).getName(ptr) == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str) { - ESMS::LiveCellRef *gold = + MWWorld::LiveCellRef *gold = ptr.get(); if (compare_string_ci(gold->ref.refID, "gold_001") @@ -281,29 +281,29 @@ MWWorld::ContainerStoreIterator::ContainerStoreIterator (int mask, ContainerStor ++*this; } -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Potion), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mPotion(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Apparatus), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mApparatus(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Armor), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mArmor(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Book), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mBook(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Clothing), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mClothing(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Ingredient), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mIngredient(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Light), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mLight(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Lockpick), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mLockpick(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Miscellaneous), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mMiscellaneous(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Probe), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mProbe(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Repair), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mRepair(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Weapon), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mWeapon(iterator){} void MWWorld::ContainerStoreIterator::incType() diff --git a/apps/openmw/mwworld/containerstore.hpp b/apps/openmw/mwworld/containerstore.hpp index 15b553f9d..f71b493bd 100644 --- a/apps/openmw/mwworld/containerstore.hpp +++ b/apps/openmw/mwworld/containerstore.hpp @@ -3,8 +3,7 @@ #include -#include - +#include "cellstore.hpp" #include "refdata.hpp" #include "ptr.hpp" @@ -40,18 +39,18 @@ namespace MWWorld private: - ESMS::CellRefList potions; - ESMS::CellRefList appas; - ESMS::CellRefList armors; - ESMS::CellRefList books; - ESMS::CellRefList clothes; - ESMS::CellRefList ingreds; - ESMS::CellRefList lights; - ESMS::CellRefList lockpicks; - ESMS::CellRefList miscItems; - ESMS::CellRefList probes; - ESMS::CellRefList repairs; - ESMS::CellRefList weapons; + MWWorld::CellRefList potions; + MWWorld::CellRefList appas; + MWWorld::CellRefList armors; + MWWorld::CellRefList books; + MWWorld::CellRefList clothes; + MWWorld::CellRefList ingreds; + MWWorld::CellRefList lights; + MWWorld::CellRefList lockpicks; + MWWorld::CellRefList miscItems; + MWWorld::CellRefList probes; + MWWorld::CellRefList repairs; + MWWorld::CellRefList weapons; int mStateId; mutable float mCachedWeight; mutable bool mWeightUpToDate; @@ -122,18 +121,18 @@ namespace MWWorld ContainerStore *mContainer; mutable Ptr mPtr; - ESMS::CellRefList::List::iterator mPotion; - ESMS::CellRefList::List::iterator mApparatus; - ESMS::CellRefList::List::iterator mArmor; - ESMS::CellRefList::List::iterator mBook; - ESMS::CellRefList::List::iterator mClothing; - ESMS::CellRefList::List::iterator mIngredient; - ESMS::CellRefList::List::iterator mLight; - ESMS::CellRefList::List::iterator mLockpick; - ESMS::CellRefList::List::iterator mMiscellaneous; - ESMS::CellRefList::List::iterator mProbe; - ESMS::CellRefList::List::iterator mRepair; - ESMS::CellRefList::List::iterator mWeapon; + MWWorld::CellRefList::List::iterator mPotion; + MWWorld::CellRefList::List::iterator mApparatus; + MWWorld::CellRefList::List::iterator mArmor; + MWWorld::CellRefList::List::iterator mBook; + MWWorld::CellRefList::List::iterator mClothing; + MWWorld::CellRefList::List::iterator mIngredient; + MWWorld::CellRefList::List::iterator mLight; + MWWorld::CellRefList::List::iterator mLockpick; + MWWorld::CellRefList::List::iterator mMiscellaneous; + MWWorld::CellRefList::List::iterator mProbe; + MWWorld::CellRefList::List::iterator mRepair; + MWWorld::CellRefList::List::iterator mWeapon; private: @@ -144,18 +143,18 @@ namespace MWWorld ///< Begin-iterator // construct iterator using a CellRefList iterator - ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); void incType(); diff --git a/apps/openmw/mwworld/inventorystore.cpp b/apps/openmw/mwworld/inventorystore.cpp index 6df73004b..9d99227ed 100644 --- a/apps/openmw/mwworld/inventorystore.cpp +++ b/apps/openmw/mwworld/inventorystore.cpp @@ -6,9 +6,10 @@ #include -#include "../mwbase/environment.hpp" +#include -#include "../mwworld/world.hpp" +#include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwmechanics/npcstats.hpp" diff --git a/apps/openmw/mwworld/localscripts.cpp b/apps/openmw/mwworld/localscripts.cpp index 2d90d90e0..d15f00c92 100644 --- a/apps/openmw/mwworld/localscripts.cpp +++ b/apps/openmw/mwworld/localscripts.cpp @@ -1,13 +1,17 @@ #include "localscripts.hpp" +#include + +#include "cellstore.hpp" + namespace { template void listCellScripts (MWWorld::LocalScripts& localScripts, - ESMS::CellRefList& cellRefList, MWWorld::Ptr::CellStore *cell) + MWWorld::CellRefList& cellRefList, MWWorld::Ptr::CellStore *cell) { - for (typename ESMS::CellRefList::List::iterator iter ( + for (typename MWWorld::CellRefList::List::iterator iter ( cellRefList.list.begin()); iter!=cellRefList.list.end(); ++iter) { diff --git a/apps/openmw/mwworld/localscripts.hpp b/apps/openmw/mwworld/localscripts.hpp index 1ea2cf4d5..78f65e356 100644 --- a/apps/openmw/mwworld/localscripts.hpp +++ b/apps/openmw/mwworld/localscripts.hpp @@ -13,6 +13,8 @@ namespace ESMS namespace MWWorld { + class CellStore; + /// \brief List of active local scripts class LocalScripts { @@ -41,13 +43,13 @@ namespace MWWorld void add (const std::string& scriptName, const Ptr& ptr); ///< Add script to collection of active local scripts. - void addCell (Ptr::CellStore *cell); + void addCell (CellStore *cell); ///< Add all local scripts in a cell. void clear(); ///< Clear active local scripts collection. - void clearCell (Ptr::CellStore *cell); + void clearCell (CellStore *cell); ///< Remove all scripts belonging to \a cell. void remove (const Ptr& ptr); diff --git a/apps/openmw/mwworld/manualref.hpp b/apps/openmw/mwworld/manualref.hpp index f8bc7d983..6044ac8d5 100644 --- a/apps/openmw/mwworld/manualref.hpp +++ b/apps/openmw/mwworld/manualref.hpp @@ -3,10 +3,10 @@ #include -#include #include #include "ptr.hpp" +#include "cellstore.hpp" namespace MWWorld { @@ -24,11 +24,11 @@ namespace MWWorld { if (const T *instance = list.search (name)) { - ESMS::LiveCellRef ref; + LiveCellRef ref; ref.base = instance; mRef = ref; - mPtr = Ptr (&boost::any_cast&> (mRef), 0); + mPtr = Ptr (&boost::any_cast&> (mRef), 0); return true; } @@ -41,11 +41,11 @@ namespace MWWorld { if (const T *instance = list.search (name)) { - ESMS::LiveCellRef ref; + LiveCellRef ref; ref.base = instance; mRef = ref; - mPtr = Ptr (&boost::any_cast&> (mRef), 0); + mPtr = Ptr (&boost::any_cast&> (mRef), 0); return true; } diff --git a/apps/openmw/mwworld/physicssystem.cpp b/apps/openmw/mwworld/physicssystem.cpp index 7c1ff31b4..4d16a6d1c 100644 --- a/apps/openmw/mwworld/physicssystem.cpp +++ b/apps/openmw/mwworld/physicssystem.cpp @@ -1,18 +1,19 @@ +#include "physicssystem.hpp" + #include -#include "physicssystem.hpp" -#include "../mwworld/ptr.hpp" -#include "../mwworld/world.hpp" // FIXME -#include +#include +#include +#include +#include +#include +#include -#include "OgreRoot.h" -#include "OgreRenderWindow.h" -#include "OgreSceneManager.h" -#include "OgreViewport.h" -#include "OgreCamera.h" -#include "OgreTextureManager.h" +#include +#include "../mwbase/world.hpp" // FIXME +#include "ptr.hpp" using namespace Ogre; namespace MWWorld diff --git a/apps/openmw/mwworld/player.cpp b/apps/openmw/mwworld/player.cpp index 91b030d1c..0eeebad4e 100644 --- a/apps/openmw/mwworld/player.cpp +++ b/apps/openmw/mwworld/player.cpp @@ -1,18 +1,22 @@ #include "player.hpp" +#include + +#include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" + #include "../mwrender/player.hpp" #include "../mwmechanics/movement.hpp" #include "../mwmechanics/npcstats.hpp" -#include "world.hpp" #include "class.hpp" namespace MWWorld { - Player::Player (MWRender::Player *renderer, const ESM::NPC *player, MWWorld::World& world) : - mCellStore (0), mRenderer (renderer), mWorld (world), mClass (0), + Player::Player (MWRender::Player *renderer, const ESM::NPC *player, const MWBase::World& world) : + mCellStore (0), mRenderer (renderer), mClass (0), mAutoMove (false), mForwardBackward (0) { mPlayer.base = player; @@ -36,8 +40,8 @@ namespace MWWorld void Player::setPos(float x, float y, float z) { - /// \todo This fcuntion should be removed during the mwrender-refactoring. - mWorld.moveObject (getPlayer(), x, y, z); + /// \todo This fcuntion should be removed during the mwrender-refactoring. + MWBase::Environment::get().getWorld()->moveObject (getPlayer(), x, y, z); } void Player::setRot(float x, float y, float z) @@ -90,14 +94,13 @@ namespace MWWorld MWWorld::Class::get (ptr).getMovementSettings (ptr).mForwardBackward = value; } - void Player::setUpDown(int value) - { - MWWorld::Ptr ptr = getPlayer(); - + void Player::setUpDown(int value) + { + MWWorld::Ptr ptr = getPlayer(); MWWorld::Class::get (ptr).getMovementSettings (ptr).mUpDown = value; - } + } void Player::toggleRunning() { diff --git a/apps/openmw/mwworld/player.hpp b/apps/openmw/mwworld/player.hpp index a5c5ff308..b1692bd81 100644 --- a/apps/openmw/mwworld/player.hpp +++ b/apps/openmw/mwworld/player.hpp @@ -3,13 +3,17 @@ #include "OgreCamera.h" -#include - +#include "../mwworld/cellstore.hpp" #include "../mwworld/refdata.hpp" #include "../mwworld/ptr.hpp" #include "../mwmechanics/drawstate.hpp" +namespace MWBase +{ + class World; +} + namespace MWRender { class Player; @@ -17,15 +21,14 @@ namespace MWRender namespace MWWorld { - class World; + class CellStore; /// \brief NPC object representing the player and additional player data - class Player + class Player { - ESMS::LiveCellRef mPlayer; - MWWorld::Ptr::CellStore *mCellStore; + LiveCellRef mPlayer; + MWWorld::CellStore *mCellStore; MWRender::Player *mRenderer; - MWWorld::World& mWorld; std::string mName; bool mMale; std::string mRace; @@ -35,7 +38,7 @@ namespace MWWorld int mForwardBackward; public: - Player(MWRender::Player *renderer, const ESM::NPC *player, MWWorld::World& world); + Player(MWRender::Player *renderer, const ESM::NPC *player, const MWBase::World& world); ~Player(); @@ -45,7 +48,7 @@ namespace MWWorld /// Set where the player is looking at. Uses Morrowind (euler) angles void setRot(float x, float y, float z); - void setCell (MWWorld::Ptr::CellStore *cellStore) + void setCell (MWWorld::CellStore *cellStore) { mCellStore = cellStore; } @@ -119,7 +122,7 @@ namespace MWWorld void setLeftRight (int value); void setForwardBackward (int value); - void setUpDown(int value); + void setUpDown(int value); void toggleRunning(); }; diff --git a/apps/openmw/mwworld/ptr.hpp b/apps/openmw/mwworld/ptr.hpp index 4cf3e98da..b7469b8f5 100644 --- a/apps/openmw/mwworld/ptr.hpp +++ b/apps/openmw/mwworld/ptr.hpp @@ -7,9 +7,7 @@ #include -#include - -#include "refdata.hpp" +#include "cellstore.hpp" namespace MWWorld { @@ -21,7 +19,8 @@ namespace MWWorld { public: - typedef ESMS::CellStore CellStore; + typedef MWWorld::CellStore CellStore; + ///< \deprecated boost::any mPtr; ESM::CellRef *mCellRef; @@ -51,7 +50,7 @@ namespace MWWorld } template - Ptr (ESMS::LiveCellRef *liveCellRef, CellStore *cell) + Ptr (MWWorld::LiveCellRef *liveCellRef, CellStore *cell) : mContainerStore (0) { mPtr = liveCellRef; @@ -62,9 +61,9 @@ namespace MWWorld } template - ESMS::LiveCellRef *get() const + MWWorld::LiveCellRef *get() const { - return boost::any_cast*> (mPtr); + return boost::any_cast*> (mPtr); } ESM::CellRef& getCellRef() const; diff --git a/apps/openmw/mwworld/refdata.cpp b/apps/openmw/mwworld/refdata.cpp index e1c14b907..14ddd3ec5 100644 --- a/apps/openmw/mwworld/refdata.cpp +++ b/apps/openmw/mwworld/refdata.cpp @@ -1,9 +1,10 @@ #include "refdata.hpp" -#include +#include #include "customdata.hpp" +#include "cellstore.hpp" namespace MWWorld { diff --git a/apps/openmw/mwworld/refdata.hpp b/apps/openmw/mwworld/refdata.hpp index 30d676f13..41521e47a 100644 --- a/apps/openmw/mwworld/refdata.hpp +++ b/apps/openmw/mwworld/refdata.hpp @@ -3,12 +3,15 @@ #include -#include - #include #include "../mwscript/locals.hpp" +namespace Ogre +{ + class SceneNode; +} + namespace ESM { class Script; diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index a47137d25..39496def3 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -1,7 +1,7 @@ #include "scene.hpp" -#include "world.hpp" #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" /// FIXME #include "../mwmechanics/mechanicsmanager.hpp" @@ -9,12 +9,12 @@ #include "../mwgui/window_manager.hpp" -#include "../mwworld/world.hpp" /// FIXME #include "../mwworld/manualref.hpp" /// FIXME #include "ptr.hpp" #include "player.hpp" #include "class.hpp" +#include "localscripts.hpp" #include "cellfunctors.hpp" @@ -23,7 +23,7 @@ namespace template void insertCellRefList(MWRender::RenderingManager& rendering, - T& cellRefList, ESMS::CellStore &cell, MWWorld::PhysicsSystem& physics) + T& cellRefList, MWWorld::CellStore &cell, MWWorld::PhysicsSystem& physics) { if (!cellRefList.list.empty()) { @@ -86,7 +86,7 @@ namespace MWWorld if (!((*iter)->cell->data.flags & ESM::Cell::Interior)) { - ESM::Land* land = mWorld->getStore().lands.search((*iter)->cell->data.gridX,(*iter)->cell->data.gridY); + ESM::Land* land = MWBase::Environment::get().getWorld()->getStore().lands.search((*iter)->cell->data.gridX,(*iter)->cell->data.gridY); if (land) mPhysics->removeHeightField( (*iter)->cell->data.gridX, (*iter)->cell->data.gridY ); } @@ -95,7 +95,7 @@ namespace MWWorld mRendering.removeCell(*iter); //mPhysics->removeObject("Unnamed_43"); - mWorld->getLocalScripts().clearCell (*iter); + MWBase::Environment::get().getWorld()->getLocalScripts().clearCell (*iter); MWBase::Environment::get().getMechanicsManager()->dropActors (*iter); MWBase::Environment::get().getSoundManager()->stopSound (*iter); mActiveCells.erase(*iter); @@ -107,7 +107,7 @@ namespace MWWorld void Scene::loadCell (Ptr::CellStore *cell) { // register local scripts - mWorld->getLocalScripts().addCell (cell); + MWBase::Environment::get().getWorld()->getLocalScripts().addCell (cell); @@ -124,7 +124,7 @@ namespace MWWorld if (!(cell->cell->data.flags & ESM::Cell::Interior)) { - ESM::Land* land = mWorld->getStore().lands.search(cell->cell->data.gridX,cell->cell->data.gridY); + ESM::Land* land = MWBase::Environment::get().getWorld()->getStore().lands.search(cell->cell->data.gridX,cell->cell->data.gridY); if (land) mPhysics->addHeightField (land->landData->heights, cell->cell->data.gridX, cell->cell->data.gridY, @@ -146,14 +146,14 @@ namespace MWWorld mPhysics->setCurrentWater(hasWater, cell->cell->water); if (adjustPlayerPos) { - mWorld->getPlayer().setPos (position.pos[0], position.pos[1], position.pos[2]); - mWorld->getPlayer().setRot (position.rot[0], position.rot[1], position.rot[2]); + MWBase::Environment::get().getWorld()->getPlayer().setPos (position.pos[0], position.pos[1], position.pos[2]); + MWBase::Environment::get().getWorld()->getPlayer().setRot (position.rot[0], position.rot[1], position.rot[2]); } - mWorld->getPlayer().setCell (cell); + MWBase::Environment::get().getWorld()->getPlayer().setCell (cell); - MWBase::Environment::get().getMechanicsManager()->addActor (mWorld->getPlayer().getPlayer()); - MWBase::Environment::get().getMechanicsManager()->watchActor (mWorld->getPlayer().getPlayer()); + MWBase::Environment::get().getMechanicsManager()->addActor (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); + MWBase::Environment::get().getMechanicsManager()->watchActor (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); MWBase::Environment::get().getWindowManager()->changeCell( mCurrentCell ); } @@ -163,7 +163,7 @@ namespace MWWorld mRendering.preCellChange(mCurrentCell); // remove active - MWBase::Environment::get().getMechanicsManager()->removeActor (mWorld->getPlayer().getPlayer()); + MWBase::Environment::get().getMechanicsManager()->removeActor (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); CellStoreCollection::iterator active = mActiveCells.begin(); @@ -202,7 +202,7 @@ namespace MWWorld if (iter==mActiveCells.end()) { - Ptr::CellStore *cell = mWorld->getExterior(x, y); + CellStore *cell = MWBase::Environment::get().getWorld()->getExterior(x, y); loadCell (cell); } @@ -228,10 +228,10 @@ namespace MWWorld // adjust player - playerCellChange (mWorld->getExterior(X, Y), position, adjustPlayerPos); + playerCellChange (MWBase::Environment::get().getWorld()->getExterior(X, Y), position, adjustPlayerPos); // Sky system - mWorld->adjustSky(); + MWBase::Environment::get().getWorld()->adjustSky(); mRendering.switchToExterior(); @@ -239,9 +239,8 @@ namespace MWWorld } //We need the ogre renderer and a scene node. - Scene::Scene (World *world, MWRender::RenderingManager& rendering, PhysicsSystem *physics) - : mCurrentCell (0), mCellChanged (false), mWorld(world), - mPhysics(physics), mRendering(rendering) + Scene::Scene (MWRender::RenderingManager& rendering, PhysicsSystem *physics) + : mCurrentCell (0), mCellChanged (false), mPhysics(physics), mRendering(rendering) { } @@ -263,7 +262,7 @@ namespace MWWorld { std::cout << "Changing to interior\n"; - Ptr::CellStore *cell = mWorld->getInterior(cellName); + CellStore *cell = MWBase::Environment::get().getWorld()->getInterior(cellName); // remove active CellStoreCollection::iterator active = mActiveCells.begin(); @@ -287,7 +286,7 @@ namespace MWWorld mRendering.configureFog(*cell); // Sky system - mWorld->adjustSky(); + MWBase::Environment::get().getWorld()->adjustSky(); mCellChanged = true; } @@ -297,7 +296,7 @@ namespace MWWorld int x = 0; int y = 0; - mWorld->positionToIndex (position.pos[0], position.pos[1], x, y); + MWBase::Environment::get().getWorld()->positionToIndex (position.pos[0], position.pos[1], x, y); changeCell (x, y, position, true); } @@ -312,7 +311,7 @@ namespace MWWorld mCellChanged = false; } - void Scene::insertCell(ESMS::CellStore &cell) + void Scene::insertCell (Ptr::CellStore &cell) { // Loop through all references in the cell insertCellRefList(mRendering, cell.activators, cell, *mPhysics); @@ -339,7 +338,7 @@ namespace MWWorld /// \todo this whole code needs major clean up, and doesn't belong in this class. - void Scene::insertObject(MWWorld::Ptr ptr, Ptr::CellStore* cell) + void Scene::insertObject (const Ptr& ptr, CellStore* cell) { std::string type = ptr.getTypeName(); @@ -348,67 +347,67 @@ namespace MWWorld // insert into the correct CellRefList if (type == typeid(ESM::Potion).name()) { - ESMS::LiveCellRef* ref = ptr.get(); + MWWorld::LiveCellRef* ref = ptr.get(); cell->potions.list.push_back( *ref ); newPtr = MWWorld::Ptr(&cell->potions.list.back(), cell); } else if (type == typeid(ESM::Apparatus).name()) { - ESMS::LiveCellRef* ref = ptr.get(); + MWWorld::LiveCellRef* ref = ptr.get(); cell->appas.list.push_back( *ref ); newPtr = MWWorld::Ptr(&cell->appas.list.back(), cell); } else if (type == typeid(ESM::Armor).name()) { - ESMS::LiveCellRef* ref = ptr.get(); + MWWorld::LiveCellRef* ref = ptr.get(); cell->armors.list.push_back( *ref ); newPtr = MWWorld::Ptr(&cell->armors.list.back(), cell); } else if (type == typeid(ESM::Book).name()) { - ESMS::LiveCellRef* ref = ptr.get(); + MWWorld::LiveCellRef* ref = ptr.get(); cell->books.list.push_back( *ref ); newPtr = MWWorld::Ptr(&cell->books.list.back(), cell); } else if (type == typeid(ESM::Clothing).name()) { - ESMS::LiveCellRef* ref = ptr.get(); + MWWorld::LiveCellRef* ref = ptr.get(); cell->clothes.list.push_back( *ref ); newPtr = MWWorld::Ptr(&cell->clothes.list.back(), cell); } else if (type == typeid(ESM::Ingredient).name()) { - ESMS::LiveCellRef* ref = ptr.get(); + MWWorld::LiveCellRef* ref = ptr.get(); cell->ingreds.list.push_back( *ref ); newPtr = MWWorld::Ptr(&cell->ingreds.list.back(), cell); } else if (type == typeid(ESM::Light).name()) { - ESMS::LiveCellRef* ref = ptr.get(); + MWWorld::LiveCellRef* ref = ptr.get(); cell->lights.list.push_back( *ref ); newPtr = MWWorld::Ptr(&cell->lights.list.back(), cell); } else if (type == typeid(ESM::Tool).name()) { - ESMS::LiveCellRef* ref = ptr.get(); + MWWorld::LiveCellRef* ref = ptr.get(); cell->lockpicks.list.push_back( *ref ); newPtr = MWWorld::Ptr(&cell->lockpicks.list.back(), cell); } else if (type == typeid(ESM::Repair).name()) { - ESMS::LiveCellRef* ref = ptr.get(); + MWWorld::LiveCellRef* ref = ptr.get(); cell->repairs.list.push_back( *ref ); newPtr = MWWorld::Ptr(&cell->repairs.list.back(), cell); } else if (type == typeid(ESM::Probe).name()) { - ESMS::LiveCellRef* ref = ptr.get(); + MWWorld::LiveCellRef* ref = ptr.get(); cell->probes.list.push_back( *ref ); newPtr = MWWorld::Ptr(&cell->probes.list.back(), cell); } else if (type == typeid(ESM::Weapon).name()) { - ESMS::LiveCellRef* ref = ptr.get(); + MWWorld::LiveCellRef* ref = ptr.get(); cell->weapons.list.push_back( *ref ); newPtr = MWWorld::Ptr(&cell->weapons.list.back(), cell); } @@ -432,7 +431,7 @@ namespace MWWorld MWWorld::ManualRef newRef (MWBase::Environment::get().getWorld()->getStore(), base); - ESMS::LiveCellRef* ref = newRef.getPtr().get(); + MWWorld::LiveCellRef* ref = newRef.getPtr().get(); cell->miscItems.list.push_back( *ref ); newPtr = MWWorld::Ptr(&cell->miscItems.list.back(), cell); @@ -444,7 +443,7 @@ namespace MWWorld } else { - ESMS::LiveCellRef* ref = ptr.get(); + MWWorld::LiveCellRef* ref = ptr.get(); cell->miscItems.list.push_back( *ref ); newPtr = MWWorld::Ptr(&cell->miscItems.list.back(), cell); diff --git a/apps/openmw/mwworld/scene.hpp b/apps/openmw/mwworld/scene.hpp index 906580ff4..64a8c9f8e 100644 --- a/apps/openmw/mwworld/scene.hpp +++ b/apps/openmw/mwworld/scene.hpp @@ -8,14 +8,10 @@ #include -#include - #include "../mwrender/renderingmanager.hpp" #include "../mwrender/renderinginterface.hpp" #include "physicssystem.hpp" -#include "refdata.hpp" -#include "ptr.hpp" #include "globals.hpp" namespace Ogre @@ -47,43 +43,43 @@ namespace MWRender namespace MWWorld { class Player; + class CellStore; + class Ptr; class Scene { - public: - typedef std::set CellStoreCollection; + typedef std::set CellStoreCollection; private: //OEngine::Render::OgreRenderer& mRenderer; - Ptr::CellStore* mCurrentCell; // the cell, the player is in + CellStore* mCurrentCell; // the cell, the player is in CellStoreCollection mActiveCells; bool mCellChanged; - World *mWorld; PhysicsSystem *mPhysics; MWRender::RenderingManager& mRendering; - void playerCellChange (Ptr::CellStore *cell, const ESM::Position& position, + void playerCellChange (CellStore *cell, const ESM::Position& position, bool adjustPlayerPos = true); public: - Scene (World *world, MWRender::RenderingManager& rendering, PhysicsSystem *physics); + Scene (MWRender::RenderingManager& rendering, PhysicsSystem *physics); ~Scene(); void unloadCell (CellStoreCollection::iterator iter); - void loadCell (Ptr::CellStore *cell); + void loadCell (CellStore *cell); void changeCell (int X, int Y, const ESM::Position& position, bool adjustPlayerPos); ///< Move from exterior to interior or from interior cell to a different /// interior cell. - Ptr::CellStore* getCurrentCell (); + CellStore* getCurrentCell (); const CellStoreCollection& getActiveCells () const; @@ -98,11 +94,11 @@ namespace MWWorld void markCellAsUnchanged(); - void insertCell(ESMS::CellStore &cell); + void insertCell (Ptr::CellStore &cell); /// this method is only meant for dropping objects into the gameworld from a container /// and thus only handles object types that can be placed in a container - void insertObject(MWWorld::Ptr object, Ptr::CellStore* cell); + void insertObject (const Ptr& object, CellStore* cell); void update (float duration); diff --git a/apps/openmw/mwworld/weather.cpp b/apps/openmw/mwworld/weather.cpp index 3d6547d6a..6c275ff80 100644 --- a/apps/openmw/mwworld/weather.cpp +++ b/apps/openmw/mwworld/weather.cpp @@ -1,17 +1,20 @@ #include "weather.hpp" -#include "world.hpp" -#include "player.hpp" - -#include "../mwrender/renderingmanager.hpp" -#include "../mwsound/soundmanager.hpp" #include #include -#include #include +#include + #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" + +#include "../mwrender/renderingmanager.hpp" + +#include "../mwsound/soundmanager.hpp" + +#include "player.hpp" using namespace Ogre; using namespace MWWorld; diff --git a/apps/openmw/mwworld/world.cpp b/apps/openmw/mwworld/worldimp.cpp similarity index 90% rename from apps/openmw/mwworld/world.cpp rename to apps/openmw/mwworld/worldimp.cpp index 79fd03e36..6f9f9936c 100644 --- a/apps/openmw/mwworld/world.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1,4 +1,4 @@ -#include "world.hpp" +#include "worldimp.hpp" #include #include @@ -33,10 +33,10 @@ namespace { template void listCellScripts (const ESMS::ESMStore& store, - ESMS::CellRefList& cellRefList, MWWorld::LocalScripts& localScripts, + MWWorld::CellRefList& cellRefList, MWWorld::LocalScripts& localScripts, MWWorld::Ptr::CellStore *cell) { - for (typename ESMS::CellRefList::List::iterator iter ( + for (typename MWWorld::CellRefList::List::iterator iter ( cellRefList.list.begin()); iter!=cellRefList.list.end(); ++iter) { @@ -53,10 +53,10 @@ namespace } template - ESMS::LiveCellRef *searchViaHandle (const std::string& handle, - ESMS::CellRefList& refList) + MWWorld::LiveCellRef *searchViaHandle (const std::string& handle, + MWWorld::CellRefList& refList) { - typedef typename ESMS::CellRefList::List::iterator iterator; + typedef typename MWWorld::CellRefList::List::iterator iterator; for (iterator iter (refList.list.begin()); iter!=refList.list.end(); ++iter) { @@ -75,45 +75,45 @@ namespace MWWorld { Ptr World::getPtrViaHandle (const std::string& handle, Ptr::CellStore& cell) { - if (ESMS::LiveCellRef *ref = + if (MWWorld::LiveCellRef *ref = searchViaHandle (handle, cell.activators)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = searchViaHandle (handle, cell.potions)) + if (MWWorld::LiveCellRef *ref = searchViaHandle (handle, cell.potions)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = searchViaHandle (handle, cell.appas)) + if (MWWorld::LiveCellRef *ref = searchViaHandle (handle, cell.appas)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = searchViaHandle (handle, cell.armors)) + if (MWWorld::LiveCellRef *ref = searchViaHandle (handle, cell.armors)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = searchViaHandle (handle, cell.books)) + if (MWWorld::LiveCellRef *ref = searchViaHandle (handle, cell.books)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = searchViaHandle (handle, cell.clothes)) + if (MWWorld::LiveCellRef *ref = searchViaHandle (handle, cell.clothes)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = + if (MWWorld::LiveCellRef *ref = searchViaHandle (handle, cell.containers)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = + if (MWWorld::LiveCellRef *ref = searchViaHandle (handle, cell.creatures)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = searchViaHandle (handle, cell.doors)) + if (MWWorld::LiveCellRef *ref = searchViaHandle (handle, cell.doors)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = + if (MWWorld::LiveCellRef *ref = searchViaHandle (handle, cell.ingreds)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = searchViaHandle (handle, cell.lights)) + if (MWWorld::LiveCellRef *ref = searchViaHandle (handle, cell.lights)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = searchViaHandle (handle, cell.lockpicks)) + if (MWWorld::LiveCellRef *ref = searchViaHandle (handle, cell.lockpicks)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = searchViaHandle (handle, cell.miscItems)) + if (MWWorld::LiveCellRef *ref = searchViaHandle (handle, cell.miscItems)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = searchViaHandle (handle, cell.npcs)) + if (MWWorld::LiveCellRef *ref = searchViaHandle (handle, cell.npcs)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = searchViaHandle (handle, cell.probes)) + if (MWWorld::LiveCellRef *ref = searchViaHandle (handle, cell.probes)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = searchViaHandle (handle, cell.repairs)) + if (MWWorld::LiveCellRef *ref = searchViaHandle (handle, cell.repairs)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = searchViaHandle (handle, cell.statics)) + if (MWWorld::LiveCellRef *ref = searchViaHandle (handle, cell.statics)) return Ptr (ref, &cell); - if (ESMS::LiveCellRef *ref = searchViaHandle (handle, cell.weapons)) + if (MWWorld::LiveCellRef *ref = searchViaHandle (handle, cell.weapons)) return Ptr (ref, &cell); return Ptr(); } @@ -154,19 +154,19 @@ namespace MWWorld mRendering->skyDisable(); } - void World::setFallbackValues(std::map fallbackMap) + void World::setFallbackValues (const std::map& fallbackMap) { mFallback = fallbackMap; } - std::string World::getFallback(std::string key) + std::string World::getFallback (const std::string& key) const { return getFallback(key, ""); } - std::string World::getFallback(std::string key, std::string def) + std::string World::getFallback (const std::string& key, const std::string& def) const { - std::map::iterator it; + std::map::const_iterator it; if((it = mFallback.find(key)) == mFallback.end()) { return def; @@ -179,7 +179,7 @@ namespace MWWorld const std::string& master, const boost::filesystem::path& resDir, bool newGame, const std::string& encoding, std::map fallbackMap) : mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0), - mSky (true), mNextDynamicRecord (0), mCells (mStore, mEsm, *this), + mSky (true), mNextDynamicRecord (0), mCells (mStore, mEsm), mNumFacing(0) { mPhysics = new PhysicsSystem(renderer); @@ -211,7 +211,7 @@ namespace MWWorld mGlobalVariables->setInt ("chargenstate", 1); } - mWorldScene = new Scene(this, *mRendering, mPhysics); + mWorldScene = new Scene(*mRendering, mPhysics); setFallbackValues(fallbackMap); @@ -351,7 +351,7 @@ namespace MWWorld throw std::runtime_error ("unknown Ogre handle: " + handle); } - void World::enable (Ptr reference) + void World::enable (const Ptr& reference) { if (!reference.getRefData().isEnabled()) { @@ -362,7 +362,7 @@ namespace MWWorld } } - void World::disable (Ptr reference) + void World::disable (const Ptr& reference) { if (reference.getRefData().isEnabled()) { @@ -537,7 +537,7 @@ namespace MWWorld } } - void World::deleteObject (Ptr ptr) + void World::deleteObject (const Ptr& ptr) { if (ptr.getRefData().getCount()>0) { @@ -552,7 +552,7 @@ namespace MWWorld } } - bool World::moveObjectImp (Ptr ptr, float x, float y, float z) + bool World::moveObjectImp (const Ptr& ptr, float x, float y, float z) { bool ret = false; ptr.getRefData().getPosition().pos[0] = x; @@ -590,7 +590,7 @@ namespace MWWorld return ret; } - void World::moveObject (Ptr ptr, float x, float y, float z) + void World::moveObject (const Ptr& ptr, float x, float y, float z) { moveObjectImp(ptr, x, y, z); @@ -753,6 +753,8 @@ namespace MWWorld void World::update (float duration) { + /// \todo split this function up into subfunctions + mWorldScene->update (duration); mWeatherManager->update (duration); @@ -959,10 +961,10 @@ namespace MWWorld return mRendering->getFader(); } - Ogre::Vector2 World::getNorthVector(Ptr::CellStore* cell) + Ogre::Vector2 World::getNorthVector (CellStore* cell) { - ESMS::CellRefList statics = cell->statics; - ESMS::LiveCellRef* ref = statics.find("northmarker"); + MWWorld::CellRefList statics = cell->statics; + MWWorld::LiveCellRef* ref = statics.find("northmarker"); if (!ref) return Vector2(0, 1); Ogre::SceneNode* node = ref->mData.getBaseNode(); @@ -981,14 +983,14 @@ namespace MWWorld mRendering->toggleWater(); } - bool World::placeObject(MWWorld::Ptr object, float cursorX, float cursorY) + bool World::placeObject (const Ptr& object, float cursorX, float cursorY) { std::pair result = mPhysics->castRay(cursorX, cursorY); if (!result.first) return false; - MWWorld::Ptr::CellStore* cell; + CellStore* cell; if (isCellExterior()) { int cellX, cellY; @@ -1021,7 +1023,7 @@ namespace MWWorld return true; } - void World::dropObjectOnGround(MWWorld::Ptr object) + void World::dropObjectOnGround (const Ptr& object) { MWWorld::Ptr::CellStore* cell = getPlayer().getPlayer().getCell(); diff --git a/apps/openmw/mwworld/world.hpp b/apps/openmw/mwworld/worldimp.hpp similarity index 53% rename from apps/openmw/mwworld/world.hpp rename to apps/openmw/mwworld/worldimp.hpp index 34990574e..d64b3a373 100644 --- a/apps/openmw/mwworld/world.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -1,12 +1,13 @@ -#ifndef GAME_MWWORLD_WORLD_H -#define GAME_MWWORLD_WORLD_H +#ifndef GAME_MWWORLD_WORLDIMP_H +#define GAME_MWWORLD_WORLDIMP_H #include #include #include -#include +#include + #include #include "../mwrender/debugging.hpp" @@ -26,6 +27,8 @@ #include +#include "../mwbase/world.hpp" + namespace Ogre { class Vector3; @@ -59,20 +62,8 @@ namespace MWWorld /// \brief The game world and its visual representation - class World + class World : public MWBase::World { - public: - - enum RenderMode - { - Render_CollisionDebug, - Render_Wireframe, - Render_Pathgrid, - Render_Compositors - }; - - private: - MWRender::RenderingManager* mRendering; MWWorld::WeatherManager* mWeatherManager; @@ -110,180 +101,183 @@ namespace MWWorld int getDaysPerMonth (int month) const; - bool moveObjectImp (Ptr ptr, float x, float y, float z); + bool moveObjectImp (const Ptr& ptr, float x, float y, float z); ///< @return true if the active cell (cell player is in) changed public: - World (OEngine::Render::OgreRenderer& renderer, + World (OEngine::Render::OgreRenderer& renderer, const Files::Collections& fileCollections, const std::string& master, const boost::filesystem::path& resDir, bool newGame, const std::string& encoding, std::map fallbackMap); - ~World(); + virtual ~World(); - OEngine::Render::Fader* getFader(); + virtual OEngine::Render::Fader* getFader(); + ///< \ŧodo remove this function. Rendering details should not be exposed. - Ptr::CellStore *getExterior (int x, int y); + virtual CellStore *getExterior (int x, int y); - Ptr::CellStore *getInterior (const std::string& name); + virtual CellStore *getInterior (const std::string& name); - void setWaterHeight(const float height); - void toggleWater(); + virtual void setWaterHeight(const float height); - void adjustSky(); + virtual void toggleWater(); - void getTriangleBatchCount(unsigned int &triangles, unsigned int &batches); + virtual void adjustSky(); - void setFallbackValues(std::map fallbackMap); + virtual void getTriangleBatchCount(unsigned int &triangles, unsigned int &batches); - std::string getFallback(std::string key); + virtual void setFallbackValues (const std::map& fallbackMap); - std::string getFallback(std::string key, std::string def); + virtual std::string getFallback (const std::string& key) const; - MWWorld::Player& getPlayer(); + virtual std::string getFallback (const std::string& key, const std::string& def) const; - const ESMS::ESMStore& getStore() const; + virtual Player& getPlayer(); - ESM::ESMReader& getEsmReader(); + virtual const ESMS::ESMStore& getStore() const; - LocalScripts& getLocalScripts(); + virtual ESM::ESMReader& getEsmReader(); - bool hasCellChanged() const; + virtual LocalScripts& getLocalScripts(); + + virtual bool hasCellChanged() const; ///< Has the player moved to a different cell, since the last frame? - bool isCellExterior() const; - bool isCellQuasiExterior() const; + virtual bool isCellExterior() const; + + virtual bool isCellQuasiExterior() const; - Ogre::Vector2 getNorthVector(Ptr::CellStore* cell); + virtual Ogre::Vector2 getNorthVector (CellStore* cell); ///< get north vector (OGRE coordinates) for given interior cell - Globals::Data& getGlobalVariable (const std::string& name); + virtual Globals::Data& getGlobalVariable (const std::string& name); - Globals::Data getGlobalVariable (const std::string& name) const; + virtual Globals::Data getGlobalVariable (const std::string& name) const; - char getGlobalVariableType (const std::string& name) const; + virtual char getGlobalVariableType (const std::string& name) const; ///< Return ' ', if there is no global variable with this name. - Ptr getPtr (const std::string& name, bool activeOnly); + virtual Ptr getPtr (const std::string& name, bool activeOnly); ///< Return a pointer to a liveCellRef with the given name. /// \param activeOnly do non search inactive cells. - Ptr getPtrViaHandle (const std::string& handle); + virtual Ptr getPtrViaHandle (const std::string& handle); ///< Return a pointer to a liveCellRef with the given Ogre handle. - /// \todo enable reference in the OGRE scene - void enable (Ptr reference); + virtual void enable (const Ptr& ptr); - /// \todo 5disable reference in the OGRE scene - void disable (Ptr reference); + virtual void disable (const Ptr& ptr); - void advanceTime (double hours); + virtual void advanceTime (double hours); ///< Advance in-game time. - void setHour (double hour); + virtual void setHour (double hour); ///< Set in-game time hour. - void setMonth (int month); + virtual void setMonth (int month); ///< Set in-game time month. - void setDay (int day); + virtual void setDay (int day); ///< Set in-game time day. - TimeStamp getTimeStamp() const; + virtual TimeStamp getTimeStamp() const; ///< Return current in-game time stamp. - bool toggleSky(); + virtual bool toggleSky(); ///< \return Resulting mode - void changeWeather(const std::string& region, const unsigned int id); + virtual void changeWeather (const std::string& region, const unsigned int id); - int getCurrentWeather() const; + virtual int getCurrentWeather() const; - int getMasserPhase() const; + virtual int getMasserPhase() const; - int getSecundaPhase() const; + virtual int getSecundaPhase() const; - void setMoonColour (bool red); + virtual void setMoonColour (bool red); - float getTimeScaleFactor() const; + virtual float getTimeScaleFactor() const; - void changeToInteriorCell (const std::string& cellName, const ESM::Position& position); + virtual void changeToInteriorCell (const std::string& cellName, + const ESM::Position& position); ///< Move to interior cell. - void changeToExteriorCell (const ESM::Position& position); + virtual void changeToExteriorCell (const ESM::Position& position); ///< Move to exterior cell. - const ESM::Cell *getExterior (const std::string& cellName) const; + virtual const ESM::Cell *getExterior (const std::string& cellName) const; ///< Return a cell matching the given name or a 0-pointer, if there is no such cell. - void markCellAsUnchanged(); + virtual void markCellAsUnchanged(); - std::string getFacedHandle(); + virtual std::string getFacedHandle(); ///< Return handle of the object the player is looking at - void deleteObject (Ptr ptr); + virtual void deleteObject (const Ptr& ptr); - void moveObject (Ptr ptr, float x, float y, float z); + virtual void moveObject (const Ptr& ptr, float x, float y, float z); - void indexToPosition (int cellX, int cellY, float &x, float &y, bool centre = false) const; + virtual void indexToPosition (int cellX, int cellY, float &x, float &y, bool centre = false) + const; ///< Convert cell numbers to position. - void positionToIndex (float x, float y, int &cellX, int &cellY) const; + virtual void positionToIndex (float x, float y, int &cellX, int &cellY) const; ///< Convert position to cell numbers - void doPhysics (const std::vector >& actors, + virtual void doPhysics (const std::vector >& actors, float duration); ///< Run physics simulation and modify \a world accordingly. - bool toggleCollisionMode(); + virtual bool toggleCollisionMode(); ///< Toggle collision mode for player. If disabled player object should ignore /// collisions and gravity. ///< \return Resulting mode - bool toggleRenderMode (RenderMode mode); + virtual bool toggleRenderMode (RenderMode mode); ///< Toggle a render mode. ///< \return Resulting mode - std::pair createRecord (const ESM::Potion& record); + virtual std::pair createRecord (const ESM::Potion& record); ///< Create a new recrod (of type potion) in the ESM store. /// \return ID, pointer to created record - std::pair createRecord (const ESM::Class& record); + virtual std::pair createRecord (const ESM::Class& record); ///< Create a new recrod (of type class) in the ESM store. /// \return ID, pointer to created record - const ESM::Cell *createRecord (const ESM::Cell& record); + virtual const ESM::Cell *createRecord (const ESM::Cell& record); ///< Create a new recrod (of type cell) in the ESM store. /// \return ID, pointer to created record - void playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName, int mode, - int number = 1); + virtual void playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName, + int mode, int number = 1); ///< Run animation for a MW-reference. Calls to this function for references that are /// currently not in the rendered scene should be ignored. /// /// \param mode: 0 normal, 1 immediate start, 2 immediate loop /// \param number How offen the animation should be run - void skipAnimation (const MWWorld::Ptr& ptr); + virtual void skipAnimation (const MWWorld::Ptr& ptr); ///< Skip the animation for the given MW-reference for one frame. Calls to this function for /// references that are currently not in the rendered scene should be ignored. - void update (float duration); + virtual void update (float duration); - bool placeObject(MWWorld::Ptr object, float cursorX, float cursorY); + virtual bool placeObject (const Ptr& object, float cursorX, float cursorY); ///< place an object into the gameworld at the specified cursor position /// @param object /// @param cursor X (relative 0-1) /// @param cursor Y (relative 0-1) /// @return true if the object was placed, or false if it was rejected because the position is too far away - void dropObjectOnGround(MWWorld::Ptr object); + virtual void dropObjectOnGround (const Ptr& object); - bool canPlaceObject(float cursorX, float cursorY); + virtual bool canPlaceObject(float cursorX, float cursorY); ///< @return true if it is possible to place on object at specified cursor location - void processChangedSettings(const Settings::CategorySettingVector& settings); + virtual void processChangedSettings(const Settings::CategorySettingVector& settings); }; } diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 8a1875d0f..284ca3cce 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -35,7 +35,7 @@ add_component_dir (file_finder ) add_component_dir (esm_store - cell_store reclists store + reclists store ) add_component_dir (esm @@ -74,4 +74,3 @@ target_link_libraries(components ${Boost_LIBRARIES} ${OGRE_LIBRARIES}) # Make the variable accessible for other subdirectories set(COMPONENT_FILES ${COMPONENT_FILES} PARENT_SCOPE) - diff --git a/components/esm_store/cell_store.hpp b/components/esm_store/cell_store.hpp deleted file mode 100644 index 024412291..000000000 --- a/components/esm_store/cell_store.hpp +++ /dev/null @@ -1,287 +0,0 @@ -#ifndef _GAME_CELL_STORE_H -#define _GAME_CELL_STORE_H - -/* - Cell storage. - - Used to load, look up and store all references in a single cell. - - Depends on esm/loadcell.hpp (loading from ESM) and esm_store.hpp - (looking up references.) Neither of these modules depend on us. - */ - -#include "store.hpp" -#include "components/esm/records.hpp" - -#include -#include -#include -#include -#include -#include - -namespace ESMS -{ - using namespace ESM; - - /// A reference to one object (of any type) in a cell. - /// - /// Constructing this with a CellRef instance in the constructor means that - /// in practice (where D is RefData) the possibly mutable data is copied - /// across to mData. If later adding data (such as position) to CellRef - /// this would have to be manually copied across. - template - struct LiveCellRef - { - LiveCellRef(const CellRef& cref, const X* b = NULL) : base(b), ref(cref), - mData(ref) {} - - - LiveCellRef(const X* b = NULL) : base(b), mData(ref) {} - - // The object that this instance is based on. - const X* base; - - /* Information about this instance, such as 3D location and - rotation and individual type-dependent data. - */ - CellRef ref; - - /// runtime-data - D mData; - }; - - /// A list of cell references - template - struct CellRefList - { - typedef LiveCellRef LiveRef; - typedef std::list List; - List list; - - // Search for the given reference in the given reclist from - // ESMStore. Insert the reference into the list if a match is - // found. If not, throw an exception. - template - void find(CellRef &ref, const Y& recList) - { - const X* obj = recList.find(ref.refID); - if(obj == NULL) - throw std::runtime_error("Error resolving cell reference " + ref.refID); - - list.push_back(LiveRef(ref, obj)); - } - - LiveRef *find (const std::string& name) - { - for (typename std::list::iterator iter (list.begin()); iter!=list.end(); ++iter) - { - if (iter->ref.refID==name) - return &*iter; - } - - return 0; - } - }; - - /// A storage struct for one single cell reference. - template - class CellStore - { - public: - - enum State - { - State_Unloaded, State_Preloaded, State_Loaded - }; - - CellStore (const ESM::Cell *cell_) : cell (cell_), mState (State_Unloaded) - { - mWaterLevel = cell->water; - } - - const ESM::Cell *cell; - State mState; - std::vector mIds; - - float mWaterLevel; - - // Lists for each individual object type - CellRefList activators; - CellRefList potions; - CellRefList appas; - CellRefList armors; - CellRefList books; - CellRefList clothes; - CellRefList containers; - CellRefList creatures; - CellRefList doors; - CellRefList ingreds; - CellRefList creatureLists; - CellRefList itemLists; - CellRefList lights; - CellRefList lockpicks; - CellRefList miscItems; - CellRefList npcs; - CellRefList probes; - CellRefList repairs; - CellRefList statics; - CellRefList weapons; - - void load (const ESMStore &store, ESMReader &esm) - { - if (mState!=State_Loaded) - { - if (mState==State_Preloaded) - mIds.clear(); - - std::cout << "loading cell " << cell->getDescription() << std::endl; - - loadRefs (store, esm); - - mState = State_Loaded; - } - } - - void preload (const ESMStore &store, ESMReader &esm) - { - if (mState==State_Unloaded) - { - listRefs (store, esm); - - mState = State_Preloaded; - } - } - - /// Call functor (ref) for each reference. functor must return a bool. Returning - /// false will abort the iteration. - /// \return Iteration completed? - template - bool forEach (Functor& functor) - { - return - forEachImp (functor, activators) && - forEachImp (functor, potions) && - forEachImp (functor, appas) && - forEachImp (functor, armors) && - forEachImp (functor, books) && - forEachImp (functor, clothes) && - forEachImp (functor, containers) && - forEachImp (functor, creatures) && - forEachImp (functor, doors) && - forEachImp (functor, ingreds) && - forEachImp (functor, creatureLists) && - forEachImp (functor, itemLists) && - forEachImp (functor, lights) && - forEachImp (functor, lockpicks) && - forEachImp (functor, miscItems) && - forEachImp (functor, npcs) && - forEachImp (functor, probes) && - forEachImp (functor, repairs) && - forEachImp (functor, statics) && - forEachImp (functor, weapons); - } - - private: - - template - bool forEachImp (Functor& functor, List& list) - { - for (typename List::List::iterator iter (list.list.begin()); iter!=list.list.end(); - ++iter) - if (!functor (iter->ref, iter->mData)) - return false; - - return true; - } - - /// Run through references and store IDs - void listRefs(const ESMStore &store, ESMReader &esm) - { - assert (cell); - - if (cell->context.filename.empty()) - return; // this is a dynamically generated cell -> skipping. - - // Reopen the ESM reader and seek to the right position. - cell->restore (esm); - - CellRef ref; - - // Get each reference in turn - while (cell->getNextRef (esm, ref)) - { - std::string lowerCase; - - std::transform (ref.refID.begin(), ref.refID.end(), std::back_inserter (lowerCase), - (int(*)(int)) std::tolower); - - mIds.push_back (lowerCase); - } - - std::sort (mIds.begin(), mIds.end()); - } - - void loadRefs(const ESMStore &store, ESMReader &esm) - { - assert (cell); - - if (cell->context.filename.empty()) - return; // this is a dynamically generated cell -> skipping. - - // Reopen the ESM reader and seek to the right position. - cell->restore(esm); - - CellRef ref; - - // Get each reference in turn - while(cell->getNextRef(esm, ref)) - { - std::string lowerCase; - - std::transform (ref.refID.begin(), ref.refID.end(), std::back_inserter (lowerCase), - (int(*)(int)) std::tolower); - - int rec = store.find(ref.refID); - - ref.refID = lowerCase; - - /* We can optimize this further by storing the pointer to the - record itself in store.all, so that we don't need to look it - up again here. However, never optimize. There are infinite - opportunities to do that later. - */ - switch(rec) - { - case REC_ACTI: activators.find(ref, store.activators); break; - case REC_ALCH: potions.find(ref, store.potions); break; - case REC_APPA: appas.find(ref, store.appas); break; - case REC_ARMO: armors.find(ref, store.armors); break; - case REC_BOOK: books.find(ref, store.books); break; - case REC_CLOT: clothes.find(ref, store.clothes); break; - case REC_CONT: containers.find(ref, store.containers); break; - case REC_CREA: creatures.find(ref, store.creatures); break; - case REC_DOOR: doors.find(ref, store.doors); break; - case REC_INGR: ingreds.find(ref, store.ingreds); break; - case REC_LEVC: creatureLists.find(ref, store.creatureLists); break; - case REC_LEVI: itemLists.find(ref, store.itemLists); break; - case REC_LIGH: lights.find(ref, store.lights); break; - case REC_LOCK: lockpicks.find(ref, store.lockpicks); break; - case REC_MISC: miscItems.find(ref, store.miscItems); break; - case REC_NPC_: npcs.find(ref, store.npcs); break; - case REC_PROB: probes.find(ref, store.probes); break; - case REC_REPA: repairs.find(ref, store.repairs); break; - case REC_STAT: statics.find(ref, store.statics); break; - case REC_WEAP: weapons.find(ref, store.weapons); break; - - case 0: std::cout << "Cell reference " + ref.refID + " not found!\n"; break; - default: - std::cout << "WARNING: Ignoring reference '" << ref.refID << "' of unhandled type\n"; - } - } - } - - }; -} - -#endif diff --git a/components/nif/data.hpp b/components/nif/data.hpp index eaa11b5ee..0684470ec 100644 --- a/components/nif/data.hpp +++ b/components/nif/data.hpp @@ -25,8 +25,9 @@ #define _NIF_DATA_H_ #include "controlled.hpp" -#include -#include + +#include +#include namespace Nif { @@ -557,7 +558,7 @@ public: translist1 = c.getTranslist1(); - translist2 = c.getTranslist2(); + translist2 = c.getTranslist2(); translist3 = c.getTranslist3(); transtime = c.gettTime(); diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index 331701c2a..895c51a0d 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -25,6 +25,14 @@ #include "ogre_nif_loader.hpp" +#include +#include +#include +#include +#include +#include +#include + #include #include @@ -230,7 +238,7 @@ void NIFLoader::createMaterial(const String &name, //tech->setSchemeName("blahblah"); Pass* pass = tech->createPass(); pass->setVertexProgram("Ogre/BasicVertexPrograms/AmbientOneTexture");*/ - + // This assigns the texture to this material. If the texture name is // a file name, and this file exists (in a resource directory), it @@ -478,7 +486,7 @@ void NIFLoader::createOgreSubMesh(NiTriShape *shape, const String &material, std bind->setBinding(nextBuf++, vbuf); } - + // Vertex colors if (data->colors.length) { @@ -795,7 +803,7 @@ void NIFLoader::handleNiTriShape(NiTriShape *shape, int flags, BoundsFinder &bou std::list vertexBoneAssignments; Nif::NiTriShapeCopy copy = shape->clone(); - + if(!shape->controller.empty()) { Nif::Controller* cont = shape->controller.getPtr(); @@ -984,7 +992,7 @@ void NIFLoader::handleNiTriShape(NiTriShape *shape, int flags, BoundsFinder &bou } if(!mSkel.isNull() ){ int boneIndex; - + boneIndex = mSkel->getNumBones() - 1; for(int i = 0; i < numVerts; i++){ VertexBoneAssignment vba; @@ -1388,7 +1396,7 @@ void NIFLoader::loadResource(Resource *resource) vba.boneIndex = boneIndex; vba.vertexIndex = 0; vba.weight = 1; - + (*iter)->addBoneAssignment(vba); } diff --git a/components/nifogre/ogre_nif_loader.hpp b/components/nifogre/ogre_nif_loader.hpp index 794459e46..d73948fa8 100644 --- a/components/nifogre/ogre_nif_loader.hpp +++ b/components/nifogre/ogre_nif_loader.hpp @@ -26,12 +26,10 @@ #include #include -#include + +#include #include -#include -#include -#include -#include +#include #include #include "../nif/nif_file.hpp" @@ -45,7 +43,6 @@ #include #include // For warning messages -#include #include using namespace boost::algorithm; @@ -193,7 +190,7 @@ class NIFLoader : Ogre::ManualResourceLoader std::vector mS; std::vector needBoneAssignments; bool inTheSkeletonTree; - + }; diff --git a/files/mygui/CMakeLists.txt b/files/mygui/CMakeLists.txt index dad4afb46..f41cdf54e 100644 --- a/files/mygui/CMakeLists.txt +++ b/files/mygui/CMakeLists.txt @@ -15,52 +15,52 @@ configure_file("${SDIR}/openmw_box.skin.xml" "${DDIR}/openmw_box.skin.xml" COPYO configure_file("${SDIR}/openmw_button.skin.xml" "${DDIR}/openmw_button.skin.xml" COPYONLY) configure_file("${SDIR}/openmw_list.skin.xml" "${DDIR}/openmw_list.skin.xml" COPYONLY) configure_file("${SDIR}/openmw_edit.skin.xml" "${DDIR}/openmw_edit.skin.xml" COPYONLY) -configure_file("${SDIR}/openmw_console_layout.xml" "${DDIR}/openmw_console_layout.xml" COPYONLY) +configure_file("${SDIR}/openmw_console.layout" "${DDIR}/openmw_console.layout" COPYONLY) configure_file("${SDIR}/openmw_console.skin.xml" "${DDIR}/openmw_console.skin.xml" COPYONLY) configure_file("${SDIR}/openmw.font.xml" "${DDIR}/openmw.font.xml" COPYONLY) configure_file("${SDIR}/openmw_hud_box.skin.xml" "${DDIR}/openmw_hud_box.skin.xml" COPYONLY) configure_file("${SDIR}/openmw_hud_energybar.skin.xml" "${DDIR}/openmw_hud_energybar.skin.xml" COPYONLY) -configure_file("${SDIR}/openmw_hud_layout.xml" "${DDIR}/openmw_hud_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_text_input_layout.xml" "${DDIR}/openmw_text_input_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_infobox_layout.xml" "${DDIR}/openmw_infobox_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_chargen_race_layout.xml" "${DDIR}/openmw_chargen_race_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_chargen_class_layout.xml" "${DDIR}/openmw_chargen_class_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_chargen_generate_class_result_layout.xml" "${DDIR}/openmw_chargen_generate_class_result_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_chargen_create_class_layout.xml" "${DDIR}/openmw_chargen_create_class_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_chargen_select_specialization_layout.xml" "${DDIR}/openmw_chargen_select_specialization_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_chargen_select_attribute_layout.xml" "${DDIR}/openmw_chargen_select_attribute_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_chargen_select_skill_layout.xml" "${DDIR}/openmw_chargen_select_skill_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_chargen_class_description_layout.xml" "${DDIR}/openmw_chargen_class_description_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_chargen_birth_layout.xml" "${DDIR}/openmw_chargen_birth_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_chargen_review_layout.xml" "${DDIR}/openmw_chargen_review_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_dialogue_window_layout.xml" "${DDIR}/openmw_dialogue_window_layout.xml" COPYONLY) +configure_file("${SDIR}/openmw_hud.layout" "${DDIR}/openmw_hud.layout" COPYONLY) +configure_file("${SDIR}/openmw_text_input.layout" "${DDIR}/openmw_text_input.layout" COPYONLY) +configure_file("${SDIR}/openmw_infobox.layout" "${DDIR}/openmw_infobox.layout" COPYONLY) +configure_file("${SDIR}/openmw_chargen_race.layout" "${DDIR}/openmw_chargen_race.layout" COPYONLY) +configure_file("${SDIR}/openmw_chargen_class.layout" "${DDIR}/openmw_chargen_class.layout" COPYONLY) +configure_file("${SDIR}/openmw_chargen_generate_class_result.layout" "${DDIR}/openmw_chargen_generate_class_result.layout" COPYONLY) +configure_file("${SDIR}/openmw_chargen_create_class.layout" "${DDIR}/openmw_chargen_create_class.layout" COPYONLY) +configure_file("${SDIR}/openmw_chargen_select_specialization.layout" "${DDIR}/openmw_chargen_select_specialization.layout" COPYONLY) +configure_file("${SDIR}/openmw_chargen_select_attribute.layout" "${DDIR}/openmw_chargen_select_attribute.layout" COPYONLY) +configure_file("${SDIR}/openmw_chargen_select_skill.layout" "${DDIR}/openmw_chargen_select_skill.layout" COPYONLY) +configure_file("${SDIR}/openmw_chargen_class_description.layout" "${DDIR}/openmw_chargen_class_description.layout" COPYONLY) +configure_file("${SDIR}/openmw_chargen_birth.layout" "${DDIR}/openmw_chargen_birth.layout" COPYONLY) +configure_file("${SDIR}/openmw_chargen_review.layout" "${DDIR}/openmw_chargen_review.layout" COPYONLY) +configure_file("${SDIR}/openmw_dialogue_window.layout" "${DDIR}/openmw_dialogue_window.layout" COPYONLY) configure_file("${SDIR}/openmw_dialogue_window_skin.xml" "${DDIR}/openmw_dialogue_window_skin.xml" COPYONLY) -configure_file("${SDIR}/openmw_inventory_window_layout.xml" "${DDIR}/openmw_inventory_window_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_container_window_layout.xml" "${DDIR}/openmw_container_window_layout.xml" COPYONLY) +configure_file("${SDIR}/openmw_inventory_window.layout" "${DDIR}/openmw_inventory_window.layout" COPYONLY) +configure_file("${SDIR}/openmw_container_window.layout" "${DDIR}/openmw_container_window.layout" COPYONLY) configure_file("${SDIR}/openmw_layers.xml" "${DDIR}/openmw_layers.xml" COPYONLY) -configure_file("${SDIR}/openmw_mainmenu_layout.xml" "${DDIR}/openmw_mainmenu_layout.xml" COPYONLY) +configure_file("${SDIR}/openmw_mainmenu.layout" "${DDIR}/openmw_mainmenu.layout" COPYONLY) configure_file("${SDIR}/openmw_mainmenu_skin.xml" "${DDIR}/openmw_mainmenu_skin.xml" COPYONLY) -configure_file("${SDIR}/openmw_map_window_layout.xml" "${DDIR}/openmw_map_window_layout.xml" COPYONLY) +configure_file("${SDIR}/openmw_map_window.layout" "${DDIR}/openmw_map_window.layout" COPYONLY) configure_file("${SDIR}/openmw_map_window_skin.xml" "${DDIR}/openmw_map_window_skin.xml" COPYONLY) configure_file("${SDIR}/openmw.pointer.xml" "${DDIR}/openmw.pointer.xml" COPYONLY) configure_file("${SDIR}/openmw_progress.skin.xml" "${DDIR}/openmw_progress.skin.xml" COPYONLY) -configure_file("${SDIR}/openmw_stats_window_layout.xml" "${DDIR}/openmw_stats_window_layout.xml" COPYONLY) +configure_file("${SDIR}/openmw_stats_window.layout" "${DDIR}/openmw_stats_window.layout" COPYONLY) configure_file("${SDIR}/openmw_text.skin.xml" "${DDIR}/openmw_text.skin.xml" COPYONLY) configure_file("${SDIR}/openmw_windows.skin.xml" "${DDIR}/openmw_windows.skin.xml" COPYONLY) -configure_file("${SDIR}/openmw_messagebox_layout.xml" "${DDIR}/openmw_messagebox_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_interactive_messagebox_layout.xml" "${DDIR}/openmw_interactive_messagebox_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_journal_layout.xml" "${DDIR}/openmw_journal_layout.xml" COPYONLY) +configure_file("${SDIR}/openmw_messagebox.layout" "${DDIR}/openmw_messagebox.layout" COPYONLY) +configure_file("${SDIR}/openmw_interactive_messagebox.layout" "${DDIR}/openmw_interactive_messagebox.layout" COPYONLY) +configure_file("${SDIR}/openmw_journal.layout" "${DDIR}/openmw_journal.layout" COPYONLY) configure_file("${SDIR}/openmw_journal_skin.xml" "${DDIR}/openmw_journal_skin.xml" COPYONLY) -configure_file("${SDIR}/openmw_tooltips.xml" "${DDIR}/openmw_tooltips.xml" COPYONLY) -configure_file("${SDIR}/openmw_scroll_layout.xml" "${DDIR}/openmw_scroll_layout.xml" COPYONLY) +configure_file("${SDIR}/openmw_tooltips.layout" "${DDIR}/openmw_tooltips.layout" COPYONLY) +configure_file("${SDIR}/openmw_scroll.layout" "${DDIR}/openmw_scroll.layout" COPYONLY) configure_file("${SDIR}/openmw_scroll_skin.xml" "${DDIR}/openmw_scroll_skin.xml" COPYONLY) -configure_file("${SDIR}/openmw_book_layout.xml" "${DDIR}/openmw_book_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_count_window_layout.xml" "${DDIR}/openmw_count_window_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_trade_window_layout.xml" "${DDIR}/openmw_trade_window_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_settings_window_layout.xml" "${DDIR}/openmw_settings_window_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_confirmation_dialog_layout.xml" "${DDIR}/openmw_confirmation_dialog_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_alchemy_window_layout.xml" "${DDIR}/openmw_alchemy_window_layout.xml" COPYONLY) -configure_file("${SDIR}/openmw_spell_window_layout.xml" "${DDIR}/openmw_spell_window_layout.xml" COPYONLY) +configure_file("${SDIR}/openmw_book.layout" "${DDIR}/openmw_book.layout" COPYONLY) +configure_file("${SDIR}/openmw_count_window.layout" "${DDIR}/openmw_count_window.layout" COPYONLY) +configure_file("${SDIR}/openmw_trade_window.layout" "${DDIR}/openmw_trade_window.layout" COPYONLY) +configure_file("${SDIR}/openmw_settings_window.layout" "${DDIR}/openmw_settings_window.layout" COPYONLY) +configure_file("${SDIR}/openmw_confirmation_dialog.layout" "${DDIR}/openmw_confirmation_dialog.layout" COPYONLY) +configure_file("${SDIR}/openmw_alchemy_window.layout" "${DDIR}/openmw_alchemy_window.layout" COPYONLY) +configure_file("${SDIR}/openmw_spell_window.layout" "${DDIR}/openmw_spell_window.layout" COPYONLY) configure_file("${SDIR}/atlas1.cfg" "${DDIR}/atlas1.cfg" COPYONLY) configure_file("${SDIR}/smallbars.png" "${DDIR}/smallbars.png" COPYONLY) configure_file("${SDIR}/EBGaramond-Regular.ttf" "${DDIR}/EBGaramond-Regular.ttf" COPYONLY) diff --git a/files/mygui/openmw_alchemy_window_layout.xml b/files/mygui/openmw_alchemy_window.layout similarity index 100% rename from files/mygui/openmw_alchemy_window_layout.xml rename to files/mygui/openmw_alchemy_window.layout diff --git a/files/mygui/openmw_book_layout.xml b/files/mygui/openmw_book.layout similarity index 100% rename from files/mygui/openmw_book_layout.xml rename to files/mygui/openmw_book.layout diff --git a/files/mygui/openmw_chargen_birth_layout.xml b/files/mygui/openmw_chargen_birth.layout similarity index 100% rename from files/mygui/openmw_chargen_birth_layout.xml rename to files/mygui/openmw_chargen_birth.layout diff --git a/files/mygui/openmw_chargen_class_layout.xml b/files/mygui/openmw_chargen_class.layout similarity index 100% rename from files/mygui/openmw_chargen_class_layout.xml rename to files/mygui/openmw_chargen_class.layout diff --git a/files/mygui/openmw_chargen_class_description_layout.xml b/files/mygui/openmw_chargen_class_description.layout similarity index 100% rename from files/mygui/openmw_chargen_class_description_layout.xml rename to files/mygui/openmw_chargen_class_description.layout diff --git a/files/mygui/openmw_chargen_create_class_layout.xml b/files/mygui/openmw_chargen_create_class.layout similarity index 100% rename from files/mygui/openmw_chargen_create_class_layout.xml rename to files/mygui/openmw_chargen_create_class.layout diff --git a/files/mygui/openmw_chargen_generate_class_result_layout.xml b/files/mygui/openmw_chargen_generate_class_result.layout similarity index 100% rename from files/mygui/openmw_chargen_generate_class_result_layout.xml rename to files/mygui/openmw_chargen_generate_class_result.layout diff --git a/files/mygui/openmw_chargen_race_layout.xml b/files/mygui/openmw_chargen_race.layout similarity index 100% rename from files/mygui/openmw_chargen_race_layout.xml rename to files/mygui/openmw_chargen_race.layout diff --git a/files/mygui/openmw_chargen_review_layout.xml b/files/mygui/openmw_chargen_review.layout similarity index 100% rename from files/mygui/openmw_chargen_review_layout.xml rename to files/mygui/openmw_chargen_review.layout diff --git a/files/mygui/openmw_chargen_select_attribute_layout.xml b/files/mygui/openmw_chargen_select_attribute.layout similarity index 100% rename from files/mygui/openmw_chargen_select_attribute_layout.xml rename to files/mygui/openmw_chargen_select_attribute.layout diff --git a/files/mygui/openmw_chargen_select_skill_layout.xml b/files/mygui/openmw_chargen_select_skill.layout similarity index 100% rename from files/mygui/openmw_chargen_select_skill_layout.xml rename to files/mygui/openmw_chargen_select_skill.layout diff --git a/files/mygui/openmw_chargen_select_specialization_layout.xml b/files/mygui/openmw_chargen_select_specialization.layout similarity index 100% rename from files/mygui/openmw_chargen_select_specialization_layout.xml rename to files/mygui/openmw_chargen_select_specialization.layout diff --git a/files/mygui/openmw_confirmation_dialog_layout.xml b/files/mygui/openmw_confirmation_dialog.layout similarity index 100% rename from files/mygui/openmw_confirmation_dialog_layout.xml rename to files/mygui/openmw_confirmation_dialog.layout diff --git a/files/mygui/openmw_console_layout.xml b/files/mygui/openmw_console.layout similarity index 100% rename from files/mygui/openmw_console_layout.xml rename to files/mygui/openmw_console.layout diff --git a/files/mygui/openmw_container_window_layout.xml b/files/mygui/openmw_container_window.layout similarity index 100% rename from files/mygui/openmw_container_window_layout.xml rename to files/mygui/openmw_container_window.layout diff --git a/files/mygui/openmw_count_window_layout.xml b/files/mygui/openmw_count_window.layout similarity index 100% rename from files/mygui/openmw_count_window_layout.xml rename to files/mygui/openmw_count_window.layout diff --git a/files/mygui/openmw_dialogue_window_layout.xml b/files/mygui/openmw_dialogue_window.layout similarity index 100% rename from files/mygui/openmw_dialogue_window_layout.xml rename to files/mygui/openmw_dialogue_window.layout diff --git a/files/mygui/openmw_hud_layout.xml b/files/mygui/openmw_hud.layout similarity index 100% rename from files/mygui/openmw_hud_layout.xml rename to files/mygui/openmw_hud.layout diff --git a/files/mygui/openmw_infobox_layout.xml b/files/mygui/openmw_infobox.layout similarity index 100% rename from files/mygui/openmw_infobox_layout.xml rename to files/mygui/openmw_infobox.layout diff --git a/files/mygui/openmw_interactive_messagebox_layout.xml b/files/mygui/openmw_interactive_messagebox.layout similarity index 100% rename from files/mygui/openmw_interactive_messagebox_layout.xml rename to files/mygui/openmw_interactive_messagebox.layout diff --git a/files/mygui/openmw_inventory_window_layout.xml b/files/mygui/openmw_inventory_window.layout similarity index 100% rename from files/mygui/openmw_inventory_window_layout.xml rename to files/mygui/openmw_inventory_window.layout diff --git a/files/mygui/openmw_journal_layout.xml b/files/mygui/openmw_journal.layout similarity index 100% rename from files/mygui/openmw_journal_layout.xml rename to files/mygui/openmw_journal.layout diff --git a/files/mygui/openmw_mainmenu_layout.xml b/files/mygui/openmw_mainmenu.layout similarity index 100% rename from files/mygui/openmw_mainmenu_layout.xml rename to files/mygui/openmw_mainmenu.layout diff --git a/files/mygui/openmw_map_window_layout.xml b/files/mygui/openmw_map_window.layout similarity index 100% rename from files/mygui/openmw_map_window_layout.xml rename to files/mygui/openmw_map_window.layout diff --git a/files/mygui/openmw_messagebox_layout.xml b/files/mygui/openmw_messagebox.layout similarity index 100% rename from files/mygui/openmw_messagebox_layout.xml rename to files/mygui/openmw_messagebox.layout diff --git a/files/mygui/openmw_scroll_layout.xml b/files/mygui/openmw_scroll.layout similarity index 100% rename from files/mygui/openmw_scroll_layout.xml rename to files/mygui/openmw_scroll.layout diff --git a/files/mygui/openmw_settings_window_layout.xml b/files/mygui/openmw_settings_window.layout similarity index 100% rename from files/mygui/openmw_settings_window_layout.xml rename to files/mygui/openmw_settings_window.layout diff --git a/files/mygui/openmw_spell_window_layout.xml b/files/mygui/openmw_spell_window.layout similarity index 100% rename from files/mygui/openmw_spell_window_layout.xml rename to files/mygui/openmw_spell_window.layout diff --git a/files/mygui/openmw_stats_window_layout.xml b/files/mygui/openmw_stats_window.layout similarity index 100% rename from files/mygui/openmw_stats_window_layout.xml rename to files/mygui/openmw_stats_window.layout diff --git a/files/mygui/openmw_text_input_layout.xml b/files/mygui/openmw_text_input.layout similarity index 100% rename from files/mygui/openmw_text_input_layout.xml rename to files/mygui/openmw_text_input.layout diff --git a/files/mygui/openmw_tooltips.xml b/files/mygui/openmw_tooltips.layout similarity index 100% rename from files/mygui/openmw_tooltips.xml rename to files/mygui/openmw_tooltips.layout diff --git a/files/mygui/openmw_trade_window_layout.xml b/files/mygui/openmw_trade_window.layout similarity index 100% rename from files/mygui/openmw_trade_window_layout.xml rename to files/mygui/openmw_trade_window.layout diff --git a/libs/openengine/bullet/BtOgre.cpp b/libs/openengine/bullet/BtOgre.cpp index 618739083..f50465159 100644 --- a/libs/openengine/bullet/BtOgre.cpp +++ b/libs/openengine/bullet/BtOgre.cpp @@ -17,6 +17,10 @@ #include "BtOgreGP.h" #include "BtOgreExtras.h" +#include +#include +#include + using namespace Ogre; namespace BtOgre { diff --git a/libs/openengine/bullet/BtOgreGP.h b/libs/openengine/bullet/BtOgreGP.h index f0534de4b..4ce2f181e 100644 --- a/libs/openengine/bullet/BtOgreGP.h +++ b/libs/openengine/bullet/BtOgreGP.h @@ -19,7 +19,10 @@ #include "btBulletDynamicsCommon.h" #include "BtOgreExtras.h" -#include "Ogre.h" + +#include +#include +#include namespace BtOgre { diff --git a/libs/openengine/bullet/CMotionState.cpp b/libs/openengine/bullet/CMotionState.cpp index d7746cbc5..dc28d9e5f 100644 --- a/libs/openengine/bullet/CMotionState.cpp +++ b/libs/openengine/bullet/CMotionState.cpp @@ -4,7 +4,6 @@ #include #include #include -//#include namespace OEngine { namespace Physic diff --git a/libs/openengine/bullet/physic.cpp b/libs/openengine/bullet/physic.cpp index 1bc4341a0..500e8a7ef 100644 --- a/libs/openengine/bullet/physic.cpp +++ b/libs/openengine/bullet/physic.cpp @@ -3,7 +3,6 @@ #include #include #include -//#include #include "CMotionState.h" #include "OgreRoot.h" #include "btKinematicCharacterController.h" @@ -286,7 +285,7 @@ namespace Physic minh = h; maxh = h; } - + if (h>maxh) maxh = h; if (h #include #include #include "trace.h" #include "physic.hpp" +#include //#include "GameMath.h" //#include "GameTime.h" @@ -154,7 +154,7 @@ struct playerMove KEYUP }; - playercmd() : forwardmove(0), rightmove(0), upmove(0), serverTime(50), ducking(false), + playercmd() : forwardmove(0), rightmove(0), upmove(0), serverTime(50), ducking(false), activating(false), lastActivatingState(false), procActivating(NO_CHANGE), dropping(false), lastDroppingState(false), procDropping(NO_CHANGE) { diff --git a/libs/openengine/bullet/trace.h b/libs/openengine/bullet/trace.h index d446b6854..076baf56e 100644 --- a/libs/openengine/bullet/trace.h +++ b/libs/openengine/bullet/trace.h @@ -5,12 +5,11 @@ #include #include #include -//#include #include #include - + enum traceWorldType { collisionWorldTrace = 1, @@ -33,7 +32,7 @@ struct NewPhysTraceResults float fraction; bool startSolid; //const Object* hitObj; -}; +}; struct traceResults { Ogre::Vector3 endpos;