Merge branch 'master' of https://github.com/zinnschlag/openmw into inputsystem

actorid
scrawl 13 years ago
commit 39f87bee0e

@ -25,7 +25,7 @@ add_openmw_dir (mwinput
)
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
@ -66,7 +66,7 @@ add_openmw_dir (mwmechanics
add_openmw_dir (mwbase
environment world scriptmanager dialoguemanager journal soundmanager mechanicsmanager
inputmanager
inputmanager windowmanager
)
# Main executable

@ -15,7 +15,7 @@
#include "mwinput/inputmanagerimp.hpp"
#include "mwgui/window_manager.hpp"
#include "mwgui/windowmanagerimp.hpp"
#include "mwgui/cursorreplace.hpp"
#include "mwscript/scriptmanagerimp.hpp"

@ -10,6 +10,7 @@
#include "soundmanager.hpp"
#include "mechanicsmanager.hpp"
#include "inputmanager.hpp"
#include "windowmanager.hpp"
MWBase::Environment *MWBase::Environment::sThis = 0;
@ -42,7 +43,7 @@ void MWBase::Environment::setScriptManager (ScriptManager *scriptManager)
mScriptManager = scriptManager;
}
void MWBase::Environment::setWindowManager (MWGui::WindowManager *windowManager)
void MWBase::Environment::setWindowManager (WindowManager *windowManager)
{
mWindowManager = windowManager;
}
@ -90,7 +91,7 @@ MWBase::ScriptManager *MWBase::Environment::getScriptManager() const
return mScriptManager;
}
MWGui::WindowManager *MWBase::Environment::getWindowManager() const
MWBase::WindowManager *MWBase::Environment::getWindowManager() const
{
assert (mWindowManager);
return mWindowManager;
@ -145,6 +146,10 @@ void MWBase::Environment::cleanup()
delete mScriptManager;
mScriptManager = 0;
/// \todo Re-enable (currently throwing an exception)
// delete mWindowManager;
mWindowManager = 0;
delete mWorld;
mWorld = 0;
}

@ -1,11 +1,6 @@
#ifndef GAME_BASE_INVIRONMENT_H
#define GAME_BASE_INVIRONMENT_H
namespace MWGui
{
class WindowManager;
}
namespace MWBase
{
class World;
@ -15,6 +10,7 @@ namespace MWBase
class SoundManager;
class MechanicsManager;
class InputManager;
class WindowManager;
/// \brief Central hub for mw-subsystems
///
@ -29,7 +25,7 @@ namespace MWBase
World *mWorld;
SoundManager *mSoundManager;
ScriptManager *mScriptManager;
MWGui::WindowManager *mWindowManager;
WindowManager *mWindowManager;
MechanicsManager *mMechanicsManager;
DialogueManager *mDialogueManager;
Journal *mJournal;
@ -54,7 +50,7 @@ namespace MWBase
void setScriptManager (MWBase::ScriptManager *scriptManager);
void setWindowManager (MWGui::WindowManager *windowManager);
void setWindowManager (WindowManager *windowManager);
void setMechanicsManager (MechanicsManager *mechanicsManager);
@ -73,7 +69,7 @@ namespace MWBase
ScriptManager *getScriptManager() const;
MWGui::WindowManager *getWindowManager() const;
WindowManager *getWindowManager() const;
MechanicsManager *getMechanicsManager() const;

@ -0,0 +1,210 @@
#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 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"

@ -8,6 +8,7 @@
#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

@ -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"

@ -12,6 +12,7 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwmechanics/creaturestats.hpp"
#include "../mwmechanics/npcstats.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,6 +13,7 @@
#include "../mwbase/world.hpp"
#include "../mwbase/scriptmanager.hpp"
#include "../mwbase/journal.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/refdata.hpp"
@ -20,22 +21,20 @@
#include "../mwworld/containerstore.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,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,16 +5,16 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/soundmanager.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

@ -104,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)
@ -179,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);
@ -190,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);
@ -201,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);
@ -220,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);
@ -230,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);
@ -247,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);
@ -260,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());
}
@ -303,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();
@ -355,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
@ -383,6 +392,7 @@ void CharacterCreation::onPickClassDialogBack()
if (!classId.empty())
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(classId);
mWM->removeDialog(mPickClassDialog);
mPickClassDialog = 0;
}
mWM->popGuiMode();
@ -391,10 +401,8 @@ void CharacterCreation::onPickClassDialogBack()
void CharacterCreation::onClassChoice(int _index)
{
if (mClassChoiceDialog)
{
mWM->removeDialog(mClassChoiceDialog);
}
mWM->removeDialog(mClassChoiceDialog);
mClassChoiceDialog = 0;
mWM->popGuiMode();
@ -424,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)
@ -451,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();
@ -466,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)
@ -493,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)
@ -513,6 +525,7 @@ void CharacterCreation::onBirthSignDialogBack()
{
MWBase::Environment::get().getMechanicsManager()->setPlayerBirthsign(mBirthSignDialog->getBirthId());
mWM->removeDialog(mBirthSignDialog);
mBirthSignDialog = 0;
}
mWM->popGuiMode();
@ -548,6 +561,7 @@ void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow)
mWM->setPlayerClass(klass);
mWM->removeDialog(mCreateClassDialog);
mCreateClassDialog = 0;
}
if (mCreationStage == CSE_ReviewNext)
@ -569,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);
@ -580,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();
@ -658,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);
@ -675,8 +691,9 @@ void CharacterCreation::showClassQuestionDialog()
return;
}
if (mGenerateClassQuestionDialog)
mWM->removeDialog(mGenerateClassQuestionDialog);
mWM->removeDialog(mGenerateClassQuestionDialog);
mGenerateClassQuestionDialog = 0;
mGenerateClassQuestionDialog = new InfoBoxDialog(*mWM);
InfoBoxDialog::ButtonList buttons;
@ -696,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();
@ -706,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,17 +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/stat.hpp"
namespace MWGui
{
class WindowManager;
class WindowBase;
class TextInputDialog;
@ -31,7 +29,7 @@ namespace MWGui
public:
typedef std::vector<int> SkillList;
CharacterCreation(WindowManager* _wm);
CharacterCreation(MWBase::WindowManager* _wm);
~CharacterCreation();
//Show a dialog
@ -60,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,7 +20,6 @@
#include "../mwclass/container.hpp"
#include "window_manager.hpp"
#include "widgets.hpp"
#include "countdialog.hpp"
#include "tradewindow.hpp"
@ -591,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"

@ -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,11 +2,9 @@
#include <OgreRoot.h>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "window_manager.hpp"
#include "../mwbase/windowmanager.hpp"
namespace MWGui
{

@ -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,16 +3,16 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/soundmanager.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);

@ -14,10 +14,10 @@
#include "../mwbase/world.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/inputmanager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwrender/renderingmanager.hpp"
#include "window_manager.hpp"
#include "confirmationdialog.hpp"
namespace
@ -81,7 +81,7 @@ namespace
namespace MWGui
{
SettingsWindow::SettingsWindow(WindowManager& parWindowManager) :
SettingsWindow::SettingsWindow(MWBase::WindowManager& parWindowManager) :
WindowBase("openmw_settings_window.layout", parWindowManager)
{
getWidget(mOkButton, "OkButton");

@ -13,7 +13,7 @@ namespace MWGui
class SettingsWindow : public WindowBase
{
public:
SettingsWindow(WindowManager& parWindowManager);
SettingsWindow(MWBase::WindowManager& parWindowManager);
private:
static int const sFovMin = 30;
@ -77,4 +77,3 @@ namespace MWGui
}
#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();

@ -9,20 +9,20 @@
#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/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)
@ -57,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);
@ -383,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";
@ -443,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());
@ -485,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)
@ -496,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,22 +42,6 @@
#include "alchemywindow.hpp"
#include "spellwindow.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 <components/settings/settings.hpp>
#include <cassert>
#include <iterator>
using namespace MWGui;
WindowManager::WindowManager(
@ -338,10 +343,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;
}
@ -424,7 +431,6 @@ void WindowManager::updateSkillArea()
void WindowManager::removeDialog(OEngine::GUI::Layout*dialog)
{
assert(dialog);
if (!dialog)
return;
dialog->setVisible(false);
@ -491,11 +497,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))
@ -745,3 +746,79 @@ 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;
}

@ -0,0 +1,254 @@
#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 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;
/// \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

@ -9,7 +9,7 @@
#include <openengine/ogre/renderer.hpp>
#include "../mwgui/window_manager.hpp"
#include "../mwbase/windowmanager.hpp"
#include <mangle/input/servers/ois_driver.hpp>
#include <mangle/input/filters/eventlist.hpp>
@ -83,7 +83,7 @@ namespace MWInput
MouseLookEventPtr mouse;
OEngine::GUI::EventInjectorPtr guiEvents;
MWWorld::Player &player;
MWGui::WindowManager &windows;
MWBase::WindowManager &windows;
OMW::Engine& mEngine;
bool mDragDrop;
@ -230,7 +230,7 @@ private:
public:
InputImpl(OEngine::Render::OgreRenderer &_ogre,
MWWorld::Player &_player,
MWGui::WindowManager &_windows,
MWBase::WindowManager &_windows,
bool debug,
OMW::Engine& engine)
: ogre(_ogre),
@ -457,7 +457,7 @@ private:
/***CONSTRUCTOR***/
MWInputManager::MWInputManager(OEngine::Render::OgreRenderer &ogre,
MWWorld::Player &player,
MWGui::WindowManager &windows,
MWBase::WindowManager &windows,
bool debug,
OMW::Engine& engine)
{

@ -20,7 +20,7 @@ namespace MWWorld
class Player;
}
namespace MWGui
namespace MWBase
{
class WindowManager;
}
@ -47,7 +47,7 @@ namespace MWInput
public:
MWInputManager(OEngine::Render::OgreRenderer &_ogre,
MWWorld::Player&_player,
MWGui::WindowManager &_windows,
MWBase::WindowManager &_windows,
bool debug,
OMW::Engine& engine);
virtual ~MWInputManager();

@ -5,12 +5,11 @@
#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()
@ -265,8 +264,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)
{

@ -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 "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,8 +8,7 @@
#include <components/interpreter/opcodes.hpp>
#include "../mwbase/environment.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "interpretercontext.hpp"

@ -5,16 +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 "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
{

@ -1,9 +1,8 @@
#include "actionopen.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwclass/container.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwgui/container.hpp"
#include "class.hpp"

@ -1,7 +1,8 @@
#include "actionread.hpp"
#include "../mwbase/environment.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwgui/bookwindow.hpp"
#include "../mwgui/scrollwindow.hpp"

@ -3,8 +3,7 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "class.hpp"
#include "containerstore.hpp"

@ -1,11 +1,12 @@
#include "scene.hpp"
#include <components/esm_store/store.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" /// FIXME
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "player.hpp"
#include "localscripts.hpp"

@ -6,12 +6,11 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwrender/sky.hpp"
#include "../mwrender/player.hpp"
#include "../mwgui/window_manager.hpp"
#include "player.hpp"
#include "manualref.hpp"
#include "cellfunctors.hpp"

Loading…
Cancel
Save