1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-21 21:39:40 +00:00

Merge remote branch 'mirc/master' into openengine

This commit is contained in:
Marc Zinnschlag 2012-01-29 20:25:11 +01:00
commit 81d0d58346
13 changed files with 64 additions and 70 deletions

3
.gitignore vendored
View file

@ -7,3 +7,6 @@ Docs/mainpage.hpp
CMakeFiles CMakeFiles
*/CMakeFiles */CMakeFiles
CMakeCache.txt CMakeCache.txt
Makefile
makefile

View file

@ -1,5 +0,0 @@
esmtool_cmd.c: esmtool.ggo
gengetopt < esmtool.ggo
clean:
rm esmtool_cmd.c esmtool_cmd.h

View file

@ -35,8 +35,6 @@
#include "mwsound/soundmanager.hpp" #include "mwsound/soundmanager.hpp"
#include "mwworld/world.hpp" #include "mwworld/world.hpp"
#include "mwworld/ptr.hpp"
#include "mwworld/environment.hpp"
#include "mwworld/class.hpp" #include "mwworld/class.hpp"
#include "mwworld/player.hpp" #include "mwworld/player.hpp"
@ -175,7 +173,6 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
OMW::Engine::Engine(Cfg::ConfigurationManager& configurationManager) OMW::Engine::Engine(Cfg::ConfigurationManager& configurationManager)
: mOgre (0) : mOgre (0)
, mPhysicEngine (0)
, mFpsLevel(0) , mFpsLevel(0)
, mDebug (false) , mDebug (false)
, mVerboseScripts (false) , mVerboseScripts (false)
@ -186,7 +183,6 @@ OMW::Engine::Engine(Cfg::ConfigurationManager& configurationManager)
, mFocusTDiff (0) , mFocusTDiff (0)
, mScriptManager (0) , mScriptManager (0)
, mScriptContext (0) , mScriptContext (0)
, mGuiManager (0)
, mFSStrict (false) , mFSStrict (false)
, mCfgMgr(configurationManager) , mCfgMgr(configurationManager)
{ {
@ -196,7 +192,6 @@ OMW::Engine::Engine(Cfg::ConfigurationManager& configurationManager)
OMW::Engine::~Engine() OMW::Engine::~Engine()
{ {
delete mGuiManager;
delete mEnvironment.mWorld; delete mEnvironment.mWorld;
delete mEnvironment.mSoundManager; delete mEnvironment.mSoundManager;
delete mEnvironment.mGlobalScripts; delete mEnvironment.mGlobalScripts;
@ -205,7 +200,6 @@ OMW::Engine::~Engine()
delete mEnvironment.mJournal; delete mEnvironment.mJournal;
delete mScriptManager; delete mScriptManager;
delete mScriptContext; delete mScriptContext;
delete mPhysicEngine;
delete mOgre; delete mOgre;
} }
@ -333,26 +327,15 @@ void OMW::Engine::go()
loadBSA(); loadBSA();
/// \todo move this into the physics manager
// Create physics. shapeLoader is deleted by the physic engine
NifBullet::ManualBulletShapeLoader* shapeLoader = new NifBullet::ManualBulletShapeLoader();
mPhysicEngine = new OEngine::Physic::PhysicEngine(shapeLoader);
// Create the world // Create the world
mEnvironment.mWorld = new MWWorld::World (*mOgre, mPhysicEngine, mFileCollections, mMaster, mEnvironment.mWorld = new MWWorld::World (*mOgre, mFileCollections, mMaster,
mResDir, mNewGame, mEnvironment, mEncoding); mResDir, mNewGame, mEnvironment, mEncoding);
/// \todo move this into the GUI manager (a.k.a WindowManager)
// Set up the GUI system
mGuiManager = new OEngine::GUI::MyGUIManager(mOgre->getWindow(), mOgre->getScene(), false,
mCfgMgr.getLogPath().string() + std::string("/"));
// Create window manager - this manages all the MW-specific GUI windows // Create window manager - this manages all the MW-specific GUI windows
MWScript::registerExtensions (mExtensions); MWScript::registerExtensions (mExtensions);
mEnvironment.mWindowManager = new MWGui::WindowManager(mGuiManager->getGui(), mEnvironment, mEnvironment.mWindowManager = new MWGui::WindowManager(mEnvironment,
mExtensions, mFpsLevel, mNewGame); mExtensions, mFpsLevel, mNewGame, mOgre, mCfgMgr.getLogPath().string() + std::string("/"));
// Create sound system // Create sound system
mEnvironment.mSoundManager = new MWSound::SoundManager(mOgre->getRoot(), mEnvironment.mSoundManager = new MWSound::SoundManager(mOgre->getRoot(),

View file

@ -7,8 +7,6 @@
#include <OgreFrameListener.h> #include <OgreFrameListener.h>
#include <openengine/bullet/physic.hpp>
#include <components/compiler/extensions.hpp> #include <components/compiler/extensions.hpp>
#include <components/files/collections.hpp> #include <components/files/collections.hpp>
#include <components/cfg/configurationmanager.hpp> #include <components/cfg/configurationmanager.hpp>
@ -63,7 +61,6 @@ namespace OMW
boost::filesystem::path mDataDir; boost::filesystem::path mDataDir;
boost::filesystem::path mResDir; boost::filesystem::path mResDir;
OEngine::Render::OgreRenderer *mOgre; OEngine::Render::OgreRenderer *mOgre;
OEngine::Physic::PhysicEngine* mPhysicEngine;
std::string mCellName; std::string mCellName;
std::string mMaster; std::string mMaster;
int mFpsLevel; int mFpsLevel;
@ -80,7 +77,7 @@ namespace OMW
MWScript::ScriptManager *mScriptManager; MWScript::ScriptManager *mScriptManager;
Compiler::Extensions mExtensions; Compiler::Extensions mExtensions;
Compiler::Context *mScriptContext; Compiler::Context *mScriptContext;
OEngine::GUI::MyGUIManager *mGuiManager;
Files::Collections mFileCollections; Files::Collections mFileCollections;
bool mFSStrict; bool mFSStrict;

View file

@ -22,12 +22,13 @@
using namespace MWGui; using namespace MWGui;
WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment, WindowManager::WindowManager(MWWorld::Environment& environment,
const Compiler::Extensions& extensions, int fpsLevel, bool newGame) const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string logpath)
: environment(environment) : environment(environment)
, nameDialog(nullptr) , nameDialog(nullptr)
, raceDialog(nullptr) , raceDialog(nullptr)
, dialogueWindow(nullptr) , dialogueWindow(nullptr)
, mGuiManager (0)
, classChoiceDialog(nullptr) , classChoiceDialog(nullptr)
, generateClassQuestionDialog(nullptr) , generateClassQuestionDialog(nullptr)
, generateClassResultDialog(nullptr) , generateClassResultDialog(nullptr)
@ -35,7 +36,6 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
, createClassDialog(nullptr) , createClassDialog(nullptr)
, birthSignDialog(nullptr) , birthSignDialog(nullptr)
, reviewDialog(nullptr) , reviewDialog(nullptr)
, gui(_gui)
, mode(GM_Game) , mode(GM_Game)
, nextMode(GM_Game) , nextMode(GM_Game)
, needModeChange(false) , needModeChange(false)
@ -46,6 +46,10 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
creationStage = NotStarted; creationStage = NotStarted;
// Set up the GUI system
mGuiManager = new OEngine::GUI::MyGUIManager(mOgre->getWindow(), mOgre->getScene(), false, logpath);
gui = mGuiManager->getGui();
//Register own widgets with MyGUI //Register own widgets with MyGUI
MyGUI::FactoryManager::getInstance().registerFactory<DialogeHistory>("Widget"); MyGUI::FactoryManager::getInstance().registerFactory<DialogeHistory>("Widget");
@ -91,6 +95,7 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
WindowManager::~WindowManager() WindowManager::~WindowManager()
{ {
delete mGuiManager;
delete console; delete console;
delete mMessageBoxManager; delete mMessageBoxManager;
delete hud; delete hud;

View file

@ -15,6 +15,8 @@
#include <set> #include <set>
#include <components/esm_store/store.hpp> #include <components/esm_store/store.hpp>
#include <openengine/ogre/renderer.hpp>
#include <openengine/gui/manager.hpp>
#include "../mwmechanics/stat.hpp" #include "../mwmechanics/stat.hpp"
#include "mode.hpp" #include "mode.hpp"
@ -81,6 +83,7 @@ namespace MWGui
typedef std::vector<int> SkillList; typedef std::vector<int> SkillList;
private: private:
OEngine::GUI::MyGUIManager *mGuiManager;
MWWorld::Environment& environment; MWWorld::Environment& environment;
HUD *hud; HUD *hud;
MapWindow *map; MapWindow *map;
@ -165,8 +168,8 @@ namespace MWGui
public: public:
/// The constructor needs the main Gui object /// The constructor needs the main Gui object
WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment, WindowManager(MWWorld::Environment& environment,
const Compiler::Extensions& extensions, int fpsLevel, bool newGame); const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string logpath);
virtual ~WindowManager(); virtual ~WindowManager();
/** /**

View file

@ -19,8 +19,6 @@ using namespace Ogre;
namespace MWRender { namespace MWRender {
RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, OEngine::Physic::PhysicEngine* engine, MWWorld::Environment& environment) RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, OEngine::Physic::PhysicEngine* engine, MWWorld::Environment& environment)
:mRendering(_rend), mObjects(mRendering), mActors(mRendering, environment), mDebugging(engine) :mRendering(_rend), mObjects(mRendering), mActors(mRendering, environment), mDebugging(engine)
{ {

View file

@ -3,6 +3,7 @@
#include "physicssystem.hpp" #include "physicssystem.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/world.hpp" // FIXME #include "../mwworld/world.hpp" // FIXME
#include <components/nifbullet/bullet_nif_loader.hpp>
#include "OgreRoot.h" #include "OgreRoot.h"
#include "OgreRenderWindow.h" #include "OgreRenderWindow.h"
@ -16,16 +17,24 @@ using namespace Ogre;
namespace MWWorld namespace MWWorld
{ {
PhysicsSystem::PhysicsSystem(OEngine::Render::OgreRenderer &_rend , OEngine::Physic::PhysicEngine* physEng) : PhysicsSystem::PhysicsSystem(OEngine::Render::OgreRenderer &_rend) :
mRender(_rend), mEngine(physEng), mFreeFly (true) mRender(_rend), mEngine(0), mFreeFly (true)
{ {
// Create physics. shapeLoader is deleted by the physic engine
NifBullet::ManualBulletShapeLoader* shapeLoader = new NifBullet::ManualBulletShapeLoader();
mEngine = new OEngine::Physic::PhysicEngine(shapeLoader);
} }
PhysicsSystem::~PhysicsSystem() PhysicsSystem::~PhysicsSystem()
{ {
delete mEngine;
} }
OEngine::Physic::PhysicEngine* PhysicsSystem::getEngine()
{
return mEngine;
}
std::pair<std::string, float> PhysicsSystem::getFacedHandle (MWWorld::World& world) std::pair<std::string, float> PhysicsSystem::getFacedHandle (MWWorld::World& world)
{ {
std::string handle = ""; std::string handle = "";

View file

@ -12,7 +12,7 @@ namespace MWWorld
class PhysicsSystem class PhysicsSystem
{ {
public: public:
PhysicsSystem (OEngine::Render::OgreRenderer &_rend , OEngine::Physic::PhysicEngine* physEng); PhysicsSystem (OEngine::Render::OgreRenderer &_rend);
~PhysicsSystem (); ~PhysicsSystem ();
std::vector< std::pair<std::string, Ogre::Vector3> > doPhysics (float duration, std::vector< std::pair<std::string, Ogre::Vector3> > doPhysics (float duration,
@ -39,6 +39,8 @@ namespace MWWorld
void insertActorPhysics(const MWWorld::Ptr&, std::string model); void insertActorPhysics(const MWWorld::Ptr&, std::string model);
OEngine::Physic::PhysicEngine* getEngine();
private: private:
OEngine::Render::OgreRenderer &mRender; OEngine::Render::OgreRenderer &mRender;
OEngine::Physic::PhysicEngine* mEngine; OEngine::Physic::PhysicEngine* mEngine;

View file

@ -143,16 +143,17 @@ namespace MWWorld
} }
} }
World::World (OEngine::Render::OgreRenderer& renderer, OEngine::Physic::PhysicEngine* physEng, World::World (OEngine::Render::OgreRenderer& renderer,
const Files::Collections& fileCollections, const Files::Collections& fileCollections,
const std::string& master, const boost::filesystem::path& resDir, const std::string& master, const boost::filesystem::path& resDir,
bool newGame, Environment& environment, const std::string& encoding) bool newGame, Environment& environment, const std::string& encoding)
: mRendering (renderer,resDir, physEng, environment),mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0), : mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
mSky (false), mEnvironment (environment), mNextDynamicRecord (0), mCells (mStore, mEsm, *this) mSky (false), mEnvironment (environment), mNextDynamicRecord (0), mCells (mStore, mEsm, *this)
{ {
mPhysEngine = physEng; mPhysics = new PhysicsSystem(renderer);
mPhysEngine = mPhysics->getEngine();
mPhysics = new PhysicsSystem(renderer, physEng);
mRendering = new MWRender::RenderingManager(renderer, resDir, mPhysEngine, environment);
boost::filesystem::path masterPath (fileCollections.getCollection (".esm").getPath (master)); boost::filesystem::path masterPath (fileCollections.getCollection (".esm").getPath (master));
@ -163,7 +164,7 @@ namespace MWWorld
mEsm.open (masterPath.string()); mEsm.open (masterPath.string());
mStore.load (mEsm); mStore.load (mEsm);
MWRender::Player* play = &(mRendering.getPlayer()); MWRender::Player* play = &(mRendering->getPlayer());
mPlayer = new MWWorld::Player (play, mStore.npcs.find ("player"), *this); mPlayer = new MWWorld::Player (play, mStore.npcs.find ("player"), *this);
mPhysics->addActor (mPlayer->getPlayer().getRefData().getHandle(), "", Ogre::Vector3 (0, 0, 0)); mPhysics->addActor (mPlayer->getPlayer().getRefData().getHandle(), "", Ogre::Vector3 (0, 0, 0));
@ -176,9 +177,7 @@ namespace MWWorld
mGlobalVariables->setInt ("chargenstate", 1); mGlobalVariables->setInt ("chargenstate", 1);
} }
mPhysEngine = physEng; mWorldScene = new Scene(environment, this, *mRendering, mPhysics);
mWorldScene = new Scene(environment, this, mRendering, mPhysics);
} }
@ -186,7 +185,7 @@ namespace MWWorld
{ {
delete mWorldScene; delete mWorldScene;
delete mGlobalVariables; delete mGlobalVariables;
delete mRendering;
delete mPhysics; delete mPhysics;
delete mPlayer; delete mPlayer;
@ -368,7 +367,7 @@ namespace MWWorld
mGlobalVariables->setFloat ("gamehour", hour); mGlobalVariables->setFloat ("gamehour", hour);
mRendering.skySetHour (hour); mRendering->skySetHour (hour);
if (days>0) if (days>0)
setDay (days + mGlobalVariables->getInt ("day")); setDay (days + mGlobalVariables->getInt ("day"));
@ -403,7 +402,7 @@ namespace MWWorld
mGlobalVariables->setInt ("day", day); mGlobalVariables->setInt ("day", day);
mGlobalVariables->setInt ("month", month); mGlobalVariables->setInt ("month", month);
mRendering.skySetDate (day, month); mRendering->skySetDate (day, month);
} }
void World::setMonth (int month) void World::setMonth (int month)
@ -424,7 +423,7 @@ namespace MWWorld
if (years>0) if (years>0)
mGlobalVariables->setInt ("year", years+mGlobalVariables->getInt ("year")); mGlobalVariables->setInt ("year", years+mGlobalVariables->getInt ("year"));
mRendering.skySetDate (mGlobalVariables->getInt ("day"), month); mRendering->skySetDate (mGlobalVariables->getInt ("day"), month);
} }
bool World::toggleSky() bool World::toggleSky()
@ -432,34 +431,34 @@ namespace MWWorld
if (mSky) if (mSky)
{ {
mSky = false; mSky = false;
mRendering.skyDisable(); mRendering->skyDisable();
return false; return false;
} }
else else
{ {
mSky = true; mSky = true;
// TODO check for extorior or interior with sky. // TODO check for extorior or interior with sky.
mRendering.skySetHour (mGlobalVariables->getFloat ("gamehour")); mRendering->skySetHour (mGlobalVariables->getFloat ("gamehour"));
mRendering.skySetDate (mGlobalVariables->getInt ("day"), mRendering->skySetDate (mGlobalVariables->getInt ("day"),
mGlobalVariables->getInt ("month")); mGlobalVariables->getInt ("month"));
mRendering.skyEnable(); mRendering->skyEnable();
return true; return true;
} }
} }
int World::getMasserPhase() const int World::getMasserPhase() const
{ {
return mRendering.skyGetMasserPhase(); return mRendering->skyGetMasserPhase();
} }
int World::getSecundaPhase() const int World::getSecundaPhase() const
{ {
return mRendering.skyGetSecundaPhase(); return mRendering->skyGetSecundaPhase();
} }
void World::setMoonColour (bool red) void World::setMoonColour (bool red)
{ {
mRendering.skySetMoonColour (red); mRendering->skySetMoonColour (red);
} }
float World::getTimeScaleFactor() const float World::getTimeScaleFactor() const
@ -505,7 +504,7 @@ namespace MWWorld
mEnvironment.mSoundManager->stopSound3D (ptr); mEnvironment.mSoundManager->stopSound3D (ptr);
mPhysics->removeObject (ptr.getRefData().getHandle()); mPhysics->removeObject (ptr.getRefData().getHandle());
mRendering.removeObject(ptr); mRendering->removeObject(ptr);
mLocalScripts.remove (ptr); mLocalScripts.remove (ptr);
} }
@ -542,7 +541,7 @@ namespace MWWorld
/// \todo cell change for non-player ref /// \todo cell change for non-player ref
mRendering.moveObject (ptr, Ogre::Vector3 (x, y, z)); mRendering->moveObject (ptr, Ogre::Vector3 (x, y, z));
} }
void World::moveObject (Ptr ptr, float x, float y, float z) void World::moveObject (Ptr ptr, float x, float y, float z)
@ -616,7 +615,7 @@ namespace MWWorld
bool World::toggleRenderMode (RenderMode mode) bool World::toggleRenderMode (RenderMode mode)
{ {
return mRendering.toggleRenderMode (mode); return mRendering->toggleRenderMode (mode);
} }
std::pair<std::string, const ESM::Potion *> World::createRecord (const ESM::Potion& record) std::pair<std::string, const ESM::Potion *> World::createRecord (const ESM::Potion& record)
@ -677,12 +676,12 @@ namespace MWWorld
void World::playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName, int mode, void World::playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName, int mode,
int number) int number)
{ {
mRendering.playAnimationGroup (ptr, groupName, mode, number); mRendering->playAnimationGroup (ptr, groupName, mode, number);
} }
void World::skipAnimation (const MWWorld::Ptr& ptr) void World::skipAnimation (const MWWorld::Ptr& ptr)
{ {
mRendering.skipAnimation (ptr); mRendering->skipAnimation (ptr);
} }
void World::update (float duration) void World::update (float duration)

View file

@ -65,7 +65,7 @@ namespace MWWorld
private: private:
MWRender::RenderingManager mRendering; MWRender::RenderingManager* mRendering;
MWWorld::Scene *mWorldScene; MWWorld::Scene *mWorldScene;
MWWorld::Player *mPlayer; MWWorld::Player *mPlayer;
@ -95,7 +95,7 @@ namespace MWWorld
public: public:
World (OEngine::Render::OgreRenderer& renderer, OEngine::Physic::PhysicEngine* physEng, World (OEngine::Render::OgreRenderer& renderer,
const Files::Collections& fileCollections, const Files::Collections& fileCollections,
const std::string& master, const boost::filesystem::path& resDir, bool newGame, const std::string& master, const boost::filesystem::path& resDir, bool newGame,
Environment& environment, const std::string& encoding); Environment& environment, const std::string& encoding);

View file

@ -19,7 +19,7 @@ along with Caelum. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef __APPLE__ #ifdef __APPLE__
#include "Ogre/Ogre.h" #include "OGRE/Ogre.h"
#else #else
#include "Ogre.h" #include "Ogre.h"
#endif #endif

View file

@ -75,7 +75,7 @@ namespace Caelum
stream.unsetf(std::ios::dec); stream.unsetf(std::ios::dec);
stream.setf(std::ios::hex); stream.setf(std::ios::hex);
stream.setf(std::ios::uppercase); stream.setf(std::ios::uppercase);
stream << reinterpret_cast<ptrdiff_t>(pointer); stream << reinterpret_cast<std::ptrdiff_t>(pointer);
return stream.str(); return stream.str();
} }