added --debug option and finally cleaned up the merge mess

pull/7/head
Marc Zinnschlag 15 years ago
parent 417df63302
commit c7f76f51fb

@ -11,8 +11,6 @@
#include "world.hpp"
#include "mwrender/sky.hpp"
class ProcessCommandsHook : public Ogre::FrameListener
{
public:
@ -27,12 +25,18 @@ protected:
};
OMW::Engine::Engine() : mWorld(NULL)
OMW::Engine::Engine() : mWorld(NULL), mDebug (false)
{
mspCommandServer.reset(
new OMW::CommandServer::Server(&mCommandQueue, kCommandServerPort));
}
OMW::Engine::~Engine()
{
// mspCommandServer->stop();
delete mWorld;
}
// Load all BSA files in data directory.
void OMW::Engine::loadBSA()
@ -89,13 +93,11 @@ void OMW::Engine::addMaster (const std::string& master)
}
}
// Enables sky rendering
//
void OMW::Engine::enableSky (bool bEnable)
void OMW::Engine::enableDebugMode()
{
mEnableSky = bEnable;
mDebug = true;
}
void OMW::Engine::processCommands()
{
Command cmd;
@ -144,7 +146,7 @@ void OMW::Engine::go()
std::cout << "Setting up input system\n";
// Sets up the input system
MWInput::MWInputManager input(mOgre, mWorld->getPlayerPos());
MWInput::MWInputManager input(mOgre, mWorld->getPlayerPos(), mDebug);
// Launch the console server
std::cout << "Starting command server on port " << kCommandServerPort << std::endl;
@ -159,10 +161,4 @@ void OMW::Engine::go()
std::cout << "\nThat's all for now!\n";
}
OMW::Engine::~Engine()
{
// mspCommandServer->stop();
delete mWorld;
delete mpSkyManager;
}

@ -11,12 +11,6 @@
#include "components/commandserver/server.hpp"
#include "components/commandserver/command.hpp"
namespace MWRender
{
class SkyManager;
}
namespace OMW
{
class World;
@ -32,9 +26,7 @@ namespace OMW
std::string mCellName;
std::string mMaster;
World *mWorld;
bool mEnableSky;
MWRender::SkyManager* mpSkyManager;
bool mDebug;
TsDeque<OMW::Command> mCommandQueue;
std::auto_ptr<OMW::CommandServer::Server> mspCommandServer;
@ -67,8 +59,9 @@ namespace OMW
/// - Currently OpenMW only supports one master at the same time.
void addMaster (const std::string& master);
/// Enables rendering of the sky (off by default).
void enableSky (bool bEnable);
/// Enable debug mode:
/// - non-exclusive input
void enableDebugMode();
/// Process pending commands
void processCommands();

@ -29,6 +29,7 @@ bool parseOptions (int argc, char**argv, OMW::Engine& engine)
"set initial cell (only interior cells supported at the moment")
("master", bpo::value<std::string>()->default_value ("Morrowind"),
"master file")
( "debug", "debug mode" )
;
bpo::variables_map variables;
@ -50,6 +51,9 @@ bool parseOptions (int argc, char**argv, OMW::Engine& engine)
engine.setDataDir (variables["data"].as<std::string>());
engine.setCell (variables["start"].as<std::string>());
engine.addMaster (variables["master"].as<std::string>());
if (variables.count ("debug"))
engine.enableDebugMode();
return true;
}

@ -58,10 +58,10 @@ namespace MWInput
public:
MWInputManager(Render::OgreRenderer &_ogre,
MWRender::PlayerPos &_player)
MWRender::PlayerPos &_player, bool debug)
: disp(A_LAST),
ogre(_ogre),
input(_ogre),
input(_ogre, debug),
poller(input),
listener(_ogre, input, disp),
player(_player),

@ -16,7 +16,7 @@ using namespace OIS;
using namespace std;
OISManager::OISManager(Render::OgreRenderer &rend)
OISManager::OISManager(Render::OgreRenderer &rend, bool debug)
{
RenderWindow *window = rend.getWindow();
assert(window);
@ -32,7 +32,7 @@ OISManager::OISManager(Render::OgreRenderer &rend)
// Non-exclusive mouse and keyboard input in debug mode. Debug mode
// isn't implemented yet though.
if(true)
if(debug)
{
#if defined OIS_WIN32_PLATFORM
pl.insert(std::make_pair(std::string("w32_mouse"),

@ -12,7 +12,7 @@ namespace Input
OIS::Mouse *mouse;
OIS::Keyboard *keyboard;
OISManager(Render::OgreRenderer &rend);
OISManager(Render::OgreRenderer &rend, bool debug);
~OISManager();
};
}

Loading…
Cancel
Save