mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 00:26:39 +00:00 
			
		
		
		
	second part of refactoring
This commit is contained in:
		
							parent
							
								
									f8cb4c2502
								
							
						
					
					
						commit
						d51e6fb7c4
					
				
					 13 changed files with 57 additions and 49 deletions
				
			
		| 
						 | 
				
			
			@ -10,12 +10,9 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/)
 | 
			
		|||
 | 
			
		||||
set(GAME 
 | 
			
		||||
    apps/openmw/main.cpp 
 | 
			
		||||
    apps/openmw/engine.cpp
 | 
			
		||||
    apps/openmw/world.cpp)
 | 
			
		||||
    apps/openmw/engine.cpp)
 | 
			
		||||
set(GAME_HEADER 
 | 
			
		||||
    apps/openmw/engine.hpp
 | 
			
		||||
    apps/openmw/world.hpp
 | 
			
		||||
    apps/openmw/refdata.hpp)
 | 
			
		||||
    apps/openmw/engine.hpp)
 | 
			
		||||
source_group(game FILES ${GAME} ${GAME_HEADER})
 | 
			
		||||
 | 
			
		||||
set(GAMEREND 
 | 
			
		||||
| 
						 | 
				
			
			@ -60,9 +57,17 @@ set(GAMESOUND_HEADER
 | 
			
		|||
    apps/openmw/mwsound/extensions.hpp)
 | 
			
		||||
source_group(apps\\openmw\\mwsound FILES ${GAMESOUND} ${GAMESOUND_HEADER}) 
 | 
			
		||||
 | 
			
		||||
set(APPS ${GAME} ${GAMEREND} ${GAMEINPUT} ${GAMESCRIPT} ${GAMESOUND})
 | 
			
		||||
set(GAMEWORLD
 | 
			
		||||
    apps/openmw/mwworld/world.cpp)
 | 
			
		||||
set(GAMEWORLD_HEADER 
 | 
			
		||||
    apps/openmw/mwworld/refdata.hpp
 | 
			
		||||
    apps/openmw/mwworld/world.hpp)
 | 
			
		||||
source_group(apps\\openmw\\mwworld FILES ${GAMEWORLD} ${GAMEWORLD_HEADER}) 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
set(APPS ${GAME} ${GAMEREND} ${GAMEINPUT} ${GAMESCRIPT} ${GAMESOUND} ${GAMEWORLD})
 | 
			
		||||
set(APPS_HEADER ${GAME_HEADER} ${GAMEREND_HEADER} ${GAMEINPUT_HEADER} ${GAMESCRIPT_HEADER}
 | 
			
		||||
    ${GAMESOUND_HEADER})
 | 
			
		||||
    ${GAMESOUND_HEADER} ${GAMEWORLD_HEADER})
 | 
			
		||||
 | 
			
		||||
# source directory: components
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,10 +4,11 @@
 | 
			
		|||
 | 
			
		||||
#include <iostream>
 | 
			
		||||
 | 
			
		||||
#include "components/misc/fileops.hpp"
 | 
			
		||||
#include "components/bsa/bsa_archive.hpp"
 | 
			
		||||
#include <components/misc/fileops.hpp>
 | 
			
		||||
#include <components/bsa/bsa_archive.hpp>
 | 
			
		||||
 | 
			
		||||
#include "mwinput/inputmanager.hpp"
 | 
			
		||||
 | 
			
		||||
#include "mwscript/scriptmanager.hpp"
 | 
			
		||||
#include "mwscript/compilercontextscript.hpp"
 | 
			
		||||
#include "mwscript/interpretercontext.hpp"
 | 
			
		||||
| 
						 | 
				
			
			@ -15,11 +16,11 @@
 | 
			
		|||
 | 
			
		||||
#include "mwsound/soundmanager.hpp"
 | 
			
		||||
 | 
			
		||||
#include "world.hpp"
 | 
			
		||||
#include "mwworld/world.hpp"
 | 
			
		||||
 | 
			
		||||
void OMW::Engine::executeLocalScripts()
 | 
			
		||||
{
 | 
			
		||||
    for (World::ScriptList::const_iterator iter (mWorld->getLocalScripts().begin());
 | 
			
		||||
    for (MWWorld::World::ScriptList::const_iterator iter (mWorld->getLocalScripts().begin());
 | 
			
		||||
        iter!=mWorld->getLocalScripts().end(); ++iter)
 | 
			
		||||
    {
 | 
			
		||||
        MWScript::InterpreterContext interpreterContext (*mWorld, *mSoundManager, iter->second);
 | 
			
		||||
| 
						 | 
				
			
			@ -163,7 +164,7 @@ void OMW::Engine::go()
 | 
			
		|||
    loadBSA();
 | 
			
		||||
 | 
			
		||||
    // Create the world
 | 
			
		||||
    mWorld = new World (mOgre, mDataDir, mMaster, mCellName);
 | 
			
		||||
    mWorld = new MWWorld::World (mOgre, mDataDir, mMaster, mCellName);
 | 
			
		||||
 | 
			
		||||
    mSoundManager = new MWSound::SoundManager;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,10 +7,10 @@
 | 
			
		|||
 | 
			
		||||
#include <OgreFrameListener.h>
 | 
			
		||||
 | 
			
		||||
#include "components/engine/ogre/renderer.hpp"
 | 
			
		||||
#include "components/misc/tsdeque.hpp"
 | 
			
		||||
#include "components/commandserver/server.hpp"
 | 
			
		||||
#include "components/commandserver/command.hpp"
 | 
			
		||||
#include <components/engine/ogre/renderer.hpp>
 | 
			
		||||
#include <components/misc/tsdeque.hpp>
 | 
			
		||||
#include <components/commandserver/server.hpp>
 | 
			
		||||
#include <components/commandserver/command.hpp>
 | 
			
		||||
#include <components/compiler/extensions.hpp>
 | 
			
		||||
 | 
			
		||||
namespace Compiler
 | 
			
		||||
| 
						 | 
				
			
			@ -28,10 +28,13 @@ namespace MWSound
 | 
			
		|||
    class SoundManager;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace OMW
 | 
			
		||||
namespace MWWorld
 | 
			
		||||
{
 | 
			
		||||
    class World;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace OMW
 | 
			
		||||
{
 | 
			
		||||
    /// \brief Main engine class, that brings together all the components of OpenMW
 | 
			
		||||
 | 
			
		||||
    class Engine : private Ogre::FrameListener
 | 
			
		||||
| 
						 | 
				
			
			@ -42,7 +45,7 @@ namespace OMW
 | 
			
		|||
            Render::OgreRenderer mOgre;
 | 
			
		||||
            std::string mCellName;
 | 
			
		||||
            std::string mMaster;
 | 
			
		||||
            World *mWorld;
 | 
			
		||||
            MWWorld::World *mWorld;
 | 
			
		||||
            bool mDebug;
 | 
			
		||||
            bool mVerboseScripts;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,7 +18,7 @@ void insertObj(CellRenderImp& cellRender, T& liveRef)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
template<>
 | 
			
		||||
void insertObj(CellRenderImp& cellRender, ESMS::LiveCellRef<ESM::Light, OMW::RefData>& liveRef)
 | 
			
		||||
void insertObj(CellRenderImp& cellRender, ESMS::LiveCellRef<ESM::Light, MWWorld::RefData>& liveRef)
 | 
			
		||||
{
 | 
			
		||||
  assert (liveRef.base != NULL);
 | 
			
		||||
  const std::string &model = liveRef.base->model;
 | 
			
		||||
| 
						 | 
				
			
			@ -50,7 +50,7 @@ void insertCellRefList (CellRenderImp& cellRender, T& cellRefList)
 | 
			
		|||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CellRenderImp::insertCell(ESMS::CellStore<OMW::RefData> &cell)
 | 
			
		||||
void CellRenderImp::insertCell(ESMS::CellStore<MWWorld::RefData> &cell)
 | 
			
		||||
{
 | 
			
		||||
  // Loop through all references in the cell
 | 
			
		||||
  insertCellRefList (*this, cell.activators);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@
 | 
			
		|||
 | 
			
		||||
#include "components/esm_store/cell_store.hpp"
 | 
			
		||||
 | 
			
		||||
#include "../refdata.hpp"
 | 
			
		||||
#include "../mwworld/refdata.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ESM
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -35,7 +35,7 @@ namespace MWRender
 | 
			
		|||
    /// finish inserting a new reference and return a handle to it.
 | 
			
		||||
    virtual std::string insertEnd() = 0;
 | 
			
		||||
      
 | 
			
		||||
    void insertCell(ESMS::CellStore<OMW::RefData> &cell);
 | 
			
		||||
    void insertCell(ESMS::CellStore<MWWorld::RefData> &cell);
 | 
			
		||||
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -42,7 +42,7 @@ namespace MWRender
 | 
			
		|||
 | 
			
		||||
    static bool lightOutQuadInLin;
 | 
			
		||||
 | 
			
		||||
    ESMS::CellStore<OMW::RefData> &cell;
 | 
			
		||||
    ESMS::CellStore<MWWorld::RefData> &cell;
 | 
			
		||||
    MWScene &scene;
 | 
			
		||||
 | 
			
		||||
    /// The scene node that contains all objects belonging to this
 | 
			
		||||
| 
						 | 
				
			
			@ -78,7 +78,7 @@ namespace MWRender
 | 
			
		|||
 | 
			
		||||
  public:
 | 
			
		||||
 | 
			
		||||
    InteriorCellRender(ESMS::CellStore<OMW::RefData> &_cell, MWScene &_scene)
 | 
			
		||||
    InteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWScene &_scene)
 | 
			
		||||
    : cell(_cell), scene(_scene), base(NULL), insert(NULL), ambientMode (0) {}
 | 
			
		||||
 | 
			
		||||
    virtual ~InteriorCellRender() { destroy(); }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,7 @@
 | 
			
		|||
#include <components/interpreter/runtime.hpp>
 | 
			
		||||
#include <components/interpreter/opcodes.hpp>
 | 
			
		||||
 | 
			
		||||
#include "../world.hpp"
 | 
			
		||||
#include "../mwworld/world.hpp"
 | 
			
		||||
 | 
			
		||||
#include "interpretercontext.hpp"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,11 +5,11 @@
 | 
			
		|||
#include <iostream>
 | 
			
		||||
 | 
			
		||||
#include "locals.hpp"
 | 
			
		||||
#include "../world.hpp"
 | 
			
		||||
#include "../mwworld/world.hpp"
 | 
			
		||||
 | 
			
		||||
namespace MWScript
 | 
			
		||||
{
 | 
			
		||||
    InterpreterContext::InterpreterContext (OMW::World& world,
 | 
			
		||||
    InterpreterContext::InterpreterContext (MWWorld::World& world,
 | 
			
		||||
        MWSound::SoundManager& soundManager, MWScript::Locals *locals)
 | 
			
		||||
    : mWorld (world), mSoundManager (soundManager), mLocals (locals)
 | 
			
		||||
    {}
 | 
			
		||||
| 
						 | 
				
			
			@ -71,7 +71,7 @@ namespace MWScript
 | 
			
		|||
            std::cerr << "error: message box buttons not supported" << std::endl;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    OMW::World& InterpreterContext::getWorld()
 | 
			
		||||
    MWWorld::World& InterpreterContext::getWorld()
 | 
			
		||||
    {
 | 
			
		||||
        return mWorld;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@
 | 
			
		|||
 | 
			
		||||
#include <components/interpreter/context.hpp>
 | 
			
		||||
 | 
			
		||||
namespace OMW
 | 
			
		||||
namespace MWWorld
 | 
			
		||||
{
 | 
			
		||||
    class World;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -19,13 +19,13 @@ namespace MWScript
 | 
			
		|||
 | 
			
		||||
    class InterpreterContext : public Interpreter::Context
 | 
			
		||||
    {
 | 
			
		||||
            OMW::World& mWorld;
 | 
			
		||||
            MWWorld::World& mWorld;
 | 
			
		||||
            MWSound::SoundManager& mSoundManager;
 | 
			
		||||
            Locals *mLocals;
 | 
			
		||||
        
 | 
			
		||||
        public:
 | 
			
		||||
        
 | 
			
		||||
            InterpreterContext (OMW::World& world, MWSound::SoundManager& soundManager,
 | 
			
		||||
            InterpreterContext (MWWorld::World& world, MWSound::SoundManager& soundManager,
 | 
			
		||||
                MWScript::Locals *locals);
 | 
			
		||||
            ///< The ownership of \a locals is not transferred. 0-pointer allowed.
 | 
			
		||||
    
 | 
			
		||||
| 
						 | 
				
			
			@ -44,7 +44,7 @@ namespace MWScript
 | 
			
		|||
            virtual void messageBox (const std::string& message,
 | 
			
		||||
                const std::vector<std::string>& buttons);   
 | 
			
		||||
 | 
			
		||||
            OMW::World& getWorld();
 | 
			
		||||
            MWWorld::World& getWorld();
 | 
			
		||||
            
 | 
			
		||||
            MWSound::SoundManager& getSoundManager();
 | 
			
		||||
    };
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,7 +9,7 @@
 | 
			
		|||
 | 
			
		||||
#include "../mwscript/interpretercontext.hpp"
 | 
			
		||||
 | 
			
		||||
#include "../world.hpp"
 | 
			
		||||
#include "../mwworld/world.hpp"
 | 
			
		||||
 | 
			
		||||
#include "soundmanager.hpp"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,16 +1,16 @@
 | 
			
		|||
#ifndef REFDATA_H
 | 
			
		||||
#define REFDATA_H
 | 
			
		||||
#ifndef GAME_MWWORLD_REFDATA_H
 | 
			
		||||
#define GAME_MWWORLD_REFDATA_H
 | 
			
		||||
 | 
			
		||||
#include <string>
 | 
			
		||||
 | 
			
		||||
#include "mwscript/locals.hpp"
 | 
			
		||||
#include "../mwscript/locals.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ESM
 | 
			
		||||
{
 | 
			
		||||
    class Script;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace OMW
 | 
			
		||||
namespace MWWorld
 | 
			
		||||
{
 | 
			
		||||
    class RefData
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			@ -13,9 +13,9 @@ namespace
 | 
			
		|||
{
 | 
			
		||||
    template<typename T>
 | 
			
		||||
    void listCellScripts (const ESMS::ESMStore& store,
 | 
			
		||||
        ESMS::CellRefList<T, OMW::RefData>& cellRefList, OMW::World::ScriptList& scriptList)
 | 
			
		||||
        ESMS::CellRefList<T, MWWorld::RefData>& cellRefList, MWWorld::World::ScriptList& scriptList)
 | 
			
		||||
    {
 | 
			
		||||
        for (typename ESMS::CellRefList<T, OMW::RefData>::List::iterator iter (
 | 
			
		||||
        for (typename ESMS::CellRefList<T, MWWorld::RefData>::List::iterator iter (
 | 
			
		||||
            cellRefList.list.begin());
 | 
			
		||||
            iter!=cellRefList.list.end(); ++iter)
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			@ -33,9 +33,9 @@ namespace
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace OMW
 | 
			
		||||
namespace MWWorld
 | 
			
		||||
{
 | 
			
		||||
    void World::insertInteriorScripts (ESMS::CellStore<OMW::RefData>& cell)
 | 
			
		||||
    void World::insertInteriorScripts (ESMS::CellStore<RefData>& cell)
 | 
			
		||||
    {
 | 
			
		||||
        listCellScripts (mStore, cell.activators, mLocalScripts);
 | 
			
		||||
        listCellScripts (mStore, cell.potions, mLocalScripts);
 | 
			
		||||
| 
						 | 
				
			
			@ -1,16 +1,15 @@
 | 
			
		|||
#ifndef WORLD_H
 | 
			
		||||
#define WORLD_H
 | 
			
		||||
#ifndef GAME_MWWORLD_WORLD_H
 | 
			
		||||
#define GAME_MWWORLD_WORLD_H
 | 
			
		||||
 | 
			
		||||
#include <vector>
 | 
			
		||||
#include <map>
 | 
			
		||||
 | 
			
		||||
#include <boost/filesystem.hpp>
 | 
			
		||||
 | 
			
		||||
#include "components/esm_store/cell_store.hpp"
 | 
			
		||||
 | 
			
		||||
#include "apps/openmw/mwrender/playerpos.hpp"
 | 
			
		||||
#include "apps/openmw/mwrender/mwscene.hpp"
 | 
			
		||||
#include <components/esm_store/cell_store.hpp>
 | 
			
		||||
 | 
			
		||||
#include "../mwrender/playerpos.hpp"
 | 
			
		||||
#include "../mwrender/mwscene.hpp"
 | 
			
		||||
 | 
			
		||||
#include "refdata.hpp"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -25,7 +24,7 @@ namespace MWRender
 | 
			
		|||
    class CellRender;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
namespace OMW
 | 
			
		||||
namespace MWWorld
 | 
			
		||||
{
 | 
			
		||||
    /// \brief The game world and its visual representation
 | 
			
		||||
    
 | 
			
		||||
| 
						 | 
				
			
			@ -54,7 +53,7 @@ namespace OMW
 | 
			
		|||
            World (const World&);
 | 
			
		||||
            World& operator= (const World&);
 | 
			
		||||
    
 | 
			
		||||
            void insertInteriorScripts (ESMS::CellStore<OMW::RefData>& cell);
 | 
			
		||||
            void insertInteriorScripts (ESMS::CellStore<RefData>& cell);
 | 
			
		||||
    
 | 
			
		||||
        public:
 | 
			
		||||
        
 | 
			
		||||
		Loading…
	
		Reference in a new issue