mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
added new mwstate subsystem
This commit is contained in:
parent
eddd6bf48d
commit
79b7fa258b
7 changed files with 82 additions and 4 deletions
|
@ -72,6 +72,10 @@ add_openmw_dir (mwmechanics
|
||||||
aiescort aiactivate repair enchanting pathfinding security spellsuccess
|
aiescort aiactivate repair enchanting pathfinding security spellsuccess
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_openmw_dir (mwstate
|
||||||
|
statemanagerimp
|
||||||
|
)
|
||||||
|
|
||||||
add_openmw_dir (mwbase
|
add_openmw_dir (mwbase
|
||||||
environment world scriptmanager dialoguemanager journal soundmanager mechanicsmanager
|
environment world scriptmanager dialoguemanager journal soundmanager mechanicsmanager
|
||||||
inputmanager windowmanager
|
inputmanager windowmanager
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
#include <MyGUI_WidgetManager.h>
|
#include <MyGUI_WidgetManager.h>
|
||||||
|
|
||||||
|
#include <SDL.h>
|
||||||
|
|
||||||
#include <components/compiler/extensions0.hpp>
|
#include <components/compiler/extensions0.hpp>
|
||||||
|
|
||||||
#include <components/bsa/bsa_archive.hpp>
|
#include <components/bsa/bsa_archive.hpp>
|
||||||
|
@ -39,8 +41,7 @@
|
||||||
|
|
||||||
#include "mwmechanics/mechanicsmanagerimp.hpp"
|
#include "mwmechanics/mechanicsmanagerimp.hpp"
|
||||||
|
|
||||||
|
#include "mwstate/statemanagerimp.hpp"
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
void OMW::Engine::executeLocalScripts()
|
void OMW::Engine::executeLocalScripts()
|
||||||
{
|
{
|
||||||
|
@ -320,6 +321,8 @@ std::string OMW::Engine::loadSettings (Settings::Manager & settings)
|
||||||
|
|
||||||
void OMW::Engine::prepareEngine (Settings::Manager & settings)
|
void OMW::Engine::prepareEngine (Settings::Manager & settings)
|
||||||
{
|
{
|
||||||
|
mEnvironment.setStateManager (new MWState::StateManager);
|
||||||
|
|
||||||
Nif::NIFFile::CacheLock cachelock;
|
Nif::NIFFile::CacheLock cachelock;
|
||||||
|
|
||||||
std::string renderSystem = settings.getString("render system", "Video");
|
std::string renderSystem = settings.getString("render system", "Video");
|
||||||
|
@ -397,7 +400,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
|
||||||
for (size_t i = 0; i < mContentFiles.size(); i++)
|
for (size_t i = 0; i < mContentFiles.size(); i++)
|
||||||
mTranslationDataStorage.loadTranslationData(mFileCollections, mContentFiles[i]);
|
mTranslationDataStorage.loadTranslationData(mFileCollections, mContentFiles[i]);
|
||||||
|
|
||||||
Compiler::registerExtensions (mExtensions);
|
Compiler::registerExtensions (mExtensions);
|
||||||
|
|
||||||
// Create sound system
|
// Create sound system
|
||||||
mEnvironment.setSoundManager (new MWSound::SoundManager(mUseSound));
|
mEnvironment.setSoundManager (new MWSound::SoundManager(mUseSound));
|
||||||
|
|
|
@ -11,13 +11,15 @@
|
||||||
#include "mechanicsmanager.hpp"
|
#include "mechanicsmanager.hpp"
|
||||||
#include "inputmanager.hpp"
|
#include "inputmanager.hpp"
|
||||||
#include "windowmanager.hpp"
|
#include "windowmanager.hpp"
|
||||||
|
#include "statemanager.hpp"
|
||||||
|
|
||||||
MWBase::Environment *MWBase::Environment::sThis = 0;
|
MWBase::Environment *MWBase::Environment::sThis = 0;
|
||||||
bool MWBase::Environment::sExit = false;
|
bool MWBase::Environment::sExit = false;
|
||||||
|
|
||||||
MWBase::Environment::Environment()
|
MWBase::Environment::Environment()
|
||||||
: mWorld (0), mSoundManager (0), mScriptManager (0), mWindowManager (0),
|
: mWorld (0), mSoundManager (0), mScriptManager (0), mWindowManager (0),
|
||||||
mMechanicsManager (0), mDialogueManager (0), mJournal (0), mInputManager (0), mFrameDuration (0)
|
mMechanicsManager (0), mDialogueManager (0), mJournal (0), mInputManager (0), mFrameDuration (0),
|
||||||
|
mStateManager (0)
|
||||||
{
|
{
|
||||||
assert (!sThis);
|
assert (!sThis);
|
||||||
sThis = this;
|
sThis = this;
|
||||||
|
@ -69,6 +71,11 @@ void MWBase::Environment::setInputManager (InputManager *inputManager)
|
||||||
mInputManager = inputManager;
|
mInputManager = inputManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MWBase::Environment::setStateManager (StateManager *stateManager)
|
||||||
|
{
|
||||||
|
mStateManager = stateManager;
|
||||||
|
}
|
||||||
|
|
||||||
void MWBase::Environment::setFrameDuration (float duration)
|
void MWBase::Environment::setFrameDuration (float duration)
|
||||||
{
|
{
|
||||||
mFrameDuration = duration;
|
mFrameDuration = duration;
|
||||||
|
@ -122,6 +129,12 @@ MWBase::InputManager *MWBase::Environment::getInputManager() const
|
||||||
return mInputManager;
|
return mInputManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MWBase::StateManager *MWBase::Environment::getStateManager() const
|
||||||
|
{
|
||||||
|
assert (mStateManager);
|
||||||
|
return mStateManager;
|
||||||
|
}
|
||||||
|
|
||||||
float MWBase::Environment::getFrameDuration() const
|
float MWBase::Environment::getFrameDuration() const
|
||||||
{
|
{
|
||||||
return mFrameDuration;
|
return mFrameDuration;
|
||||||
|
@ -152,6 +165,9 @@ void MWBase::Environment::cleanup()
|
||||||
|
|
||||||
delete mInputManager;
|
delete mInputManager;
|
||||||
mInputManager = 0;
|
mInputManager = 0;
|
||||||
|
|
||||||
|
delete mStateManager;
|
||||||
|
mStateManager = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MWBase::Environment& MWBase::Environment::get()
|
const MWBase::Environment& MWBase::Environment::get()
|
||||||
|
|
|
@ -11,6 +11,7 @@ namespace MWBase
|
||||||
class MechanicsManager;
|
class MechanicsManager;
|
||||||
class InputManager;
|
class InputManager;
|
||||||
class WindowManager;
|
class WindowManager;
|
||||||
|
class StateManager;
|
||||||
|
|
||||||
/// \brief Central hub for mw-subsystems
|
/// \brief Central hub for mw-subsystems
|
||||||
///
|
///
|
||||||
|
@ -30,6 +31,7 @@ namespace MWBase
|
||||||
DialogueManager *mDialogueManager;
|
DialogueManager *mDialogueManager;
|
||||||
Journal *mJournal;
|
Journal *mJournal;
|
||||||
InputManager *mInputManager;
|
InputManager *mInputManager;
|
||||||
|
StateManager *mStateManager;
|
||||||
float mFrameDuration;
|
float mFrameDuration;
|
||||||
|
|
||||||
static bool sExit;
|
static bool sExit;
|
||||||
|
@ -65,6 +67,8 @@ namespace MWBase
|
||||||
|
|
||||||
void setInputManager (InputManager *inputManager);
|
void setInputManager (InputManager *inputManager);
|
||||||
|
|
||||||
|
void setStateManager (StateManager *stateManager);
|
||||||
|
|
||||||
void setFrameDuration (float duration);
|
void setFrameDuration (float duration);
|
||||||
///< Set length of current frame in seconds.
|
///< Set length of current frame in seconds.
|
||||||
|
|
||||||
|
@ -84,6 +88,8 @@ namespace MWBase
|
||||||
|
|
||||||
InputManager *getInputManager() const;
|
InputManager *getInputManager() const;
|
||||||
|
|
||||||
|
StateManager *getStateManager() const;
|
||||||
|
|
||||||
float getFrameDuration() const;
|
float getFrameDuration() const;
|
||||||
|
|
||||||
void cleanup();
|
void cleanup();
|
||||||
|
|
25
apps/openmw/mwbase/statemanager.hpp
Normal file
25
apps/openmw/mwbase/statemanager.hpp
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#ifndef GAME_MWSTATE_STATEMANAGER_H
|
||||||
|
#define GAME_MWSTATE_STATEMANAGER_H
|
||||||
|
|
||||||
|
namespace MWBase
|
||||||
|
{
|
||||||
|
/// \brief Interface for game state manager (implemented in MWState)
|
||||||
|
class StateManager
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
StateManager (const StateManager&);
|
||||||
|
///< not implemented
|
||||||
|
|
||||||
|
StateManager& operator= (const StateManager&);
|
||||||
|
///< not implemented
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
StateManager() {}
|
||||||
|
|
||||||
|
virtual ~StateManager() {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
7
apps/openmw/mwstate/statemanagerimp.cpp
Normal file
7
apps/openmw/mwstate/statemanagerimp.cpp
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
|
||||||
|
#include "statemanagerimp.hpp"
|
||||||
|
|
||||||
|
MWState::StateManager::StateManager()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
17
apps/openmw/mwstate/statemanagerimp.hpp
Normal file
17
apps/openmw/mwstate/statemanagerimp.hpp
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef GAME_STATE_STATEMANAGER_H
|
||||||
|
#define GAME_STATE_STATEMANAGER_H
|
||||||
|
|
||||||
|
#include "../mwbase/statemanager.hpp"
|
||||||
|
|
||||||
|
namespace MWState
|
||||||
|
{
|
||||||
|
class StateManager : public MWBase::StateManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
StateManager();
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in a new issue