mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-05 14:45:39 +00:00
Finally merged in master
This commit is contained in:
commit
0697c7f7f4
279 changed files with 16191 additions and 6911 deletions
|
@ -15,7 +15,7 @@ include (OpenMWMacros)
|
|||
# Version
|
||||
|
||||
set (OPENMW_VERSION_MAJOR 0)
|
||||
set (OPENMW_VERSION_MINOR 16)
|
||||
set (OPENMW_VERSION_MINOR 17)
|
||||
set (OPENMW_VERSION_RELEASE 0)
|
||||
|
||||
set (OPENMW_VERSION "${OPENMW_VERSION_MAJOR}.${OPENMW_VERSION_MINOR}.${OPENMW_VERSION_RELEASE}")
|
||||
|
@ -96,19 +96,13 @@ ENDIF()
|
|||
|
||||
set(LIBDIR ${CMAKE_SOURCE_DIR}/libs)
|
||||
|
||||
set(MANGLE_INPUT ${LIBDIR}/mangle/input/servers/ois_driver.cpp)
|
||||
set(MANGLE_ALL ${MANGLE_INPUT})
|
||||
source_group(libs\\mangle FILES ${MANGLE_ALL})
|
||||
|
||||
set(OENGINE_OGRE
|
||||
${LIBDIR}/openengine/ogre/renderer.cpp
|
||||
${LIBDIR}/openengine/ogre/mouselook.cpp
|
||||
${LIBDIR}/openengine/ogre/fader.cpp
|
||||
${LIBDIR}/openengine/ogre/imagerotate.cpp
|
||||
${LIBDIR}/openengine/ogre/atlas.cpp
|
||||
)
|
||||
set(OENGINE_GUI
|
||||
${LIBDIR}/openengine/gui/events.cpp
|
||||
${LIBDIR}/openengine/gui/manager.cpp
|
||||
)
|
||||
|
||||
|
@ -135,7 +129,7 @@ set(OENGINE_BULLET
|
|||
set(OENGINE_ALL ${OENGINE_OGRE} ${OENGINE_GUI} ${OENGINE_BULLET})
|
||||
source_group(libs\\openengine FILES ${OENGINE_ALL})
|
||||
|
||||
set(OPENMW_LIBS ${MANGLE_ALL} ${OENGINE_ALL})
|
||||
set(OPENMW_LIBS ${OENGINE_ALL})
|
||||
set(OPENMW_LIBS_HEADER)
|
||||
|
||||
# Sound setup
|
||||
|
@ -257,13 +251,15 @@ if (APPLE)
|
|||
"${APP_BUNDLE_DIR}/Contents/Resources/OpenMW.icns" COPYONLY)
|
||||
endif (APPLE)
|
||||
|
||||
# Set up DEBUG define
|
||||
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS_DEBUG DEBUG=1)
|
||||
|
||||
# Set up Ogre plugin folder & debug suffix
|
||||
# Ogre on OS X doesn't use "_d" suffix (see Ogre's CMakeLists.txt)
|
||||
if (DEFINED CMAKE_BUILD_TYPE AND CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT APPLE)
|
||||
add_definitions(-DOGRE_PLUGIN_DEBUG_SUFFIX="_d")
|
||||
else()
|
||||
if (APPLE)
|
||||
# Ogre on OS X doesn't use "_d" suffix (see Ogre's CMakeLists.txt)
|
||||
add_definitions(-DOGRE_PLUGIN_DEBUG_SUFFIX="")
|
||||
else ()
|
||||
add_definitions(-DOGRE_PLUGIN_DEBUG_SUFFIX="_d")
|
||||
endif()
|
||||
|
||||
add_definitions(-DOGRE_PLUGIN_DIR_REL="${OGRE_PLUGIN_DIR_REL}")
|
||||
|
@ -443,6 +439,7 @@ endif(WIN32)
|
|||
|
||||
# Extern
|
||||
add_subdirectory (extern/shiny)
|
||||
add_subdirectory (extern/oics)
|
||||
|
||||
# Components
|
||||
add_subdirectory (components)
|
||||
|
|
|
@ -20,30 +20,31 @@ add_openmw_dir (mwrender
|
|||
)
|
||||
|
||||
add_openmw_dir (mwinput
|
||||
inputmanager
|
||||
inputmanagerimp
|
||||
)
|
||||
|
||||
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
|
||||
confirmationdialog alchemywindow referenceinterface spellwindow
|
||||
confirmationdialog alchemywindow referenceinterface spellwindow mainmenu quickkeysmenu
|
||||
itemselection
|
||||
)
|
||||
|
||||
add_openmw_dir (mwdialogue
|
||||
dialoguemanager journal journalentry quest topic
|
||||
dialoguemanagerimp journalimp journalentry quest topic
|
||||
)
|
||||
|
||||
add_openmw_dir (mwscript
|
||||
locals scriptmanager compilercontext interpretercontext cellextensions miscextensions
|
||||
locals scriptmanagerimp compilercontext interpretercontext cellextensions miscextensions
|
||||
guiextensions soundextensions skyextensions statsextensions containerextensions
|
||||
aiextensions controlextensions extensions globalscripts ref dialogueextensions
|
||||
animationextensions transformationextensions consoleextensions userextensions
|
||||
)
|
||||
|
||||
add_openmw_dir (mwsound
|
||||
soundmanager openal_output audiere_decoder mpgsnd_decoder ffmpeg_decoder
|
||||
soundmanagerimp openal_output audiere_decoder mpgsnd_decoder ffmpeg_decoder
|
||||
)
|
||||
|
||||
add_openmw_dir (mwworld
|
||||
|
@ -59,12 +60,13 @@ add_openmw_dir (mwclass
|
|||
)
|
||||
|
||||
add_openmw_dir (mwmechanics
|
||||
mechanicsmanager stat creaturestats magiceffects movement actors drawstate spells
|
||||
mechanicsmanagerimp stat creaturestats magiceffects movement actors drawstate spells
|
||||
activespells npcstats
|
||||
)
|
||||
|
||||
add_openmw_dir (mwbase
|
||||
environment world
|
||||
environment world scriptmanager dialoguemanager journal soundmanager mechanicsmanager
|
||||
inputmanager windowmanager
|
||||
)
|
||||
|
||||
# Main executable
|
||||
|
@ -102,6 +104,7 @@ target_link_libraries(openmw
|
|||
${MYGUI_PLATFORM_LIBRARIES}
|
||||
"shiny"
|
||||
"shiny.OgrePlatform"
|
||||
"oics"
|
||||
components
|
||||
)
|
||||
|
||||
|
@ -112,7 +115,9 @@ endif()
|
|||
|
||||
if(APPLE)
|
||||
find_library(CARBON_FRAMEWORK Carbon)
|
||||
target_link_libraries(openmw ${CARBON_FRAMEWORK})
|
||||
find_library(COCOA_FRAMEWORK Cocoa)
|
||||
find_library(IOKIT_FRAMEWORK IOKit)
|
||||
target_link_libraries(openmw ${CARBON_FRAMEWORK} ${COCOA_FRAMEWORK} ${IOKIT_FRAMEWORK})
|
||||
endif(APPLE)
|
||||
|
||||
if(DPKG_PROGRAM)
|
||||
|
|
|
@ -13,15 +13,15 @@
|
|||
#include <components/nifbullet/bullet_nif_loader.hpp>
|
||||
#include <components/nifogre/ogre_nif_loader.hpp>
|
||||
|
||||
#include "mwinput/inputmanager.hpp"
|
||||
#include "mwinput/inputmanagerimp.hpp"
|
||||
|
||||
#include "mwgui/window_manager.hpp"
|
||||
#include "mwgui/windowmanagerimp.hpp"
|
||||
#include "mwgui/cursorreplace.hpp"
|
||||
|
||||
#include "mwscript/scriptmanager.hpp"
|
||||
#include "mwscript/scriptmanagerimp.hpp"
|
||||
#include "mwscript/extensions.hpp"
|
||||
|
||||
#include "mwsound/soundmanager.hpp"
|
||||
#include "mwsound/soundmanagerimp.hpp"
|
||||
|
||||
#include "mwworld/class.hpp"
|
||||
#include "mwworld/player.hpp"
|
||||
|
@ -29,10 +29,10 @@
|
|||
|
||||
#include "mwclass/classes.hpp"
|
||||
|
||||
#include "mwdialogue/dialoguemanager.hpp"
|
||||
#include "mwdialogue/journal.hpp"
|
||||
#include "mwdialogue/dialoguemanagerimp.hpp"
|
||||
#include "mwdialogue/journalimp.hpp"
|
||||
|
||||
#include "mwmechanics/mechanicsmanager.hpp"
|
||||
#include "mwmechanics/mechanicsmanagerimp.hpp"
|
||||
|
||||
|
||||
void OMW::Engine::executeLocalScripts()
|
||||
|
@ -67,7 +67,7 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
|
|||
mEnvironment.setFrameDuration (evt.timeSinceLastFrame);
|
||||
|
||||
// update input
|
||||
MWBase::Environment::get().getInputManager()->update();
|
||||
MWBase::Environment::get().getInputManager()->update(evt.timeSinceLastFrame);
|
||||
|
||||
// sound
|
||||
if (mUseSound)
|
||||
|
@ -270,6 +270,10 @@ void OMW::Engine::go()
|
|||
else if (boost::filesystem::exists(globaldefault))
|
||||
settings.loadUser(globaldefault);
|
||||
|
||||
// Get the path for the keybinder xml file
|
||||
std::string keybinderUser = (mCfgMgr.getUserPath() / "input.xml").string();
|
||||
bool keybinderUserExists = boost::filesystem::exists(keybinderUser);
|
||||
|
||||
mFpsLevel = settings.getInt("fps", "HUD");
|
||||
|
||||
// load nif overrides
|
||||
|
@ -352,6 +356,8 @@ void OMW::Engine::go()
|
|||
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
||||
pos.pos[2] = 0;
|
||||
|
||||
mEnvironment.getWorld()->renderPlayer();
|
||||
|
||||
if (const ESM::Cell *exterior = MWBase::Environment::get().getWorld()->getExterior (mCellName))
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->indexToPosition (exterior->data.gridX, exterior->data.gridY,
|
||||
|
@ -366,9 +372,9 @@ void OMW::Engine::go()
|
|||
|
||||
// Sets up the input system
|
||||
|
||||
mEnvironment.setInputManager (new MWInput::MWInputManager (*mOgre,
|
||||
mEnvironment.setInputManager (new MWInput::InputManager (*mOgre,
|
||||
MWBase::Environment::get().getWorld()->getPlayer(),
|
||||
*MWBase::Environment::get().getWindowManager(), mDebug, *this));
|
||||
*MWBase::Environment::get().getWindowManager(), mDebug, *this, keybinderUser, keybinderUserExists));
|
||||
|
||||
std::cout << "\nPress Q/ESC or close window to exit.\n";
|
||||
|
||||
|
|
46
apps/openmw/mwbase/dialoguemanager.hpp
Normal file
46
apps/openmw/mwbase/dialoguemanager.hpp
Normal file
|
@ -0,0 +1,46 @@
|
|||
#ifndef GAME_MWBASE_DIALOGUEMANAGER_H
|
||||
#define GAME_MWBASE_DIALOGUEMANAGER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class Ptr;
|
||||
}
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
/// \brief Interface for dialogue manager (implemented in MWDialogue)
|
||||
class DialogueManager
|
||||
{
|
||||
DialogueManager (const DialogueManager&);
|
||||
///< not implemented
|
||||
|
||||
DialogueManager& operator= (const DialogueManager&);
|
||||
///< not implemented
|
||||
|
||||
public:
|
||||
|
||||
DialogueManager() {}
|
||||
|
||||
virtual ~DialogueManager() {}
|
||||
|
||||
virtual void startDialogue (const MWWorld::Ptr& actor) = 0;
|
||||
|
||||
virtual void addTopic (const std::string& topic) = 0;
|
||||
|
||||
virtual void askQuestion (const std::string& question,int choice) = 0;
|
||||
|
||||
virtual void goodbye() = 0;
|
||||
|
||||
///get the faction of the actor you are talking with
|
||||
virtual std::string getFaction() const = 0;
|
||||
|
||||
//calbacks for the GUI
|
||||
virtual void keywordSelected (const std::string& keyword) = 0;
|
||||
virtual void goodbyeSelected() = 0;
|
||||
virtual void questionAnswered (const std::string& answer) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -3,18 +3,14 @@
|
|||
|
||||
#include <cassert>
|
||||
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
|
||||
#include "../mwscript/scriptmanager.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
#include "../mwdialogue/dialoguemanager.hpp"
|
||||
#include "../mwdialogue/journal.hpp"
|
||||
|
||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||
|
||||
#include "world.hpp"
|
||||
#include "scriptmanager.hpp"
|
||||
#include "dialoguemanager.hpp"
|
||||
#include "journal.hpp"
|
||||
#include "soundmanager.hpp"
|
||||
#include "mechanicsmanager.hpp"
|
||||
#include "inputmanager.hpp"
|
||||
#include "windowmanager.hpp"
|
||||
|
||||
MWBase::Environment *MWBase::Environment::sThis = 0;
|
||||
|
||||
|
@ -37,37 +33,37 @@ void MWBase::Environment::setWorld (World *world)
|
|||
mWorld = world;
|
||||
}
|
||||
|
||||
void MWBase::Environment::setSoundManager (MWSound::SoundManager *soundManager)
|
||||
void MWBase::Environment::setSoundManager (SoundManager *soundManager)
|
||||
{
|
||||
mSoundManager = soundManager;
|
||||
}
|
||||
|
||||
void MWBase::Environment::setScriptManager (MWScript::ScriptManager *scriptManager)
|
||||
void MWBase::Environment::setScriptManager (ScriptManager *scriptManager)
|
||||
{
|
||||
mScriptManager = scriptManager;
|
||||
}
|
||||
|
||||
void MWBase::Environment::setWindowManager (MWGui::WindowManager *windowManager)
|
||||
void MWBase::Environment::setWindowManager (WindowManager *windowManager)
|
||||
{
|
||||
mWindowManager = windowManager;
|
||||
}
|
||||
|
||||
void MWBase::Environment::setMechanicsManager (MWMechanics::MechanicsManager *mechanicsManager)
|
||||
void MWBase::Environment::setMechanicsManager (MechanicsManager *mechanicsManager)
|
||||
{
|
||||
mMechanicsManager = mechanicsManager;
|
||||
}
|
||||
|
||||
void MWBase::Environment::setDialogueManager (MWDialogue::DialogueManager *dialogueManager)
|
||||
void MWBase::Environment::setDialogueManager (DialogueManager *dialogueManager)
|
||||
{
|
||||
mDialogueManager = dialogueManager;
|
||||
}
|
||||
|
||||
void MWBase::Environment::setJournal (MWDialogue::Journal *journal)
|
||||
void MWBase::Environment::setJournal (Journal *journal)
|
||||
{
|
||||
mJournal = journal;
|
||||
}
|
||||
|
||||
void MWBase::Environment::setInputManager (MWInput::MWInputManager *inputManager)
|
||||
void MWBase::Environment::setInputManager (InputManager *inputManager)
|
||||
{
|
||||
mInputManager = inputManager;
|
||||
}
|
||||
|
@ -83,43 +79,43 @@ MWBase::World *MWBase::Environment::getWorld() const
|
|||
return mWorld;
|
||||
}
|
||||
|
||||
MWSound::SoundManager *MWBase::Environment::getSoundManager() const
|
||||
MWBase::SoundManager *MWBase::Environment::getSoundManager() const
|
||||
{
|
||||
assert (mSoundManager);
|
||||
return mSoundManager;
|
||||
}
|
||||
|
||||
MWScript::ScriptManager *MWBase::Environment::getScriptManager() const
|
||||
MWBase::ScriptManager *MWBase::Environment::getScriptManager() const
|
||||
{
|
||||
assert (mScriptManager);
|
||||
return mScriptManager;
|
||||
}
|
||||
|
||||
MWGui::WindowManager *MWBase::Environment::getWindowManager() const
|
||||
MWBase::WindowManager *MWBase::Environment::getWindowManager() const
|
||||
{
|
||||
assert (mWindowManager);
|
||||
return mWindowManager;
|
||||
}
|
||||
|
||||
MWMechanics::MechanicsManager *MWBase::Environment::getMechanicsManager() const
|
||||
MWBase::MechanicsManager *MWBase::Environment::getMechanicsManager() const
|
||||
{
|
||||
assert (mMechanicsManager);
|
||||
return mMechanicsManager;
|
||||
}
|
||||
|
||||
MWDialogue::DialogueManager *MWBase::Environment::getDialogueManager() const
|
||||
MWBase::DialogueManager *MWBase::Environment::getDialogueManager() const
|
||||
{
|
||||
assert (mDialogueManager);
|
||||
return mDialogueManager;
|
||||
}
|
||||
|
||||
MWDialogue::Journal *MWBase::Environment::getJournal() const
|
||||
MWBase::Journal *MWBase::Environment::getJournal() const
|
||||
{
|
||||
assert (mJournal);
|
||||
return mJournal;
|
||||
}
|
||||
|
||||
MWInput::MWInputManager *MWBase::Environment::getInputManager() const
|
||||
MWBase::InputManager *MWBase::Environment::getInputManager() const
|
||||
{
|
||||
assert (mInputManager);
|
||||
return mInputManager;
|
||||
|
@ -150,6 +146,9 @@ void MWBase::Environment::cleanup()
|
|||
delete mScriptManager;
|
||||
mScriptManager = 0;
|
||||
|
||||
delete mWindowManager;
|
||||
mWindowManager = 0;
|
||||
|
||||
delete mWorld;
|
||||
mWorld = 0;
|
||||
}
|
||||
|
|
|
@ -1,40 +1,16 @@
|
|||
#ifndef GAME_BASE_INVIRONMENT_H
|
||||
#define GAME_BASE_INVIRONMENT_H
|
||||
|
||||
namespace MWSound
|
||||
{
|
||||
class SoundManager;
|
||||
}
|
||||
|
||||
namespace MWScript
|
||||
{
|
||||
class ScriptManager;
|
||||
}
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class WindowManager;
|
||||
}
|
||||
|
||||
namespace MWMechanics
|
||||
{
|
||||
class MechanicsManager;
|
||||
}
|
||||
|
||||
namespace MWDialogue
|
||||
{
|
||||
class DialogueManager;
|
||||
class Journal;
|
||||
}
|
||||
|
||||
namespace MWInput
|
||||
{
|
||||
struct MWInputManager;
|
||||
}
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
class World;
|
||||
class ScriptManager;
|
||||
class DialogueManager;
|
||||
class Journal;
|
||||
class SoundManager;
|
||||
class MechanicsManager;
|
||||
class InputManager;
|
||||
class WindowManager;
|
||||
|
||||
/// \brief Central hub for mw-subsystems
|
||||
///
|
||||
|
@ -47,13 +23,13 @@ namespace MWBase
|
|||
static Environment *sThis;
|
||||
|
||||
World *mWorld;
|
||||
MWSound::SoundManager *mSoundManager;
|
||||
MWScript::ScriptManager *mScriptManager;
|
||||
MWGui::WindowManager *mWindowManager;
|
||||
MWMechanics::MechanicsManager *mMechanicsManager;
|
||||
MWDialogue::DialogueManager *mDialogueManager;
|
||||
MWDialogue::Journal *mJournal;
|
||||
MWInput::MWInputManager *mInputManager;
|
||||
SoundManager *mSoundManager;
|
||||
ScriptManager *mScriptManager;
|
||||
WindowManager *mWindowManager;
|
||||
MechanicsManager *mMechanicsManager;
|
||||
DialogueManager *mDialogueManager;
|
||||
Journal *mJournal;
|
||||
InputManager *mInputManager;
|
||||
float mFrameDuration;
|
||||
|
||||
Environment (const Environment&);
|
||||
|
@ -70,38 +46,38 @@ namespace MWBase
|
|||
|
||||
void setWorld (World *world);
|
||||
|
||||
void setSoundManager (MWSound::SoundManager *soundManager);
|
||||
void setSoundManager (SoundManager *soundManager);
|
||||
|
||||
void setScriptManager (MWScript::ScriptManager *scriptManager);
|
||||
void setScriptManager (MWBase::ScriptManager *scriptManager);
|
||||
|
||||
void setWindowManager (MWGui::WindowManager *windowManager);
|
||||
void setWindowManager (WindowManager *windowManager);
|
||||
|
||||
void setMechanicsManager (MWMechanics::MechanicsManager *mechanicsManager);
|
||||
void setMechanicsManager (MechanicsManager *mechanicsManager);
|
||||
|
||||
void setDialogueManager (MWDialogue::DialogueManager *dialogueManager);
|
||||
void setDialogueManager (DialogueManager *dialogueManager);
|
||||
|
||||
void setJournal (MWDialogue::Journal *journal);
|
||||
void setJournal (Journal *journal);
|
||||
|
||||
void setInputManager (MWInput::MWInputManager *inputManager);
|
||||
void setInputManager (InputManager *inputManager);
|
||||
|
||||
void setFrameDuration (float duration);
|
||||
///< Set length of current frame in seconds.
|
||||
|
||||
World *getWorld() const;
|
||||
|
||||
MWSound::SoundManager *getSoundManager() const;
|
||||
SoundManager *getSoundManager() const;
|
||||
|
||||
MWScript::ScriptManager *getScriptManager() const;
|
||||
ScriptManager *getScriptManager() const;
|
||||
|
||||
MWGui::WindowManager *getWindowManager() const;
|
||||
WindowManager *getWindowManager() const;
|
||||
|
||||
MWMechanics::MechanicsManager *getMechanicsManager() const;
|
||||
MechanicsManager *getMechanicsManager() const;
|
||||
|
||||
MWDialogue::DialogueManager *getDialogueManager() const;
|
||||
DialogueManager *getDialogueManager() const;
|
||||
|
||||
MWDialogue::Journal *getJournal() const;
|
||||
Journal *getJournal() const;
|
||||
|
||||
MWInput::MWInputManager *getInputManager() const;
|
||||
InputManager *getInputManager() const;
|
||||
|
||||
float getFrameDuration() const;
|
||||
|
||||
|
|
44
apps/openmw/mwbase/inputmanager.hpp
Normal file
44
apps/openmw/mwbase/inputmanager.hpp
Normal file
|
@ -0,0 +1,44 @@
|
|||
#ifndef GAME_MWBASE_INPUTMANAGER_H
|
||||
#define GAME_MWBASE_INPUTMANAGER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
/// \brief Interface for input manager (implemented in MWInput)
|
||||
class InputManager
|
||||
{
|
||||
InputManager (const InputManager&);
|
||||
///< not implemented
|
||||
|
||||
InputManager& operator= (const InputManager&);
|
||||
///< not implemented
|
||||
|
||||
public:
|
||||
|
||||
InputManager() {}
|
||||
|
||||
virtual ~InputManager() {}
|
||||
|
||||
virtual void update(float dt) = 0;
|
||||
|
||||
virtual void changeInputMode(bool guiMode) = 0;
|
||||
|
||||
virtual void processChangedSettings(const Settings::CategorySettingVector& changed) = 0;
|
||||
|
||||
virtual void setDragDrop(bool dragDrop) = 0;
|
||||
|
||||
virtual void toggleControlSwitch (const std::string& sw, bool value) = 0;
|
||||
|
||||
virtual std::string getActionDescription (int action) = 0;
|
||||
virtual std::string getActionBindingName (int action) = 0;
|
||||
virtual std::vector<int> getActionSorting () = 0;
|
||||
virtual int getNumActions() = 0;
|
||||
virtual void enableDetectingBindingMode (int action) = 0;
|
||||
virtual void resetToDefaultBindings() = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
73
apps/openmw/mwbase/journal.hpp
Normal file
73
apps/openmw/mwbase/journal.hpp
Normal file
|
@ -0,0 +1,73 @@
|
|||
#ifndef GAME_MWBASE_JOURNAL_H
|
||||
#define GAME_MWBASE_JOURNAL_H
|
||||
|
||||
#include <string>
|
||||
#include <deque>
|
||||
#include <map>
|
||||
|
||||
#include "../mwdialogue/journalentry.hpp"
|
||||
#include "../mwdialogue/topic.hpp"
|
||||
#include "../mwdialogue/quest.hpp"
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
/// \brief Interface for the player's journal (implemented in MWDialogue)
|
||||
class Journal
|
||||
{
|
||||
Journal (const Journal&);
|
||||
///< not implemented
|
||||
|
||||
Journal& operator= (const Journal&);
|
||||
///< not implemented
|
||||
|
||||
public:
|
||||
|
||||
typedef std::deque<MWDialogue::StampedJournalEntry> TEntryContainer;
|
||||
typedef TEntryContainer::const_iterator TEntryIter;
|
||||
typedef std::map<std::string, MWDialogue::Quest> TQuestContainer; // topc, quest
|
||||
typedef TQuestContainer::const_iterator TQuestIter;
|
||||
typedef std::map<std::string, MWDialogue::Topic> TTopicContainer; // topic-id, topic-content
|
||||
typedef TTopicContainer::const_iterator TTopicIter;
|
||||
|
||||
public:
|
||||
|
||||
Journal() {}
|
||||
|
||||
virtual ~Journal() {}
|
||||
|
||||
virtual void addEntry (const std::string& id, int index) = 0;
|
||||
///< Add a journal entry.
|
||||
|
||||
virtual void setJournalIndex (const std::string& id, int index) = 0;
|
||||
///< Set the journal index without adding an entry.
|
||||
|
||||
virtual int getJournalIndex (const std::string& id) const = 0;
|
||||
///< Get the journal index.
|
||||
|
||||
virtual void addTopic (const std::string& topicId, const std::string& infoId) = 0;
|
||||
|
||||
virtual TEntryIter begin() const = 0;
|
||||
///< Iterator pointing to the begin of the main journal.
|
||||
///
|
||||
/// \note Iterators to main journal entries will never become invalid.
|
||||
|
||||
virtual TEntryIter end() const = 0;
|
||||
///< Iterator pointing past the end of the main journal.
|
||||
|
||||
virtual TQuestIter questBegin() const = 0;
|
||||
///< Iterator pointing to the first quest (sorted by topic ID)
|
||||
|
||||
virtual TQuestIter questEnd() const = 0;
|
||||
///< Iterator pointing past the last quest.
|
||||
|
||||
virtual TTopicIter topicBegin() const = 0;
|
||||
///< Iterator pointing to the first topic (sorted by topic ID)
|
||||
///
|
||||
/// \note The topic ID is identical with the user-visible topic string.
|
||||
|
||||
virtual TTopicIter topicEnd() const = 0;
|
||||
///< Iterator pointing past the last topic.
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
77
apps/openmw/mwbase/mechanicsmanager.hpp
Normal file
77
apps/openmw/mwbase/mechanicsmanager.hpp
Normal file
|
@ -0,0 +1,77 @@
|
|||
#ifndef GAME_MWBASE_MECHANICSMANAGER_H
|
||||
#define GAME_MWBASE_MECHANICSMANAGER_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Ogre
|
||||
{
|
||||
class Vector3;
|
||||
}
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
struct Class;
|
||||
}
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class Ptr;
|
||||
class CellStore;
|
||||
}
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
/// \brief Interface for game mechanics manager (implemented in MWMechanics)
|
||||
class MechanicsManager
|
||||
{
|
||||
MechanicsManager (const MechanicsManager&);
|
||||
///< not implemented
|
||||
|
||||
MechanicsManager& operator= (const MechanicsManager&);
|
||||
///< not implemented
|
||||
|
||||
public:
|
||||
|
||||
MechanicsManager() {}
|
||||
|
||||
virtual ~MechanicsManager() {}
|
||||
|
||||
virtual void addActor (const MWWorld::Ptr& ptr) = 0;
|
||||
///< Register an actor for stats management
|
||||
|
||||
virtual void removeActor (const MWWorld::Ptr& ptr) = 0;
|
||||
///< Deregister an actor for stats management
|
||||
|
||||
virtual void dropActors (const MWWorld::CellStore *cellStore) = 0;
|
||||
///< Deregister all actors in the given cell.
|
||||
|
||||
virtual void watchActor (const MWWorld::Ptr& ptr) = 0;
|
||||
///< On each update look for changes in a previously registered actor and update the
|
||||
/// GUI accordingly.
|
||||
|
||||
virtual void update (std::vector<std::pair<std::string, Ogre::Vector3> >& movement,
|
||||
float duration, bool paused) = 0;
|
||||
///< Update actor stats and store desired velocity vectors in \a movement
|
||||
///
|
||||
/// \param paused In game type does not currently advance (this usually means some GUI
|
||||
/// component is up).
|
||||
|
||||
virtual void setPlayerName (const std::string& name) = 0;
|
||||
///< Set player name.
|
||||
|
||||
virtual void setPlayerRace (const std::string& id, bool male) = 0;
|
||||
///< Set player race.
|
||||
|
||||
virtual void setPlayerBirthsign (const std::string& id) = 0;
|
||||
///< Set player birthsign.
|
||||
|
||||
virtual void setPlayerClass (const std::string& id) = 0;
|
||||
///< Set player class to stock class.
|
||||
|
||||
virtual void setPlayerClass (const ESM::Class& class_) = 0;
|
||||
///< Set player class to custom class.
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
62
apps/openmw/mwbase/scriptmanager.hpp
Normal file
62
apps/openmw/mwbase/scriptmanager.hpp
Normal file
|
@ -0,0 +1,62 @@
|
|||
#ifndef GAME_MWBASE_SCRIPTMANAGER_H
|
||||
#define GAME_MWBASE_SCRIPTMANAGER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Interpreter
|
||||
{
|
||||
class Context;
|
||||
}
|
||||
|
||||
namespace Compiler
|
||||
{
|
||||
class Locals;
|
||||
}
|
||||
|
||||
namespace MWScript
|
||||
{
|
||||
class GlobalScripts;
|
||||
}
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
/// \brief Interface for script manager (implemented in MWScript)
|
||||
class ScriptManager
|
||||
{
|
||||
ScriptManager (const ScriptManager&);
|
||||
///< not implemented
|
||||
|
||||
ScriptManager& operator= (const ScriptManager&);
|
||||
///< not implemented
|
||||
|
||||
public:
|
||||
|
||||
ScriptManager() {}
|
||||
|
||||
virtual ~ScriptManager() {}
|
||||
|
||||
virtual void run (const std::string& name, Interpreter::Context& interpreterContext) = 0;
|
||||
///< Run the script with the given name (compile first, if not compiled yet)
|
||||
|
||||
virtual bool compile (const std::string& name) = 0;
|
||||
///< Compile script with the given namen
|
||||
/// \return Success?
|
||||
|
||||
virtual std::pair<int, int> compileAll() = 0;
|
||||
///< Compile all scripts
|
||||
/// \return count, success
|
||||
|
||||
virtual Compiler::Locals& getLocals (const std::string& name) = 0;
|
||||
///< Return locals for script \a name.
|
||||
|
||||
virtual MWScript::GlobalScripts& getGlobalScripts() = 0;
|
||||
|
||||
virtual int getLocalIndex (const std::string& scriptId, const std::string& variable,
|
||||
char type) = 0;
|
||||
///< Return index of the variable of the given name and type in the given script. Will
|
||||
/// throw an exception, if there is no such script or variable or the type does not match.
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
129
apps/openmw/mwbase/soundmanager.hpp
Normal file
129
apps/openmw/mwbase/soundmanager.hpp
Normal file
|
@ -0,0 +1,129 @@
|
|||
#ifndef GAME_MWBASE_SOUNDMANAGER_H
|
||||
#define GAME_MWBASE_SOUNDMANAGER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
||||
namespace Ogre
|
||||
{
|
||||
class Vector3;
|
||||
}
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class CellStore;
|
||||
}
|
||||
|
||||
namespace MWSound
|
||||
{
|
||||
class Sound;
|
||||
}
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
typedef boost::shared_ptr<MWSound::Sound> SoundPtr;
|
||||
|
||||
/// \brief Interface for sound manager (implemented in MWSound)
|
||||
class SoundManager
|
||||
{
|
||||
public:
|
||||
|
||||
enum PlayMode {
|
||||
Play_Normal = 0, /* tracked, non-looping, multi-instance, environment */
|
||||
Play_Loop = 1<<0, /* Sound will continually loop until explicitly stopped */
|
||||
Play_NoEnv = 1<<1, /* Do not apply environment effects (eg, underwater filters) */
|
||||
Play_NoTrack = 1<<2, /* (3D only) Play the sound at the given object's position
|
||||
* but do not keep it updated (the sound will not move with
|
||||
* the object and will not stop when the object is deleted. */
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
SoundManager (const SoundManager&);
|
||||
///< not implemented
|
||||
|
||||
SoundManager& operator= (const SoundManager&);
|
||||
///< not implemented
|
||||
|
||||
public:
|
||||
|
||||
SoundManager() {}
|
||||
|
||||
virtual ~SoundManager() {}
|
||||
|
||||
virtual void processChangedSettings(const Settings::CategorySettingVector& settings) = 0;
|
||||
|
||||
virtual void stopMusic() = 0;
|
||||
///< Stops music if it's playing
|
||||
|
||||
virtual void streamMusic(const std::string& filename) = 0;
|
||||
///< Play a soundifle
|
||||
/// \param filename name of a sound file in "Music/" in the data directory.
|
||||
|
||||
virtual void startRandomTitle() = 0;
|
||||
///< Starts a random track from the current playlist
|
||||
|
||||
virtual bool isMusicPlaying() = 0;
|
||||
///< Returns true if music is playing
|
||||
|
||||
virtual void playPlaylist(const std::string &playlist) = 0;
|
||||
///< Start playing music from the selected folder
|
||||
/// \param name of the folder that contains the playlist
|
||||
|
||||
virtual void say(MWWorld::Ptr reference, const std::string& filename) = 0;
|
||||
///< Make an actor say some text.
|
||||
/// \param filename name of a sound file in "Sound/" in the data directory.
|
||||
|
||||
virtual void say(const std::string& filename) = 0;
|
||||
///< Say some text, without an actor ref
|
||||
/// \param filename name of a sound file in "Sound/" in the data directory.
|
||||
|
||||
virtual bool sayDone(MWWorld::Ptr reference=MWWorld::Ptr()) const = 0;
|
||||
///< Is actor not speaking?
|
||||
|
||||
virtual void stopSay(MWWorld::Ptr reference=MWWorld::Ptr()) = 0;
|
||||
///< Stop an actor speaking
|
||||
|
||||
virtual SoundPtr playSound(const std::string& soundId, float volume, float pitch,
|
||||
int mode=Play_Normal) = 0;
|
||||
///< Play a sound, independently of 3D-position
|
||||
|
||||
virtual SoundPtr playSound3D(MWWorld::Ptr reference, const std::string& soundId,
|
||||
float volume, float pitch, int mode=Play_Normal) = 0;
|
||||
///< Play a sound from an object
|
||||
|
||||
virtual void stopSound3D(MWWorld::Ptr reference, const std::string& soundId) = 0;
|
||||
///< Stop the given object from playing the given sound,
|
||||
|
||||
virtual void stopSound3D(MWWorld::Ptr reference) = 0;
|
||||
///< Stop the given object from playing all sounds.
|
||||
|
||||
virtual void stopSound(const MWWorld::CellStore *cell) = 0;
|
||||
///< Stop all sounds for the given cell.
|
||||
|
||||
virtual void stopSound(const std::string& soundId) = 0;
|
||||
///< Stop a non-3d looping sound
|
||||
|
||||
virtual bool getSoundPlaying(MWWorld::Ptr reference, const std::string& soundId) const = 0;
|
||||
///< Is the given sound currently playing on the given object?
|
||||
|
||||
virtual void updateObject(MWWorld::Ptr reference) = 0;
|
||||
///< Update the position of all sounds connected to the given object.
|
||||
|
||||
virtual void update(float duration) = 0;
|
||||
|
||||
virtual void setListenerPosDir(const Ogre::Vector3 &pos, const Ogre::Vector3 &dir) = 0;
|
||||
};
|
||||
|
||||
inline int operator|(SoundManager::PlayMode a, SoundManager::PlayMode b)
|
||||
{ return static_cast<int> (a) | static_cast<int> (b); }
|
||||
inline int operator&(SoundManager::PlayMode a, SoundManager::PlayMode b)
|
||||
{ return static_cast<int> (a) & static_cast<int> (b); }
|
||||
}
|
||||
|
||||
#endif
|
220
apps/openmw/mwbase/windowmanager.hpp
Normal file
220
apps/openmw/mwbase/windowmanager.hpp
Normal file
|
@ -0,0 +1,220 @@
|
|||
#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 activateQuickKey (int index) = 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 showCrosshair(bool show) = 0;
|
||||
virtual bool getSubtitlesEnabled() = 0;
|
||||
virtual void toggleHud() = 0;
|
||||
|
||||
virtual void disallowMouse() = 0;
|
||||
virtual void allowMouse() = 0;
|
||||
virtual void notifyInputActionBound() = 0;
|
||||
|
||||
virtual void removeDialog(OEngine::GUI::Layout* dialog) = 0;
|
||||
///< Hides dialog and schedules dialog to be deleted.
|
||||
|
||||
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons) = 0;
|
||||
virtual int readPressedButton() = 0;
|
||||
///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
||||
|
||||
virtual void onFrame (float frameDuration) = 0;
|
||||
|
||||
/// \todo get rid of this stuff. Move it to the respective UI element classes, if needed.
|
||||
virtual std::map<int, MWMechanics::Stat<float> > getPlayerSkillValues() = 0;
|
||||
virtual std::map<int, MWMechanics::Stat<int> > getPlayerAttributeValues() = 0;
|
||||
virtual SkillList getPlayerMinorSkills() = 0;
|
||||
virtual SkillList getPlayerMajorSkills() = 0;
|
||||
|
||||
/**
|
||||
* Fetches a GMST string from the store, if there is no setting with the given
|
||||
* ID or it is not a string the default string is returned.
|
||||
*
|
||||
* @param id Identifier for the GMST setting, e.g. "aName"
|
||||
* @param default Default value if the GMST setting cannot be used.
|
||||
*/
|
||||
virtual const std::string &getGameSettingString(const std::string &id, const std::string &default_) = 0;
|
||||
|
||||
virtual void processChangedSettings(const Settings::CategorySettingVector& changed) = 0;
|
||||
|
||||
virtual void executeInConsole (const std::string& path) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -46,6 +46,7 @@ namespace MWWorld
|
|||
|
||||
namespace MWBase
|
||||
{
|
||||
/// \brief Interface for the World (implemented in MWWorld)
|
||||
class World
|
||||
{
|
||||
World (const World&);
|
||||
|
@ -54,14 +55,6 @@ namespace MWBase
|
|||
World& operator= (const World&);
|
||||
///< not implemented
|
||||
|
||||
protected:
|
||||
|
||||
virtual void
|
||||
placeObject(
|
||||
const MWWorld::Ptr &ptr,
|
||||
MWWorld::CellStore &cell,
|
||||
const ESM::Position &pos) = 0;
|
||||
|
||||
public:
|
||||
|
||||
enum RenderMode
|
||||
|
@ -72,6 +65,12 @@ namespace MWBase
|
|||
Render_Compositors
|
||||
};
|
||||
|
||||
struct DoorMarker
|
||||
{
|
||||
std::string name;
|
||||
float x, y; // world position
|
||||
};
|
||||
|
||||
World() {}
|
||||
|
||||
virtual ~World() {}
|
||||
|
@ -115,6 +114,15 @@ namespace MWBase
|
|||
virtual Ogre::Vector2 getNorthVector (MWWorld::CellStore* cell) = 0;
|
||||
///< get north vector (OGRE coordinates) for given interior cell
|
||||
|
||||
virtual std::vector<DoorMarker> getDoorMarkers (MWWorld::CellStore* cell) = 0;
|
||||
///< get a list of teleport door markers for a given cell, to be displayed on the local map
|
||||
|
||||
virtual void getInteriorMapPosition (Ogre::Vector2 position, float& nX, float& nY, int &x, int& y) = 0;
|
||||
///< see MWRender::LocalMap::getInteriorMapPosition
|
||||
|
||||
virtual bool isPositionExplored (float nX, float nY, int x, int y, bool interior) = 0;
|
||||
///< see MWRender::LocalMap::isPositionExplored
|
||||
|
||||
virtual MWWorld::Globals::Data& getGlobalVariable (const std::string& name) = 0;
|
||||
|
||||
virtual MWWorld::Globals::Data getGlobalVariable (const std::string& name) const = 0;
|
||||
|
@ -184,9 +192,12 @@ namespace MWBase
|
|||
|
||||
virtual void moveObject (const MWWorld::Ptr& ptr, float x, float y, float z) = 0;
|
||||
|
||||
virtual void
|
||||
moveObject(const MWWorld::Ptr &ptr, MWWorld::CellStore &newCell, float x, float y, float z) = 0;
|
||||
|
||||
virtual void scaleObject (const MWWorld::Ptr& ptr, float scale) = 0;
|
||||
|
||||
virtual void rotateObject(const MWWorld::Ptr& ptr,float x,float y,float z) = 0;
|
||||
virtual void rotateObject(const MWWorld::Ptr& ptr,float x,float y,float z, bool adjust = false) = 0;
|
||||
|
||||
virtual void indexToPosition (int cellX, int cellY, float &x, float &y, bool centre = false)
|
||||
const = 0;
|
||||
|
@ -252,6 +263,14 @@ namespace MWBase
|
|||
|
||||
virtual bool isSwimming(const MWWorld::Ptr &object) = 0;
|
||||
virtual bool isUnderwater(const ESM::Cell &cell, const Ogre::Vector3 &pos) = 0;
|
||||
|
||||
virtual void togglePOV() = 0;
|
||||
virtual void togglePreviewMode(bool enable) = 0;
|
||||
virtual bool toggleVanityMode(bool enable, bool force) = 0;
|
||||
virtual void allowVanityMode(bool allow) = 0;
|
||||
virtual void togglePlayerLooking(bool enable) = 0;
|
||||
|
||||
virtual void renderPlayer() = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
|
@ -15,11 +16,8 @@
|
|||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Apparatus::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
|
@ -39,7 +37,7 @@ namespace MWClass
|
|||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string Apparatus::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
|
||||
|
@ -64,10 +62,12 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Apparatus::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
boost::shared_ptr<MWWorld::Action> action(
|
||||
new MWWorld::ActionTake (ptr));
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
action->setSound(getUpSoundId(ptr));
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
std::string Apparatus::getScript (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
|
@ -18,11 +19,8 @@
|
|||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Armor::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
|
@ -42,7 +40,7 @@ namespace MWClass
|
|||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string Armor::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
|
@ -67,10 +65,11 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Armor::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
action->setSound(getUpSoundId(ptr));
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
bool Armor::hasItemHealth (const MWWorld::Ptr& ptr) const
|
||||
|
@ -272,9 +271,11 @@ namespace MWClass
|
|||
|
||||
boost::shared_ptr<MWWorld::Action> Armor::use (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound (getUpSoundId(ptr), 1.0, 1.0);
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionEquip(ptr));
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionEquip(ptr));
|
||||
action->setSound(getUpSoundId(ptr));
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actionread.hpp"
|
||||
|
@ -14,11 +16,8 @@
|
|||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Book::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
|
@ -38,7 +37,7 @@ namespace MWClass
|
|||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string Book::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
|
@ -14,13 +15,10 @@
|
|||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Clothing::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
|
@ -40,7 +38,7 @@ namespace MWClass
|
|||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string Clothing::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
|
@ -63,12 +61,13 @@ namespace MWClass
|
|||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Clothing::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
action->setSound(getUpSoundId(ptr));
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
std::string Clothing::getScript (const MWWorld::Ptr& ptr) const
|
||||
|
@ -223,9 +222,11 @@ namespace MWClass
|
|||
|
||||
boost::shared_ptr<MWWorld::Action> Clothing::use (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound (getUpSoundId(ptr), 1.0, 1.0);
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionEquip(ptr));
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionEquip(ptr));
|
||||
action->setSound(getUpSoundId(ptr));
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/nullaction.hpp"
|
||||
|
@ -14,14 +15,11 @@
|
|||
#include "../mwworld/actionopen.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
struct CustomData : public MWWorld::CustomData
|
||||
|
@ -69,7 +67,7 @@ namespace MWClass
|
|||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string Container::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Container> *ref =
|
||||
|
@ -94,8 +92,9 @@ namespace MWClass
|
|||
{
|
||||
// TODO check for key
|
||||
std::cout << "Locked container" << std::endl;
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, lockedSound, 1.0, 1.0);
|
||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::NullAction);
|
||||
action->setSound(lockedSound);
|
||||
return action;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -110,9 +109,10 @@ namespace MWClass
|
|||
{
|
||||
// Trap activation goes here
|
||||
std::cout << "Activated trap: " << ptr.getCellRef().trap << std::endl;
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, trapActivationSound, 1.0, 1.0);
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::NullAction);
|
||||
action->setSound(trapActivationSound);
|
||||
ptr.getCellRef().trap = "";
|
||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||
return action;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,11 @@
|
|||
#include <components/esm/loadcrea.hpp>
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||
#include "../mwmechanics/magiceffects.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontalk.hpp"
|
||||
|
@ -17,7 +18,6 @@
|
|||
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
namespace
|
||||
|
@ -61,10 +61,10 @@ namespace MWClass
|
|||
|
||||
data->mCreatureStats.setLevel(ref->base->data.level);
|
||||
|
||||
data->mCreatureStats.setHello(ref->base->AI.hello);
|
||||
data->mCreatureStats.setFight(ref->base->AI.fight);
|
||||
data->mCreatureStats.setFlee(ref->base->AI.flee);
|
||||
data->mCreatureStats.setAlarm(ref->base->AI.alarm);
|
||||
data->mCreatureStats.setHello(ref->base->mAiData.mHello);
|
||||
data->mCreatureStats.setFight(ref->base->mAiData.mFight);
|
||||
data->mCreatureStats.setFlee(ref->base->mAiData.mFlee);
|
||||
data->mCreatureStats.setAlarm(ref->base->mAiData.mAlarm);
|
||||
|
||||
// store
|
||||
ptr.getRefData().setCustomData (data.release());
|
||||
|
@ -104,7 +104,7 @@ namespace MWClass
|
|||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
return "";
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Creature::getName (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -59,6 +59,11 @@ namespace MWClass
|
|||
static void registerSelf();
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
|
||||
virtual bool
|
||||
isActor() const {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
@ -13,14 +14,11 @@
|
|||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Door::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
|
@ -81,17 +79,25 @@ namespace MWClass
|
|||
// TODO check for key
|
||||
// TODO report failure to player (message, sound?). Look up behaviour of original MW.
|
||||
std::cout << "Locked!" << std::endl;
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, lockedSound, 1.0, 1.0);
|
||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::NullAction);
|
||||
|
||||
action->setSound(lockedSound);
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
if(!ptr.getCellRef().trap.empty())
|
||||
{
|
||||
// Trap activation
|
||||
std::cout << "Activated trap: " << ptr.getCellRef().trap << std::endl;
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, trapActivationSound, 1.0, 1.0);
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::NullAction);
|
||||
|
||||
action->setSound(trapActivationSound);
|
||||
ptr.getCellRef().trap = "";
|
||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
if (ref->ref.teleport)
|
||||
|
@ -100,11 +106,11 @@ namespace MWClass
|
|||
/// \todo remove this if clause once ActionTeleport can also support other actors
|
||||
if (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()==actor)
|
||||
{
|
||||
// the player is using the door
|
||||
// The reason this is not 3D is that it would get interrupted when you teleport
|
||||
MWBase::Environment::get().getSoundManager()->playSound(openSound, 1.0, 1.0);
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTeleport (ref->ref.destCell, ref->ref.doorDest));
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ref->ref.destCell, ref->ref.doorDest));
|
||||
|
||||
action->setSound(openSound);
|
||||
|
||||
return action;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -118,8 +124,11 @@ namespace MWClass
|
|||
// TODO return action for rotating the door
|
||||
|
||||
// This is a little pointless, but helps with testing
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, openSound, 1.0, 1.0);
|
||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::NullAction);
|
||||
|
||||
action->setSound(openSound);
|
||||
|
||||
return action;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,20 +5,18 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.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"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Ingredient::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
|
@ -38,7 +36,7 @@ namespace MWClass
|
|||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string Ingredient::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
|
||||
|
@ -63,10 +61,11 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Ingredient::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
action->setSound(getUpSoundId(ptr));
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
std::string Ingredient::getScript (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#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,11 +16,8 @@
|
|||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
|
@ -58,7 +57,7 @@ namespace MWClass
|
|||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
}
|
||||
if (!ref->base->sound.empty()) {
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->base->sound, 1.0, 1.0, MWSound::Play_Loop);
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->base->sound, 1.0, 1.0, MWBase::SoundManager::Play_Loop);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,10 +94,11 @@ namespace MWClass
|
|||
if (!(ref->base->data.flags & ESM::Light::Carry))
|
||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
action->setSound(getUpSoundId(ptr));
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
std::string Light::getScript (const MWWorld::Ptr& ptr) const
|
||||
|
@ -192,9 +192,11 @@ namespace MWClass
|
|||
|
||||
boost::shared_ptr<MWWorld::Action> Light::use (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound (getUpSoundId(ptr), 1.0, 1.0);
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionEquip(ptr));
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionEquip(ptr));
|
||||
action->setSound(getUpSoundId(ptr));
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
|
@ -13,14 +14,11 @@
|
|||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Lockpick::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
|
@ -40,7 +38,7 @@ namespace MWClass
|
|||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string Lockpick::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Tool> *ref =
|
||||
|
@ -65,10 +63,11 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Lockpick::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
action->setSound(getUpSoundId(ptr));
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
std::string Lockpick::getScript (const MWWorld::Ptr& ptr) const
|
||||
|
@ -161,9 +160,11 @@ namespace MWClass
|
|||
|
||||
boost::shared_ptr<MWWorld::Action> Lockpick::use (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound (getUpSoundId(ptr), 1.0, 1.0);
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionEquip(ptr));
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionEquip(ptr));
|
||||
action->setSound(getUpSoundId(ptr));
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
|
@ -14,14 +15,11 @@
|
|||
#include "../mwworld/physicssystem.hpp"
|
||||
#include "../mwworld/manualref.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
namespace MWClass
|
||||
|
@ -43,7 +41,7 @@ namespace MWClass
|
|||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string Miscellaneous::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
|
@ -68,10 +66,11 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Miscellaneous::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
action->setSound(getUpSoundId(ptr));
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
std::string Miscellaneous::getScript (const MWWorld::Ptr& ptr) const
|
||||
|
@ -189,7 +188,7 @@ namespace MWClass
|
|||
Miscellaneous::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
|
||||
{
|
||||
MWWorld::Ptr newPtr;
|
||||
|
||||
|
||||
const ESMS::ESMStore &store =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
|
|
|
@ -11,11 +11,12 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/movement.hpp"
|
||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontalk.hpp"
|
||||
|
@ -26,7 +27,6 @@
|
|||
#include "../mwrender/actors.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
namespace
|
||||
|
@ -100,10 +100,10 @@ namespace MWClass
|
|||
/// \todo do something with npdt12 maybe:p
|
||||
}
|
||||
|
||||
data->mCreatureStats.setHello(ref->base->AI.hello);
|
||||
data->mCreatureStats.setFight(ref->base->AI.fight);
|
||||
data->mCreatureStats.setFlee(ref->base->AI.flee);
|
||||
data->mCreatureStats.setAlarm(ref->base->AI.alarm);
|
||||
data->mCreatureStats.setHello(ref->base->mAiData.mHello);
|
||||
data->mCreatureStats.setFight(ref->base->mAiData.mFight);
|
||||
data->mCreatureStats.setFlee(ref->base->mAiData.mFlee);
|
||||
data->mCreatureStats.setAlarm(ref->base->mAiData.mAlarm);
|
||||
|
||||
// store
|
||||
ptr.getRefData().setCustomData (data.release());
|
||||
|
|
|
@ -93,6 +93,11 @@ namespace MWClass
|
|||
static void registerSelf();
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
|
||||
virtual bool
|
||||
isActor() const {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
|
@ -13,14 +14,11 @@
|
|||
#include "../mwworld/physicssystem.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Potion::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
|
@ -65,10 +63,12 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Potion::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
boost::shared_ptr<MWWorld::Action> action(
|
||||
new MWWorld::ActionTake (ptr));
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
action->setSound (getUpSoundId(ptr));
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
std::string Potion::getScript (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
|
@ -13,14 +14,11 @@
|
|||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Probe::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
|
@ -40,7 +38,7 @@ namespace MWClass
|
|||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string Probe::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||
|
@ -64,10 +62,11 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Probe::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
action->setSound(getUpSoundId(ptr));
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
std::string Probe::getScript (const MWWorld::Ptr& ptr) const
|
||||
|
@ -160,9 +159,11 @@ namespace MWClass
|
|||
|
||||
boost::shared_ptr<MWWorld::Action> Probe::use (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound (getUpSoundId(ptr), 1.0, 1.0);
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionEquip(ptr));
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionEquip(ptr));
|
||||
action->setSound(getUpSoundId(ptr));
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
|
@ -174,4 +175,3 @@ namespace MWClass
|
|||
return MWWorld::Ptr(&cell.probes.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,20 +5,18 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.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"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Repair::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
|
@ -38,7 +36,7 @@ namespace MWClass
|
|||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string Repair::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
|
@ -63,10 +61,11 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Repair::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
action->setSound(getUpSoundId(ptr));
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
std::string Repair::getScript (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
|
@ -13,14 +14,11 @@
|
|||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Weapon::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
|
@ -40,7 +38,7 @@ namespace MWClass
|
|||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string Weapon::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
|
@ -65,10 +63,11 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Weapon::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
action->setSound(getUpSoundId(ptr));
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
bool Weapon::hasItemHealth (const MWWorld::Ptr& ptr) const
|
||||
|
@ -361,9 +360,11 @@ namespace MWClass
|
|||
|
||||
boost::shared_ptr<MWWorld::Action> Weapon::use (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound (getUpSoundId(ptr), 1.0, 1.0);
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionEquip(ptr));
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionEquip(ptr));
|
||||
action->setSound(getUpSoundId(ptr));
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
#include "dialoguemanager.hpp"
|
||||
#include "dialoguemanagerimp.hpp"
|
||||
|
||||
#include <cctype>
|
||||
#include <algorithm>
|
||||
|
@ -11,33 +11,30 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/scriptmanager.hpp"
|
||||
#include "../mwbase/journal.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/refdata.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
#include "../mwgui/dialogue.hpp"
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
|
||||
#include "journal.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "../mwscript/extensions.hpp"
|
||||
#include "../mwscript/scriptmanager.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"
|
||||
|
@ -599,12 +596,12 @@ namespace MWDialogue
|
|||
}
|
||||
}
|
||||
|
||||
void DialogueManager::addTopic(std::string topic)
|
||||
void DialogueManager::addTopic (const std::string& topic)
|
||||
{
|
||||
mKnownTopics[toLower(topic)] = true;
|
||||
}
|
||||
|
||||
void DialogueManager::parseText(std::string text)
|
||||
void DialogueManager::parseText (std::string text)
|
||||
{
|
||||
std::list<std::string>::iterator it;
|
||||
for(it = mActorKnownTopics.begin();it != mActorKnownTopics.end();++it)
|
||||
|
@ -772,14 +769,14 @@ namespace MWDialogue
|
|||
if (mActor.getTypeName() == typeid(ESM::NPC).name())
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::NPC>* ref = mActor.get<ESM::NPC>();
|
||||
if (ref->base->hasAI)
|
||||
services = ref->base->AI.services;
|
||||
if (ref->base->mHasAI)
|
||||
services = ref->base->mAiData.mServices;
|
||||
}
|
||||
else if (mActor.getTypeName() == typeid(ESM::Creature).name())
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Creature>* ref = mActor.get<ESM::Creature>();
|
||||
if (ref->base->hasAI)
|
||||
services = ref->base->AI.services;
|
||||
if (ref->base->mHasAI)
|
||||
services = ref->base->mAiData.mServices;
|
||||
}
|
||||
|
||||
if (services & ESM::NPC::Weapon
|
||||
|
@ -804,7 +801,7 @@ namespace MWDialogue
|
|||
mChoice = choice;
|
||||
}
|
||||
|
||||
void DialogueManager::keywordSelected(std::string keyword)
|
||||
void DialogueManager::keywordSelected (const std::string& keyword)
|
||||
{
|
||||
if(!mIsInChoice)
|
||||
{
|
||||
|
@ -846,11 +843,11 @@ namespace MWDialogue
|
|||
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Dialogue);
|
||||
}
|
||||
|
||||
void DialogueManager::questionAnswered(std::string answere)
|
||||
void DialogueManager::questionAnswered (const std::string& answer)
|
||||
{
|
||||
if(mChoiceMap.find(answere) != mChoiceMap.end())
|
||||
if(mChoiceMap.find(answer) != mChoiceMap.end())
|
||||
{
|
||||
mChoice = mChoiceMap[answere];
|
||||
mChoice = mChoiceMap[answer];
|
||||
|
||||
std::vector<ESM::DialInfo>::const_iterator iter;
|
||||
if(mDialogueMap.find(mLastTopic) != mDialogueMap.end())
|
||||
|
@ -882,13 +879,13 @@ namespace MWDialogue
|
|||
}
|
||||
}
|
||||
|
||||
void DialogueManager::printError(std::string error)
|
||||
void DialogueManager::printError (std::string error)
|
||||
{
|
||||
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
||||
win->addText(error);
|
||||
}
|
||||
|
||||
void DialogueManager::askQuestion(std::string question, int choice)
|
||||
void DialogueManager::askQuestion (const std::string& question, int choice)
|
||||
{
|
||||
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
||||
win->askQuestion(question);
|
||||
|
@ -896,7 +893,7 @@ namespace MWDialogue
|
|||
mIsInChoice = true;
|
||||
}
|
||||
|
||||
std::string DialogueManager::getFaction()
|
||||
std::string DialogueManager::getFaction() const
|
||||
{
|
||||
if (mActor.getTypeName() != typeid(ESM::NPC).name())
|
||||
return "";
|
|
@ -1,5 +1,7 @@
|
|||
#ifndef GAME_MMDIALOG_DIALOGUEMANAGER_H
|
||||
#define GAME_MWDIALOG_DIALOGUEMANAGER_H
|
||||
#ifndef GAME_MWDIALOG_DIALOGUEMANAGERIMP_H
|
||||
#define GAME_MWDIALOG_DIALOGUEMANAGERIMP_H
|
||||
|
||||
#include "../mwbase/dialoguemanager.hpp"
|
||||
|
||||
#include <components/esm/loadinfo.hpp>
|
||||
|
||||
|
@ -9,11 +11,12 @@
|
|||
#include <components/compiler/output.hpp>
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace MWDialogue
|
||||
{
|
||||
class DialogueManager
|
||||
class DialogueManager : public MWBase::DialogueManager
|
||||
{
|
||||
bool isMatching (const MWWorld::Ptr& actor, const ESM::DialInfo::SelectStruct& select) const;
|
||||
|
||||
|
@ -50,21 +53,21 @@ namespace MWDialogue
|
|||
|
||||
DialogueManager (const Compiler::Extensions& extensions);
|
||||
|
||||
void startDialogue (const MWWorld::Ptr& actor);
|
||||
virtual void startDialogue (const MWWorld::Ptr& actor);
|
||||
|
||||
void addTopic(std::string topic);
|
||||
virtual void addTopic (const std::string& topic);
|
||||
|
||||
void askQuestion(std::string question,int choice);
|
||||
virtual void askQuestion (const std::string& question,int choice);
|
||||
|
||||
void goodbye();
|
||||
virtual void goodbye();
|
||||
|
||||
///get the faction of the actor you are talking with
|
||||
std::string getFaction();
|
||||
virtual std::string getFaction() const;
|
||||
|
||||
//calbacks for the GUI
|
||||
void keywordSelected(std::string keyword);
|
||||
void goodbyeSelected();
|
||||
void questionAnswered(std::string answere);
|
||||
virtual void keywordSelected (const std::string& keyword);
|
||||
virtual void goodbyeSelected();
|
||||
virtual void questionAnswered (const std::string& answer);
|
||||
|
||||
};
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef GAME_MMDIALOGUE_JOURNALENTRY_H
|
||||
#define GAME_MMDIALOGUE_JOURNALENTRY_H
|
||||
#ifndef GAME_MWDIALOGUE_JOURNALENTRY_H
|
||||
#define GAME_MWDIALOGUE_JOURNALENTRY_H
|
||||
|
||||
#include <string>
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
|
||||
#include "journal.hpp"
|
||||
#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
|
|
@ -1,9 +1,7 @@
|
|||
#ifndef GAME_MMDIALOG_JOURNAL_H
|
||||
#ifndef GAME_MWDIALOG_JOURNAL_H
|
||||
#define GAME_MWDIALOG_JOURNAL_H
|
||||
|
||||
#include <string>
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include "../mwbase/journal.hpp"
|
||||
|
||||
#include "journalentry.hpp"
|
||||
#include "quest.hpp"
|
||||
|
@ -11,19 +9,8 @@
|
|||
namespace MWDialogue
|
||||
{
|
||||
/// \brief The player's journal
|
||||
class Journal
|
||||
class Journal : public MWBase::Journal
|
||||
{
|
||||
public:
|
||||
|
||||
typedef std::deque<StampedJournalEntry> TEntryContainer;
|
||||
typedef TEntryContainer::const_iterator TEntryIter;
|
||||
typedef std::map<std::string, Quest> TQuestContainer; // topc, quest
|
||||
typedef TQuestContainer::const_iterator TQuestIter;
|
||||
typedef std::map<std::string, Topic> TTopicContainer; // topic-id, topic-content
|
||||
typedef TTopicContainer::const_iterator TTopicIter;
|
||||
|
||||
private:
|
||||
|
||||
TEntryContainer mJournal;
|
||||
TQuestContainer mQuests;
|
||||
TTopicContainer mTopics;
|
||||
|
@ -34,37 +21,37 @@ namespace MWDialogue
|
|||
|
||||
Journal();
|
||||
|
||||
void addEntry (const std::string& id, int index);
|
||||
virtual void addEntry (const std::string& id, int index);
|
||||
///< Add a journal entry.
|
||||
|
||||
void setJournalIndex (const std::string& id, int index);
|
||||
virtual void setJournalIndex (const std::string& id, int index);
|
||||
///< Set the journal index without adding an entry.
|
||||
|
||||
int getJournalIndex (const std::string& id) const;
|
||||
virtual int getJournalIndex (const std::string& id) const;
|
||||
///< Get the journal index.
|
||||
|
||||
void addTopic (const std::string& topicId, const std::string& infoId);
|
||||
virtual void addTopic (const std::string& topicId, const std::string& infoId);
|
||||
|
||||
TEntryIter begin() const;
|
||||
virtual TEntryIter begin() const;
|
||||
///< Iterator pointing to the begin of the main journal.
|
||||
///
|
||||
/// \note Iterators to main journal entries will never become invalid.
|
||||
|
||||
TEntryIter end() const;
|
||||
virtual TEntryIter end() const;
|
||||
///< Iterator pointing past the end of the main journal.
|
||||
|
||||
TQuestIter questBegin() const;
|
||||
virtual TQuestIter questBegin() const;
|
||||
///< Iterator pointing to the first quest (sorted by topic ID)
|
||||
|
||||
TQuestIter questEnd() const;
|
||||
virtual TQuestIter questEnd() const;
|
||||
///< Iterator pointing past the last quest.
|
||||
|
||||
TTopicIter topicBegin() const;
|
||||
virtual TTopicIter topicBegin() const;
|
||||
///< Iterator pointing to the first topic (sorted by topic ID)
|
||||
///
|
||||
/// \note The topic ID is identical with the user-visible topic string.
|
||||
|
||||
TTopicIter topicEnd() const;
|
||||
virtual TTopicIter topicEnd() const;
|
||||
///< Iterator pointing past the last topic.
|
||||
};
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef GAME_MMDIALOG_QUEST_H
|
||||
#ifndef GAME_MWDIALOG_QUEST_H
|
||||
#define GAME_MWDIALOG_QUEST_H
|
||||
|
||||
#include "topic.hpp"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef GAME_MMDIALOG_TOPIC_H
|
||||
#ifndef GAME_MWDIALOG_TOPIC_H
|
||||
#define GAME_MWDIALOG_TOPIC_H
|
||||
|
||||
#include <string>
|
||||
|
|
|
@ -4,15 +4,13 @@
|
|||
|
||||
#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 "../mwsound/soundmanager.hpp"
|
||||
|
||||
#include "window_manager.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
std::string getIconPath(MWWorld::Ptr ptr)
|
||||
|
@ -28,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
|
||||
|
@ -60,9 +65,9 @@ void BirthDialog::setNextButtonShow(bool shown)
|
|||
|
||||
void BirthDialog::open()
|
||||
{
|
||||
WindowBase::open();
|
||||
updateBirths();
|
||||
updateSpells();
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -29,7 +28,7 @@ namespace MWGui
|
|||
void setBirthId(const std::string &raceId);
|
||||
|
||||
void setNextButtonShow(bool shown);
|
||||
void open();
|
||||
virtual void open();
|
||||
|
||||
// Events
|
||||
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
||||
|
|
|
@ -4,17 +4,17 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
#include "../mwsound/soundmanager.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");
|
||||
|
@ -98,7 +98,7 @@ void BookWindow::onCloseButtonClicked (MyGUI::Widget* _sender)
|
|||
|
||||
void BookWindow::onTakeButtonClicked (MyGUI::Widget* _sender)
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("Item Book Up", 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("Item Book Up", 1.0, 1.0, MWBase::SoundManager::Play_NoTrack);
|
||||
|
||||
MWWorld::ActionTake take(mBook);
|
||||
take.execute (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
#include "mode.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -103,11 +104,19 @@ namespace
|
|||
{ESM::Class::Combat, ESM::Class::Magic, ESM::Class::Stealth}
|
||||
}
|
||||
} };
|
||||
|
||||
struct ClassPoint
|
||||
{
|
||||
const char *id;
|
||||
// Specialization points to match, in order: Stealth, Combat, Magic
|
||||
// Note: Order is taken from http://www.uesp.net/wiki/Morrowind:Class_Quiz
|
||||
unsigned int points[3];
|
||||
};
|
||||
}
|
||||
|
||||
using namespace MWGui;
|
||||
|
||||
CharacterCreation::CharacterCreation(WindowManager* _wm)
|
||||
CharacterCreation::CharacterCreation(MWBase::WindowManager* _wm)
|
||||
: mNameDialog(0)
|
||||
, mRaceDialog(0)
|
||||
, mClassChoiceDialog(0)
|
||||
|
@ -178,64 +187,64 @@ 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);
|
||||
mNameDialog->setNextButtonShow(mCreationStage >= CSE_NameChosen);
|
||||
mNameDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onNameDialogDone);
|
||||
mNameDialog->open();
|
||||
mNameDialog->setVisible(true);
|
||||
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);
|
||||
mRaceDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onRaceDialogDone);
|
||||
mRaceDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onRaceDialogBack);
|
||||
mRaceDialog->open();
|
||||
mRaceDialog->setVisible(true);;
|
||||
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();
|
||||
mClassChoiceDialog->setVisible(true);
|
||||
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);
|
||||
mPickClassDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onPickClassDialogDone);
|
||||
mPickClassDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onPickClassDialogBack);
|
||||
mPickClassDialog->open();
|
||||
mPickClassDialog->setVisible(true);
|
||||
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);
|
||||
mBirthSignDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogBack);
|
||||
mBirthSignDialog->open();
|
||||
mBirthSignDialog->setVisible(true);
|
||||
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);
|
||||
mCreateClassDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onCreateClassDialogBack);
|
||||
mCreateClassDialog->open();
|
||||
mCreateClassDialog->setVisible(true);
|
||||
break;
|
||||
case GM_ClassGenerate:
|
||||
mGenerateClassStep = 0;
|
||||
|
@ -246,8 +255,8 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
showClassQuestionDialog();
|
||||
break;
|
||||
case GM_Review:
|
||||
if (mReviewDialog)
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mReviewDialog = 0;
|
||||
mReviewDialog = new ReviewDialog(*mWM);
|
||||
mReviewDialog->setPlayerName(mPlayerName);
|
||||
mReviewDialog->setRace(mPlayerRaceId);
|
||||
|
@ -259,20 +268,20 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
mReviewDialog->setFatigue(mPlayerFatigue);
|
||||
|
||||
{
|
||||
std::map<ESM::Attribute::AttributeID, MWMechanics::Stat<int> > attributes = mWM->getPlayerAttributeValues();
|
||||
for (std::map<ESM::Attribute::AttributeID, MWMechanics::Stat<int> >::iterator it = attributes.begin();
|
||||
std::map<int, MWMechanics::Stat<int> > attributes = mWM->getPlayerAttributeValues();
|
||||
for (std::map<int, MWMechanics::Stat<int> >::iterator it = attributes.begin();
|
||||
it != attributes.end(); ++it)
|
||||
{
|
||||
mReviewDialog->setAttribute(it->first, it->second);
|
||||
mReviewDialog->setAttribute(static_cast<ESM::Attribute::AttributeID> (it->first), it->second);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
std::map<ESM::Skill::SkillEnum, MWMechanics::Stat<float> > skills = mWM->getPlayerSkillValues();
|
||||
for (std::map<ESM::Skill::SkillEnum, MWMechanics::Stat<float> >::iterator it = skills.begin();
|
||||
std::map<int, MWMechanics::Stat<float> > skills = mWM->getPlayerSkillValues();
|
||||
for (std::map<int, MWMechanics::Stat<float> >::iterator it = skills.begin();
|
||||
it != skills.end(); ++it)
|
||||
{
|
||||
mReviewDialog->setSkillValue(it->first, it->second);
|
||||
mReviewDialog->setSkillValue(static_cast<ESM::Skill::SkillEnum> (it->first), it->second);
|
||||
}
|
||||
mReviewDialog->configureSkills(mWM->getPlayerMajorSkills(), mWM->getPlayerMinorSkills());
|
||||
}
|
||||
|
@ -280,7 +289,7 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
mReviewDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onReviewDialogDone);
|
||||
mReviewDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onReviewDialogBack);
|
||||
mReviewDialog->eventActivateDialog += MyGUI::newDelegate(this, &CharacterCreation::onReviewActivateDialog);
|
||||
mReviewDialog->open();
|
||||
mReviewDialog->setVisible(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -302,24 +311,24 @@ void CharacterCreation::setPlayerFatigue (const MWMechanics::DynamicStat<int>& v
|
|||
|
||||
void CharacterCreation::onReviewDialogDone(WindowBase* parWindow)
|
||||
{
|
||||
if (mReviewDialog)
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mReviewDialog = 0;
|
||||
|
||||
mWM->popGuiMode();
|
||||
}
|
||||
|
||||
void CharacterCreation::onReviewDialogBack()
|
||||
{
|
||||
if (mReviewDialog)
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mReviewDialog = 0;
|
||||
|
||||
mWM->pushGuiMode(GM_Birth);
|
||||
}
|
||||
|
||||
void CharacterCreation::onReviewActivateDialog(int parDialog)
|
||||
{
|
||||
if (mReviewDialog)
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mReviewDialog = 0;
|
||||
mCreationStage = CSE_ReviewNext;
|
||||
|
||||
mWM->popGuiMode();
|
||||
|
@ -354,6 +363,7 @@ void CharacterCreation::onPickClassDialogDone(WindowBase* parWindow)
|
|||
mWM->setPlayerClass(mPlayerClass);
|
||||
}
|
||||
mWM->removeDialog(mPickClassDialog);
|
||||
mPickClassDialog = 0;
|
||||
}
|
||||
|
||||
//TODO This bit gets repeated a few times; wrap it in a function
|
||||
|
@ -382,6 +392,7 @@ void CharacterCreation::onPickClassDialogBack()
|
|||
if (!classId.empty())
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(classId);
|
||||
mWM->removeDialog(mPickClassDialog);
|
||||
mPickClassDialog = 0;
|
||||
}
|
||||
|
||||
mWM->popGuiMode();
|
||||
|
@ -390,10 +401,8 @@ void CharacterCreation::onPickClassDialogBack()
|
|||
|
||||
void CharacterCreation::onClassChoice(int _index)
|
||||
{
|
||||
if (mClassChoiceDialog)
|
||||
{
|
||||
mWM->removeDialog(mClassChoiceDialog);
|
||||
}
|
||||
mWM->removeDialog(mClassChoiceDialog);
|
||||
mClassChoiceDialog = 0;
|
||||
|
||||
mWM->popGuiMode();
|
||||
|
||||
|
@ -423,6 +432,7 @@ void CharacterCreation::onNameDialogDone(WindowBase* parWindow)
|
|||
mWM->setValue("name", mPlayerName);
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerName(mPlayerName);
|
||||
mWM->removeDialog(mNameDialog);
|
||||
mNameDialog = 0;
|
||||
}
|
||||
|
||||
if (mCreationStage == CSE_ReviewNext)
|
||||
|
@ -450,6 +460,7 @@ void CharacterCreation::onRaceDialogBack()
|
|||
if (!mPlayerRaceId.empty())
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerRace(mPlayerRaceId, mRaceDialog->getGender() == RaceDialog::GM_Male);
|
||||
mWM->removeDialog(mRaceDialog);
|
||||
mRaceDialog = 0;
|
||||
}
|
||||
|
||||
mWM->popGuiMode();
|
||||
|
@ -465,6 +476,7 @@ void CharacterCreation::onRaceDialogDone(WindowBase* parWindow)
|
|||
if (!mPlayerRaceId.empty())
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerRace(mPlayerRaceId, mRaceDialog->getGender() == RaceDialog::GM_Male);
|
||||
mWM->removeDialog(mRaceDialog);
|
||||
mRaceDialog = 0;
|
||||
}
|
||||
|
||||
if (mCreationStage == CSE_ReviewNext)
|
||||
|
@ -492,6 +504,7 @@ void CharacterCreation::onBirthSignDialogDone(WindowBase* parWindow)
|
|||
if (!mPlayerBirthSignId.empty())
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerBirthsign(mPlayerBirthSignId);
|
||||
mWM->removeDialog(mBirthSignDialog);
|
||||
mBirthSignDialog = 0;
|
||||
}
|
||||
|
||||
if (mCreationStage >= CSE_BirthSignChosen)
|
||||
|
@ -512,6 +525,7 @@ void CharacterCreation::onBirthSignDialogBack()
|
|||
{
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerBirthsign(mBirthSignDialog->getBirthId());
|
||||
mWM->removeDialog(mBirthSignDialog);
|
||||
mBirthSignDialog = 0;
|
||||
}
|
||||
|
||||
mWM->popGuiMode();
|
||||
|
@ -547,6 +561,7 @@ void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow)
|
|||
mWM->setPlayerClass(klass);
|
||||
|
||||
mWM->removeDialog(mCreateClassDialog);
|
||||
mCreateClassDialog = 0;
|
||||
}
|
||||
|
||||
if (mCreationStage == CSE_ReviewNext)
|
||||
|
@ -568,8 +583,8 @@ void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow)
|
|||
|
||||
void CharacterCreation::onCreateClassDialogBack()
|
||||
{
|
||||
if (mCreateClassDialog)
|
||||
mWM->removeDialog(mCreateClassDialog);
|
||||
mWM->removeDialog(mCreateClassDialog);
|
||||
mCreateClassDialog = 0;
|
||||
|
||||
mWM->popGuiMode();
|
||||
mWM->pushGuiMode(GM_Class);
|
||||
|
@ -579,8 +594,9 @@ void CharacterCreation::onClassQuestionChosen(int _index)
|
|||
{
|
||||
MWBase::Environment::get().getSoundManager()->stopSay();
|
||||
|
||||
if (mGenerateClassQuestionDialog)
|
||||
mWM->removeDialog(mGenerateClassQuestionDialog);
|
||||
mWM->removeDialog(mGenerateClassQuestionDialog);
|
||||
mGenerateClassQuestionDialog = 0;
|
||||
|
||||
if (_index < 0 || _index >= 3)
|
||||
{
|
||||
mWM->popGuiMode();
|
||||
|
@ -657,13 +673,14 @@ 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);
|
||||
mGenerateClassResultDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onGenerateClassDone);
|
||||
mGenerateClassResultDialog->open();
|
||||
mGenerateClassResultDialog->setVisible(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -674,8 +691,9 @@ void CharacterCreation::showClassQuestionDialog()
|
|||
return;
|
||||
}
|
||||
|
||||
if (mGenerateClassQuestionDialog)
|
||||
mWM->removeDialog(mGenerateClassQuestionDialog);
|
||||
mWM->removeDialog(mGenerateClassQuestionDialog);
|
||||
mGenerateClassQuestionDialog = 0;
|
||||
|
||||
mGenerateClassQuestionDialog = new InfoBoxDialog(*mWM);
|
||||
|
||||
InfoBoxDialog::ButtonList buttons;
|
||||
|
@ -685,7 +703,7 @@ void CharacterCreation::showClassQuestionDialog()
|
|||
buttons.push_back(sGenerateClassSteps[mGenerateClassStep].mButtons[2]);
|
||||
mGenerateClassQuestionDialog->setButtons(buttons);
|
||||
mGenerateClassQuestionDialog->eventButtonSelected += MyGUI::newDelegate(this, &CharacterCreation::onClassQuestionChosen);
|
||||
mGenerateClassQuestionDialog->open();
|
||||
mGenerateClassQuestionDialog->setVisible(true);
|
||||
|
||||
MWBase::Environment::get().getSoundManager()->say(sGenerateClassSteps[mGenerateClassStep].mSound);
|
||||
}
|
||||
|
@ -695,8 +713,9 @@ void CharacterCreation::onGenerateClassBack()
|
|||
if(mCreationStage < CSE_ClassChosen)
|
||||
mCreationStage = CSE_ClassChosen;
|
||||
|
||||
if (mGenerateClassResultDialog)
|
||||
mWM->removeDialog(mGenerateClassResultDialog);
|
||||
mWM->removeDialog(mGenerateClassResultDialog);
|
||||
mGenerateClassResultDialog = 0;
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass);
|
||||
|
||||
mWM->popGuiMode();
|
||||
|
@ -705,8 +724,9 @@ void CharacterCreation::onGenerateClassBack()
|
|||
|
||||
void CharacterCreation::onGenerateClassDone(WindowBase* parWindow)
|
||||
{
|
||||
if (mGenerateClassResultDialog)
|
||||
mWM->removeDialog(mGenerateClassResultDialog);
|
||||
mWM->removeDialog(mGenerateClassResultDialog);
|
||||
mGenerateClassResultDialog = 0;
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass);
|
||||
const ESM::Class *klass = MWBase::Environment::get().getWorld()->getStore().classes.find(mGenerateClass);
|
||||
mPlayerClass = *klass;
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
#ifndef CHARACTER_CREATION_HPP
|
||||
#define CHARACTER_CREATION_HPP
|
||||
|
||||
#include "window_manager.hpp"
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||
#include "../mwmechanics/stat.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class WindowManager;
|
||||
class WindowBase;
|
||||
|
||||
class TextInputDialog;
|
||||
|
@ -32,7 +29,7 @@ namespace MWGui
|
|||
public:
|
||||
typedef std::vector<int> SkillList;
|
||||
|
||||
CharacterCreation(WindowManager* _wm);
|
||||
CharacterCreation(MWBase::WindowManager* _wm);
|
||||
~CharacterCreation();
|
||||
|
||||
//Show a dialog
|
||||
|
@ -61,7 +58,7 @@ namespace MWGui
|
|||
BirthDialog* mBirthSignDialog;
|
||||
ReviewDialog* mReviewDialog;
|
||||
|
||||
WindowManager* mWM;
|
||||
MWBase::WindowManager* mWM;
|
||||
|
||||
//Player data
|
||||
std::string mPlayerName;
|
||||
|
|
|
@ -7,7 +7,10 @@
|
|||
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "window_manager.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "tooltips.hpp"
|
||||
|
||||
#undef min
|
||||
|
@ -17,7 +20,7 @@ using namespace MWGui;
|
|||
|
||||
/* GenerateClassResultDialog */
|
||||
|
||||
GenerateClassResultDialog::GenerateClassResultDialog(WindowManager& parWindowManager)
|
||||
GenerateClassResultDialog::GenerateClassResultDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_generate_class_result.layout", parWindowManager)
|
||||
{
|
||||
// Centre dialog
|
||||
|
@ -43,11 +46,6 @@ GenerateClassResultDialog::GenerateClassResultDialog(WindowManager& parWindowMan
|
|||
backButton->setCoord(315 - okButtonWidth - backButtonWidth - 6, 219, backButtonWidth, 23);
|
||||
}
|
||||
|
||||
void GenerateClassResultDialog::open()
|
||||
{
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
std::string GenerateClassResultDialog::getClassId() const
|
||||
{
|
||||
return mClassName->getCaption();
|
||||
|
@ -57,8 +55,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 +72,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
|
||||
|
@ -141,7 +138,6 @@ void PickClassDialog::open()
|
|||
{
|
||||
updateClasses();
|
||||
updateStats();
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -193,7 +189,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 +213,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 +277,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)
|
||||
{
|
||||
|
@ -339,7 +335,6 @@ void InfoBoxDialog::open()
|
|||
layoutVertically(mMainWidget, 4 + 6);
|
||||
|
||||
center();
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
int InfoBoxDialog::getChosenButton() const
|
||||
|
@ -365,7 +360,7 @@ void InfoBoxDialog::onButtonClicked(MyGUI::WidgetPtr _sender)
|
|||
|
||||
/* ClassChoiceDialog */
|
||||
|
||||
ClassChoiceDialog::ClassChoiceDialog(WindowManager& parWindowManager)
|
||||
ClassChoiceDialog::ClassChoiceDialog(MWBase::WindowManager& parWindowManager)
|
||||
: InfoBoxDialog(parWindowManager)
|
||||
{
|
||||
setText("");
|
||||
|
@ -379,7 +374,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)
|
||||
|
@ -547,35 +542,21 @@ void CreateClassDialog::setNextButtonShow(bool shown)
|
|||
descriptionButton->setCoord(459 - okButtonWidth - backButtonWidth - descriptionButtonWidth - 12, 158, descriptionButtonWidth, 23);
|
||||
}
|
||||
|
||||
void CreateClassDialog::open()
|
||||
{
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
// widget controls
|
||||
|
||||
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,8 +682,8 @@ void CreateClassDialog::onBackClicked(MyGUI::Widget* _sender)
|
|||
|
||||
/* SelectSpecializationDialog */
|
||||
|
||||
SelectSpecializationDialog::SelectSpecializationDialog(WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_select_specialization.layout", parWindowManager)
|
||||
SelectSpecializationDialog::SelectSpecializationDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowModal("openmw_chargen_select_specialization.layout", parWindowManager)
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
@ -734,13 +715,10 @@ SelectSpecializationDialog::SelectSpecializationDialog(WindowManager& parWindowM
|
|||
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSpecializationDialog::onCancelClicked);
|
||||
int buttonWidth = cancelButton->getTextSize().width + 24;
|
||||
cancelButton->setCoord(216 - buttonWidth, 90, buttonWidth, 21);
|
||||
|
||||
MyGUI::InputManager::getInstance().addWidgetModal(mMainWidget);
|
||||
}
|
||||
|
||||
SelectSpecializationDialog::~SelectSpecializationDialog()
|
||||
{
|
||||
MyGUI::InputManager::getInstance().removeWidgetModal(mMainWidget);
|
||||
}
|
||||
|
||||
// widget controls
|
||||
|
@ -766,8 +744,8 @@ void SelectSpecializationDialog::onCancelClicked(MyGUI::Widget* _sender)
|
|||
|
||||
/* SelectAttributeDialog */
|
||||
|
||||
SelectAttributeDialog::SelectAttributeDialog(WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_select_attribute.layout", parWindowManager)
|
||||
SelectAttributeDialog::SelectAttributeDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowModal("openmw_chargen_select_attribute.layout", parWindowManager)
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
@ -792,13 +770,10 @@ SelectAttributeDialog::SelectAttributeDialog(WindowManager& parWindowManager)
|
|||
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectAttributeDialog::onCancelClicked);
|
||||
int buttonWidth = cancelButton->getTextSize().width + 24;
|
||||
cancelButton->setCoord(186 - buttonWidth, 180, buttonWidth, 21);
|
||||
|
||||
MyGUI::InputManager::getInstance().addWidgetModal(mMainWidget);
|
||||
}
|
||||
|
||||
SelectAttributeDialog::~SelectAttributeDialog()
|
||||
{
|
||||
MyGUI::InputManager::getInstance().removeWidgetModal(mMainWidget);
|
||||
}
|
||||
|
||||
// widget controls
|
||||
|
@ -818,8 +793,8 @@ void SelectAttributeDialog::onCancelClicked(MyGUI::Widget* _sender)
|
|||
|
||||
/* SelectSkillDialog */
|
||||
|
||||
SelectSkillDialog::SelectSkillDialog(WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_select_skill.layout", parWindowManager)
|
||||
SelectSkillDialog::SelectSkillDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowModal("openmw_chargen_select_skill.layout", parWindowManager)
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
@ -891,12 +866,10 @@ SelectSkillDialog::SelectSkillDialog(WindowManager& parWindowManager)
|
|||
int buttonWidth = cancelButton->getTextSize().width + 24;
|
||||
cancelButton->setCoord(447 - buttonWidth, 218, buttonWidth, 21);
|
||||
|
||||
MyGUI::InputManager::getInstance().addWidgetModal(mMainWidget);
|
||||
}
|
||||
|
||||
SelectSkillDialog::~SelectSkillDialog()
|
||||
{
|
||||
MyGUI::InputManager::getInstance().removeWidgetModal(mMainWidget);
|
||||
}
|
||||
|
||||
// widget controls
|
||||
|
@ -914,8 +887,8 @@ void SelectSkillDialog::onCancelClicked(MyGUI::Widget* _sender)
|
|||
|
||||
/* DescriptionDialog */
|
||||
|
||||
DescriptionDialog::DescriptionDialog(WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_class_description.layout", parWindowManager)
|
||||
DescriptionDialog::DescriptionDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowModal("openmw_chargen_class_description.layout", parWindowManager)
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
@ -931,13 +904,10 @@ DescriptionDialog::DescriptionDialog(WindowManager& parWindowManager)
|
|||
|
||||
// Make sure the edit box has focus
|
||||
MyGUI::InputManager::getInstance().setKeyFocusWidget(mTextEdit);
|
||||
|
||||
MyGUI::InputManager::getInstance().addWidgetModal(mMainWidget);
|
||||
}
|
||||
|
||||
DescriptionDialog::~DescriptionDialog()
|
||||
{
|
||||
MyGUI::InputManager::getInstance().removeWidgetModal(mMainWidget);
|
||||
}
|
||||
|
||||
// widget controls
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -27,7 +26,7 @@ namespace MWGui
|
|||
std::string getText() const;
|
||||
void setButtons(ButtonList &buttons);
|
||||
|
||||
void open();
|
||||
virtual void open();
|
||||
int getChosenButton() const;
|
||||
|
||||
// Events
|
||||
|
@ -64,19 +63,17 @@ 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);
|
||||
|
||||
void open();
|
||||
|
||||
// Events
|
||||
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
||||
|
||||
|
@ -99,13 +96,13 @@ 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);
|
||||
|
||||
void setNextButtonShow(bool shown);
|
||||
void open();
|
||||
virtual void open();
|
||||
|
||||
// Events
|
||||
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
||||
|
@ -135,10 +132,10 @@ namespace MWGui
|
|||
std::string mCurrentClassId;
|
||||
};
|
||||
|
||||
class SelectSpecializationDialog : public WindowBase
|
||||
class SelectSpecializationDialog : public WindowModal
|
||||
{
|
||||
public:
|
||||
SelectSpecializationDialog(WindowManager& parWindowManager);
|
||||
SelectSpecializationDialog(MWBase::WindowManager& parWindowManager);
|
||||
~SelectSpecializationDialog();
|
||||
|
||||
ESM::Class::Specialization getSpecializationId() const { return mSpecializationId; }
|
||||
|
@ -166,10 +163,10 @@ namespace MWGui
|
|||
ESM::Class::Specialization mSpecializationId;
|
||||
};
|
||||
|
||||
class SelectAttributeDialog : public WindowBase
|
||||
class SelectAttributeDialog : public WindowModal
|
||||
{
|
||||
public:
|
||||
SelectAttributeDialog(WindowManager& parWindowManager);
|
||||
SelectAttributeDialog(MWBase::WindowManager& parWindowManager);
|
||||
~SelectAttributeDialog();
|
||||
|
||||
ESM::Attribute::AttributeID getAttributeId() const { return mAttributeId; }
|
||||
|
@ -199,10 +196,10 @@ namespace MWGui
|
|||
ESM::Attribute::AttributeID mAttributeId;
|
||||
};
|
||||
|
||||
class SelectSkillDialog : public WindowBase
|
||||
class SelectSkillDialog : public WindowModal
|
||||
{
|
||||
public:
|
||||
SelectSkillDialog(WindowManager& parWindowManager);
|
||||
SelectSkillDialog(MWBase::WindowManager& parWindowManager);
|
||||
~SelectSkillDialog();
|
||||
|
||||
ESM::Skill::SkillEnum getSkillId() const { return mSkillId; }
|
||||
|
@ -235,10 +232,10 @@ namespace MWGui
|
|||
ESM::Skill::SkillEnum mSkillId;
|
||||
};
|
||||
|
||||
class DescriptionDialog : public WindowBase
|
||||
class DescriptionDialog : public WindowModal
|
||||
{
|
||||
public:
|
||||
DescriptionDialog(WindowManager& parWindowManager);
|
||||
DescriptionDialog(MWBase::WindowManager& parWindowManager);
|
||||
~DescriptionDialog();
|
||||
|
||||
std::string getTextInput() const { return mTextEdit ? mTextEdit->getOnlyText() : ""; }
|
||||
|
@ -254,7 +251,7 @@ namespace MWGui
|
|||
class CreateClassDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
CreateClassDialog(WindowManager& parWindowManager);
|
||||
CreateClassDialog(MWBase::WindowManager& parWindowManager);
|
||||
virtual ~CreateClassDialog();
|
||||
|
||||
std::string getName() const;
|
||||
|
@ -265,7 +262,6 @@ namespace MWGui
|
|||
std::vector<ESM::Skill::SkillEnum> getMinorSkills() const;
|
||||
|
||||
void setNextButtonShow(bool shown);
|
||||
void open();
|
||||
|
||||
// Events
|
||||
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
ConfirmationDialog::ConfirmationDialog(WindowManager& parWindowManager) :
|
||||
WindowBase("openmw_confirmation_dialog.layout", parWindowManager)
|
||||
ConfirmationDialog::ConfirmationDialog(MWBase::WindowManager& parWindowManager) :
|
||||
WindowModal("openmw_confirmation_dialog.layout", parWindowManager)
|
||||
{
|
||||
getWidget(mMessage, "Message");
|
||||
getWidget(mOkButton, "OkButton");
|
||||
|
@ -32,9 +32,6 @@ namespace MWGui
|
|||
|
||||
center();
|
||||
|
||||
// make other gui elements inaccessible while this dialog is open
|
||||
MyGUI::InputManager::getInstance().addWidgetModal(mMainWidget);
|
||||
|
||||
int okButtonWidth = mOkButton->getTextSize().width + 24;
|
||||
mOkButton->setCoord(mMainWidget->getWidth() - 30 - okButtonWidth,
|
||||
mOkButton->getTop(),
|
||||
|
@ -52,19 +49,13 @@ namespace MWGui
|
|||
{
|
||||
eventCancelClicked();
|
||||
|
||||
close();
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
void ConfirmationDialog::onOkButtonClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
eventOkClicked();
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
void ConfirmationDialog::close()
|
||||
{
|
||||
setVisible(false);
|
||||
MyGUI::InputManager::getInstance().removeWidgetModal(mMainWidget);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
class ConfirmationDialog : public WindowBase
|
||||
class ConfirmationDialog : public WindowModal
|
||||
{
|
||||
public:
|
||||
ConfirmationDialog(WindowManager& parWindowManager);
|
||||
ConfirmationDialog(MWBase::WindowManager& parWindowManager);
|
||||
void open(const std::string& message);
|
||||
|
||||
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
||||
|
@ -26,8 +26,6 @@ namespace MWGui
|
|||
|
||||
void onCancelButtonClicked(MyGUI::Widget* _sender);
|
||||
void onOkButtonClicked(MyGUI::Widget* _sender);
|
||||
|
||||
void close();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/manualref.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
@ -18,11 +20,6 @@
|
|||
|
||||
#include "../mwclass/container.hpp"
|
||||
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
#include "window_manager.hpp"
|
||||
#include "widgets.hpp"
|
||||
#include "countdialog.hpp"
|
||||
#include "tradewindow.hpp"
|
||||
|
@ -594,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,8 +7,8 @@
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
CountDialog::CountDialog(WindowManager& parWindowManager) :
|
||||
WindowBase("openmw_count_window.layout", parWindowManager)
|
||||
CountDialog::CountDialog(MWBase::WindowManager& parWindowManager) :
|
||||
WindowModal("openmw_count_window.layout", parWindowManager)
|
||||
{
|
||||
getWidget(mSlider, "CountSlider");
|
||||
getWidget(mItemEdit, "ItemEdit");
|
||||
|
@ -40,9 +40,6 @@ namespace MWGui
|
|||
width,
|
||||
mMainWidget->getHeight());
|
||||
|
||||
// make other gui elements inaccessible while this dialog is open
|
||||
MyGUI::InputManager::getInstance().addWidgetModal(mMainWidget);
|
||||
|
||||
MyGUI::InputManager::getInstance().setKeyFocusWidget(mItemEdit);
|
||||
|
||||
mSlider->setScrollPosition(maxCount-1);
|
||||
|
@ -63,14 +60,14 @@ namespace MWGui
|
|||
|
||||
void CountDialog::onCancelButtonClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
close();
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
void CountDialog::onOkButtonClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
eventOkClicked(NULL, mSlider->getScrollPosition()+1);
|
||||
|
||||
close();
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
void CountDialog::onEditTextChange(MyGUI::EditBox* _sender)
|
||||
|
@ -99,10 +96,4 @@ namespace MWGui
|
|||
{
|
||||
mItemEdit->setCaption(boost::lexical_cast<std::string>(_position+1));
|
||||
}
|
||||
|
||||
void CountDialog::close()
|
||||
{
|
||||
setVisible(false);
|
||||
MyGUI::InputManager::getInstance().removeWidgetModal(mMainWidget);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
class CountDialog : public WindowBase
|
||||
class CountDialog : public WindowModal
|
||||
{
|
||||
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;
|
||||
|
@ -30,8 +30,6 @@ namespace MWGui
|
|||
void onOkButtonClicked(MyGUI::Widget* _sender);
|
||||
void onEditTextChange(MyGUI::EditBox* _sender);
|
||||
void onSliderMoved(MyGUI::ScrollBar* _sender, size_t _position);
|
||||
|
||||
void close();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -16,4 +16,5 @@ CursorReplace::CursorReplace()
|
|||
OEngine::Render::ImageRotate::rotate("textures\\tx_cursormove.dds", "mwpointer_dresize2.png", 45);
|
||||
|
||||
OEngine::Render::Atlas::createFromFile("atlas1.cfg", "mwgui1", "textures\\");
|
||||
OEngine::Render::Atlas::createFromFile("mainmenu.cfg", "mwgui2", "textures\\");
|
||||
}
|
||||
|
|
|
@ -9,10 +9,11 @@
|
|||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwdialogue/dialoguemanager.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"
|
||||
|
@ -41,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");
|
||||
}
|
||||
|
||||
|
|
|
@ -8,16 +8,15 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
#include "../mwgui/widgets.hpp"
|
||||
|
||||
#include "inventorywindow.hpp"
|
||||
#include "window_manager.hpp"
|
||||
#include "container.hpp"
|
||||
#include "console.hpp"
|
||||
|
||||
|
@ -25,9 +24,9 @@ using namespace MWGui;
|
|||
|
||||
HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
|
||||
: Layout("openmw_hud.layout")
|
||||
, health(NULL)
|
||||
, magicka(NULL)
|
||||
, stamina(NULL)
|
||||
, mHealth(NULL)
|
||||
, mMagicka(NULL)
|
||||
, mStamina(NULL)
|
||||
, mWeapImage(NULL)
|
||||
, mSpellImage(NULL)
|
||||
, mWeapStatus(NULL)
|
||||
|
@ -37,10 +36,10 @@ HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
|
|||
, mMinimap(NULL)
|
||||
, mCompass(NULL)
|
||||
, mCrosshair(NULL)
|
||||
, fpsbox(NULL)
|
||||
, fpscounter(NULL)
|
||||
, trianglecounter(NULL)
|
||||
, batchcounter(NULL)
|
||||
, mFpsBox(NULL)
|
||||
, mFpsCounter(NULL)
|
||||
, mTriangleCounter(NULL)
|
||||
, mBatchCounter(NULL)
|
||||
, mHealthManaStaminaBaseLeft(0)
|
||||
, mWeapBoxBaseLeft(0)
|
||||
, mSpellBoxBaseLeft(0)
|
||||
|
@ -58,10 +57,9 @@ HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
|
|||
|
||||
// Energy bars
|
||||
getWidget(mHealthFrame, "HealthFrame");
|
||||
getWidget(health, "Health");
|
||||
getWidget(magicka, "Magicka");
|
||||
getWidget(stamina, "Stamina");
|
||||
|
||||
getWidget(mHealth, "Health");
|
||||
getWidget(mMagicka, "Magicka");
|
||||
getWidget(mStamina, "Stamina");
|
||||
mHealthManaStaminaBaseLeft = mHealthFrame->getLeft();
|
||||
|
||||
MyGUI::Widget *healthFrame, *magickaFrame, *fatigueFrame;
|
||||
|
@ -94,9 +92,10 @@ HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
|
|||
|
||||
getWidget(mMinimapBox, "MiniMapBox");
|
||||
mMinimapBoxBaseRight = viewSize.width - mMinimapBox->getRight();
|
||||
mMinimapBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMapClicked);
|
||||
getWidget(mMinimap, "MiniMap");
|
||||
getWidget(mCompass, "Compass");
|
||||
getWidget(mMinimapButton, "MiniMapButton");
|
||||
mMinimapButton->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMapClicked);
|
||||
|
||||
getWidget(mCellNameBox, "CellName");
|
||||
getWidget(mWeaponSpellBox, "WeaponSpellName");
|
||||
|
@ -105,8 +104,8 @@ HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
|
|||
|
||||
setFpsLevel(fpsLevel);
|
||||
|
||||
getWidget(trianglecounter, "TriangleCounter");
|
||||
getWidget(batchcounter, "BatchCounter");
|
||||
getWidget(mTriangleCounter, "TriangleCounter");
|
||||
getWidget(mBatchCounter, "BatchCounter");
|
||||
|
||||
setEffect("icons\\s\\tx_s_chameleon.dds");
|
||||
|
||||
|
@ -119,7 +118,7 @@ HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
|
|||
|
||||
void HUD::setFpsLevel(int level)
|
||||
{
|
||||
fpscounter = 0;
|
||||
mFpsCounter = 0;
|
||||
|
||||
MyGUI::Widget* fps;
|
||||
getWidget(fps, "FPSBoxAdv");
|
||||
|
@ -129,32 +128,32 @@ void HUD::setFpsLevel(int level)
|
|||
|
||||
if (level == 2)
|
||||
{
|
||||
getWidget(fpsbox, "FPSBoxAdv");
|
||||
fpsbox->setVisible(true);
|
||||
getWidget(fpscounter, "FPSCounterAdv");
|
||||
getWidget(mFpsBox, "FPSBoxAdv");
|
||||
mFpsBox->setVisible(true);
|
||||
getWidget(mFpsCounter, "FPSCounterAdv");
|
||||
}
|
||||
else if (level == 1)
|
||||
{
|
||||
getWidget(fpsbox, "FPSBox");
|
||||
fpsbox->setVisible(true);
|
||||
getWidget(fpscounter, "FPSCounter");
|
||||
getWidget(mFpsBox, "FPSBox");
|
||||
mFpsBox->setVisible(true);
|
||||
getWidget(mFpsCounter, "FPSCounter");
|
||||
}
|
||||
}
|
||||
|
||||
void HUD::setFPS(float fps)
|
||||
{
|
||||
if (fpscounter)
|
||||
fpscounter->setCaption(boost::lexical_cast<std::string>((int)fps));
|
||||
if (mFpsCounter)
|
||||
mFpsCounter->setCaption(boost::lexical_cast<std::string>((int)fps));
|
||||
}
|
||||
|
||||
void HUD::setTriangleCount(unsigned int count)
|
||||
{
|
||||
trianglecounter->setCaption(boost::lexical_cast<std::string>(count));
|
||||
mTriangleCounter->setCaption(boost::lexical_cast<std::string>(count));
|
||||
}
|
||||
|
||||
void HUD::setBatchCount(unsigned int count)
|
||||
{
|
||||
batchcounter->setCaption(boost::lexical_cast<std::string>(count));
|
||||
mBatchCounter->setCaption(boost::lexical_cast<std::string>(count));
|
||||
}
|
||||
|
||||
void HUD::setEffect(const char *img)
|
||||
|
@ -177,20 +176,20 @@ void HUD::setValue(const std::string& id, const MWMechanics::DynamicStat<int>& v
|
|||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
health->setProgressRange (value.getModified());
|
||||
health->setProgressPosition (value.getCurrent());
|
||||
mHealth->setProgressRange (value.getModified());
|
||||
mHealth->setProgressPosition (value.getCurrent());
|
||||
getWidget(w, "HealthFrame");
|
||||
w->setUserString("Caption_HealthDescription", "#{sHealthDesc}\n" + valStr);
|
||||
break;
|
||||
case 1:
|
||||
magicka->setProgressRange (value.getModified());
|
||||
magicka->setProgressPosition (value.getCurrent());
|
||||
mMagicka->setProgressRange (value.getModified());
|
||||
mMagicka->setProgressPosition (value.getCurrent());
|
||||
getWidget(w, "MagickaFrame");
|
||||
w->setUserString("Caption_HealthDescription", "#{sIntDesc}\n" + valStr);
|
||||
break;
|
||||
case 2:
|
||||
stamina->setProgressRange (value.getModified());
|
||||
stamina->setProgressPosition (value.getCurrent());
|
||||
mStamina->setProgressRange (value.getModified());
|
||||
mStamina->setProgressPosition (value.getCurrent());
|
||||
getWidget(w, "FatigueFrame");
|
||||
w->setUserString("Caption_HealthDescription", "#{sFatDesc}\n" + valStr);
|
||||
break;
|
||||
|
@ -198,46 +197,11 @@ void HUD::setValue(const std::string& id, const MWMechanics::DynamicStat<int>& v
|
|||
}
|
||||
}
|
||||
|
||||
void HUD::setBottomLeftVisibility(bool hmsVisible, bool weapVisible, bool spellVisible)
|
||||
{
|
||||
int weapDx = 0, spellDx = 0;
|
||||
if (!hmsVisible)
|
||||
spellDx = weapDx = mWeapBoxBaseLeft - mHealthManaStaminaBaseLeft;
|
||||
|
||||
if (!weapVisible)
|
||||
spellDx += mSpellBoxBaseLeft - mWeapBoxBaseLeft;
|
||||
|
||||
mWeaponVisible = weapVisible;
|
||||
mSpellVisible = spellVisible;
|
||||
if (!mWeaponVisible && !mSpellVisible)
|
||||
mWeaponSpellBox->setVisible(false);
|
||||
|
||||
health->setVisible(hmsVisible);
|
||||
stamina->setVisible(hmsVisible);
|
||||
magicka->setVisible(hmsVisible);
|
||||
mWeapBox->setPosition(mWeapBoxBaseLeft - weapDx, mWeapBox->getTop());
|
||||
mWeapBox->setVisible(weapVisible);
|
||||
mSpellBox->setPosition(mSpellBoxBaseLeft - spellDx, mSpellBox->getTop());
|
||||
mSpellBox->setVisible(spellVisible);
|
||||
}
|
||||
|
||||
void HUD::setBottomRightVisibility(bool effectBoxVisible, bool minimapBoxVisible)
|
||||
{
|
||||
const MyGUI::IntSize& viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||
|
||||
// effect box can have variable width -> variable left coordinate
|
||||
int effectsDx = 0;
|
||||
if (!minimapBoxVisible)
|
||||
effectsDx = (viewSize.width - mMinimapBoxBaseRight) - (viewSize.width - mEffectBoxBaseRight);
|
||||
|
||||
mMapVisible = minimapBoxVisible;
|
||||
mMinimapBox->setVisible(minimapBoxVisible);
|
||||
mEffectBox->setPosition((viewSize.width - mEffectBoxBaseRight) - mEffectBox->getWidth() + effectsDx, mEffectBox->getTop());
|
||||
mEffectBox->setVisible(effectBoxVisible);
|
||||
}
|
||||
|
||||
void HUD::onWorldClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
if (!MWBase::Environment::get().getWindowManager ()->isGuiMode ())
|
||||
return;
|
||||
|
||||
if (mDragAndDrop->mIsOnDragAndDrop)
|
||||
{
|
||||
// drop item into the gameworld
|
||||
|
@ -518,3 +482,68 @@ void HUD::unsetSelectedWeapon()
|
|||
mWeapImage->setImageTexture("icons\\k\\stealth_handtohand.dds");
|
||||
mWeapBox->clearUserStrings();
|
||||
}
|
||||
|
||||
void HUD::setCrosshairVisible(bool visible)
|
||||
{
|
||||
mCrosshair->setVisible (visible);
|
||||
}
|
||||
|
||||
void HUD::setHmsVisible(bool visible)
|
||||
{
|
||||
mHealth->setVisible(visible);
|
||||
mMagicka->setVisible(visible);
|
||||
mStamina->setVisible(visible);
|
||||
updatePositions();
|
||||
}
|
||||
|
||||
void HUD::setWeapVisible(bool visible)
|
||||
{
|
||||
mWeapBox->setVisible(visible);
|
||||
updatePositions();
|
||||
}
|
||||
|
||||
void HUD::setSpellVisible(bool visible)
|
||||
{
|
||||
mSpellBox->setVisible(visible);
|
||||
updatePositions();
|
||||
}
|
||||
|
||||
void HUD::setEffectVisible(bool visible)
|
||||
{
|
||||
mEffectBox->setVisible (visible);
|
||||
updatePositions();
|
||||
}
|
||||
|
||||
void HUD::setMinimapVisible(bool visible)
|
||||
{
|
||||
mMinimapBox->setVisible (visible);
|
||||
updatePositions();
|
||||
}
|
||||
|
||||
void HUD::updatePositions()
|
||||
{
|
||||
int weapDx = 0, spellDx = 0;
|
||||
if (!mHealth->getVisible())
|
||||
spellDx = weapDx = mWeapBoxBaseLeft - mHealthManaStaminaBaseLeft;
|
||||
|
||||
if (!mWeapBox->getVisible())
|
||||
spellDx += mSpellBoxBaseLeft - mWeapBoxBaseLeft;
|
||||
|
||||
mWeaponVisible = mWeapBox->getVisible();
|
||||
mSpellVisible = mSpellBox->getVisible();
|
||||
if (!mWeaponVisible && !mSpellVisible)
|
||||
mWeaponSpellBox->setVisible(false);
|
||||
|
||||
mWeapBox->setPosition(mWeapBoxBaseLeft - weapDx, mWeapBox->getTop());
|
||||
mSpellBox->setPosition(mSpellBoxBaseLeft - spellDx, mSpellBox->getTop());
|
||||
|
||||
const MyGUI::IntSize& viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||
|
||||
// effect box can have variable width -> variable left coordinate
|
||||
int effectsDx = 0;
|
||||
if (!mMinimapBox->getVisible ())
|
||||
effectsDx = (viewSize.width - mMinimapBoxBaseRight) - (viewSize.width - mEffectBoxBaseRight);
|
||||
|
||||
mMapVisible = mMinimapBox->getVisible ();
|
||||
mEffectBox->setPosition((viewSize.width - mEffectBoxBaseRight) - mEffectBox->getWidth() + effectsDx, mEffectBox->getTop());
|
||||
}
|
||||
|
|
|
@ -18,8 +18,14 @@ namespace MWGui
|
|||
void setFPS(float fps);
|
||||
void setTriangleCount(unsigned int count);
|
||||
void setBatchCount(unsigned int count);
|
||||
void setBottomLeftVisibility(bool hmsVisible, bool weapVisible, bool spellVisible);
|
||||
void setBottomRightVisibility(bool effectBoxVisible, bool minimapVisible);
|
||||
|
||||
void setHmsVisible(bool visible);
|
||||
void setWeapVisible(bool visible);
|
||||
void setSpellVisible(bool visible);
|
||||
|
||||
void setEffectVisible(bool visible);
|
||||
void setMinimapVisible(bool visible);
|
||||
|
||||
void setFpsLevel(const int level);
|
||||
|
||||
void setSelectedSpell(const std::string& spellId, int successChancePercent);
|
||||
|
@ -28,6 +34,8 @@ namespace MWGui
|
|||
void unsetSelectedSpell();
|
||||
void unsetSelectedWeapon();
|
||||
|
||||
void setCrosshairVisible(bool visible);
|
||||
|
||||
void onFrame(float dt);
|
||||
void onResChange(int width, int height);
|
||||
|
||||
|
@ -35,12 +43,14 @@ namespace MWGui
|
|||
|
||||
bool getWorldMouseOver() { return mWorldMouseOver; }
|
||||
|
||||
MyGUI::ProgressPtr health, magicka, stamina;
|
||||
private:
|
||||
MyGUI::ProgressPtr mHealth, mMagicka, mStamina;
|
||||
MyGUI::Widget* mHealthFrame;
|
||||
MyGUI::Widget *mWeapBox, *mSpellBox;
|
||||
MyGUI::ImageBox *mWeapImage, *mSpellImage;
|
||||
MyGUI::ProgressPtr mWeapStatus, mSpellStatus;
|
||||
MyGUI::Widget *mEffectBox, *mMinimapBox;
|
||||
MyGUI::Button* mMinimapButton;
|
||||
MyGUI::ImageBox* mEffect1;
|
||||
MyGUI::ScrollView* mMinimap;
|
||||
MyGUI::ImageBox* mCompass;
|
||||
|
@ -48,12 +58,13 @@ namespace MWGui
|
|||
MyGUI::TextBox* mCellNameBox;
|
||||
MyGUI::TextBox* mWeaponSpellBox;
|
||||
|
||||
MyGUI::WidgetPtr fpsbox;
|
||||
MyGUI::TextBox* fpscounter;
|
||||
MyGUI::TextBox* trianglecounter;
|
||||
MyGUI::TextBox* batchcounter;
|
||||
MyGUI::Widget* mDummy;
|
||||
|
||||
MyGUI::WidgetPtr mFpsBox;
|
||||
MyGUI::TextBox* mFpsCounter;
|
||||
MyGUI::TextBox* mTriangleCounter;
|
||||
MyGUI::TextBox* mBatchCounter;
|
||||
|
||||
private:
|
||||
// bottom left elements
|
||||
int mHealthManaStaminaBaseLeft, mWeapBoxBaseLeft, mSpellBoxBaseLeft;
|
||||
// bottom right elements
|
||||
|
@ -81,5 +92,7 @@ namespace MWGui
|
|||
void onWeaponClicked(MyGUI::Widget* _sender);
|
||||
void onMagicClicked(MyGUI::Widget* _sender);
|
||||
void onMapClicked(MyGUI::Widget* _sender);
|
||||
|
||||
void updatePositions();
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
|
@ -17,11 +19,6 @@
|
|||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
#include "../mwclass/container.hpp"
|
||||
|
||||
#include "window_manager.hpp"
|
||||
#include "widgets.hpp"
|
||||
#include "bookwindow.hpp"
|
||||
#include "scrollwindow.hpp"
|
||||
|
@ -43,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();
|
||||
|
||||
|
|
45
apps/openmw/mwgui/itemselection.cpp
Normal file
45
apps/openmw/mwgui/itemselection.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
#include "itemselection.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
ItemSelectionDialog::ItemSelectionDialog(const std::string &label, ContainerBase::Filter filter, MWBase::WindowManager& parWindowManager)
|
||||
: ContainerBase(NULL)
|
||||
, WindowModal("openmw_itemselection_dialog.layout", parWindowManager)
|
||||
{
|
||||
mFilter = filter;
|
||||
|
||||
MyGUI::ScrollView* itemView;
|
||||
MyGUI::Widget* containerWidget;
|
||||
getWidget(containerWidget, "Items");
|
||||
getWidget(itemView, "ItemView");
|
||||
setWidgets(containerWidget, itemView);
|
||||
|
||||
MyGUI::TextBox* l;
|
||||
getWidget(l, "Label");
|
||||
l->setCaptionWithReplacing (label);
|
||||
|
||||
MyGUI::Button* cancelButton;
|
||||
getWidget(cancelButton, "CancelButton");
|
||||
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ItemSelectionDialog::onCancelButtonClicked);
|
||||
|
||||
int dx = (cancelButton->getTextSize().width + 24) - cancelButton->getWidth();
|
||||
cancelButton->setCoord(cancelButton->getLeft() - dx,
|
||||
cancelButton->getTop(),
|
||||
cancelButton->getTextSize ().width + 24,
|
||||
cancelButton->getHeight());
|
||||
|
||||
center();
|
||||
}
|
||||
|
||||
void ItemSelectionDialog::onSelectedItemImpl(MWWorld::Ptr item)
|
||||
{
|
||||
eventItemSelected(item);
|
||||
}
|
||||
|
||||
void ItemSelectionDialog::onCancelButtonClicked(MyGUI::Widget* sender)
|
||||
{
|
||||
eventDialogCanceled();
|
||||
}
|
||||
|
||||
}
|
28
apps/openmw/mwgui/itemselection.hpp
Normal file
28
apps/openmw/mwgui/itemselection.hpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
#include "container.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
class ItemSelectionDialog : public ContainerBase, public WindowModal
|
||||
{
|
||||
public:
|
||||
ItemSelectionDialog(const std::string& label, ContainerBase::Filter filter, MWBase::WindowManager& parWindowManager);
|
||||
|
||||
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
||||
typedef MyGUI::delegates::CMultiDelegate1<MWWorld::Ptr> EventHandle_Item;
|
||||
|
||||
EventHandle_Item eventItemSelected;
|
||||
EventHandle_Void eventDialogCanceled;
|
||||
|
||||
|
||||
private:
|
||||
virtual void onReferenceUnavailable() { ; }
|
||||
|
||||
virtual void onSelectedItemImpl(MWWorld::Ptr item);
|
||||
|
||||
void onCancelButtonClicked(MyGUI::Widget* sender);
|
||||
};
|
||||
|
||||
}
|
|
@ -2,12 +2,11 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/journal.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwdialogue/journal.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
#include "window_manager.hpp"
|
||||
#include "../mwdialogue/journalentry.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -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,13 +10,11 @@
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
class WindowManager;
|
||||
|
||||
class JournalWindow : public WindowBase
|
||||
{
|
||||
public:
|
||||
JournalWindow(WindowManager& parWindowManager);
|
||||
void open();
|
||||
JournalWindow(MWBase::WindowManager& parWindowManager);
|
||||
virtual void open();
|
||||
|
||||
virtual void setVisible(bool visible); // only used to play close sound
|
||||
|
||||
|
|
84
apps/openmw/mwgui/mainmenu.cpp
Normal file
84
apps/openmw/mwgui/mainmenu.cpp
Normal file
|
@ -0,0 +1,84 @@
|
|||
#include "mainmenu.hpp"
|
||||
|
||||
#include <OgreRoot.h>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
MainMenu::MainMenu(int w, int h)
|
||||
: OEngine::GUI::Layout("openmw_mainmenu.layout")
|
||||
, mButtonBox(0)
|
||||
{
|
||||
onResChange(w,h);
|
||||
}
|
||||
|
||||
void MainMenu::onResChange(int w, int h)
|
||||
{
|
||||
setCoord(0,0,w,h);
|
||||
|
||||
int height = 64 * 3;
|
||||
|
||||
if (mButtonBox)
|
||||
MyGUI::Gui::getInstance ().destroyWidget(mButtonBox);
|
||||
|
||||
mButtonBox = mMainWidget->createWidget<MyGUI::Widget>("", MyGUI::IntCoord(w/2 - 64, h/2 - height/2, 128, height), MyGUI::Align::Default);
|
||||
int curH = 0;
|
||||
|
||||
mReturn = mButtonBox->createWidget<MyGUI::Button> ("ButtonImage", MyGUI::IntCoord(0, curH, 128, 64), MyGUI::Align::Default);
|
||||
mReturn->setImageResource ("Menu_Return");
|
||||
mReturn->eventMouseButtonClick += MyGUI::newDelegate(this, &MainMenu::returnToGame);
|
||||
curH += 64;
|
||||
|
||||
|
||||
/*
|
||||
mNewGame = mButtonBox->createWidget<MyGUI::Button> ("ButtonImage", MyGUI::IntCoord(0, curH, 128, 64), MyGUI::Align::Default);
|
||||
mNewGame->setImageResource ("Menu_NewGame");
|
||||
curH += 64;
|
||||
|
||||
mLoadGame = mButtonBox->createWidget<MyGUI::Button> ("ButtonImage", MyGUI::IntCoord(0, curH, 128, 64), MyGUI::Align::Default);
|
||||
mLoadGame->setImageResource ("Menu_LoadGame");
|
||||
curH += 64;
|
||||
|
||||
|
||||
mSaveGame = mButtonBox->createWidget<MyGUI::Button> ("ButtonImage", MyGUI::IntCoord(0, curH, 128, 64), MyGUI::Align::Default);
|
||||
mSaveGame->setImageResource ("Menu_SaveGame");
|
||||
curH += 64;
|
||||
*/
|
||||
|
||||
mOptions = mButtonBox->createWidget<MyGUI::Button> ("ButtonImage", MyGUI::IntCoord(0, curH, 128, 64), MyGUI::Align::Default);
|
||||
mOptions->setImageResource ("Menu_Options");
|
||||
mOptions->eventMouseButtonClick += MyGUI::newDelegate(this, &MainMenu::showOptions);
|
||||
curH += 64;
|
||||
|
||||
/*
|
||||
mCredits = mButtonBox->createWidget<MyGUI::Button> ("ButtonImage", MyGUI::IntCoord(0, curH, 128, 64), MyGUI::Align::Default);
|
||||
mCredits->setImageResource ("Menu_Credits");
|
||||
curH += 64;
|
||||
*/
|
||||
|
||||
mExitGame = mButtonBox->createWidget<MyGUI::Button> ("ButtonImage", MyGUI::IntCoord(0, curH, 128, 64), MyGUI::Align::Default);
|
||||
mExitGame->setImageResource ("Menu_ExitGame");
|
||||
mExitGame->eventMouseButtonClick += MyGUI::newDelegate(this, &MainMenu::exitGame);
|
||||
curH += 64;
|
||||
}
|
||||
|
||||
void MainMenu::returnToGame(MyGUI::Widget* sender)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager ()->removeGuiMode (GM_MainMenu);
|
||||
}
|
||||
|
||||
void MainMenu::showOptions(MyGUI::Widget* sender)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager ()->pushGuiMode (GM_Settings);
|
||||
}
|
||||
|
||||
void MainMenu::exitGame(MyGUI::Widget* sender)
|
||||
{
|
||||
Ogre::Root::getSingleton ().queueEndRendering ();
|
||||
}
|
||||
|
||||
}
|
|
@ -6,11 +6,24 @@ namespace MWGui
|
|||
class MainMenu : public OEngine::GUI::Layout
|
||||
{
|
||||
public:
|
||||
MainMenu(int w, int h)
|
||||
: Layout("openmw_mainmenu.layout")
|
||||
{
|
||||
setCoord(0,0,w,h);
|
||||
}
|
||||
MainMenu(int w, int h);
|
||||
|
||||
void onResChange(int w, int h);
|
||||
|
||||
private:
|
||||
MyGUI::Button* mReturn;
|
||||
MyGUI::Button* mNewGame;
|
||||
MyGUI::Button* mLoadGame;
|
||||
MyGUI::Button* mSaveGame;
|
||||
MyGUI::Button* mOptions;
|
||||
MyGUI::Button* mCredits;
|
||||
MyGUI::Button* mExitGame;
|
||||
|
||||
MyGUI::Widget* mButtonBox;
|
||||
|
||||
void returnToGame(MyGUI::Widget* sender);
|
||||
void showOptions(MyGUI::Widget* sender);
|
||||
void exitGame(MyGUI::Widget* sender);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
#include "map_window.hpp"
|
||||
#include "window_manager.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <OgreVector2.h>
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
||||
using namespace MWGui;
|
||||
|
||||
LocalMapBase::LocalMapBase()
|
||||
|
@ -88,13 +93,34 @@ void LocalMapBase::applyFogOfWar()
|
|||
}
|
||||
}
|
||||
|
||||
void LocalMapBase::onMarkerFocused (MyGUI::Widget* w1, MyGUI::Widget* w2)
|
||||
{
|
||||
applyFogOfWar ();
|
||||
}
|
||||
|
||||
void LocalMapBase::onMarkerUnfocused (MyGUI::Widget* w1, MyGUI::Widget* w2)
|
||||
{
|
||||
applyFogOfWar ();
|
||||
}
|
||||
|
||||
void LocalMapBase::setActiveCell(const int x, const int y, bool interior)
|
||||
{
|
||||
if (x==mCurX && y==mCurY && mInterior==interior && !mChanged) return; // don't do anything if we're still in the same cell
|
||||
|
||||
// clear all previous markers
|
||||
for (unsigned int i=0; i< mLocalMap->getChildCount(); ++i)
|
||||
{
|
||||
if (mLocalMap->getChildAt(i)->getName ().substr (0, 6) == "Marker")
|
||||
{
|
||||
MyGUI::Gui::getInstance ().destroyWidget (mLocalMap->getChildAt(i));
|
||||
}
|
||||
}
|
||||
|
||||
for (int mx=0; mx<3; ++mx)
|
||||
{
|
||||
for (int my=0; my<3; ++my)
|
||||
{
|
||||
// map
|
||||
std::string image = mPrefix+"_"+ boost::lexical_cast<std::string>(x + (mx-1)) + "_"
|
||||
+ boost::lexical_cast<std::string>(y + (interior ? (my-1) : -1*(my-1)));
|
||||
|
||||
|
@ -107,12 +133,78 @@ void LocalMapBase::setActiveCell(const int x, const int y, bool interior)
|
|||
box->setImageTexture(image);
|
||||
else
|
||||
box->setImageTexture("black.png");
|
||||
|
||||
|
||||
// door markers
|
||||
|
||||
// interior map only consists of one cell, so handle the markers only once
|
||||
if (interior && (mx != 2 || my != 2))
|
||||
continue;
|
||||
|
||||
MWWorld::CellStore* cell;
|
||||
if (interior)
|
||||
cell = MWBase::Environment::get().getWorld ()->getInterior (mPrefix);
|
||||
else
|
||||
cell = MWBase::Environment::get().getWorld ()->getExterior (x+mx-1, y-(my-1));
|
||||
|
||||
std::vector<MWBase::World::DoorMarker> doors = MWBase::Environment::get().getWorld ()->getDoorMarkers (cell);
|
||||
|
||||
for (std::vector<MWBase::World::DoorMarker>::iterator it = doors.begin(); it != doors.end(); ++it)
|
||||
{
|
||||
MWBase::World::DoorMarker marker = *it;
|
||||
|
||||
// convert world coordinates to normalized cell coordinates
|
||||
MyGUI::IntCoord widgetCoord;
|
||||
float nX,nY;
|
||||
int cellDx, cellDy;
|
||||
if (!interior)
|
||||
{
|
||||
const int cellSize = 8192;
|
||||
|
||||
nX = (marker.x - cellSize * (x+mx-1)) / cellSize;
|
||||
nY = 1 - (marker.y - cellSize * (y-(my-1))) / cellSize;
|
||||
|
||||
widgetCoord = MyGUI::IntCoord(nX * 512 - 4 + mx * 512, nY * 512 - 4 + my * 512, 8, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
Ogre::Vector2 position (marker.x, -marker.y);
|
||||
MWBase::Environment::get().getWorld ()->getInteriorMapPosition (position, nX, nY, cellDx, cellDy);
|
||||
|
||||
widgetCoord = MyGUI::IntCoord(nX * 512 - 4 + (1+cellDx-x) * 512, nY * 512 - 4 + (1+cellDy-y) * 512, 8, 8);
|
||||
}
|
||||
|
||||
static int counter = 0;
|
||||
++counter;
|
||||
MyGUI::Button* markerWidget = mLocalMap->createWidget<MyGUI::Button>("ButtonImage",
|
||||
widgetCoord, MyGUI::Align::Default, "Marker" + boost::lexical_cast<std::string>(counter));
|
||||
markerWidget->setImageResource("DoorMarker");
|
||||
markerWidget->setUserString("ToolTipType", "Layout");
|
||||
markerWidget->setUserString("ToolTipLayout", "TextToolTip");
|
||||
markerWidget->setUserString("Caption_Text", marker.name);
|
||||
markerWidget->setUserString("IsMarker", "true");
|
||||
markerWidget->eventMouseSetFocus += MyGUI::newDelegate(this, &LocalMapBase::onMarkerFocused);
|
||||
markerWidget->eventMouseLostFocus += MyGUI::newDelegate(this, &LocalMapBase::onMarkerUnfocused);
|
||||
|
||||
MarkerPosition markerPos;
|
||||
markerPos.interior = interior;
|
||||
markerPos.cellX = interior ? cellDx : x + mx - 1;
|
||||
markerPos.cellY = interior ? cellDy : y + ((my - 1)*-1);
|
||||
markerPos.nX = nX;
|
||||
markerPos.nY = nY;
|
||||
|
||||
markerWidget->setUserData(markerPos);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
mInterior = interior;
|
||||
mCurX = x;
|
||||
mCurY = y;
|
||||
mChanged = false;
|
||||
|
||||
// fog of war
|
||||
applyFogOfWar();
|
||||
|
||||
// set the compass texture again, because MyGUI determines sorting of ImageBox widgets
|
||||
|
@ -154,7 +246,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)
|
||||
{
|
||||
|
|
|
@ -18,6 +18,15 @@ namespace MWGui
|
|||
|
||||
void toggleFogOfWar();
|
||||
|
||||
struct MarkerPosition
|
||||
{
|
||||
bool interior;
|
||||
int cellX;
|
||||
int cellY;
|
||||
float nX;
|
||||
float nY;
|
||||
};
|
||||
|
||||
protected:
|
||||
int mCurX, mCurY;
|
||||
bool mInterior;
|
||||
|
@ -32,6 +41,9 @@ namespace MWGui
|
|||
|
||||
void applyFogOfWar();
|
||||
|
||||
void onMarkerFocused(MyGUI::Widget* w1, MyGUI::Widget* w2);
|
||||
void onMarkerUnfocused(MyGUI::Widget* w1, MyGUI::Widget* w2);
|
||||
|
||||
OEngine::GUI::Layout* mLayout;
|
||||
|
||||
bool mMapDragAndDrop;
|
||||
|
@ -45,11 +57,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;
|
||||
|
|
|
@ -32,7 +32,9 @@ namespace MWGui
|
|||
GM_Review,
|
||||
|
||||
// interactive MessageBox
|
||||
GM_InterMessageBox
|
||||
GM_InterMessageBox,
|
||||
|
||||
GM_QuickKeysMenu
|
||||
};
|
||||
|
||||
// Windows shown in inventory mode
|
||||
|
|
630
apps/openmw/mwgui/quickkeysmenu.cpp
Normal file
630
apps/openmw/mwgui/quickkeysmenu.cpp
Normal file
|
@ -0,0 +1,630 @@
|
|||
#include "quickkeysmenu.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
#include "../mwworld/actionequip.hpp"
|
||||
#include "../mwmechanics/spells.hpp"
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/spellsuccess.hpp"
|
||||
#include "../mwgui/inventorywindow.hpp"
|
||||
#include "../mwgui/bookwindow.hpp"
|
||||
#include "../mwgui/scrollwindow.hpp"
|
||||
|
||||
#include "windowmanagerimp.hpp"
|
||||
#include "itemselection.hpp"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
bool sortItems(const MWWorld::Ptr& left, const MWWorld::Ptr& right)
|
||||
{
|
||||
int cmp = MWWorld::Class::get(left).getName(left).compare(
|
||||
MWWorld::Class::get(right).getName(right));
|
||||
return cmp < 0;
|
||||
}
|
||||
|
||||
bool sortSpells(const std::string& left, const std::string& right)
|
||||
{
|
||||
const ESM::Spell* a = MWBase::Environment::get().getWorld()->getStore().spells.find(left);
|
||||
const ESM::Spell* b = MWBase::Environment::get().getWorld()->getStore().spells.find(right);
|
||||
|
||||
int cmp = a->name.compare(b->name);
|
||||
return cmp < 0;
|
||||
}
|
||||
}
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
QuickKeysMenu::QuickKeysMenu(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_quickkeys_menu.layout", parWindowManager)
|
||||
, mAssignDialog(0)
|
||||
, mItemSelectionDialog(0)
|
||||
, mMagicSelectionDialog(0)
|
||||
{
|
||||
getWidget(mOkButton, "OKButton");
|
||||
getWidget(mInstructionLabel, "InstructionLabel");
|
||||
|
||||
mMainWidget->setSize(mMainWidget->getWidth(),
|
||||
mMainWidget->getHeight() + (mInstructionLabel->getTextSize().height - mInstructionLabel->getHeight()));
|
||||
|
||||
int okButtonWidth = mOkButton->getTextSize ().width + 24;
|
||||
mOkButton->setCoord(mOkButton->getLeft() - (okButtonWidth - mOkButton->getWidth()),
|
||||
mOkButton->getTop(),
|
||||
okButtonWidth,
|
||||
mOkButton->getHeight());
|
||||
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &QuickKeysMenu::onOkButtonClicked);
|
||||
|
||||
center();
|
||||
|
||||
|
||||
for (int i = 0; i < 10; ++i)
|
||||
{
|
||||
MyGUI::Button* button;
|
||||
getWidget(button, "QuickKey" + boost::lexical_cast<std::string>(i+1));
|
||||
|
||||
button->eventMouseButtonClick += MyGUI::newDelegate(this, &QuickKeysMenu::onQuickKeyButtonClicked);
|
||||
|
||||
unassign(button, i);
|
||||
|
||||
mQuickKeyButtons.push_back(button);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
QuickKeysMenu::~QuickKeysMenu()
|
||||
{
|
||||
delete mAssignDialog;
|
||||
delete mItemSelectionDialog;
|
||||
delete mMagicSelectionDialog;
|
||||
}
|
||||
|
||||
void QuickKeysMenu::unassign(MyGUI::Widget* key, int index)
|
||||
{
|
||||
while (key->getChildCount ())
|
||||
MyGUI::Gui::getInstance ().destroyWidget (key->getChildAt(0));
|
||||
|
||||
key->setUserData(Type_Unassigned);
|
||||
|
||||
MyGUI::TextBox* textBox = key->createWidgetReal<MyGUI::TextBox>("SandText", MyGUI::FloatCoord(0,0,1,1), MyGUI::Align::Default);
|
||||
textBox->setTextAlign (MyGUI::Align::Center);
|
||||
textBox->setCaption (boost::lexical_cast<std::string>(index+1));
|
||||
textBox->setNeedMouseFocus (false);
|
||||
}
|
||||
|
||||
void QuickKeysMenu::onQuickKeyButtonClicked(MyGUI::Widget* sender)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < 10; ++i)
|
||||
{
|
||||
if (sender == mQuickKeyButtons[i] || sender->getParent () == mQuickKeyButtons[i])
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert(index != -1);
|
||||
mSelectedIndex = index;
|
||||
|
||||
{
|
||||
// open assign dialog
|
||||
if (!mAssignDialog)
|
||||
mAssignDialog = new QuickKeysMenuAssign(mWindowManager, this);
|
||||
mAssignDialog->setVisible (true);
|
||||
}
|
||||
}
|
||||
|
||||
void QuickKeysMenu::onOkButtonClicked (MyGUI::Widget *sender)
|
||||
{
|
||||
mWindowManager.removeGuiMode(GM_QuickKeysMenu);
|
||||
}
|
||||
|
||||
|
||||
void QuickKeysMenu::onItemButtonClicked(MyGUI::Widget* sender)
|
||||
{
|
||||
if (!mItemSelectionDialog )
|
||||
{
|
||||
mItemSelectionDialog = new ItemSelectionDialog("#{sQuickMenu6}", ContainerBase::Filter_All, mWindowManager);
|
||||
mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &QuickKeysMenu::onAssignItem);
|
||||
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &QuickKeysMenu::onAssignItemCancel);
|
||||
}
|
||||
mItemSelectionDialog->setVisible(true);
|
||||
mItemSelectionDialog->openContainer(MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
mItemSelectionDialog->drawItems ();
|
||||
|
||||
mAssignDialog->setVisible (false);
|
||||
}
|
||||
|
||||
void QuickKeysMenu::onMagicButtonClicked(MyGUI::Widget* sender)
|
||||
{
|
||||
if (!mMagicSelectionDialog )
|
||||
{
|
||||
mMagicSelectionDialog = new MagicSelectionDialog(mWindowManager, this);
|
||||
}
|
||||
mMagicSelectionDialog->setVisible(true);
|
||||
|
||||
mAssignDialog->setVisible (false);
|
||||
}
|
||||
|
||||
void QuickKeysMenu::onUnassignButtonClicked(MyGUI::Widget* sender)
|
||||
{
|
||||
unassign(mQuickKeyButtons[mSelectedIndex], mSelectedIndex);
|
||||
mAssignDialog->setVisible (false);
|
||||
}
|
||||
|
||||
void QuickKeysMenu::onCancelButtonClicked(MyGUI::Widget* sender)
|
||||
{
|
||||
mAssignDialog->setVisible (false);
|
||||
}
|
||||
|
||||
void QuickKeysMenu::onAssignItem(MWWorld::Ptr item)
|
||||
{
|
||||
MyGUI::Button* button = mQuickKeyButtons[mSelectedIndex];
|
||||
while (button->getChildCount ())
|
||||
MyGUI::Gui::getInstance ().destroyWidget (button->getChildAt(0));
|
||||
|
||||
button->setUserData(Type_Item);
|
||||
|
||||
MyGUI::ImageBox* frame = button->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(9, 8, 42, 42), MyGUI::Align::Default);
|
||||
std::string backgroundTex = "textures\\menu_icon_barter.dds";
|
||||
frame->setImageTexture (backgroundTex);
|
||||
frame->setImageCoord (MyGUI::IntCoord(4, 4, 40, 40));
|
||||
frame->setUserString ("ToolTipType", "ItemPtr");
|
||||
frame->setUserData(item);
|
||||
frame->eventMouseButtonClick += MyGUI::newDelegate(this, &QuickKeysMenu::onQuickKeyButtonClicked);
|
||||
|
||||
|
||||
MyGUI::ImageBox* image = frame->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(5, 5, 32, 32), MyGUI::Align::Default);
|
||||
std::string path = std::string("icons\\");
|
||||
path += MWWorld::Class::get(item).getInventoryIcon(item);
|
||||
int pos = path.rfind(".");
|
||||
path.erase(pos);
|
||||
path.append(".dds");
|
||||
image->setImageTexture (path);
|
||||
image->setNeedMouseFocus (false);
|
||||
|
||||
mItemSelectionDialog->setVisible(false);
|
||||
}
|
||||
|
||||
void QuickKeysMenu::onAssignItemCancel()
|
||||
{
|
||||
mItemSelectionDialog->setVisible(false);
|
||||
}
|
||||
|
||||
void QuickKeysMenu::onAssignMagicItem (MWWorld::Ptr item)
|
||||
{
|
||||
MyGUI::Button* button = mQuickKeyButtons[mSelectedIndex];
|
||||
while (button->getChildCount ())
|
||||
MyGUI::Gui::getInstance ().destroyWidget (button->getChildAt(0));
|
||||
|
||||
button->setUserData(Type_MagicItem);
|
||||
|
||||
MyGUI::ImageBox* frame = button->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(9, 8, 42, 42), MyGUI::Align::Default);
|
||||
std::string backgroundTex = "textures\\menu_icon_select_magic_magic.dds";
|
||||
frame->setImageTexture (backgroundTex);
|
||||
frame->setImageCoord (MyGUI::IntCoord(2, 2, 40, 40));
|
||||
frame->setUserString ("ToolTipType", "ItemPtr");
|
||||
frame->setUserData(item);
|
||||
frame->eventMouseButtonClick += MyGUI::newDelegate(this, &QuickKeysMenu::onQuickKeyButtonClicked);
|
||||
|
||||
MyGUI::ImageBox* image = frame->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(5, 5, 32, 32), MyGUI::Align::Default);
|
||||
std::string path = std::string("icons\\");
|
||||
path += MWWorld::Class::get(item).getInventoryIcon(item);
|
||||
int pos = path.rfind(".");
|
||||
path.erase(pos);
|
||||
path.append(".dds");
|
||||
image->setImageTexture (path);
|
||||
image->setNeedMouseFocus (false);
|
||||
|
||||
mMagicSelectionDialog->setVisible(false);
|
||||
}
|
||||
|
||||
void QuickKeysMenu::onAssignMagic (const std::string& spellId)
|
||||
{
|
||||
MyGUI::Button* button = mQuickKeyButtons[mSelectedIndex];
|
||||
while (button->getChildCount ())
|
||||
MyGUI::Gui::getInstance ().destroyWidget (button->getChildAt(0));
|
||||
|
||||
button->setUserData(Type_Magic);
|
||||
|
||||
MyGUI::ImageBox* frame = button->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(9, 8, 42, 42), MyGUI::Align::Default);
|
||||
std::string backgroundTex = "textures\\menu_icon_select_magic.dds";
|
||||
frame->setImageTexture (backgroundTex);
|
||||
frame->setImageCoord (MyGUI::IntCoord(2, 2, 40, 40));
|
||||
frame->setUserString ("ToolTipType", "Spell");
|
||||
frame->setUserString ("Spell", spellId);
|
||||
frame->eventMouseButtonClick += MyGUI::newDelegate(this, &QuickKeysMenu::onQuickKeyButtonClicked);
|
||||
|
||||
MyGUI::ImageBox* image = frame->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(5, 5, 32, 32), MyGUI::Align::Default);
|
||||
|
||||
// use the icon of the first effect
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
|
||||
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(spell->effects.list.front().effectID);
|
||||
std::string path = effect->icon;
|
||||
int slashPos = path.find("\\");
|
||||
path.insert(slashPos+1, "b_");
|
||||
path = std::string("icons\\") + path;
|
||||
int pos = path.rfind(".");
|
||||
path.erase(pos);
|
||||
path.append(".dds");
|
||||
|
||||
image->setImageTexture (path);
|
||||
image->setNeedMouseFocus (false);
|
||||
|
||||
mMagicSelectionDialog->setVisible(false);
|
||||
}
|
||||
|
||||
void QuickKeysMenu::onAssignMagicCancel ()
|
||||
{
|
||||
mMagicSelectionDialog->setVisible(false);
|
||||
}
|
||||
|
||||
void QuickKeysMenu::activateQuickKey(int index)
|
||||
{
|
||||
MyGUI::Button* button = mQuickKeyButtons[index-1];
|
||||
|
||||
QuickKeyType type = *button->getUserData<QuickKeyType>();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
|
||||
if (type == Type_Magic)
|
||||
{
|
||||
std::string spellId = button->getChildAt(0)->getUserString("Spell");
|
||||
spells.setSelectedSpell(spellId);
|
||||
store.setSelectedEnchantItem(store.end());
|
||||
mWindowManager.setSelectedSpell(spellId, int(MWMechanics::getSpellSuccessChance(spellId, player)));
|
||||
}
|
||||
else if (type == Type_Item)
|
||||
{
|
||||
MWWorld::Ptr item = *button->getChildAt (0)->getUserData<MWWorld::Ptr>();
|
||||
|
||||
// make sure the item is available
|
||||
if (item.getRefData ().getCount() == 0)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager ()->messageBox (
|
||||
"#{sQuickMenu5} " + MWWorld::Class::get(item).getName(item), std::vector<std::string>());
|
||||
return;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> action = MWWorld::Class::get(item).use(item);
|
||||
|
||||
action->execute (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
|
||||
// this is necessary for books/scrolls: if they are already in the player's inventory,
|
||||
// the "Take" button should not be visible.
|
||||
// NOTE: the take button is "reset" when the window opens, so we can safely do the following
|
||||
// without screwing up future book windows
|
||||
mWindowManager.getBookWindow()->setTakeButtonShow(false);
|
||||
mWindowManager.getScrollWindow()->setTakeButtonShow(false);
|
||||
|
||||
// since we changed equipping status, update the inventory window
|
||||
mWindowManager.getInventoryWindow()->drawItems();
|
||||
}
|
||||
else if (type == Type_MagicItem)
|
||||
{
|
||||
MWWorld::Ptr item = *button->getChildAt (0)->getUserData<MWWorld::Ptr>();
|
||||
|
||||
// make sure the item is available
|
||||
if (item.getRefData ().getCount() == 0)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager ()->messageBox (
|
||||
"#{sQuickMenu5} " + MWWorld::Class::get(item).getName(item), std::vector<std::string>());
|
||||
return;
|
||||
}
|
||||
|
||||
// retrieve ContainerStoreIterator to the item
|
||||
MWWorld::ContainerStoreIterator it = store.begin();
|
||||
for (; it != store.end(); ++it)
|
||||
{
|
||||
if (*it == item)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert(it != store.end());
|
||||
|
||||
// equip, if it can be equipped
|
||||
if (!MWWorld::Class::get(item).getEquipmentSlots(item).first.empty())
|
||||
{
|
||||
// Note: can't use Class::use here because enchanted scrolls for example would then open the scroll window instead of equipping
|
||||
|
||||
MWWorld::ActionEquip action(item);
|
||||
action.execute (MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ());
|
||||
|
||||
// since we changed equipping status, update the inventory window
|
||||
mWindowManager.getInventoryWindow()->drawItems();
|
||||
}
|
||||
|
||||
store.setSelectedEnchantItem(it);
|
||||
spells.setSelectedSpell("");
|
||||
mWindowManager.setSelectedEnchantItem(item, 100); /// \todo track charge %
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------
|
||||
|
||||
QuickKeysMenuAssign::QuickKeysMenuAssign (MWBase::WindowManager &parWindowManager, QuickKeysMenu* parent)
|
||||
: WindowModal("openmw_quickkeys_menu_assign.layout", parWindowManager)
|
||||
, mParent(parent)
|
||||
{
|
||||
getWidget(mLabel, "Label");
|
||||
getWidget(mItemButton, "ItemButton");
|
||||
getWidget(mMagicButton, "MagicButton");
|
||||
getWidget(mUnassignButton, "UnassignButton");
|
||||
getWidget(mCancelButton, "CancelButton");
|
||||
|
||||
mItemButton->eventMouseButtonClick += MyGUI::newDelegate(mParent, &QuickKeysMenu::onItemButtonClicked);
|
||||
mMagicButton->eventMouseButtonClick += MyGUI::newDelegate(mParent, &QuickKeysMenu::onMagicButtonClicked);
|
||||
mUnassignButton->eventMouseButtonClick += MyGUI::newDelegate(mParent, &QuickKeysMenu::onUnassignButtonClicked);
|
||||
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(mParent, &QuickKeysMenu::onCancelButtonClicked);
|
||||
|
||||
|
||||
int maxWidth = mItemButton->getTextSize ().width + 24;
|
||||
maxWidth = std::max(maxWidth, mMagicButton->getTextSize ().width + 24);
|
||||
maxWidth = std::max(maxWidth, mUnassignButton->getTextSize ().width + 24);
|
||||
maxWidth = std::max(maxWidth, mCancelButton->getTextSize ().width + 24);
|
||||
|
||||
mMainWidget->setSize(maxWidth + 24, mMainWidget->getHeight());
|
||||
mLabel->setSize(maxWidth, mLabel->getHeight());
|
||||
|
||||
mItemButton->setCoord((maxWidth - mItemButton->getTextSize().width-24)/2 + 8,
|
||||
mItemButton->getTop(),
|
||||
mItemButton->getTextSize().width + 24,
|
||||
mItemButton->getHeight());
|
||||
mMagicButton->setCoord((maxWidth - mMagicButton->getTextSize().width-24)/2 + 8,
|
||||
mMagicButton->getTop(),
|
||||
mMagicButton->getTextSize().width + 24,
|
||||
mMagicButton->getHeight());
|
||||
mUnassignButton->setCoord((maxWidth - mUnassignButton->getTextSize().width-24)/2 + 8,
|
||||
mUnassignButton->getTop(),
|
||||
mUnassignButton->getTextSize().width + 24,
|
||||
mUnassignButton->getHeight());
|
||||
mCancelButton->setCoord((maxWidth - mCancelButton->getTextSize().width-24)/2 + 8,
|
||||
mCancelButton->getTop(),
|
||||
mCancelButton->getTextSize().width + 24,
|
||||
mCancelButton->getHeight());
|
||||
|
||||
center();
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------
|
||||
|
||||
MagicSelectionDialog::MagicSelectionDialog(MWBase::WindowManager &parWindowManager, QuickKeysMenu* parent)
|
||||
: WindowModal("openmw_magicselection_dialog.layout", parWindowManager)
|
||||
, mParent(parent)
|
||||
, mWidth(0)
|
||||
, mHeight(0)
|
||||
{
|
||||
getWidget(mCancelButton, "CancelButton");
|
||||
getWidget(mMagicList, "MagicList");
|
||||
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &MagicSelectionDialog::onCancelButtonClicked);
|
||||
|
||||
int dx = (mCancelButton->getTextSize().width + 24) - mCancelButton->getWidth();
|
||||
mCancelButton->setCoord(mCancelButton->getLeft() - dx,
|
||||
mCancelButton->getTop(),
|
||||
mCancelButton->getTextSize ().width + 24,
|
||||
mCancelButton->getHeight());
|
||||
|
||||
center();
|
||||
}
|
||||
|
||||
void MagicSelectionDialog::onCancelButtonClicked (MyGUI::Widget *sender)
|
||||
{
|
||||
mParent->onAssignMagicCancel ();
|
||||
}
|
||||
|
||||
void MagicSelectionDialog::open ()
|
||||
{
|
||||
WindowModal::open();
|
||||
|
||||
while (mMagicList->getChildCount ())
|
||||
MyGUI::Gui::getInstance ().destroyWidget (mMagicList->getChildAt (0));
|
||||
|
||||
mHeight = 0;
|
||||
|
||||
const int spellHeight = 18;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
|
||||
/// \todo lots of copy&pasted code from SpellWindow
|
||||
|
||||
// retrieve powers & spells, sort by name
|
||||
std::vector<std::string> spellList;
|
||||
|
||||
for (MWMechanics::Spells::TIterator it = spells.begin(); it != spells.end(); ++it)
|
||||
{
|
||||
spellList.push_back(*it);
|
||||
}
|
||||
|
||||
std::vector<std::string> powers;
|
||||
std::vector<std::string>::iterator it = spellList.begin();
|
||||
while (it != spellList.end())
|
||||
{
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
|
||||
if (spell->data.type == ESM::Spell::ST_Power)
|
||||
{
|
||||
powers.push_back(*it);
|
||||
it = spellList.erase(it);
|
||||
}
|
||||
else if (spell->data.type == ESM::Spell::ST_Ability
|
||||
|| spell->data.type == ESM::Spell::ST_Blight
|
||||
|| spell->data.type == ESM::Spell::ST_Curse
|
||||
|| spell->data.type == ESM::Spell::ST_Disease)
|
||||
{
|
||||
it = spellList.erase(it);
|
||||
}
|
||||
else
|
||||
++it;
|
||||
}
|
||||
std::sort(powers.begin(), powers.end(), sortSpells);
|
||||
std::sort(spellList.begin(), spellList.end(), sortSpells);
|
||||
|
||||
// retrieve usable magic items & sort
|
||||
std::vector<MWWorld::Ptr> items;
|
||||
for (MWWorld::ContainerStoreIterator it(store.begin()); it != store.end(); ++it)
|
||||
{
|
||||
std::string enchantId = MWWorld::Class::get(*it).getEnchantment(*it);
|
||||
if (enchantId != "")
|
||||
{
|
||||
// only add items with "Cast once" or "Cast on use"
|
||||
const ESM::Enchantment* enchant = MWBase::Environment::get().getWorld()->getStore().enchants.find(enchantId);
|
||||
int type = enchant->data.type;
|
||||
if (type != ESM::Enchantment::CastOnce
|
||||
&& type != ESM::Enchantment::WhenUsed)
|
||||
continue;
|
||||
|
||||
items.push_back(*it);
|
||||
}
|
||||
}
|
||||
std::sort(items.begin(), items.end(), sortItems);
|
||||
|
||||
|
||||
int height = estimateHeight(items.size() + powers.size() + spellList.size());
|
||||
bool scrollVisible = height > mMagicList->getHeight();
|
||||
mWidth = mMagicList->getWidth() - scrollVisible * 18;
|
||||
|
||||
|
||||
// powers
|
||||
addGroup("#{sPowers}", "");
|
||||
|
||||
for (std::vector<std::string>::const_iterator it = powers.begin(); it != powers.end(); ++it)
|
||||
{
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
|
||||
MyGUI::Button* t = mMagicList->createWidget<MyGUI::Button>("SpellText",
|
||||
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
|
||||
t->setCaption(spell->name);
|
||||
t->setTextAlign(MyGUI::Align::Left);
|
||||
t->setUserString("ToolTipType", "Spell");
|
||||
t->setUserString("Spell", *it);
|
||||
t->eventMouseWheel += MyGUI::newDelegate(this, &MagicSelectionDialog::onMouseWheel);
|
||||
t->eventMouseButtonClick += MyGUI::newDelegate(this, &MagicSelectionDialog::onSpellSelected);
|
||||
|
||||
mHeight += spellHeight;
|
||||
}
|
||||
|
||||
// other spells
|
||||
addGroup("#{sSpells}", "");
|
||||
for (std::vector<std::string>::const_iterator it = spellList.begin(); it != spellList.end(); ++it)
|
||||
{
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
|
||||
MyGUI::Button* t = mMagicList->createWidget<MyGUI::Button>("SpellText",
|
||||
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
|
||||
t->setCaption(spell->name);
|
||||
t->setTextAlign(MyGUI::Align::Left);
|
||||
t->setUserString("ToolTipType", "Spell");
|
||||
t->setUserString("Spell", *it);
|
||||
t->eventMouseWheel += MyGUI::newDelegate(this, &MagicSelectionDialog::onMouseWheel);
|
||||
t->eventMouseButtonClick += MyGUI::newDelegate(this, &MagicSelectionDialog::onSpellSelected);
|
||||
|
||||
mHeight += spellHeight;
|
||||
}
|
||||
|
||||
|
||||
// enchanted items
|
||||
addGroup("#{sMagicItem}", "");
|
||||
|
||||
for (std::vector<MWWorld::Ptr>::const_iterator it = items.begin(); it != items.end(); ++it)
|
||||
{
|
||||
MWWorld::Ptr item = *it;
|
||||
|
||||
// check if the item is currently equipped (will display in a different color)
|
||||
bool equipped = false;
|
||||
for (int i=0; i < MWWorld::InventoryStore::Slots; ++i)
|
||||
{
|
||||
if (store.getSlot(i) != store.end() && *store.getSlot(i) == item)
|
||||
{
|
||||
equipped = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MyGUI::Button* t = mMagicList->createWidget<MyGUI::Button>(equipped ? "SpellText" : "SpellTextUnequipped",
|
||||
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
|
||||
t->setCaption(MWWorld::Class::get(item).getName(item));
|
||||
t->setTextAlign(MyGUI::Align::Left);
|
||||
t->setUserData(item);
|
||||
t->setUserString("ToolTipType", "ItemPtr");
|
||||
t->eventMouseButtonClick += MyGUI::newDelegate(this, &MagicSelectionDialog::onEnchantedItemSelected);
|
||||
t->eventMouseWheel += MyGUI::newDelegate(this, &MagicSelectionDialog::onMouseWheel);
|
||||
|
||||
mHeight += spellHeight;
|
||||
}
|
||||
|
||||
|
||||
mMagicList->setCanvasSize (mWidth, std::max(mMagicList->getHeight(), mHeight));
|
||||
|
||||
}
|
||||
|
||||
void MagicSelectionDialog::addGroup(const std::string &label, const std::string& label2)
|
||||
{
|
||||
if (mMagicList->getChildCount() > 0)
|
||||
{
|
||||
MyGUI::ImageBox* separator = mMagicList->createWidget<MyGUI::ImageBox>("MW_HLine",
|
||||
MyGUI::IntCoord(4, mHeight, mWidth-8, 18),
|
||||
MyGUI::Align::Left | MyGUI::Align::Top);
|
||||
separator->setNeedMouseFocus(false);
|
||||
mHeight += 18;
|
||||
}
|
||||
|
||||
MyGUI::TextBox* groupWidget = mMagicList->createWidget<MyGUI::TextBox>("SandBrightText",
|
||||
MyGUI::IntCoord(0, mHeight, mWidth, 24),
|
||||
MyGUI::Align::Left | MyGUI::Align::Top | MyGUI::Align::HStretch);
|
||||
groupWidget->setCaptionWithReplacing(label);
|
||||
groupWidget->setTextAlign(MyGUI::Align::Left);
|
||||
groupWidget->setNeedMouseFocus(false);
|
||||
|
||||
if (label2 != "")
|
||||
{
|
||||
MyGUI::TextBox* groupWidget2 = mMagicList->createWidget<MyGUI::TextBox>("SandBrightText",
|
||||
MyGUI::IntCoord(0, mHeight, mWidth-4, 24),
|
||||
MyGUI::Align::Left | MyGUI::Align::Top);
|
||||
groupWidget2->setCaptionWithReplacing(label2);
|
||||
groupWidget2->setTextAlign(MyGUI::Align::Right);
|
||||
groupWidget2->setNeedMouseFocus(false);
|
||||
}
|
||||
|
||||
mHeight += 24;
|
||||
}
|
||||
|
||||
|
||||
void MagicSelectionDialog::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
||||
{
|
||||
if (mMagicList->getViewOffset().top + _rel*0.3 > 0)
|
||||
mMagicList->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||
else
|
||||
mMagicList->setViewOffset(MyGUI::IntPoint(0, mMagicList->getViewOffset().top + _rel*0.3));
|
||||
}
|
||||
|
||||
void MagicSelectionDialog::onEnchantedItemSelected(MyGUI::Widget* _sender)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr item = *_sender->getUserData<MWWorld::Ptr>();
|
||||
|
||||
mParent->onAssignMagicItem (item);
|
||||
}
|
||||
|
||||
void MagicSelectionDialog::onSpellSelected(MyGUI::Widget* _sender)
|
||||
{
|
||||
mParent->onAssignMagic (_sender->getUserString("Spell"));
|
||||
}
|
||||
|
||||
int MagicSelectionDialog::estimateHeight(int numSpells) const
|
||||
{
|
||||
int height = 0;
|
||||
height += 24 * 3 + 18 * 2; // group headings
|
||||
height += numSpells * 18;
|
||||
return height;
|
||||
}
|
||||
|
||||
}
|
107
apps/openmw/mwgui/quickkeysmenu.hpp
Normal file
107
apps/openmw/mwgui/quickkeysmenu.hpp
Normal file
|
@ -0,0 +1,107 @@
|
|||
#ifndef MWGUI_QUICKKEYS_H
|
||||
#define MWGUI_QUICKKEYS_H
|
||||
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
||||
#include "window_base.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
class QuickKeysMenuAssign;
|
||||
class ItemSelectionDialog;
|
||||
class MagicSelectionDialog;
|
||||
|
||||
class QuickKeysMenu : public WindowBase
|
||||
{
|
||||
public:
|
||||
QuickKeysMenu(MWBase::WindowManager& parWindowManager);
|
||||
~QuickKeysMenu();
|
||||
|
||||
|
||||
void onItemButtonClicked(MyGUI::Widget* sender);
|
||||
void onMagicButtonClicked(MyGUI::Widget* sender);
|
||||
void onUnassignButtonClicked(MyGUI::Widget* sender);
|
||||
void onCancelButtonClicked(MyGUI::Widget* sender);
|
||||
|
||||
void onAssignItem (MWWorld::Ptr item);
|
||||
void onAssignItemCancel ();
|
||||
void onAssignMagicItem (MWWorld::Ptr item);
|
||||
void onAssignMagic (const std::string& spellId);
|
||||
void onAssignMagicCancel ();
|
||||
|
||||
void activateQuickKey(int index);
|
||||
|
||||
enum QuickKeyType
|
||||
{
|
||||
Type_Item,
|
||||
Type_Magic,
|
||||
Type_MagicItem,
|
||||
Type_Unassigned
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
MyGUI::EditBox* mInstructionLabel;
|
||||
MyGUI::Button* mOkButton;
|
||||
|
||||
std::vector<MyGUI::Button*> mQuickKeyButtons;
|
||||
|
||||
QuickKeysMenuAssign* mAssignDialog;
|
||||
ItemSelectionDialog* mItemSelectionDialog;
|
||||
MagicSelectionDialog* mMagicSelectionDialog;
|
||||
|
||||
int mSelectedIndex;
|
||||
|
||||
|
||||
void onQuickKeyButtonClicked(MyGUI::Widget* sender);
|
||||
void onOkButtonClicked(MyGUI::Widget* sender);
|
||||
|
||||
void unassign(MyGUI::Widget* key, int index);
|
||||
};
|
||||
|
||||
class QuickKeysMenuAssign : public WindowModal
|
||||
{
|
||||
public:
|
||||
QuickKeysMenuAssign(MWBase::WindowManager& parWindowManager, QuickKeysMenu* parent);
|
||||
|
||||
private:
|
||||
MyGUI::TextBox* mLabel;
|
||||
MyGUI::Button* mItemButton;
|
||||
MyGUI::Button* mMagicButton;
|
||||
MyGUI::Button* mUnassignButton;
|
||||
MyGUI::Button* mCancelButton;
|
||||
|
||||
QuickKeysMenu* mParent;
|
||||
};
|
||||
|
||||
class MagicSelectionDialog : public WindowModal
|
||||
{
|
||||
public:
|
||||
MagicSelectionDialog(MWBase::WindowManager& parWindowManager, QuickKeysMenu* parent);
|
||||
|
||||
virtual void open();
|
||||
|
||||
private:
|
||||
MyGUI::Button* mCancelButton;
|
||||
MyGUI::ScrollView* mMagicList;
|
||||
|
||||
int mWidth;
|
||||
int mHeight;
|
||||
|
||||
QuickKeysMenu* mParent;
|
||||
|
||||
void onCancelButtonClicked (MyGUI::Widget* sender);
|
||||
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
|
||||
void onEnchantedItemSelected(MyGUI::Widget* _sender);
|
||||
void onSpellSelected(MyGUI::Widget* _sender);
|
||||
int estimateHeight(int numSpells) const;
|
||||
|
||||
|
||||
void addGroup(const std::string& label, const std::string& label2);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -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)
|
||||
|
@ -110,7 +113,6 @@ void RaceDialog::open()
|
|||
updateRaces();
|
||||
updateSkills();
|
||||
updateSpellPowers();
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -209,7 +211,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 +245,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 +283,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
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ namespace MWGui
|
|||
// setHair()
|
||||
|
||||
void setNextButtonShow(bool shown);
|
||||
void open();
|
||||
virtual void open();
|
||||
|
||||
// Events
|
||||
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
@ -107,7 +110,6 @@ ReviewDialog::ReviewDialog(WindowManager& parWindowManager)
|
|||
void ReviewDialog::open()
|
||||
{
|
||||
updateSkillArea();
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
void ReviewDialog::onScrollChangePosition(MyGUI::ScrollBar* scroller, size_t pos)
|
||||
|
@ -138,7 +140,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 +158,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);
|
||||
|
@ -46,7 +46,7 @@ namespace MWGui
|
|||
void configureSkills(const SkillList& major, const SkillList& minor);
|
||||
void setSkillValue(ESM::Skill::SkillEnum skillId, const MWMechanics::Stat<float>& value);
|
||||
|
||||
void open();
|
||||
virtual void open();
|
||||
|
||||
// Events
|
||||
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwsound/soundmanager.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");
|
||||
|
@ -62,7 +62,7 @@ void ScrollWindow::onCloseButtonClicked (MyGUI::Widget* _sender)
|
|||
|
||||
void ScrollWindow::onTakeButtonClicked (MyGUI::Widget* _sender)
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("Item Book Up", 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("Item Book Up", 1.0, 1.0, MWBase::SoundManager::Play_NoTrack);
|
||||
|
||||
MWWorld::ActionTake take(mScroll);
|
||||
take.execute (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -12,14 +12,12 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/inputmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwrender/renderingmanager.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
|
||||
#include "window_manager.hpp"
|
||||
#include "confirmationdialog.hpp"
|
||||
|
||||
namespace
|
||||
|
@ -83,10 +81,12 @@ namespace
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
SettingsWindow::SettingsWindow(WindowManager& parWindowManager) :
|
||||
SettingsWindow::SettingsWindow(MWBase::WindowManager& parWindowManager) :
|
||||
WindowBase("openmw_settings_window.layout", parWindowManager)
|
||||
{
|
||||
getWidget(mOkButton, "OkButton");
|
||||
getWidget(mSubtitlesButton, "SubtitlesButton");
|
||||
getWidget(mCrosshairButton, "CrosshairButton");
|
||||
getWidget(mResolutionList, "ResolutionList");
|
||||
getWidget(mMenuTransparencySlider, "MenuTransparencySlider");
|
||||
getWidget(mToolTipDelaySlider, "ToolTipDelaySlider");
|
||||
|
@ -117,7 +117,15 @@ namespace MWGui
|
|||
getWidget(mMiscShadows, "MiscShadows");
|
||||
getWidget(mShadowsDebug, "ShadowsDebug");
|
||||
getWidget(mUnderwaterButton, "UnderwaterButton");
|
||||
getWidget(mControlsBox, "ControlsBox");
|
||||
getWidget(mResetControlsButton, "ResetControlsButton");
|
||||
getWidget(mInvertYButton, "InvertYButton");
|
||||
getWidget(mUISensitivitySlider, "UISensitivitySlider");
|
||||
getWidget(mCameraSensitivitySlider, "CameraSensitivitySlider");
|
||||
|
||||
mSubtitlesButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
|
||||
mCrosshairButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
|
||||
mInvertYButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
|
||||
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onOkButtonClicked);
|
||||
mUnderwaterButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
|
||||
mShadersButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onShadersToggled);
|
||||
|
@ -156,6 +164,9 @@ namespace MWGui
|
|||
mOkButton->setCoord(mMainWidget->getWidth()-16-okSize, mOkButton->getTop(),
|
||||
okSize, mOkButton->getHeight());
|
||||
|
||||
mResetControlsButton->setSize (mResetControlsButton->getTextSize ().width + 24, mResetControlsButton->getHeight());
|
||||
mResetControlsButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onResetDefaultBindings);
|
||||
|
||||
// fill resolution list
|
||||
Ogre::RenderSystem* rs = Ogre::Root::getSingleton().getRenderSystem();
|
||||
Ogre::StringVector videoModes = rs->getConfigOptions()["Video Mode"].possibleValues;
|
||||
|
@ -185,6 +196,9 @@ namespace MWGui
|
|||
int tooltip_delay = (mToolTipDelaySlider->getScrollRange()-1) * Settings::Manager::getFloat("tooltip delay", "GUI");
|
||||
mToolTipDelaySlider->setScrollPosition(tooltip_delay);
|
||||
|
||||
mSubtitlesButton->setCaptionWithReplacing(Settings::Manager::getBool("subtitles", "GUI") ? "#{sOn}" : "#{sOff}");
|
||||
mCrosshairButton->setCaptionWithReplacing(Settings::Manager::getBool("crosshair", "HUD") ? "#{sOn}" : "#{sOff}");
|
||||
|
||||
float fovVal = (Settings::Manager::getFloat("field of view", "General")-sFovMin)/(sFovMax-sFovMin);
|
||||
mFOVSlider->setScrollPosition(fovVal * (mFOVSlider->getScrollRange()-1));
|
||||
MyGUI::TextBox* fovText;
|
||||
|
@ -221,6 +235,16 @@ namespace MWGui
|
|||
mMiscShadows->setCaptionWithReplacing(Settings::Manager::getBool("misc shadows", "Shadows") ? "#{sOn}" : "#{sOff}");
|
||||
mShadowsDebug->setCaptionWithReplacing(Settings::Manager::getBool("debug", "Shadows") ? "#{sOn}" : "#{sOff}");
|
||||
|
||||
float cameraSens = (Settings::Manager::getFloat("camera sensitivity", "Input")-0.2)/(5.0-0.2);
|
||||
mCameraSensitivitySlider->setScrollPosition (cameraSens * (mCameraSensitivitySlider->getScrollRange()-1));
|
||||
float uiSens = (Settings::Manager::getFloat("ui sensitivity", "Input")-0.2)/(5.0-0.2);
|
||||
mUISensitivitySlider->setScrollPosition (uiSens * (mUISensitivitySlider->getScrollRange()-1));
|
||||
mCameraSensitivitySlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
|
||||
mUISensitivitySlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
|
||||
|
||||
|
||||
mInvertYButton->setCaptionWithReplacing(Settings::Manager::getBool("invert y axis", "Input") ? "#{sOn}" : "#{sOff}");
|
||||
|
||||
std::string shaders;
|
||||
if (!Settings::Manager::getBool("shaders", "Objects"))
|
||||
shaders = "off";
|
||||
|
@ -264,6 +288,7 @@ namespace MWGui
|
|||
dialog->eventOkClicked.clear();
|
||||
dialog->eventOkClicked += MyGUI::newDelegate(this, &SettingsWindow::onResolutionAccept);
|
||||
dialog->eventCancelClicked.clear();
|
||||
dialog->eventCancelClicked += MyGUI::newDelegate(this, &SettingsWindow::onResolutionCancel);
|
||||
}
|
||||
|
||||
void SettingsWindow::onResolutionAccept()
|
||||
|
@ -383,6 +408,12 @@ namespace MWGui
|
|||
Settings::Manager::setBool("misc shadows", "Shadows", newState);
|
||||
else if (_sender == mShadowsDebug)
|
||||
Settings::Manager::setBool("debug", "Shadows", newState);
|
||||
else if (_sender == mInvertYButton)
|
||||
Settings::Manager::setBool("invert y axis", "Input", newState);
|
||||
else if (_sender == mCrosshairButton)
|
||||
Settings::Manager::setBool("crosshair", "HUD", newState);
|
||||
else if (_sender == mSubtitlesButton)
|
||||
Settings::Manager::setBool("subtitles", "GUI", newState);
|
||||
|
||||
apply();
|
||||
}
|
||||
|
@ -500,6 +531,10 @@ namespace MWGui
|
|||
Settings::Manager::setFloat("footsteps volume", "Sound", val);
|
||||
else if (scroller == mMusicVolumeSlider)
|
||||
Settings::Manager::setFloat("music volume", "Sound", val);
|
||||
else if (scroller == mUISensitivitySlider)
|
||||
Settings::Manager::setFloat("ui sensitivity", "Input", (1-val) * 0.2 + val * 5.f);
|
||||
else if (scroller == mCameraSensitivitySlider)
|
||||
Settings::Manager::setFloat("camera sensitivity", "Input", (1-val) * 0.2 + val * 5.f);
|
||||
|
||||
apply();
|
||||
}
|
||||
|
@ -512,4 +547,78 @@ namespace MWGui
|
|||
MWBase::Environment::get().getWindowManager()->processChangedSettings(changed);
|
||||
MWBase::Environment::get().getInputManager()->processChangedSettings(changed);
|
||||
}
|
||||
|
||||
void SettingsWindow::updateControlsBox()
|
||||
{
|
||||
while (mControlsBox->getChildCount())
|
||||
MyGUI::Gui::getInstance().destroyWidget(mControlsBox->getChildAt(0));
|
||||
|
||||
std::vector<int> actions = MWBase::Environment::get().getInputManager()->getActionSorting ();
|
||||
|
||||
const int h = 18;
|
||||
const int w = mControlsBox->getWidth() - 28;
|
||||
int curH = 0;
|
||||
for (std::vector<int>::const_iterator it = actions.begin(); it != actions.end(); ++it)
|
||||
{
|
||||
std::string desc = MWBase::Environment::get().getInputManager()->getActionDescription (*it);
|
||||
if (desc == "")
|
||||
continue;
|
||||
|
||||
std::string binding = MWBase::Environment::get().getInputManager()->getActionBindingName (*it);
|
||||
|
||||
MyGUI::TextBox* leftText = mControlsBox->createWidget<MyGUI::TextBox>("SandText", MyGUI::IntCoord(0,curH,w,h), MyGUI::Align::Default);
|
||||
leftText->setCaptionWithReplacing(desc);
|
||||
|
||||
MyGUI::Button* rightText = mControlsBox->createWidget<MyGUI::Button>("SandTextButton", MyGUI::IntCoord(0,curH,w,h), MyGUI::Align::Default);
|
||||
rightText->setCaptionWithReplacing(binding);
|
||||
rightText->setTextAlign (MyGUI::Align::Right);
|
||||
rightText->setUserData(*it); // save the action id for callbacks
|
||||
rightText->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onRebindAction);
|
||||
rightText->eventMouseWheel += MyGUI::newDelegate(this, &SettingsWindow::onInputTabMouseWheel);
|
||||
curH += h;
|
||||
}
|
||||
|
||||
mControlsBox->setCanvasSize (mControlsBox->getWidth(), std::max(curH, mControlsBox->getHeight()));
|
||||
}
|
||||
|
||||
void SettingsWindow::onRebindAction(MyGUI::Widget* _sender)
|
||||
{
|
||||
int actionId = *_sender->getUserData<int>();
|
||||
|
||||
static_cast<MyGUI::Button*>(_sender)->setCaptionWithReplacing("#{sNone}");
|
||||
|
||||
MWBase::Environment::get().getWindowManager ()->messageBox ("#{sControlsMenu3}", std::vector<std::string>());
|
||||
MWBase::Environment::get().getWindowManager ()->disallowMouse();
|
||||
|
||||
MWBase::Environment::get().getInputManager ()->enableDetectingBindingMode (actionId);
|
||||
|
||||
}
|
||||
|
||||
void SettingsWindow::onInputTabMouseWheel(MyGUI::Widget* _sender, int _rel)
|
||||
{
|
||||
if (mControlsBox->getViewOffset().top + _rel*0.3 > 0)
|
||||
mControlsBox->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||
else
|
||||
mControlsBox->setViewOffset(MyGUI::IntPoint(0, mControlsBox->getViewOffset().top + _rel*0.3));
|
||||
}
|
||||
|
||||
void SettingsWindow::onResetDefaultBindings(MyGUI::Widget* _sender)
|
||||
{
|
||||
ConfirmationDialog* dialog = mWindowManager.getConfirmationDialog();
|
||||
dialog->open("#{sNotifyMessage66}");
|
||||
dialog->eventOkClicked.clear();
|
||||
dialog->eventOkClicked += MyGUI::newDelegate(this, &SettingsWindow::onResetDefaultBindingsAccept);
|
||||
dialog->eventCancelClicked.clear();
|
||||
}
|
||||
|
||||
void SettingsWindow::onResetDefaultBindingsAccept()
|
||||
{
|
||||
MWBase::Environment::get().getInputManager ()->resetToDefaultBindings ();
|
||||
updateControlsBox ();
|
||||
}
|
||||
|
||||
void SettingsWindow::open()
|
||||
{
|
||||
updateControlsBox ();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,11 @@ namespace MWGui
|
|||
class SettingsWindow : public WindowBase
|
||||
{
|
||||
public:
|
||||
SettingsWindow(WindowManager& parWindowManager);
|
||||
SettingsWindow(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
virtual void open();
|
||||
|
||||
void updateControlsBox();
|
||||
|
||||
private:
|
||||
static int const sFovMin = 30;
|
||||
|
@ -26,6 +30,8 @@ namespace MWGui
|
|||
|
||||
MyGUI::ScrollBar* mMenuTransparencySlider;
|
||||
MyGUI::ScrollBar* mToolTipDelaySlider;
|
||||
MyGUI::Button* mSubtitlesButton;
|
||||
MyGUI::Button* mCrosshairButton;
|
||||
|
||||
// graphics
|
||||
MyGUI::ListBox* mResolutionList;
|
||||
|
@ -60,6 +66,13 @@ namespace MWGui
|
|||
MyGUI::ScrollBar* mFootstepsVolumeSlider;
|
||||
MyGUI::ScrollBar* mMusicVolumeSlider;
|
||||
|
||||
// controls
|
||||
MyGUI::ScrollView* mControlsBox;
|
||||
MyGUI::Button* mResetControlsButton;
|
||||
MyGUI::Button* mInvertYButton;
|
||||
MyGUI::ScrollBar* mUISensitivitySlider;
|
||||
MyGUI::ScrollBar* mCameraSensitivitySlider;
|
||||
|
||||
void onOkButtonClicked(MyGUI::Widget* _sender);
|
||||
void onFpsToggled(MyGUI::Widget* _sender);
|
||||
void onTextureFilteringToggled(MyGUI::Widget* _sender);
|
||||
|
@ -72,9 +85,13 @@ namespace MWGui
|
|||
void onShadersToggled(MyGUI::Widget* _sender);
|
||||
void onShadowTextureSize(MyGUI::Widget* _sender);
|
||||
|
||||
void onRebindAction(MyGUI::Widget* _sender);
|
||||
void onInputTabMouseWheel(MyGUI::Widget* _sender, int _rel);
|
||||
void onResetDefaultBindings(MyGUI::Widget* _sender);
|
||||
void onResetDefaultBindingsAccept ();
|
||||
|
||||
void apply();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -8,17 +8,17 @@
|
|||
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
#include "../mwworld/actionequip.hpp"
|
||||
|
||||
#include "../mwmechanics/spells.hpp"
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/spellsuccess.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
#include "window_manager.hpp"
|
||||
#include "inventorywindow.hpp"
|
||||
#include "confirmationdialog.hpp"
|
||||
|
||||
|
@ -43,7 +43,7 @@ namespace
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
SpellWindow::SpellWindow(WindowManager& parWindowManager)
|
||||
SpellWindow::SpellWindow(MWBase::WindowManager& parWindowManager)
|
||||
: WindowPinnableBase("openmw_spell_window.layout", parWindowManager)
|
||||
, mHeight(0)
|
||||
, mWidth(0)
|
||||
|
@ -351,34 +351,10 @@ namespace MWGui
|
|||
if (_sender->getUserString("Equipped") == "false"
|
||||
&& !MWWorld::Class::get(item).getEquipmentSlots(item).first.empty())
|
||||
{
|
||||
// sound
|
||||
MWBase::Environment::get().getSoundManager()->playSound(MWWorld::Class::get(item).getUpSoundId(item), 1.0, 1.0);
|
||||
|
||||
// Note: can't use Class::use here because enchanted scrolls for example would then open the scroll window instead of equipping
|
||||
|
||||
/// \todo the following code is pretty much copy&paste from ActionEquip, put it in a function?
|
||||
// slots that this item can be equipped in
|
||||
std::pair<std::vector<int>, bool> slots = MWWorld::Class::get(item).getEquipmentSlots(item);
|
||||
|
||||
// equip the item in the first free slot
|
||||
for (std::vector<int>::const_iterator slot=slots.first.begin();
|
||||
slot!=slots.first.end(); ++slot)
|
||||
{
|
||||
// if all slots are occupied, replace the last slot
|
||||
if (slot == --slots.first.end())
|
||||
{
|
||||
store.equip(*slot, it);
|
||||
break;
|
||||
}
|
||||
|
||||
if (store.getSlot(*slot) == store.end())
|
||||
{
|
||||
// slot is not occupied
|
||||
store.equip(*slot, it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/// \todo scripts?
|
||||
MWWorld::ActionEquip action(item);
|
||||
action.execute (MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ());
|
||||
|
||||
// since we changed equipping status, update the inventory window
|
||||
mWindowManager.getInventoryWindow()->drawItems();
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace MWGui
|
|||
class SpellWindow : public WindowPinnableBase
|
||||
{
|
||||
public:
|
||||
SpellWindow(WindowManager& parWindowManager);
|
||||
SpellWindow(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
void updateSpells();
|
||||
|
||||
|
|
|
@ -8,20 +8,21 @@
|
|||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
|
||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
|
||||
#include "window_manager.hpp"
|
||||
#include "tooltips.hpp"
|
||||
|
||||
|
||||
using namespace MWGui;
|
||||
const int StatsWindow::sLineHeight = 18;
|
||||
|
||||
StatsWindow::StatsWindow (WindowManager& parWindowManager)
|
||||
StatsWindow::StatsWindow (MWBase::WindowManager& parWindowManager)
|
||||
: WindowPinnableBase("openmw_stats_window.layout", parWindowManager)
|
||||
, mSkillAreaWidget(NULL)
|
||||
, mSkillClientWidget(NULL)
|
||||
|
@ -56,7 +57,7 @@ StatsWindow::StatsWindow (WindowManager& parWindowManager)
|
|||
{ 0, 0 }
|
||||
};
|
||||
|
||||
const ESMS::ESMStore &store = mWindowManager.getStore();
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
for (int i=0; names[i][0]; ++i)
|
||||
{
|
||||
setText (names[i][0], store.gameSettings.find (names[i][1])->str);
|
||||
|
@ -382,12 +383,12 @@ void StatsWindow::addSkills(const SkillList &skills, const std::string &titleId,
|
|||
float modified = stat.getModified();
|
||||
int progressPercent = (modified - float(static_cast<int>(modified))) * 100;
|
||||
|
||||
const ESM::Skill* skill = mWindowManager.getStore().skills.search(skillId);
|
||||
const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().skills.search(skillId);
|
||||
assert(skill);
|
||||
|
||||
std::string icon = "icons\\k\\" + ESM::Skill::sIconNames[skillId];
|
||||
|
||||
const ESM::Attribute* attr = mWindowManager.getStore().attributes.search(skill->data.attribute);
|
||||
const ESM::Attribute* attr = MWBase::Environment::get().getWorld()->getStore().attributes.search(skill->data.attribute);
|
||||
assert(attr);
|
||||
|
||||
std::string state = "normal";
|
||||
|
@ -442,7 +443,7 @@ void StatsWindow::updateSkillArea()
|
|||
if (!mMiscSkills.empty())
|
||||
addSkills(mMiscSkills, "sSkillClassMisc", "Misc Skills", coord1, coord2);
|
||||
|
||||
const ESMS::ESMStore &store = mWindowManager.getStore();
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
// race tooltip
|
||||
const ESM::Race* playerRace = store.races.find (MWBase::Environment::get().getWorld()->getPlayer().getRace());
|
||||
|
@ -484,8 +485,8 @@ void StatsWindow::updateSkillArea()
|
|||
text += std::string("\n\n#DDC79E#{sNextRank} ") + faction->ranks[it->second+1];
|
||||
|
||||
ESM::RankData rankData = faction->data.rankData[it->second+1];
|
||||
const ESM::Attribute* attr1 = mWindowManager.getStore().attributes.search(faction->data.attribute1);
|
||||
const ESM::Attribute* attr2 = mWindowManager.getStore().attributes.search(faction->data.attribute2);
|
||||
const ESM::Attribute* attr1 = MWBase::Environment::get().getWorld()->getStore().attributes.search(faction->data.attribute1);
|
||||
const ESM::Attribute* attr2 = MWBase::Environment::get().getWorld()->getStore().attributes.search(faction->data.attribute2);
|
||||
assert(attr1 && attr2);
|
||||
|
||||
text += "\n#BF9959#{" + attr1->name + "}: " + boost::lexical_cast<std::string>(rankData.attribute1)
|
||||
|
@ -495,7 +496,7 @@ void StatsWindow::updateSkillArea()
|
|||
text += "\n#BF9959";
|
||||
for (int i=0; i<6; ++i)
|
||||
{
|
||||
const ESM::Skill* skill = mWindowManager.getStore().skills.search(faction->data.skillID[i]);
|
||||
const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().skills.search(faction->data.skillID[i]);
|
||||
assert(skill);
|
||||
text += "#{"+ESM::Skill::sSkillNameIds[faction->data.skillID[i]]+"}";
|
||||
if (i<5)
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace MWGui
|
|||
|
||||
typedef std::vector<int> SkillList;
|
||||
|
||||
StatsWindow(WindowManager& parWindowManager);
|
||||
StatsWindow(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
/// automatically updates all the data in the stats window, but only if it has changed.
|
||||
void onFrame();
|
||||
|
@ -82,4 +82,3 @@ namespace MWGui
|
|||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#include "text_input.hpp"
|
||||
#include "window_manager.hpp"
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
using namespace MWGui;
|
||||
|
||||
TextInputDialog::TextInputDialog(WindowManager& parWindowManager)
|
||||
TextInputDialog::TextInputDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_text_input.layout", parWindowManager)
|
||||
{
|
||||
// Centre dialog
|
||||
|
@ -44,7 +45,6 @@ void TextInputDialog::open()
|
|||
{
|
||||
// Make sure the edit box has focus
|
||||
MyGUI::InputManager::getInstance().setKeyFocusWidget(mTextEdit);
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
// widget controls
|
||||
|
|
|
@ -18,14 +18,14 @@ 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); }
|
||||
|
||||
void setNextButtonShow(bool shown);
|
||||
void setTextLabel(const std::string &label);
|
||||
void open();
|
||||
virtual void open();
|
||||
|
||||
protected:
|
||||
void onOkClicked(MyGUI::Widget* _sender);
|
||||
|
|
|
@ -8,16 +8,17 @@
|
|||
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
|
||||
#include "window_manager.hpp"
|
||||
#include "map_window.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)
|
||||
|
@ -150,7 +151,19 @@ void ToolTips::onFrame(float frameDuration)
|
|||
{
|
||||
return;
|
||||
}
|
||||
else if (type == "ItemPtr")
|
||||
|
||||
// special handling for markers on the local map: the tooltip should only be visible
|
||||
// if the marker is not hidden due to the fog of war.
|
||||
if (focus->getUserString ("IsMarker") == "true")
|
||||
{
|
||||
LocalMapBase::MarkerPosition pos = *focus->getUserData<LocalMapBase::MarkerPosition>();
|
||||
|
||||
if (!MWBase::Environment::get().getWorld ()->isPositionExplored (pos.nX, pos.nY, pos.cellX, pos.cellY, pos.interior))
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (type == "ItemPtr")
|
||||
{
|
||||
mFocusObject = *focus->getUserData<MWWorld::Ptr>();
|
||||
tooltipSize = getToolTipViaPtr(false);
|
||||
|
@ -199,7 +212,8 @@ void ToolTips::onFrame(float frameDuration)
|
|||
it != userStrings.end(); ++it)
|
||||
{
|
||||
if (it->first == "ToolTipType"
|
||||
|| it->first == "ToolTipLayout")
|
||||
|| it->first == "ToolTipLayout"
|
||||
|| it->first == "IsMarker")
|
||||
continue;
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -4,17 +4,17 @@
|
|||
|
||||
#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 "../mwsound/soundmanager.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)
|
||||
|
@ -291,14 +291,14 @@ namespace MWGui
|
|||
if (mPtr.getTypeName() == typeid(ESM::NPC).name())
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::NPC>* ref = mPtr.get<ESM::NPC>();
|
||||
if (ref->base->hasAI)
|
||||
services = ref->base->AI.services;
|
||||
if (ref->base->mHasAI)
|
||||
services = ref->base->mAiData.mServices;
|
||||
}
|
||||
else if (mPtr.getTypeName() == typeid(ESM::Creature).name())
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Creature>* ref = mPtr.get<ESM::Creature>();
|
||||
if (ref->base->hasAI)
|
||||
services = ref->base->AI.services;
|
||||
if (ref->base->mHasAI)
|
||||
services = ref->base->mAiData.mServices;
|
||||
}
|
||||
|
||||
/// \todo what about potions, there doesn't seem to be a flag for them??
|
||||
|
|
|
@ -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,27 +1,26 @@
|
|||
#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)
|
||||
{
|
||||
}
|
||||
|
||||
void WindowBase::open()
|
||||
{
|
||||
}
|
||||
|
||||
void WindowBase::setVisible(bool visible)
|
||||
{
|
||||
bool wasVisible = mMainWidget->getVisible();
|
||||
mMainWidget->setVisible(visible);
|
||||
|
||||
if (!wasVisible && visible)
|
||||
if (visible)
|
||||
open();
|
||||
else if (wasVisible && !visible)
|
||||
close();
|
||||
}
|
||||
|
||||
void WindowBase::center()
|
||||
|
@ -39,3 +38,18 @@ void WindowBase::center()
|
|||
coord.top = (gameWindowSize.height - coord.height)/2;
|
||||
mMainWidget->setCoord(coord);
|
||||
}
|
||||
|
||||
WindowModal::WindowModal(const std::string& parLayout, MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase(parLayout, parWindowManager)
|
||||
{
|
||||
}
|
||||
|
||||
void WindowModal::open()
|
||||
{
|
||||
MyGUI::InputManager::getInstance ().addWidgetModal (mMainWidget);
|
||||
}
|
||||
|
||||
void WindowModal::close()
|
||||
{
|
||||
MyGUI::InputManager::getInstance ().removeWidgetModal (mMainWidget);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
|
||||
#include <openengine/gui/layout.hpp>
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
class WindowManager;
|
||||
}
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class WindowManager;
|
||||
|
@ -10,13 +15,14 @@ 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;
|
||||
|
||||
virtual void open();
|
||||
virtual void setVisible(bool visible); // calls open() if visible is true and was false before
|
||||
virtual void open() {}
|
||||
virtual void close () {}
|
||||
virtual void setVisible(bool visible);
|
||||
void center();
|
||||
|
||||
/** Event : Dialog finished, OK button clicked.\n
|
||||
|
@ -25,9 +31,21 @@ namespace MWGui
|
|||
EventHandle_WindowBase eventDone;
|
||||
|
||||
protected:
|
||||
WindowManager& mWindowManager;
|
||||
/// \todo remove
|
||||
MWBase::WindowManager& mWindowManager;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* "Modal" windows cause the rest of the interface to be unaccessible while they are visible
|
||||
*/
|
||||
class WindowModal : public WindowBase
|
||||
{
|
||||
public:
|
||||
WindowModal(const std::string& parLayout, MWBase::WindowManager& parWindowManager);
|
||||
virtual void open();
|
||||
virtual void close();
|
||||
};
|
||||
}
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue