forked from mirror/openmw-tes3mp
Merge branch 'next' of https://github.com/zinnschlag/openmw.git into object_movement_creation
This commit is contained in:
commit
cc01a5ceed
188 changed files with 11427 additions and 5213 deletions
|
@ -96,19 +96,13 @@ ENDIF()
|
|||
|
||||
set(LIBDIR ${CMAKE_SOURCE_DIR}/libs)
|
||||
|
||||
set(MANGLE_INPUT ${LIBDIR}/mangle/input/servers/ois_driver.cpp)
|
||||
set(MANGLE_ALL ${MANGLE_INPUT})
|
||||
source_group(libs\\mangle FILES ${MANGLE_ALL})
|
||||
|
||||
set(OENGINE_OGRE
|
||||
${LIBDIR}/openengine/ogre/renderer.cpp
|
||||
${LIBDIR}/openengine/ogre/mouselook.cpp
|
||||
${LIBDIR}/openengine/ogre/fader.cpp
|
||||
${LIBDIR}/openengine/ogre/imagerotate.cpp
|
||||
${LIBDIR}/openengine/ogre/atlas.cpp
|
||||
)
|
||||
set(OENGINE_GUI
|
||||
${LIBDIR}/openengine/gui/events.cpp
|
||||
${LIBDIR}/openengine/gui/manager.cpp
|
||||
)
|
||||
|
||||
|
@ -135,7 +129,7 @@ set(OENGINE_BULLET
|
|||
set(OENGINE_ALL ${OENGINE_OGRE} ${OENGINE_GUI} ${OENGINE_BULLET})
|
||||
source_group(libs\\openengine FILES ${OENGINE_ALL})
|
||||
|
||||
set(OPENMW_LIBS ${MANGLE_ALL} ${OENGINE_ALL})
|
||||
set(OPENMW_LIBS ${OENGINE_ALL})
|
||||
set(OPENMW_LIBS_HEADER)
|
||||
|
||||
# Sound setup
|
||||
|
@ -443,6 +437,7 @@ endif(WIN32)
|
|||
|
||||
# Extern
|
||||
add_subdirectory (extern/shiny)
|
||||
add_subdirectory (extern/oics)
|
||||
|
||||
# Components
|
||||
add_subdirectory (components)
|
||||
|
|
|
@ -20,12 +20,12 @@ add_openmw_dir (mwrender
|
|||
)
|
||||
|
||||
add_openmw_dir (mwinput
|
||||
inputmanager
|
||||
inputmanagerimp
|
||||
mouselookevent
|
||||
)
|
||||
|
||||
add_openmw_dir (mwgui
|
||||
text_input widgets race class birth review window_manager console dialogue
|
||||
text_input widgets race class birth review windowmanagerimp console dialogue
|
||||
dialogue_history window_base stats_window messagebox journalwindow charactercreation
|
||||
map_window window_pinnable_base cursorreplace tooltips scrollwindow bookwindow list
|
||||
formatting inventorywindow container hud countdialog tradewindow settingswindow
|
||||
|
@ -60,12 +60,13 @@ add_openmw_dir (mwclass
|
|||
)
|
||||
|
||||
add_openmw_dir (mwmechanics
|
||||
mechanicsmanager stat creaturestats magiceffects movement actors drawstate spells
|
||||
mechanicsmanagerimp stat creaturestats magiceffects movement actors drawstate spells
|
||||
activespells npcstats
|
||||
)
|
||||
|
||||
add_openmw_dir (mwbase
|
||||
environment world scriptmanager dialoguemanager journal soundmanager
|
||||
environment world scriptmanager dialoguemanager journal soundmanager mechanicsmanager
|
||||
inputmanager windowmanager
|
||||
)
|
||||
|
||||
# Main executable
|
||||
|
@ -103,6 +104,7 @@ target_link_libraries(openmw
|
|||
${MYGUI_PLATFORM_LIBRARIES}
|
||||
"shiny"
|
||||
"shiny.OgrePlatform"
|
||||
"oics"
|
||||
components
|
||||
)
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
#include <components/nifbullet/bullet_nif_loader.hpp>
|
||||
#include <components/nifogre/ogre_nif_loader.hpp>
|
||||
|
||||
#include "mwinput/inputmanager.hpp"
|
||||
#include "mwinput/inputmanagerimp.hpp"
|
||||
|
||||
#include "mwgui/window_manager.hpp"
|
||||
#include "mwgui/windowmanagerimp.hpp"
|
||||
#include "mwgui/cursorreplace.hpp"
|
||||
|
||||
#include "mwscript/scriptmanagerimp.hpp"
|
||||
|
@ -32,7 +32,7 @@
|
|||
#include "mwdialogue/dialoguemanagerimp.hpp"
|
||||
#include "mwdialogue/journalimp.hpp"
|
||||
|
||||
#include "mwmechanics/mechanicsmanager.hpp"
|
||||
#include "mwmechanics/mechanicsmanagerimp.hpp"
|
||||
|
||||
|
||||
void OMW::Engine::executeLocalScripts()
|
||||
|
@ -67,7 +67,7 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
|
|||
mEnvironment.setFrameDuration (evt.timeSinceLastFrame);
|
||||
|
||||
// update input
|
||||
MWBase::Environment::get().getInputManager()->update();
|
||||
MWBase::Environment::get().getInputManager()->update(evt.timeSinceLastFrame);
|
||||
|
||||
// sound
|
||||
if (mUseSound)
|
||||
|
@ -270,6 +270,10 @@ void OMW::Engine::go()
|
|||
else if (boost::filesystem::exists(globaldefault))
|
||||
settings.loadUser(globaldefault);
|
||||
|
||||
// Get the path for the keybinder xml file
|
||||
std::string keybinderUser = (mCfgMgr.getUserPath() / "input.xml").string();
|
||||
bool keybinderUserExists = boost::filesystem::exists(keybinderUser);
|
||||
|
||||
mFpsLevel = settings.getInt("fps", "HUD");
|
||||
|
||||
// load nif overrides
|
||||
|
@ -366,9 +370,9 @@ void OMW::Engine::go()
|
|||
|
||||
// Sets up the input system
|
||||
|
||||
mEnvironment.setInputManager (new MWInput::MWInputManager (*mOgre,
|
||||
mEnvironment.setInputManager (new MWInput::InputManager (*mOgre,
|
||||
MWBase::Environment::get().getWorld()->getPlayer(),
|
||||
*MWBase::Environment::get().getWindowManager(), mDebug, *this));
|
||||
*MWBase::Environment::get().getWindowManager(), mDebug, *this, keybinderUser, keybinderUserExists));
|
||||
|
||||
std::cout << "\nPress Q/ESC or close window to exit.\n";
|
||||
|
||||
|
|
|
@ -3,15 +3,14 @@
|
|||
|
||||
#include <cassert>
|
||||
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
|
||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||
|
||||
#include "world.hpp"
|
||||
#include "scriptmanager.hpp"
|
||||
#include "dialoguemanager.hpp"
|
||||
#include "journal.hpp"
|
||||
#include "soundmanager.hpp"
|
||||
#include "mechanicsmanager.hpp"
|
||||
#include "inputmanager.hpp"
|
||||
#include "windowmanager.hpp"
|
||||
|
||||
MWBase::Environment *MWBase::Environment::sThis = 0;
|
||||
|
||||
|
@ -44,12 +43,12 @@ void MWBase::Environment::setScriptManager (ScriptManager *scriptManager)
|
|||
mScriptManager = scriptManager;
|
||||
}
|
||||
|
||||
void MWBase::Environment::setWindowManager (MWGui::WindowManager *windowManager)
|
||||
void MWBase::Environment::setWindowManager (WindowManager *windowManager)
|
||||
{
|
||||
mWindowManager = windowManager;
|
||||
}
|
||||
|
||||
void MWBase::Environment::setMechanicsManager (MWMechanics::MechanicsManager *mechanicsManager)
|
||||
void MWBase::Environment::setMechanicsManager (MechanicsManager *mechanicsManager)
|
||||
{
|
||||
mMechanicsManager = mechanicsManager;
|
||||
}
|
||||
|
@ -64,7 +63,7 @@ void MWBase::Environment::setJournal (Journal *journal)
|
|||
mJournal = journal;
|
||||
}
|
||||
|
||||
void MWBase::Environment::setInputManager (MWInput::MWInputManager *inputManager)
|
||||
void MWBase::Environment::setInputManager (InputManager *inputManager)
|
||||
{
|
||||
mInputManager = inputManager;
|
||||
}
|
||||
|
@ -92,13 +91,13 @@ MWBase::ScriptManager *MWBase::Environment::getScriptManager() const
|
|||
return mScriptManager;
|
||||
}
|
||||
|
||||
MWGui::WindowManager *MWBase::Environment::getWindowManager() const
|
||||
MWBase::WindowManager *MWBase::Environment::getWindowManager() const
|
||||
{
|
||||
assert (mWindowManager);
|
||||
return mWindowManager;
|
||||
}
|
||||
|
||||
MWMechanics::MechanicsManager *MWBase::Environment::getMechanicsManager() const
|
||||
MWBase::MechanicsManager *MWBase::Environment::getMechanicsManager() const
|
||||
{
|
||||
assert (mMechanicsManager);
|
||||
return mMechanicsManager;
|
||||
|
@ -116,7 +115,7 @@ MWBase::Journal *MWBase::Environment::getJournal() const
|
|||
return mJournal;
|
||||
}
|
||||
|
||||
MWInput::MWInputManager *MWBase::Environment::getInputManager() const
|
||||
MWBase::InputManager *MWBase::Environment::getInputManager() const
|
||||
{
|
||||
assert (mInputManager);
|
||||
return mInputManager;
|
||||
|
@ -147,6 +146,9 @@ void MWBase::Environment::cleanup()
|
|||
delete mScriptManager;
|
||||
mScriptManager = 0;
|
||||
|
||||
delete mWindowManager;
|
||||
mWindowManager = 0;
|
||||
|
||||
delete mWorld;
|
||||
mWorld = 0;
|
||||
}
|
||||
|
|
|
@ -1,21 +1,6 @@
|
|||
#ifndef GAME_BASE_INVIRONMENT_H
|
||||
#define GAME_BASE_INVIRONMENT_H
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class WindowManager;
|
||||
}
|
||||
|
||||
namespace MWMechanics
|
||||
{
|
||||
class MechanicsManager;
|
||||
}
|
||||
|
||||
namespace MWInput
|
||||
{
|
||||
struct MWInputManager;
|
||||
}
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
class World;
|
||||
|
@ -23,6 +8,9 @@ namespace MWBase
|
|||
class DialogueManager;
|
||||
class Journal;
|
||||
class SoundManager;
|
||||
class MechanicsManager;
|
||||
class InputManager;
|
||||
class WindowManager;
|
||||
|
||||
/// \brief Central hub for mw-subsystems
|
||||
///
|
||||
|
@ -37,11 +25,11 @@ namespace MWBase
|
|||
World *mWorld;
|
||||
SoundManager *mSoundManager;
|
||||
ScriptManager *mScriptManager;
|
||||
MWGui::WindowManager *mWindowManager;
|
||||
MWMechanics::MechanicsManager *mMechanicsManager;
|
||||
WindowManager *mWindowManager;
|
||||
MechanicsManager *mMechanicsManager;
|
||||
DialogueManager *mDialogueManager;
|
||||
Journal *mJournal;
|
||||
MWInput::MWInputManager *mInputManager;
|
||||
InputManager *mInputManager;
|
||||
float mFrameDuration;
|
||||
|
||||
Environment (const Environment&);
|
||||
|
@ -62,15 +50,15 @@ namespace MWBase
|
|||
|
||||
void setScriptManager (MWBase::ScriptManager *scriptManager);
|
||||
|
||||
void setWindowManager (MWGui::WindowManager *windowManager);
|
||||
void setWindowManager (WindowManager *windowManager);
|
||||
|
||||
void setMechanicsManager (MWMechanics::MechanicsManager *mechanicsManager);
|
||||
void setMechanicsManager (MechanicsManager *mechanicsManager);
|
||||
|
||||
void setDialogueManager (DialogueManager *dialogueManager);
|
||||
|
||||
void setJournal (Journal *journal);
|
||||
|
||||
void setInputManager (MWInput::MWInputManager *inputManager);
|
||||
void setInputManager (InputManager *inputManager);
|
||||
|
||||
void setFrameDuration (float duration);
|
||||
///< Set length of current frame in seconds.
|
||||
|
@ -79,17 +67,17 @@ namespace MWBase
|
|||
|
||||
SoundManager *getSoundManager() const;
|
||||
|
||||
MWBase::ScriptManager *getScriptManager() const;
|
||||
ScriptManager *getScriptManager() const;
|
||||
|
||||
MWGui::WindowManager *getWindowManager() const;
|
||||
WindowManager *getWindowManager() const;
|
||||
|
||||
MWMechanics::MechanicsManager *getMechanicsManager() const;
|
||||
MechanicsManager *getMechanicsManager() const;
|
||||
|
||||
DialogueManager *getDialogueManager() const;
|
||||
|
||||
Journal *getJournal() const;
|
||||
|
||||
MWInput::MWInputManager *getInputManager() const;
|
||||
InputManager *getInputManager() const;
|
||||
|
||||
float getFrameDuration() const;
|
||||
|
||||
|
|
44
apps/openmw/mwbase/inputmanager.hpp
Normal file
44
apps/openmw/mwbase/inputmanager.hpp
Normal file
|
@ -0,0 +1,44 @@
|
|||
#ifndef GAME_MWBASE_INPUTMANAGER_H
|
||||
#define GAME_MWBASE_INPUTMANAGER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
/// \brief Interface for input manager (implemented in MWInput)
|
||||
class InputManager
|
||||
{
|
||||
InputManager (const InputManager&);
|
||||
///< not implemented
|
||||
|
||||
InputManager& operator= (const InputManager&);
|
||||
///< not implemented
|
||||
|
||||
public:
|
||||
|
||||
InputManager() {}
|
||||
|
||||
virtual ~InputManager() {}
|
||||
|
||||
virtual void update(float dt) = 0;
|
||||
|
||||
virtual void changeInputMode(bool guiMode) = 0;
|
||||
|
||||
virtual void processChangedSettings(const Settings::CategorySettingVector& changed) = 0;
|
||||
|
||||
virtual void setDragDrop(bool dragDrop) = 0;
|
||||
|
||||
virtual void toggleControlSwitch (const std::string& sw, bool value) = 0;
|
||||
|
||||
virtual std::string getActionDescription (int action) = 0;
|
||||
virtual std::string getActionBindingName (int action) = 0;
|
||||
virtual std::vector<int> getActionSorting () = 0;
|
||||
virtual int getNumActions() = 0;
|
||||
virtual void enableDetectingBindingMode (int action) = 0;
|
||||
virtual void resetToDefaultBindings() = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
77
apps/openmw/mwbase/mechanicsmanager.hpp
Normal file
77
apps/openmw/mwbase/mechanicsmanager.hpp
Normal file
|
@ -0,0 +1,77 @@
|
|||
#ifndef GAME_MWBASE_MECHANICSMANAGER_H
|
||||
#define GAME_MWBASE_MECHANICSMANAGER_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Ogre
|
||||
{
|
||||
class Vector3;
|
||||
}
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
struct Class;
|
||||
}
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class Ptr;
|
||||
class CellStore;
|
||||
}
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
/// \brief Interface for game mechanics manager (implemented in MWMechanics)
|
||||
class MechanicsManager
|
||||
{
|
||||
MechanicsManager (const MechanicsManager&);
|
||||
///< not implemented
|
||||
|
||||
MechanicsManager& operator= (const MechanicsManager&);
|
||||
///< not implemented
|
||||
|
||||
public:
|
||||
|
||||
MechanicsManager() {}
|
||||
|
||||
virtual ~MechanicsManager() {}
|
||||
|
||||
virtual void addActor (const MWWorld::Ptr& ptr) = 0;
|
||||
///< Register an actor for stats management
|
||||
|
||||
virtual void removeActor (const MWWorld::Ptr& ptr) = 0;
|
||||
///< Deregister an actor for stats management
|
||||
|
||||
virtual void dropActors (const MWWorld::CellStore *cellStore) = 0;
|
||||
///< Deregister all actors in the given cell.
|
||||
|
||||
virtual void watchActor (const MWWorld::Ptr& ptr) = 0;
|
||||
///< On each update look for changes in a previously registered actor and update the
|
||||
/// GUI accordingly.
|
||||
|
||||
virtual void update (std::vector<std::pair<std::string, Ogre::Vector3> >& movement,
|
||||
float duration, bool paused) = 0;
|
||||
///< Update actor stats and store desired velocity vectors in \a movement
|
||||
///
|
||||
/// \param paused In game type does not currently advance (this usually means some GUI
|
||||
/// component is up).
|
||||
|
||||
virtual void setPlayerName (const std::string& name) = 0;
|
||||
///< Set player name.
|
||||
|
||||
virtual void setPlayerRace (const std::string& id, bool male) = 0;
|
||||
///< Set player race.
|
||||
|
||||
virtual void setPlayerBirthsign (const std::string& id) = 0;
|
||||
///< Set player birthsign.
|
||||
|
||||
virtual void setPlayerClass (const std::string& id) = 0;
|
||||
///< Set player class to stock class.
|
||||
|
||||
virtual void setPlayerClass (const ESM::Class& class_) = 0;
|
||||
///< Set player class to custom class.
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
214
apps/openmw/mwbase/windowmanager.hpp
Normal file
214
apps/openmw/mwbase/windowmanager.hpp
Normal file
|
@ -0,0 +1,214 @@
|
|||
#ifndef GAME_MWBASE_WINDOWMANAGER_H
|
||||
#define GAME_MWBASE_WINDOWMANAGER_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include "../mwmechanics/stat.hpp"
|
||||
|
||||
#include "../mwgui/mode.hpp"
|
||||
|
||||
namespace MyGUI
|
||||
{
|
||||
class Gui;
|
||||
class Widget;
|
||||
class UString;
|
||||
}
|
||||
|
||||
namespace OEngine
|
||||
{
|
||||
namespace GUI
|
||||
{
|
||||
class Layout;
|
||||
}
|
||||
}
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
struct Class;
|
||||
}
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class CellStore;
|
||||
class Ptr;
|
||||
}
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class Console;
|
||||
class SpellWindow;
|
||||
class TradeWindow;
|
||||
class ConfirmationDialog;
|
||||
class CountDialog;
|
||||
class ScrollWindow;
|
||||
class BookWindow;
|
||||
class InventoryWindow;
|
||||
class ContainerWindow;
|
||||
class DialogueWindow;
|
||||
}
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
/// \brief Interface for widnow manager (implemented in MWGui)
|
||||
class WindowManager
|
||||
{
|
||||
WindowManager (const WindowManager&);
|
||||
///< not implemented
|
||||
|
||||
WindowManager& operator= (const WindowManager&);
|
||||
///< not implemented
|
||||
|
||||
public:
|
||||
|
||||
typedef std::vector<int> SkillList;
|
||||
|
||||
WindowManager() {}
|
||||
|
||||
virtual ~WindowManager() {}
|
||||
|
||||
/**
|
||||
* Should be called each frame to update windows/gui elements.
|
||||
* This could mean updating sizes of gui elements or opening
|
||||
* new dialogs.
|
||||
*/
|
||||
virtual void update() = 0;
|
||||
|
||||
virtual void pushGuiMode (MWGui::GuiMode mode) = 0;
|
||||
virtual void popGuiMode() = 0;
|
||||
|
||||
virtual void removeGuiMode (MWGui::GuiMode mode) = 0;
|
||||
///< can be anywhere in the stack
|
||||
|
||||
virtual MWGui::GuiMode getMode() const = 0;
|
||||
|
||||
virtual bool isGuiMode() const = 0;
|
||||
|
||||
virtual void toggleVisible (MWGui::GuiWindow wnd) = 0;
|
||||
|
||||
/// Disallow all inventory mode windows
|
||||
virtual void disallowAll() = 0;
|
||||
|
||||
/// Allow one or more windows
|
||||
virtual void allow (MWGui::GuiWindow wnd) = 0;
|
||||
|
||||
virtual bool isAllowed (MWGui::GuiWindow wnd) const = 0;
|
||||
|
||||
/// \todo investigate, if we really need to expose every single lousy UI element to the outside world
|
||||
virtual MWGui::DialogueWindow* getDialogueWindow() = 0;
|
||||
virtual MWGui::ContainerWindow* getContainerWindow() = 0;
|
||||
virtual MWGui::InventoryWindow* getInventoryWindow() = 0;
|
||||
virtual MWGui::BookWindow* getBookWindow() = 0;
|
||||
virtual MWGui::ScrollWindow* getScrollWindow() = 0;
|
||||
virtual MWGui::CountDialog* getCountDialog() = 0;
|
||||
virtual MWGui::ConfirmationDialog* getConfirmationDialog() = 0;
|
||||
virtual MWGui::TradeWindow* getTradeWindow() = 0;
|
||||
virtual MWGui::SpellWindow* getSpellWindow() = 0;
|
||||
virtual MWGui::Console* getConsole() = 0;
|
||||
|
||||
virtual MyGUI::Gui* getGui() const = 0;
|
||||
|
||||
virtual void wmUpdateFps(float fps, unsigned int triangleCount, unsigned int batchCount) = 0;
|
||||
|
||||
/// Set value for the given ID.
|
||||
virtual void setValue (const std::string& id, const MWMechanics::Stat<int>& value) = 0;
|
||||
virtual void setValue (int parSkill, const MWMechanics::Stat<float>& value) = 0;
|
||||
virtual void setValue (const std::string& id, const MWMechanics::DynamicStat<int>& value) = 0;
|
||||
virtual void setValue (const std::string& id, const std::string& value) = 0;
|
||||
virtual void setValue (const std::string& id, int value) = 0;
|
||||
|
||||
virtual void setPlayerClass (const ESM::Class &class_) = 0;
|
||||
///< set current class of player
|
||||
|
||||
virtual void configureSkills (const SkillList& major, const SkillList& minor) = 0;
|
||||
///< configure skill groups, each set contains the skill ID for that group.
|
||||
|
||||
virtual void setReputation (int reputation) = 0;
|
||||
///< set the current reputation value
|
||||
|
||||
virtual void setBounty (int bounty) = 0;
|
||||
///< set the current bounty value
|
||||
|
||||
virtual void updateSkillArea() = 0;
|
||||
///< update display of skills, factions, birth sign, reputation and bounty
|
||||
|
||||
virtual void changeCell(MWWorld::CellStore* cell) = 0;
|
||||
///< change the active cell
|
||||
|
||||
virtual void setPlayerPos(const float x, const float y) = 0;
|
||||
///< set player position in map space
|
||||
|
||||
virtual void setPlayerDir(const float x, const float y) = 0;
|
||||
///< set player view direction in map space
|
||||
|
||||
virtual void setFocusObject(const MWWorld::Ptr& focus) = 0;
|
||||
virtual void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y) = 0;
|
||||
|
||||
virtual void setMouseVisible(bool visible) = 0;
|
||||
virtual void getMousePosition(int &x, int &y) = 0;
|
||||
virtual void getMousePosition(float &x, float &y) = 0;
|
||||
virtual void setDragDrop(bool dragDrop) = 0;
|
||||
virtual bool getWorldMouseOver() = 0;
|
||||
|
||||
virtual void toggleFogOfWar() = 0;
|
||||
|
||||
virtual void toggleFullHelp() = 0;
|
||||
///< show extra info in item tooltips (owner, script)
|
||||
|
||||
virtual bool getFullHelp() const = 0;
|
||||
|
||||
virtual void setInteriorMapTexture(const int x, const int y) = 0;
|
||||
///< set the index of the map texture that should be used (for interiors)
|
||||
|
||||
/// sets the visibility of the hud health/magicka/stamina bars
|
||||
virtual void setHMSVisibility(bool visible) = 0;
|
||||
|
||||
/// sets the visibility of the hud minimap
|
||||
virtual void setMinimapVisibility(bool visible) = 0;
|
||||
virtual void setWeaponVisibility(bool visible) = 0;
|
||||
virtual void setSpellVisibility(bool visible) = 0;
|
||||
|
||||
virtual void setSelectedSpell(const std::string& spellId, int successChancePercent) = 0;
|
||||
virtual void setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent) = 0;
|
||||
virtual void setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent) = 0;
|
||||
virtual void unsetSelectedSpell() = 0;
|
||||
virtual void unsetSelectedWeapon() = 0;
|
||||
|
||||
virtual void disallowMouse() = 0;
|
||||
virtual void allowMouse() = 0;
|
||||
virtual void notifyInputActionBound() = 0;
|
||||
|
||||
virtual void removeDialog(OEngine::GUI::Layout* dialog) = 0;
|
||||
///< Hides dialog and schedules dialog to be deleted.
|
||||
|
||||
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons) = 0;
|
||||
virtual int readPressedButton() = 0;
|
||||
///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
||||
|
||||
virtual void onFrame (float frameDuration) = 0;
|
||||
|
||||
/// \todo get rid of this stuff. Move it to the respective UI element classes, if needed.
|
||||
virtual std::map<int, MWMechanics::Stat<float> > getPlayerSkillValues() = 0;
|
||||
virtual std::map<int, MWMechanics::Stat<int> > getPlayerAttributeValues() = 0;
|
||||
virtual SkillList getPlayerMinorSkills() = 0;
|
||||
virtual SkillList getPlayerMajorSkills() = 0;
|
||||
|
||||
/**
|
||||
* Fetches a GMST string from the store, if there is no setting with the given
|
||||
* ID or it is not a string the default string is returned.
|
||||
*
|
||||
* @param id Identifier for the GMST setting, e.g. "aName"
|
||||
* @param default Default value if the GMST setting cannot be used.
|
||||
*/
|
||||
virtual const std::string &getGameSettingString(const std::string &id, const std::string &default_) = 0;
|
||||
|
||||
virtual void processChangedSettings(const Settings::CategorySettingVector& changed) = 0;
|
||||
|
||||
virtual void executeInConsole (const std::string& path) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -4,6 +4,7 @@
|
|||
#include <components/esm/loadacti.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld//cellstore.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
@ -12,7 +13,6 @@
|
|||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
namespace MWClass
|
||||
|
@ -34,7 +34,7 @@ namespace MWClass
|
|||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string Activator::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Activator> *ref =
|
||||
|
@ -104,4 +104,3 @@ namespace MWClass
|
|||
return MWWorld::Ptr(&cell.activators.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
|
@ -16,7 +17,6 @@
|
|||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
namespace MWClass
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
|
@ -19,7 +20,6 @@
|
|||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
namespace MWClass
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actionread.hpp"
|
||||
|
@ -15,7 +16,6 @@
|
|||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
namespace MWClass
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
|
@ -15,7 +16,6 @@
|
|||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/nullaction.hpp"
|
||||
|
@ -15,7 +16,6 @@
|
|||
#include "../mwworld/actionopen.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
|
|
@ -4,10 +4,11 @@
|
|||
#include <components/esm/loadcrea.hpp>
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||
#include "../mwmechanics/magiceffects.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontalk.hpp"
|
||||
|
@ -17,7 +18,6 @@
|
|||
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
namespace
|
||||
|
@ -104,7 +104,7 @@ namespace MWClass
|
|||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
return "";
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Creature::getName (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
@ -14,7 +15,6 @@
|
|||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
|
@ -15,7 +16,6 @@
|
|||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
|
@ -14,7 +15,6 @@
|
|||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
|
@ -15,7 +16,6 @@
|
|||
#include "../mwworld/physicssystem.hpp"
|
||||
#include "../mwworld/manualref.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
|
|
@ -11,11 +11,12 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/movement.hpp"
|
||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontalk.hpp"
|
||||
|
@ -26,7 +27,6 @@
|
|||
#include "../mwrender/actors.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
namespace
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
|
@ -14,7 +15,6 @@
|
|||
#include "../mwworld/physicssystem.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
|
@ -14,7 +15,6 @@
|
|||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
|
@ -14,7 +15,6 @@
|
|||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
|
|
@ -13,30 +13,28 @@
|
|||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/scriptmanager.hpp"
|
||||
#include "../mwbase/journal.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/refdata.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
#include "../mwgui/dialogue.hpp"
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "../mwscript/extensions.hpp"
|
||||
|
||||
#include <components/compiler/exception.hpp>
|
||||
#include <components/compiler/errorhandler.hpp>
|
||||
#include <components/compiler/scanner.hpp>
|
||||
#include <components/compiler/locals.hpp>
|
||||
#include <components/compiler/output.hpp>
|
||||
#include <components/compiler/scriptparser.hpp>
|
||||
#include <components/interpreter/interpreter.hpp>
|
||||
|
||||
#include "../mwscript/compilercontext.hpp"
|
||||
#include "../mwscript/interpretercontext.hpp"
|
||||
#include <components/compiler/scriptparser.hpp>
|
||||
#include "../mwscript/extensions.hpp"
|
||||
|
||||
#include "../mwclass/npc.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef GAME_MWDIALOG_DIALOGUEMANAGERIMP_H
|
||||
#define GAME_MWDIALOG_DIALOGUEMANAGERIMP_H
|
||||
|
||||
#include "../mwbase/dialoguemanager.hpp"
|
||||
|
||||
#include <components/esm/loadinfo.hpp>
|
||||
|
||||
#include <components/compiler/streamerrorhandler.hpp>
|
||||
|
@ -8,8 +10,6 @@
|
|||
#include "../mwscript/interpretercontext.hpp"
|
||||
#include <components/compiler/output.hpp>
|
||||
|
||||
#include "../mwbase/dialoguemanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
||||
#include <map>
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
|
||||
#include "journalimp.hpp"
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/messagebox.hpp"
|
||||
|
||||
namespace MWDialogue
|
||||
|
|
|
@ -5,13 +5,12 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/manualref.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
||||
#include "window_manager.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
std::string getIconPath(MWWorld::Ptr ptr)
|
||||
|
@ -27,7 +26,7 @@ namespace
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
AlchemyWindow::AlchemyWindow(WindowManager& parWindowManager)
|
||||
AlchemyWindow::AlchemyWindow(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_alchemy_window.layout", parWindowManager)
|
||||
, ContainerBase(0)
|
||||
{
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace MWGui
|
|||
class AlchemyWindow : public WindowBase, public ContainerBase
|
||||
{
|
||||
public:
|
||||
AlchemyWindow(WindowManager& parWindowManager);
|
||||
AlchemyWindow(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
virtual void open();
|
||||
|
||||
|
|
|
@ -1,15 +1,20 @@
|
|||
#include "birth.hpp"
|
||||
#include "window_manager.hpp"
|
||||
#include "widgets.hpp"
|
||||
#include "components/esm_store/store.hpp"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "components/esm_store/store.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "widgets.hpp"
|
||||
|
||||
using namespace MWGui;
|
||||
using namespace Widgets;
|
||||
|
||||
BirthDialog::BirthDialog(WindowManager& parWindowManager)
|
||||
BirthDialog::BirthDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_birth.layout", parWindowManager)
|
||||
{
|
||||
// Centre dialog
|
||||
|
@ -114,7 +119,7 @@ void BirthDialog::updateBirths()
|
|||
{
|
||||
mBirthList->removeAllItems();
|
||||
|
||||
const ESMS::ESMStore &store = mWindowManager.getStore();
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
ESMS::RecListT<ESM::BirthSign>::MapType::const_iterator it = store.birthSigns.list.begin();
|
||||
ESMS::RecListT<ESM::BirthSign>::MapType::const_iterator end = store.birthSigns.list.end();
|
||||
|
@ -144,7 +149,7 @@ void BirthDialog::updateSpells()
|
|||
const int lineHeight = 18;
|
||||
MyGUI::IntCoord coord(0, 0, mSpellArea->getWidth(), 18);
|
||||
|
||||
const ESMS::ESMStore &store = mWindowManager.getStore();
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::BirthSign *birth = store.birthSigns.find(mCurrentBirthId);
|
||||
|
||||
std::string texturePath = std::string("textures\\") + birth->texture;
|
||||
|
|
|
@ -10,14 +10,13 @@
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
/// \todo remove
|
||||
using namespace MyGUI;
|
||||
|
||||
class WindowManager;
|
||||
|
||||
class BirthDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
BirthDialog(WindowManager& parWindowManager);
|
||||
BirthDialog(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
enum Gender
|
||||
{
|
||||
|
|
|
@ -5,18 +5,16 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "formatting.hpp"
|
||||
#include "window_manager.hpp"
|
||||
|
||||
using namespace MWGui;
|
||||
|
||||
BookWindow::BookWindow (WindowManager& parWindowManager) :
|
||||
BookWindow::BookWindow (MWBase::WindowManager& parWindowManager) :
|
||||
WindowBase("openmw_book.layout", parWindowManager)
|
||||
{
|
||||
getWidget(mCloseButton, "CloseButton");
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace MWGui
|
|||
class BookWindow : public WindowBase
|
||||
{
|
||||
public:
|
||||
BookWindow(WindowManager& parWindowManager);
|
||||
BookWindow(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
void open(MWWorld::Ptr book);
|
||||
void setTakeButtonShow(bool show);
|
||||
|
@ -43,4 +43,3 @@ namespace MWGui
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -103,11 +104,19 @@ namespace
|
|||
{ESM::Class::Combat, ESM::Class::Magic, ESM::Class::Stealth}
|
||||
}
|
||||
} };
|
||||
|
||||
struct ClassPoint
|
||||
{
|
||||
const char *id;
|
||||
// Specialization points to match, in order: Stealth, Combat, Magic
|
||||
// Note: Order is taken from http://www.uesp.net/wiki/Morrowind:Class_Quiz
|
||||
unsigned int points[3];
|
||||
};
|
||||
}
|
||||
|
||||
using namespace MWGui;
|
||||
|
||||
CharacterCreation::CharacterCreation(WindowManager* _wm)
|
||||
CharacterCreation::CharacterCreation(MWBase::WindowManager* _wm)
|
||||
: mNameDialog(0)
|
||||
, mRaceDialog(0)
|
||||
, mClassChoiceDialog(0)
|
||||
|
@ -178,8 +187,8 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
switch (id)
|
||||
{
|
||||
case GM_Name:
|
||||
if(mNameDialog)
|
||||
mWM->removeDialog(mNameDialog);
|
||||
mWM->removeDialog(mNameDialog);
|
||||
mNameDialog = 0;
|
||||
mNameDialog = new TextInputDialog(*mWM);
|
||||
mNameDialog->setTextLabel(mWM->getGameSettingString("sName", "Name"));
|
||||
mNameDialog->setTextInput(mPlayerName);
|
||||
|
@ -189,8 +198,8 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
break;
|
||||
|
||||
case GM_Race:
|
||||
if (mRaceDialog)
|
||||
mWM->removeDialog(mRaceDialog);
|
||||
mWM->removeDialog(mRaceDialog);
|
||||
mRaceDialog = 0;
|
||||
mRaceDialog = new RaceDialog(*mWM);
|
||||
mRaceDialog->setNextButtonShow(mCreationStage >= CSE_RaceChosen);
|
||||
mRaceDialog->setRaceId(mPlayerRaceId);
|
||||
|
@ -200,16 +209,16 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
break;
|
||||
|
||||
case GM_Class:
|
||||
if (mClassChoiceDialog)
|
||||
mWM->removeDialog(mClassChoiceDialog);
|
||||
mWM->removeDialog(mClassChoiceDialog);
|
||||
mClassChoiceDialog = 0;
|
||||
mClassChoiceDialog = new ClassChoiceDialog(*mWM);
|
||||
mClassChoiceDialog->eventButtonSelected += MyGUI::newDelegate(this, &CharacterCreation::onClassChoice);
|
||||
mClassChoiceDialog->open();
|
||||
break;
|
||||
|
||||
case GM_ClassPick:
|
||||
if (mPickClassDialog)
|
||||
mWM->removeDialog(mPickClassDialog);
|
||||
mWM->removeDialog(mPickClassDialog);
|
||||
mPickClassDialog = 0;
|
||||
mPickClassDialog = new PickClassDialog(*mWM);
|
||||
mPickClassDialog->setNextButtonShow(mCreationStage >= CSE_ClassChosen);
|
||||
mPickClassDialog->setClassId(mPlayerClass.name);
|
||||
|
@ -219,8 +228,8 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
break;
|
||||
|
||||
case GM_Birth:
|
||||
if (mBirthSignDialog)
|
||||
mWM->removeDialog(mBirthSignDialog);
|
||||
mWM->removeDialog(mBirthSignDialog);
|
||||
mBirthSignDialog = 0;
|
||||
mBirthSignDialog = new BirthDialog(*mWM);
|
||||
mBirthSignDialog->setNextButtonShow(mCreationStage >= CSE_BirthSignChosen);
|
||||
mBirthSignDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogDone);
|
||||
|
@ -229,8 +238,8 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
break;
|
||||
|
||||
case GM_ClassCreate:
|
||||
if (mCreateClassDialog)
|
||||
mWM->removeDialog(mCreateClassDialog);
|
||||
mWM->removeDialog(mCreateClassDialog);
|
||||
mCreateClassDialog = 0;
|
||||
mCreateClassDialog = new CreateClassDialog(*mWM);
|
||||
mCreateClassDialog->setNextButtonShow(mCreationStage >= CSE_ClassChosen);
|
||||
mCreateClassDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onCreateClassDialogDone);
|
||||
|
@ -246,8 +255,8 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
showClassQuestionDialog();
|
||||
break;
|
||||
case GM_Review:
|
||||
if (mReviewDialog)
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mReviewDialog = 0;
|
||||
mReviewDialog = new ReviewDialog(*mWM);
|
||||
mReviewDialog->setPlayerName(mPlayerName);
|
||||
mReviewDialog->setRace(mPlayerRaceId);
|
||||
|
@ -259,20 +268,20 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
mReviewDialog->setFatigue(mPlayerFatigue);
|
||||
|
||||
{
|
||||
std::map<ESM::Attribute::AttributeID, MWMechanics::Stat<int> > attributes = mWM->getPlayerAttributeValues();
|
||||
for (std::map<ESM::Attribute::AttributeID, MWMechanics::Stat<int> >::iterator it = attributes.begin();
|
||||
std::map<int, MWMechanics::Stat<int> > attributes = mWM->getPlayerAttributeValues();
|
||||
for (std::map<int, MWMechanics::Stat<int> >::iterator it = attributes.begin();
|
||||
it != attributes.end(); ++it)
|
||||
{
|
||||
mReviewDialog->setAttribute(it->first, it->second);
|
||||
mReviewDialog->setAttribute(static_cast<ESM::Attribute::AttributeID> (it->first), it->second);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
std::map<ESM::Skill::SkillEnum, MWMechanics::Stat<float> > skills = mWM->getPlayerSkillValues();
|
||||
for (std::map<ESM::Skill::SkillEnum, MWMechanics::Stat<float> >::iterator it = skills.begin();
|
||||
std::map<int, MWMechanics::Stat<float> > skills = mWM->getPlayerSkillValues();
|
||||
for (std::map<int, MWMechanics::Stat<float> >::iterator it = skills.begin();
|
||||
it != skills.end(); ++it)
|
||||
{
|
||||
mReviewDialog->setSkillValue(it->first, it->second);
|
||||
mReviewDialog->setSkillValue(static_cast<ESM::Skill::SkillEnum> (it->first), it->second);
|
||||
}
|
||||
mReviewDialog->configureSkills(mWM->getPlayerMajorSkills(), mWM->getPlayerMinorSkills());
|
||||
}
|
||||
|
@ -302,24 +311,24 @@ void CharacterCreation::setPlayerFatigue (const MWMechanics::DynamicStat<int>& v
|
|||
|
||||
void CharacterCreation::onReviewDialogDone(WindowBase* parWindow)
|
||||
{
|
||||
if (mReviewDialog)
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mReviewDialog = 0;
|
||||
|
||||
mWM->popGuiMode();
|
||||
}
|
||||
|
||||
void CharacterCreation::onReviewDialogBack()
|
||||
{
|
||||
if (mReviewDialog)
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mReviewDialog = 0;
|
||||
|
||||
mWM->pushGuiMode(GM_Birth);
|
||||
}
|
||||
|
||||
void CharacterCreation::onReviewActivateDialog(int parDialog)
|
||||
{
|
||||
if (mReviewDialog)
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mReviewDialog = 0;
|
||||
mCreationStage = CSE_ReviewNext;
|
||||
|
||||
mWM->popGuiMode();
|
||||
|
@ -354,6 +363,7 @@ void CharacterCreation::onPickClassDialogDone(WindowBase* parWindow)
|
|||
mWM->setPlayerClass(mPlayerClass);
|
||||
}
|
||||
mWM->removeDialog(mPickClassDialog);
|
||||
mPickClassDialog = 0;
|
||||
}
|
||||
|
||||
//TODO This bit gets repeated a few times; wrap it in a function
|
||||
|
@ -382,6 +392,7 @@ void CharacterCreation::onPickClassDialogBack()
|
|||
if (!classId.empty())
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(classId);
|
||||
mWM->removeDialog(mPickClassDialog);
|
||||
mPickClassDialog = 0;
|
||||
}
|
||||
|
||||
mWM->popGuiMode();
|
||||
|
@ -390,10 +401,8 @@ void CharacterCreation::onPickClassDialogBack()
|
|||
|
||||
void CharacterCreation::onClassChoice(int _index)
|
||||
{
|
||||
if (mClassChoiceDialog)
|
||||
{
|
||||
mWM->removeDialog(mClassChoiceDialog);
|
||||
}
|
||||
mWM->removeDialog(mClassChoiceDialog);
|
||||
mClassChoiceDialog = 0;
|
||||
|
||||
mWM->popGuiMode();
|
||||
|
||||
|
@ -423,6 +432,7 @@ void CharacterCreation::onNameDialogDone(WindowBase* parWindow)
|
|||
mWM->setValue("name", mPlayerName);
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerName(mPlayerName);
|
||||
mWM->removeDialog(mNameDialog);
|
||||
mNameDialog = 0;
|
||||
}
|
||||
|
||||
if (mCreationStage == CSE_ReviewNext)
|
||||
|
@ -450,6 +460,7 @@ void CharacterCreation::onRaceDialogBack()
|
|||
if (!mPlayerRaceId.empty())
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerRace(mPlayerRaceId, mRaceDialog->getGender() == RaceDialog::GM_Male);
|
||||
mWM->removeDialog(mRaceDialog);
|
||||
mRaceDialog = 0;
|
||||
}
|
||||
|
||||
mWM->popGuiMode();
|
||||
|
@ -465,6 +476,7 @@ void CharacterCreation::onRaceDialogDone(WindowBase* parWindow)
|
|||
if (!mPlayerRaceId.empty())
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerRace(mPlayerRaceId, mRaceDialog->getGender() == RaceDialog::GM_Male);
|
||||
mWM->removeDialog(mRaceDialog);
|
||||
mRaceDialog = 0;
|
||||
}
|
||||
|
||||
if (mCreationStage == CSE_ReviewNext)
|
||||
|
@ -492,6 +504,7 @@ void CharacterCreation::onBirthSignDialogDone(WindowBase* parWindow)
|
|||
if (!mPlayerBirthSignId.empty())
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerBirthsign(mPlayerBirthSignId);
|
||||
mWM->removeDialog(mBirthSignDialog);
|
||||
mBirthSignDialog = 0;
|
||||
}
|
||||
|
||||
if (mCreationStage >= CSE_BirthSignChosen)
|
||||
|
@ -512,6 +525,7 @@ void CharacterCreation::onBirthSignDialogBack()
|
|||
{
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerBirthsign(mBirthSignDialog->getBirthId());
|
||||
mWM->removeDialog(mBirthSignDialog);
|
||||
mBirthSignDialog = 0;
|
||||
}
|
||||
|
||||
mWM->popGuiMode();
|
||||
|
@ -547,6 +561,7 @@ void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow)
|
|||
mWM->setPlayerClass(klass);
|
||||
|
||||
mWM->removeDialog(mCreateClassDialog);
|
||||
mCreateClassDialog = 0;
|
||||
}
|
||||
|
||||
if (mCreationStage == CSE_ReviewNext)
|
||||
|
@ -568,8 +583,8 @@ void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow)
|
|||
|
||||
void CharacterCreation::onCreateClassDialogBack()
|
||||
{
|
||||
if (mCreateClassDialog)
|
||||
mWM->removeDialog(mCreateClassDialog);
|
||||
mWM->removeDialog(mCreateClassDialog);
|
||||
mCreateClassDialog = 0;
|
||||
|
||||
mWM->popGuiMode();
|
||||
mWM->pushGuiMode(GM_Class);
|
||||
|
@ -579,8 +594,9 @@ void CharacterCreation::onClassQuestionChosen(int _index)
|
|||
{
|
||||
MWBase::Environment::get().getSoundManager()->stopSay();
|
||||
|
||||
if (mGenerateClassQuestionDialog)
|
||||
mWM->removeDialog(mGenerateClassQuestionDialog);
|
||||
mWM->removeDialog(mGenerateClassQuestionDialog);
|
||||
mGenerateClassQuestionDialog = 0;
|
||||
|
||||
if (_index < 0 || _index >= 3)
|
||||
{
|
||||
mWM->popGuiMode();
|
||||
|
@ -657,8 +673,9 @@ void CharacterCreation::showClassQuestionDialog()
|
|||
}
|
||||
}
|
||||
|
||||
if (mGenerateClassResultDialog)
|
||||
mWM->removeDialog(mGenerateClassResultDialog);
|
||||
mWM->removeDialog(mGenerateClassResultDialog);
|
||||
mGenerateClassResultDialog = 0;
|
||||
|
||||
mGenerateClassResultDialog = new GenerateClassResultDialog(*mWM);
|
||||
mGenerateClassResultDialog->setClassId(mGenerateClass);
|
||||
mGenerateClassResultDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onGenerateClassBack);
|
||||
|
@ -674,8 +691,9 @@ void CharacterCreation::showClassQuestionDialog()
|
|||
return;
|
||||
}
|
||||
|
||||
if (mGenerateClassQuestionDialog)
|
||||
mWM->removeDialog(mGenerateClassQuestionDialog);
|
||||
mWM->removeDialog(mGenerateClassQuestionDialog);
|
||||
mGenerateClassQuestionDialog = 0;
|
||||
|
||||
mGenerateClassQuestionDialog = new InfoBoxDialog(*mWM);
|
||||
|
||||
InfoBoxDialog::ButtonList buttons;
|
||||
|
@ -695,8 +713,9 @@ void CharacterCreation::onGenerateClassBack()
|
|||
if(mCreationStage < CSE_ClassChosen)
|
||||
mCreationStage = CSE_ClassChosen;
|
||||
|
||||
if (mGenerateClassResultDialog)
|
||||
mWM->removeDialog(mGenerateClassResultDialog);
|
||||
mWM->removeDialog(mGenerateClassResultDialog);
|
||||
mGenerateClassResultDialog = 0;
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass);
|
||||
|
||||
mWM->popGuiMode();
|
||||
|
@ -705,8 +724,9 @@ void CharacterCreation::onGenerateClassBack()
|
|||
|
||||
void CharacterCreation::onGenerateClassDone(WindowBase* parWindow)
|
||||
{
|
||||
if (mGenerateClassResultDialog)
|
||||
mWM->removeDialog(mGenerateClassResultDialog);
|
||||
mWM->removeDialog(mGenerateClassResultDialog);
|
||||
mGenerateClassResultDialog = 0;
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass);
|
||||
const ESM::Class *klass = MWBase::Environment::get().getWorld()->getStore().classes.find(mGenerateClass);
|
||||
mPlayerClass = *klass;
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
#ifndef CHARACTER_CREATION_HPP
|
||||
#define CHARACTER_CREATION_HPP
|
||||
|
||||
#include "window_manager.hpp"
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||
#include "../mwmechanics/stat.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class WindowManager;
|
||||
class WindowBase;
|
||||
|
||||
class TextInputDialog;
|
||||
|
@ -32,7 +29,7 @@ namespace MWGui
|
|||
public:
|
||||
typedef std::vector<int> SkillList;
|
||||
|
||||
CharacterCreation(WindowManager* _wm);
|
||||
CharacterCreation(MWBase::WindowManager* _wm);
|
||||
~CharacterCreation();
|
||||
|
||||
//Show a dialog
|
||||
|
@ -61,7 +58,7 @@ namespace MWGui
|
|||
BirthDialog* mBirthSignDialog;
|
||||
ReviewDialog* mReviewDialog;
|
||||
|
||||
WindowManager* mWM;
|
||||
MWBase::WindowManager* mWM;
|
||||
|
||||
//Player data
|
||||
std::string mPlayerName;
|
||||
|
|
|
@ -7,7 +7,10 @@
|
|||
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "window_manager.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "tooltips.hpp"
|
||||
|
||||
#undef min
|
||||
|
@ -17,7 +20,7 @@ using namespace MWGui;
|
|||
|
||||
/* GenerateClassResultDialog */
|
||||
|
||||
GenerateClassResultDialog::GenerateClassResultDialog(WindowManager& parWindowManager)
|
||||
GenerateClassResultDialog::GenerateClassResultDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_generate_class_result.layout", parWindowManager)
|
||||
{
|
||||
// Centre dialog
|
||||
|
@ -57,8 +60,7 @@ void GenerateClassResultDialog::setClassId(const std::string &classId)
|
|||
{
|
||||
mCurrentClassId = classId;
|
||||
mClassImage->setImageTexture(std::string("textures\\levelup\\") + mCurrentClassId + ".dds");
|
||||
const ESMS::ESMStore &store = mWindowManager.getStore();
|
||||
mClassName->setCaption(store.classes.find(mCurrentClassId)->name);
|
||||
mClassName->setCaption(MWBase::Environment::get().getWorld()->getStore().classes.find(mCurrentClassId)->name);
|
||||
}
|
||||
|
||||
// widget controls
|
||||
|
@ -75,7 +77,7 @@ void GenerateClassResultDialog::onBackClicked(MyGUI::Widget* _sender)
|
|||
|
||||
/* PickClassDialog */
|
||||
|
||||
PickClassDialog::PickClassDialog(WindowManager& parWindowManager)
|
||||
PickClassDialog::PickClassDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_class.layout", parWindowManager)
|
||||
{
|
||||
// Centre dialog
|
||||
|
@ -193,7 +195,7 @@ void PickClassDialog::updateClasses()
|
|||
{
|
||||
mClassList->removeAllItems();
|
||||
|
||||
const ESMS::ESMStore &store = mWindowManager.getStore();
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
ESMS::RecListT<ESM::Class>::MapType::const_iterator it = store.classes.list.begin();
|
||||
ESMS::RecListT<ESM::Class>::MapType::const_iterator end = store.classes.list.end();
|
||||
|
@ -217,7 +219,7 @@ void PickClassDialog::updateStats()
|
|||
{
|
||||
if (mCurrentClassId.empty())
|
||||
return;
|
||||
const ESMS::ESMStore &store = mWindowManager.getStore();
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Class *klass = store.classes.search(mCurrentClassId);
|
||||
if (!klass)
|
||||
return;
|
||||
|
@ -281,7 +283,7 @@ void InfoBoxDialog::layoutVertically(MyGUI::WidgetPtr widget, int margin)
|
|||
widget->setSize(width, pos);
|
||||
}
|
||||
|
||||
InfoBoxDialog::InfoBoxDialog(WindowManager& parWindowManager)
|
||||
InfoBoxDialog::InfoBoxDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_infobox.layout", parWindowManager)
|
||||
, mCurrentButton(-1)
|
||||
{
|
||||
|
@ -365,7 +367,7 @@ void InfoBoxDialog::onButtonClicked(MyGUI::WidgetPtr _sender)
|
|||
|
||||
/* ClassChoiceDialog */
|
||||
|
||||
ClassChoiceDialog::ClassChoiceDialog(WindowManager& parWindowManager)
|
||||
ClassChoiceDialog::ClassChoiceDialog(MWBase::WindowManager& parWindowManager)
|
||||
: InfoBoxDialog(parWindowManager)
|
||||
{
|
||||
setText("");
|
||||
|
@ -379,7 +381,7 @@ ClassChoiceDialog::ClassChoiceDialog(WindowManager& parWindowManager)
|
|||
|
||||
/* CreateClassDialog */
|
||||
|
||||
CreateClassDialog::CreateClassDialog(WindowManager& parWindowManager)
|
||||
CreateClassDialog::CreateClassDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_create_class.layout", parWindowManager)
|
||||
, mSpecDialog(nullptr)
|
||||
, mAttribDialog(nullptr)
|
||||
|
@ -556,26 +558,17 @@ void CreateClassDialog::open()
|
|||
|
||||
void CreateClassDialog::onDialogCancel()
|
||||
{
|
||||
if (mSpecDialog)
|
||||
{
|
||||
mWindowManager.removeDialog(mSpecDialog);
|
||||
mSpecDialog = 0;
|
||||
}
|
||||
if (mAttribDialog)
|
||||
{
|
||||
mWindowManager.removeDialog(mAttribDialog);
|
||||
mAttribDialog = 0;
|
||||
}
|
||||
if (mSkillDialog)
|
||||
{
|
||||
mWindowManager.removeDialog(mSkillDialog);
|
||||
mSkillDialog = 0;
|
||||
}
|
||||
if (mDescDialog)
|
||||
{
|
||||
mWindowManager.removeDialog(mDescDialog);
|
||||
mDescDialog = 0;
|
||||
}
|
||||
mWindowManager.removeDialog(mSpecDialog);
|
||||
mSpecDialog = 0;
|
||||
|
||||
mWindowManager.removeDialog(mAttribDialog);
|
||||
mAttribDialog = 0;
|
||||
|
||||
mWindowManager.removeDialog(mSkillDialog);
|
||||
mSkillDialog = 0;
|
||||
|
||||
mWindowManager.removeDialog(mDescDialog);
|
||||
mDescDialog = 0;
|
||||
}
|
||||
|
||||
void CreateClassDialog::onSpecializationClicked(MyGUI::WidgetPtr _sender)
|
||||
|
@ -701,7 +694,7 @@ void CreateClassDialog::onBackClicked(MyGUI::Widget* _sender)
|
|||
|
||||
/* SelectSpecializationDialog */
|
||||
|
||||
SelectSpecializationDialog::SelectSpecializationDialog(WindowManager& parWindowManager)
|
||||
SelectSpecializationDialog::SelectSpecializationDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_select_specialization.layout", parWindowManager)
|
||||
{
|
||||
// Centre dialog
|
||||
|
@ -766,7 +759,7 @@ void SelectSpecializationDialog::onCancelClicked(MyGUI::Widget* _sender)
|
|||
|
||||
/* SelectAttributeDialog */
|
||||
|
||||
SelectAttributeDialog::SelectAttributeDialog(WindowManager& parWindowManager)
|
||||
SelectAttributeDialog::SelectAttributeDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_select_attribute.layout", parWindowManager)
|
||||
{
|
||||
// Centre dialog
|
||||
|
@ -818,7 +811,7 @@ void SelectAttributeDialog::onCancelClicked(MyGUI::Widget* _sender)
|
|||
|
||||
/* SelectSkillDialog */
|
||||
|
||||
SelectSkillDialog::SelectSkillDialog(WindowManager& parWindowManager)
|
||||
SelectSkillDialog::SelectSkillDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_select_skill.layout", parWindowManager)
|
||||
{
|
||||
// Centre dialog
|
||||
|
@ -914,7 +907,7 @@ void SelectSkillDialog::onCancelClicked(MyGUI::Widget* _sender)
|
|||
|
||||
/* DescriptionDialog */
|
||||
|
||||
DescriptionDialog::DescriptionDialog(WindowManager& parWindowManager)
|
||||
DescriptionDialog::DescriptionDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_class_description.layout", parWindowManager)
|
||||
{
|
||||
// Centre dialog
|
||||
|
|
|
@ -12,14 +12,13 @@
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
/// \todo remove!
|
||||
using namespace MyGUI;
|
||||
|
||||
class WindowManager;
|
||||
|
||||
class InfoBoxDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
InfoBoxDialog(WindowManager& parWindowManager);
|
||||
InfoBoxDialog(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
typedef std::vector<std::string> ButtonList;
|
||||
|
||||
|
@ -64,13 +63,13 @@ namespace MWGui
|
|||
Class_Create = 2,
|
||||
Class_Back = 3
|
||||
};
|
||||
ClassChoiceDialog(WindowManager& parWindowManager);
|
||||
ClassChoiceDialog(MWBase::WindowManager& parWindowManager);
|
||||
};
|
||||
|
||||
class GenerateClassResultDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
GenerateClassResultDialog(WindowManager& parWindowManager);
|
||||
GenerateClassResultDialog(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
std::string getClassId() const;
|
||||
void setClassId(const std::string &classId);
|
||||
|
@ -99,7 +98,7 @@ namespace MWGui
|
|||
class PickClassDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
PickClassDialog(WindowManager& parWindowManager);
|
||||
PickClassDialog(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
const std::string &getClassId() const { return mCurrentClassId; }
|
||||
void setClassId(const std::string &classId);
|
||||
|
@ -138,7 +137,7 @@ namespace MWGui
|
|||
class SelectSpecializationDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
SelectSpecializationDialog(WindowManager& parWindowManager);
|
||||
SelectSpecializationDialog(MWBase::WindowManager& parWindowManager);
|
||||
~SelectSpecializationDialog();
|
||||
|
||||
ESM::Class::Specialization getSpecializationId() const { return mSpecializationId; }
|
||||
|
@ -169,7 +168,7 @@ namespace MWGui
|
|||
class SelectAttributeDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
SelectAttributeDialog(WindowManager& parWindowManager);
|
||||
SelectAttributeDialog(MWBase::WindowManager& parWindowManager);
|
||||
~SelectAttributeDialog();
|
||||
|
||||
ESM::Attribute::AttributeID getAttributeId() const { return mAttributeId; }
|
||||
|
@ -202,7 +201,7 @@ namespace MWGui
|
|||
class SelectSkillDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
SelectSkillDialog(WindowManager& parWindowManager);
|
||||
SelectSkillDialog(MWBase::WindowManager& parWindowManager);
|
||||
~SelectSkillDialog();
|
||||
|
||||
ESM::Skill::SkillEnum getSkillId() const { return mSkillId; }
|
||||
|
@ -238,7 +237,7 @@ namespace MWGui
|
|||
class DescriptionDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
DescriptionDialog(WindowManager& parWindowManager);
|
||||
DescriptionDialog(MWBase::WindowManager& parWindowManager);
|
||||
~DescriptionDialog();
|
||||
|
||||
std::string getTextInput() const { return mTextEdit ? mTextEdit->getOnlyText() : ""; }
|
||||
|
@ -254,7 +253,7 @@ namespace MWGui
|
|||
class CreateClassDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
CreateClassDialog(WindowManager& parWindowManager);
|
||||
CreateClassDialog(MWBase::WindowManager& parWindowManager);
|
||||
virtual ~CreateClassDialog();
|
||||
|
||||
std::string getName() const;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
ConfirmationDialog::ConfirmationDialog(WindowManager& parWindowManager) :
|
||||
ConfirmationDialog::ConfirmationDialog(MWBase::WindowManager& parWindowManager) :
|
||||
WindowBase("openmw_confirmation_dialog.layout", parWindowManager)
|
||||
{
|
||||
getWidget(mMessage, "Message");
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace MWGui
|
|||
class ConfirmationDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
ConfirmationDialog(WindowManager& parWindowManager);
|
||||
ConfirmationDialog(MWBase::WindowManager& parWindowManager);
|
||||
void open(const std::string& message);
|
||||
|
||||
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/manualref.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
@ -19,9 +20,6 @@
|
|||
|
||||
#include "../mwclass/container.hpp"
|
||||
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
|
||||
#include "window_manager.hpp"
|
||||
#include "widgets.hpp"
|
||||
#include "countdialog.hpp"
|
||||
#include "tradewindow.hpp"
|
||||
|
@ -593,7 +591,7 @@ MWWorld::ContainerStore& ContainerBase::getContainerStore()
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
ContainerWindow::ContainerWindow(WindowManager& parWindowManager,DragAndDrop* dragAndDrop)
|
||||
ContainerWindow::ContainerWindow(MWBase::WindowManager& parWindowManager,DragAndDrop* dragAndDrop)
|
||||
: ContainerBase(dragAndDrop)
|
||||
, WindowBase("openmw_container_window.layout", parWindowManager)
|
||||
{
|
||||
|
|
|
@ -127,7 +127,7 @@ namespace MWGui
|
|||
class ContainerWindow : public ContainerBase, public WindowBase
|
||||
{
|
||||
public:
|
||||
ContainerWindow(WindowManager& parWindowManager,DragAndDrop* dragAndDrop);
|
||||
ContainerWindow(MWBase::WindowManager& parWindowManager,DragAndDrop* dragAndDrop);
|
||||
|
||||
virtual ~ContainerWindow();
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
CountDialog::CountDialog(WindowManager& parWindowManager) :
|
||||
CountDialog::CountDialog(MWBase::WindowManager& parWindowManager) :
|
||||
WindowBase("openmw_count_window.layout", parWindowManager)
|
||||
{
|
||||
getWidget(mSlider, "CountSlider");
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace MWGui
|
|||
class CountDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
CountDialog(WindowManager& parWindowManager);
|
||||
CountDialog(MWBase::WindowManager& parWindowManager);
|
||||
void open(const std::string& item, const std::string& message, const int maxCount);
|
||||
|
||||
typedef MyGUI::delegates::CMultiDelegate2<MyGUI::Widget*, int> EventHandle_WidgetInt;
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/dialoguemanager.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "dialogue_history.hpp"
|
||||
#include "window_manager.hpp"
|
||||
#include "widgets.hpp"
|
||||
#include "list.hpp"
|
||||
#include "tradewindow.hpp"
|
||||
|
@ -42,7 +42,7 @@ std::string::size_type find_str_ci(const std::string& str, const std::string& su
|
|||
}
|
||||
|
||||
|
||||
DialogueWindow::DialogueWindow(WindowManager& parWindowManager)
|
||||
DialogueWindow::DialogueWindow(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_dialogue_window.layout", parWindowManager)
|
||||
, mEnabled(true)
|
||||
, mShowTrade(false)
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace MWGui
|
|||
class DialogueWindow: public WindowBase, public ReferenceInterface
|
||||
{
|
||||
public:
|
||||
DialogueWindow(WindowManager& parWindowManager);
|
||||
DialogueWindow(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
// Events
|
||||
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "dialogue_history.hpp"
|
||||
#include "window_manager.hpp"
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "widgets.hpp"
|
||||
#include "components/esm_store/store.hpp"
|
||||
|
||||
|
@ -71,4 +73,3 @@ void DialogueHistory::addDialogText(const UString& parText)
|
|||
addText(parText);
|
||||
addText("\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
@ -16,7 +17,6 @@
|
|||
#include "../mwgui/widgets.hpp"
|
||||
|
||||
#include "inventorywindow.hpp"
|
||||
#include "window_manager.hpp"
|
||||
#include "container.hpp"
|
||||
#include "console.hpp"
|
||||
|
||||
|
@ -237,6 +237,9 @@ void HUD::setBottomRightVisibility(bool effectBoxVisible, bool minimapBoxVisible
|
|||
|
||||
void HUD::onWorldClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
if (!MWBase::Environment::get().getWindowManager ()->isGuiMode ())
|
||||
return;
|
||||
|
||||
if (mDragAndDrop->mIsOnDragAndDrop)
|
||||
{
|
||||
// drop item into the gameworld
|
||||
|
|
|
@ -48,6 +48,8 @@ namespace MWGui
|
|||
MyGUI::TextBox* mCellNameBox;
|
||||
MyGUI::TextBox* mWeaponSpellBox;
|
||||
|
||||
MyGUI::Widget* mDummy;
|
||||
|
||||
MyGUI::WidgetPtr fpsbox;
|
||||
MyGUI::TextBox* fpscounter;
|
||||
MyGUI::TextBox* trianglecounter;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
|
@ -18,7 +19,6 @@
|
|||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
|
||||
#include "window_manager.hpp"
|
||||
#include "widgets.hpp"
|
||||
#include "bookwindow.hpp"
|
||||
#include "scrollwindow.hpp"
|
||||
|
@ -40,7 +40,7 @@ namespace
|
|||
namespace MWGui
|
||||
{
|
||||
|
||||
InventoryWindow::InventoryWindow(WindowManager& parWindowManager,DragAndDrop* dragAndDrop)
|
||||
InventoryWindow::InventoryWindow(MWBase::WindowManager& parWindowManager,DragAndDrop* dragAndDrop)
|
||||
: ContainerBase(dragAndDrop)
|
||||
, WindowPinnableBase("openmw_inventory_window.layout", parWindowManager)
|
||||
, mTrading(false)
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace MWGui
|
|||
class InventoryWindow : public ContainerBase, public WindowPinnableBase
|
||||
{
|
||||
public:
|
||||
InventoryWindow(WindowManager& parWindowManager,DragAndDrop* dragAndDrop);
|
||||
InventoryWindow(MWBase::WindowManager& parWindowManager,DragAndDrop* dragAndDrop);
|
||||
|
||||
virtual void open();
|
||||
|
||||
|
|
|
@ -4,11 +4,10 @@
|
|||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/journal.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwdialogue/journalentry.hpp"
|
||||
|
||||
#include "window_manager.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
struct book
|
||||
|
@ -82,7 +81,7 @@ book formatText(std::string text,book mBook,int maxLine, int lineSize)
|
|||
}
|
||||
|
||||
|
||||
MWGui::JournalWindow::JournalWindow (WindowManager& parWindowManager)
|
||||
MWGui::JournalWindow::JournalWindow (MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_journal.layout", parWindowManager)
|
||||
, mLastPos(0)
|
||||
, mVisible(false)
|
||||
|
|
|
@ -10,12 +10,10 @@
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
class WindowManager;
|
||||
|
||||
class JournalWindow : public WindowBase
|
||||
{
|
||||
public:
|
||||
JournalWindow(WindowManager& parWindowManager);
|
||||
JournalWindow(MWBase::WindowManager& parWindowManager);
|
||||
void open();
|
||||
|
||||
virtual void setVisible(bool visible); // only used to play close sound
|
||||
|
|
|
@ -2,22 +2,29 @@
|
|||
|
||||
#include <OgreRoot.h>
|
||||
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
#include "window_manager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
MainMenu::MainMenu(int w, int h)
|
||||
: OEngine::GUI::Layout("openmw_mainmenu.layout")
|
||||
, mButtonBox(0)
|
||||
{
|
||||
onResChange(w,h);
|
||||
}
|
||||
|
||||
void MainMenu::onResChange(int w, int h)
|
||||
{
|
||||
setCoord(0,0,w,h);
|
||||
|
||||
int height = 64 * 3;
|
||||
|
||||
if (mButtonBox)
|
||||
MyGUI::Gui::getInstance ().destroyWidget(mButtonBox);
|
||||
|
||||
mButtonBox = mMainWidget->createWidget<MyGUI::Widget>("", MyGUI::IntCoord(w/2 - 64, h/2 - height/2, 128, height), MyGUI::Align::Default);
|
||||
int curH = 0;
|
||||
|
||||
|
@ -57,7 +64,6 @@ namespace MWGui
|
|||
mExitGame->setImageResource ("Menu_ExitGame");
|
||||
mExitGame->eventMouseButtonClick += MyGUI::newDelegate(this, &MainMenu::exitGame);
|
||||
curH += 64;
|
||||
|
||||
}
|
||||
|
||||
void MainMenu::returnToGame(MyGUI::Widget* sender)
|
||||
|
|
|
@ -8,6 +8,8 @@ namespace MWGui
|
|||
public:
|
||||
MainMenu(int w, int h);
|
||||
|
||||
void onResChange(int w, int h);
|
||||
|
||||
private:
|
||||
MyGUI::Button* mReturn;
|
||||
MyGUI::Button* mNewGame;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "map_window.hpp"
|
||||
#include "window_manager.hpp"
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
|
@ -154,7 +155,7 @@ void LocalMapBase::setPlayerDir(const float x, const float y)
|
|||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
|
||||
MapWindow::MapWindow(WindowManager& parWindowManager) :
|
||||
MapWindow::MapWindow(MWBase::WindowManager& parWindowManager) :
|
||||
MWGui::WindowPinnableBase("openmw_map_window.layout", parWindowManager),
|
||||
mGlobal(false)
|
||||
{
|
||||
|
|
|
@ -45,11 +45,11 @@ namespace MWGui
|
|||
class MapWindow : public MWGui::WindowPinnableBase, public LocalMapBase
|
||||
{
|
||||
public:
|
||||
MapWindow(WindowManager& parWindowManager);
|
||||
MapWindow(MWBase::WindowManager& parWindowManager);
|
||||
virtual ~MapWindow(){}
|
||||
|
||||
void setCellName(const std::string& cellName);
|
||||
|
||||
|
||||
private:
|
||||
void onDragStart(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id);
|
||||
void onMouseDrag(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
using namespace MWGui;
|
||||
|
||||
MessageBoxManager::MessageBoxManager (WindowManager *windowManager)
|
||||
MessageBoxManager::MessageBoxManager (MWBase::WindowManager *windowManager)
|
||||
{
|
||||
mWindowManager = windowManager;
|
||||
// defines
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
#include <MyGUI.h>
|
||||
|
||||
#include "window_base.hpp"
|
||||
#include "window_manager.hpp"
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#undef MessageBox
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
class InteractiveMessageBox;
|
||||
class MessageBoxManager;
|
||||
class MessageBox;
|
||||
|
@ -25,27 +25,27 @@ namespace MWGui
|
|||
class MessageBoxManager
|
||||
{
|
||||
public:
|
||||
MessageBoxManager (WindowManager* windowManager);
|
||||
MessageBoxManager (MWBase::WindowManager* windowManager);
|
||||
void onFrame (float frameDuration);
|
||||
void createMessageBox (const std::string& message);
|
||||
bool createInteractiveMessageBox (const std::string& message, const std::vector<std::string>& buttons);
|
||||
bool isInteractiveMessageBox ();
|
||||
|
||||
|
||||
void removeMessageBox (float time, MessageBox *msgbox);
|
||||
bool removeMessageBox (MessageBox *msgbox);
|
||||
void setMessageBoxSpeed (int speed);
|
||||
|
||||
|
||||
int readPressedButton ();
|
||||
|
||||
WindowManager *mWindowManager;
|
||||
|
||||
|
||||
MWBase::WindowManager *mWindowManager;
|
||||
|
||||
private:
|
||||
std::vector<MessageBox*> mMessageBoxes;
|
||||
InteractiveMessageBox* mInterMessageBoxe;
|
||||
std::vector<MessageBoxManagerTimer> mTimers;
|
||||
float mMessageBoxSpeed;
|
||||
};
|
||||
|
||||
|
||||
class MessageBox : public OEngine::GUI::Layout
|
||||
{
|
||||
public:
|
||||
|
@ -53,9 +53,9 @@ namespace MWGui
|
|||
void setMessage (const std::string& message);
|
||||
int getHeight ();
|
||||
void update (int height);
|
||||
|
||||
|
||||
bool mMarkedToDelete;
|
||||
|
||||
|
||||
protected:
|
||||
MessageBoxManager& mMessageBoxManager;
|
||||
int mHeight;
|
||||
|
@ -65,16 +65,16 @@ namespace MWGui
|
|||
int mBottomPadding;
|
||||
int mNextBoxPadding;
|
||||
};
|
||||
|
||||
|
||||
class InteractiveMessageBox : public OEngine::GUI::Layout
|
||||
{
|
||||
public:
|
||||
InteractiveMessageBox (MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector<std::string>& buttons);
|
||||
void mousePressed (MyGUI::Widget* _widget);
|
||||
int readPressedButton ();
|
||||
|
||||
|
||||
bool mMarkedToDelete;
|
||||
|
||||
|
||||
private:
|
||||
MessageBoxManager& mMessageBoxManager;
|
||||
MyGUI::EditPtr mMessageWidget;
|
||||
|
|
|
@ -8,14 +8,17 @@
|
|||
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "window_manager.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "widgets.hpp"
|
||||
#include "tooltips.hpp"
|
||||
|
||||
using namespace MWGui;
|
||||
using namespace Widgets;
|
||||
|
||||
RaceDialog::RaceDialog(WindowManager& parWindowManager)
|
||||
RaceDialog::RaceDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_race.layout", parWindowManager)
|
||||
, mGenderIndex(0)
|
||||
, mFaceIndex(0)
|
||||
|
@ -209,7 +212,7 @@ void RaceDialog::updateRaces()
|
|||
{
|
||||
mRaceList->removeAllItems();
|
||||
|
||||
const ESMS::ESMStore &store = mWindowManager.getStore();
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
ESMS::RecListT<ESM::Race>::MapType::const_iterator it = store.races.list.begin();
|
||||
ESMS::RecListT<ESM::Race>::MapType::const_iterator end = store.races.list.end();
|
||||
|
@ -243,7 +246,7 @@ void RaceDialog::updateSkills()
|
|||
const int lineHeight = 18;
|
||||
MyGUI::IntCoord coord1(0, 0, mSkillList->getWidth(), 18);
|
||||
|
||||
const ESMS::ESMStore &store = mWindowManager.getStore();
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Race *race = store.races.find(mCurrentRaceId);
|
||||
int count = sizeof(race->data.bonus)/sizeof(race->data.bonus[0]); // TODO: Find a portable macro for this ARRAYSIZE?
|
||||
for (int i = 0; i < count; ++i)
|
||||
|
@ -281,7 +284,7 @@ void RaceDialog::updateSpellPowers()
|
|||
const int lineHeight = 18;
|
||||
MyGUI::IntCoord coord(0, 0, mSpellPowerList->getWidth(), 18);
|
||||
|
||||
const ESMS::ESMStore &store = mWindowManager.getStore();
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Race *race = store.races.find(mCurrentRaceId);
|
||||
|
||||
std::vector<std::string>::const_iterator it = race->powers.list.begin();
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace MWGui
|
|||
class RaceDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
RaceDialog(WindowManager& parWindowManager);
|
||||
RaceDialog(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
enum Gender
|
||||
{
|
||||
|
|
|
@ -7,7 +7,10 @@
|
|||
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "window_manager.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "widgets.hpp"
|
||||
#include "tooltips.hpp"
|
||||
|
||||
|
@ -19,7 +22,7 @@ using namespace Widgets;
|
|||
|
||||
const int ReviewDialog::sLineHeight = 18;
|
||||
|
||||
ReviewDialog::ReviewDialog(WindowManager& parWindowManager)
|
||||
ReviewDialog::ReviewDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_review.layout", parWindowManager)
|
||||
, mLastPos(0)
|
||||
{
|
||||
|
@ -138,7 +141,7 @@ void ReviewDialog::setPlayerName(const std::string &name)
|
|||
void ReviewDialog::setRace(const std::string &raceId)
|
||||
{
|
||||
mRaceId = raceId;
|
||||
const ESM::Race *race = mWindowManager.getStore().races.search(mRaceId);
|
||||
const ESM::Race *race = MWBase::Environment::get().getWorld()->getStore().races.search(mRaceId);
|
||||
if (race)
|
||||
{
|
||||
ToolTips::createRaceToolTip(mRaceWidget, race);
|
||||
|
@ -156,7 +159,7 @@ void ReviewDialog::setClass(const ESM::Class& class_)
|
|||
void ReviewDialog::setBirthSign(const std::string& signId)
|
||||
{
|
||||
mBirthSignId = signId;
|
||||
const ESM::BirthSign *sign = mWindowManager.getStore().birthSigns.search(mBirthSignId);
|
||||
const ESM::BirthSign *sign = MWBase::Environment::get().getWorld()->getStore().birthSigns.search(mBirthSignId);
|
||||
if (sign)
|
||||
{
|
||||
mBirthSignWidget->setCaption(sign->name);
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace MWGui
|
|||
};
|
||||
typedef std::vector<int> SkillList;
|
||||
|
||||
ReviewDialog(WindowManager& parWindowManager);
|
||||
ReviewDialog(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
void setPlayerName(const std::string &name);
|
||||
void setRace(const std::string &raceId);
|
||||
|
|
|
@ -3,18 +3,16 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "formatting.hpp"
|
||||
#include "window_manager.hpp"
|
||||
|
||||
using namespace MWGui;
|
||||
|
||||
ScrollWindow::ScrollWindow (WindowManager& parWindowManager) :
|
||||
ScrollWindow::ScrollWindow (MWBase::WindowManager& parWindowManager) :
|
||||
WindowBase("openmw_scroll.layout", parWindowManager)
|
||||
{
|
||||
getWidget(mTextView, "TextView");
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace MWGui
|
|||
class ScrollWindow : public WindowBase
|
||||
{
|
||||
public:
|
||||
ScrollWindow (WindowManager& parWindowManager);
|
||||
ScrollWindow (MWBase::WindowManager& parWindowManager);
|
||||
|
||||
void open (MWWorld::Ptr scroll);
|
||||
void setTakeButtonShow(bool show);
|
||||
|
|
|
@ -13,12 +13,11 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/inputmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwrender/renderingmanager.hpp"
|
||||
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
|
||||
#include "window_manager.hpp"
|
||||
#include "confirmationdialog.hpp"
|
||||
|
||||
namespace
|
||||
|
@ -82,7 +81,7 @@ namespace
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
SettingsWindow::SettingsWindow(WindowManager& parWindowManager) :
|
||||
SettingsWindow::SettingsWindow(MWBase::WindowManager& parWindowManager) :
|
||||
WindowBase("openmw_settings_window.layout", parWindowManager)
|
||||
{
|
||||
getWidget(mOkButton, "OkButton");
|
||||
|
@ -116,7 +115,13 @@ namespace MWGui
|
|||
getWidget(mMiscShadows, "MiscShadows");
|
||||
getWidget(mShadowsDebug, "ShadowsDebug");
|
||||
getWidget(mUnderwaterButton, "UnderwaterButton");
|
||||
getWidget(mControlsBox, "ControlsBox");
|
||||
getWidget(mResetControlsButton, "ResetControlsButton");
|
||||
getWidget(mInvertYButton, "InvertYButton");
|
||||
getWidget(mUISensitivitySlider, "UISensitivitySlider");
|
||||
getWidget(mCameraSensitivitySlider, "CameraSensitivitySlider");
|
||||
|
||||
mInvertYButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
|
||||
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onOkButtonClicked);
|
||||
mUnderwaterButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
|
||||
mShadersButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onShadersToggled);
|
||||
|
@ -155,6 +160,9 @@ namespace MWGui
|
|||
mOkButton->setCoord(mMainWidget->getWidth()-16-okSize, mOkButton->getTop(),
|
||||
okSize, mOkButton->getHeight());
|
||||
|
||||
mResetControlsButton->setSize (mResetControlsButton->getTextSize ().width + 24, mResetControlsButton->getHeight());
|
||||
mResetControlsButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onResetDefaultBindings);
|
||||
|
||||
// fill resolution list
|
||||
Ogre::RenderSystem* rs = Ogre::Root::getSingleton().getRenderSystem();
|
||||
Ogre::StringVector videoModes = rs->getConfigOptions()["Video Mode"].possibleValues;
|
||||
|
@ -220,6 +228,16 @@ namespace MWGui
|
|||
mMiscShadows->setCaptionWithReplacing(Settings::Manager::getBool("misc shadows", "Shadows") ? "#{sOn}" : "#{sOff}");
|
||||
mShadowsDebug->setCaptionWithReplacing(Settings::Manager::getBool("debug", "Shadows") ? "#{sOn}" : "#{sOff}");
|
||||
|
||||
float cameraSens = (Settings::Manager::getFloat("camera sensitivity", "Input")-0.2)/(5.0-0.2);
|
||||
mCameraSensitivitySlider->setScrollPosition (cameraSens * (mCameraSensitivitySlider->getScrollRange()-1));
|
||||
float uiSens = (Settings::Manager::getFloat("ui sensitivity", "Input")-0.2)/(5.0-0.2);
|
||||
mUISensitivitySlider->setScrollPosition (uiSens * (mUISensitivitySlider->getScrollRange()-1));
|
||||
mCameraSensitivitySlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
|
||||
mUISensitivitySlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
|
||||
|
||||
|
||||
mInvertYButton->setCaptionWithReplacing(Settings::Manager::getBool("invert y axis", "Input") ? "#{sOn}" : "#{sOff}");
|
||||
|
||||
std::string shaders;
|
||||
if (!Settings::Manager::getBool("shaders", "Objects"))
|
||||
shaders = "off";
|
||||
|
@ -383,6 +401,8 @@ namespace MWGui
|
|||
Settings::Manager::setBool("misc shadows", "Shadows", newState);
|
||||
else if (_sender == mShadowsDebug)
|
||||
Settings::Manager::setBool("debug", "Shadows", newState);
|
||||
else if (_sender == mInvertYButton)
|
||||
Settings::Manager::setBool("invert y axis", "Input", newState);
|
||||
|
||||
apply();
|
||||
}
|
||||
|
@ -500,6 +520,10 @@ namespace MWGui
|
|||
Settings::Manager::setFloat("footsteps volume", "Sound", val);
|
||||
else if (scroller == mMusicVolumeSlider)
|
||||
Settings::Manager::setFloat("music volume", "Sound", val);
|
||||
else if (scroller == mUISensitivitySlider)
|
||||
Settings::Manager::setFloat("ui sensitivity", "Input", (1-val) * 0.2 + val * 5.f);
|
||||
else if (scroller == mCameraSensitivitySlider)
|
||||
Settings::Manager::setFloat("camera sensitivity", "Input", (1-val) * 0.2 + val * 5.f);
|
||||
|
||||
apply();
|
||||
}
|
||||
|
@ -512,4 +536,78 @@ namespace MWGui
|
|||
MWBase::Environment::get().getWindowManager()->processChangedSettings(changed);
|
||||
MWBase::Environment::get().getInputManager()->processChangedSettings(changed);
|
||||
}
|
||||
|
||||
void SettingsWindow::updateControlsBox()
|
||||
{
|
||||
while (mControlsBox->getChildCount())
|
||||
MyGUI::Gui::getInstance().destroyWidget(mControlsBox->getChildAt(0));
|
||||
|
||||
std::vector<int> actions = MWBase::Environment::get().getInputManager()->getActionSorting ();
|
||||
|
||||
const int h = 18;
|
||||
const int w = mControlsBox->getWidth() - 28;
|
||||
int curH = 0;
|
||||
for (std::vector<int>::const_iterator it = actions.begin(); it != actions.end(); ++it)
|
||||
{
|
||||
std::string desc = MWBase::Environment::get().getInputManager()->getActionDescription (*it);
|
||||
if (desc == "")
|
||||
continue;
|
||||
|
||||
std::string binding = MWBase::Environment::get().getInputManager()->getActionBindingName (*it);
|
||||
|
||||
MyGUI::TextBox* leftText = mControlsBox->createWidget<MyGUI::TextBox>("SandText", MyGUI::IntCoord(0,curH,w,h), MyGUI::Align::Default);
|
||||
leftText->setCaptionWithReplacing(desc);
|
||||
|
||||
MyGUI::Button* rightText = mControlsBox->createWidget<MyGUI::Button>("SandTextButton", MyGUI::IntCoord(0,curH,w,h), MyGUI::Align::Default);
|
||||
rightText->setCaptionWithReplacing(binding);
|
||||
rightText->setTextAlign (MyGUI::Align::Right);
|
||||
rightText->setUserData(*it); // save the action id for callbacks
|
||||
rightText->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onRebindAction);
|
||||
rightText->eventMouseWheel += MyGUI::newDelegate(this, &SettingsWindow::onInputTabMouseWheel);
|
||||
curH += h;
|
||||
}
|
||||
|
||||
mControlsBox->setCanvasSize (mControlsBox->getWidth(), std::max(curH, mControlsBox->getHeight()));
|
||||
}
|
||||
|
||||
void SettingsWindow::onRebindAction(MyGUI::Widget* _sender)
|
||||
{
|
||||
int actionId = *_sender->getUserData<int>();
|
||||
|
||||
static_cast<MyGUI::Button*>(_sender)->setCaptionWithReplacing("#{sNone}");
|
||||
|
||||
MWBase::Environment::get().getWindowManager ()->messageBox ("#{sControlsMenu3}", std::vector<std::string>());
|
||||
MWBase::Environment::get().getWindowManager ()->disallowMouse();
|
||||
|
||||
MWBase::Environment::get().getInputManager ()->enableDetectingBindingMode (actionId);
|
||||
|
||||
}
|
||||
|
||||
void SettingsWindow::onInputTabMouseWheel(MyGUI::Widget* _sender, int _rel)
|
||||
{
|
||||
if (mControlsBox->getViewOffset().top + _rel*0.3 > 0)
|
||||
mControlsBox->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||
else
|
||||
mControlsBox->setViewOffset(MyGUI::IntPoint(0, mControlsBox->getViewOffset().top + _rel*0.3));
|
||||
}
|
||||
|
||||
void SettingsWindow::onResetDefaultBindings(MyGUI::Widget* _sender)
|
||||
{
|
||||
ConfirmationDialog* dialog = mWindowManager.getConfirmationDialog();
|
||||
dialog->open("#{sNotifyMessage66}");
|
||||
dialog->eventOkClicked.clear();
|
||||
dialog->eventOkClicked += MyGUI::newDelegate(this, &SettingsWindow::onResetDefaultBindingsAccept);
|
||||
dialog->eventCancelClicked.clear();
|
||||
}
|
||||
|
||||
void SettingsWindow::onResetDefaultBindingsAccept()
|
||||
{
|
||||
MWBase::Environment::get().getInputManager ()->resetToDefaultBindings ();
|
||||
updateControlsBox ();
|
||||
}
|
||||
|
||||
void SettingsWindow::open()
|
||||
{
|
||||
updateControlsBox ();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,11 @@ namespace MWGui
|
|||
class SettingsWindow : public WindowBase
|
||||
{
|
||||
public:
|
||||
SettingsWindow(WindowManager& parWindowManager);
|
||||
SettingsWindow(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
virtual void open();
|
||||
|
||||
void updateControlsBox();
|
||||
|
||||
private:
|
||||
static int const sFovMin = 30;
|
||||
|
@ -60,6 +64,13 @@ namespace MWGui
|
|||
MyGUI::ScrollBar* mFootstepsVolumeSlider;
|
||||
MyGUI::ScrollBar* mMusicVolumeSlider;
|
||||
|
||||
// controls
|
||||
MyGUI::ScrollView* mControlsBox;
|
||||
MyGUI::Button* mResetControlsButton;
|
||||
MyGUI::Button* mInvertYButton;
|
||||
MyGUI::ScrollBar* mUISensitivitySlider;
|
||||
MyGUI::ScrollBar* mCameraSensitivitySlider;
|
||||
|
||||
void onOkButtonClicked(MyGUI::Widget* _sender);
|
||||
void onFpsToggled(MyGUI::Widget* _sender);
|
||||
void onTextureFilteringToggled(MyGUI::Widget* _sender);
|
||||
|
@ -72,9 +83,13 @@ namespace MWGui
|
|||
void onShadersToggled(MyGUI::Widget* _sender);
|
||||
void onShadowTextureSize(MyGUI::Widget* _sender);
|
||||
|
||||
void onRebindAction(MyGUI::Widget* _sender);
|
||||
void onInputTabMouseWheel(MyGUI::Widget* _sender, int _rel);
|
||||
void onResetDefaultBindings(MyGUI::Widget* _sender);
|
||||
void onResetDefaultBindingsAccept ();
|
||||
|
||||
void apply();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
|
@ -17,7 +18,6 @@
|
|||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/spellsuccess.hpp"
|
||||
|
||||
#include "window_manager.hpp"
|
||||
#include "inventorywindow.hpp"
|
||||
#include "confirmationdialog.hpp"
|
||||
|
||||
|
@ -42,7 +42,7 @@ namespace
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
SpellWindow::SpellWindow(WindowManager& parWindowManager)
|
||||
SpellWindow::SpellWindow(MWBase::WindowManager& parWindowManager)
|
||||
: WindowPinnableBase("openmw_spell_window.layout", parWindowManager)
|
||||
, mHeight(0)
|
||||
, mWidth(0)
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace MWGui
|
|||
class SpellWindow : public WindowPinnableBase
|
||||
{
|
||||
public:
|
||||
SpellWindow(WindowManager& parWindowManager);
|
||||
SpellWindow(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
void updateSpells();
|
||||
|
||||
|
|
|
@ -8,20 +8,21 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
|
||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
|
||||
#include "window_manager.hpp"
|
||||
#include "tooltips.hpp"
|
||||
|
||||
|
||||
using namespace MWGui;
|
||||
const int StatsWindow::sLineHeight = 18;
|
||||
|
||||
StatsWindow::StatsWindow (WindowManager& parWindowManager)
|
||||
StatsWindow::StatsWindow (MWBase::WindowManager& parWindowManager)
|
||||
: WindowPinnableBase("openmw_stats_window.layout", parWindowManager)
|
||||
, mSkillAreaWidget(NULL)
|
||||
, mSkillClientWidget(NULL)
|
||||
|
@ -56,7 +57,7 @@ StatsWindow::StatsWindow (WindowManager& parWindowManager)
|
|||
{ 0, 0 }
|
||||
};
|
||||
|
||||
const ESMS::ESMStore &store = mWindowManager.getStore();
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
for (int i=0; names[i][0]; ++i)
|
||||
{
|
||||
setText (names[i][0], store.gameSettings.find (names[i][1])->str);
|
||||
|
@ -382,12 +383,12 @@ void StatsWindow::addSkills(const SkillList &skills, const std::string &titleId,
|
|||
float modified = stat.getModified();
|
||||
int progressPercent = (modified - float(static_cast<int>(modified))) * 100;
|
||||
|
||||
const ESM::Skill* skill = mWindowManager.getStore().skills.search(skillId);
|
||||
const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().skills.search(skillId);
|
||||
assert(skill);
|
||||
|
||||
std::string icon = "icons\\k\\" + ESM::Skill::sIconNames[skillId];
|
||||
|
||||
const ESM::Attribute* attr = mWindowManager.getStore().attributes.search(skill->data.attribute);
|
||||
const ESM::Attribute* attr = MWBase::Environment::get().getWorld()->getStore().attributes.search(skill->data.attribute);
|
||||
assert(attr);
|
||||
|
||||
std::string state = "normal";
|
||||
|
@ -442,7 +443,7 @@ void StatsWindow::updateSkillArea()
|
|||
if (!mMiscSkills.empty())
|
||||
addSkills(mMiscSkills, "sSkillClassMisc", "Misc Skills", coord1, coord2);
|
||||
|
||||
const ESMS::ESMStore &store = mWindowManager.getStore();
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
// race tooltip
|
||||
const ESM::Race* playerRace = store.races.find (MWBase::Environment::get().getWorld()->getPlayer().getRace());
|
||||
|
@ -484,8 +485,8 @@ void StatsWindow::updateSkillArea()
|
|||
text += std::string("\n\n#DDC79E#{sNextRank} ") + faction->ranks[it->second+1];
|
||||
|
||||
ESM::RankData rankData = faction->data.rankData[it->second+1];
|
||||
const ESM::Attribute* attr1 = mWindowManager.getStore().attributes.search(faction->data.attribute1);
|
||||
const ESM::Attribute* attr2 = mWindowManager.getStore().attributes.search(faction->data.attribute2);
|
||||
const ESM::Attribute* attr1 = MWBase::Environment::get().getWorld()->getStore().attributes.search(faction->data.attribute1);
|
||||
const ESM::Attribute* attr2 = MWBase::Environment::get().getWorld()->getStore().attributes.search(faction->data.attribute2);
|
||||
assert(attr1 && attr2);
|
||||
|
||||
text += "\n#BF9959#{" + attr1->name + "}: " + boost::lexical_cast<std::string>(rankData.attribute1)
|
||||
|
@ -495,7 +496,7 @@ void StatsWindow::updateSkillArea()
|
|||
text += "\n#BF9959";
|
||||
for (int i=0; i<6; ++i)
|
||||
{
|
||||
const ESM::Skill* skill = mWindowManager.getStore().skills.search(faction->data.skillID[i]);
|
||||
const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().skills.search(faction->data.skillID[i]);
|
||||
assert(skill);
|
||||
text += "#{"+ESM::Skill::sSkillNameIds[faction->data.skillID[i]]+"}";
|
||||
if (i<5)
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace MWGui
|
|||
|
||||
typedef std::vector<int> SkillList;
|
||||
|
||||
StatsWindow(WindowManager& parWindowManager);
|
||||
StatsWindow(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
/// automatically updates all the data in the stats window, but only if it has changed.
|
||||
void onFrame();
|
||||
|
@ -82,4 +82,3 @@ namespace MWGui
|
|||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#include "text_input.hpp"
|
||||
#include "window_manager.hpp"
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
using namespace MWGui;
|
||||
|
||||
TextInputDialog::TextInputDialog(WindowManager& parWindowManager)
|
||||
TextInputDialog::TextInputDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_text_input.layout", parWindowManager)
|
||||
{
|
||||
// Centre dialog
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace MWGui
|
|||
class TextInputDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
TextInputDialog(WindowManager& parWindowManager);
|
||||
TextInputDialog(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
std::string getTextInput() const { return mTextEdit ? mTextEdit->getOnlyText() : ""; }
|
||||
void setTextInput(const std::string &text) { if (mTextEdit) mTextEdit->setOnlyText(text); }
|
||||
|
|
|
@ -8,16 +8,16 @@
|
|||
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
|
||||
#include "window_manager.hpp"
|
||||
#include "widgets.hpp"
|
||||
|
||||
using namespace MWGui;
|
||||
using namespace MyGUI;
|
||||
|
||||
ToolTips::ToolTips(WindowManager* windowManager) :
|
||||
ToolTips::ToolTips(MWBase::WindowManager* windowManager) :
|
||||
Layout("openmw_tooltips.layout")
|
||||
, mGameMode(true)
|
||||
, mWindowManager(windowManager)
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
class WindowManager;
|
||||
|
||||
// Info about tooltip that is supplied by the MWWorld::Class object
|
||||
struct ToolTipInfo
|
||||
{
|
||||
|
@ -29,7 +27,7 @@ namespace MWGui
|
|||
class ToolTips : public OEngine::GUI::Layout
|
||||
{
|
||||
public:
|
||||
ToolTips(WindowManager* windowManager);
|
||||
ToolTips(MWBase::WindowManager* windowManager);
|
||||
|
||||
void onFrame(float frameDuration);
|
||||
|
||||
|
@ -45,7 +43,7 @@ namespace MWGui
|
|||
|
||||
void setFocusObject(const MWWorld::Ptr& focus);
|
||||
void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y);
|
||||
///< set the screen-space position of the tooltip for focused object
|
||||
///< set the screen-space position of the tooltip for focused object
|
||||
|
||||
static std::string getValueString(const int value, const std::string& prefix);
|
||||
///< @return "prefix: value" or "" if value is 0
|
||||
|
@ -71,7 +69,7 @@ namespace MWGui
|
|||
private:
|
||||
MyGUI::Widget* mDynamicToolTipBox;
|
||||
|
||||
WindowManager* mWindowManager;
|
||||
MWBase::WindowManager* mWindowManager;
|
||||
|
||||
MWWorld::Ptr mFocusObject;
|
||||
|
||||
|
|
|
@ -5,16 +5,16 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
#include "../mwworld/manualref.hpp"
|
||||
|
||||
#include "window_manager.hpp"
|
||||
#include "inventorywindow.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
TradeWindow::TradeWindow(WindowManager& parWindowManager) :
|
||||
TradeWindow::TradeWindow(MWBase::WindowManager& parWindowManager) :
|
||||
WindowBase("openmw_trade_window.layout", parWindowManager)
|
||||
, ContainerBase(NULL) // no drag&drop
|
||||
, mCurrentBalance(0)
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace MWGui
|
|||
class TradeWindow : public ContainerBase, public WindowBase
|
||||
{
|
||||
public:
|
||||
TradeWindow(WindowManager& parWindowManager);
|
||||
TradeWindow(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
void startTrade(MWWorld::Ptr actor);
|
||||
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
#include "widgets.hpp"
|
||||
#include "window_manager.hpp"
|
||||
#include "components/esm_store/store.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "components/esm_store/store.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#undef min
|
||||
#undef max
|
||||
|
||||
|
@ -190,7 +194,7 @@ void MWAttribute::initialiseOverride()
|
|||
|
||||
assignWidget(mAttributeNameWidget, "StatName");
|
||||
assignWidget(mAttributeValueWidget, "StatValue");
|
||||
|
||||
|
||||
MyGUI::ButtonPtr button;
|
||||
assignWidget(button, "StatNameButton");
|
||||
if (button)
|
||||
|
@ -224,7 +228,7 @@ void MWSpell::setSpellId(const std::string &spellId)
|
|||
|
||||
void MWSpell::createEffectWidgets(std::vector<MyGUI::WidgetPtr> &effects, MyGUI::WidgetPtr creator, MyGUI::IntCoord &coord, int flags)
|
||||
{
|
||||
const ESMS::ESMStore &store = mWindowManager->getStore();
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Spell *spell = store.spells.search(mId);
|
||||
MYGUI_ASSERT(spell, "spell with id '" << mId << "' not found");
|
||||
|
||||
|
@ -255,7 +259,7 @@ void MWSpell::updateWidgets()
|
|||
{
|
||||
if (mSpellNameWidget && mWindowManager)
|
||||
{
|
||||
const ESMS::ESMStore &store = mWindowManager->getStore();
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Spell *spell = store.spells.search(mId);
|
||||
if (spell)
|
||||
static_cast<MyGUI::TextBox*>(mSpellNameWidget)->setCaption(spell->name);
|
||||
|
@ -384,7 +388,7 @@ void MWSpellEffect::updateWidgets()
|
|||
if (!mWindowManager)
|
||||
return;
|
||||
|
||||
const ESMS::ESMStore &store = mWindowManager->getStore();
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::MagicEffect *magicEffect = store.magicEffects.search(mEffectParams.mEffectID);
|
||||
if (!magicEffect)
|
||||
return;
|
||||
|
|
|
@ -10,14 +10,19 @@
|
|||
#undef MYGUI_EXPORT
|
||||
#define MYGUI_EXPORT
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
class WindowManager;
|
||||
}
|
||||
|
||||
/*
|
||||
This file contains various custom widgets used in OpenMW.
|
||||
*/
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
/// \todo remove!
|
||||
using namespace MyGUI;
|
||||
class WindowManager;
|
||||
|
||||
namespace Widgets
|
||||
{
|
||||
|
@ -81,12 +86,12 @@ namespace MWGui
|
|||
|
||||
typedef MWMechanics::Stat<float> SkillValue;
|
||||
|
||||
void setWindowManager(WindowManager *m) { mManager = m; }
|
||||
void setWindowManager(MWBase::WindowManager *m) { mManager = m; } /// \todo remove
|
||||
void setSkillId(ESM::Skill::SkillEnum skillId);
|
||||
void setSkillNumber(int skillId);
|
||||
void setSkillValue(const SkillValue& value);
|
||||
|
||||
WindowManager *getWindowManager() const { return mManager; }
|
||||
MWBase::WindowManager *getWindowManager() const { return mManager; }
|
||||
ESM::Skill::SkillEnum getSkillId() const { return mSkillId; }
|
||||
const SkillValue& getSkillValue() const { return mValue; }
|
||||
|
||||
|
@ -109,7 +114,7 @@ namespace MWGui
|
|||
|
||||
void updateWidgets();
|
||||
|
||||
WindowManager *mManager;
|
||||
MWBase::WindowManager *mManager;
|
||||
ESM::Skill::SkillEnum mSkillId;
|
||||
SkillValue mValue;
|
||||
MyGUI::WidgetPtr mSkillNameWidget, mSkillValueWidget;
|
||||
|
@ -124,11 +129,11 @@ namespace MWGui
|
|||
|
||||
typedef MWMechanics::Stat<int> AttributeValue;
|
||||
|
||||
void setWindowManager(WindowManager *m) { mManager = m; }
|
||||
void setWindowManager(MWBase::WindowManager *m) { mManager = m; }
|
||||
void setAttributeId(int attributeId);
|
||||
void setAttributeValue(const AttributeValue& value);
|
||||
|
||||
WindowManager *getWindowManager() const { return mManager; }
|
||||
MWBase::WindowManager *getWindowManager() const { return mManager; }
|
||||
int getAttributeId() const { return mId; }
|
||||
const AttributeValue& getAttributeValue() const { return mValue; }
|
||||
|
||||
|
@ -151,7 +156,7 @@ namespace MWGui
|
|||
|
||||
void updateWidgets();
|
||||
|
||||
WindowManager *mManager;
|
||||
MWBase::WindowManager *mManager;
|
||||
int mId;
|
||||
AttributeValue mValue;
|
||||
MyGUI::WidgetPtr mAttributeNameWidget, mAttributeValueWidget;
|
||||
|
@ -170,7 +175,7 @@ namespace MWGui
|
|||
|
||||
typedef MWMechanics::Stat<int> SpellValue;
|
||||
|
||||
void setWindowManager(WindowManager* parWindowManager) { mWindowManager = parWindowManager; }
|
||||
void setWindowManager(MWBase::WindowManager* parWindowManager) { mWindowManager = parWindowManager; }
|
||||
void setSpellId(const std::string &id);
|
||||
|
||||
/**
|
||||
|
@ -192,7 +197,7 @@ namespace MWGui
|
|||
private:
|
||||
void updateWidgets();
|
||||
|
||||
WindowManager* mWindowManager;
|
||||
MWBase::WindowManager* mWindowManager;
|
||||
std::string mId;
|
||||
MyGUI::TextBox* mSpellNameWidget;
|
||||
};
|
||||
|
@ -212,7 +217,7 @@ namespace MWGui
|
|||
EF_Constant = 0x02 // constant effect means that duration will not be displayed
|
||||
};
|
||||
|
||||
void setWindowManager(WindowManager* parWindowManager) { mWindowManager = parWindowManager; }
|
||||
void setWindowManager(MWBase::WindowManager* parWindowManager) { mWindowManager = parWindowManager; }
|
||||
void setEffectList(const SpellEffectList& list);
|
||||
|
||||
static SpellEffectList effectListFromESM(const ESM::EffectList* effects);
|
||||
|
@ -234,7 +239,7 @@ namespace MWGui
|
|||
private:
|
||||
void updateWidgets();
|
||||
|
||||
WindowManager* mWindowManager;
|
||||
MWBase::WindowManager* mWindowManager;
|
||||
SpellEffectList mEffectList;
|
||||
};
|
||||
typedef MWEffectList* MWEffectListPtr;
|
||||
|
@ -247,7 +252,7 @@ namespace MWGui
|
|||
|
||||
typedef ESM::ENAMstruct SpellEffectValue;
|
||||
|
||||
void setWindowManager(WindowManager* parWindowManager) { mWindowManager = parWindowManager; }
|
||||
void setWindowManager(MWBase::WindowManager* parWindowManager) { mWindowManager = parWindowManager; }
|
||||
void setSpellEffect(const SpellEffectParams& params);
|
||||
|
||||
std::string effectIDToString(const short effectID);
|
||||
|
@ -262,12 +267,12 @@ namespace MWGui
|
|||
virtual ~MWSpellEffect();
|
||||
|
||||
virtual void initialiseOverride();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
void updateWidgets();
|
||||
|
||||
WindowManager* mWindowManager;
|
||||
MWBase::WindowManager* mWindowManager;
|
||||
SpellEffectParams mEffectParams;
|
||||
MyGUI::ImageBox* mImageWidget;
|
||||
MyGUI::TextBox* mTextWidget;
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
#include "window_base.hpp"
|
||||
#include "window_manager.hpp"
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
using namespace MWGui;
|
||||
|
||||
WindowBase::WindowBase(const std::string& parLayout, WindowManager& parWindowManager)
|
||||
WindowBase::WindowBase(const std::string& parLayout, MWBase::WindowManager& parWindowManager)
|
||||
: Layout(parLayout)
|
||||
, mWindowManager(parWindowManager)
|
||||
{
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
|
||||
#include <openengine/gui/layout.hpp>
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
class WindowManager;
|
||||
}
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class WindowManager;
|
||||
|
@ -10,7 +15,7 @@ namespace MWGui
|
|||
class WindowBase: public OEngine::GUI::Layout
|
||||
{
|
||||
public:
|
||||
WindowBase(const std::string& parLayout, WindowManager& parWindowManager);
|
||||
WindowBase(const std::string& parLayout, MWBase::WindowManager& parWindowManager);
|
||||
|
||||
// Events
|
||||
typedef MyGUI::delegates::CMultiDelegate1<WindowBase*> EventHandle_WindowBase;
|
||||
|
@ -25,9 +30,9 @@ namespace MWGui
|
|||
EventHandle_WindowBase eventDone;
|
||||
|
||||
protected:
|
||||
WindowManager& mWindowManager;
|
||||
/// \todo remove
|
||||
MWBase::WindowManager& mWindowManager;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,317 +0,0 @@
|
|||
#ifndef MWGUI_WINDOWMANAGER_H
|
||||
#define MWGUI_WINDOWMANAGER_H
|
||||
|
||||
/**
|
||||
This class owns and controls all the MW specific windows in the
|
||||
GUI. It can enable/disable Gui mode, and is responsible for sending
|
||||
and retrieving information from the Gui.
|
||||
|
||||
MyGUI should be initialized separately before creating instances of
|
||||
this class.
|
||||
**/
|
||||
|
||||
#include "MyGUI_UString.h"
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
#include <components/settings/settings.hpp>
|
||||
#include <openengine/ogre/renderer.hpp>
|
||||
#include <openengine/gui/manager.hpp>
|
||||
|
||||
#include "../mwmechanics/stat.hpp"
|
||||
|
||||
#include "mode.hpp"
|
||||
|
||||
namespace MyGUI
|
||||
{
|
||||
class Gui;
|
||||
class Widget;
|
||||
}
|
||||
|
||||
namespace Compiler
|
||||
{
|
||||
class Extensions;
|
||||
}
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class Ptr;
|
||||
class CellStore;
|
||||
}
|
||||
|
||||
namespace MWMechanics
|
||||
{
|
||||
class MechanicsManager;
|
||||
}
|
||||
|
||||
namespace OEngine
|
||||
{
|
||||
namespace GUI
|
||||
{
|
||||
class Layout;
|
||||
}
|
||||
}
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class WindowBase;
|
||||
class HUD;
|
||||
class MapWindow;
|
||||
class MainMenu;
|
||||
class StatsWindow;
|
||||
class InventoryWindow;
|
||||
class Console;
|
||||
class JournalWindow;
|
||||
class CharacterCreation;
|
||||
class ContainerWindow;
|
||||
class DragAndDrop;
|
||||
class InventoryWindow;
|
||||
class ToolTips;
|
||||
class ScrollWindow;
|
||||
class BookWindow;
|
||||
class TextInputDialog;
|
||||
class InfoBoxDialog;
|
||||
class DialogueWindow;
|
||||
class MessageBoxManager;
|
||||
class CountDialog;
|
||||
class TradeWindow;
|
||||
class SettingsWindow;
|
||||
class ConfirmationDialog;
|
||||
class AlchemyWindow;
|
||||
class SpellWindow;
|
||||
|
||||
struct ClassPoint
|
||||
{
|
||||
const char *id;
|
||||
// Specialization points to match, in order: Stealth, Combat, Magic
|
||||
// Note: Order is taken from http://www.uesp.net/wiki/Morrowind:Class_Quiz
|
||||
unsigned int points[3];
|
||||
};
|
||||
|
||||
class WindowManager
|
||||
{
|
||||
public:
|
||||
typedef std::pair<std::string, int> Faction;
|
||||
typedef std::vector<Faction> FactionList;
|
||||
typedef std::vector<int> SkillList;
|
||||
|
||||
WindowManager(const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string& logpath, bool consoleOnlyScripts);
|
||||
virtual ~WindowManager();
|
||||
|
||||
/**
|
||||
* Should be called each frame to update windows/gui elements.
|
||||
* This could mean updating sizes of gui elements or opening
|
||||
* new dialogs.
|
||||
*/
|
||||
void update();
|
||||
|
||||
void pushGuiMode(GuiMode mode);
|
||||
void popGuiMode();
|
||||
void removeGuiMode(GuiMode mode); ///< can be anywhere in the stack
|
||||
|
||||
GuiMode getMode() const
|
||||
{
|
||||
if (mGuiModes.empty())
|
||||
throw std::runtime_error ("getMode() called, but there is no active mode");
|
||||
return mGuiModes.back();
|
||||
}
|
||||
|
||||
bool isGuiMode() const { return !mGuiModes.empty(); }
|
||||
|
||||
void toggleVisible(GuiWindow wnd)
|
||||
{
|
||||
mShown = (mShown & wnd) ? (GuiWindow) (mShown & ~wnd) : (GuiWindow) (mShown | wnd);
|
||||
updateVisible();
|
||||
}
|
||||
|
||||
// Disallow all inventory mode windows
|
||||
void disallowAll()
|
||||
{
|
||||
mAllowed = GW_None;
|
||||
updateVisible();
|
||||
}
|
||||
|
||||
// Allow one or more windows
|
||||
void allow(GuiWindow wnd)
|
||||
{
|
||||
mAllowed = (GuiWindow)(mAllowed | wnd);
|
||||
updateVisible();
|
||||
}
|
||||
|
||||
bool isAllowed(GuiWindow wnd) const
|
||||
{
|
||||
return mAllowed & wnd;
|
||||
}
|
||||
|
||||
MWGui::DialogueWindow* getDialogueWindow() {return mDialogueWindow;}
|
||||
MWGui::ContainerWindow* getContainerWindow() {return mContainerWindow;}
|
||||
MWGui::InventoryWindow* getInventoryWindow() {return mInventoryWindow;}
|
||||
MWGui::BookWindow* getBookWindow() {return mBookWindow;}
|
||||
MWGui::ScrollWindow* getScrollWindow() {return mScrollWindow;}
|
||||
MWGui::CountDialog* getCountDialog() {return mCountDialog;}
|
||||
MWGui::ConfirmationDialog* getConfirmationDialog() {return mConfirmationDialog;}
|
||||
MWGui::TradeWindow* getTradeWindow() {return mTradeWindow;}
|
||||
MWGui::SpellWindow* getSpellWindow() {return mSpellWindow;}
|
||||
MWGui::Console* getConsole() {return mConsole;}
|
||||
|
||||
MyGUI::Gui* getGui() const { return mGui; }
|
||||
|
||||
void wmUpdateFps(float fps, unsigned int triangleCount, unsigned int batchCount)
|
||||
{
|
||||
mFPS = fps;
|
||||
mTriangleCount = triangleCount;
|
||||
mBatchCount = batchCount;
|
||||
}
|
||||
|
||||
// MWMechanics::DynamicStat<int> getValue(const std::string& id);
|
||||
|
||||
///< Set value for the given ID.
|
||||
void setValue (const std::string& id, const MWMechanics::Stat<int>& value);
|
||||
void setValue(const ESM::Skill::SkillEnum parSkill, const MWMechanics::Stat<float>& value);
|
||||
void setValue (const std::string& id, const MWMechanics::DynamicStat<int>& value);
|
||||
void setValue (const std::string& id, const std::string& value);
|
||||
void setValue (const std::string& id, int value);
|
||||
|
||||
void setPlayerClass (const ESM::Class &class_); ///< set current class of player
|
||||
void configureSkills (const SkillList& major, const SkillList& minor); ///< configure skill groups, each set contains the skill ID for that group.
|
||||
void setReputation (int reputation); ///< set the current reputation value
|
||||
void setBounty (int bounty); ///< set the current bounty value
|
||||
void updateSkillArea(); ///< update display of skills, factions, birth sign, reputation and bounty
|
||||
|
||||
void changeCell(MWWorld::CellStore* cell); ///< change the active cell
|
||||
void setPlayerPos(const float x, const float y); ///< set player position in map space
|
||||
void setPlayerDir(const float x, const float y); ///< set player view direction in map space
|
||||
|
||||
void setFocusObject(const MWWorld::Ptr& focus);
|
||||
void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y);
|
||||
|
||||
void setMouseVisible(bool visible);
|
||||
void getMousePosition(int &x, int &y);
|
||||
void getMousePosition(float &x, float &y);
|
||||
void setDragDrop(bool dragDrop);
|
||||
bool getWorldMouseOver();
|
||||
|
||||
void toggleFogOfWar();
|
||||
void toggleFullHelp(); ///< show extra info in item tooltips (owner, script)
|
||||
bool getFullHelp() const;
|
||||
|
||||
void setInteriorMapTexture(const int x, const int y);
|
||||
///< set the index of the map texture that should be used (for interiors)
|
||||
|
||||
// sets the visibility of the hud health/magicka/stamina bars
|
||||
void setHMSVisibility(bool visible);
|
||||
// sets the visibility of the hud minimap
|
||||
void setMinimapVisibility(bool visible);
|
||||
void setWeaponVisibility(bool visible);
|
||||
void setSpellVisibility(bool visible);
|
||||
|
||||
void setSelectedSpell(const std::string& spellId, int successChancePercent);
|
||||
void setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent);
|
||||
void setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent);
|
||||
void unsetSelectedSpell();
|
||||
void unsetSelectedWeapon();
|
||||
|
||||
template<typename T>
|
||||
void removeDialog(T*& dialog); ///< Casts to OEngine::GUI::Layout and calls removeDialog, then resets pointer to nullptr.
|
||||
void removeDialog(OEngine::GUI::Layout* dialog); ///< Hides dialog and schedules dialog to be deleted.
|
||||
|
||||
void messageBox (const std::string& message, const std::vector<std::string>& buttons);
|
||||
int readPressedButton (); ///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
||||
|
||||
void onFrame (float frameDuration);
|
||||
|
||||
std::map<ESM::Skill::SkillEnum, MWMechanics::Stat<float> > getPlayerSkillValues() { return mPlayerSkillValues; }
|
||||
std::map<ESM::Attribute::AttributeID, MWMechanics::Stat<int> > getPlayerAttributeValues() { return mPlayerAttributes; }
|
||||
SkillList getPlayerMinorSkills() { return mPlayerMinorSkills; }
|
||||
SkillList getPlayerMajorSkills() { return mPlayerMajorSkills; }
|
||||
|
||||
/**
|
||||
* Fetches a GMST string from the store, if there is no setting with the given
|
||||
* ID or it is not a string the default string is returned.
|
||||
*
|
||||
* @param id Identifier for the GMST setting, e.g. "aName"
|
||||
* @param default Default value if the GMST setting cannot be used.
|
||||
*/
|
||||
const std::string &getGameSettingString(const std::string &id, const std::string &default_);
|
||||
|
||||
const ESMS::ESMStore& getStore() const;
|
||||
|
||||
void processChangedSettings(const Settings::CategorySettingVector& changed);
|
||||
|
||||
void executeInConsole (const std::string& path);
|
||||
|
||||
private:
|
||||
OEngine::GUI::MyGUIManager *mGuiManager;
|
||||
HUD *mHud;
|
||||
MapWindow *mMap;
|
||||
MainMenu *mMenu;
|
||||
ToolTips *mToolTips;
|
||||
StatsWindow *mStatsWindow;
|
||||
MessageBoxManager *mMessageBoxManager;
|
||||
Console *mConsole;
|
||||
JournalWindow* mJournal;
|
||||
DialogueWindow *mDialogueWindow;
|
||||
ContainerWindow *mContainerWindow;
|
||||
DragAndDrop* mDragAndDrop;
|
||||
InventoryWindow *mInventoryWindow;
|
||||
ScrollWindow* mScrollWindow;
|
||||
BookWindow* mBookWindow;
|
||||
CountDialog* mCountDialog;
|
||||
TradeWindow* mTradeWindow;
|
||||
SettingsWindow* mSettingsWindow;
|
||||
ConfirmationDialog* mConfirmationDialog;
|
||||
AlchemyWindow* mAlchemyWindow;
|
||||
SpellWindow* mSpellWindow;
|
||||
|
||||
CharacterCreation* mCharGen;
|
||||
|
||||
// Various stats about player as needed by window manager
|
||||
ESM::Class mPlayerClass;
|
||||
std::string mPlayerName;
|
||||
std::string mPlayerRaceId;
|
||||
std::map<ESM::Attribute::AttributeID, MWMechanics::Stat<int> > mPlayerAttributes;
|
||||
SkillList mPlayerMajorSkills, mPlayerMinorSkills;
|
||||
std::map<ESM::Skill::SkillEnum, MWMechanics::Stat<float> > mPlayerSkillValues;
|
||||
MWMechanics::DynamicStat<int> mPlayerHealth, mPlayerMagicka, mPlayerFatigue;
|
||||
|
||||
|
||||
MyGUI::Gui *mGui; // Gui
|
||||
std::vector<GuiMode> mGuiModes;
|
||||
|
||||
std::vector<OEngine::GUI::Layout*> mGarbageDialogs;
|
||||
void cleanupGarbage();
|
||||
|
||||
GuiWindow mShown; // Currently shown windows in inventory mode
|
||||
|
||||
/* Currently ALLOWED windows in inventory mode. This is used at
|
||||
the start of the game, when windows are enabled one by one
|
||||
through script commands. You can manipulate this through using
|
||||
allow() and disableAll().
|
||||
*/
|
||||
GuiWindow mAllowed;
|
||||
|
||||
void updateVisible(); // Update visibility of all windows based on mode, shown and allowed settings
|
||||
|
||||
int mShowFPSLevel;
|
||||
float mFPS;
|
||||
unsigned int mTriangleCount;
|
||||
unsigned int mBatchCount;
|
||||
|
||||
void onDialogueWindowBye();
|
||||
|
||||
/**
|
||||
* Called when MyGUI tries to retrieve a tag. This usually corresponds to a GMST string,
|
||||
* so this method will retrieve the GMST with the name \a _tag and place the result in \a _result
|
||||
*/
|
||||
void onRetrieveTag(const MyGUI::UString& _tag, MyGUI::UString& _result);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
void WindowManager::removeDialog(T*& dialog)
|
||||
{
|
||||
OEngine::GUI::Layout *d = static_cast<OEngine::GUI::Layout*>(dialog);
|
||||
removeDialog(d);
|
||||
dialog = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,9 +1,10 @@
|
|||
#include "window_pinnable_base.hpp"
|
||||
#include "window_manager.hpp"
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
using namespace MWGui;
|
||||
|
||||
WindowPinnableBase::WindowPinnableBase(const std::string& parLayout, WindowManager& parWindowManager)
|
||||
WindowPinnableBase::WindowPinnableBase(const std::string& parLayout, MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase(parLayout, parWindowManager), mPinned(false), mVisible(false)
|
||||
{
|
||||
MyGUI::WindowPtr t = static_cast<MyGUI::WindowPtr>(mMainWidget);
|
||||
|
@ -30,4 +31,3 @@ void WindowPinnableBase::onWindowButtonPressed(MyGUI::Window* sender, const std:
|
|||
|
||||
eventDone(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,13 +10,13 @@ namespace MWGui
|
|||
class WindowPinnableBase: public WindowBase
|
||||
{
|
||||
public:
|
||||
WindowPinnableBase(const std::string& parLayout, WindowManager& parWindowManager);
|
||||
WindowPinnableBase(const std::string& parLayout, MWBase::WindowManager& parWindowManager);
|
||||
void setVisible(bool b);
|
||||
bool pinned() { return mPinned; }
|
||||
|
||||
private:
|
||||
void onWindowButtonPressed(MyGUI::Window* sender, const std::string& eventName);
|
||||
|
||||
|
||||
protected:
|
||||
virtual void onPinToggled() = 0;
|
||||
|
||||
|
@ -26,4 +26,3 @@ namespace MWGui
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,4 +1,25 @@
|
|||
#include "window_manager.hpp"
|
||||
#include "windowmanagerimp.hpp"
|
||||
|
||||
#include <cassert>
|
||||
#include <iterator>
|
||||
|
||||
#include "MyGUI_UString.h"
|
||||
|
||||
#include <openengine/ogre/renderer.hpp>
|
||||
#include <openengine/gui/manager.hpp>
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/inputmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
|
||||
#include "console.hpp"
|
||||
#include "journalwindow.hpp"
|
||||
#include "charactercreation.hpp"
|
||||
#include "text_input.hpp"
|
||||
#include "review.hpp"
|
||||
#include "dialogue.hpp"
|
||||
|
@ -21,23 +42,6 @@
|
|||
#include "alchemywindow.hpp"
|
||||
#include "spellwindow.hpp"
|
||||
|
||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
|
||||
#include "console.hpp"
|
||||
#include "journalwindow.hpp"
|
||||
#include "charactercreation.hpp"
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <iterator>
|
||||
|
||||
using namespace MWGui;
|
||||
|
||||
WindowManager::WindowManager(
|
||||
|
@ -130,6 +134,8 @@ WindowManager::WindowManager(
|
|||
mAlchemyWindow = new AlchemyWindow(*this);
|
||||
mSpellWindow = new SpellWindow(*this);
|
||||
|
||||
mInputBlocker = mGui->createWidget<MyGUI::Widget>("",0,0,w,h,MyGUI::Align::Default,"Windows","");
|
||||
|
||||
// The HUD is always on
|
||||
mHud->setVisible(true);
|
||||
|
||||
|
@ -155,7 +161,6 @@ WindowManager::WindowManager(
|
|||
|
||||
WindowManager::~WindowManager()
|
||||
{
|
||||
delete mGuiManager;
|
||||
delete mConsole;
|
||||
delete mMessageBoxManager;
|
||||
delete mHud;
|
||||
|
@ -178,6 +183,8 @@ WindowManager::~WindowManager()
|
|||
delete mSpellWindow;
|
||||
|
||||
cleanupGarbage();
|
||||
|
||||
delete mGuiManager;
|
||||
}
|
||||
|
||||
void WindowManager::cleanupGarbage()
|
||||
|
@ -225,11 +232,16 @@ void WindowManager::updateVisible()
|
|||
|
||||
bool gameMode = !isGuiMode();
|
||||
|
||||
mInputBlocker->setVisible (gameMode);
|
||||
|
||||
if (gameMode)
|
||||
mToolTips->enterGameMode();
|
||||
else
|
||||
mToolTips->enterGuiMode();
|
||||
|
||||
if (gameMode)
|
||||
MyGUI::InputManager::getInstance ().setKeyFocusWidget (NULL);
|
||||
|
||||
setMinimapVisibility((mAllowed & GW_Map) && !mMap->pinned());
|
||||
setWeaponVisibility((mAllowed & GW_Inventory) && !mInventoryWindow->pinned());
|
||||
setSpellVisibility((mAllowed & GW_Magic) && !mSpellWindow->pinned());
|
||||
|
@ -339,10 +351,12 @@ void WindowManager::setValue (const std::string& id, const MWMechanics::Stat<int
|
|||
}
|
||||
|
||||
|
||||
void WindowManager::setValue(const ESM::Skill::SkillEnum parSkill, const MWMechanics::Stat<float>& value)
|
||||
void WindowManager::setValue (int parSkill, const MWMechanics::Stat<float>& value)
|
||||
{
|
||||
mStatsWindow->setValue(parSkill, value);
|
||||
mCharGen->setValue(parSkill, value);
|
||||
/// \todo Don't use the skill enum as a parameter type (we will have to drop it anyway, once we
|
||||
/// allow custom skills.
|
||||
mStatsWindow->setValue(static_cast<ESM::Skill::SkillEnum> (parSkill), value);
|
||||
mCharGen->setValue(static_cast<ESM::Skill::SkillEnum> (parSkill), value);
|
||||
mPlayerSkillValues[parSkill] = value;
|
||||
}
|
||||
|
||||
|
@ -425,7 +439,6 @@ void WindowManager::updateSkillArea()
|
|||
|
||||
void WindowManager::removeDialog(OEngine::GUI::Layout*dialog)
|
||||
{
|
||||
assert(dialog);
|
||||
if (!dialog)
|
||||
return;
|
||||
dialog->setVisible(false);
|
||||
|
@ -492,11 +505,6 @@ void WindowManager::onFrame (float frameDuration)
|
|||
mConsole->checkReferenceAvailable();
|
||||
}
|
||||
|
||||
const ESMS::ESMStore& WindowManager::getStore() const
|
||||
{
|
||||
return MWBase::Environment::get().getWorld()->getStore();
|
||||
}
|
||||
|
||||
void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell)
|
||||
{
|
||||
if (!(cell->cell->data.flags & ESM::Cell::Interior))
|
||||
|
@ -639,11 +647,13 @@ void WindowManager::processChangedSettings(const Settings::CategorySettingVector
|
|||
int y = Settings::Manager::getInt("resolution y", "Video");
|
||||
mHud->onResChange(x, y);
|
||||
mConsole->onResChange(x, y);
|
||||
mMenu->onResChange(x, y);
|
||||
mSettingsWindow->center();
|
||||
mAlchemyWindow->center();
|
||||
mScrollWindow->center();
|
||||
mBookWindow->center();
|
||||
mDragAndDrop->mDragAndDropWidget->setSize(MyGUI::IntSize(x, y));
|
||||
mInputBlocker->setSize(MyGUI::IntSize(x,y));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -745,3 +755,95 @@ void WindowManager::executeInConsole (const std::string& path)
|
|||
{
|
||||
mConsole->executeFile (path);
|
||||
}
|
||||
|
||||
void WindowManager::wmUpdateFps(float fps, unsigned int triangleCount, unsigned int batchCount)
|
||||
{
|
||||
mFPS = fps;
|
||||
mTriangleCount = triangleCount;
|
||||
mBatchCount = batchCount;
|
||||
}
|
||||
|
||||
MyGUI::Gui* WindowManager::getGui() const { return mGui; }
|
||||
|
||||
MWGui::DialogueWindow* WindowManager::getDialogueWindow() { return mDialogueWindow; }
|
||||
MWGui::ContainerWindow* WindowManager::getContainerWindow() { return mContainerWindow; }
|
||||
MWGui::InventoryWindow* WindowManager::getInventoryWindow() { return mInventoryWindow; }
|
||||
MWGui::BookWindow* WindowManager::getBookWindow() { return mBookWindow; }
|
||||
MWGui::ScrollWindow* WindowManager::getScrollWindow() { return mScrollWindow; }
|
||||
MWGui::CountDialog* WindowManager::getCountDialog() { return mCountDialog; }
|
||||
MWGui::ConfirmationDialog* WindowManager::getConfirmationDialog() { return mConfirmationDialog; }
|
||||
MWGui::TradeWindow* WindowManager::getTradeWindow() { return mTradeWindow; }
|
||||
MWGui::SpellWindow* WindowManager::getSpellWindow() { return mSpellWindow; }
|
||||
MWGui::Console* WindowManager::getConsole() { return mConsole; }
|
||||
|
||||
bool WindowManager::isAllowed (GuiWindow wnd) const
|
||||
{
|
||||
return mAllowed & wnd;
|
||||
}
|
||||
|
||||
void WindowManager::allow (GuiWindow wnd)
|
||||
{
|
||||
mAllowed = (GuiWindow)(mAllowed | wnd);
|
||||
updateVisible();
|
||||
}
|
||||
|
||||
void WindowManager::disallowAll()
|
||||
{
|
||||
mAllowed = GW_None;
|
||||
updateVisible();
|
||||
}
|
||||
|
||||
void WindowManager::toggleVisible (GuiWindow wnd)
|
||||
{
|
||||
mShown = (mShown & wnd) ? (GuiWindow) (mShown & ~wnd) : (GuiWindow) (mShown | wnd);
|
||||
updateVisible();
|
||||
}
|
||||
|
||||
bool WindowManager::isGuiMode() const
|
||||
{
|
||||
return !mGuiModes.empty();
|
||||
}
|
||||
|
||||
MWGui::GuiMode WindowManager::getMode() const
|
||||
{
|
||||
if (mGuiModes.empty())
|
||||
throw std::runtime_error ("getMode() called, but there is no active mode");
|
||||
|
||||
return mGuiModes.back();
|
||||
}
|
||||
|
||||
std::map<int, MWMechanics::Stat<float> > WindowManager::getPlayerSkillValues()
|
||||
{
|
||||
return mPlayerSkillValues;
|
||||
}
|
||||
|
||||
std::map<int, MWMechanics::Stat<int> > WindowManager::getPlayerAttributeValues()
|
||||
{
|
||||
return mPlayerAttributes;
|
||||
}
|
||||
|
||||
WindowManager::SkillList WindowManager::getPlayerMinorSkills()
|
||||
{
|
||||
return mPlayerMinorSkills;
|
||||
}
|
||||
|
||||
WindowManager::SkillList WindowManager::getPlayerMajorSkills()
|
||||
{
|
||||
return mPlayerMajorSkills;
|
||||
}
|
||||
|
||||
void WindowManager::disallowMouse()
|
||||
{
|
||||
mInputBlocker->setVisible (true);
|
||||
}
|
||||
|
||||
void WindowManager::allowMouse()
|
||||
{
|
||||
mInputBlocker->setVisible (!isGuiMode ());
|
||||
}
|
||||
|
||||
void WindowManager::notifyInputActionBound ()
|
||||
{
|
||||
mSettingsWindow->updateControlsBox ();
|
||||
allowMouse();
|
||||
}
|
260
apps/openmw/mwgui/windowmanagerimp.hpp
Normal file
260
apps/openmw/mwgui/windowmanagerimp.hpp
Normal file
|
@ -0,0 +1,260 @@
|
|||
#ifndef MWGUI_WINDOWMANAGERIMP_H
|
||||
#define MWGUI_WINDOWMANAGERIMP_H
|
||||
|
||||
/**
|
||||
This class owns and controls all the MW specific windows in the
|
||||
GUI. It can enable/disable Gui mode, and is responsible for sending
|
||||
and retrieving information from the Gui.
|
||||
|
||||
MyGUI should be initialized separately before creating instances of
|
||||
this class.
|
||||
**/
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <components/esm/loadclas.hpp>
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
namespace MyGUI
|
||||
{
|
||||
class Gui;
|
||||
class Widget;
|
||||
class UString;
|
||||
}
|
||||
|
||||
namespace Compiler
|
||||
{
|
||||
class Extensions;
|
||||
}
|
||||
|
||||
namespace OEngine
|
||||
{
|
||||
namespace GUI
|
||||
{
|
||||
class Layout;
|
||||
class MyGUIManager;
|
||||
}
|
||||
|
||||
namespace Render
|
||||
{
|
||||
class OgreRenderer;
|
||||
}
|
||||
}
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class WindowBase;
|
||||
class HUD;
|
||||
class MapWindow;
|
||||
class MainMenu;
|
||||
class StatsWindow;
|
||||
class InventoryWindow;
|
||||
class JournalWindow;
|
||||
class CharacterCreation;
|
||||
class DragAndDrop;
|
||||
class ToolTips;
|
||||
class TextInputDialog;
|
||||
class InfoBoxDialog;
|
||||
class MessageBoxManager;
|
||||
class SettingsWindow;
|
||||
class AlchemyWindow;
|
||||
|
||||
class WindowManager : public MWBase::WindowManager
|
||||
{
|
||||
public:
|
||||
typedef std::pair<std::string, int> Faction;
|
||||
typedef std::vector<Faction> FactionList;
|
||||
|
||||
WindowManager(const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string& logpath, bool consoleOnlyScripts);
|
||||
virtual ~WindowManager();
|
||||
|
||||
/**
|
||||
* Should be called each frame to update windows/gui elements.
|
||||
* This could mean updating sizes of gui elements or opening
|
||||
* new dialogs.
|
||||
*/
|
||||
virtual void update();
|
||||
|
||||
virtual void pushGuiMode(GuiMode mode);
|
||||
virtual void popGuiMode();
|
||||
virtual void removeGuiMode(GuiMode mode); ///< can be anywhere in the stack
|
||||
|
||||
virtual GuiMode getMode() const;
|
||||
|
||||
virtual bool isGuiMode() const;
|
||||
|
||||
virtual void toggleVisible(GuiWindow wnd);
|
||||
|
||||
// Disallow all inventory mode windows
|
||||
virtual void disallowAll();
|
||||
|
||||
// Allow one or more windows
|
||||
virtual void allow(GuiWindow wnd);
|
||||
|
||||
virtual bool isAllowed(GuiWindow wnd) const;
|
||||
|
||||
/// \todo investigate, if we really need to expose every single lousy UI element to the outside world
|
||||
virtual MWGui::DialogueWindow* getDialogueWindow();
|
||||
virtual MWGui::ContainerWindow* getContainerWindow();
|
||||
virtual MWGui::InventoryWindow* getInventoryWindow();
|
||||
virtual MWGui::BookWindow* getBookWindow();
|
||||
virtual MWGui::ScrollWindow* getScrollWindow();
|
||||
virtual MWGui::CountDialog* getCountDialog();
|
||||
virtual MWGui::ConfirmationDialog* getConfirmationDialog();
|
||||
virtual MWGui::TradeWindow* getTradeWindow();
|
||||
virtual MWGui::SpellWindow* getSpellWindow();
|
||||
virtual MWGui::Console* getConsole();
|
||||
|
||||
virtual MyGUI::Gui* getGui() const;
|
||||
|
||||
virtual void wmUpdateFps(float fps, unsigned int triangleCount, unsigned int batchCount);
|
||||
|
||||
///< Set value for the given ID.
|
||||
virtual void setValue (const std::string& id, const MWMechanics::Stat<int>& value);
|
||||
virtual void setValue (int parSkill, const MWMechanics::Stat<float>& value);
|
||||
virtual void setValue (const std::string& id, const MWMechanics::DynamicStat<int>& value);
|
||||
virtual void setValue (const std::string& id, const std::string& value);
|
||||
virtual void setValue (const std::string& id, int value);
|
||||
|
||||
virtual void setPlayerClass (const ESM::Class &class_); ///< set current class of player
|
||||
virtual void configureSkills (const SkillList& major, const SkillList& minor); ///< configure skill groups, each set contains the skill ID for that group.
|
||||
virtual void setReputation (int reputation); ///< set the current reputation value
|
||||
virtual void setBounty (int bounty); ///< set the current bounty value
|
||||
virtual void updateSkillArea(); ///< update display of skills, factions, birth sign, reputation and bounty
|
||||
|
||||
virtual void changeCell(MWWorld::CellStore* cell); ///< change the active cell
|
||||
virtual void setPlayerPos(const float x, const float y); ///< set player position in map space
|
||||
virtual void setPlayerDir(const float x, const float y); ///< set player view direction in map space
|
||||
|
||||
virtual void setFocusObject(const MWWorld::Ptr& focus);
|
||||
virtual void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y);
|
||||
|
||||
virtual void setMouseVisible(bool visible);
|
||||
virtual void getMousePosition(int &x, int &y);
|
||||
virtual void getMousePosition(float &x, float &y);
|
||||
virtual void setDragDrop(bool dragDrop);
|
||||
virtual bool getWorldMouseOver();
|
||||
|
||||
virtual void toggleFogOfWar();
|
||||
virtual void toggleFullHelp(); ///< show extra info in item tooltips (owner, script)
|
||||
virtual bool getFullHelp() const;
|
||||
|
||||
virtual void setInteriorMapTexture(const int x, const int y);
|
||||
///< set the index of the map texture that should be used (for interiors)
|
||||
|
||||
// sets the visibility of the hud health/magicka/stamina bars
|
||||
virtual void setHMSVisibility(bool visible);
|
||||
// sets the visibility of the hud minimap
|
||||
virtual void setMinimapVisibility(bool visible);
|
||||
virtual void setWeaponVisibility(bool visible);
|
||||
virtual void setSpellVisibility(bool visible);
|
||||
|
||||
virtual void setSelectedSpell(const std::string& spellId, int successChancePercent);
|
||||
virtual void setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent);
|
||||
virtual void setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent);
|
||||
virtual void unsetSelectedSpell();
|
||||
virtual void unsetSelectedWeapon();
|
||||
|
||||
virtual void disallowMouse();
|
||||
virtual void allowMouse();
|
||||
virtual void notifyInputActionBound();
|
||||
|
||||
virtual void removeDialog(OEngine::GUI::Layout* dialog); ///< Hides dialog and schedules dialog to be deleted.
|
||||
|
||||
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons);
|
||||
virtual int readPressedButton (); ///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
||||
|
||||
virtual void onFrame (float frameDuration);
|
||||
|
||||
/// \todo get rid of this stuff. Move it to the respective UI element classes, if needed.
|
||||
virtual std::map<int, MWMechanics::Stat<float> > getPlayerSkillValues();
|
||||
virtual std::map<int, MWMechanics::Stat<int> > getPlayerAttributeValues();
|
||||
virtual SkillList getPlayerMinorSkills();
|
||||
virtual SkillList getPlayerMajorSkills();
|
||||
|
||||
/**
|
||||
* Fetches a GMST string from the store, if there is no setting with the given
|
||||
* ID or it is not a string the default string is returned.
|
||||
*
|
||||
* @param id Identifier for the GMST setting, e.g. "aName"
|
||||
* @param default Default value if the GMST setting cannot be used.
|
||||
*/
|
||||
virtual const std::string &getGameSettingString(const std::string &id, const std::string &default_);
|
||||
|
||||
virtual void processChangedSettings(const Settings::CategorySettingVector& changed);
|
||||
|
||||
virtual void executeInConsole (const std::string& path);
|
||||
|
||||
private:
|
||||
OEngine::GUI::MyGUIManager *mGuiManager;
|
||||
HUD *mHud;
|
||||
MapWindow *mMap;
|
||||
MainMenu *mMenu;
|
||||
ToolTips *mToolTips;
|
||||
StatsWindow *mStatsWindow;
|
||||
MessageBoxManager *mMessageBoxManager;
|
||||
Console *mConsole;
|
||||
JournalWindow* mJournal;
|
||||
DialogueWindow *mDialogueWindow;
|
||||
ContainerWindow *mContainerWindow;
|
||||
DragAndDrop* mDragAndDrop;
|
||||
InventoryWindow *mInventoryWindow;
|
||||
ScrollWindow* mScrollWindow;
|
||||
BookWindow* mBookWindow;
|
||||
CountDialog* mCountDialog;
|
||||
TradeWindow* mTradeWindow;
|
||||
SettingsWindow* mSettingsWindow;
|
||||
ConfirmationDialog* mConfirmationDialog;
|
||||
AlchemyWindow* mAlchemyWindow;
|
||||
SpellWindow* mSpellWindow;
|
||||
|
||||
CharacterCreation* mCharGen;
|
||||
|
||||
MyGUI::Widget* mInputBlocker;
|
||||
|
||||
/// \todo get rid of this stuff. Move it to the respective UI element classes, if needed.
|
||||
// Various stats about player as needed by window manager
|
||||
ESM::Class mPlayerClass;
|
||||
std::string mPlayerName;
|
||||
std::string mPlayerRaceId;
|
||||
std::map<int, MWMechanics::Stat<int> > mPlayerAttributes;
|
||||
SkillList mPlayerMajorSkills, mPlayerMinorSkills;
|
||||
std::map<int, MWMechanics::Stat<float> > mPlayerSkillValues;
|
||||
MWMechanics::DynamicStat<int> mPlayerHealth, mPlayerMagicka, mPlayerFatigue;
|
||||
|
||||
|
||||
MyGUI::Gui *mGui; // Gui
|
||||
std::vector<GuiMode> mGuiModes;
|
||||
|
||||
std::vector<OEngine::GUI::Layout*> mGarbageDialogs;
|
||||
void cleanupGarbage();
|
||||
|
||||
GuiWindow mShown; // Currently shown windows in inventory mode
|
||||
|
||||
/* Currently ALLOWED windows in inventory mode. This is used at
|
||||
the start of the game, when windows are enabled one by one
|
||||
through script commands. You can manipulate this through using
|
||||
allow() and disableAll().
|
||||
*/
|
||||
GuiWindow mAllowed;
|
||||
|
||||
void updateVisible(); // Update visibility of all windows based on mode, shown and allowed settings
|
||||
|
||||
int mShowFPSLevel;
|
||||
float mFPS;
|
||||
unsigned int mTriangleCount;
|
||||
unsigned int mBatchCount;
|
||||
|
||||
void onDialogueWindowBye();
|
||||
|
||||
/**
|
||||
* Called when MyGUI tries to retrieve a tag. This usually corresponds to a GMST string,
|
||||
* so this method will retrieve the GMST with the name \a _tag and place the result in \a _result
|
||||
*/
|
||||
void onRetrieveTag(const MyGUI::UString& _tag, MyGUI::UString& _result);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,508 +0,0 @@
|
|||
#include "inputmanager.hpp"
|
||||
|
||||
#include <OgreRoot.h>
|
||||
|
||||
#include <openengine/input/dispatcher.hpp>
|
||||
#include <openengine/input/poller.hpp>
|
||||
|
||||
#include <openengine/gui/events.hpp>
|
||||
|
||||
#include <openengine/ogre/renderer.hpp>
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
|
||||
#include <mangle/input/servers/ois_driver.hpp>
|
||||
#include <mangle/input/filters/eventlist.hpp>
|
||||
|
||||
#include <libs/platform/strings.h>
|
||||
|
||||
#include "mouselookevent.hpp"
|
||||
|
||||
#include "../engine.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <OgreRoot.h>
|
||||
#include <OIS/OIS.h>
|
||||
|
||||
namespace MWInput
|
||||
{
|
||||
enum Actions
|
||||
{
|
||||
A_Quit, // Exit the program
|
||||
|
||||
A_Screenshot, // Take a screenshot
|
||||
|
||||
A_Inventory, // Toggle inventory screen
|
||||
|
||||
A_Console, // Toggle console screen
|
||||
|
||||
A_MoveLeft, // Move player left / right
|
||||
A_MoveRight,
|
||||
A_MoveForward, // Forward / Backward
|
||||
A_MoveBackward,
|
||||
|
||||
A_Activate,
|
||||
|
||||
A_Use, //Use weapon, spell, etc.
|
||||
A_Jump,
|
||||
A_AutoMove, //Toggle Auto-move forward
|
||||
A_Rest, //Rest
|
||||
A_Journal, //Journal
|
||||
A_Weapon, //Draw/Sheath weapon
|
||||
A_Spell, //Ready/Unready Casting
|
||||
A_AlwaysRun, //Toggle Always Run
|
||||
A_CycleSpellLeft, //cycling through spells
|
||||
A_CycleSpellRight,
|
||||
A_CycleWeaponLeft,//Cycling through weapons
|
||||
A_CycleWeaponRight,
|
||||
A_ToggleSneak, //Toggles Sneak, add Push-Sneak later
|
||||
A_ToggleWalk, //Toggle Walking/Running
|
||||
A_Crouch,
|
||||
|
||||
A_QuickSave,
|
||||
A_QuickLoad,
|
||||
A_QuickMenu,
|
||||
A_GameMenu,
|
||||
A_ToggleWeapon,
|
||||
A_ToggleSpell,
|
||||
|
||||
A_LAST // Marker for the last item
|
||||
};
|
||||
|
||||
// Class that handles all input and key bindings for OpenMW
|
||||
class InputImpl
|
||||
{
|
||||
OEngine::Input::DispatcherPtr disp;
|
||||
OEngine::Render::OgreRenderer &ogre;
|
||||
Mangle::Input::OISDriver input;
|
||||
OEngine::Input::Poller poller;
|
||||
MouseLookEventPtr mouse;
|
||||
OEngine::GUI::EventInjectorPtr guiEvents;
|
||||
MWWorld::Player &player;
|
||||
MWGui::WindowManager &windows;
|
||||
OMW::Engine& mEngine;
|
||||
|
||||
bool mDragDrop;
|
||||
|
||||
std::map<std::string, bool> mControlSwitch;
|
||||
|
||||
/* InputImpl Methods */
|
||||
public:
|
||||
void adjustMouseRegion(int width, int height)
|
||||
{
|
||||
input.adjustMouseClippingSize(width, height);
|
||||
}
|
||||
private:
|
||||
void toggleSpell()
|
||||
{
|
||||
if (windows.isGuiMode()) return;
|
||||
|
||||
MWMechanics::DrawState_ state = player.getDrawState();
|
||||
if (state == MWMechanics::DrawState_Weapon || state == MWMechanics::DrawState_Nothing)
|
||||
{
|
||||
player.setDrawState(MWMechanics::DrawState_Spell);
|
||||
std::cout << "Player has now readied his hands for spellcasting!\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setDrawState(MWMechanics::DrawState_Nothing);
|
||||
std::cout << "Player does not have any kind of attack ready now.\n";
|
||||
}
|
||||
}
|
||||
|
||||
void toggleWeapon()
|
||||
{
|
||||
if (windows.isGuiMode()) return;
|
||||
|
||||
MWMechanics::DrawState_ state = player.getDrawState();
|
||||
if (state == MWMechanics::DrawState_Spell || state == MWMechanics::DrawState_Nothing)
|
||||
{
|
||||
player.setDrawState(MWMechanics::DrawState_Weapon);
|
||||
std::cout << "Player is now drawing his weapon.\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setDrawState(MWMechanics::DrawState_Nothing);
|
||||
std::cout << "Player does not have any kind of attack ready now.\n";
|
||||
}
|
||||
}
|
||||
|
||||
void screenshot()
|
||||
{
|
||||
mEngine.screenshot();
|
||||
|
||||
std::vector<std::string> empty;
|
||||
windows.messageBox ("Screenshot saved", empty);
|
||||
}
|
||||
|
||||
/* toggleInventory() is called when the user presses the button to toggle the inventory screen. */
|
||||
void toggleInventory()
|
||||
{
|
||||
using namespace MWGui;
|
||||
|
||||
if (mDragDrop)
|
||||
return;
|
||||
|
||||
bool gameMode = !windows.isGuiMode();
|
||||
|
||||
// Toggle between game mode and inventory mode
|
||||
if(gameMode)
|
||||
windows.pushGuiMode(GM_Inventory);
|
||||
else if(windows.getMode() == GM_Inventory)
|
||||
windows.popGuiMode();
|
||||
|
||||
// .. but don't touch any other mode.
|
||||
}
|
||||
|
||||
// Toggle console
|
||||
void toggleConsole()
|
||||
{
|
||||
using namespace MWGui;
|
||||
|
||||
if (mDragDrop)
|
||||
return;
|
||||
|
||||
bool gameMode = !windows.isGuiMode();
|
||||
|
||||
// Switch to console mode no matter what mode we are currently
|
||||
// in, except of course if we are already in console mode
|
||||
if (!gameMode)
|
||||
{
|
||||
if (windows.getMode() == GM_Console)
|
||||
windows.popGuiMode();
|
||||
else
|
||||
windows.pushGuiMode(GM_Console);
|
||||
}
|
||||
else
|
||||
windows.pushGuiMode(GM_Console);
|
||||
}
|
||||
|
||||
void toggleJournal()
|
||||
{
|
||||
using namespace MWGui;
|
||||
|
||||
// Toggle between game mode and journal mode
|
||||
bool gameMode = !windows.isGuiMode();
|
||||
|
||||
if(gameMode)
|
||||
windows.pushGuiMode(GM_Journal);
|
||||
else if(windows.getMode() == GM_Journal)
|
||||
windows.popGuiMode();
|
||||
// .. but don't touch any other mode.
|
||||
}
|
||||
|
||||
void activate()
|
||||
{
|
||||
mEngine.activate();
|
||||
}
|
||||
|
||||
void toggleAutoMove()
|
||||
{
|
||||
if (windows.isGuiMode()) return;
|
||||
player.setAutoMove (!player.getAutoMove());
|
||||
}
|
||||
|
||||
void toggleWalking()
|
||||
{
|
||||
if (windows.isGuiMode()) return;
|
||||
player.toggleRunning();
|
||||
}
|
||||
|
||||
void toggleMainMenu()
|
||||
{
|
||||
if (windows.isGuiMode () && (windows.getMode () == MWGui::GM_MainMenu || windows.getMode () == MWGui::GM_Settings))
|
||||
windows.popGuiMode();
|
||||
else
|
||||
windows.pushGuiMode (MWGui::GM_MainMenu);
|
||||
}
|
||||
|
||||
// Exit program now button (which is disabled in GUI mode)
|
||||
void exitNow()
|
||||
{
|
||||
if(!windows.isGuiMode())
|
||||
Ogre::Root::getSingleton().queueEndRendering ();
|
||||
}
|
||||
|
||||
public:
|
||||
InputImpl(OEngine::Render::OgreRenderer &_ogre,
|
||||
MWWorld::Player &_player,
|
||||
MWGui::WindowManager &_windows,
|
||||
bool debug,
|
||||
OMW::Engine& engine)
|
||||
: ogre(_ogre),
|
||||
input(ogre.getWindow(), !debug),
|
||||
poller(input),
|
||||
player(_player),
|
||||
windows(_windows),
|
||||
mEngine (engine),
|
||||
mDragDrop(false)
|
||||
{
|
||||
using namespace OEngine::Input;
|
||||
using namespace OEngine::Render;
|
||||
using namespace OEngine::GUI;
|
||||
using namespace Mangle::Input;
|
||||
using namespace OIS;
|
||||
|
||||
disp = DispatcherPtr(new Dispatcher(A_LAST));
|
||||
|
||||
// Bind MW-specific functions
|
||||
disp->funcs.bind(A_Quit, boost::bind(&InputImpl::exitNow, this),
|
||||
"Quit program");
|
||||
disp->funcs.bind(A_Screenshot, boost::bind(&InputImpl::screenshot, this),
|
||||
"Screenshot");
|
||||
disp->funcs.bind(A_Inventory, boost::bind(&InputImpl::toggleInventory, this),
|
||||
"Toggle inventory screen");
|
||||
disp->funcs.bind(A_Console, boost::bind(&InputImpl::toggleConsole, this),
|
||||
"Toggle console");
|
||||
disp->funcs.bind(A_Journal, boost::bind(&InputImpl::toggleJournal, this),
|
||||
"Toggle journal");
|
||||
disp->funcs.bind(A_Activate, boost::bind(&InputImpl::activate, this),
|
||||
"Activate");
|
||||
disp->funcs.bind(A_AutoMove, boost::bind(&InputImpl::toggleAutoMove, this),
|
||||
"Auto Move");
|
||||
disp->funcs.bind(A_ToggleWalk, boost::bind(&InputImpl::toggleWalking, this),
|
||||
"Toggle Walk/Run");
|
||||
disp->funcs.bind(A_ToggleWeapon,boost::bind(&InputImpl::toggleWeapon,this),
|
||||
"Draw Weapon");
|
||||
disp->funcs.bind(A_ToggleSpell,boost::bind(&InputImpl::toggleSpell,this),
|
||||
"Ready hands");
|
||||
disp->funcs.bind(A_GameMenu, boost::bind(&InputImpl::toggleMainMenu, this),
|
||||
"Toggle main menu");
|
||||
|
||||
mouse = MouseLookEventPtr(new MouseLookEvent());
|
||||
|
||||
// This event handler pumps events into MyGUI
|
||||
guiEvents = EventInjectorPtr(new EventInjector(windows.getGui()));
|
||||
|
||||
// Hook 'mouse' and 'disp' up as event handlers into 'input'
|
||||
// (the OIS driver and event source.) We do this through an
|
||||
// EventList which dispatches the event to multiple handlers for
|
||||
// us.
|
||||
{
|
||||
EventList *lst = new EventList;
|
||||
input.setEvent(EventPtr(lst));
|
||||
lst->add(mouse,Event::EV_MouseMove);
|
||||
lst->add(disp,Event::EV_KeyDown);
|
||||
lst->add(guiEvents,Event::EV_ALL);
|
||||
}
|
||||
|
||||
mControlSwitch["playercontrols"] = true;
|
||||
mControlSwitch["playerfighting"] = true;
|
||||
mControlSwitch["playerjumping"] = true;
|
||||
mControlSwitch["playerlooking"] = true;
|
||||
mControlSwitch["playermagic"] = true;
|
||||
mControlSwitch["playerviewswitch"] = true;
|
||||
mControlSwitch["vanitymode"] = true;
|
||||
|
||||
changeInputMode(false);
|
||||
|
||||
/**********************************
|
||||
Key binding section
|
||||
|
||||
The rest of this function has hard coded key bindings, and is
|
||||
intended to be replaced by user defined bindings later.
|
||||
**********************************/
|
||||
|
||||
// Key bindings for keypress events
|
||||
// NOTE: These keys do not require constant polling - use in conjuction with variables in loops.
|
||||
|
||||
disp->bind(A_Quit, KC_Q);
|
||||
disp->bind(A_GameMenu, KC_ESCAPE);
|
||||
disp->bind(A_Screenshot, KC_SYSRQ);
|
||||
disp->bind(A_Inventory, KC_I);
|
||||
disp->bind(A_Console, KC_F1);
|
||||
disp->bind(A_Journal, KC_J);
|
||||
disp->bind(A_Activate, KC_SPACE);
|
||||
disp->bind(A_AutoMove, KC_Z);
|
||||
disp->bind(A_ToggleSneak, KC_X);
|
||||
disp->bind(A_ToggleWalk, KC_C);
|
||||
disp->bind(A_ToggleWeapon,KC_F);
|
||||
disp->bind(A_ToggleSpell,KC_R);
|
||||
|
||||
// Key bindings for polled keys
|
||||
// NOTE: These keys are constantly being polled. Only add keys that must be checked each frame.
|
||||
|
||||
// Arrow keys
|
||||
poller.bind(A_MoveLeft, KC_LEFT);
|
||||
poller.bind(A_MoveRight, KC_RIGHT);
|
||||
poller.bind(A_MoveForward, KC_UP);
|
||||
poller.bind(A_MoveBackward, KC_DOWN);
|
||||
|
||||
// WASD keys
|
||||
poller.bind(A_MoveLeft, KC_A);
|
||||
poller.bind(A_MoveRight, KC_D);
|
||||
poller.bind(A_MoveForward, KC_W);
|
||||
poller.bind(A_MoveBackward, KC_S);
|
||||
|
||||
poller.bind(A_Jump, KC_E);
|
||||
poller.bind(A_Crouch, KC_LCONTROL);
|
||||
}
|
||||
|
||||
void setDragDrop(bool dragDrop)
|
||||
{
|
||||
mDragDrop = dragDrop;
|
||||
}
|
||||
|
||||
//NOTE: Used to check for movement keys
|
||||
void update ()
|
||||
{
|
||||
// Tell OIS to handle all input events
|
||||
input.capture();
|
||||
|
||||
// Update windows/gui as a result of input events
|
||||
// For instance this could mean opening a new window/dialog,
|
||||
// by doing this after the input events are handled we
|
||||
// ensure that window/gui changes appear quickly while
|
||||
// avoiding that window/gui changes does not happen in
|
||||
// event callbacks (which may crash)
|
||||
windows.update();
|
||||
|
||||
// Disable movement in Gui mode
|
||||
|
||||
if (windows.isGuiMode()) return;
|
||||
|
||||
// Configure player movement according to keyboard input. Actual movement will
|
||||
// be done in the physics system.
|
||||
if (mControlSwitch["playercontrols"]) {
|
||||
if (poller.isDown(A_MoveLeft))
|
||||
{
|
||||
player.setAutoMove (false);
|
||||
player.setLeftRight (1);
|
||||
}
|
||||
else if (poller.isDown(A_MoveRight))
|
||||
{
|
||||
player.setAutoMove (false);
|
||||
player.setLeftRight (-1);
|
||||
}
|
||||
else
|
||||
player.setLeftRight (0);
|
||||
|
||||
if (poller.isDown(A_MoveForward))
|
||||
{
|
||||
player.setAutoMove (false);
|
||||
player.setForwardBackward (1);
|
||||
}
|
||||
else if (poller.isDown(A_MoveBackward))
|
||||
{
|
||||
player.setAutoMove (false);
|
||||
player.setForwardBackward (-1);
|
||||
}
|
||||
else
|
||||
player.setForwardBackward (0);
|
||||
|
||||
if (poller.isDown(A_Jump) && mControlSwitch["playerjumping"])
|
||||
player.setUpDown (1);
|
||||
else if (poller.isDown(A_Crouch))
|
||||
player.setUpDown (-1);
|
||||
else
|
||||
player.setUpDown (0);
|
||||
}
|
||||
}
|
||||
|
||||
// Switch between gui modes. Besides controlling the Gui windows
|
||||
// this also makes sure input is directed to the right place
|
||||
void changeInputMode(bool guiMode)
|
||||
{
|
||||
// Are we in GUI mode now?
|
||||
if(guiMode)
|
||||
{
|
||||
// Disable mouse look
|
||||
mouse->disable();
|
||||
|
||||
// Enable GUI events
|
||||
guiEvents->enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Start mouse-looking again if allowed.
|
||||
if (mControlSwitch["playerlooking"]) {
|
||||
mouse->enable();
|
||||
}
|
||||
|
||||
// Disable GUI events
|
||||
guiEvents->enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
void toggleControlSwitch(std::string sw, bool value)
|
||||
{
|
||||
if (mControlSwitch[sw] == value) {
|
||||
return;
|
||||
}
|
||||
/// \note 7 switches at all, if-else is relevant
|
||||
if (sw == "playercontrols" && !value) {
|
||||
player.setLeftRight(0);
|
||||
player.setForwardBackward(0);
|
||||
player.setAutoMove(false);
|
||||
player.setUpDown(0);
|
||||
} else if (sw == "playerjumping" && !value) {
|
||||
/// \fixme maybe crouching at this time
|
||||
player.setUpDown(0);
|
||||
} else if (sw == "playerlooking") {
|
||||
if (value) {
|
||||
mouse->enable();
|
||||
} else {
|
||||
mouse->disable();
|
||||
}
|
||||
}
|
||||
mControlSwitch[sw] = value;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/***CONSTRUCTOR***/
|
||||
MWInputManager::MWInputManager(OEngine::Render::OgreRenderer &ogre,
|
||||
MWWorld::Player &player,
|
||||
MWGui::WindowManager &windows,
|
||||
bool debug,
|
||||
OMW::Engine& engine)
|
||||
{
|
||||
impl = new InputImpl(ogre,player,windows,debug, engine);
|
||||
}
|
||||
|
||||
/***DESTRUCTOR***/
|
||||
MWInputManager::~MWInputManager()
|
||||
{
|
||||
delete impl;
|
||||
}
|
||||
|
||||
void MWInputManager::update()
|
||||
{
|
||||
impl->update();
|
||||
}
|
||||
|
||||
void MWInputManager::setDragDrop(bool dragDrop)
|
||||
{
|
||||
impl->setDragDrop(dragDrop);
|
||||
}
|
||||
|
||||
void MWInputManager::changeInputMode(bool guiMode)
|
||||
{
|
||||
impl->changeInputMode(guiMode);
|
||||
}
|
||||
|
||||
void MWInputManager::processChangedSettings(const Settings::CategorySettingVector& changed)
|
||||
{
|
||||
bool changeRes = false;
|
||||
for (Settings::CategorySettingVector::const_iterator it = changed.begin();
|
||||
it != changed.end(); ++it)
|
||||
{
|
||||
if (it->first == "Video" && (
|
||||
it->second == "resolution x"
|
||||
|| it->second == "resolution y"))
|
||||
changeRes = true;
|
||||
}
|
||||
|
||||
if (changeRes)
|
||||
impl->adjustMouseRegion(Settings::Manager::getInt("resolution x", "Video"), Settings::Manager::getInt("resolution y", "Video"));
|
||||
}
|
||||
|
||||
void MWInputManager::toggleControlSwitch(std::string sw, bool value)
|
||||
{
|
||||
impl->toggleControlSwitch(sw, value);
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
#ifndef _MWINPUT_MWINPUTMANAGER_H
|
||||
#define _MWINPUT_MWINPUTMANAGER_H
|
||||
|
||||
#include "../mwgui/mode.hpp"
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
namespace OEngine
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
class OgreRenderer;
|
||||
}
|
||||
}
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class Player;
|
||||
}
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class WindowManager;
|
||||
}
|
||||
|
||||
namespace OMW
|
||||
{
|
||||
class Engine;
|
||||
}
|
||||
|
||||
namespace MWInput
|
||||
{
|
||||
// Forward declaration of the real implementation.
|
||||
class InputImpl;
|
||||
|
||||
/* Class that handles all input and key bindings for OpenMW.
|
||||
|
||||
This class is just an interface. All the messy details are in
|
||||
inputmanager.cpp.
|
||||
*/
|
||||
struct MWInputManager
|
||||
{
|
||||
InputImpl *impl;
|
||||
|
||||
public:
|
||||
MWInputManager(OEngine::Render::OgreRenderer &_ogre,
|
||||
MWWorld::Player&_player,
|
||||
MWGui::WindowManager &_windows,
|
||||
bool debug,
|
||||
OMW::Engine& engine);
|
||||
~MWInputManager();
|
||||
|
||||
void update();
|
||||
|
||||
void changeInputMode(bool guiMode);
|
||||
|
||||
void processChangedSettings(const Settings::CategorySettingVector& changed);
|
||||
|
||||
void setDragDrop(bool dragDrop);
|
||||
|
||||
void toggleControlSwitch(std::string sw, bool value);
|
||||
};
|
||||
}
|
||||
#endif
|
712
apps/openmw/mwinput/inputmanagerimp.cpp
Normal file
712
apps/openmw/mwinput/inputmanagerimp.cpp
Normal file
|
@ -0,0 +1,712 @@
|
|||
#include "inputmanagerimp.hpp"
|
||||
|
||||
#if defined(__APPLE__) && !defined(__LP64__)
|
||||
#include <Carbon/Carbon.h>
|
||||
#endif
|
||||
|
||||
#include <OgreRoot.h>
|
||||
#include <OgreRenderWindow.h>
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <OIS/OISInputManager.h>
|
||||
|
||||
#include <MyGUI_InputManager.h>
|
||||
#include <MyGUI_RenderManager.h>
|
||||
|
||||
#include <openengine/ogre/renderer.hpp>
|
||||
|
||||
#include "../engine.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
namespace MWInput
|
||||
{
|
||||
InputManager::InputManager(OEngine::Render::OgreRenderer &ogre,
|
||||
MWWorld::Player &player,
|
||||
MWBase::WindowManager &windows,
|
||||
bool debug,
|
||||
OMW::Engine& engine,
|
||||
const std::string& userFile, bool userFileExists)
|
||||
: mOgre(ogre)
|
||||
, mPlayer(player)
|
||||
, mWindows(windows)
|
||||
, mEngine(engine)
|
||||
, mMouseLookEnabled(true)
|
||||
, mMouseX(ogre.getWindow()->getWidth ()/2.f)
|
||||
, mMouseY(ogre.getWindow()->getHeight ()/2.f)
|
||||
, mUserFile(userFile)
|
||||
, mDragDrop(false)
|
||||
, mGuiCursorEnabled(false)
|
||||
, mInvertY (Settings::Manager::getBool("invert y axis", "Input"))
|
||||
, mCameraSensitivity (Settings::Manager::getFloat("camera sensitivity", "Input"))
|
||||
, mUISensitivity (Settings::Manager::getFloat("ui sensitivity", "Input"))
|
||||
, mCameraYMultiplier (Settings::Manager::getFloat("camera y multiplier", "Input"))
|
||||
, mUIYMultiplier (Settings::Manager::getFloat("ui y multiplier", "Input"))
|
||||
{
|
||||
Ogre::RenderWindow* window = ogre.getWindow ();
|
||||
size_t windowHnd;
|
||||
|
||||
window->getCustomAttribute("WINDOW", &windowHnd);
|
||||
|
||||
std::ostringstream windowHndStr;
|
||||
OIS::ParamList pl;
|
||||
|
||||
windowHndStr << windowHnd;
|
||||
pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
|
||||
|
||||
// Set non-exclusive mouse and keyboard input if the user requested
|
||||
// it.
|
||||
if (debug)
|
||||
{
|
||||
#if defined OIS_WIN32_PLATFORM
|
||||
pl.insert(std::make_pair(std::string("w32_mouse"),
|
||||
std::string("DISCL_FOREGROUND" )));
|
||||
pl.insert(std::make_pair(std::string("w32_mouse"),
|
||||
std::string("DISCL_NONEXCLUSIVE")));
|
||||
pl.insert(std::make_pair(std::string("w32_keyboard"),
|
||||
std::string("DISCL_FOREGROUND")));
|
||||
pl.insert(std::make_pair(std::string("w32_keyboard"),
|
||||
std::string("DISCL_NONEXCLUSIVE")));
|
||||
#elif defined OIS_LINUX_PLATFORM
|
||||
pl.insert(std::make_pair(std::string("x11_mouse_grab"),
|
||||
std::string("false")));
|
||||
pl.insert(std::make_pair(std::string("x11_mouse_hide"),
|
||||
std::string("false")));
|
||||
pl.insert(std::make_pair(std::string("x11_keyboard_grab"),
|
||||
std::string("false")));
|
||||
pl.insert(std::make_pair(std::string("XAutoRepeatOn"),
|
||||
std::string("true")));
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(__APPLE__) && !defined(__LP64__)
|
||||
// Give the application window focus to receive input events
|
||||
ProcessSerialNumber psn = { 0, kCurrentProcess };
|
||||
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
|
||||
SetFrontProcess(&psn);
|
||||
#endif
|
||||
|
||||
mInputManager = OIS::InputManager::createInputSystem( pl );
|
||||
|
||||
// Create all devices
|
||||
mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject
|
||||
( OIS::OISKeyboard, true ));
|
||||
mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject
|
||||
( OIS::OISMouse, true ));
|
||||
|
||||
mKeyboard->setEventCallback (this);
|
||||
mMouse->setEventCallback (this);
|
||||
|
||||
adjustMouseRegion (window->getWidth(), window->getHeight());
|
||||
|
||||
MyGUI::InputManager::getInstance().injectMouseMove(mMouseX, mMouseY, mMouse->getMouseState ().Z.abs);
|
||||
|
||||
std::string file = userFileExists ? userFile : "";
|
||||
mInputCtrl = new ICS::InputControlSystem(file, true, this, NULL, A_Last);
|
||||
|
||||
loadKeyDefaults();
|
||||
|
||||
for (int i = 0; i < A_Last; ++i)
|
||||
{
|
||||
mInputCtrl->getChannel (i)->addListener (this);
|
||||
}
|
||||
|
||||
mControlSwitch["playercontrols"] = true;
|
||||
mControlSwitch["playerfighting"] = true;
|
||||
mControlSwitch["playerjumping"] = true;
|
||||
mControlSwitch["playerlooking"] = true;
|
||||
mControlSwitch["playermagic"] = true;
|
||||
mControlSwitch["playerviewswitch"] = true;
|
||||
mControlSwitch["vanitymode"] = true;
|
||||
|
||||
changeInputMode(false);
|
||||
}
|
||||
|
||||
InputManager::~InputManager()
|
||||
{
|
||||
mInputCtrl->save (mUserFile);
|
||||
|
||||
delete mInputCtrl;
|
||||
|
||||
mInputManager->destroyInputObject(mKeyboard);
|
||||
mInputManager->destroyInputObject(mMouse);
|
||||
OIS::InputManager::destroyInputSystem(mInputManager);
|
||||
}
|
||||
|
||||
void InputManager::channelChanged(ICS::Channel* channel, float currentValue, float previousValue)
|
||||
{
|
||||
if (mDragDrop)
|
||||
return;
|
||||
|
||||
int action = channel->getNumber();
|
||||
if (currentValue == 1)
|
||||
{
|
||||
// trigger action activated
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case A_GameMenu:
|
||||
toggleMainMenu ();
|
||||
break;
|
||||
case A_Quit:
|
||||
exitNow();
|
||||
break;
|
||||
case A_Screenshot:
|
||||
screenshot();
|
||||
break;
|
||||
case A_Inventory:
|
||||
toggleInventory ();
|
||||
break;
|
||||
case A_Console:
|
||||
toggleConsole ();
|
||||
break;
|
||||
case A_Activate:
|
||||
activate();
|
||||
break;
|
||||
case A_Journal:
|
||||
toggleJournal ();
|
||||
break;
|
||||
case A_AutoMove:
|
||||
toggleAutoMove ();
|
||||
break;
|
||||
case A_ToggleSneak:
|
||||
/// \todo implement
|
||||
break;
|
||||
case A_ToggleWalk:
|
||||
toggleWalking ();
|
||||
break;
|
||||
case A_ToggleWeapon:
|
||||
toggleWeapon ();
|
||||
break;
|
||||
case A_ToggleSpell:
|
||||
toggleSpell ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InputManager::update(float dt)
|
||||
{
|
||||
// Tell OIS to handle all input events
|
||||
mKeyboard->capture();
|
||||
mMouse->capture();
|
||||
|
||||
// update values of channels (as a result of pressed keys)
|
||||
mInputCtrl->update(dt);
|
||||
|
||||
// Update windows/gui as a result of input events
|
||||
// For instance this could mean opening a new window/dialog,
|
||||
// by doing this after the input events are handled we
|
||||
// ensure that window/gui changes appear quickly while
|
||||
// avoiding that window/gui changes does not happen in
|
||||
// event callbacks (which may crash)
|
||||
mWindows.update();
|
||||
|
||||
// Disable movement in Gui mode
|
||||
if (mWindows.isGuiMode()) return;
|
||||
|
||||
|
||||
// Configure player movement according to keyboard input. Actual movement will
|
||||
// be done in the physics system.
|
||||
if (mControlSwitch["playercontrols"])
|
||||
{
|
||||
if (actionIsActive(A_MoveLeft))
|
||||
{
|
||||
mPlayer.setAutoMove (false);
|
||||
mPlayer.setLeftRight (1);
|
||||
}
|
||||
else if (actionIsActive(A_MoveRight))
|
||||
{
|
||||
mPlayer.setAutoMove (false);
|
||||
mPlayer.setLeftRight (-1);
|
||||
}
|
||||
else
|
||||
mPlayer.setLeftRight (0);
|
||||
|
||||
if (actionIsActive(A_MoveForward))
|
||||
{
|
||||
mPlayer.setAutoMove (false);
|
||||
mPlayer.setForwardBackward (1);
|
||||
}
|
||||
else if (actionIsActive(A_MoveBackward))
|
||||
{
|
||||
mPlayer.setAutoMove (false);
|
||||
mPlayer.setForwardBackward (-1);
|
||||
}
|
||||
else
|
||||
mPlayer.setForwardBackward (0);
|
||||
|
||||
if (actionIsActive(A_Jump) && mControlSwitch["playerjumping"])
|
||||
mPlayer.setUpDown (1);
|
||||
else if (actionIsActive(A_Crouch))
|
||||
mPlayer.setUpDown (-1);
|
||||
else
|
||||
mPlayer.setUpDown (0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void InputManager::setDragDrop(bool dragDrop)
|
||||
{
|
||||
mDragDrop = dragDrop;
|
||||
}
|
||||
|
||||
void InputManager::changeInputMode(bool guiMode)
|
||||
{
|
||||
// Are we in GUI mode now?
|
||||
if(guiMode)
|
||||
{
|
||||
// Disable mouse look
|
||||
mMouseLookEnabled = false;
|
||||
|
||||
// Enable GUI events
|
||||
mGuiCursorEnabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Start mouse-looking again if allowed.
|
||||
if (mControlSwitch["playerlooking"]) {
|
||||
mMouseLookEnabled = true;
|
||||
}
|
||||
|
||||
// Disable GUI events
|
||||
mGuiCursorEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
void InputManager::processChangedSettings(const Settings::CategorySettingVector& changed)
|
||||
{
|
||||
bool changeRes = false;
|
||||
for (Settings::CategorySettingVector::const_iterator it = changed.begin();
|
||||
it != changed.end(); ++it)
|
||||
{
|
||||
if (it->first == "Video" && (it->second == "resolution x" || it->second == "resolution y"))
|
||||
changeRes = true;
|
||||
|
||||
if (it->first == "Input" && it->second == "invert y axis")
|
||||
mInvertY = Settings::Manager::getBool("invert y axis", "Input");
|
||||
|
||||
if (it->first == "Input" && it->second == "camera sensitivity")
|
||||
mCameraSensitivity = Settings::Manager::getFloat("camera sensitivity", "Input");
|
||||
|
||||
if (it->first == "Input" && it->second == "ui sensitivity")
|
||||
mUISensitivity = Settings::Manager::getFloat("ui sensitivity", "Input");
|
||||
|
||||
}
|
||||
|
||||
if (changeRes)
|
||||
adjustMouseRegion(Settings::Manager::getInt("resolution x", "Video"), Settings::Manager::getInt("resolution y", "Video"));
|
||||
}
|
||||
|
||||
void InputManager::toggleControlSwitch (const std::string& sw, bool value)
|
||||
{
|
||||
if (mControlSwitch[sw] == value) {
|
||||
return;
|
||||
}
|
||||
/// \note 7 switches at all, if-else is relevant
|
||||
if (sw == "playercontrols" && !value) {
|
||||
mPlayer.setLeftRight(0);
|
||||
mPlayer.setForwardBackward(0);
|
||||
mPlayer.setAutoMove(false);
|
||||
mPlayer.setUpDown(0);
|
||||
} else if (sw == "playerjumping" && !value) {
|
||||
/// \fixme maybe crouching at this time
|
||||
mPlayer.setUpDown(0);
|
||||
} else if (sw == "playerlooking") {
|
||||
if (value) {
|
||||
mMouseLookEnabled = true;
|
||||
} else {
|
||||
mMouseLookEnabled = false;
|
||||
}
|
||||
}
|
||||
mControlSwitch[sw] = value;
|
||||
}
|
||||
|
||||
void InputManager::adjustMouseRegion(int width, int height)
|
||||
{
|
||||
const OIS::MouseState &ms = mMouse->getMouseState();
|
||||
ms.width = width;
|
||||
ms.height = height;
|
||||
}
|
||||
|
||||
bool InputManager::keyPressed( const OIS::KeyEvent &arg )
|
||||
{
|
||||
mInputCtrl->keyPressed (arg);
|
||||
|
||||
MyGUI::InputManager::getInstance().injectKeyPress(MyGUI::KeyCode::Enum(arg.key), arg.text);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InputManager::keyReleased( const OIS::KeyEvent &arg )
|
||||
{
|
||||
mInputCtrl->keyReleased (arg);
|
||||
|
||||
MyGUI::InputManager::getInstance().injectKeyRelease(MyGUI::KeyCode::Enum(arg.key));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InputManager::mousePressed( const OIS::MouseEvent &arg, OIS::MouseButtonID id )
|
||||
{
|
||||
mInputCtrl->mousePressed (arg, id);
|
||||
|
||||
MyGUI::InputManager::getInstance().injectMousePress(mMouseX, mMouseY, MyGUI::MouseButton::Enum(id));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InputManager::mouseReleased( const OIS::MouseEvent &arg, OIS::MouseButtonID id )
|
||||
{
|
||||
mInputCtrl->mouseReleased (arg, id);
|
||||
|
||||
MyGUI::InputManager::getInstance().injectMouseRelease(mMouseX, mMouseY, MyGUI::MouseButton::Enum(id));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InputManager::mouseMoved( const OIS::MouseEvent &arg )
|
||||
{
|
||||
mInputCtrl->mouseMoved (arg);
|
||||
|
||||
if (mGuiCursorEnabled)
|
||||
{
|
||||
const MyGUI::IntSize& viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||
|
||||
// We keep track of our own mouse position, so that moving the mouse while in
|
||||
// game mode does not move the position of the GUI cursor
|
||||
mMouseX += float(arg.state.X.rel) * mUISensitivity;
|
||||
mMouseY += float(arg.state.Y.rel) * mUISensitivity * mUIYMultiplier;
|
||||
mMouseX = std::max(0.f, std::min(mMouseX, float(viewSize.width)));
|
||||
mMouseY = std::max(0.f, std::min(mMouseY, float(viewSize.height)));
|
||||
|
||||
MyGUI::InputManager::getInstance().injectMouseMove( int(mMouseX), int(mMouseY), arg.state.Z.abs);
|
||||
}
|
||||
|
||||
if (mMouseLookEnabled)
|
||||
{
|
||||
float x = arg.state.X.rel * mCameraSensitivity * 0.2;
|
||||
float y = arg.state.Y.rel * mCameraSensitivity * 0.2 * (mInvertY ? -1 : 1) * mUIYMultiplier;
|
||||
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
world->rotateObject(world->getPlayer().getPlayer(), -y, 0.f, x, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void InputManager::toggleMainMenu()
|
||||
{
|
||||
if (mWindows.isGuiMode () && (mWindows.getMode () == MWGui::GM_MainMenu || mWindows.getMode () == MWGui::GM_Settings))
|
||||
mWindows.popGuiMode();
|
||||
else
|
||||
mWindows.pushGuiMode (MWGui::GM_MainMenu);
|
||||
}
|
||||
|
||||
void InputManager::toggleSpell()
|
||||
{
|
||||
if (mWindows.isGuiMode()) return;
|
||||
|
||||
MWMechanics::DrawState_ state = mPlayer.getDrawState();
|
||||
if (state == MWMechanics::DrawState_Weapon || state == MWMechanics::DrawState_Nothing)
|
||||
{
|
||||
mPlayer.setDrawState(MWMechanics::DrawState_Spell);
|
||||
std::cout << "Player has now readied his hands for spellcasting!\n" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
mPlayer.setDrawState(MWMechanics::DrawState_Nothing);
|
||||
std::cout << "Player does not have any kind of attack ready now.\n" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void InputManager::toggleWeapon()
|
||||
{
|
||||
if (mWindows.isGuiMode()) return;
|
||||
|
||||
MWMechanics::DrawState_ state = mPlayer.getDrawState();
|
||||
if (state == MWMechanics::DrawState_Spell || state == MWMechanics::DrawState_Nothing)
|
||||
{
|
||||
mPlayer.setDrawState(MWMechanics::DrawState_Weapon);
|
||||
std::cout << "Player is now drawing his weapon.\n" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
mPlayer.setDrawState(MWMechanics::DrawState_Nothing);
|
||||
std::cout << "Player does not have any kind of attack ready now.\n" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void InputManager::screenshot()
|
||||
{
|
||||
mEngine.screenshot();
|
||||
|
||||
std::vector<std::string> empty;
|
||||
mWindows.messageBox ("Screenshot saved", empty);
|
||||
}
|
||||
|
||||
void InputManager::toggleInventory()
|
||||
{
|
||||
bool gameMode = !mWindows.isGuiMode();
|
||||
|
||||
// Toggle between game mode and inventory mode
|
||||
if(gameMode)
|
||||
mWindows.pushGuiMode(MWGui::GM_Inventory);
|
||||
else if(mWindows.getMode() == MWGui::GM_Inventory)
|
||||
mWindows.popGuiMode();
|
||||
|
||||
// .. but don't touch any other mode.
|
||||
}
|
||||
|
||||
void InputManager::toggleConsole()
|
||||
{
|
||||
bool gameMode = !mWindows.isGuiMode();
|
||||
|
||||
// Switch to console mode no matter what mode we are currently
|
||||
// in, except of course if we are already in console mode
|
||||
if (!gameMode)
|
||||
{
|
||||
if (mWindows.getMode() == MWGui::GM_Console)
|
||||
mWindows.popGuiMode();
|
||||
else
|
||||
mWindows.pushGuiMode(MWGui::GM_Console);
|
||||
}
|
||||
else
|
||||
mWindows.pushGuiMode(MWGui::GM_Console);
|
||||
}
|
||||
|
||||
void InputManager::toggleJournal()
|
||||
{
|
||||
// Toggle between game mode and journal mode
|
||||
bool gameMode = !mWindows.isGuiMode();
|
||||
|
||||
if(gameMode)
|
||||
mWindows.pushGuiMode(MWGui::GM_Journal);
|
||||
else if(mWindows.getMode() == MWGui::GM_Journal)
|
||||
mWindows.popGuiMode();
|
||||
// .. but don't touch any other mode.
|
||||
}
|
||||
|
||||
void InputManager::activate()
|
||||
{
|
||||
mEngine.activate();
|
||||
}
|
||||
|
||||
void InputManager::toggleAutoMove()
|
||||
{
|
||||
if (mWindows.isGuiMode()) return;
|
||||
mPlayer.setAutoMove (!mPlayer.getAutoMove());
|
||||
}
|
||||
|
||||
void InputManager::toggleWalking()
|
||||
{
|
||||
if (mWindows.isGuiMode()) return;
|
||||
mPlayer.toggleRunning();
|
||||
}
|
||||
|
||||
// Exit program now button (which is disabled in GUI mode)
|
||||
void InputManager::exitNow()
|
||||
{
|
||||
if(!mWindows.isGuiMode())
|
||||
Ogre::Root::getSingleton().queueEndRendering ();
|
||||
}
|
||||
|
||||
bool InputManager::actionIsActive (int id)
|
||||
{
|
||||
return mInputCtrl->getChannel (id)->getValue () == 1;
|
||||
}
|
||||
|
||||
void InputManager::loadKeyDefaults (bool force)
|
||||
{
|
||||
// using hardcoded key defaults is inevitable, if we want the configuration files to stay valid
|
||||
// across different versions of OpenMW (in the case where another input action is added)
|
||||
std::map<int, int> defaultKeyBindings;
|
||||
|
||||
defaultKeyBindings[A_Activate] = OIS::KC_SPACE;
|
||||
defaultKeyBindings[A_MoveBackward] = OIS::KC_S;
|
||||
defaultKeyBindings[A_MoveForward] = OIS::KC_W;
|
||||
defaultKeyBindings[A_MoveLeft] = OIS::KC_A;
|
||||
defaultKeyBindings[A_MoveRight] = OIS::KC_D;
|
||||
defaultKeyBindings[A_ToggleWeapon] = OIS::KC_F;
|
||||
defaultKeyBindings[A_ToggleSpell] = OIS::KC_R;
|
||||
defaultKeyBindings[A_Console] = OIS::KC_F1;
|
||||
defaultKeyBindings[A_Crouch] = OIS::KC_LCONTROL;
|
||||
defaultKeyBindings[A_AutoMove] = OIS::KC_Q;
|
||||
defaultKeyBindings[A_Jump] = OIS::KC_E;
|
||||
defaultKeyBindings[A_Journal] = OIS::KC_J;
|
||||
defaultKeyBindings[A_Rest] = OIS::KC_T;
|
||||
defaultKeyBindings[A_GameMenu] = OIS::KC_ESCAPE;
|
||||
|
||||
std::map<int, int> defaultMouseButtonBindings;
|
||||
defaultMouseButtonBindings[A_Inventory] = OIS::MB_Right;
|
||||
|
||||
for (int i = 0; i < A_Last; ++i)
|
||||
{
|
||||
ICS::Control* control;
|
||||
bool controlExists = mInputCtrl->getChannel(i)->getControlsCount () != 0;
|
||||
if (!controlExists)
|
||||
{
|
||||
control = new ICS::Control(boost::lexical_cast<std::string>(i), false, true, 0, ICS::ICS_MAX, ICS::ICS_MAX);
|
||||
mInputCtrl->addControl(control);
|
||||
control->attachChannel(mInputCtrl->getChannel(i), ICS::Channel::DIRECT);
|
||||
}
|
||||
else
|
||||
{
|
||||
control = mInputCtrl->getChannel(i)->getAttachedControls ().front().control;
|
||||
}
|
||||
|
||||
if (!controlExists || force)
|
||||
{
|
||||
clearAllBindings (control);
|
||||
|
||||
if (defaultKeyBindings.find(i) != defaultKeyBindings.end())
|
||||
mInputCtrl->addKeyBinding(control, static_cast<OIS::KeyCode>(defaultKeyBindings[i]), ICS::Control::INCREASE);
|
||||
else if (defaultMouseButtonBindings.find(i) != defaultMouseButtonBindings.end())
|
||||
mInputCtrl->addMouseButtonBinding (control, defaultMouseButtonBindings[i], ICS::Control::INCREASE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string InputManager::getActionDescription (int action)
|
||||
{
|
||||
std::map<int, std::string> descriptions;
|
||||
|
||||
descriptions[A_Activate] = "sActivate";
|
||||
descriptions[A_MoveBackward] = "sBack";
|
||||
descriptions[A_MoveForward] = "sForward";
|
||||
descriptions[A_MoveLeft] = "sLeft";
|
||||
descriptions[A_MoveRight] = "sRight";
|
||||
descriptions[A_ToggleWeapon] = "sReady_Weapon";
|
||||
descriptions[A_ToggleSpell] = "sReady_Magic";
|
||||
descriptions[A_Console] = "sConsoleTitle";
|
||||
descriptions[A_Crouch] = "sCrouch_Sneak";
|
||||
descriptions[A_AutoMove] = "sAuto_Run";
|
||||
descriptions[A_Jump] = "sJump";
|
||||
descriptions[A_Journal] = "sJournal";
|
||||
descriptions[A_Rest] = "sRestKey";
|
||||
descriptions[A_Inventory] = "sInventory";
|
||||
|
||||
if (descriptions[action] == "")
|
||||
return ""; // not configurable
|
||||
|
||||
return "#{" + descriptions[action] + "}";
|
||||
}
|
||||
|
||||
std::string InputManager::getActionBindingName (int action)
|
||||
{
|
||||
if (mInputCtrl->getChannel (action)->getControlsCount () == 0)
|
||||
return "#{sNone}";
|
||||
|
||||
ICS::Control* c = mInputCtrl->getChannel (action)->getAttachedControls ().front().control;
|
||||
|
||||
if (mInputCtrl->getKeyBinding (c, ICS::Control::INCREASE) != OIS::KC_UNASSIGNED)
|
||||
return mInputCtrl->keyCodeToString (mInputCtrl->getKeyBinding (c, ICS::Control::INCREASE));
|
||||
else if (mInputCtrl->getMouseButtonBinding (c, ICS::Control::INCREASE) != ICS_MAX_DEVICE_BUTTONS)
|
||||
return "#{sMouse} " + boost::lexical_cast<std::string>(mInputCtrl->getMouseButtonBinding (c, ICS::Control::INCREASE));
|
||||
else
|
||||
return "#{sNone}";
|
||||
}
|
||||
|
||||
std::vector<int> InputManager::getActionSorting()
|
||||
{
|
||||
std::vector<int> ret;
|
||||
ret.push_back(A_MoveForward);
|
||||
ret.push_back(A_MoveBackward);
|
||||
ret.push_back(A_MoveLeft);
|
||||
ret.push_back(A_MoveRight);
|
||||
ret.push_back(A_Crouch);
|
||||
ret.push_back(A_Activate);
|
||||
ret.push_back(A_ToggleWeapon);
|
||||
ret.push_back(A_ToggleSpell);
|
||||
ret.push_back(A_AutoMove);
|
||||
ret.push_back(A_Jump);
|
||||
ret.push_back(A_Inventory);
|
||||
ret.push_back(A_Journal);
|
||||
ret.push_back(A_Rest);
|
||||
ret.push_back(A_Console);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void InputManager::enableDetectingBindingMode (int action)
|
||||
{
|
||||
ICS::Control* c = mInputCtrl->getChannel (action)->getAttachedControls ().front().control;
|
||||
|
||||
mInputCtrl->enableDetectingBindingState (c, ICS::Control::INCREASE);
|
||||
}
|
||||
|
||||
void InputManager::mouseAxisBindingDetected(ICS::InputControlSystem* ICS, ICS::Control* control
|
||||
, ICS::InputControlSystem::NamedAxis axis, ICS::Control::ControlChangingDirection direction)
|
||||
{
|
||||
// we don't want mouse movement bindings
|
||||
return;
|
||||
}
|
||||
|
||||
void InputManager::keyBindingDetected(ICS::InputControlSystem* ICS, ICS::Control* control
|
||||
, OIS::KeyCode key, ICS::Control::ControlChangingDirection direction)
|
||||
{
|
||||
clearAllBindings(control);
|
||||
ICS::DetectingBindingListener::keyBindingDetected (ICS, control, key, direction);
|
||||
MWBase::Environment::get().getWindowManager ()->notifyInputActionBound ();
|
||||
}
|
||||
|
||||
void InputManager::mouseButtonBindingDetected(ICS::InputControlSystem* ICS, ICS::Control* control
|
||||
, unsigned int button, ICS::Control::ControlChangingDirection direction)
|
||||
{
|
||||
clearAllBindings(control);
|
||||
ICS::DetectingBindingListener::mouseButtonBindingDetected (ICS, control, button, direction);
|
||||
MWBase::Environment::get().getWindowManager ()->notifyInputActionBound ();
|
||||
}
|
||||
|
||||
void InputManager::joystickAxisBindingDetected(ICS::InputControlSystem* ICS, ICS::Control* control
|
||||
, int deviceId, int axis, ICS::Control::ControlChangingDirection direction)
|
||||
{
|
||||
clearAllBindings(control);
|
||||
ICS::DetectingBindingListener::joystickAxisBindingDetected (ICS, control, deviceId, axis, direction);
|
||||
MWBase::Environment::get().getWindowManager ()->notifyInputActionBound ();
|
||||
}
|
||||
|
||||
void InputManager::joystickButtonBindingDetected(ICS::InputControlSystem* ICS, ICS::Control* control
|
||||
, int deviceId, unsigned int button, ICS::Control::ControlChangingDirection direction)
|
||||
{
|
||||
clearAllBindings(control);
|
||||
ICS::DetectingBindingListener::joystickButtonBindingDetected (ICS, control, deviceId, button, direction);
|
||||
MWBase::Environment::get().getWindowManager ()->notifyInputActionBound ();
|
||||
}
|
||||
|
||||
void InputManager::joystickPOVBindingDetected(ICS::InputControlSystem* ICS, ICS::Control* control
|
||||
, int deviceId, int pov,ICS:: InputControlSystem::POVAxis axis, ICS::Control::ControlChangingDirection direction)
|
||||
{
|
||||
clearAllBindings(control);
|
||||
ICS::DetectingBindingListener::joystickPOVBindingDetected (ICS, control, deviceId, pov, axis, direction);
|
||||
MWBase::Environment::get().getWindowManager ()->notifyInputActionBound ();
|
||||
}
|
||||
|
||||
void InputManager::joystickSliderBindingDetected(ICS::InputControlSystem* ICS, ICS::Control* control
|
||||
, int deviceId, int slider, ICS::Control::ControlChangingDirection direction)
|
||||
{
|
||||
clearAllBindings(control);
|
||||
ICS::DetectingBindingListener::joystickSliderBindingDetected (ICS, control, deviceId, slider, direction);
|
||||
MWBase::Environment::get().getWindowManager ()->notifyInputActionBound ();
|
||||
}
|
||||
|
||||
void InputManager::clearAllBindings (ICS::Control* control)
|
||||
{
|
||||
// right now we don't really need multiple bindings for the same action, so remove all others first
|
||||
if (mInputCtrl->getKeyBinding (control, ICS::Control::INCREASE) != OIS::KC_UNASSIGNED)
|
||||
mInputCtrl->removeKeyBinding (mInputCtrl->getKeyBinding (control, ICS::Control::INCREASE));
|
||||
if (mInputCtrl->getMouseButtonBinding (control, ICS::Control::INCREASE) != ICS_MAX_DEVICE_BUTTONS)
|
||||
mInputCtrl->removeMouseButtonBinding (mInputCtrl->getMouseButtonBinding (control, ICS::Control::INCREASE));
|
||||
|
||||
/// \todo add joysticks here once they are added
|
||||
}
|
||||
|
||||
void InputManager::resetToDefaultBindings()
|
||||
{
|
||||
loadKeyDefaults(true);
|
||||
}
|
||||
|
||||
}
|
222
apps/openmw/mwinput/inputmanagerimp.hpp
Normal file
222
apps/openmw/mwinput/inputmanagerimp.hpp
Normal file
|
@ -0,0 +1,222 @@
|
|||
#ifndef _MWINPUT_MWINPUTMANAGERIMP_H
|
||||
#define _MWINPUT_MWINPUTMANAGERIMP_H
|
||||
|
||||
#include "../mwgui/mode.hpp"
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include "../mwbase/inputmanager.hpp"
|
||||
|
||||
namespace OEngine
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
class OgreRenderer;
|
||||
}
|
||||
}
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class Player;
|
||||
}
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
class WindowManager;
|
||||
}
|
||||
|
||||
namespace OMW
|
||||
{
|
||||
class Engine;
|
||||
}
|
||||
|
||||
namespace ICS
|
||||
{
|
||||
class InputControlSystem;
|
||||
}
|
||||
|
||||
namespace OIS
|
||||
{
|
||||
class Keyboard;
|
||||
class Mouse;
|
||||
class InputManager;
|
||||
}
|
||||
|
||||
#include <OIS/OISKeyboard.h>
|
||||
#include <OIS/OISMouse.h>
|
||||
|
||||
#include <extern/oics/ICSChannelListener.h>
|
||||
#include <extern/oics/ICSInputControlSystem.h>
|
||||
|
||||
namespace MWInput
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief Class that handles all input and key bindings for OpenMW.
|
||||
*/
|
||||
class InputManager : public MWBase::InputManager, public OIS::KeyListener, public OIS::MouseListener, public ICS::ChannelListener, public ICS::DetectingBindingListener
|
||||
{
|
||||
public:
|
||||
InputManager(OEngine::Render::OgreRenderer &_ogre,
|
||||
MWWorld::Player&_player,
|
||||
MWBase::WindowManager &_windows,
|
||||
bool debug,
|
||||
OMW::Engine& engine,
|
||||
const std::string& userFile, bool userFileExists);
|
||||
|
||||
virtual ~InputManager();
|
||||
|
||||
virtual void update(float dt);
|
||||
|
||||
virtual void changeInputMode(bool guiMode);
|
||||
|
||||
virtual void processChangedSettings(const Settings::CategorySettingVector& changed);
|
||||
|
||||
virtual void setDragDrop(bool dragDrop);
|
||||
|
||||
virtual void toggleControlSwitch (const std::string& sw, bool value);
|
||||
|
||||
virtual std::string getActionDescription (int action);
|
||||
virtual std::string getActionBindingName (int action);
|
||||
virtual int getNumActions() { return A_Last; }
|
||||
virtual std::vector<int> getActionSorting ();
|
||||
virtual void enableDetectingBindingMode (int action);
|
||||
virtual void resetToDefaultBindings();
|
||||
|
||||
|
||||
public:
|
||||
virtual bool keyPressed( const OIS::KeyEvent &arg );
|
||||
virtual bool keyReleased( const OIS::KeyEvent &arg );
|
||||
|
||||
virtual bool mousePressed( const OIS::MouseEvent &arg, OIS::MouseButtonID id );
|
||||
virtual bool mouseReleased( const OIS::MouseEvent &arg, OIS::MouseButtonID id );
|
||||
virtual bool mouseMoved( const OIS::MouseEvent &arg );
|
||||
|
||||
virtual void channelChanged(ICS::Channel* channel, float currentValue, float previousValue);
|
||||
|
||||
virtual void mouseAxisBindingDetected(ICS::InputControlSystem* ICS, ICS::Control* control
|
||||
, ICS::InputControlSystem::NamedAxis axis, ICS::Control::ControlChangingDirection direction);
|
||||
|
||||
virtual void keyBindingDetected(ICS::InputControlSystem* ICS, ICS::Control* control
|
||||
, OIS::KeyCode key, ICS::Control::ControlChangingDirection direction);
|
||||
|
||||
virtual void mouseButtonBindingDetected(ICS::InputControlSystem* ICS, ICS::Control* control
|
||||
, unsigned int button, ICS::Control::ControlChangingDirection direction);
|
||||
|
||||
virtual void joystickAxisBindingDetected(ICS::InputControlSystem* ICS, ICS::Control* control
|
||||
, int deviceId, int axis, ICS::Control::ControlChangingDirection direction);
|
||||
|
||||
virtual void joystickButtonBindingDetected(ICS::InputControlSystem* ICS, ICS::Control* control
|
||||
, int deviceId, unsigned int button, ICS::Control::ControlChangingDirection direction);
|
||||
|
||||
virtual void joystickPOVBindingDetected(ICS::InputControlSystem* ICS, ICS::Control* control
|
||||
, int deviceId, int pov,ICS:: InputControlSystem::POVAxis axis, ICS::Control::ControlChangingDirection direction);
|
||||
|
||||
virtual void joystickSliderBindingDetected(ICS::InputControlSystem* ICS, ICS::Control* control
|
||||
, int deviceId, int slider, ICS::Control::ControlChangingDirection direction);
|
||||
|
||||
void clearAllBindings (ICS::Control* control);
|
||||
|
||||
private:
|
||||
OEngine::Render::OgreRenderer &mOgre;
|
||||
MWWorld::Player &mPlayer;
|
||||
MWBase::WindowManager &mWindows;
|
||||
OMW::Engine& mEngine;
|
||||
|
||||
ICS::InputControlSystem* mInputCtrl;
|
||||
|
||||
OIS::Keyboard* mKeyboard;
|
||||
OIS::Mouse* mMouse;
|
||||
OIS::InputManager* mInputManager;
|
||||
|
||||
std::string mUserFile;
|
||||
|
||||
bool mDragDrop;
|
||||
|
||||
bool mInvertY;
|
||||
|
||||
float mCameraSensitivity;
|
||||
float mUISensitivity;
|
||||
float mCameraYMultiplier;
|
||||
float mUIYMultiplier;
|
||||
|
||||
bool mMouseLookEnabled;
|
||||
bool mGuiCursorEnabled;
|
||||
|
||||
float mMouseX;
|
||||
float mMouseY;
|
||||
|
||||
std::map<std::string, bool> mControlSwitch;
|
||||
|
||||
|
||||
private:
|
||||
void adjustMouseRegion(int width, int height);
|
||||
|
||||
private:
|
||||
void toggleMainMenu();
|
||||
void toggleSpell();
|
||||
void toggleWeapon();
|
||||
void toggleInventory();
|
||||
void toggleConsole();
|
||||
void screenshot();
|
||||
void toggleJournal();
|
||||
void activate();
|
||||
void toggleWalking();
|
||||
void toggleAutoMove();
|
||||
void exitNow();
|
||||
|
||||
bool actionIsActive (int id);
|
||||
|
||||
void loadKeyDefaults(bool force = false);
|
||||
|
||||
private:
|
||||
enum Actions
|
||||
{
|
||||
// please add new actions at the bottom, in order to preserve the channel IDs in the key configuration files
|
||||
|
||||
A_GameMenu,
|
||||
|
||||
A_Quit, // Exit the program
|
||||
|
||||
A_Screenshot, // Take a screenshot
|
||||
|
||||
A_Inventory, // Toggle inventory screen
|
||||
|
||||
A_Console, // Toggle console screen
|
||||
|
||||
A_MoveLeft, // Move player left / right
|
||||
A_MoveRight,
|
||||
A_MoveForward, // Forward / Backward
|
||||
A_MoveBackward,
|
||||
|
||||
A_Activate,
|
||||
|
||||
A_Use, //Use weapon, spell, etc.
|
||||
A_Jump,
|
||||
A_AutoMove, //Toggle Auto-move forward
|
||||
A_Rest, //Rest
|
||||
A_Journal, //Journal
|
||||
A_Weapon, //Draw/Sheath weapon
|
||||
A_Spell, //Ready/Unready Casting
|
||||
A_AlwaysRun, //Toggle Always Run
|
||||
A_CycleSpellLeft, //cycling through spells
|
||||
A_CycleSpellRight,
|
||||
A_CycleWeaponLeft,//Cycling through weapons
|
||||
A_CycleWeaponRight,
|
||||
A_ToggleSneak, //Toggles Sneak, add Push-Sneak later
|
||||
A_ToggleWalk, //Toggle Walking/Running
|
||||
A_Crouch,
|
||||
|
||||
A_QuickSave,
|
||||
A_QuickLoad,
|
||||
A_QuickMenu,
|
||||
A_ToggleWeapon,
|
||||
A_ToggleSpell,
|
||||
|
||||
A_Last // Marker for the last item
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endif
|
|
@ -1,28 +0,0 @@
|
|||
#include "mouselookevent.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include <OIS/OIS.h>
|
||||
#include <OgreCamera.h>
|
||||
#include <OgreSceneNode.h>
|
||||
|
||||
using namespace OIS;
|
||||
using namespace MWInput;
|
||||
|
||||
void MouseLookEvent::event(Type type, int index, const void *p)
|
||||
{
|
||||
if (type != EV_MouseMove || mDisabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
MouseEvent *arg = (MouseEvent*)(p);
|
||||
|
||||
float x = arg->state.X.rel * sensX;
|
||||
float y = arg->state.Y.rel * sensY;
|
||||
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
world->rotateObject(world->getPlayer().getPlayer(), -y, 0.f, x, true);
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
#ifndef _MWINPUT_MOUSELOOKEVENT_H
|
||||
#define _MWINPUT_MOUSELOOKEVENT_H
|
||||
|
||||
/*
|
||||
A mouse-look class for Ogre. Accepts input events from Mangle::Input
|
||||
and translates them.
|
||||
|
||||
You can adjust the mouse sensibility and switch to a different
|
||||
camera. The mouselook class also has an optional wrap protection
|
||||
that keeps the camera from flipping upside down.
|
||||
|
||||
You can disable the mouse looker at any time by calling
|
||||
setCamera(NULL), and reenable it by setting the camera back.
|
||||
|
||||
NOTE: The current implementation will ONLY work for native OIS
|
||||
events.
|
||||
*/
|
||||
|
||||
#include <mangle/input/event.hpp>
|
||||
|
||||
namespace MWInput
|
||||
{
|
||||
class MouseLookEvent : public Mangle::Input::Event
|
||||
{
|
||||
float sensX, sensY; // Mouse sensibility
|
||||
bool flipProt; // Flip protection
|
||||
bool mDisabled;
|
||||
|
||||
public:
|
||||
MouseLookEvent(float sX = 0.2, float sY = 0.2, bool prot=true)
|
||||
: sensX(sX), sensY(sY), flipProt(prot)
|
||||
{}
|
||||
|
||||
void setSens(float sX, float sY) {
|
||||
sensX = sX;
|
||||
sensY = sY;
|
||||
}
|
||||
|
||||
void setProt(bool p) {
|
||||
flipProt = p;
|
||||
}
|
||||
|
||||
void disable() {
|
||||
mDisabled = true;
|
||||
}
|
||||
|
||||
void enable() {
|
||||
mDisabled = false;
|
||||
}
|
||||
|
||||
void event(Type type, int index, const void *p);
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<MouseLookEvent> MouseLookEventPtr;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,16 +1,15 @@
|
|||
|
||||
#include "mechanicsmanager.hpp"
|
||||
#include "mechanicsmanagerimp.hpp"
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
|
||||
namespace MWMechanics
|
||||
{
|
||||
void MechanicsManager::buildPlayer()
|
||||
|
@ -67,15 +66,18 @@ namespace MWMechanics
|
|||
static_cast<int> (male ? attribute->male : attribute->female));
|
||||
}
|
||||
|
||||
for (int i=0; i<7; ++i)
|
||||
for (int i=0; i<27; ++i)
|
||||
{
|
||||
int index = race->data.bonus[i].skill;
|
||||
|
||||
if (index>=0 && index<27)
|
||||
{
|
||||
npcStats.getSkill (index).setBase (
|
||||
npcStats.getSkill (index).getBase() + race->data.bonus[i].bonus);
|
||||
}
|
||||
int bonus = 0;
|
||||
|
||||
for (int i2=0; i2<7; ++i2)
|
||||
if (race->data.bonus[i2].skill==i)
|
||||
{
|
||||
bonus = race->data.bonus[i2].bonus;
|
||||
break;
|
||||
}
|
||||
|
||||
npcStats.getSkill (i).setBase (5 + bonus);
|
||||
}
|
||||
|
||||
for (std::vector<std::string>::const_iterator iter (race->powers.list.begin());
|
||||
|
@ -265,8 +267,8 @@ namespace MWMechanics
|
|||
MWBase::Environment::get().getWorld()->getPlayer().getClass().name);
|
||||
mUpdatePlayer = false;
|
||||
|
||||
MWGui::WindowManager::SkillList majorSkills (5);
|
||||
MWGui::WindowManager::SkillList minorSkills (5);
|
||||
MWBase::WindowManager::SkillList majorSkills (5);
|
||||
MWBase::WindowManager::SkillList minorSkills (5);
|
||||
|
||||
for (int i=0; i<5; ++i)
|
||||
{
|
|
@ -1,8 +1,7 @@
|
|||
#ifndef GAME_MWMECHANICS_MECHANICSMANAGER_H
|
||||
#define GAME_MWMECHANICS_MECHANICSMANAGER_H
|
||||
#ifndef GAME_MWMECHANICS_MECHANICSMANAGERIMP_H
|
||||
#define GAME_MWMECHANICS_MECHANICSMANAGERIMP_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
||||
|
@ -22,7 +21,7 @@ namespace MWWorld
|
|||
|
||||
namespace MWMechanics
|
||||
{
|
||||
class MechanicsManager
|
||||
class MechanicsManager : public MWBase::MechanicsManager
|
||||
{
|
||||
MWWorld::Ptr mWatched;
|
||||
CreatureStats mWatchedCreature;
|
||||
|
@ -38,43 +37,41 @@ namespace MWMechanics
|
|||
|
||||
public:
|
||||
|
||||
MechanicsManager ();
|
||||
MechanicsManager();
|
||||
|
||||
void configureGUI();
|
||||
|
||||
void addActor (const MWWorld::Ptr& ptr);
|
||||
virtual void addActor (const MWWorld::Ptr& ptr);
|
||||
///< Register an actor for stats management
|
||||
|
||||
void removeActor (const MWWorld::Ptr& ptr);
|
||||
virtual void removeActor (const MWWorld::Ptr& ptr);
|
||||
///< Deregister an actor for stats management
|
||||
|
||||
void dropActors (const MWWorld::CellStore *cellStore);
|
||||
virtual void dropActors (const MWWorld::CellStore *cellStore);
|
||||
///< Deregister all actors in the given cell.
|
||||
|
||||
void watchActor (const MWWorld::Ptr& ptr);
|
||||
virtual void watchActor (const MWWorld::Ptr& ptr);
|
||||
///< On each update look for changes in a previously registered actor and update the
|
||||
/// GUI accordingly.
|
||||
|
||||
void update (std::vector<std::pair<std::string, Ogre::Vector3> >& movement, float duration,
|
||||
bool paused);
|
||||
virtual void update (std::vector<std::pair<std::string, Ogre::Vector3> >& movement,
|
||||
float duration, bool paused);
|
||||
///< Update actor stats and store desired velocity vectors in \a movement
|
||||
///
|
||||
/// \param paused In game type does not currently advance (this usually means some GUI
|
||||
/// component is up).
|
||||
|
||||
void setPlayerName (const std::string& name);
|
||||
virtual void setPlayerName (const std::string& name);
|
||||
///< Set player name.
|
||||
|
||||
void setPlayerRace (const std::string& id, bool male);
|
||||
virtual void setPlayerRace (const std::string& id, bool male);
|
||||
///< Set player race.
|
||||
|
||||
void setPlayerBirthsign (const std::string& id);
|
||||
virtual void setPlayerBirthsign (const std::string& id);
|
||||
///< Set player birthsign.
|
||||
|
||||
void setPlayerClass (const std::string& id);
|
||||
virtual void setPlayerClass (const std::string& id);
|
||||
///< Set player class to stock class.
|
||||
|
||||
void setPlayerClass (const ESM::Class& class_);
|
||||
virtual void setPlayerClass (const ESM::Class& class_);
|
||||
///< Set player class to custom class.
|
||||
};
|
||||
}
|
|
@ -4,10 +4,11 @@
|
|||
#include <OgreMaterialManager.h>
|
||||
#include <OgreHardwarePixelBuffer.h>
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "renderconst.hpp"
|
||||
#include "renderingmanager.hpp"
|
||||
|
|
|
@ -18,17 +18,17 @@
|
|||
#include <extern/shiny/Platforms/Ogre/OgrePlatform.hpp>
|
||||
|
||||
#include <components/esm/loadstat.hpp>
|
||||
#include <components/esm_store/store.hpp>
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include "../mwbase/world.hpp" // these includes can be removed once the static-hack is gone
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/inputmanager.hpp" // FIXME
|
||||
#include "../mwbase/windowmanager.hpp" // FIXME
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp" // FIXME
|
||||
#include "../mwinput/inputmanager.hpp" // FIXME
|
||||
|
||||
#include "shadows.hpp"
|
||||
#include "localmap.hpp"
|
||||
#include "water.hpp"
|
||||
|
@ -776,6 +776,7 @@ void RenderingManager::windowResized(Ogre::RenderWindow* rw)
|
|||
|
||||
void RenderingManager::windowClosed(Ogre::RenderWindow* rw)
|
||||
{
|
||||
Ogre::Root::getSingleton ().queueEndRendering ();
|
||||
}
|
||||
|
||||
bool RenderingManager::waterShaderSupported()
|
||||
|
|
|
@ -8,19 +8,16 @@
|
|||
#include <components/interpreter/opcodes.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/inputmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
#include "ref.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace MWScript
|
||||
{
|
||||
namespace Control
|
||||
|
@ -41,11 +38,6 @@ namespace MWScript
|
|||
MWBase::Environment::get()
|
||||
.getInputManager()
|
||||
->toggleControlSwitch(mControl, mEnable);
|
||||
|
||||
if (mEnable)
|
||||
std::cout << "enable: " << mControl << std::endl;
|
||||
else
|
||||
std::cout << "disable: " << mControl << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -8,9 +8,7 @@
|
|||
#include <components/interpreter/opcodes.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
|
||||
|
|
|
@ -5,18 +5,16 @@
|
|||
#include <stdexcept>
|
||||
|
||||
#include <components/interpreter/types.hpp>
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/scriptmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
|
||||
#include "locals.hpp"
|
||||
#include "globalscripts.hpp"
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "actionalchemy.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue