Merge remote branch 'mirc/master' into openengine

actorid
Marc Zinnschlag 13 years ago
commit 81d0d58346

3
.gitignore vendored

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

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

@ -35,8 +35,6 @@
#include "mwsound/soundmanager.hpp"
#include "mwworld/world.hpp"
#include "mwworld/ptr.hpp"
#include "mwworld/environment.hpp"
#include "mwworld/class.hpp"
#include "mwworld/player.hpp"
@ -175,7 +173,6 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
OMW::Engine::Engine(Cfg::ConfigurationManager& configurationManager)
: mOgre (0)
, mPhysicEngine (0)
, mFpsLevel(0)
, mDebug (false)
, mVerboseScripts (false)
@ -186,7 +183,6 @@ OMW::Engine::Engine(Cfg::ConfigurationManager& configurationManager)
, mFocusTDiff (0)
, mScriptManager (0)
, mScriptContext (0)
, mGuiManager (0)
, mFSStrict (false)
, mCfgMgr(configurationManager)
{
@ -196,7 +192,6 @@ OMW::Engine::Engine(Cfg::ConfigurationManager& configurationManager)
OMW::Engine::~Engine()
{
delete mGuiManager;
delete mEnvironment.mWorld;
delete mEnvironment.mSoundManager;
delete mEnvironment.mGlobalScripts;
@ -205,7 +200,6 @@ OMW::Engine::~Engine()
delete mEnvironment.mJournal;
delete mScriptManager;
delete mScriptContext;
delete mPhysicEngine;
delete mOgre;
}
@ -333,26 +327,15 @@ void OMW::Engine::go()
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
mEnvironment.mWorld = new MWWorld::World (*mOgre, mPhysicEngine, mFileCollections, mMaster,
mEnvironment.mWorld = new MWWorld::World (*mOgre, mFileCollections, mMaster,
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
MWScript::registerExtensions (mExtensions);
mEnvironment.mWindowManager = new MWGui::WindowManager(mGuiManager->getGui(), mEnvironment,
mExtensions, mFpsLevel, mNewGame);
mEnvironment.mWindowManager = new MWGui::WindowManager(mEnvironment,
mExtensions, mFpsLevel, mNewGame, mOgre, mCfgMgr.getLogPath().string() + std::string("/"));
// Create sound system
mEnvironment.mSoundManager = new MWSound::SoundManager(mOgre->getRoot(),

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

@ -22,12 +22,13 @@
using namespace MWGui;
WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment,
const Compiler::Extensions& extensions, int fpsLevel, bool newGame)
WindowManager::WindowManager(MWWorld::Environment& environment,
const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string logpath)
: environment(environment)
, nameDialog(nullptr)
, raceDialog(nullptr)
, dialogueWindow(nullptr)
, mGuiManager (0)
, classChoiceDialog(nullptr)
, generateClassQuestionDialog(nullptr)
, generateClassResultDialog(nullptr)
@ -35,7 +36,6 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
, createClassDialog(nullptr)
, birthSignDialog(nullptr)
, reviewDialog(nullptr)
, gui(_gui)
, mode(GM_Game)
, nextMode(GM_Game)
, needModeChange(false)
@ -46,6 +46,10 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
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
MyGUI::FactoryManager::getInstance().registerFactory<DialogeHistory>("Widget");
@ -91,6 +95,7 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
WindowManager::~WindowManager()
{
delete mGuiManager;
delete console;
delete mMessageBoxManager;
delete hud;

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

@ -19,8 +19,6 @@ using namespace Ogre;
namespace MWRender {
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)
{

@ -3,6 +3,7 @@
#include "physicssystem.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/world.hpp" // FIXME
#include <components/nifbullet/bullet_nif_loader.hpp>
#include "OgreRoot.h"
#include "OgreRenderWindow.h"
@ -16,16 +17,24 @@ using namespace Ogre;
namespace MWWorld
{
PhysicsSystem::PhysicsSystem(OEngine::Render::OgreRenderer &_rend , OEngine::Physic::PhysicEngine* physEng) :
mRender(_rend), mEngine(physEng), mFreeFly (true)
PhysicsSystem::PhysicsSystem(OEngine::Render::OgreRenderer &_rend) :
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()
{
delete mEngine;
}
OEngine::Physic::PhysicEngine* PhysicsSystem::getEngine()
{
return mEngine;
}
std::pair<std::string, float> PhysicsSystem::getFacedHandle (MWWorld::World& world)
{
std::string handle = "";

@ -12,7 +12,7 @@ namespace MWWorld
class PhysicsSystem
{
public:
PhysicsSystem (OEngine::Render::OgreRenderer &_rend , OEngine::Physic::PhysicEngine* physEng);
PhysicsSystem (OEngine::Render::OgreRenderer &_rend);
~PhysicsSystem ();
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);
OEngine::Physic::PhysicEngine* getEngine();
private:
OEngine::Render::OgreRenderer &mRender;
OEngine::Physic::PhysicEngine* mEngine;

@ -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 std::string& master, const boost::filesystem::path& resDir,
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)
{
mPhysEngine = physEng;
mPhysics = new PhysicsSystem(renderer, physEng);
mPhysics = new PhysicsSystem(renderer);
mPhysEngine = mPhysics->getEngine();
mRendering = new MWRender::RenderingManager(renderer, resDir, mPhysEngine, environment);
boost::filesystem::path masterPath (fileCollections.getCollection (".esm").getPath (master));
@ -163,7 +164,7 @@ namespace MWWorld
mEsm.open (masterPath.string());
mStore.load (mEsm);
MWRender::Player* play = &(mRendering.getPlayer());
MWRender::Player* play = &(mRendering->getPlayer());
mPlayer = new MWWorld::Player (play, mStore.npcs.find ("player"), *this);
mPhysics->addActor (mPlayer->getPlayer().getRefData().getHandle(), "", Ogre::Vector3 (0, 0, 0));
@ -176,9 +177,7 @@ namespace MWWorld
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 mGlobalVariables;
delete mRendering;
delete mPhysics;
delete mPlayer;
@ -368,7 +367,7 @@ namespace MWWorld
mGlobalVariables->setFloat ("gamehour", hour);
mRendering.skySetHour (hour);
mRendering->skySetHour (hour);
if (days>0)
setDay (days + mGlobalVariables->getInt ("day"));
@ -403,7 +402,7 @@ namespace MWWorld
mGlobalVariables->setInt ("day", day);
mGlobalVariables->setInt ("month", month);
mRendering.skySetDate (day, month);
mRendering->skySetDate (day, month);
}
void World::setMonth (int month)
@ -424,7 +423,7 @@ namespace MWWorld
if (years>0)
mGlobalVariables->setInt ("year", years+mGlobalVariables->getInt ("year"));
mRendering.skySetDate (mGlobalVariables->getInt ("day"), month);
mRendering->skySetDate (mGlobalVariables->getInt ("day"), month);
}
bool World::toggleSky()
@ -432,34 +431,34 @@ namespace MWWorld
if (mSky)
{
mSky = false;
mRendering.skyDisable();
mRendering->skyDisable();
return false;
}
else
{
mSky = true;
// TODO check for extorior or interior with sky.
mRendering.skySetHour (mGlobalVariables->getFloat ("gamehour"));
mRendering.skySetDate (mGlobalVariables->getInt ("day"),
mRendering->skySetHour (mGlobalVariables->getFloat ("gamehour"));
mRendering->skySetDate (mGlobalVariables->getInt ("day"),
mGlobalVariables->getInt ("month"));
mRendering.skyEnable();
mRendering->skyEnable();
return true;
}
}
int World::getMasserPhase() const
{
return mRendering.skyGetMasserPhase();
return mRendering->skyGetMasserPhase();
}
int World::getSecundaPhase() const
{
return mRendering.skyGetSecundaPhase();
return mRendering->skyGetSecundaPhase();
}
void World::setMoonColour (bool red)
{
mRendering.skySetMoonColour (red);
mRendering->skySetMoonColour (red);
}
float World::getTimeScaleFactor() const
@ -505,7 +504,7 @@ namespace MWWorld
mEnvironment.mSoundManager->stopSound3D (ptr);
mPhysics->removeObject (ptr.getRefData().getHandle());
mRendering.removeObject(ptr);
mRendering->removeObject(ptr);
mLocalScripts.remove (ptr);
}
@ -542,7 +541,7 @@ namespace MWWorld
/// \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)
@ -616,7 +615,7 @@ namespace MWWorld
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)
@ -677,12 +676,12 @@ namespace MWWorld
void World::playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName, int mode,
int number)
{
mRendering.playAnimationGroup (ptr, groupName, mode, number);
mRendering->playAnimationGroup (ptr, groupName, mode, number);
}
void World::skipAnimation (const MWWorld::Ptr& ptr)
{
mRendering.skipAnimation (ptr);
mRendering->skipAnimation (ptr);
}
void World::update (float duration)

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

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

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

Loading…
Cancel
Save