1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 06:35:30 +00:00

Merge commit 'amos/gui-windows' into newchar

This commit is contained in:
Marc Zinnschlag 2010-09-15 22:20:00 +02:00
commit 8de9619579
17 changed files with 312 additions and 162 deletions

View File

@ -270,6 +270,7 @@ void OMW::Engine::go()
// Sets up the input system
MWInput::MWInputManager input(mOgre, mEnvironment.mWorld->getPlayerPos(),
*mEnvironment.mWindowManager, mDebug, *this);
mEnvironment.mInputManager = &input;
focusFrameCounter = 0;

View File

@ -285,6 +285,7 @@ namespace MWGui
}
};
#if 0
class InventoryWindow : public OEngine::GUI::Layout
{
public:
@ -403,5 +404,6 @@ namespace MWGui
MyGUI::Colour activeColor;
MyGUI::Colour inactiveColor;
};
#endif
}
#endif

View File

@ -0,0 +1,43 @@
#ifndef MWGUI_MODE_H
#define MWGUI_MODE_H
namespace MWGui
{
enum GuiMode
{
GM_Game, // Game mode, only HUD
GM_Inventory, // Inventory mode
GM_MainMenu, // Main menu mode
GM_Console, // Console mode
// None of the following are implemented yet
GM_Dialogue, // NPC interaction
GM_Barter,
GM_Rest,
// .. more here ..
// Startup character creation dialogs
GM_Name,
GM_Race,
GM_Birth,
GM_Class,
GM_Review
};
// Windows shown in inventory mode
enum GuiWindow
{
GW_None = 0,
GW_Map = 0x01,
GW_Inventory = 0x02,
GW_Magic = 0x04,
GW_Stats = 0x08,
GW_ALL = 0xFF
};
}
#endif

View File

@ -1,6 +1,7 @@
#include "race.hpp"
#include "../mwworld/environment.hpp"
#include "../mwworld/world.hpp"
#include "window_manager.hpp"
#include "components/esm_store/store.hpp"
#include <assert.h>
@ -12,7 +13,7 @@
using namespace MWGui;
RaceDialog::RaceDialog(MWWorld::Environment& environment, bool showNext)
RaceDialog::RaceDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize)
: Layout("openmw_chargen_race_layout.xml")
, environment(environment)
, genderIndex(0)
@ -21,12 +22,17 @@ RaceDialog::RaceDialog(MWWorld::Environment& environment, bool showNext)
, faceCount(10)
, hairCount(14)
{
mMainWidget->setCoord(mMainWidget->getCoord() + MyGUI::IntPoint(0, 100));
// Centre dialog
MyGUI::IntCoord coord = mMainWidget->getCoord();
coord.left = (gameWindowSize.width - coord.width)/2;
coord.top = (gameWindowSize.height - coord.height)/2;
mMainWidget->setCoord(coord);
// These are just demo values, you should replace these with
// real calls from outside the class later.
setText("AppearanceT", "Appearance");
WindowManager *wm = environment.mWindowManager;
setText("AppearanceT", wm->getGameSettingString("sRaceMenu1", "Appearance"));
getWidget(appearanceBox, "AppearanceBox");
getWidget(headRotate, "HeadRotate");
@ -38,29 +44,34 @@ RaceDialog::RaceDialog(MWWorld::Environment& environment, bool showNext)
// Set up next/previous buttons
MyGUI::ButtonPtr prevButton, nextButton;
setText("GenderChoiceT", wm->getGameSettingString("sRaceMenu2", "Change Sex"));
getWidget(prevButton, "PrevGenderButton");
getWidget(nextButton, "NextGenderButton");
prevButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousGender);
nextButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectNextGender);
setText("FaceChoiceT", wm->getGameSettingString("sRaceMenu3", "Change Face"));
getWidget(prevButton, "PrevFaceButton");
getWidget(nextButton, "NextFaceButton");
prevButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousFace);
nextButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectNextFace);
setText("HairChoiceT", wm->getGameSettingString("sRaceMenu3", "Change Hair"));
getWidget(prevButton, "PrevHairButton");
getWidget(nextButton, "NextHairButton");
prevButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousHair);
nextButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectNextHair);
setText("RaceT", "Race");
setText("RaceT", wm->getGameSettingString("sRaceMenu4", "Race"));
getWidget(raceList, "RaceList");
raceList->setScrollVisible(true);
raceList->eventListSelectAccept = MyGUI::newDelegate(this, &RaceDialog::onSelectRace);
raceList->eventListMouseItemActivate = MyGUI::newDelegate(this, &RaceDialog::onSelectRace);
raceList->eventListChangePosition = MyGUI::newDelegate(this, &RaceDialog::onSelectRace);
setText("SkillsT", wm->getGameSettingString("sBonusSkillTitle", "Skill Bonus"));
getWidget(skillList, "SkillList");
setText("SpellPowerT", wm->getGameSettingString("sRaceMenu7", "Specials"));
getWidget(spellPowerList, "SpellPowerList");
// TODO: These buttons should be managed by a Dialog class
@ -71,28 +82,54 @@ RaceDialog::RaceDialog(MWWorld::Environment& environment, bool showNext)
MyGUI::ButtonPtr okButton;
getWidget(okButton, "OKButton");
okButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onOkClicked);
if (showNext)
{
okButton->setCaption("Next");
// Adjust back button when next is shown
backButton->setCoord(backButton->getCoord() - MyGUI::IntPoint(18, 0));
okButton->setCoord(okButton->getCoord() + MyGUI::IntCoord(-18, 0, 18, 0));
}
updateRaces();
updateSkills();
updateSpellPowers();
}
void RaceDialog::setRace(const std::string &race)
void RaceDialog::setNextButtonShow(bool shown)
{
currentRace = race;
MyGUI::ButtonPtr backButton;
getWidget(backButton, "BackButton");
MyGUI::ButtonPtr okButton;
getWidget(okButton, "OKButton");
// TODO: All hardcoded coords for buttons are temporary, will be replaced with a dynamic system.
if (shown)
{
okButton->setCaption("Next");
// Adjust back button when next is shown
backButton->setCoord(MyGUI::IntCoord(471 - 18, 397, 53, 23));
okButton->setCoord(MyGUI::IntCoord(532 - 18, 397, 42 + 18, 23));
}
else
{
okButton->setCaption("OK");
backButton->setCoord(MyGUI::IntCoord(471, 397, 53, 23));
okButton->setCoord(MyGUI::IntCoord(532, 397, 42, 23));
}
}
void RaceDialog::open()
{
updateRaces();
updateSkills();
updateSpellPowers();
setVisible(true);
}
void RaceDialog::setRaceId(const std::string &raceId)
{
currentRaceId = raceId;
raceList->setIndexSelected(MyGUI::ITEM_NONE);
size_t count = raceList->getItemCount();
for (size_t i = 0; i < count; ++i)
{
if (boost::iequals(raceList->getItem(i), race))
if (boost::iequals(raceList->getItem(i), raceId))
{
raceList->setIndexSelected(i);
break;
@ -165,11 +202,11 @@ void RaceDialog::onSelectRace(MyGUI::List* _sender, size_t _index)
if (_index == MyGUI::ITEM_NONE)
return;
const std::string race = raceList->getItem(_index);
if (boost::iequals(currentRace, race))
const std::string *raceId = raceList->getItemDataAt<std::string>(_index);
if (boost::iequals(currentRaceId, *raceId))
return;
currentRace = race;
currentRaceId = *raceId;
updateSkills();
updateSpellPowers();
}
@ -192,8 +229,8 @@ void RaceDialog::updateRaces()
if (!playable) // Only display playable races
continue;
raceList->addItem(race.name);
if (boost::iequals(race.name, currentRace))
raceList->addItem(race.name, it->first);
if (boost::iequals(race.name, currentRaceId))
raceList->setIndexSelected(index);
++index;
}
@ -207,7 +244,7 @@ void RaceDialog::updateSkills()
}
skillItems.clear();
if (currentRace.empty())
if (currentRaceId.empty())
return;
MyGUI::StaticTextPtr skillNameWidget, skillBonusWidget;
@ -215,8 +252,9 @@ void RaceDialog::updateSkills()
MyGUI::IntCoord coord1(0, 0, skillList->getWidth() - (40 + 4), 18);
MyGUI::IntCoord coord2(coord1.left + coord1.width, 0, 40, 18);
WindowManager *wm = environment.mWindowManager;
ESMS::ESMStore &store = environment.mWorld->getStore();
const ESM::Race *race = store.races.find(currentRace);
const ESM::Race *race = store.races.find(currentRaceId);
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)
{
@ -227,7 +265,8 @@ void RaceDialog::updateSkills()
skillNameWidget = skillList->createWidget<MyGUI::StaticText>("SandText", coord1, MyGUI::Align::Default,
std::string("SkillName") + boost::lexical_cast<std::string>(i));
assert(skillId >= 0 && skillId < ESM::Skill::Length);
skillNameWidget->setCaption(ESMS::Skill::sSkillNames[skillId]);
const std::string &skillNameId = ESMS::Skill::sSkillNameIds[skillId];
skillNameWidget->setCaption(wm->getGameSettingString(skillNameId, skillNameId));
skillBonusWidget = skillList->createWidget<MyGUI::StaticText>("SandTextRight", coord2, MyGUI::Align::Default,
std::string("SkillBonus") + boost::lexical_cast<std::string>(i));
@ -250,7 +289,7 @@ void RaceDialog::updateSpellPowers()
}
spellPowerItems.clear();
if (currentRace.empty())
if (currentRaceId.empty())
return;
MyGUI::StaticTextPtr spellPowerWidget;
@ -258,7 +297,7 @@ void RaceDialog::updateSpellPowers()
MyGUI::IntCoord coord(0, 0, spellPowerList->getWidth(), 18);
ESMS::ESMStore &store = environment.mWorld->getStore();
const ESM::Race *race = store.races.find(currentRace);
const ESM::Race *race = store.races.find(currentRaceId);
std::vector<std::string>::const_iterator it = race->powers.list.begin();
std::vector<std::string>::const_iterator end = race->powers.list.end();

View File

@ -21,12 +21,10 @@ namespace MWGui
{
using namespace MyGUI;
typedef delegates::CDelegate0 EventHandle_Void;
class RaceDialog : public OEngine::GUI::Layout
{
public:
RaceDialog(MWWorld::Environment& environment, bool showNext);
RaceDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize);
enum Gender
{
@ -34,17 +32,21 @@ namespace MWGui
GM_Female
};
const std::string &getRace() const { return currentRace; }
const std::string &getRaceId() const { return currentRaceId; }
Gender getGender() const { return genderIndex == 0 ? GM_Male : GM_Female; }
// getFace()
// getHair()
void setRace(const std::string &race);
void setRaceId(const std::string &raceId);
void setGender(Gender gender) { genderIndex = gender == GM_Male ? 0 : 1; }
// setFace()
// setHair()
void setNextButtonShow(bool shown);
void open();
// Events
typedef delegates::CDelegate0 EventHandle_Void;
/** Event : Back button clicked.\n
signature : void method()\n
@ -93,7 +95,7 @@ namespace MWGui
int genderIndex, faceIndex, hairIndex;
int faceCount, hairCount;
std::string currentRace;
std::string currentRaceId;
};
}
#endif

View File

@ -4,32 +4,55 @@
using namespace MWGui;
TextInputDialog::TextInputDialog(MWWorld::Environment& environment, const std::string &label, bool showNext, MyGUI::IntSize size)
TextInputDialog::TextInputDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize)
: Layout("openmw_text_input_layout.xml")
, environment(environment)
{
// Centre dialog
MyGUI::IntCoord coord = mMainWidget->getCoord();
coord.left = (size.width - coord.width)/2;
coord.top = (size.height - coord.height)/2;
coord.left = (gameWindowSize.width - coord.width)/2;
coord.top = (gameWindowSize.height - coord.height)/2;
mMainWidget->setCoord(coord);
setText("LabelT", label);
getWidget(textEdit, "TextEdit");
// textEdit->eventEditSelectAccept = newDelegate(this, &TextInputDialog::onTextAccepted);
textEdit->eventEditSelectAccept = newDelegate(this, &TextInputDialog::onTextAccepted);
// TODO: These buttons should be managed by a Dialog class
MyGUI::ButtonPtr okButton;
getWidget(okButton, "OKButton");
okButton->eventMouseButtonClick = MyGUI::newDelegate(this, &TextInputDialog::onOkClicked);
if (showNext)
// Make sure the edit box has focus
MyGUI::InputManager::getInstance().setKeyFocusWidget(textEdit);
}
void TextInputDialog::setNextButtonShow(bool shown)
{
MyGUI::ButtonPtr okButton;
getWidget(okButton, "OKButton");
if (shown)
{
okButton->setCaption("Next");
// Adjust back button when next is shown
okButton->setCoord(okButton->getCoord() + MyGUI::IntCoord(-18, 0, 18, 0));
okButton->setCoord(MyGUI::IntCoord(264 - 18, 60, 42 + 18, 23));
}
else
{
okButton->setCaption("OK");
okButton->setCoord(MyGUI::IntCoord(264, 60, 42, 23));
}
}
void TextInputDialog::setTextLabel(const std::string &label)
{
setText("LabelT", label);
}
void TextInputDialog::open()
{
// Make sure the edit box has focus
MyGUI::InputManager::getInstance().setKeyFocusWidget(textEdit);
textEdit->setOnlyText("");
setVisible(true);
}
// widget controls

View File

@ -15,17 +15,20 @@ namespace MWGui
{
using namespace MyGUI;
typedef delegates::CDelegate0 EventHandle_Void;
class TextInputDialog : public OEngine::GUI::Layout
{
public:
TextInputDialog(MWWorld::Environment& environment, const std::string &label, bool showNext, MyGUI::IntSize size);
TextInputDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize);
std::string getTextInput() const { return textEdit ? textEdit->getOnlyText() : ""; }
void setTextInput(const std::string &text) { if (textEdit) textEdit->setOnlyText(text); }
void setNextButtonShow(bool shown);
void setTextLabel(const std::string &label);
void open();
// Events
typedef delegates::CDelegate0 EventHandle_Void;
/** Event : Dialog finished, OK button clicked.\n
signature : void method()\n

View File

@ -4,6 +4,7 @@
#include "race.hpp"
#include "../mwmechanics/mechanicsmanager.hpp"
#include "../mwinput/inputmanager.hpp"
#include "console.hpp"
@ -37,7 +38,9 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
menu = new MainMenu(w,h);
map = new MapWindow();
stats = new StatsWindow (environment.mWorld->getStore());
#if 0
inventory = new InventoryWindow ();
#endif
console = new Console(w,h, environment, extensions);
// The HUD is always on
@ -54,7 +57,9 @@ WindowManager::~WindowManager()
delete map;
delete menu;
delete stats;
#if 0
delete inventory;
#endif
delete nameDialog;
delete raceDialog;
@ -66,7 +71,9 @@ void WindowManager::updateVisible()
map->setVisible(false);
menu->setVisible(false);
stats->setVisible(false);
#if 0
inventory->setVisible(false);
#endif
console->disable();
// Mouse is visible whenever we're not in game mode
@ -94,19 +101,24 @@ void WindowManager::updateVisible()
if (mode == GM_Name)
{
if (!nameDialog)
nameDialog = new TextInputDialog(environment, "Name", nameChosen, gui->getViewSize());
nameDialog = new TextInputDialog(environment, gui->getViewSize());
std::string sName = getGameSettingString("sName", "Name");
nameDialog->setTextLabel(sName);
nameDialog->setNextButtonShow(nameChosen);
nameDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onNameDialogDone);
nameDialog->setVisible(true);
nameDialog->open();
return;
}
if (mode == GM_Race)
{
if (!raceDialog)
raceDialog = new RaceDialog (environment, raceChosen);
raceDialog = new RaceDialog(environment, gui->getViewSize());
raceDialog->setNextButtonShow(raceChosen);
raceDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onRaceDialogDone);
raceDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onRaceDialogBack);
raceDialog->setVisible(true);
raceDialog->open();
return;
}
@ -119,14 +131,18 @@ void WindowManager::updateVisible()
int eff = shown & allowed;
// Show the windows we want
map -> setVisible( eff & GW_Map );
stats -> setVisible( eff & GW_Stats );
map -> setVisible( (eff & GW_Map) != 0 );
stats -> setVisible( (eff & GW_Stats) != 0 );
#if 0
// inventory -> setVisible( eff & GW_Inventory );
#endif
return;
}
// All other modes are ignored
mode = GM_Game;
// Unsupported mode, switch back to game
// Note: The call will eventually end up this method again but
// will stop at the check if(mode == GM_Game) above.
environment.mInputManager->setGuiMode(GM_Game);
}
void WindowManager::setValue (const std::string& id, const MWMechanics::Stat<int>& value)
@ -162,6 +178,14 @@ void WindowManager::messageBox (const std::string& message, const std::vector<st
}
}
const std::string &WindowManager::getGameSettingString(const std::string &id, const std::string &default)
{
const ESM::GameSetting *setting = environment.mWorld->getStore().gameSettings.search(id);
if (setting && setting->type == ESM::VT_String)
return setting->str;
return default;
}
void WindowManager::updateCharacterGeneration()
{
if (raceDialog)
@ -175,40 +199,46 @@ void WindowManager::updateCharacterGeneration()
void WindowManager::onNameDialogDone()
{
nameDialog->eventDone = MWGui::TextInputDialog::EventHandle_Void();
bool goNext = nameChosen; // Go to next dialog if name was previously chosen
nameChosen = true;
if (nameDialog)
{
nameDialog->setVisible(false);
environment.mMechanicsManager->setPlayerName(nameDialog->getTextInput());
}
delete nameDialog;
nameDialog = nullptr;
updateCharacterGeneration();
if (reviewNext)
setMode(GM_Review);
else if (raceChosen)
setMode(GM_Race);
environment.mInputManager->setGuiMode(GM_Review);
else if (goNext)
environment.mInputManager->setGuiMode(GM_Race);
else
environment.mInputManager->setGuiMode(GM_Game);
}
void WindowManager::onRaceDialogDone()
{
raceDialog->eventDone = MWGui::RaceDialog::EventHandle_Void();
bool goNext = raceChosen; // Go to next dialog if race was previously chosen
raceChosen = true;
if (raceDialog)
{
raceDialog->setVisible(false);
environment.mMechanicsManager->setPlayerRace(raceDialog->getRace(), raceDialog->getGender() == RaceDialog::GM_Male);
environment.mMechanicsManager->setPlayerRace(raceDialog->getRaceId(), raceDialog->getGender() == RaceDialog::GM_Male);
}
delete raceDialog;
raceDialog = nullptr;
updateCharacterGeneration();
if (reviewNext)
setMode(GM_Review);
else if (classChosen)
setMode(GM_Class);
environment.mInputManager->setGuiMode(GM_Review);
else if (goNext)
environment.mInputManager->setGuiMode(GM_Class);
else
environment.mInputManager->setGuiMode(GM_Game);
}
void WindowManager::onRaceDialogBack()
@ -216,12 +246,10 @@ void WindowManager::onRaceDialogBack()
if (raceDialog)
{
raceDialog->setVisible(false);
environment.mMechanicsManager->setPlayerRace(raceDialog->getRace(), raceDialog->getGender() == RaceDialog::GM_Male);
environment.mMechanicsManager->setPlayerRace(raceDialog->getRaceId(), raceDialog->getGender() == RaceDialog::GM_Male);
}
delete raceDialog;
raceDialog = nullptr;
updateCharacterGeneration();
setMode(GM_Name);
environment.mInputManager->setGuiMode(GM_Name);
}

View File

@ -14,6 +14,7 @@
#include <vector>
#include "../mwmechanics/stat.hpp"
#include "mode.hpp"
namespace MyGUI
{
@ -42,42 +43,6 @@ namespace MWGui
class TextInputDialog;
class RaceDialog;
enum GuiMode
{
GM_Game, // Game mode, only HUD
GM_Inventory, // Inventory mode
GM_MainMenu, // Main menu mode
GM_Console, // Console mode
// None of the following are implemented yet
GM_Dialogue, // NPC interaction
GM_Barter,
GM_Rest,
// .. more here ..
// Startup character creation dialogs
GM_Name,
GM_Race,
GM_Birth,
GM_Class,
GM_Review
};
// Windows shown in inventory mode
enum GuiWindow
{
GW_None = 0,
GW_Map = 0x01,
GW_Inventory = 0x02,
GW_Magic = 0x04,
GW_Stats = 0x08,
GW_ALL = 0xFF
};
class WindowManager
{
MWWorld::Environment& environment;
@ -85,7 +50,9 @@ namespace MWGui
MapWindow *map;
MainMenu *menu;
StatsWindow *stats;
#if 0
InventoryWindow *inventory;
#endif
Console *console;
// Character creation
@ -172,6 +139,15 @@ namespace MWGui
void messageBox (const std::string& message, const std::vector<std::string>& buttons);
/**
* 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);
private:
void updateCharacterGeneration();
void checkCharacterGeneration(GuiMode mode);

View File

@ -79,34 +79,6 @@ namespace MWInput
ogre.screenshot(buf);
}
// Switch between gui modes. Besides controlling the Gui windows
// this also makes sure input is directed to the right place
void setGuiMode(MWGui::GuiMode mode)
{
// Tell the GUI what to show (this also takes care of the mouse
// pointer)
windows.setMode(mode);
// Are we in GUI mode now?
if(windows.isGuiMode())
{
// Disable mouse look
mouse->setCamera(NULL);
// Enable GUI events
guiEvents->enabled = true;
}
else
{
// Start mouse-looking again. TODO: This should also allow
// for other ways to disable mouselook, like paralyzation.
mouse->setCamera(player.getCamera());
// Disable GUI events
guiEvents->enabled = false;
}
}
// Called when the user presses the button to toggle the inventory
// screen.
void toggleInventory()
@ -275,6 +247,34 @@ namespace MWInput
return true;
}
// Switch between gui modes. Besides controlling the Gui windows
// this also makes sure input is directed to the right place
void setGuiMode(MWGui::GuiMode mode)
{
// Tell the GUI what to show (this also takes care of the mouse
// pointer)
windows.setMode(mode);
// Are we in GUI mode now?
if(windows.isGuiMode())
{
// Disable mouse look
mouse->setCamera(NULL);
// Enable GUI events
guiEvents->enabled = true;
}
else
{
// Start mouse-looking again. TODO: This should also allow
// for other ways to disable mouselook, like paralyzation.
mouse->setCamera(player.getCamera());
// Disable GUI events
guiEvents->enabled = false;
}
}
};
MWInputManager::MWInputManager(OEngine::Render::OgreRenderer &ogre,
@ -290,4 +290,9 @@ namespace MWInput
{
delete impl;
}
void MWInputManager::setGuiMode(MWGui::GuiMode mode)
{
impl->setGuiMode(mode);
}
}

View File

@ -1,6 +1,8 @@
#ifndef _MWINPUT_MWINPUTMANAGER_H
#define _MWINPUT_MWINPUTMANAGER_H
#include "../mwgui/mode.hpp"
namespace OEngine
{
namespace Render
@ -45,6 +47,8 @@ namespace MWInput
bool debug,
OMW::Engine& engine);
~MWInputManager();
void setGuiMode(MWGui::GuiMode mode);
};
}
#endif

View File

@ -8,6 +8,7 @@
#include <components/interpreter/opcodes.hpp>
#include "../mwgui/window_manager.hpp"
#include "../mwinput/inputmanager.hpp"
#include "interpretercontext.hpp"
@ -47,7 +48,7 @@ namespace MWScript
InterpreterContext& context =
static_cast<InterpreterContext&> (runtime.getContext());
context.getWindowManager().setMode(mDialogue);
context.getInputManager().setGuiMode(mDialogue);
}
};

View File

@ -11,6 +11,8 @@
#include "../mwgui/window_manager.hpp"
#include "../mwinput/inputmanager.hpp"
#include "locals.hpp"
#include "globalscripts.hpp"
@ -263,6 +265,11 @@ namespace MWScript
return *mEnvironment.mWindowManager;
}
MWInput::MWInputManager& InterpreterContext::getInputManager()
{
return *mEnvironment.mInputManager;
}
MWWorld::World& InterpreterContext::getWorld()
{
return *mEnvironment.mWorld;

View File

@ -15,6 +15,11 @@ namespace MWSound
class SoundManager;
}
namespace MWInput
{
struct MWInputManager;
}
namespace MWScript
{
struct Locals;
@ -107,6 +112,8 @@ namespace MWScript
MWGui::WindowManager& getWindowManager();
MWInput::MWInputManager& getInputManager();
MWWorld::Ptr getReference();
///< Reference, that the script is running from (can be empty)
};

View File

@ -26,6 +26,11 @@ namespace MWDialogue
class DialogueManager;
}
namespace MWInput
{
struct MWInputManager;
}
namespace MWWorld
{
class World;
@ -36,7 +41,8 @@ namespace MWWorld
public:
Environment()
: mWorld (0), mSoundManager (0), mGlobalScripts (0), mWindowManager (0),
mMechanicsManager (0), mDialogueManager (0), mFrameDuration (0)
mMechanicsManager (0), mDialogueManager (0), mFrameDuration (0),
mInputManager (0)
{}
World *mWorld;
@ -46,6 +52,9 @@ namespace MWWorld
MWMechanics::MechanicsManager *mMechanicsManager;
MWDialogue::DialogueManager *mDialogueManager;
float mFrameDuration;
// For setting GUI mode
MWInput::MWInputManager *mInputManager;
};
}

View File

@ -61,7 +61,7 @@ struct Skill
HandToHand = 26,
Length
};
static const std::string sSkillNames[Length];
static const std::string sSkillNameIds[Length];
void load(ESMReader &esm)
{

View File

@ -2,33 +2,33 @@
namespace ESM
{
const std::string Skill::sSkillNames[Length] = {
"Block",
"Armorer",
"Medium Armor",
"Heavy Armor",
"Blunt Weapon",
"Long Blade",
"Axe",
"Spear",
"Athletics",
"Enchant",
"Destruction",
"Alteration",
"Illusion",
"Conjuration",
"Mysticism",
"Restoration",
"Alchemy",
"Unarmored",
"Security",
"Sneak",
"Acrobatics",
"Light Armor",
"Short Blade",
"Marksman",
"Mercantile",
"Speechcraft",
"Hand To Hand",
const std::string Skill::sSkillNameIds[Length] = {
"sSkillBlock",
"sSkillArmorer",
"sSkillMediumarmor",
"sSkillHeavyarmor",
"sSkillBluntweapon",
"sSkillLongblade",
"sSkillAxe",
"sSkillSpear",
"sSkillAthletics",
"sSkillEnchant",
"sSkillDestruction",
"sSkillAlteration",
"sSkillIllusion",
"sSkillConjuration",
"sSkillMysticism",
"sSkillRestoration",
"sSkillAlchemy",
"sSkillUnarmored",
"sSkillSecurity",
"sSkillSneak",
"sSkillAcrobatics",
"sSkillLightarmor",
"sSkillShortblade",
"sSkillMarksman",
"sSkillMercantile",
"sSkillSpeechcraft",
"sSkillHandtohand",
};
}