mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 10:23:52 +00:00
Merge branch 'next' of https://github.com/zinnschlag/openmw into tooltips
Conflicts: apps/openmw/engine.cpp apps/openmw/mwclass/apparatus.cpp apps/openmw/mwclass/book.cpp apps/openmw/mwclass/container.cpp apps/openmw/mwclass/ingredient.cpp apps/openmw/mwclass/misc.cpp apps/openmw/mwclass/npc.cpp apps/openmw/mwclass/potion.cpp apps/openmw/mwclass/repair.cpp apps/openmw/mwgui/window_manager.cpp
This commit is contained in:
commit
1b5bfc52a1
126 changed files with 1404 additions and 1356 deletions
|
@ -359,12 +359,17 @@ if(DPKG_PROGRAM)
|
||||||
endif(DPKG_PROGRAM)
|
endif(DPKG_PROGRAM)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
FILE(GLOB files "${OpenMW_BINARY_DIR}/Release/*.*")
|
FILE(GLOB dll_files "${OpenMW_BINARY_DIR}/Release/*.dll")
|
||||||
INSTALL(FILES ${files} DESTINATION ".")
|
INSTALL(FILES ${dll_files} DESTINATION ".")
|
||||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "." RENAME "openmw.cfg")
|
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "." RENAME "openmw.cfg")
|
||||||
INSTALL(FILES
|
INSTALL(FILES
|
||||||
|
"${OpenMW_BINARY_DIR}/plugins.cfg"
|
||||||
"${OpenMW_SOURCE_DIR}/readme.txt"
|
"${OpenMW_SOURCE_DIR}/readme.txt"
|
||||||
|
"${OpenMW_BINARY_DIR}/launcher.qss"
|
||||||
"${OpenMW_BINARY_DIR}/settings-default.cfg"
|
"${OpenMW_BINARY_DIR}/settings-default.cfg"
|
||||||
|
"${OpenMW_BINARY_DIR}/transparency-overrides.cfg"
|
||||||
|
"${OpenMW_BINARY_DIR}/Release/omwlauncher.exe"
|
||||||
|
"${OpenMW_BINARY_DIR}/Release/openmw.exe"
|
||||||
DESTINATION ".")
|
DESTINATION ".")
|
||||||
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION ".")
|
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION ".")
|
||||||
|
|
||||||
|
@ -390,7 +395,7 @@ if(WIN32)
|
||||||
SET(CPACK_NSIS_INSTALLED_ICON_NAME "omwlauncher.exe")
|
SET(CPACK_NSIS_INSTALLED_ICON_NAME "omwlauncher.exe")
|
||||||
SET(CPACK_NSIS_MUI_ICON "${OpenMW_SOURCE_DIR}/apps/launcher/resources/images/openmw.ico")
|
SET(CPACK_NSIS_MUI_ICON "${OpenMW_SOURCE_DIR}/apps/launcher/resources/images/openmw.ico")
|
||||||
SET(CPACK_NSIS_MUI_UNIICON "${OpenMW_SOURCE_DIR}/apps/launcher/resources/images/openmw.ico")
|
SET(CPACK_NSIS_MUI_UNIICON "${OpenMW_SOURCE_DIR}/apps/launcher/resources/images/openmw.ico")
|
||||||
# SET(CPACK_PACKAGE_ICON "${OpenMW_SOURCE_DIR}\\\\files\\\\openmw.bmp")
|
SET(CPACK_PACKAGE_ICON "${OpenMW_SOURCE_DIR}\\\\files\\\\openmw.bmp")
|
||||||
|
|
||||||
SET(VCREDIST32 "${OpenMW_BINARY_DIR}/vcredist_x86.exe")
|
SET(VCREDIST32 "${OpenMW_BINARY_DIR}/vcredist_x86.exe")
|
||||||
if(EXISTS ${VCREDIST32})
|
if(EXISTS ${VCREDIST32})
|
||||||
|
|
|
@ -44,7 +44,7 @@ add_openmw_dir (mwsound
|
||||||
)
|
)
|
||||||
|
|
||||||
add_openmw_dir (mwworld
|
add_openmw_dir (mwworld
|
||||||
refdata world physicssystem scene environment globals class action nullaction actionteleport
|
refdata world physicssystem scene globals class action nullaction actionteleport
|
||||||
containerstore actiontalk actiontake manualref player cellfunctors
|
containerstore actiontalk actiontake manualref player cellfunctors
|
||||||
cells localscripts customdata weather inventorystore ptr
|
cells localscripts customdata weather inventorystore ptr
|
||||||
)
|
)
|
||||||
|
@ -58,6 +58,10 @@ add_openmw_dir (mwmechanics
|
||||||
mechanicsmanager stat creaturestats magiceffects movement actors drawstate spells
|
mechanicsmanager stat creaturestats magiceffects movement actors drawstate spells
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_openmw_dir (mwbase
|
||||||
|
environment
|
||||||
|
)
|
||||||
|
|
||||||
# Main executable
|
# Main executable
|
||||||
IF(OGRE_STATIC)
|
IF(OGRE_STATIC)
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
|
|
|
@ -50,10 +50,12 @@
|
||||||
|
|
||||||
#include "mwmechanics/mechanicsmanager.hpp"
|
#include "mwmechanics/mechanicsmanager.hpp"
|
||||||
|
|
||||||
|
#include "mwbase/environment.hpp"
|
||||||
|
|
||||||
|
|
||||||
void OMW::Engine::executeLocalScripts()
|
void OMW::Engine::executeLocalScripts()
|
||||||
{
|
{
|
||||||
MWWorld::LocalScripts& localScripts = mEnvironment.mWorld->getLocalScripts();
|
MWWorld::LocalScripts& localScripts = MWBase::Environment::get().getWorld()->getLocalScripts();
|
||||||
|
|
||||||
localScripts.startIteration();
|
localScripts.startIteration();
|
||||||
|
|
||||||
|
@ -61,11 +63,11 @@ void OMW::Engine::executeLocalScripts()
|
||||||
{
|
{
|
||||||
std::pair<std::string, MWWorld::Ptr> script = localScripts.getNext();
|
std::pair<std::string, MWWorld::Ptr> script = localScripts.getNext();
|
||||||
|
|
||||||
MWScript::InterpreterContext interpreterContext (mEnvironment,
|
MWScript::InterpreterContext interpreterContext (
|
||||||
&script.second.getRefData().getLocals(), script.second);
|
&script.second.getRefData().getLocals(), script.second);
|
||||||
mEnvironment.mScriptManager->run (script.first, interpreterContext);
|
MWBase::Environment::get().getScriptManager()->run (script.first, interpreterContext);
|
||||||
|
|
||||||
if (mEnvironment.mWorld->hasCellChanged())
|
if (MWBase::Environment::get().getWorld()->hasCellChanged())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,19 +85,19 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mEnvironment.mFrameDuration = evt.timeSinceLastFrame;
|
mEnvironment.setFrameDuration (evt.timeSinceLastFrame);
|
||||||
|
|
||||||
// update input
|
// update input
|
||||||
mEnvironment.mInputManager->update();
|
MWBase::Environment::get().getInputManager()->update();
|
||||||
|
|
||||||
// sound
|
// sound
|
||||||
if (mUseSound)
|
if (mUseSound)
|
||||||
mEnvironment.mSoundManager->update (evt.timeSinceLastFrame);
|
MWBase::Environment::get().getSoundManager()->update (evt.timeSinceLastFrame);
|
||||||
|
|
||||||
// global scripts
|
// global scripts
|
||||||
mEnvironment.mGlobalScripts->run (mEnvironment);
|
MWBase::Environment::get().getScriptManager()->getGlobalScripts().run();
|
||||||
|
|
||||||
bool changed = mEnvironment.mWorld->hasCellChanged();
|
bool changed = MWBase::Environment::get().getWorld()->hasCellChanged();
|
||||||
|
|
||||||
// local scripts
|
// local scripts
|
||||||
executeLocalScripts(); // This does not handle the case where a global script causes a cell
|
executeLocalScripts(); // This does not handle the case where a global script causes a cell
|
||||||
|
@ -103,32 +105,32 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
|
||||||
// frame.
|
// frame.
|
||||||
|
|
||||||
// passing of time
|
// passing of time
|
||||||
if (mEnvironment.mWindowManager->getMode()==MWGui::GM_Game)
|
if (MWBase::Environment::get().getWindowManager()->getMode()==MWGui::GM_Game)
|
||||||
mEnvironment.mWorld->advanceTime (
|
MWBase::Environment::get().getWorld()->advanceTime (
|
||||||
mEnvironment.mFrameDuration*mEnvironment.mWorld->getTimeScaleFactor()/3600);
|
mEnvironment.getFrameDuration()*MWBase::Environment::get().getWorld()->getTimeScaleFactor()/3600);
|
||||||
|
|
||||||
|
|
||||||
if (changed) // keep change flag for another frame, if cell changed happend in local script
|
if (changed) // keep change flag for another frame, if cell changed happend in local script
|
||||||
mEnvironment.mWorld->markCellAsUnchanged();
|
MWBase::Environment::get().getWorld()->markCellAsUnchanged();
|
||||||
|
|
||||||
// update actors
|
// update actors
|
||||||
std::vector<std::pair<std::string, Ogre::Vector3> > movement;
|
std::vector<std::pair<std::string, Ogre::Vector3> > movement;
|
||||||
mEnvironment.mMechanicsManager->update (movement, mEnvironment.mFrameDuration,
|
MWBase::Environment::get().getMechanicsManager()->update (movement, mEnvironment.getFrameDuration(),
|
||||||
mEnvironment.mWindowManager->getMode()!=MWGui::GM_Game);
|
MWBase::Environment::get().getWindowManager()->getMode()!=MWGui::GM_Game);
|
||||||
|
|
||||||
if (mEnvironment.mWindowManager->getMode()==MWGui::GM_Game)
|
if (MWBase::Environment::get().getWindowManager()->getMode()==MWGui::GM_Game)
|
||||||
mEnvironment.mWorld->doPhysics (movement, mEnvironment.mFrameDuration);
|
MWBase::Environment::get().getWorld()->doPhysics (movement, mEnvironment.getFrameDuration());
|
||||||
|
|
||||||
// update world
|
// update world
|
||||||
mEnvironment.mWorld->update (evt.timeSinceLastFrame);
|
MWBase::Environment::get().getWorld()->update (evt.timeSinceLastFrame);
|
||||||
|
|
||||||
// update GUI
|
// update GUI
|
||||||
Ogre::RenderWindow* window = mOgre->getWindow();
|
Ogre::RenderWindow* window = mOgre->getWindow();
|
||||||
mEnvironment.mWindowManager->wmUpdateFps(window->getLastFPS(),
|
MWBase::Environment::get().getWindowManager()->wmUpdateFps(window->getLastFPS(),
|
||||||
window->getTriangleCount(),
|
window->getTriangleCount(),
|
||||||
window->getBatchCount());
|
window->getBatchCount());
|
||||||
|
|
||||||
mEnvironment.mWindowManager->onFrame(mEnvironment.mFrameDuration);
|
MWBase::Environment::get().getWindowManager()->onFrame(evt.timeSinceLastFrame);
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
{
|
{
|
||||||
|
@ -157,13 +159,13 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
|
||||||
|
|
||||||
OMW::Engine::~Engine()
|
OMW::Engine::~Engine()
|
||||||
{
|
{
|
||||||
delete mEnvironment.mWorld;
|
delete MWBase::Environment::get().getInputManager();
|
||||||
delete mEnvironment.mSoundManager;
|
delete MWBase::Environment::get().getSoundManager();
|
||||||
delete mEnvironment.mGlobalScripts;
|
delete MWBase::Environment::get().getMechanicsManager();
|
||||||
delete mEnvironment.mMechanicsManager;
|
delete MWBase::Environment::get().getDialogueManager();
|
||||||
delete mEnvironment.mDialogueManager;
|
delete MWBase::Environment::get().getJournal();
|
||||||
delete mEnvironment.mJournal;
|
delete MWBase::Environment::get().getScriptManager();
|
||||||
delete mEnvironment.mScriptManager;
|
delete MWBase::Environment::get().getWorld();
|
||||||
delete mScriptContext;
|
delete mScriptContext;
|
||||||
delete mOgre;
|
delete mOgre;
|
||||||
}
|
}
|
||||||
|
@ -262,7 +264,6 @@ void OMW::Engine::setNewGame(bool newGame)
|
||||||
void OMW::Engine::go()
|
void OMW::Engine::go()
|
||||||
{
|
{
|
||||||
mFocusTDiff = 0;
|
mFocusTDiff = 0;
|
||||||
assert (!mEnvironment.mWorld);
|
|
||||||
assert (!mCellName.empty());
|
assert (!mCellName.empty());
|
||||||
assert (!mMaster.empty());
|
assert (!mMaster.empty());
|
||||||
assert (!mOgre);
|
assert (!mOgre);
|
||||||
|
@ -331,69 +332,66 @@ void OMW::Engine::go()
|
||||||
MWGui::CursorReplace replacer;
|
MWGui::CursorReplace replacer;
|
||||||
|
|
||||||
// Create the world
|
// Create the world
|
||||||
mEnvironment.mWorld = new MWWorld::World (*mOgre, mFileCollections, mMaster,
|
mEnvironment.setWorld (new MWWorld::World (*mOgre, mFileCollections, mMaster,
|
||||||
mResDir, mNewGame, mEnvironment, mEncoding, mFallbackMap);
|
mResDir, mNewGame, mEncoding, mFallbackMap));
|
||||||
|
|
||||||
// Create window manager - this manages all the MW-specific GUI windows
|
// Create window manager - this manages all the MW-specific GUI windows
|
||||||
MWScript::registerExtensions (mExtensions);
|
MWScript::registerExtensions (mExtensions);
|
||||||
|
|
||||||
mEnvironment.mWindowManager = new MWGui::WindowManager(mEnvironment,
|
mEnvironment.setWindowManager (new MWGui::WindowManager(
|
||||||
mExtensions, mFpsLevel, mNewGame, mOgre, mCfgMgr.getLogPath().string() + std::string("/"));
|
mExtensions, mFpsLevel, mNewGame, mOgre, mCfgMgr.getLogPath().string() + std::string("/")));
|
||||||
|
|
||||||
// Create sound system
|
// Create sound system
|
||||||
mEnvironment.mSoundManager = new MWSound::SoundManager(mUseSound, mEnvironment);
|
mEnvironment.setSoundManager (new MWSound::SoundManager(mUseSound));
|
||||||
|
|
||||||
// Create script system
|
// Create script system
|
||||||
mScriptContext = new MWScript::CompilerContext (MWScript::CompilerContext::Type_Full,
|
mScriptContext = new MWScript::CompilerContext (MWScript::CompilerContext::Type_Full);
|
||||||
mEnvironment);
|
|
||||||
mScriptContext->setExtensions (&mExtensions);
|
mScriptContext->setExtensions (&mExtensions);
|
||||||
|
|
||||||
mEnvironment.mScriptManager = new MWScript::ScriptManager (mEnvironment.mWorld->getStore(),
|
mEnvironment.setScriptManager (new MWScript::ScriptManager (MWBase::Environment::get().getWorld()->getStore(),
|
||||||
mVerboseScripts, *mScriptContext);
|
mVerboseScripts, *mScriptContext));
|
||||||
|
|
||||||
mEnvironment.mGlobalScripts = new MWScript::GlobalScripts (mEnvironment.mWorld->getStore(),
|
|
||||||
*mEnvironment.mScriptManager);
|
|
||||||
|
|
||||||
// Create game mechanics system
|
// Create game mechanics system
|
||||||
mEnvironment.mMechanicsManager = new MWMechanics::MechanicsManager (mEnvironment);
|
mEnvironment.setMechanicsManager (new MWMechanics::MechanicsManager);
|
||||||
|
|
||||||
// Create dialog system
|
// Create dialog system
|
||||||
mEnvironment.mJournal = new MWDialogue::Journal (mEnvironment);
|
mEnvironment.setJournal (new MWDialogue::Journal);
|
||||||
mEnvironment.mDialogueManager = new MWDialogue::DialogueManager (mEnvironment,mExtensions);
|
mEnvironment.setDialogueManager (new MWDialogue::DialogueManager (mExtensions));
|
||||||
|
|
||||||
// load cell
|
// load cell
|
||||||
ESM::Position pos;
|
ESM::Position pos;
|
||||||
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
||||||
pos.pos[2] = 0;
|
pos.pos[2] = 0;
|
||||||
|
|
||||||
if (const ESM::Cell *exterior = mEnvironment.mWorld->getExterior (mCellName))
|
if (const ESM::Cell *exterior = MWBase::Environment::get().getWorld()->getExterior (mCellName))
|
||||||
{
|
{
|
||||||
mEnvironment.mWorld->indexToPosition (exterior->data.gridX, exterior->data.gridY,
|
MWBase::Environment::get().getWorld()->indexToPosition (exterior->data.gridX, exterior->data.gridY,
|
||||||
pos.pos[0], pos.pos[1], true);
|
pos.pos[0], pos.pos[1], true);
|
||||||
mEnvironment.mWorld->changeToExteriorCell (pos);
|
MWBase::Environment::get().getWorld()->changeToExteriorCell (pos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pos.pos[0] = pos.pos[1] = 0;
|
pos.pos[0] = pos.pos[1] = 0;
|
||||||
mEnvironment.mWorld->changeToInteriorCell (mCellName, pos);
|
MWBase::Environment::get().getWorld()->changeToInteriorCell (mCellName, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets up the input system
|
// Sets up the input system
|
||||||
MWInput::MWInputManager input(*mOgre, mEnvironment.mWorld->getPlayer(),
|
|
||||||
*mEnvironment.mWindowManager, mDebug, *this);
|
mEnvironment.setInputManager (new MWInput::MWInputManager (*mOgre,
|
||||||
mEnvironment.mInputManager = &input;
|
MWBase::Environment::get().getWorld()->getPlayer(),
|
||||||
|
*MWBase::Environment::get().getWindowManager(), mDebug, *this));
|
||||||
|
|
||||||
std::cout << "\nPress Q/ESC or close window to exit.\n";
|
std::cout << "\nPress Q/ESC or close window to exit.\n";
|
||||||
|
|
||||||
mOgre->getRoot()->addFrameListener (this);
|
mOgre->getRoot()->addFrameListener (this);
|
||||||
|
|
||||||
// Play some good 'ol tunes
|
// Play some good 'ol tunes
|
||||||
mEnvironment.mSoundManager->playPlaylist(std::string("Explore"));
|
MWBase::Environment::get().getSoundManager()->playPlaylist(std::string("Explore"));
|
||||||
|
|
||||||
// scripts
|
// scripts
|
||||||
if (mCompileAll)
|
if (mCompileAll)
|
||||||
{
|
{
|
||||||
std::pair<int, int> result = mEnvironment.mScriptManager->compileAll();
|
std::pair<int, int> result = MWBase::Environment::get().getScriptManager()->compileAll();
|
||||||
|
|
||||||
if (result.first)
|
if (result.first)
|
||||||
std::cout
|
std::cout
|
||||||
|
@ -414,10 +412,10 @@ void OMW::Engine::go()
|
||||||
|
|
||||||
void OMW::Engine::activate()
|
void OMW::Engine::activate()
|
||||||
{
|
{
|
||||||
if (mEnvironment.mWindowManager->getMode()!=MWGui::GM_Game)
|
if (MWBase::Environment::get().getWindowManager()->getMode()!=MWGui::GM_Game)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::string handle = mEnvironment.mWorld->getFacedHandle();
|
std::string handle = MWBase::Environment::get().getWorld()->getFacedHandle();
|
||||||
|
|
||||||
if (handle.empty())
|
if (handle.empty())
|
||||||
return;
|
return;
|
||||||
|
@ -428,7 +426,7 @@ void OMW::Engine::activate()
|
||||||
MWWorld::Ptr ptr;
|
MWWorld::Ptr ptr;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ptr = mEnvironment.mWorld->getPtrViaHandle (handle);
|
ptr = MWBase::Environment::get().getWorld()->getPtrViaHandle (handle);
|
||||||
|
|
||||||
if (ptr.isEmpty())
|
if (ptr.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
@ -438,12 +436,10 @@ void OMW::Engine::activate()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MWScript::InterpreterContext interpreterContext (mEnvironment,
|
MWScript::InterpreterContext interpreterContext (&ptr.getRefData().getLocals(), ptr);
|
||||||
&ptr.getRefData().getLocals(), ptr);
|
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> action =
|
boost::shared_ptr<MWWorld::Action> action =
|
||||||
MWWorld::Class::get (ptr).activate (ptr, mEnvironment.mWorld->getPlayer().getPlayer(),
|
MWWorld::Class::get (ptr).activate (ptr, MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||||
mEnvironment);
|
|
||||||
|
|
||||||
interpreterContext.activate (ptr, action);
|
interpreterContext.activate (ptr, action);
|
||||||
|
|
||||||
|
@ -451,8 +447,8 @@ void OMW::Engine::activate()
|
||||||
|
|
||||||
if (!script.empty())
|
if (!script.empty())
|
||||||
{
|
{
|
||||||
mEnvironment.mWorld->getLocalScripts().setIgnore (ptr);
|
MWBase::Environment::get().getWorld()->getLocalScripts().setIgnore (ptr);
|
||||||
mEnvironment.mScriptManager->run (script, interpreterContext);
|
MWBase::Environment::get().getScriptManager()->run (script, interpreterContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!interpreterContext.hasActivationBeenHandled())
|
if (!interpreterContext.hasActivationBeenHandled())
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
#include <components/compiler/extensions.hpp>
|
#include <components/compiler/extensions.hpp>
|
||||||
#include <components/files/collections.hpp>
|
#include <components/files/collections.hpp>
|
||||||
|
|
||||||
#include "mwworld/environment.hpp"
|
#include "mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "mwworld/ptr.hpp"
|
#include "mwworld/ptr.hpp"
|
||||||
|
|
||||||
namespace Compiler
|
namespace Compiler
|
||||||
|
@ -77,7 +78,7 @@ namespace OMW
|
||||||
std::string mFocusName;
|
std::string mFocusName;
|
||||||
std::map<std::string,std::string> mFallbackMap;
|
std::map<std::string,std::string> mFallbackMap;
|
||||||
|
|
||||||
MWWorld::Environment mEnvironment;
|
MWBase::Environment mEnvironment;
|
||||||
Compiler::Extensions mExtensions;
|
Compiler::Extensions mExtensions;
|
||||||
Compiler::Context *mScriptContext;
|
Compiler::Context *mScriptContext;
|
||||||
|
|
||||||
|
|
123
apps/openmw/mwbase/environment.cpp
Normal file
123
apps/openmw/mwbase/environment.cpp
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
|
||||||
|
#include "environment.hpp"
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
MWBase::Environment *MWBase::Environment::sThis = 0;
|
||||||
|
|
||||||
|
MWBase::Environment::Environment()
|
||||||
|
: mWorld (0), mSoundManager (0), mScriptManager (0), mWindowManager (0),
|
||||||
|
mMechanicsManager (0), mDialogueManager (0), mJournal (0), mInputManager (0), mFrameDuration (0)
|
||||||
|
{
|
||||||
|
assert (!sThis);
|
||||||
|
sThis = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
MWBase::Environment::~Environment()
|
||||||
|
{
|
||||||
|
sThis = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MWBase::Environment::setWorld (MWWorld::World *world)
|
||||||
|
{
|
||||||
|
mWorld = world;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MWBase::Environment::setSoundManager (MWSound::SoundManager *soundManager)
|
||||||
|
{
|
||||||
|
mSoundManager = soundManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MWBase::Environment::setScriptManager (MWScript::ScriptManager *scriptManager)
|
||||||
|
{
|
||||||
|
mScriptManager = scriptManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MWBase::Environment::setWindowManager (MWGui::WindowManager *windowManager)
|
||||||
|
{
|
||||||
|
mWindowManager = windowManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MWBase::Environment::setMechanicsManager (MWMechanics::MechanicsManager *mechanicsManager)
|
||||||
|
{
|
||||||
|
mMechanicsManager = mechanicsManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MWBase::Environment::setDialogueManager (MWDialogue::DialogueManager *dialogueManager)
|
||||||
|
{
|
||||||
|
mDialogueManager = dialogueManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MWBase::Environment::setJournal (MWDialogue::Journal *journal)
|
||||||
|
{
|
||||||
|
mJournal = journal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MWBase::Environment::setInputManager (MWInput::MWInputManager *inputManager)
|
||||||
|
{
|
||||||
|
mInputManager = inputManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MWBase::Environment::setFrameDuration (float duration)
|
||||||
|
{
|
||||||
|
mFrameDuration = duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
MWWorld::World *MWBase::Environment::getWorld() const
|
||||||
|
{
|
||||||
|
assert (mWorld);
|
||||||
|
return mWorld;
|
||||||
|
}
|
||||||
|
|
||||||
|
MWSound::SoundManager *MWBase::Environment::getSoundManager() const
|
||||||
|
{
|
||||||
|
assert (mSoundManager);
|
||||||
|
return mSoundManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
MWScript::ScriptManager *MWBase::Environment::getScriptManager() const
|
||||||
|
{
|
||||||
|
assert (mScriptManager);
|
||||||
|
return mScriptManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
MWGui::WindowManager *MWBase::Environment::getWindowManager() const
|
||||||
|
{
|
||||||
|
assert (mWindowManager);
|
||||||
|
return mWindowManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
MWMechanics::MechanicsManager *MWBase::Environment::getMechanicsManager() const
|
||||||
|
{
|
||||||
|
assert (mMechanicsManager);
|
||||||
|
return mMechanicsManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
MWDialogue::DialogueManager *MWBase::Environment::getDialogueManager() const
|
||||||
|
{
|
||||||
|
assert (mDialogueManager);
|
||||||
|
return mDialogueManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
MWDialogue::Journal *MWBase::Environment::getJournal() const
|
||||||
|
{
|
||||||
|
assert (mJournal);
|
||||||
|
return mJournal;
|
||||||
|
}
|
||||||
|
|
||||||
|
MWInput::MWInputManager *MWBase::Environment::getInputManager() const
|
||||||
|
{
|
||||||
|
assert (mInputManager);
|
||||||
|
return mInputManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
float MWBase::Environment::getFrameDuration() const
|
||||||
|
{
|
||||||
|
return mFrameDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
const MWBase::Environment& MWBase::Environment::get()
|
||||||
|
{
|
||||||
|
assert (sThis);
|
||||||
|
return *sThis;
|
||||||
|
}
|
116
apps/openmw/mwbase/environment.hpp
Normal file
116
apps/openmw/mwbase/environment.hpp
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
#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 MWWorld
|
||||||
|
{
|
||||||
|
class World;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace MWBase
|
||||||
|
{
|
||||||
|
/// \brief Central hub for mw-subsystems
|
||||||
|
///
|
||||||
|
/// This class allows each mw-subsystem to access any others subsystem's top-level manager class.
|
||||||
|
///
|
||||||
|
/// \attention Environment does not take ownership of the manager class instances it is handed over in
|
||||||
|
/// the set* functions.
|
||||||
|
class Environment
|
||||||
|
{
|
||||||
|
static Environment *sThis;
|
||||||
|
|
||||||
|
MWWorld::World *mWorld;
|
||||||
|
MWSound::SoundManager *mSoundManager;
|
||||||
|
MWScript::ScriptManager *mScriptManager;
|
||||||
|
MWGui::WindowManager *mWindowManager;
|
||||||
|
MWMechanics::MechanicsManager *mMechanicsManager;
|
||||||
|
MWDialogue::DialogueManager *mDialogueManager;
|
||||||
|
MWDialogue::Journal *mJournal;
|
||||||
|
MWInput::MWInputManager *mInputManager;
|
||||||
|
float mFrameDuration;
|
||||||
|
|
||||||
|
Environment (const Environment&);
|
||||||
|
///< not implemented
|
||||||
|
|
||||||
|
Environment& operator= (const Environment&);
|
||||||
|
///< not implemented
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Environment();
|
||||||
|
|
||||||
|
~Environment();
|
||||||
|
|
||||||
|
void setWorld (MWWorld::World *world);
|
||||||
|
|
||||||
|
void setSoundManager (MWSound::SoundManager *soundManager);
|
||||||
|
|
||||||
|
void setScriptManager (MWScript::ScriptManager *scriptManager);
|
||||||
|
|
||||||
|
void setWindowManager (MWGui::WindowManager *windowManager);
|
||||||
|
|
||||||
|
void setMechanicsManager (MWMechanics::MechanicsManager *mechanicsManager);
|
||||||
|
|
||||||
|
void setDialogueManager (MWDialogue::DialogueManager *dialogueManager);
|
||||||
|
|
||||||
|
void setJournal (MWDialogue::Journal *journal);
|
||||||
|
|
||||||
|
void setInputManager (MWInput::MWInputManager *inputManager);
|
||||||
|
|
||||||
|
void setFrameDuration (float duration);
|
||||||
|
///< Set length of current frame in seconds.
|
||||||
|
|
||||||
|
MWWorld::World *getWorld() const;
|
||||||
|
|
||||||
|
MWSound::SoundManager *getSoundManager() const;
|
||||||
|
|
||||||
|
MWScript::ScriptManager *getScriptManager() const;
|
||||||
|
|
||||||
|
MWGui::WindowManager *getWindowManager() const;
|
||||||
|
|
||||||
|
MWMechanics::MechanicsManager *getMechanicsManager() const;
|
||||||
|
|
||||||
|
MWDialogue::DialogueManager *getDialogueManager() const;
|
||||||
|
|
||||||
|
MWDialogue::Journal *getJournal() const;
|
||||||
|
|
||||||
|
MWInput::MWInputManager *getInputManager() const;
|
||||||
|
|
||||||
|
float getFrameDuration() const;
|
||||||
|
|
||||||
|
static const Environment& get();
|
||||||
|
///< Return instance of this class.
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,13 +1,13 @@
|
||||||
|
|
||||||
#include "activator.hpp"
|
#include "activator.hpp"
|
||||||
#include "../mwrender/objects.hpp"
|
|
||||||
|
|
||||||
#include <components/esm/loadacti.hpp>
|
#include <components/esm/loadacti.hpp>
|
||||||
|
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwgui/window_manager.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
|
@ -28,7 +28,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Activator::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const
|
void Activator::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Activator, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Activator, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Activator>();
|
ptr.get<ESM::Activator>();
|
||||||
|
@ -73,7 +73,7 @@ namespace MWClass
|
||||||
return (ref->base->name != "");
|
return (ref->base->name != "");
|
||||||
}
|
}
|
||||||
|
|
||||||
MWGui::ToolTipInfo Activator::getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
MWGui::ToolTipInfo Activator::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Activator, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Activator, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Activator>();
|
ptr.get<ESM::Activator>();
|
||||||
|
@ -82,7 +82,7 @@ namespace MWClass
|
||||||
info.caption = ref->base->name;
|
info.caption = ref->base->name;
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
if (environment.mWindowManager->getFullHelp())
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp())
|
||||||
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
||||||
info.text = text;
|
info.text = text;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace MWClass
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||||
///< Add reference into a cell for rendering
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const;
|
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
|
@ -21,7 +21,7 @@ namespace MWClass
|
||||||
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||||
|
|
||||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
||||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
|
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
|
@ -35,7 +36,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Apparatus::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const
|
void Apparatus::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Apparatus>();
|
ptr.get<ESM::Apparatus>();
|
||||||
|
@ -58,9 +59,9 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> Apparatus::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Apparatus::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
|
@ -107,7 +108,7 @@ namespace MWClass
|
||||||
return (ref->base->name != "");
|
return (ref->base->name != "");
|
||||||
}
|
}
|
||||||
|
|
||||||
MWGui::ToolTipInfo Apparatus::getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
MWGui::ToolTipInfo Apparatus::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Apparatus>();
|
ptr.get<ESM::Apparatus>();
|
||||||
|
@ -116,12 +117,14 @@ namespace MWClass
|
||||||
info.caption = ref->base->name;
|
info.caption = ref->base->name;
|
||||||
info.icon = ref->base->icon;
|
info.icon = ref->base->icon;
|
||||||
|
|
||||||
std::string text;
|
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sQuality")->str + ": " + MWGui::ToolTips::toString(ref->base->data.quality);
|
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
|
||||||
text += MWGui::ToolTips::getValueString(ref->base->data.value, environment.mWorld->getStore().gameSettings.search("sValue")->str);
|
|
||||||
|
|
||||||
if (environment.mWindowManager->getFullHelp()) {
|
std::string text;
|
||||||
|
text += "\n" + store.gameSettings.search("sQuality")->str + ": " + MWGui::ToolTips::toString(ref->base->data.quality);
|
||||||
|
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
||||||
|
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
|
||||||
|
|
||||||
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
||||||
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,14 +12,14 @@ namespace MWClass
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||||
///< Add reference into a cell for rendering
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const;
|
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
const MWWorld::Ptr& actor) const;
|
||||||
///< Generate action for activation
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||||
|
@ -31,7 +31,7 @@ namespace MWClass
|
||||||
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||||
|
|
||||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
|
@ -9,11 +9,11 @@
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
|
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwgui/window_manager.hpp"
|
||||||
|
@ -38,7 +38,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Armor::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const
|
void Armor::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Armor>();
|
ptr.get<ESM::Armor>();
|
||||||
|
@ -60,9 +60,9 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> Armor::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Armor::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, MWSound::Play_NoTrack);
|
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
|
@ -123,7 +123,7 @@ namespace MWClass
|
||||||
return std::make_pair (slots, false);
|
return std::make_pair (slots, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Armor::getEquipmentSkill (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
int Armor::getEquipmentSkill (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Armor>();
|
ptr.get<ESM::Armor>();
|
||||||
|
@ -149,13 +149,13 @@ namespace MWClass
|
||||||
if (typeGmst.empty())
|
if (typeGmst.empty())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
float iWeight = environment.mWorld->getStore().gameSettings.find (typeGmst)->i;
|
float iWeight = MWBase::Environment::get().getWorld()->getStore().gameSettings.find (typeGmst)->i;
|
||||||
|
|
||||||
if (iWeight * environment.mWorld->getStore().gameSettings.find ("fLightMaxMod")->f>=
|
if (iWeight * MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fLightMaxMod")->f>=
|
||||||
ref->base->data.weight)
|
ref->base->data.weight)
|
||||||
return ESM::Skill::LightArmor;
|
return ESM::Skill::LightArmor;
|
||||||
|
|
||||||
if (iWeight * environment.mWorld->getStore().gameSettings.find ("fMedMaxMod")->f>=
|
if (iWeight * MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMedMaxMod")->f>=
|
||||||
ref->base->data.weight)
|
ref->base->data.weight)
|
||||||
return ESM::Skill::MediumArmor;
|
return ESM::Skill::MediumArmor;
|
||||||
|
|
||||||
|
@ -177,9 +177,9 @@ namespace MWClass
|
||||||
registerClass (typeid (ESM::Armor).name(), instance);
|
registerClass (typeid (ESM::Armor).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Armor::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Armor::getUpSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
int es = getEquipmentSkill(ptr, environment);
|
int es = getEquipmentSkill(ptr);
|
||||||
if (es == ESM::Skill::LightArmor)
|
if (es == ESM::Skill::LightArmor)
|
||||||
return std::string("Item Armor Light Up");
|
return std::string("Item Armor Light Up");
|
||||||
else if (es == ESM::Skill::MediumArmor)
|
else if (es == ESM::Skill::MediumArmor)
|
||||||
|
@ -188,9 +188,9 @@ namespace MWClass
|
||||||
return std::string("Item Armor Heavy Up");
|
return std::string("Item Armor Heavy Up");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Armor::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Armor::getDownSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
int es = getEquipmentSkill(ptr, environment);
|
int es = getEquipmentSkill(ptr);
|
||||||
if (es == ESM::Skill::LightArmor)
|
if (es == ESM::Skill::LightArmor)
|
||||||
return std::string("Item Armor Light Down");
|
return std::string("Item Armor Light Down");
|
||||||
else if (es == ESM::Skill::MediumArmor)
|
else if (es == ESM::Skill::MediumArmor)
|
||||||
|
@ -207,7 +207,7 @@ namespace MWClass
|
||||||
return (ref->base->name != "");
|
return (ref->base->name != "");
|
||||||
}
|
}
|
||||||
|
|
||||||
MWGui::ToolTipInfo Armor::getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
MWGui::ToolTipInfo Armor::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Armor>();
|
ptr.get<ESM::Armor>();
|
||||||
|
@ -218,25 +218,27 @@ namespace MWClass
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
||||||
|
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
|
||||||
// get armor type string (light/medium/heavy)
|
// get armor type string (light/medium/heavy)
|
||||||
int armorType = getEquipmentSkill(ptr, environment);
|
int armorType = getEquipmentSkill(ptr);
|
||||||
std::string typeText;
|
std::string typeText;
|
||||||
if (armorType == ESM::Skill::LightArmor)
|
if (armorType == ESM::Skill::LightArmor)
|
||||||
typeText = environment.mWorld->getStore().gameSettings.search("sLight")->str;
|
typeText = store.gameSettings.search("sLight")->str;
|
||||||
else if (armorType == ESM::Skill::MediumArmor)
|
else if (armorType == ESM::Skill::MediumArmor)
|
||||||
typeText = environment.mWorld->getStore().gameSettings.search("sMedium")->str;
|
typeText = store.gameSettings.search("sMedium")->str;
|
||||||
else
|
else
|
||||||
typeText = environment.mWorld->getStore().gameSettings.search("sHeavy")->str;
|
typeText = store.gameSettings.search("sHeavy")->str;
|
||||||
|
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sArmorRating")->str + ": " + MWGui::ToolTips::toString(ref->base->data.armor);
|
text += "\n" + store.gameSettings.search("sArmorRating")->str + ": " + MWGui::ToolTips::toString(ref->base->data.armor);
|
||||||
|
|
||||||
/// \todo store the current armor health somewhere
|
/// \todo store the current armor health somewhere
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sCondition")->str + ": " + MWGui::ToolTips::toString(ref->base->data.health);
|
text += "\n" + store.gameSettings.search("sCondition")->str + ": " + MWGui::ToolTips::toString(ref->base->data.health);
|
||||||
|
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight) + " (" + typeText + ")";
|
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight) + " (" + typeText + ")";
|
||||||
text += MWGui::ToolTips::getValueString(ref->base->data.value, environment.mWorld->getStore().gameSettings.search("sValue")->str);
|
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
|
||||||
|
|
||||||
if (environment.mWindowManager->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
||||||
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,14 +12,14 @@ namespace MWClass
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||||
///< Add reference into a cell for rendering
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const;
|
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
const MWWorld::Ptr& actor) const;
|
||||||
///< Generate action for activation
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual bool hasItemHealth (const MWWorld::Ptr& ptr) const;
|
virtual bool hasItemHealth (const MWWorld::Ptr& ptr) const;
|
||||||
|
@ -35,15 +35,14 @@ namespace MWClass
|
||||||
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
|
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
|
||||||
/// stay stacked when equipped?
|
/// stay stacked when equipped?
|
||||||
|
|
||||||
virtual int getEquipmentSkill (const MWWorld::Ptr& ptr,
|
virtual int getEquipmentSkill (const MWWorld::Ptr& ptr) const;
|
||||||
const MWWorld::Environment& environment) const;
|
|
||||||
/// Return the index of the skill this item corresponds to when equiopped or -1, if there is
|
/// Return the index of the skill this item corresponds to when equiopped or -1, if there is
|
||||||
/// no such skill.
|
/// no such skill.
|
||||||
|
|
||||||
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||||
|
|
||||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
||||||
virtual int getValue (const MWWorld::Ptr& ptr) const;
|
virtual int getValue (const MWWorld::Ptr& ptr) const;
|
||||||
|
@ -51,10 +50,10 @@ namespace MWClass
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the pick up sound Id
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the put down sound Id
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
|
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
|
@ -34,7 +35,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Book::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const
|
void Book::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Book>();
|
ptr.get<ESM::Book>();
|
||||||
|
@ -57,11 +58,11 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> Book::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Book::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
// TODO implement reading
|
// TODO implement reading
|
||||||
|
|
||||||
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, MWSound::Play_NoTrack);
|
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
|
@ -90,12 +91,12 @@ namespace MWClass
|
||||||
registerClass (typeid (ESM::Book).name(), instance);
|
registerClass (typeid (ESM::Book).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Book::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Book::getUpSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
return std::string("Item Book Up");
|
return std::string("Item Book Up");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Book::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Book::getDownSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
return std::string("Item Book Down");
|
return std::string("Item Book Down");
|
||||||
}
|
}
|
||||||
|
@ -108,7 +109,7 @@ namespace MWClass
|
||||||
return (ref->base->name != "");
|
return (ref->base->name != "");
|
||||||
}
|
}
|
||||||
|
|
||||||
MWGui::ToolTipInfo Book::getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
MWGui::ToolTipInfo Book::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Book>();
|
ptr.get<ESM::Book>();
|
||||||
|
@ -117,12 +118,14 @@ namespace MWClass
|
||||||
info.caption = ref->base->name;
|
info.caption = ref->base->name;
|
||||||
info.icon = ref->base->icon;
|
info.icon = ref->base->icon;
|
||||||
|
|
||||||
|
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
||||||
text += MWGui::ToolTips::getValueString(ref->base->data.value, environment.mWorld->getStore().gameSettings.search("sValue")->str);
|
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
|
||||||
|
|
||||||
if (environment.mWindowManager->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
||||||
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,14 +12,14 @@ namespace MWClass
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||||
///< Add reference into a cell for rendering
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const;
|
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
const MWWorld::Ptr& actor) const;
|
||||||
///< Generate action for activation
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||||
|
@ -28,7 +28,7 @@ namespace MWClass
|
||||||
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||||
|
|
||||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
||||||
virtual int getValue (const MWWorld::Ptr& ptr) const;
|
virtual int getValue (const MWWorld::Ptr& ptr) const;
|
||||||
|
@ -36,10 +36,10 @@ namespace MWClass
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the pick up sound Id
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the put down sound Id
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
|
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clothing::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const
|
void Clothing::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Clothing>();
|
ptr.get<ESM::Clothing>();
|
||||||
|
@ -59,9 +60,9 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> Clothing::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Clothing::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, MWSound::Play_NoTrack);
|
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
|
@ -115,8 +116,7 @@ namespace MWClass
|
||||||
return std::make_pair (slots, false);
|
return std::make_pair (slots, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Clothing::getEquipmentSkill (const MWWorld::Ptr& ptr,
|
int Clothing::getEquipmentSkill (const MWWorld::Ptr& ptr) const
|
||||||
const MWWorld::Environment& environment) const
|
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Clothing>();
|
ptr.get<ESM::Clothing>();
|
||||||
|
@ -142,7 +142,7 @@ namespace MWClass
|
||||||
registerClass (typeid (ESM::Clothing).name(), instance);
|
registerClass (typeid (ESM::Clothing).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Clothing::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Clothing::getUpSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Clothing>();
|
ptr.get<ESM::Clothing>();
|
||||||
|
@ -154,7 +154,7 @@ namespace MWClass
|
||||||
return std::string("Item Clothes Up");
|
return std::string("Item Clothes Up");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Clothing::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Clothing::getDownSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Clothing>();
|
ptr.get<ESM::Clothing>();
|
||||||
|
@ -174,7 +174,7 @@ namespace MWClass
|
||||||
return (ref->base->name != "");
|
return (ref->base->name != "");
|
||||||
}
|
}
|
||||||
|
|
||||||
MWGui::ToolTipInfo Clothing::getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
MWGui::ToolTipInfo Clothing::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Clothing>();
|
ptr.get<ESM::Clothing>();
|
||||||
|
@ -183,12 +183,14 @@ namespace MWClass
|
||||||
info.caption = ref->base->name;
|
info.caption = ref->base->name;
|
||||||
info.icon = ref->base->icon;
|
info.icon = ref->base->icon;
|
||||||
|
|
||||||
|
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
||||||
text += MWGui::ToolTips::getValueString(ref->base->data.value, environment.mWorld->getStore().gameSettings.search("sValue")->str);
|
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
|
||||||
|
|
||||||
if (environment.mWindowManager->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
||||||
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,14 +12,14 @@ namespace MWClass
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||||
///< Add reference into a cell for rendering
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const;
|
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
const MWWorld::Ptr& actor) const;
|
||||||
///< Generate action for activation
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||||
|
@ -29,15 +29,14 @@ namespace MWClass
|
||||||
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
|
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
|
||||||
/// stay stacked when equipped?
|
/// stay stacked when equipped?
|
||||||
|
|
||||||
virtual int getEquipmentSkill (const MWWorld::Ptr& ptr,
|
virtual int getEquipmentSkill (const MWWorld::Ptr& ptr) const;
|
||||||
const MWWorld::Environment& environment) const;
|
|
||||||
/// Return the index of the skill this item corresponds to when equiopped or -1, if there is
|
/// Return the index of the skill this item corresponds to when equiopped or -1, if there is
|
||||||
/// no such skill.
|
/// no such skill.
|
||||||
|
|
||||||
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||||
|
|
||||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
||||||
virtual int getValue (const MWWorld::Ptr& ptr) const;
|
virtual int getValue (const MWWorld::Ptr& ptr) const;
|
||||||
|
@ -45,10 +44,10 @@ namespace MWClass
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the pick up sound Id
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the put down sound Id
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,12 @@
|
||||||
|
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/nullaction.hpp"
|
#include "../mwworld/nullaction.hpp"
|
||||||
#include "../mwworld/containerstore.hpp"
|
#include "../mwworld/containerstore.hpp"
|
||||||
#include "../mwworld/customdata.hpp"
|
#include "../mwworld/customdata.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwgui/window_manager.hpp"
|
||||||
|
@ -65,7 +66,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Container::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const
|
void Container::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Container>();
|
ptr.get<ESM::Container>();
|
||||||
|
@ -80,7 +81,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> Container::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Container::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
const std::string lockedSound = "LockedChest";
|
const std::string lockedSound = "LockedChest";
|
||||||
const std::string trapActivationSound = "Disarm Trap Fail";
|
const std::string trapActivationSound = "Disarm Trap Fail";
|
||||||
|
@ -89,7 +90,7 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
// TODO check for key
|
// TODO check for key
|
||||||
std::cout << "Locked container" << std::endl;
|
std::cout << "Locked container" << std::endl;
|
||||||
environment.mSoundManager->playSound3D (ptr, lockedSound, 1.0, 1.0);
|
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, lockedSound, 1.0, 1.0);
|
||||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -104,7 +105,7 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
// Trap activation goes here
|
// Trap activation goes here
|
||||||
std::cout << "Activated trap: " << ptr.getCellRef().trap << std::endl;
|
std::cout << "Activated trap: " << ptr.getCellRef().trap << std::endl;
|
||||||
environment.mSoundManager->playSound3D (ptr, trapActivationSound, 1.0, 1.0);
|
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, trapActivationSound, 1.0, 1.0);
|
||||||
ptr.getCellRef().trap = "";
|
ptr.getCellRef().trap = "";
|
||||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||||
}
|
}
|
||||||
|
@ -150,7 +151,7 @@ namespace MWClass
|
||||||
return (ref->base->name != "");
|
return (ref->base->name != "");
|
||||||
}
|
}
|
||||||
|
|
||||||
MWGui::ToolTipInfo Container::getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
MWGui::ToolTipInfo Container::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Container>();
|
ptr.get<ESM::Container>();
|
||||||
|
@ -158,13 +159,15 @@ namespace MWClass
|
||||||
MWGui::ToolTipInfo info;
|
MWGui::ToolTipInfo info;
|
||||||
info.caption = ref->base->name;
|
info.caption = ref->base->name;
|
||||||
|
|
||||||
|
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
if (ref->ref.lockLevel > 0)
|
if (ref->ref.lockLevel > 0)
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sLockLevel")->str + ": " + MWGui::ToolTips::toString(ref->ref.lockLevel);
|
text += "\n" + store.gameSettings.search("sLockLevel")->str + ": " + MWGui::ToolTips::toString(ref->ref.lockLevel);
|
||||||
if (ref->ref.trap != "")
|
if (ref->ref.trap != "")
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sTrapped")->str;
|
text += "\n" + store.gameSettings.search("sTrapped")->str;
|
||||||
|
|
||||||
if (environment.mWindowManager->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
||||||
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,20 +14,20 @@ namespace MWClass
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||||
///< Add reference into a cell for rendering
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const;
|
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
const MWWorld::Ptr& actor) const;
|
||||||
///< Generate action for activation
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||||
|
|
||||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
||||||
virtual MWWorld::ContainerStore& getContainerStore (const MWWorld::Ptr& ptr) const;
|
virtual MWWorld::ContainerStore& getContainerStore (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
|
@ -6,9 +6,10 @@
|
||||||
#include "../mwmechanics/creaturestats.hpp"
|
#include "../mwmechanics/creaturestats.hpp"
|
||||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontalk.hpp"
|
#include "../mwworld/actiontalk.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "../mwworld/customdata.hpp"
|
#include "../mwworld/customdata.hpp"
|
||||||
#include "../mwworld/containerstore.hpp"
|
#include "../mwworld/containerstore.hpp"
|
||||||
|
|
||||||
|
@ -76,7 +77,7 @@ namespace MWClass
|
||||||
actors.insertCreature(ptr);
|
actors.insertCreature(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const
|
void Creature::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Creature>();
|
ptr.get<ESM::Creature>();
|
||||||
|
@ -89,14 +90,14 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::enable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
void Creature::enable (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
environment.mMechanicsManager->addActor (ptr);
|
MWBase::Environment::get().getMechanicsManager()->addActor (ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::disable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
void Creature::disable (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
environment.mMechanicsManager->removeActor (ptr);
|
MWBase::Environment::get().getMechanicsManager()->removeActor (ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Creature::getName (const MWWorld::Ptr& ptr) const
|
std::string Creature::getName (const MWWorld::Ptr& ptr) const
|
||||||
|
@ -115,7 +116,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> Creature::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Creature::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::ActionTalk (ptr));
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::ActionTalk (ptr));
|
||||||
}
|
}
|
||||||
|
@ -150,7 +151,7 @@ namespace MWClass
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MWGui::ToolTipInfo Creature::getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
MWGui::ToolTipInfo Creature::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Creature>();
|
ptr.get<ESM::Creature>();
|
||||||
|
@ -159,7 +160,7 @@ namespace MWClass
|
||||||
info.caption = ref->base->name;
|
info.caption = ref->base->name;
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
if (environment.mWindowManager->getFullHelp())
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp())
|
||||||
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
||||||
info.text = text;
|
info.text = text;
|
||||||
|
|
||||||
|
|
|
@ -20,12 +20,12 @@ namespace MWClass
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||||
///< Add reference into a cell for rendering
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const;
|
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual void enable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual void enable (const MWWorld::Ptr& ptr) const;
|
||||||
///< Enable reference; only does the non-rendering part
|
///< Enable reference; only does the non-rendering part
|
||||||
|
|
||||||
virtual void disable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual void disable (const MWWorld::Ptr& ptr) const;
|
||||||
///< Enable reference; only does the non-rendering part
|
///< Enable reference; only does the non-rendering part
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
|
@ -35,14 +35,14 @@ namespace MWClass
|
||||||
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||||
|
|
||||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
||||||
virtual MWMechanics::CreatureStats& getCreatureStats (const MWWorld::Ptr& ptr) const;
|
virtual MWMechanics::CreatureStats& getCreatureStats (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return creature stats
|
///< Return creature stats
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
const MWWorld::Ptr& actor) const;
|
||||||
///< Generate action for activation
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual MWWorld::ContainerStore& getContainerStore (
|
virtual MWWorld::ContainerStore& getContainerStore (
|
||||||
|
|
|
@ -5,11 +5,12 @@
|
||||||
|
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/nullaction.hpp"
|
#include "../mwworld/nullaction.hpp"
|
||||||
#include "../mwworld/actionteleport.hpp"
|
#include "../mwworld/actionteleport.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwgui/window_manager.hpp"
|
||||||
|
@ -37,7 +38,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Door::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const
|
void Door::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Door>();
|
ptr.get<ESM::Door>();
|
||||||
|
@ -61,7 +62,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> Door::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Door::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Door>();
|
ptr.get<ESM::Door>();
|
||||||
|
@ -76,7 +77,7 @@ namespace MWClass
|
||||||
// TODO check for key
|
// TODO check for key
|
||||||
// TODO report failure to player (message, sound?). Look up behaviour of original MW.
|
// TODO report failure to player (message, sound?). Look up behaviour of original MW.
|
||||||
std::cout << "Locked!" << std::endl;
|
std::cout << "Locked!" << std::endl;
|
||||||
environment.mSoundManager->playSound3D (ptr, lockedSound, 1.0, 1.0);
|
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, lockedSound, 1.0, 1.0);
|
||||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +85,7 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
// Trap activation
|
// Trap activation
|
||||||
std::cout << "Activated trap: " << ptr.getCellRef().trap << std::endl;
|
std::cout << "Activated trap: " << ptr.getCellRef().trap << std::endl;
|
||||||
environment.mSoundManager->playSound3D(ptr, trapActivationSound, 1.0, 1.0);
|
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, trapActivationSound, 1.0, 1.0);
|
||||||
ptr.getCellRef().trap = "";
|
ptr.getCellRef().trap = "";
|
||||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||||
}
|
}
|
||||||
|
@ -92,11 +93,11 @@ namespace MWClass
|
||||||
if (ref->ref.teleport)
|
if (ref->ref.teleport)
|
||||||
{
|
{
|
||||||
// teleport door
|
// teleport door
|
||||||
if (environment.mWorld->getPlayer().getPlayer()==actor)
|
if (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()==actor)
|
||||||
{
|
{
|
||||||
// the player is using the door
|
// the player is using the door
|
||||||
// The reason this is not 3D is that it would get interrupted when you teleport
|
// The reason this is not 3D is that it would get interrupted when you teleport
|
||||||
environment.mSoundManager->playSound(openSound, 1.0, 1.0);
|
MWBase::Environment::get().getSoundManager()->playSound(openSound, 1.0, 1.0);
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTeleportPlayer (ref->ref.destCell, ref->ref.doorDest));
|
new MWWorld::ActionTeleportPlayer (ref->ref.destCell, ref->ref.doorDest));
|
||||||
}
|
}
|
||||||
|
@ -113,7 +114,7 @@ namespace MWClass
|
||||||
// TODO return action for rotating the door
|
// TODO return action for rotating the door
|
||||||
|
|
||||||
// This is a little pointless, but helps with testing
|
// This is a little pointless, but helps with testing
|
||||||
environment.mSoundManager->playSound3D (ptr, openSound, 1.0, 1.0);
|
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, openSound, 1.0, 1.0);
|
||||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,7 +155,7 @@ namespace MWClass
|
||||||
return (ref->base->name != "");
|
return (ref->base->name != "");
|
||||||
}
|
}
|
||||||
|
|
||||||
MWGui::ToolTipInfo Door::getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
MWGui::ToolTipInfo Door::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Door>();
|
ptr.get<ESM::Door>();
|
||||||
|
@ -164,6 +165,8 @@ namespace MWClass
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
||||||
|
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
|
||||||
if (ref->ref.teleport)
|
if (ref->ref.teleport)
|
||||||
{
|
{
|
||||||
std::string dest;
|
std::string dest;
|
||||||
|
@ -176,26 +179,26 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
// door leads to exterior, use cell name (if any), otherwise translated region name
|
// door leads to exterior, use cell name (if any), otherwise translated region name
|
||||||
int x,y;
|
int x,y;
|
||||||
environment.mWorld->positionToIndex (ref->ref.doorDest.pos[0], ref->ref.doorDest.pos[1], x, y);
|
MWBase::Environment::get().getWorld()->positionToIndex (ref->ref.doorDest.pos[0], ref->ref.doorDest.pos[1], x, y);
|
||||||
const ESM::Cell* cell = environment.mWorld->getStore().cells.findExt(x,y);
|
const ESM::Cell* cell = store.cells.findExt(x,y);
|
||||||
if (cell->name != "")
|
if (cell->name != "")
|
||||||
dest = cell->name;
|
dest = cell->name;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const ESM::Region* region = environment.mWorld->getStore().regions.search(cell->region);
|
const ESM::Region* region = store.regions.search(cell->region);
|
||||||
dest = region->name;
|
dest = region->name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sTo")->str;
|
text += "\n" + store.gameSettings.search("sTo")->str;
|
||||||
text += "\n"+dest;
|
text += "\n"+dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ref->ref.lockLevel > 0)
|
if (ref->ref.lockLevel > 0)
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sLockLevel")->str + ": " + MWGui::ToolTips::toString(ref->ref.lockLevel);
|
text += "\n" + store.gameSettings.search("sLockLevel")->str + ": " + MWGui::ToolTips::toString(ref->ref.lockLevel);
|
||||||
if (ref->ref.trap != "")
|
if (ref->ref.trap != "")
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sTrapped")->str;
|
text += "\n" + store.gameSettings.search("sTrapped")->str;
|
||||||
|
|
||||||
if (environment.mWindowManager->getFullHelp())
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp())
|
||||||
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
||||||
|
|
||||||
info.text = text;
|
info.text = text;
|
||||||
|
|
|
@ -12,20 +12,20 @@ namespace MWClass
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||||
///< Add reference into a cell for rendering
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const;
|
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
const MWWorld::Ptr& actor) const;
|
||||||
///< Generate action for activation
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||||
|
|
||||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
||||||
virtual void lock (const MWWorld::Ptr& ptr, int lockLevel) const;
|
virtual void lock (const MWWorld::Ptr& ptr, int lockLevel) const;
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
|
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwgui/window_manager.hpp"
|
||||||
|
@ -35,7 +36,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ingredient::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const
|
void Ingredient::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Ingredient>();
|
ptr.get<ESM::Ingredient>();
|
||||||
|
@ -56,9 +57,9 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> Ingredient::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Ingredient::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, MWSound::Play_NoTrack);
|
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
|
@ -87,12 +88,12 @@ namespace MWClass
|
||||||
registerClass (typeid (ESM::Ingredient).name(), instance);
|
registerClass (typeid (ESM::Ingredient).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Ingredient::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Ingredient::getUpSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
return std::string("Item Ingredient Up");
|
return std::string("Item Ingredient Up");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Ingredient::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Ingredient::getDownSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
return std::string("Item Ingredient Down");
|
return std::string("Item Ingredient Down");
|
||||||
}
|
}
|
||||||
|
@ -105,7 +106,7 @@ namespace MWClass
|
||||||
return (ref->base->name != "");
|
return (ref->base->name != "");
|
||||||
}
|
}
|
||||||
|
|
||||||
MWGui::ToolTipInfo Ingredient::getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
MWGui::ToolTipInfo Ingredient::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Ingredient>();
|
ptr.get<ESM::Ingredient>();
|
||||||
|
@ -114,12 +115,14 @@ namespace MWClass
|
||||||
info.caption = ref->base->name;
|
info.caption = ref->base->name;
|
||||||
info.icon = ref->base->icon;
|
info.icon = ref->base->icon;
|
||||||
|
|
||||||
|
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
||||||
text += MWGui::ToolTips::getValueString(ref->base->data.value, environment.mWorld->getStore().gameSettings.search("sValue")->str);
|
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
|
||||||
|
|
||||||
if (environment.mWindowManager->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
||||||
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,20 +12,20 @@ namespace MWClass
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||||
///< Add reference into a cell for rendering
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const;
|
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
const MWWorld::Ptr& actor) const;
|
||||||
///< Generate action for activation
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||||
|
|
||||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
||||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||||
|
@ -36,10 +36,10 @@ namespace MWClass
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the pick up sound Id
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the put down sound Id
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,11 @@
|
||||||
|
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
#include "../mwworld/nullaction.hpp"
|
#include "../mwworld/nullaction.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
|
@ -43,7 +44,7 @@ namespace MWClass
|
||||||
objects.insertLight (ptr, r, g, b, radius);
|
objects.insertLight (ptr, r, g, b, radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Light::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const
|
void Light::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Light>();
|
ptr.get<ESM::Light>();
|
||||||
|
@ -56,14 +57,14 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Light::enable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
void Light::enable (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Light>();
|
ptr.get<ESM::Light>();
|
||||||
|
|
||||||
if (!ref->base->sound.empty())
|
if (!ref->base->sound.empty())
|
||||||
{
|
{
|
||||||
environment.mSoundManager->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, MWSound::Play_Loop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +80,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> Light::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Light::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Light>();
|
ptr.get<ESM::Light>();
|
||||||
|
@ -87,7 +88,7 @@ namespace MWClass
|
||||||
if (!(ref->base->data.flags & ESM::Light::Carry))
|
if (!(ref->base->data.flags & ESM::Light::Carry))
|
||||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||||
|
|
||||||
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, MWSound::Play_NoTrack);
|
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
|
@ -129,12 +130,12 @@ namespace MWClass
|
||||||
registerClass (typeid (ESM::Light).name(), instance);
|
registerClass (typeid (ESM::Light).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Light::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Light::getUpSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
return std::string("Item Misc Up");
|
return std::string("Item Misc Up");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Light::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Light::getDownSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
return std::string("Item Misc Down");
|
return std::string("Item Misc Down");
|
||||||
}
|
}
|
||||||
|
@ -147,7 +148,7 @@ namespace MWClass
|
||||||
return (ref->base->name != "");
|
return (ref->base->name != "");
|
||||||
}
|
}
|
||||||
|
|
||||||
MWGui::ToolTipInfo Light::getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
MWGui::ToolTipInfo Light::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Light>();
|
ptr.get<ESM::Light>();
|
||||||
|
@ -156,12 +157,14 @@ namespace MWClass
|
||||||
info.caption = ref->base->name;
|
info.caption = ref->base->name;
|
||||||
info.icon = ref->base->icon;
|
info.icon = ref->base->icon;
|
||||||
|
|
||||||
|
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
||||||
text += MWGui::ToolTips::getValueString(ref->base->data.value, environment.mWorld->getStore().gameSettings.search("sValue")->str);
|
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
|
||||||
|
|
||||||
if (environment.mWindowManager->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
||||||
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,9 @@ namespace MWClass
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||||
///< Add reference into a cell for rendering
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const;
|
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual void enable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual void enable (const MWWorld::Ptr& ptr) const;
|
||||||
///< Enable reference; only does the non-rendering part
|
///< Enable reference; only does the non-rendering part
|
||||||
/// \attention This is not the same as the script instruction with the same name. References
|
/// \attention This is not the same as the script instruction with the same name. References
|
||||||
/// should only be enabled while in an active cell.
|
/// should only be enabled while in an active cell.
|
||||||
|
@ -26,11 +26,11 @@ namespace MWClass
|
||||||
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||||
|
|
||||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
const MWWorld::Ptr& actor) const;
|
||||||
///< Generate action for activation
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||||
|
@ -45,10 +45,10 @@ namespace MWClass
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the pick up sound Id
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the put down sound Id
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
|
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwgui/window_manager.hpp"
|
||||||
|
@ -35,7 +36,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lockpick::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const
|
void Lockpick::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Tool>();
|
ptr.get<ESM::Tool>();
|
||||||
|
@ -59,9 +60,9 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> Lockpick::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Lockpick::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, MWSound::Play_NoTrack);
|
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
|
@ -99,12 +100,12 @@ namespace MWClass
|
||||||
registerClass (typeid (ESM::Tool).name(), instance);
|
registerClass (typeid (ESM::Tool).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Lockpick::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Lockpick::getUpSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
return std::string("Item Lockpick Up");
|
return std::string("Item Lockpick Up");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Lockpick::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Lockpick::getDownSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
return std::string("Item Lockpick Down");
|
return std::string("Item Lockpick Down");
|
||||||
}
|
}
|
||||||
|
@ -117,7 +118,7 @@ namespace MWClass
|
||||||
return (ref->base->name != "");
|
return (ref->base->name != "");
|
||||||
}
|
}
|
||||||
|
|
||||||
MWGui::ToolTipInfo Lockpick::getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
MWGui::ToolTipInfo Lockpick::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Tool>();
|
ptr.get<ESM::Tool>();
|
||||||
|
@ -126,16 +127,18 @@ namespace MWClass
|
||||||
info.caption = ref->base->name;
|
info.caption = ref->base->name;
|
||||||
info.icon = ref->base->icon;
|
info.icon = ref->base->icon;
|
||||||
|
|
||||||
|
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
||||||
/// \todo store remaining uses somewhere
|
/// \todo store remaining uses somewhere
|
||||||
|
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sUses")->str + ": " + MWGui::ToolTips::toString(ref->base->data.uses);
|
text += "\n" + store.gameSettings.search("sUses")->str + ": " + MWGui::ToolTips::toString(ref->base->data.uses);
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sQuality")->str + ": " + MWGui::ToolTips::toString(ref->base->data.quality);
|
text += "\n" + store.gameSettings.search("sQuality")->str + ": " + MWGui::ToolTips::toString(ref->base->data.quality);
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
||||||
text += MWGui::ToolTips::getValueString(ref->base->data.value, environment.mWorld->getStore().gameSettings.search("sValue")->str);
|
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
|
||||||
|
|
||||||
if (environment.mWindowManager->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
||||||
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,20 +12,20 @@ namespace MWClass
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||||
///< Add reference into a cell for rendering
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const;
|
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
const MWWorld::Ptr& actor) const;
|
||||||
///< Generate action for activation
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||||
|
|
||||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
||||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||||
|
@ -40,10 +40,10 @@ namespace MWClass
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the pick up sound Id
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the put down sound Id
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,11 @@
|
||||||
|
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
|
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwgui/window_manager.hpp"
|
||||||
#include "../mwgui/tooltips.hpp"
|
#include "../mwgui/tooltips.hpp"
|
||||||
|
@ -37,7 +38,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Miscellaneous::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const
|
void Miscellaneous::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Miscellaneous>();
|
ptr.get<ESM::Miscellaneous>();
|
||||||
|
@ -60,9 +61,9 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> Miscellaneous::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Miscellaneous::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, MWSound::Play_NoTrack);
|
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
|
@ -91,24 +92,24 @@ namespace MWClass
|
||||||
registerClass (typeid (ESM::Miscellaneous).name(), instance);
|
registerClass (typeid (ESM::Miscellaneous).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Miscellaneous::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Miscellaneous::getUpSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Miscellaneous>();
|
ptr.get<ESM::Miscellaneous>();
|
||||||
|
|
||||||
if (ref->base->name == environment.mWorld->getStore().gameSettings.search("sGold")->str)
|
if (ref->base->name == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str)
|
||||||
{
|
{
|
||||||
return std::string("Item Gold Up");
|
return std::string("Item Gold Up");
|
||||||
}
|
}
|
||||||
return std::string("Item Misc Up");
|
return std::string("Item Misc Up");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Miscellaneous::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Miscellaneous::getDownSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Miscellaneous>();
|
ptr.get<ESM::Miscellaneous>();
|
||||||
|
|
||||||
if (ref->base->name == environment.mWorld->getStore().gameSettings.search("sGold")->str)
|
if (ref->base->name == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str)
|
||||||
{
|
{
|
||||||
return std::string("Item Gold Down");
|
return std::string("Item Gold Down");
|
||||||
}
|
}
|
||||||
|
@ -123,7 +124,7 @@ namespace MWClass
|
||||||
return (ref->base->name != "");
|
return (ref->base->name != "");
|
||||||
}
|
}
|
||||||
|
|
||||||
MWGui::ToolTipInfo Miscellaneous::getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
MWGui::ToolTipInfo Miscellaneous::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Miscellaneous>();
|
ptr.get<ESM::Miscellaneous>();
|
||||||
|
@ -132,23 +133,25 @@ namespace MWClass
|
||||||
info.caption = ref->base->name;
|
info.caption = ref->base->name;
|
||||||
info.icon = ref->base->icon;
|
info.icon = ref->base->icon;
|
||||||
|
|
||||||
|
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
|
||||||
if (ref->ref.soul != "")
|
if (ref->ref.soul != "")
|
||||||
{
|
{
|
||||||
const ESM::Creature *creature = environment.mWorld->getStore().creatures.search(ref->ref.soul);
|
const ESM::Creature *creature = store.creatures.search(ref->ref.soul);
|
||||||
info.caption += " (" + creature->name + ")";
|
info.caption += " (" + creature->name + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
||||||
if (ref->base->name == environment.mWorld->getStore().gameSettings.search("sGold")->str)
|
if (ref->base->name == store.gameSettings.search("sGold")->str)
|
||||||
info.caption += " (" + boost::lexical_cast<std::string>(ref->base->data.value) + ")";
|
info.caption += " (" + boost::lexical_cast<std::string>(ref->base->data.value) + ")";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
||||||
text += MWGui::ToolTips::getValueString(ref->base->data.value, environment.mWorld->getStore().gameSettings.search("sValue")->str);
|
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (environment.mWindowManager->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
||||||
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,20 +12,20 @@ namespace MWClass
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||||
///< Add reference into a cell for rendering
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const;
|
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
const MWWorld::Ptr& actor) const;
|
||||||
///< Generate action for activation
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||||
|
|
||||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
||||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||||
|
@ -36,10 +36,10 @@ namespace MWClass
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the pick up sound Id
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the put down sound Id
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,13 +14,14 @@
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontalk.hpp"
|
#include "../mwworld/actiontalk.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/customdata.hpp"
|
#include "../mwworld/customdata.hpp"
|
||||||
|
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwgui/window_manager.hpp"
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
const Ogre::Radian kOgrePi (Ogre::Math::PI);
|
const Ogre::Radian kOgrePi (Ogre::Math::PI);
|
||||||
|
@ -113,7 +114,7 @@ namespace MWClass
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Npc::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const
|
void Npc::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,14 +136,14 @@ namespace MWClass
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Npc::enable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
void Npc::enable (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
environment.mMechanicsManager->addActor (ptr);
|
MWBase::Environment::get().getMechanicsManager()->addActor (ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Npc::disable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
void Npc::disable (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
environment.mMechanicsManager->removeActor (ptr);
|
MWBase::Environment::get().getMechanicsManager()->removeActor (ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Npc::getName (const MWWorld::Ptr& ptr) const
|
std::string Npc::getName (const MWWorld::Ptr& ptr) const
|
||||||
|
@ -168,7 +169,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> Npc::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Npc::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::ActionTalk (ptr));
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::ActionTalk (ptr));
|
||||||
}
|
}
|
||||||
|
@ -309,7 +310,7 @@ namespace MWClass
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MWGui::ToolTipInfo Npc::getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
MWGui::ToolTipInfo Npc::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::NPC>();
|
ptr.get<ESM::NPC>();
|
||||||
|
@ -318,7 +319,7 @@ namespace MWClass
|
||||||
info.caption = ref->base->name;
|
info.caption = ref->base->name;
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
if (environment.mWindowManager->getFullHelp())
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp())
|
||||||
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
||||||
info.text = text;
|
info.text = text;
|
||||||
|
|
||||||
|
|
|
@ -17,12 +17,12 @@ namespace MWClass
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||||
///< Add reference into a cell for rendering
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const;
|
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual void enable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual void enable (const MWWorld::Ptr& ptr) const;
|
||||||
///< Enable reference; only does the non-rendering part
|
///< Enable reference; only does the non-rendering part
|
||||||
|
|
||||||
virtual void disable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual void disable (const MWWorld::Ptr& ptr) const;
|
||||||
///< Enable reference; only does the non-rendering part
|
///< Enable reference; only does the non-rendering part
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
|
@ -41,14 +41,14 @@ namespace MWClass
|
||||||
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||||
|
|
||||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
||||||
virtual MWWorld::InventoryStore& getInventoryStore (const MWWorld::Ptr& ptr) const;
|
virtual MWWorld::InventoryStore& getInventoryStore (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return inventory store
|
///< Return inventory store
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
const MWWorld::Ptr& actor) const;
|
||||||
///< Generate action for activation
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
|
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwgui/window_manager.hpp"
|
||||||
|
@ -35,7 +36,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Potion::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const
|
void Potion::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Potion>();
|
ptr.get<ESM::Potion>();
|
||||||
|
@ -58,9 +59,9 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> Potion::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Potion::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, MWSound::Play_NoTrack);
|
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
|
@ -89,12 +90,12 @@ namespace MWClass
|
||||||
registerClass (typeid (ESM::Potion).name(), instance);
|
registerClass (typeid (ESM::Potion).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Potion::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Potion::getUpSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
return std::string("Item Potion Up");
|
return std::string("Item Potion Up");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Potion::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Potion::getDownSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
return std::string("Item Potion Down");
|
return std::string("Item Potion Down");
|
||||||
}
|
}
|
||||||
|
@ -107,7 +108,7 @@ namespace MWClass
|
||||||
return (ref->base->name != "");
|
return (ref->base->name != "");
|
||||||
}
|
}
|
||||||
|
|
||||||
MWGui::ToolTipInfo Potion::getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
MWGui::ToolTipInfo Potion::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Potion>();
|
ptr.get<ESM::Potion>();
|
||||||
|
@ -116,12 +117,14 @@ namespace MWClass
|
||||||
info.caption = ref->base->name;
|
info.caption = ref->base->name;
|
||||||
info.icon = ref->base->icon;
|
info.icon = ref->base->icon;
|
||||||
|
|
||||||
|
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
||||||
text += MWGui::ToolTips::getValueString(ref->base->data.value, environment.mWorld->getStore().gameSettings.search("sValue")->str);
|
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
|
||||||
|
|
||||||
if (environment.mWindowManager->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
||||||
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,20 +12,20 @@ namespace MWClass
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||||
///< Add reference into a cell for rendering
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const;
|
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
const MWWorld::Ptr& actor) const;
|
||||||
///< Generate action for activation
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||||
|
|
||||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
||||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||||
|
@ -36,10 +36,10 @@ namespace MWClass
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the pick up sound Id
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the put down sound Id
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
|
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwgui/window_manager.hpp"
|
||||||
|
@ -35,7 +36,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Probe::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const
|
void Probe::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Probe>();
|
ptr.get<ESM::Probe>();
|
||||||
|
@ -58,9 +59,9 @@ namespace MWClass
|
||||||
return ref->base->name;
|
return ref->base->name;
|
||||||
}
|
}
|
||||||
boost::shared_ptr<MWWorld::Action> Probe::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Probe::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, MWSound::Play_NoTrack);
|
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
|
@ -98,12 +99,12 @@ namespace MWClass
|
||||||
registerClass (typeid (ESM::Probe).name(), instance);
|
registerClass (typeid (ESM::Probe).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Probe::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Probe::getUpSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
return std::string("Item Probe Up");
|
return std::string("Item Probe Up");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Probe::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Probe::getDownSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
return std::string("Item Probe Down");
|
return std::string("Item Probe Down");
|
||||||
}
|
}
|
||||||
|
@ -116,7 +117,7 @@ namespace MWClass
|
||||||
return (ref->base->name != "");
|
return (ref->base->name != "");
|
||||||
}
|
}
|
||||||
|
|
||||||
MWGui::ToolTipInfo Probe::getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
MWGui::ToolTipInfo Probe::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Probe>();
|
ptr.get<ESM::Probe>();
|
||||||
|
@ -125,16 +126,18 @@ namespace MWClass
|
||||||
info.caption = ref->base->name;
|
info.caption = ref->base->name;
|
||||||
info.icon = ref->base->icon;
|
info.icon = ref->base->icon;
|
||||||
|
|
||||||
|
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
||||||
/// \todo store remaining uses somewhere
|
/// \todo store remaining uses somewhere
|
||||||
|
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sUses")->str + ": " + MWGui::ToolTips::toString(ref->base->data.uses);
|
text += "\n" + store.gameSettings.search("sUses")->str + ": " + MWGui::ToolTips::toString(ref->base->data.uses);
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sQuality")->str + ": " + MWGui::ToolTips::toString(ref->base->data.quality);
|
text += "\n" + store.gameSettings.search("sQuality")->str + ": " + MWGui::ToolTips::toString(ref->base->data.quality);
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
||||||
text += MWGui::ToolTips::getValueString(ref->base->data.value, environment.mWorld->getStore().gameSettings.search("sValue")->str);
|
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
|
||||||
|
|
||||||
if (environment.mWindowManager->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
||||||
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,20 +12,20 @@ namespace MWClass
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||||
///< Add reference into a cell for rendering
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const;
|
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
const MWWorld::Ptr& actor) const;
|
||||||
///< Generate action for activation
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||||
|
|
||||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
||||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||||
|
@ -40,10 +40,10 @@ namespace MWClass
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the pick up sound Id
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the put down sound Id
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
|
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwgui/window_manager.hpp"
|
||||||
#include "../mwgui/tooltips.hpp"
|
#include "../mwgui/tooltips.hpp"
|
||||||
|
@ -34,7 +35,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Repair::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const
|
void Repair::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Repair>();
|
ptr.get<ESM::Repair>();
|
||||||
|
@ -57,9 +58,9 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> Repair::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Repair::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, MWSound::Play_NoTrack);
|
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
|
@ -88,12 +89,12 @@ namespace MWClass
|
||||||
registerClass (typeid (ESM::Repair).name(), instance);
|
registerClass (typeid (ESM::Repair).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Repair::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Repair::getUpSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
return std::string("Item Repair Up");
|
return std::string("Item Repair Up");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Repair::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Repair::getDownSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
return std::string("Item Repair Down");
|
return std::string("Item Repair Down");
|
||||||
}
|
}
|
||||||
|
@ -106,7 +107,7 @@ namespace MWClass
|
||||||
return (ref->base->name != "");
|
return (ref->base->name != "");
|
||||||
}
|
}
|
||||||
|
|
||||||
MWGui::ToolTipInfo Repair::getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
MWGui::ToolTipInfo Repair::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Repair>();
|
ptr.get<ESM::Repair>();
|
||||||
|
@ -119,12 +120,13 @@ namespace MWClass
|
||||||
|
|
||||||
/// \todo store remaining uses somewhere
|
/// \todo store remaining uses somewhere
|
||||||
|
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sUses")->str + ": " + MWGui::ToolTips::toString(ref->base->data.uses);
|
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sQuality")->str + ": " + MWGui::ToolTips::toString(ref->base->data.quality);
|
text += "\n" + store.gameSettings.search("sUses")->str + ": " + MWGui::ToolTips::toString(ref->base->data.uses);
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
text += "\n" + store.gameSettings.search("sQuality")->str + ": " + MWGui::ToolTips::toString(ref->base->data.quality);
|
||||||
text += MWGui::ToolTips::getValueString(ref->base->data.value, environment.mWorld->getStore().gameSettings.search("sValue")->str);
|
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
||||||
|
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
|
||||||
|
|
||||||
if (environment.mWindowManager->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
||||||
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,20 +12,20 @@ namespace MWClass
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||||
///< Add reference into a cell for rendering
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const;
|
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
const MWWorld::Ptr& actor) const;
|
||||||
///< Generate action for activation
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||||
|
|
||||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
||||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||||
|
@ -36,10 +36,10 @@ namespace MWClass
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the pick up sound Id
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the put down sound Id
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Static::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const
|
void Static::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Static, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Static, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Static>();
|
ptr.get<ESM::Static>();
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace MWClass
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||||
///< Add reference into a cell for rendering
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const;
|
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
|
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Weapon::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const
|
void Weapon::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Weapon>();
|
ptr.get<ESM::Weapon>();
|
||||||
|
@ -59,9 +60,9 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> Weapon::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Weapon::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, MWSound::Play_NoTrack);
|
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
|
@ -112,8 +113,7 @@ namespace MWClass
|
||||||
return std::make_pair (slots, stack);
|
return std::make_pair (slots, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Weapon::getEquipmentSkill (const MWWorld::Ptr& ptr,
|
int Weapon::getEquipmentSkill (const MWWorld::Ptr& ptr) const
|
||||||
const MWWorld::Environment& environment) const
|
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Weapon>();
|
ptr.get<ESM::Weapon>();
|
||||||
|
@ -158,7 +158,7 @@ namespace MWClass
|
||||||
registerClass (typeid (ESM::Weapon).name(), instance);
|
registerClass (typeid (ESM::Weapon).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Weapon::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Weapon::getUpSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Weapon>();
|
ptr.get<ESM::Weapon>();
|
||||||
|
@ -204,7 +204,7 @@ namespace MWClass
|
||||||
return std::string("Item Misc Up");
|
return std::string("Item Misc Up");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Weapon::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
std::string Weapon::getDownSoundId (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Weapon>();
|
ptr.get<ESM::Weapon>();
|
||||||
|
@ -258,7 +258,7 @@ namespace MWClass
|
||||||
return (ref->base->name != "");
|
return (ref->base->name != "");
|
||||||
}
|
}
|
||||||
|
|
||||||
MWGui::ToolTipInfo Weapon::getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
MWGui::ToolTipInfo Weapon::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Weapon>();
|
ptr.get<ESM::Weapon>();
|
||||||
|
@ -267,12 +267,14 @@ namespace MWClass
|
||||||
info.caption = ref->base->name;
|
info.caption = ref->base->name;
|
||||||
info.icon = ref->base->icon;
|
info.icon = ref->base->icon;
|
||||||
|
|
||||||
|
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
||||||
// weapon type & damage. arrows / bolts don't have his info.
|
// weapon type & damage. arrows / bolts don't have his info.
|
||||||
if (ref->base->data.type < 12)
|
if (ref->base->data.type < 12)
|
||||||
{
|
{
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sType")->str + " ";
|
text += "\n" + store.gameSettings.search("sType")->str + " ";
|
||||||
|
|
||||||
std::map <int, std::pair <std::string, std::string> > mapping;
|
std::map <int, std::pair <std::string, std::string> > mapping;
|
||||||
mapping[ESM::Weapon::ShortBladeOneHand] = std::make_pair("sSkillShortblade", "sOneHanded");
|
mapping[ESM::Weapon::ShortBladeOneHand] = std::make_pair("sSkillShortblade", "sOneHanded");
|
||||||
|
@ -291,29 +293,29 @@ namespace MWClass
|
||||||
std::string type = mapping[ref->base->data.type].first;
|
std::string type = mapping[ref->base->data.type].first;
|
||||||
std::string oneOrTwoHanded = mapping[ref->base->data.type].second;
|
std::string oneOrTwoHanded = mapping[ref->base->data.type].second;
|
||||||
|
|
||||||
text += environment.mWorld->getStore().gameSettings.search(type)->str +
|
text += store.gameSettings.search(type)->str +
|
||||||
((oneOrTwoHanded != "") ? ", " + environment.mWorld->getStore().gameSettings.search(oneOrTwoHanded)->str : "");
|
((oneOrTwoHanded != "") ? ", " + store.gameSettings.search(oneOrTwoHanded)->str : "");
|
||||||
|
|
||||||
// weapon damage
|
// weapon damage
|
||||||
if (ref->base->data.type >= 9)
|
if (ref->base->data.type >= 9)
|
||||||
{
|
{
|
||||||
// marksman
|
// marksman
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sAttack")->str + ": "
|
text += "\n" + store.gameSettings.search("sAttack")->str + ": "
|
||||||
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->data.chop[0]))
|
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->data.chop[0]))
|
||||||
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->data.chop[1]));
|
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->data.chop[1]));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Chop
|
// Chop
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sChop")->str + ": "
|
text += "\n" + store.gameSettings.search("sChop")->str + ": "
|
||||||
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->data.chop[0]))
|
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->data.chop[0]))
|
||||||
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->data.chop[1]));
|
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->data.chop[1]));
|
||||||
// Slash
|
// Slash
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sSlash")->str + ": "
|
text += "\n" + store.gameSettings.search("sSlash")->str + ": "
|
||||||
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->data.slash[0]))
|
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->data.slash[0]))
|
||||||
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->data.slash[1]));
|
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->data.slash[1]));
|
||||||
// Thrust
|
// Thrust
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sThrust")->str + ": "
|
text += "\n" + store.gameSettings.search("sThrust")->str + ": "
|
||||||
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->data.thrust[0]))
|
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->data.thrust[0]))
|
||||||
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->data.thrust[1]));
|
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->data.thrust[1]));
|
||||||
}
|
}
|
||||||
|
@ -321,10 +323,10 @@ namespace MWClass
|
||||||
|
|
||||||
/// \todo store the current weapon health somewhere
|
/// \todo store the current weapon health somewhere
|
||||||
if (ref->base->data.type < 11) // thrown weapons and arrows/bolts don't have health, only quantity
|
if (ref->base->data.type < 11) // thrown weapons and arrows/bolts don't have health, only quantity
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sCondition")->str + ": " + MWGui::ToolTips::toString(ref->base->data.health);
|
text += "\n" + store.gameSettings.search("sCondition")->str + ": " + MWGui::ToolTips::toString(ref->base->data.health);
|
||||||
|
|
||||||
text += "\n" + environment.mWorld->getStore().gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
|
||||||
text += MWGui::ToolTips::getValueString(ref->base->data.value, environment.mWorld->getStore().gameSettings.search("sValue")->str);
|
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
|
||||||
|
|
||||||
// this should be going into a custom mygui widget MWEnchantment
|
// this should be going into a custom mygui widget MWEnchantment
|
||||||
/*
|
/*
|
||||||
|
@ -352,11 +354,11 @@ namespace MWClass
|
||||||
*/
|
*/
|
||||||
if (ref->base->enchant != "")
|
if (ref->base->enchant != "")
|
||||||
{
|
{
|
||||||
const ESM::Enchantment* enchant = environment.mWorld->getStore().enchants.search(ref->base->enchant);
|
const ESM::Enchantment* enchant = store.enchants.search(ref->base->enchant);
|
||||||
info.enchant = enchant;
|
info.enchant = enchant;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (environment.mWindowManager->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
|
||||||
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,20 +12,20 @@ namespace MWClass
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||||
///< Add reference into a cell for rendering
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const;
|
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
const MWWorld::Ptr& actor) const;
|
||||||
///< Generate action for activation
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||||
|
|
||||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
||||||
virtual bool hasItemHealth (const MWWorld::Ptr& ptr) const;
|
virtual bool hasItemHealth (const MWWorld::Ptr& ptr) const;
|
||||||
|
@ -41,8 +41,7 @@ namespace MWClass
|
||||||
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
|
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
|
||||||
/// stay stacked when equipped?
|
/// stay stacked when equipped?
|
||||||
|
|
||||||
virtual int getEquipmentSkill (const MWWorld::Ptr& ptr,
|
virtual int getEquipmentSkill (const MWWorld::Ptr& ptr) const;
|
||||||
const MWWorld::Environment& environment) const;
|
|
||||||
/// Return the index of the skill this item corresponds to when equiopped or -1, if there is
|
/// Return the index of the skill this item corresponds to when equiopped or -1, if there is
|
||||||
/// no such skill.
|
/// no such skill.
|
||||||
|
|
||||||
|
@ -51,10 +50,10 @@ namespace MWClass
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the pick up sound Id
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return the put down sound Id
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
|
|
||||||
#include <components/esm_store/store.hpp>
|
#include <components/esm_store/store.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
#include "../mwworld/refdata.hpp"
|
#include "../mwworld/refdata.hpp"
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
|
@ -181,7 +181,7 @@ namespace MWDialogue
|
||||||
|
|
||||||
case 46://Same faction
|
case 46://Same faction
|
||||||
{
|
{
|
||||||
MWMechanics::NpcStats PCstats = MWWorld::Class::get(mEnvironment.mWorld->getPlayer().getPlayer()).getNpcStats(mEnvironment.mWorld->getPlayer().getPlayer());
|
MWMechanics::NpcStats PCstats = MWWorld::Class::get(MWBase::Environment::get().getWorld()->getPlayer().getPlayer()).getNpcStats(MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||||
MWMechanics::NpcStats NPCstats = MWWorld::Class::get(actor).getNpcStats(actor);
|
MWMechanics::NpcStats NPCstats = MWWorld::Class::get(actor).getNpcStats(actor);
|
||||||
int sameFaction = 0;
|
int sameFaction = 0;
|
||||||
if(!NPCstats.mFactionRank.empty())
|
if(!NPCstats.mFactionRank.empty())
|
||||||
|
@ -288,12 +288,12 @@ namespace MWDialogue
|
||||||
if (select.type==ESM::VT_Short || select.type==ESM::VT_Int ||
|
if (select.type==ESM::VT_Short || select.type==ESM::VT_Int ||
|
||||||
select.type==ESM::VT_Long)
|
select.type==ESM::VT_Long)
|
||||||
{
|
{
|
||||||
if (!checkGlobal (comp, toLower (name), select.i, *mEnvironment.mWorld))
|
if (!checkGlobal (comp, toLower (name), select.i, *MWBase::Environment::get().getWorld()))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (select.type==ESM::VT_Float)
|
else if (select.type==ESM::VT_Float)
|
||||||
{
|
{
|
||||||
if (!checkGlobal (comp, toLower (name), select.f, *mEnvironment.mWorld))
|
if (!checkGlobal (comp, toLower (name), select.f, *MWBase::Environment::get().getWorld()))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -308,13 +308,13 @@ namespace MWDialogue
|
||||||
select.type==ESM::VT_Long)
|
select.type==ESM::VT_Long)
|
||||||
{
|
{
|
||||||
if (!checkLocal (comp, toLower (name), select.i, actor,
|
if (!checkLocal (comp, toLower (name), select.i, actor,
|
||||||
mEnvironment.mWorld->getStore()))
|
MWBase::Environment::get().getWorld()->getStore()))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (select.type==ESM::VT_Float)
|
else if (select.type==ESM::VT_Float)
|
||||||
{
|
{
|
||||||
if (!checkLocal (comp, toLower (name), select.f, actor,
|
if (!checkLocal (comp, toLower (name), select.f, actor,
|
||||||
mEnvironment.mWorld->getStore()))
|
MWBase::Environment::get().getWorld()->getStore()))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -326,7 +326,7 @@ namespace MWDialogue
|
||||||
case '4'://journal
|
case '4'://journal
|
||||||
if(select.type==ESM::VT_Int)
|
if(select.type==ESM::VT_Int)
|
||||||
{
|
{
|
||||||
if(!selectCompare<int,int>(comp,mEnvironment.mJournal->getJournalIndex(toLower(name)),select.i)) return false;
|
if(!selectCompare<int,int>(comp,MWBase::Environment::get().getJournal()->getJournalIndex(toLower(name)),select.i)) return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::runtime_error (
|
throw std::runtime_error (
|
||||||
|
@ -336,7 +336,7 @@ namespace MWDialogue
|
||||||
|
|
||||||
case '5'://item
|
case '5'://item
|
||||||
{
|
{
|
||||||
MWWorld::Ptr player = mEnvironment.mWorld->getPlayer().getPlayer();
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||||
MWWorld::ContainerStore& store = MWWorld::Class::get (player).getContainerStore (player);
|
MWWorld::ContainerStore& store = MWWorld::Class::get (player).getContainerStore (player);
|
||||||
|
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
|
@ -424,13 +424,13 @@ namespace MWDialogue
|
||||||
select.type==ESM::VT_Long)
|
select.type==ESM::VT_Long)
|
||||||
{
|
{
|
||||||
if (checkLocal (comp, toLower (name), select.i, actor,
|
if (checkLocal (comp, toLower (name), select.i, actor,
|
||||||
mEnvironment.mWorld->getStore()))
|
MWBase::Environment::get().getWorld()->getStore()))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (select.type==ESM::VT_Float)
|
else if (select.type==ESM::VT_Float)
|
||||||
{
|
{
|
||||||
if (checkLocal (comp, toLower (name), select.f, actor,
|
if (checkLocal (comp, toLower (name), select.f, actor,
|
||||||
mEnvironment.mWorld->getStore()))
|
MWBase::Environment::get().getWorld()->getStore()))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -500,7 +500,7 @@ namespace MWDialogue
|
||||||
// TODO check player faction
|
// TODO check player faction
|
||||||
if(!info.pcFaction.empty())
|
if(!info.pcFaction.empty())
|
||||||
{
|
{
|
||||||
MWMechanics::NpcStats stats = MWWorld::Class::get(mEnvironment.mWorld->getPlayer().getPlayer()).getNpcStats(mEnvironment.mWorld->getPlayer().getPlayer());
|
MWMechanics::NpcStats stats = MWWorld::Class::get(MWBase::Environment::get().getWorld()->getPlayer().getPlayer()).getNpcStats(MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||||
std::map<std::string,int>::iterator it = stats.mFactionRank.find(info.pcFaction);
|
std::map<std::string,int>::iterator it = stats.mFactionRank.find(info.pcFaction);
|
||||||
if(it!=stats.mFactionRank.end())
|
if(it!=stats.mFactionRank.end())
|
||||||
{
|
{
|
||||||
|
@ -528,7 +528,7 @@ namespace MWDialogue
|
||||||
|
|
||||||
// check cell
|
// check cell
|
||||||
if (!info.cell.empty())
|
if (!info.cell.empty())
|
||||||
if (mEnvironment.mWorld->getPlayer().getPlayer().getCell()->cell->name != info.cell)
|
if (MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell->name != info.cell)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// TODO check DATAstruct
|
// TODO check DATAstruct
|
||||||
|
@ -540,8 +540,8 @@ namespace MWDialogue
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogueManager::DialogueManager (MWWorld::Environment& environment,const Compiler::Extensions& extensions) :
|
DialogueManager::DialogueManager (const Compiler::Extensions& extensions) :
|
||||||
mEnvironment (environment),mCompilerContext (MWScript::CompilerContext::Type_Dialgoue, environment),
|
mCompilerContext (MWScript::CompilerContext::Type_Dialgoue),
|
||||||
mErrorStream(std::cout.rdbuf()),mErrorHandler(mErrorStream)
|
mErrorStream(std::cout.rdbuf()),mErrorHandler(mErrorStream)
|
||||||
{
|
{
|
||||||
mChoice = -1;
|
mChoice = -1;
|
||||||
|
@ -549,10 +549,10 @@ namespace MWDialogue
|
||||||
mCompilerContext.setExtensions (&extensions);
|
mCompilerContext.setExtensions (&extensions);
|
||||||
mDialogueMap.clear();
|
mDialogueMap.clear();
|
||||||
actorKnownTopics.clear();
|
actorKnownTopics.clear();
|
||||||
ESMS::RecListT<ESM::Dialogue>::MapType dialogueList = mEnvironment.mWorld->getStore().dialogs.list;
|
ESMS::RecListCaseT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list;
|
||||||
for(ESMS::RecListT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
|
for(ESMS::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
|
||||||
{
|
{
|
||||||
mDialogueMap[it->first] = it->second;
|
mDialogueMap[toLower(it->first)] = it->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -592,8 +592,8 @@ namespace MWDialogue
|
||||||
actorKnownTopics.clear();
|
actorKnownTopics.clear();
|
||||||
|
|
||||||
//initialise the GUI
|
//initialise the GUI
|
||||||
mEnvironment.mInputManager->setGuiMode(MWGui::GM_Dialogue);
|
MWBase::Environment::get().getInputManager()->setGuiMode(MWGui::GM_Dialogue);
|
||||||
MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow();
|
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
||||||
win->startDialogue(MWWorld::Class::get (actor).getName (actor));
|
win->startDialogue(MWWorld::Class::get (actor).getName (actor));
|
||||||
|
|
||||||
//setup the list of topics known by the actor. Topics who are also on the knownTopics list will be added to the GUI
|
//setup the list of topics known by the actor. Topics who are also on the knownTopics list will be added to the GUI
|
||||||
|
@ -601,9 +601,9 @@ namespace MWDialogue
|
||||||
|
|
||||||
//greeting
|
//greeting
|
||||||
bool greetingFound = false;
|
bool greetingFound = false;
|
||||||
//ESMS::RecListT<ESM::Dialogue>::MapType dialogueList = mEnvironment.mWorld->getStore().dialogs.list;
|
//ESMS::RecListT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list;
|
||||||
ESMS::RecListT<ESM::Dialogue>::MapType dialogueList = mEnvironment.mWorld->getStore().dialogs.list;
|
ESMS::RecListCaseT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list;
|
||||||
for(ESMS::RecListT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
|
for(ESMS::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
|
||||||
{
|
{
|
||||||
ESM::Dialogue ndialogue = it->second;
|
ESM::Dialogue ndialogue = it->second;
|
||||||
if(ndialogue.type == ESM::Dialogue::Greeting)
|
if(ndialogue.type == ESM::Dialogue::Greeting)
|
||||||
|
@ -650,7 +650,7 @@ namespace MWDialogue
|
||||||
if (!actorScript.empty())
|
if (!actorScript.empty())
|
||||||
{
|
{
|
||||||
// grab local variables from actor's script, if available.
|
// grab local variables from actor's script, if available.
|
||||||
locals = mEnvironment.mScriptManager->getLocals (actorScript);
|
locals = MWBase::Environment::get().getScriptManager()->getLocals (actorScript);
|
||||||
}
|
}
|
||||||
|
|
||||||
Compiler::ScriptParser parser(mErrorHandler,mCompilerContext, locals, false);
|
Compiler::ScriptParser parser(mErrorHandler,mCompilerContext, locals, false);
|
||||||
|
@ -677,13 +677,12 @@ namespace MWDialogue
|
||||||
|
|
||||||
void DialogueManager::executeScript(std::string script)
|
void DialogueManager::executeScript(std::string script)
|
||||||
{
|
{
|
||||||
std::cout << script;
|
|
||||||
std::vector<Interpreter::Type_Code> code;
|
std::vector<Interpreter::Type_Code> code;
|
||||||
if(compile(script,code))
|
if(compile(script,code))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MWScript::InterpreterContext interpreterContext(mEnvironment,&mActor.getRefData().getLocals(),mActor);
|
MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor);
|
||||||
Interpreter::Interpreter interpreter;
|
Interpreter::Interpreter interpreter;
|
||||||
MWScript::installOpcodes (interpreter);
|
MWScript::installOpcodes (interpreter);
|
||||||
interpreter.run (&code[0], code.size(), interpreterContext);
|
interpreter.run (&code[0], code.size(), interpreterContext);
|
||||||
|
@ -701,9 +700,9 @@ namespace MWDialogue
|
||||||
int choice = mChoice;
|
int choice = mChoice;
|
||||||
mChoice = -1;
|
mChoice = -1;
|
||||||
actorKnownTopics.clear();
|
actorKnownTopics.clear();
|
||||||
MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow();
|
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
||||||
ESMS::RecListT<ESM::Dialogue>::MapType dialogueList = mEnvironment.mWorld->getStore().dialogs.list;
|
ESMS::RecListCaseT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list;
|
||||||
for(ESMS::RecListT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
|
for(ESMS::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
|
||||||
{
|
{
|
||||||
ESM::Dialogue ndialogue = it->second;
|
ESM::Dialogue ndialogue = it->second;
|
||||||
if(ndialogue.type == ESM::Dialogue::Topic)
|
if(ndialogue.type == ESM::Dialogue::Topic)
|
||||||
|
@ -713,7 +712,7 @@ namespace MWDialogue
|
||||||
{
|
{
|
||||||
if (isMatching (mActor, *iter) && functionFilter(mActor,*iter,true))
|
if (isMatching (mActor, *iter) && functionFilter(mActor,*iter,true))
|
||||||
{
|
{
|
||||||
actorKnownTopics.push_back(it->first);
|
actorKnownTopics.push_back(toLower(it->first));
|
||||||
//does the player know the topic?
|
//does the player know the topic?
|
||||||
if(knownTopics.find(toLower(it->first)) != knownTopics.end())
|
if(knownTopics.find(toLower(it->first)) != knownTopics.end())
|
||||||
{
|
{
|
||||||
|
@ -747,7 +746,7 @@ namespace MWDialogue
|
||||||
|
|
||||||
parseText(text);
|
parseText(text);
|
||||||
|
|
||||||
MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow();
|
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
||||||
win->addTitle(keyword);
|
win->addTitle(keyword);
|
||||||
win->addText(iter->response);
|
win->addText(iter->response);
|
||||||
|
|
||||||
|
@ -767,7 +766,7 @@ namespace MWDialogue
|
||||||
|
|
||||||
void DialogueManager::goodbyeSelected()
|
void DialogueManager::goodbyeSelected()
|
||||||
{
|
{
|
||||||
mEnvironment.mInputManager->setGuiMode(MWGui::GM_Game);
|
MWBase::Environment::get().getInputManager()->setGuiMode(MWGui::GM_Game);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueManager::questionAnswered(std::string answere)
|
void DialogueManager::questionAnswered(std::string answere)
|
||||||
|
@ -790,7 +789,7 @@ namespace MWDialogue
|
||||||
mChoiceMap.clear();
|
mChoiceMap.clear();
|
||||||
mChoice = -1;
|
mChoice = -1;
|
||||||
mIsInChoice = false;
|
mIsInChoice = false;
|
||||||
MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow();
|
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
||||||
std::string text = iter->response;
|
std::string text = iter->response;
|
||||||
parseText(text);
|
parseText(text);
|
||||||
win->addText(text);
|
win->addText(text);
|
||||||
|
@ -808,13 +807,13 @@ namespace MWDialogue
|
||||||
|
|
||||||
void DialogueManager::printError(std::string error)
|
void DialogueManager::printError(std::string error)
|
||||||
{
|
{
|
||||||
MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow();
|
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
||||||
win->addText(error);
|
win->addText(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueManager::askQuestion(std::string question, int choice)
|
void DialogueManager::askQuestion(std::string question, int choice)
|
||||||
{
|
{
|
||||||
MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow();
|
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
||||||
win->askQuestion(question);
|
win->askQuestion(question);
|
||||||
mChoiceMap[question] = choice;
|
mChoiceMap[question] = choice;
|
||||||
mIsInChoice = true;
|
mIsInChoice = true;
|
||||||
|
|
|
@ -11,17 +11,10 @@
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
namespace MWWorld
|
|
||||||
{
|
|
||||||
class Environment;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace MWDialogue
|
namespace MWDialogue
|
||||||
{
|
{
|
||||||
class DialogueManager
|
class DialogueManager
|
||||||
{
|
{
|
||||||
MWWorld::Environment& mEnvironment;
|
|
||||||
|
|
||||||
bool isMatching (const MWWorld::Ptr& actor, const ESM::DialInfo::SelectStruct& select) const;
|
bool isMatching (const MWWorld::Ptr& actor, const ESM::DialInfo::SelectStruct& select) const;
|
||||||
|
|
||||||
bool isMatching (const MWWorld::Ptr& actor, const ESM::DialInfo& info) const;
|
bool isMatching (const MWWorld::Ptr& actor, const ESM::DialInfo& info) const;
|
||||||
|
@ -55,7 +48,7 @@ namespace MWDialogue
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DialogueManager (MWWorld::Environment& environment,const Compiler::Extensions& extensions);
|
DialogueManager (const Compiler::Extensions& extensions);
|
||||||
|
|
||||||
void startDialogue (const MWWorld::Ptr& actor);
|
void startDialogue (const MWWorld::Ptr& actor);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
#include "journal.hpp"
|
#include "journal.hpp"
|
||||||
|
|
||||||
#include "../mwworld/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwgui/window_manager.hpp"
|
||||||
#include "../mwgui/messagebox.hpp"
|
#include "../mwgui/messagebox.hpp"
|
||||||
|
@ -23,31 +23,30 @@ namespace MWDialogue
|
||||||
return iter->second;
|
return iter->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
Journal::Journal (MWWorld::Environment& environment)
|
Journal::Journal()
|
||||||
: mEnvironment (environment)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void Journal::addEntry (const std::string& id, int index)
|
void Journal::addEntry (const std::string& id, int index)
|
||||||
{
|
{
|
||||||
StampedJournalEntry entry =
|
StampedJournalEntry entry =
|
||||||
StampedJournalEntry::makeFromQuest (id, index, *mEnvironment.mWorld);
|
StampedJournalEntry::makeFromQuest (id, index, *MWBase::Environment::get().getWorld());
|
||||||
|
|
||||||
mJournal.push_back (entry);
|
mJournal.push_back (entry);
|
||||||
|
|
||||||
Quest& quest = getQuest (id);
|
Quest& quest = getQuest (id);
|
||||||
|
|
||||||
quest.addEntry (entry, *mEnvironment.mWorld); // we are doing slicing on purpose here
|
quest.addEntry (entry, *MWBase::Environment::get().getWorld()); // we are doing slicing on purpose here
|
||||||
|
|
||||||
std::vector<std::string> empty;
|
std::vector<std::string> empty;
|
||||||
std::string notification = "Your Journal has been updated.";
|
std::string notification = "Your Journal has been updated.";
|
||||||
mEnvironment.mWindowManager->messageBox (notification, empty);
|
MWBase::Environment::get().getWindowManager()->messageBox (notification, empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Journal::setJournalIndex (const std::string& id, int index)
|
void Journal::setJournalIndex (const std::string& id, int index)
|
||||||
{
|
{
|
||||||
Quest& quest = getQuest (id);
|
Quest& quest = getQuest (id);
|
||||||
|
|
||||||
quest.setIndex (index, *mEnvironment.mWorld);
|
quest.setIndex (index, *MWBase::Environment::get().getWorld());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Journal::addTopic (const std::string& topicId, const std::string& infoId)
|
void Journal::addTopic (const std::string& topicId, const std::string& infoId)
|
||||||
|
@ -62,7 +61,7 @@ namespace MWDialogue
|
||||||
iter = result.first;
|
iter = result.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
iter->second.addEntry (JournalEntry (topicId, infoId), *mEnvironment.mWorld);
|
iter->second.addEntry (JournalEntry (topicId, infoId), *MWBase::Environment::get().getWorld());
|
||||||
}
|
}
|
||||||
|
|
||||||
int Journal::getJournalIndex (const std::string& id) const
|
int Journal::getJournalIndex (const std::string& id) const
|
||||||
|
|
|
@ -8,11 +8,6 @@
|
||||||
#include "journalentry.hpp"
|
#include "journalentry.hpp"
|
||||||
#include "quest.hpp"
|
#include "quest.hpp"
|
||||||
|
|
||||||
namespace MWWorld
|
|
||||||
{
|
|
||||||
struct Environment;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace MWDialogue
|
namespace MWDialogue
|
||||||
{
|
{
|
||||||
/// \brief The player's journal
|
/// \brief The player's journal
|
||||||
|
@ -29,7 +24,6 @@ namespace MWDialogue
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
MWWorld::Environment& mEnvironment;
|
|
||||||
TEntryContainer mJournal;
|
TEntryContainer mJournal;
|
||||||
TQuestContainer mQuests;
|
TQuestContainer mQuests;
|
||||||
TTopicContainer mTopics;
|
TTopicContainer mTopics;
|
||||||
|
@ -38,7 +32,7 @@ namespace MWDialogue
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Journal (MWWorld::Environment& environment);
|
Journal();
|
||||||
|
|
||||||
void addEntry (const std::string& id, int index);
|
void addEntry (const std::string& id, int index);
|
||||||
///< Add a journal entry.
|
///< Add a journal entry.
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include "dialogue.hpp"
|
#include "dialogue.hpp"
|
||||||
#include "mode.hpp"
|
#include "mode.hpp"
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
struct Step
|
struct Step
|
||||||
|
@ -93,7 +95,7 @@ namespace
|
||||||
|
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
|
|
||||||
CharacterCreation::CharacterCreation(WindowManager* _wm, MWWorld::Environment* _environment)
|
CharacterCreation::CharacterCreation(WindowManager* _wm)
|
||||||
: mNameDialog(0)
|
: mNameDialog(0)
|
||||||
, mRaceDialog(0)
|
, mRaceDialog(0)
|
||||||
, mDialogueWindow(0)
|
, mDialogueWindow(0)
|
||||||
|
@ -105,7 +107,6 @@ CharacterCreation::CharacterCreation(WindowManager* _wm, MWWorld::Environment* _
|
||||||
, mBirthSignDialog(0)
|
, mBirthSignDialog(0)
|
||||||
, mReviewDialog(0)
|
, mReviewDialog(0)
|
||||||
, mWM(_wm)
|
, mWM(_wm)
|
||||||
, mEnvironment(_environment)
|
|
||||||
{
|
{
|
||||||
mCreationStage = CSE_NotStarted;
|
mCreationStage = CSE_NotStarted;
|
||||||
}
|
}
|
||||||
|
@ -279,8 +280,8 @@ void CharacterCreation::onPickClassDialogDone(WindowBase* parWindow)
|
||||||
{
|
{
|
||||||
const std::string &classId = mPickClassDialog->getClassId();
|
const std::string &classId = mPickClassDialog->getClassId();
|
||||||
if (!classId.empty())
|
if (!classId.empty())
|
||||||
mEnvironment->mMechanicsManager->setPlayerClass(classId);
|
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(classId);
|
||||||
const ESM::Class *klass = mEnvironment->mWorld->getStore().classes.find(classId);
|
const ESM::Class *klass = MWBase::Environment::get().getWorld()->getStore().classes.find(classId);
|
||||||
if (klass)
|
if (klass)
|
||||||
{
|
{
|
||||||
mPlayerClass = *klass;
|
mPlayerClass = *klass;
|
||||||
|
@ -307,7 +308,7 @@ void CharacterCreation::onPickClassDialogBack()
|
||||||
{
|
{
|
||||||
const std::string classId = mPickClassDialog->getClassId();
|
const std::string classId = mPickClassDialog->getClassId();
|
||||||
if (!classId.empty())
|
if (!classId.empty())
|
||||||
mEnvironment->mMechanicsManager->setPlayerClass(classId);
|
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(classId);
|
||||||
mWM->removeDialog(mPickClassDialog);
|
mWM->removeDialog(mPickClassDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,7 +346,7 @@ void CharacterCreation::onNameDialogDone(WindowBase* parWindow)
|
||||||
{
|
{
|
||||||
mPlayerName = mNameDialog->getTextInput();
|
mPlayerName = mNameDialog->getTextInput();
|
||||||
mWM->setValue("name", mPlayerName);
|
mWM->setValue("name", mPlayerName);
|
||||||
mEnvironment->mMechanicsManager->setPlayerName(mPlayerName);
|
MWBase::Environment::get().getMechanicsManager()->setPlayerName(mPlayerName);
|
||||||
mWM->removeDialog(mNameDialog);
|
mWM->removeDialog(mNameDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,7 +367,7 @@ void CharacterCreation::onRaceDialogBack()
|
||||||
{
|
{
|
||||||
mPlayerRaceId = mRaceDialog->getRaceId();
|
mPlayerRaceId = mRaceDialog->getRaceId();
|
||||||
if (!mPlayerRaceId.empty())
|
if (!mPlayerRaceId.empty())
|
||||||
mEnvironment->mMechanicsManager->setPlayerRace(mPlayerRaceId, mRaceDialog->getGender() == RaceDialog::GM_Male);
|
MWBase::Environment::get().getMechanicsManager()->setPlayerRace(mPlayerRaceId, mRaceDialog->getGender() == RaceDialog::GM_Male);
|
||||||
mWM->removeDialog(mRaceDialog);
|
mWM->removeDialog(mRaceDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,7 +381,7 @@ void CharacterCreation::onRaceDialogDone(WindowBase* parWindow)
|
||||||
mPlayerRaceId = mRaceDialog->getRaceId();
|
mPlayerRaceId = mRaceDialog->getRaceId();
|
||||||
mWM->setValue("race", mPlayerRaceId);
|
mWM->setValue("race", mPlayerRaceId);
|
||||||
if (!mPlayerRaceId.empty())
|
if (!mPlayerRaceId.empty())
|
||||||
mEnvironment->mMechanicsManager->setPlayerRace(mPlayerRaceId, mRaceDialog->getGender() == RaceDialog::GM_Male);
|
MWBase::Environment::get().getMechanicsManager()->setPlayerRace(mPlayerRaceId, mRaceDialog->getGender() == RaceDialog::GM_Male);
|
||||||
mWM->removeDialog(mRaceDialog);
|
mWM->removeDialog(mRaceDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,7 +403,7 @@ void CharacterCreation::onBirthSignDialogDone(WindowBase* parWindow)
|
||||||
mPlayerBirthSignId = mBirthSignDialog->getBirthId();
|
mPlayerBirthSignId = mBirthSignDialog->getBirthId();
|
||||||
mWM->setBirthSign(mPlayerBirthSignId);
|
mWM->setBirthSign(mPlayerBirthSignId);
|
||||||
if (!mPlayerBirthSignId.empty())
|
if (!mPlayerBirthSignId.empty())
|
||||||
mEnvironment->mMechanicsManager->setPlayerBirthsign(mPlayerBirthSignId);
|
MWBase::Environment::get().getMechanicsManager()->setPlayerBirthsign(mPlayerBirthSignId);
|
||||||
mWM->removeDialog(mBirthSignDialog);
|
mWM->removeDialog(mBirthSignDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,7 +420,7 @@ void CharacterCreation::onBirthSignDialogBack()
|
||||||
{
|
{
|
||||||
if (mBirthSignDialog)
|
if (mBirthSignDialog)
|
||||||
{
|
{
|
||||||
mEnvironment->mMechanicsManager->setPlayerBirthsign(mBirthSignDialog->getBirthId());
|
MWBase::Environment::get().getMechanicsManager()->setPlayerBirthsign(mBirthSignDialog->getBirthId());
|
||||||
mWM->removeDialog(mBirthSignDialog);
|
mWM->removeDialog(mBirthSignDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,7 +451,7 @@ void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow)
|
||||||
klass.data.skills[i][1] = majorSkills[i];
|
klass.data.skills[i][1] = majorSkills[i];
|
||||||
klass.data.skills[i][0] = minorSkills[i];
|
klass.data.skills[i][0] = minorSkills[i];
|
||||||
}
|
}
|
||||||
mEnvironment->mMechanicsManager->setPlayerClass(klass);
|
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(klass);
|
||||||
mPlayerClass = klass;
|
mPlayerClass = klass;
|
||||||
mWM->setPlayerClass(klass);
|
mWM->setPlayerClass(klass);
|
||||||
|
|
||||||
|
@ -592,7 +593,7 @@ void CharacterCreation::onGenerateClassBack()
|
||||||
|
|
||||||
if (mGenerateClassResultDialog)
|
if (mGenerateClassResultDialog)
|
||||||
mWM->removeDialog(mGenerateClassResultDialog);
|
mWM->removeDialog(mGenerateClassResultDialog);
|
||||||
mEnvironment->mMechanicsManager->setPlayerClass(mGenerateClass);
|
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass);
|
||||||
|
|
||||||
mWM->setGuiMode(GM_Class);
|
mWM->setGuiMode(GM_Class);
|
||||||
}
|
}
|
||||||
|
@ -601,7 +602,7 @@ void CharacterCreation::onGenerateClassDone(WindowBase* parWindow)
|
||||||
{
|
{
|
||||||
if (mGenerateClassResultDialog)
|
if (mGenerateClassResultDialog)
|
||||||
mWM->removeDialog(mGenerateClassResultDialog);
|
mWM->removeDialog(mGenerateClassResultDialog);
|
||||||
mEnvironment->mMechanicsManager->setPlayerClass(mGenerateClass);
|
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass);
|
||||||
|
|
||||||
if (mCreationStage == CSE_ReviewNext)
|
if (mCreationStage == CSE_ReviewNext)
|
||||||
mWM->setGuiMode(GM_Review);
|
mWM->setGuiMode(GM_Review);
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
typedef std::vector<int> SkillList;
|
typedef std::vector<int> SkillList;
|
||||||
|
|
||||||
CharacterCreation(WindowManager* _wm, MWWorld::Environment* _environment);
|
CharacterCreation(WindowManager* _wm);
|
||||||
~CharacterCreation();
|
~CharacterCreation();
|
||||||
|
|
||||||
//Show a dialog
|
//Show a dialog
|
||||||
|
@ -56,7 +56,6 @@ namespace MWGui
|
||||||
ReviewDialog* mReviewDialog;
|
ReviewDialog* mReviewDialog;
|
||||||
|
|
||||||
WindowManager* mWM;
|
WindowManager* mWM;
|
||||||
MWWorld::Environment* mEnvironment;
|
|
||||||
|
|
||||||
//Player data
|
//Player data
|
||||||
std::string mPlayerName;
|
std::string mPlayerName;
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
#include "../mwscript/extensions.hpp"
|
#include "../mwscript/extensions.hpp"
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
class ConsoleInterpreterContext : public MWScript::InterpreterContext
|
class ConsoleInterpreterContext : public MWScript::InterpreterContext
|
||||||
|
@ -15,15 +17,14 @@ namespace MWGui
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ConsoleInterpreterContext (Console& console, MWWorld::Environment& environment,
|
ConsoleInterpreterContext (Console& console, MWWorld::Ptr reference);
|
||||||
MWWorld::Ptr reference);
|
|
||||||
|
|
||||||
virtual void report (const std::string& message);
|
virtual void report (const std::string& message);
|
||||||
};
|
};
|
||||||
|
|
||||||
ConsoleInterpreterContext::ConsoleInterpreterContext (Console& console,
|
ConsoleInterpreterContext::ConsoleInterpreterContext (Console& console,
|
||||||
MWWorld::Environment& environment, MWWorld::Ptr reference)
|
MWWorld::Ptr reference)
|
||||||
: MWScript::InterpreterContext (environment,
|
: MWScript::InterpreterContext (
|
||||||
reference.isEmpty() ? 0 : &reference.getRefData().getLocals(), reference),
|
reference.isEmpty() ? 0 : &reference.getRefData().getLocals(), reference),
|
||||||
mConsole (console)
|
mConsole (console)
|
||||||
{}
|
{}
|
||||||
|
@ -88,7 +89,7 @@ namespace MWGui
|
||||||
scanner.listKeywords (mNames);
|
scanner.listKeywords (mNames);
|
||||||
|
|
||||||
// identifier
|
// identifier
|
||||||
const ESMS::ESMStore& store = mEnvironment.mWorld->getStore();
|
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
|
||||||
for (ESMS::RecListList::const_iterator iter (store.recLists.begin());
|
for (ESMS::RecListList::const_iterator iter (store.recLists.begin());
|
||||||
iter!=store.recLists.end(); ++iter)
|
iter!=store.recLists.end(); ++iter)
|
||||||
|
@ -101,11 +102,9 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Console::Console(int w, int h, MWWorld::Environment& environment,
|
Console::Console(int w, int h, const Compiler::Extensions& extensions)
|
||||||
const Compiler::Extensions& extensions)
|
|
||||||
: Layout("openmw_console_layout.xml"),
|
: Layout("openmw_console_layout.xml"),
|
||||||
mCompilerContext (MWScript::CompilerContext::Type_Console, environment),
|
mCompilerContext (MWScript::CompilerContext::Type_Console)
|
||||||
mEnvironment (environment)
|
|
||||||
{
|
{
|
||||||
setCoord(10,10, w-10, h/2);
|
setCoord(10,10, w-10, h/2);
|
||||||
|
|
||||||
|
@ -241,7 +240,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ConsoleInterpreterContext interpreterContext (*this, mEnvironment, MWWorld::Ptr());
|
ConsoleInterpreterContext interpreterContext (*this, MWWorld::Ptr());
|
||||||
Interpreter::Interpreter interpreter;
|
Interpreter::Interpreter interpreter;
|
||||||
MWScript::installOpcodes (interpreter);
|
MWScript::installOpcodes (interpreter);
|
||||||
std::vector<Interpreter::Type_Code> code;
|
std::vector<Interpreter::Type_Code> code;
|
||||||
|
|
|
@ -23,7 +23,6 @@ namespace MWGui
|
||||||
private:
|
private:
|
||||||
|
|
||||||
MWScript::CompilerContext mCompilerContext;
|
MWScript::CompilerContext mCompilerContext;
|
||||||
MWWorld::Environment& mEnvironment;
|
|
||||||
std::vector<std::string> mNames;
|
std::vector<std::string> mNames;
|
||||||
|
|
||||||
bool compile (const std::string& cmd, Compiler::Output& output);
|
bool compile (const std::string& cmd, Compiler::Output& output);
|
||||||
|
@ -51,7 +50,7 @@ namespace MWGui
|
||||||
StringList::iterator current;
|
StringList::iterator current;
|
||||||
std::string editString;
|
std::string editString;
|
||||||
|
|
||||||
Console(int w, int h, MWWorld::Environment& environment, const Compiler::Extensions& extensions);
|
Console(int w, int h, const Compiler::Extensions& extensions);
|
||||||
|
|
||||||
void enable();
|
void enable();
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "window_manager.hpp"
|
#include "window_manager.hpp"
|
||||||
#include "widgets.hpp"
|
#include "widgets.hpp"
|
||||||
#include "components/esm_store/store.hpp"
|
#include "components/esm_store/store.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwdialogue/dialoguemanager.hpp"
|
#include "../mwdialogue/dialoguemanager.hpp"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -36,9 +36,8 @@ std::string::size_type find_str_ci(const std::string& str, const std::string& su
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DialogueWindow::DialogueWindow(WindowManager& parWindowManager,MWWorld::Environment& environment)
|
DialogueWindow::DialogueWindow(WindowManager& parWindowManager)
|
||||||
: WindowBase("openmw_dialogue_window_layout.xml", parWindowManager),
|
: WindowBase("openmw_dialogue_window_layout.xml", parWindowManager)
|
||||||
mEnvironment(environment)
|
|
||||||
{
|
{
|
||||||
// Centre dialog
|
// Centre dialog
|
||||||
center();
|
center();
|
||||||
|
@ -83,9 +82,9 @@ void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender)
|
||||||
if(color != "#B29154")
|
if(color != "#B29154")
|
||||||
{
|
{
|
||||||
UString key = history->getColorTextAt(cursorPosition);
|
UString key = history->getColorTextAt(cursorPosition);
|
||||||
if(color == "#686EBA") mEnvironment.mDialogueManager->keywordSelected(lower_string(key));
|
if(color == "#686EBA") MWBase::Environment::get().getDialogueManager()->keywordSelected(lower_string(key));
|
||||||
|
|
||||||
if(color == "#572D21") mEnvironment.mDialogueManager->questionAnswered(key);
|
if(color == "#572D21") MWBase::Environment::get().getDialogueManager()->questionAnswered(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +99,7 @@ void DialogueWindow::open()
|
||||||
|
|
||||||
void DialogueWindow::onByeClicked(MyGUI::Widget* _sender)
|
void DialogueWindow::onByeClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
mEnvironment.mDialogueManager->goodbyeSelected();
|
MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueWindow::onSelectTopic(MyGUI::ListBox* _sender, size_t _index)
|
void DialogueWindow::onSelectTopic(MyGUI::ListBox* _sender, size_t _index)
|
||||||
|
@ -108,7 +107,7 @@ void DialogueWindow::onSelectTopic(MyGUI::ListBox* _sender, size_t _index)
|
||||||
if (_index == MyGUI::ITEM_NONE)
|
if (_index == MyGUI::ITEM_NONE)
|
||||||
return;
|
return;
|
||||||
std::string topic = _sender->getItemNameAt(_index);
|
std::string topic = _sender->getItemNameAt(_index);
|
||||||
mEnvironment.mDialogueManager->keywordSelected(lower_string(topic));
|
MWBase::Environment::get().getDialogueManager()->keywordSelected(lower_string(topic));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueWindow::startDialogue(std::string npcName)
|
void DialogueWindow::startDialogue(std::string npcName)
|
||||||
|
@ -183,6 +182,16 @@ void DialogueWindow::addText(std::string text)
|
||||||
|
|
||||||
void DialogueWindow::addTitle(std::string text)
|
void DialogueWindow::addTitle(std::string text)
|
||||||
{
|
{
|
||||||
|
// This is called from the dialogue manager, so text is
|
||||||
|
// case-smashed - thus we have to retrieve the correct case
|
||||||
|
// of the text through the topic list.
|
||||||
|
for (size_t i=0; i<topicsList->getItemCount(); ++i)
|
||||||
|
{
|
||||||
|
std::string item = topicsList->getItemNameAt(i);
|
||||||
|
if (lower_string(item) == text)
|
||||||
|
text = item;
|
||||||
|
}
|
||||||
|
|
||||||
history->addDialogHeading(text);
|
history->addDialogHeading(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,6 @@ namespace MWGui
|
||||||
class WindowManager;
|
class WindowManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MWWorld
|
|
||||||
{
|
|
||||||
class Environment;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This file contains the dialouge window
|
This file contains the dialouge window
|
||||||
Layout is defined by resources/mygui/openmw_dialogue_window_layout.xml.
|
Layout is defined by resources/mygui/openmw_dialogue_window_layout.xml.
|
||||||
|
@ -23,17 +18,15 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
class DialogueHistory;
|
class DialogueHistory;
|
||||||
|
|
||||||
using namespace MyGUI;
|
|
||||||
|
|
||||||
class DialogueWindow: public WindowBase
|
class DialogueWindow: public WindowBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DialogueWindow(WindowManager& parWindowManager,MWWorld::Environment& environment);
|
DialogueWindow(WindowManager& parWindowManager);
|
||||||
|
|
||||||
void open();
|
void open();
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
||||||
|
|
||||||
/** Event : Dialog finished, OK button clicked.\n
|
/** Event : Dialog finished, OK button clicked.\n
|
||||||
signature : void method()\n
|
signature : void method()\n
|
||||||
|
@ -65,8 +58,6 @@ namespace MWGui
|
||||||
MyGUI::ProgressPtr pDispositionBar;
|
MyGUI::ProgressPtr pDispositionBar;
|
||||||
MyGUI::EditPtr pDispositionText;
|
MyGUI::EditPtr pDispositionText;
|
||||||
std::map<std::string,std::string> pTopicsText;// this map links keyword and "real" text.
|
std::map<std::string,std::string> pTopicsText;// this map links keyword and "real" text.
|
||||||
|
|
||||||
MWWorld::Environment& mEnvironment;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "journalwindow.hpp"
|
#include "journalwindow.hpp"
|
||||||
#include "window_manager.hpp"
|
#include "window_manager.hpp"
|
||||||
#include "../mwdialogue/journal.hpp"
|
#include "../mwdialogue/journal.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
#include "../mwsound/soundmanager.hpp"
|
#include "../mwsound/soundmanager.hpp"
|
||||||
|
@ -118,20 +118,20 @@ void MWGui::JournalWindow::open()
|
||||||
{
|
{
|
||||||
mPageNumber = 0;
|
mPageNumber = 0;
|
||||||
std::string journalOpenSound = "book open";
|
std::string journalOpenSound = "book open";
|
||||||
mWindowManager.getEnvironment().mSoundManager->playSound (journalOpenSound, 1.0, 1.0);
|
MWBase::Environment::get().getSoundManager()->playSound (journalOpenSound, 1.0, 1.0);
|
||||||
if(mWindowManager.getEnvironment().mJournal->begin()!=mWindowManager.getEnvironment().mJournal->end())
|
if(MWBase::Environment::get().getJournal()->begin()!=MWBase::Environment::get().getJournal()->end())
|
||||||
{
|
{
|
||||||
book journal;
|
book journal;
|
||||||
journal.endLine = 0;
|
journal.endLine = 0;
|
||||||
|
|
||||||
for(std::deque<MWDialogue::StampedJournalEntry>::const_iterator it = mWindowManager.getEnvironment().mJournal->begin();it!=mWindowManager.getEnvironment().mJournal->end();it++)
|
for(std::deque<MWDialogue::StampedJournalEntry>::const_iterator it = MWBase::Environment::get().getJournal()->begin();it!=MWBase::Environment::get().getJournal()->end();it++)
|
||||||
{
|
{
|
||||||
std::string a = it->getText(mWindowManager.getEnvironment().mWorld->getStore());
|
std::string a = it->getText(MWBase::Environment::get().getWorld()->getStore());
|
||||||
journal = formatText(a,journal,10,17);
|
journal = formatText(a,journal,10,17);
|
||||||
journal.endLine = journal.endLine +1;
|
journal.endLine = journal.endLine +1;
|
||||||
journal.pages.back() = journal.pages.back() + std::string("\n");
|
journal.pages.back() = journal.pages.back() + std::string("\n");
|
||||||
}
|
}
|
||||||
//std::string a = mWindowManager.getEnvironment().mJournal->begin()->getText(mWindowManager.getEnvironment().mWorld->getStore());
|
//std::string a = MWBase::Environment::get().getJournal()->begin()->getText(MWBase::Environment::get().getWorld()->getStore());
|
||||||
//std::list<std::string> journal = formatText(a,10,20,1);
|
//std::list<std::string> journal = formatText(a,10,20,1);
|
||||||
bool left = true;
|
bool left = true;
|
||||||
for(std::list<std::string>::iterator it = journal.pages.begin(); it != journal.pages.end();it++)
|
for(std::list<std::string>::iterator it = journal.pages.begin(); it != journal.pages.end();it++)
|
||||||
|
@ -155,7 +155,7 @@ void MWGui::JournalWindow::open()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//std::cout << mWindowManager.getEnvironment().mJournal->begin()->getText(mWindowManager.getEnvironment().mWorld->getStore());
|
//std::cout << MWBase::Environment::get().getJournal()->begin()->getText(MWBase::Environment::get().getWorld()->getStore());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ void MWGui::JournalWindow::notifyNextPage(MyGUI::WidgetPtr _sender)
|
||||||
if(mPageNumber < int(leftPages.size())-1)
|
if(mPageNumber < int(leftPages.size())-1)
|
||||||
{
|
{
|
||||||
std::string nextSound = "book page2";
|
std::string nextSound = "book page2";
|
||||||
mWindowManager.getEnvironment().mSoundManager->playSound (nextSound, 1.0, 1.0);
|
MWBase::Environment::get().getSoundManager()->playSound (nextSound, 1.0, 1.0);
|
||||||
mPageNumber = mPageNumber + 1;
|
mPageNumber = mPageNumber + 1;
|
||||||
displayLeftText(leftPages[mPageNumber]);
|
displayLeftText(leftPages[mPageNumber]);
|
||||||
displayRightText(rightPages[mPageNumber]);
|
displayRightText(rightPages[mPageNumber]);
|
||||||
|
@ -193,7 +193,7 @@ void MWGui::JournalWindow::notifyPrevPage(MyGUI::WidgetPtr _sender)
|
||||||
if(mPageNumber > 0)
|
if(mPageNumber > 0)
|
||||||
{
|
{
|
||||||
std::string prevSound = "book page";
|
std::string prevSound = "book page";
|
||||||
mWindowManager.getEnvironment().mSoundManager->playSound (prevSound, 1.0, 1.0);
|
MWBase::Environment::get().getSoundManager()->playSound (prevSound, 1.0, 1.0);
|
||||||
mPageNumber = mPageNumber - 1;
|
mPageNumber = mPageNumber - 1;
|
||||||
displayLeftText(leftPages[mPageNumber]);
|
displayLeftText(leftPages[mPageNumber]);
|
||||||
displayRightText(rightPages[mPageNumber]);
|
displayRightText(rightPages[mPageNumber]);
|
||||||
|
|
|
@ -145,7 +145,7 @@ IntSize ToolTips::getToolTipViaPtr ()
|
||||||
{
|
{
|
||||||
mDynamicToolTipBox->setVisible(true);
|
mDynamicToolTipBox->setVisible(true);
|
||||||
|
|
||||||
ToolTipInfo info = object.getToolTipInfo(mFocusObject, mWindowManager->getEnvironment());
|
ToolTipInfo info = object.getToolTipInfo(mFocusObject);
|
||||||
tooltipSize = createToolTip(info);
|
tooltipSize = createToolTip(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||||
#include "../mwinput/inputmanager.hpp"
|
#include "../mwinput/inputmanager.hpp"
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "console.hpp"
|
#include "console.hpp"
|
||||||
#include "journalwindow.hpp"
|
#include "journalwindow.hpp"
|
||||||
#include "charactercreation.hpp"
|
#include "charactercreation.hpp"
|
||||||
|
@ -24,10 +26,9 @@
|
||||||
|
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
|
|
||||||
WindowManager::WindowManager(MWWorld::Environment& environment,
|
WindowManager::WindowManager(
|
||||||
const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string logpath)
|
const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string logpath)
|
||||||
: mGuiManager(NULL)
|
: mGuiManager(NULL)
|
||||||
, environment(environment)
|
|
||||||
, hud(NULL)
|
, hud(NULL)
|
||||||
, map(NULL)
|
, map(NULL)
|
||||||
, menu(NULL)
|
, menu(NULL)
|
||||||
|
@ -78,16 +79,16 @@ WindowManager::WindowManager(MWWorld::Environment& environment,
|
||||||
menu = new MainMenu(w,h);
|
menu = new MainMenu(w,h);
|
||||||
map = new MapWindow(*this);
|
map = new MapWindow(*this);
|
||||||
stats = new StatsWindow(*this);
|
stats = new StatsWindow(*this);
|
||||||
console = new Console(w,h, environment, extensions);
|
console = new Console(w,h, extensions);
|
||||||
mJournal = new JournalWindow(*this);
|
mJournal = new JournalWindow(*this);
|
||||||
mMessageBoxManager = new MessageBoxManager(this);
|
mMessageBoxManager = new MessageBoxManager(this);
|
||||||
dialogueWindow = new DialogueWindow(*this,environment);
|
dialogueWindow = new DialogueWindow(*this);
|
||||||
mToolTips = new ToolTips(this);
|
mToolTips = new ToolTips(this);
|
||||||
|
|
||||||
// The HUD is always on
|
// The HUD is always on
|
||||||
hud->setVisible(true);
|
hud->setVisible(true);
|
||||||
|
|
||||||
mCharGen = new CharacterCreation(this, &environment);
|
mCharGen = new CharacterCreation(this);
|
||||||
|
|
||||||
// Setup player stats
|
// Setup player stats
|
||||||
for (int i = 0; i < ESM::Attribute::Length; ++i)
|
for (int i = 0; i < ESM::Attribute::Length; ++i)
|
||||||
|
@ -147,7 +148,7 @@ void WindowManager::update()
|
||||||
if (needModeChange)
|
if (needModeChange)
|
||||||
{
|
{
|
||||||
needModeChange = false;
|
needModeChange = false;
|
||||||
environment.mInputManager->setGuiMode(nextMode);
|
MWBase::Environment::get().getInputManager()->setGuiMode(nextMode);
|
||||||
nextMode = GM_Game;
|
nextMode = GM_Game;
|
||||||
}
|
}
|
||||||
if (showFPSLevel > 0)
|
if (showFPSLevel > 0)
|
||||||
|
@ -158,11 +159,6 @@ void WindowManager::update()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MWWorld::Environment& WindowManager::getEnvironment()
|
|
||||||
{
|
|
||||||
return environment;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WindowManager::setNextMode(GuiMode newMode)
|
void WindowManager::setNextMode(GuiMode newMode)
|
||||||
{
|
{
|
||||||
nextMode = newMode;
|
nextMode = newMode;
|
||||||
|
@ -171,7 +167,7 @@ void WindowManager::setNextMode(GuiMode newMode)
|
||||||
|
|
||||||
void WindowManager::setGuiMode(GuiMode newMode)
|
void WindowManager::setGuiMode(GuiMode newMode)
|
||||||
{
|
{
|
||||||
environment.mInputManager->setGuiMode(newMode);
|
MWBase::Environment::get().getInputManager()->setGuiMode(newMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::updateVisible()
|
void WindowManager::updateVisible()
|
||||||
|
@ -397,7 +393,7 @@ int WindowManager::readPressedButton ()
|
||||||
|
|
||||||
const std::string &WindowManager::getGameSettingString(const std::string &id, const std::string &default_)
|
const std::string &WindowManager::getGameSettingString(const std::string &id, const std::string &default_)
|
||||||
{
|
{
|
||||||
const ESM::GameSetting *setting = environment.mWorld->getStore().gameSettings.search(id);
|
const ESM::GameSetting *setting = MWBase::Environment::get().getWorld()->getStore().gameSettings.search(id);
|
||||||
if (setting && setting->type == ESM::VT_String)
|
if (setting && setting->type == ESM::VT_String)
|
||||||
return setting->str;
|
return setting->str;
|
||||||
return default_;
|
return default_;
|
||||||
|
@ -422,7 +418,7 @@ void WindowManager::onFrame (float frameDuration)
|
||||||
|
|
||||||
const ESMS::ESMStore& WindowManager::getStore() const
|
const ESMS::ESMStore& WindowManager::getStore() const
|
||||||
{
|
{
|
||||||
return environment.mWorld->getStore();
|
return MWBase::Environment::get().getWorld()->getStore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell)
|
void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell)
|
||||||
|
@ -434,7 +430,7 @@ void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell)
|
||||||
name = cell->cell->name;
|
name = cell->cell->name;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const ESM::Region* region = environment.mWorld->getStore().regions.search(cell->cell->region);
|
const ESM::Region* region = MWBase::Environment::get().getWorld()->getStore().regions.search(cell->cell->region);
|
||||||
name = region->name;
|
name = region->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,6 @@ namespace Compiler
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
class Environment;
|
|
||||||
class World;
|
class World;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +83,7 @@ namespace MWGui
|
||||||
typedef std::vector<Faction> FactionList;
|
typedef std::vector<Faction> FactionList;
|
||||||
typedef std::vector<int> SkillList;
|
typedef std::vector<int> SkillList;
|
||||||
|
|
||||||
WindowManager(MWWorld::Environment& environment, const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string logpath);
|
WindowManager(const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string logpath);
|
||||||
virtual ~WindowManager();
|
virtual ~WindowManager();
|
||||||
|
|
||||||
void setGuiMode(GuiMode newMode);
|
void setGuiMode(GuiMode newMode);
|
||||||
|
@ -96,8 +95,6 @@ namespace MWGui
|
||||||
*/
|
*/
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
MWWorld::Environment& getEnvironment();
|
|
||||||
|
|
||||||
void setMode(GuiMode newMode)
|
void setMode(GuiMode newMode)
|
||||||
{
|
{
|
||||||
if (newMode==GM_Inventory && allowed==GW_None)
|
if (newMode==GM_Inventory && allowed==GW_None)
|
||||||
|
@ -197,7 +194,6 @@ namespace MWGui
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OEngine::GUI::MyGUIManager *mGuiManager;
|
OEngine::GUI::MyGUIManager *mGuiManager;
|
||||||
MWWorld::Environment& environment;
|
|
||||||
HUD *hud;
|
HUD *hud;
|
||||||
MapWindow *map;
|
MapWindow *map;
|
||||||
MainMenu *menu;
|
MainMenu *menu;
|
||||||
|
|
|
@ -97,6 +97,8 @@ namespace MWInput
|
||||||
|
|
||||||
void toggleSpell()
|
void toggleSpell()
|
||||||
{
|
{
|
||||||
|
if (windows.isGuiMode()) return;
|
||||||
|
|
||||||
DrawState state = player.getDrawState();
|
DrawState state = player.getDrawState();
|
||||||
if (state == DrawState_Weapon || state == DrawState_Nothing)
|
if (state == DrawState_Weapon || state == DrawState_Nothing)
|
||||||
{
|
{
|
||||||
|
@ -108,11 +110,12 @@ namespace MWInput
|
||||||
player.setDrawState(DrawState_Nothing);
|
player.setDrawState(DrawState_Nothing);
|
||||||
std::cout << "Player does not have any kind of attack ready now.\n";
|
std::cout << "Player does not have any kind of attack ready now.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleWeapon()
|
void toggleWeapon()
|
||||||
{
|
{
|
||||||
|
if (windows.isGuiMode()) return;
|
||||||
|
|
||||||
DrawState state = player.getDrawState();
|
DrawState state = player.getDrawState();
|
||||||
if (state == DrawState_Spell || state == DrawState_Nothing)
|
if (state == DrawState_Spell || state == DrawState_Nothing)
|
||||||
{
|
{
|
||||||
|
@ -124,7 +127,6 @@ namespace MWInput
|
||||||
player.setDrawState(DrawState_Nothing);
|
player.setDrawState(DrawState_Nothing);
|
||||||
std::cout << "Player does not have any kind of attack ready now.\n";
|
std::cout << "Player does not have any kind of attack ready now.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void screenshot()
|
void screenshot()
|
||||||
|
@ -184,11 +186,13 @@ namespace MWInput
|
||||||
|
|
||||||
void toggleAutoMove()
|
void toggleAutoMove()
|
||||||
{
|
{
|
||||||
|
if (windows.isGuiMode()) return;
|
||||||
player.setAutoMove (!player.getAutoMove());
|
player.setAutoMove (!player.getAutoMove());
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleWalking()
|
void toggleWalking()
|
||||||
{
|
{
|
||||||
|
if (windows.isGuiMode()) return;
|
||||||
player.toggleRunning();
|
player.toggleRunning();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,10 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
if (!paused && ptr.getRefData().getHandle()!="player")
|
if (!paused && ptr.getRefData().getHandle()!="player")
|
||||||
MWWorld::Class::get (ptr).getInventoryStore (ptr).autoEquip (
|
MWWorld::Class::get (ptr).getInventoryStore (ptr).autoEquip (
|
||||||
MWWorld::Class::get (ptr).getNpcStats (ptr), mEnvironment);
|
MWWorld::Class::get (ptr).getNpcStats (ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
Actors::Actors (MWWorld::Environment& environment) : mEnvironment (environment), mDuration (0) {}
|
Actors::Actors() : mDuration (0) {}
|
||||||
|
|
||||||
void Actors::addActor (const MWWorld::Ptr& ptr)
|
void Actors::addActor (const MWWorld::Ptr& ptr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,16 +12,10 @@ namespace Ogre
|
||||||
class Vector3;
|
class Vector3;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MWWorld
|
|
||||||
{
|
|
||||||
class Environment;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
class Actors
|
class Actors
|
||||||
{
|
{
|
||||||
MWWorld::Environment& mEnvironment;
|
|
||||||
std::set<MWWorld::Ptr> mActors;
|
std::set<MWWorld::Ptr> mActors;
|
||||||
float mDuration;
|
float mDuration;
|
||||||
|
|
||||||
|
@ -31,7 +25,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Actors (MWWorld::Environment& environment);
|
Actors();
|
||||||
|
|
||||||
void addActor (const MWWorld::Ptr& ptr);
|
void addActor (const MWWorld::Ptr& ptr);
|
||||||
///< Register an actor for stats management
|
///< Register an actor for stats management
|
||||||
|
|
|
@ -5,8 +5,9 @@
|
||||||
|
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwgui/window_manager.hpp"
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
|
|
||||||
|
@ -14,7 +15,7 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
void MechanicsManager::buildPlayer()
|
void MechanicsManager::buildPlayer()
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = mEnvironment.mWorld->getPlayer().getPlayer();
|
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||||
|
|
||||||
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
||||||
MWMechanics::NpcStats& npcStats = MWWorld::Class::get (ptr).getNpcStats (ptr);
|
MWMechanics::NpcStats& npcStats = MWWorld::Class::get (ptr).getNpcStats (ptr);
|
||||||
|
@ -33,10 +34,10 @@ namespace MWMechanics
|
||||||
if (mRaceSelected)
|
if (mRaceSelected)
|
||||||
{
|
{
|
||||||
const ESM::Race *race =
|
const ESM::Race *race =
|
||||||
mEnvironment.mWorld->getStore().races.find (
|
MWBase::Environment::get().getWorld()->getStore().races.find (
|
||||||
mEnvironment.mWorld->getPlayer().getRace());
|
MWBase::Environment::get().getWorld()->getPlayer().getRace());
|
||||||
|
|
||||||
bool male = mEnvironment.mWorld->getPlayer().isMale();
|
bool male = MWBase::Environment::get().getWorld()->getPlayer().isMale();
|
||||||
|
|
||||||
for (int i=0; i<8; ++i)
|
for (int i=0; i<8; ++i)
|
||||||
{
|
{
|
||||||
|
@ -76,11 +77,11 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
|
|
||||||
// birthsign
|
// birthsign
|
||||||
if (!mEnvironment.mWorld->getPlayer().getBirthsign().empty())
|
if (!MWBase::Environment::get().getWorld()->getPlayer().getBirthsign().empty())
|
||||||
{
|
{
|
||||||
const ESM::BirthSign *sign =
|
const ESM::BirthSign *sign =
|
||||||
mEnvironment.mWorld->getStore().birthSigns.find (
|
MWBase::Environment::get().getWorld()->getStore().birthSigns.find (
|
||||||
mEnvironment.mWorld->getPlayer().getBirthsign());
|
MWBase::Environment::get().getWorld()->getPlayer().getBirthsign());
|
||||||
|
|
||||||
for (std::vector<std::string>::const_iterator iter (sign->powers.list.begin());
|
for (std::vector<std::string>::const_iterator iter (sign->powers.list.begin());
|
||||||
iter!=sign->powers.list.end(); ++iter)
|
iter!=sign->powers.list.end(); ++iter)
|
||||||
|
@ -92,7 +93,7 @@ namespace MWMechanics
|
||||||
// class
|
// class
|
||||||
if (mClassSelected)
|
if (mClassSelected)
|
||||||
{
|
{
|
||||||
const ESM::Class& class_ = mEnvironment.mWorld->getPlayer().getClass();
|
const ESM::Class& class_ = MWBase::Environment::get().getWorld()->getPlayer().getClass();
|
||||||
|
|
||||||
for (int i=0; i<2; ++i)
|
for (int i=0; i<2; ++i)
|
||||||
{
|
{
|
||||||
|
@ -121,7 +122,7 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef ESMS::IndexListT<ESM::Skill>::MapType ContainerType;
|
typedef ESMS::IndexListT<ESM::Skill>::MapType ContainerType;
|
||||||
const ContainerType& skills = mEnvironment.mWorld->getStore().skills.list;
|
const ContainerType& skills = MWBase::Environment::get().getWorld()->getStore().skills.list;
|
||||||
|
|
||||||
for (ContainerType::const_iterator iter (skills.begin()); iter!=skills.end(); ++iter)
|
for (ContainerType::const_iterator iter (skills.begin()); iter!=skills.end(); ++iter)
|
||||||
{
|
{
|
||||||
|
@ -164,7 +165,7 @@ namespace MWMechanics
|
||||||
MWMechanics::CreatureStats& creatureStats =
|
MWMechanics::CreatureStats& creatureStats =
|
||||||
MWWorld::Class::get (creature).getCreatureStats (creature);
|
MWWorld::Class::get (creature).getCreatureStats (creature);
|
||||||
|
|
||||||
MagicEffects now = creatureStats.mSpells.getMagicEffects (mEnvironment);
|
MagicEffects now = creatureStats.mSpells.getMagicEffects();
|
||||||
|
|
||||||
/// \todo add effects from active spells and equipment
|
/// \todo add effects from active spells and equipment
|
||||||
|
|
||||||
|
@ -175,9 +176,9 @@ namespace MWMechanics
|
||||||
// TODO apply diff to other stats
|
// TODO apply diff to other stats
|
||||||
}
|
}
|
||||||
|
|
||||||
MechanicsManager::MechanicsManager (MWWorld::Environment& environment)
|
MechanicsManager::MechanicsManager()
|
||||||
: mEnvironment (environment), mUpdatePlayer (true), mClassSelected (false),
|
: mUpdatePlayer (true), mClassSelected (false),
|
||||||
mRaceSelected (false), mActors (environment)
|
mRaceSelected (false)
|
||||||
{
|
{
|
||||||
buildPlayer();
|
buildPlayer();
|
||||||
}
|
}
|
||||||
|
@ -236,7 +237,7 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
mWatchedCreature.mAttributes[i] = stats.mAttributes[i];
|
mWatchedCreature.mAttributes[i] = stats.mAttributes[i];
|
||||||
|
|
||||||
mEnvironment.mWindowManager->setValue (attributeNames[i], stats.mAttributes[i]);
|
MWBase::Environment::get().getWindowManager()->setValue (attributeNames[i], stats.mAttributes[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +247,7 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
mWatchedCreature.mDynamic[i] = stats.mDynamic[i];
|
mWatchedCreature.mDynamic[i] = stats.mDynamic[i];
|
||||||
|
|
||||||
mEnvironment.mWindowManager->setValue (dynamicNames[i], stats.mDynamic[i]);
|
MWBase::Environment::get().getWindowManager()->setValue (dynamicNames[i], stats.mDynamic[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,25 +260,25 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
update = true;
|
update = true;
|
||||||
mWatchedNpc.mSkill[i] = npcStats.mSkill[i];
|
mWatchedNpc.mSkill[i] = npcStats.mSkill[i];
|
||||||
mEnvironment.mWindowManager->setValue((ESM::Skill::SkillEnum)i, npcStats.mSkill[i]);
|
MWBase::Environment::get().getWindowManager()->setValue((ESM::Skill::SkillEnum)i, npcStats.mSkill[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update)
|
if (update)
|
||||||
mEnvironment.mWindowManager->updateSkillArea();
|
MWBase::Environment::get().getWindowManager()->updateSkillArea();
|
||||||
|
|
||||||
mEnvironment.mWindowManager->setValue ("level", stats.mLevel);
|
MWBase::Environment::get().getWindowManager()->setValue ("level", stats.mLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mUpdatePlayer)
|
if (mUpdatePlayer)
|
||||||
{
|
{
|
||||||
// basic player profile; should not change anymore after the creation phase is finished.
|
// basic player profile; should not change anymore after the creation phase is finished.
|
||||||
mEnvironment.mWindowManager->setValue ("name", mEnvironment.mWorld->getPlayer().getName());
|
MWBase::Environment::get().getWindowManager()->setValue ("name", MWBase::Environment::get().getWorld()->getPlayer().getName());
|
||||||
mEnvironment.mWindowManager->setValue ("race",
|
MWBase::Environment::get().getWindowManager()->setValue ("race",
|
||||||
mEnvironment.mWorld->getStore().races.find (mEnvironment.mWorld->getPlayer().
|
MWBase::Environment::get().getWorld()->getStore().races.find (MWBase::Environment::get().getWorld()->getPlayer().
|
||||||
getRace())->name);
|
getRace())->name);
|
||||||
mEnvironment.mWindowManager->setValue ("class",
|
MWBase::Environment::get().getWindowManager()->setValue ("class",
|
||||||
mEnvironment.mWorld->getPlayer().getClass().name);
|
MWBase::Environment::get().getWorld()->getPlayer().getClass().name);
|
||||||
mUpdatePlayer = false;
|
mUpdatePlayer = false;
|
||||||
|
|
||||||
MWGui::WindowManager::SkillList majorSkills (5);
|
MWGui::WindowManager::SkillList majorSkills (5);
|
||||||
|
@ -285,11 +286,11 @@ namespace MWMechanics
|
||||||
|
|
||||||
for (int i=0; i<5; ++i)
|
for (int i=0; i<5; ++i)
|
||||||
{
|
{
|
||||||
minorSkills[i] = mEnvironment.mWorld->getPlayer().getClass().data.skills[i][0];
|
minorSkills[i] = MWBase::Environment::get().getWorld()->getPlayer().getClass().data.skills[i][0];
|
||||||
majorSkills[i] = mEnvironment.mWorld->getPlayer().getClass().data.skills[i][1];
|
majorSkills[i] = MWBase::Environment::get().getWorld()->getPlayer().getClass().data.skills[i][1];
|
||||||
}
|
}
|
||||||
|
|
||||||
mEnvironment.mWindowManager->configureSkills (majorSkills, minorSkills);
|
MWBase::Environment::get().getWindowManager()->configureSkills (majorSkills, minorSkills);
|
||||||
}
|
}
|
||||||
|
|
||||||
mActors.update (movement, duration, paused);
|
mActors.update (movement, duration, paused);
|
||||||
|
@ -297,14 +298,14 @@ namespace MWMechanics
|
||||||
|
|
||||||
void MechanicsManager::setPlayerName (const std::string& name)
|
void MechanicsManager::setPlayerName (const std::string& name)
|
||||||
{
|
{
|
||||||
mEnvironment.mWorld->getPlayer().setName (name);
|
MWBase::Environment::get().getWorld()->getPlayer().setName (name);
|
||||||
mUpdatePlayer = true;
|
mUpdatePlayer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MechanicsManager::setPlayerRace (const std::string& race, bool male)
|
void MechanicsManager::setPlayerRace (const std::string& race, bool male)
|
||||||
{
|
{
|
||||||
mEnvironment.mWorld->getPlayer().setGender (male);
|
MWBase::Environment::get().getWorld()->getPlayer().setGender (male);
|
||||||
mEnvironment.mWorld->getPlayer().setRace (race);
|
MWBase::Environment::get().getWorld()->getPlayer().setRace (race);
|
||||||
mRaceSelected = true;
|
mRaceSelected = true;
|
||||||
buildPlayer();
|
buildPlayer();
|
||||||
mUpdatePlayer = true;
|
mUpdatePlayer = true;
|
||||||
|
@ -312,14 +313,14 @@ namespace MWMechanics
|
||||||
|
|
||||||
void MechanicsManager::setPlayerBirthsign (const std::string& id)
|
void MechanicsManager::setPlayerBirthsign (const std::string& id)
|
||||||
{
|
{
|
||||||
mEnvironment.mWorld->getPlayer().setBirthsign (id);
|
MWBase::Environment::get().getWorld()->getPlayer().setBirthsign (id);
|
||||||
buildPlayer();
|
buildPlayer();
|
||||||
mUpdatePlayer = true;
|
mUpdatePlayer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MechanicsManager::setPlayerClass (const std::string& id)
|
void MechanicsManager::setPlayerClass (const std::string& id)
|
||||||
{
|
{
|
||||||
mEnvironment.mWorld->getPlayer().setClass (*mEnvironment.mWorld->getStore().classes.find (id));
|
MWBase::Environment::get().getWorld()->getPlayer().setClass (*MWBase::Environment::get().getWorld()->getStore().classes.find (id));
|
||||||
mClassSelected = true;
|
mClassSelected = true;
|
||||||
buildPlayer();
|
buildPlayer();
|
||||||
mUpdatePlayer = true;
|
mUpdatePlayer = true;
|
||||||
|
@ -327,7 +328,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
void MechanicsManager::setPlayerClass (const ESM::Class& class_)
|
void MechanicsManager::setPlayerClass (const ESM::Class& class_)
|
||||||
{
|
{
|
||||||
mEnvironment.mWorld->getPlayer().setClass (class_);
|
MWBase::Environment::get().getWorld()->getPlayer().setClass (class_);
|
||||||
mClassSelected = true;
|
mClassSelected = true;
|
||||||
buildPlayer();
|
buildPlayer();
|
||||||
mUpdatePlayer = true;
|
mUpdatePlayer = true;
|
||||||
|
|
|
@ -15,16 +15,10 @@ namespace Ogre
|
||||||
class Vector3;
|
class Vector3;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MWWorld
|
|
||||||
{
|
|
||||||
class Environment;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
class MechanicsManager
|
class MechanicsManager
|
||||||
{
|
{
|
||||||
MWWorld::Environment& mEnvironment;
|
|
||||||
MWWorld::Ptr mWatched;
|
MWWorld::Ptr mWatched;
|
||||||
CreatureStats mWatchedCreature;
|
CreatureStats mWatchedCreature;
|
||||||
NpcStats mWatchedNpc;
|
NpcStats mWatchedNpc;
|
||||||
|
@ -41,7 +35,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MechanicsManager (MWWorld::Environment& environment);
|
MechanicsManager ();
|
||||||
|
|
||||||
void configureGUI();
|
void configureGUI();
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
#include <components/esm/loadspel.hpp>
|
#include <components/esm/loadspel.hpp>
|
||||||
|
|
||||||
#include "../mwworld/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
#include "magiceffects.hpp"
|
#include "magiceffects.hpp"
|
||||||
|
@ -48,13 +49,13 @@ namespace MWMechanics
|
||||||
mSelectedSpell.clear();
|
mSelectedSpell.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
MagicEffects Spells::getMagicEffects (const MWWorld::Environment& environment) const
|
MagicEffects Spells::getMagicEffects() const
|
||||||
{
|
{
|
||||||
MagicEffects effects;
|
MagicEffects effects;
|
||||||
|
|
||||||
for (TIterator iter = mSpells.begin(); iter!=mSpells.end(); ++iter)
|
for (TIterator iter = mSpells.begin(); iter!=mSpells.end(); ++iter)
|
||||||
{
|
{
|
||||||
const ESM::Spell *spell = environment.mWorld->getStore().spells.find (*iter);
|
const ESM::Spell *spell = MWBase::Environment::get().getWorld()->getStore().spells.find (*iter);
|
||||||
|
|
||||||
if (spell->data.type==ESM::Spell::ST_Ability || spell->data.type==ESM::Spell::ST_Blight ||
|
if (spell->data.type==ESM::Spell::ST_Ability || spell->data.type==ESM::Spell::ST_Blight ||
|
||||||
spell->data.type==ESM::Spell::ST_Disease || spell->data.type==ESM::Spell::ST_Curse)
|
spell->data.type==ESM::Spell::ST_Disease || spell->data.type==ESM::Spell::ST_Curse)
|
||||||
|
|
|
@ -9,11 +9,6 @@ namespace ESM
|
||||||
struct Spell;
|
struct Spell;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MWWorld
|
|
||||||
{
|
|
||||||
struct Environment;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
class MagicEffects;
|
class MagicEffects;
|
||||||
|
@ -49,7 +44,7 @@ namespace MWMechanics
|
||||||
///< If the spell to be removed is the selected spell, the selected spell will be changed to
|
///< If the spell to be removed is the selected spell, the selected spell will be changed to
|
||||||
/// no spell (empty string).
|
/// no spell (empty string).
|
||||||
|
|
||||||
MagicEffects getMagicEffects (const MWWorld::Environment& environment) const;
|
MagicEffects getMagicEffects() const;
|
||||||
///< Return sum of magic effects resulting from abilities, blights, deseases and curses.
|
///< Return sum of magic effects resulting from abilities, blights, deseases and curses.
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
|
@ -23,7 +23,7 @@ void Actors::setMwRoot(Ogre::SceneNode* root){
|
||||||
void Actors::insertNPC(const MWWorld::Ptr& ptr, MWWorld::InventoryStore& inv){
|
void Actors::insertNPC(const MWWorld::Ptr& ptr, MWWorld::InventoryStore& inv){
|
||||||
|
|
||||||
insertBegin(ptr, true, true);
|
insertBegin(ptr, true, true);
|
||||||
NpcAnimation* anim = new MWRender::NpcAnimation(ptr, mEnvironment, mRend, inv);
|
NpcAnimation* anim = new MWRender::NpcAnimation(ptr, mRend, inv);
|
||||||
|
|
||||||
mAllActors[ptr] = anim;
|
mAllActors[ptr] = anim;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ void Actors::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_){
|
||||||
void Actors::insertCreature (const MWWorld::Ptr& ptr){
|
void Actors::insertCreature (const MWWorld::Ptr& ptr){
|
||||||
|
|
||||||
insertBegin(ptr, true, true);
|
insertBegin(ptr, true, true);
|
||||||
CreatureAnimation* anim = new MWRender::CreatureAnimation(ptr, mEnvironment, mRend);
|
CreatureAnimation* anim = new MWRender::CreatureAnimation(ptr, mRend);
|
||||||
//mAllActors.insert(std::pair<MWWorld::Ptr, Animation*>(ptr,anim));
|
//mAllActors.insert(std::pair<MWWorld::Ptr, Animation*>(ptr,anim));
|
||||||
delete mAllActors[ptr];
|
delete mAllActors[ptr];
|
||||||
mAllActors[ptr] = anim;
|
mAllActors[ptr] = anim;
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#include "../mwworld/refdata.hpp"
|
#include "../mwworld/refdata.hpp"
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontalk.hpp"
|
#include "../mwworld/actiontalk.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "npcanimation.hpp"
|
#include "npcanimation.hpp"
|
||||||
#include "creatureanimation.hpp"
|
#include "creatureanimation.hpp"
|
||||||
#include <openengine/bullet/physic.hpp>
|
#include <openengine/bullet/physic.hpp>
|
||||||
|
@ -23,13 +22,12 @@ namespace MWRender{
|
||||||
OEngine::Render::OgreRenderer &mRend;
|
OEngine::Render::OgreRenderer &mRend;
|
||||||
std::map<MWWorld::Ptr::CellStore *, Ogre::SceneNode *> mCellSceneNodes;
|
std::map<MWWorld::Ptr::CellStore *, Ogre::SceneNode *> mCellSceneNodes;
|
||||||
Ogre::SceneNode* mMwRoot;
|
Ogre::SceneNode* mMwRoot;
|
||||||
MWWorld::Environment& mEnvironment;
|
|
||||||
std::map<MWWorld::Ptr, Animation*> mAllActors;
|
std::map<MWWorld::Ptr, Animation*> mAllActors;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Actors(OEngine::Render::OgreRenderer& _rend, MWWorld::Environment& _env): mRend(_rend), mEnvironment(_env){}
|
Actors(OEngine::Render::OgreRenderer& _rend): mRend(_rend) {}
|
||||||
~Actors();
|
~Actors();
|
||||||
void setMwRoot(Ogre::SceneNode* root);
|
void setMwRoot(Ogre::SceneNode* root);
|
||||||
void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_);
|
void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_);
|
||||||
|
|
|
@ -4,10 +4,9 @@
|
||||||
namespace MWRender{
|
namespace MWRender{
|
||||||
std::map<std::string, int> Animation::mUniqueIDs;
|
std::map<std::string, int> Animation::mUniqueIDs;
|
||||||
|
|
||||||
Animation::Animation(MWWorld::Environment& _env, OEngine::Render::OgreRenderer& _rend)
|
Animation::Animation(OEngine::Render::OgreRenderer& _rend)
|
||||||
: insert(NULL)
|
: insert(NULL)
|
||||||
, mRend(_rend)
|
, mRend(_rend)
|
||||||
, mEnvironment(_env)
|
|
||||||
, vecRotPos()
|
, vecRotPos()
|
||||||
, time(0.0f)
|
, time(0.0f)
|
||||||
, startTime(0.0f)
|
, startTime(0.0f)
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include "../mwworld/refdata.hpp"
|
#include "../mwworld/refdata.hpp"
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontalk.hpp"
|
#include "../mwworld/actiontalk.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include <components/nif/node.hpp>
|
#include <components/nif/node.hpp>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <openengine/bullet/physic.hpp>
|
#include <openengine/bullet/physic.hpp>
|
||||||
|
@ -25,7 +24,6 @@ class Animation{
|
||||||
protected:
|
protected:
|
||||||
Ogre::SceneNode* insert;
|
Ogre::SceneNode* insert;
|
||||||
OEngine::Render::OgreRenderer &mRend;
|
OEngine::Render::OgreRenderer &mRend;
|
||||||
MWWorld::Environment& mEnvironment;
|
|
||||||
std::map<Nif::NiSkinData::BoneInfoCopy*, PosAndRot> vecRotPos;
|
std::map<Nif::NiSkinData::BoneInfoCopy*, PosAndRot> vecRotPos;
|
||||||
static std::map<std::string, int> mUniqueIDs;
|
static std::map<std::string, int> mUniqueIDs;
|
||||||
|
|
||||||
|
@ -60,7 +58,7 @@ class Animation{
|
||||||
std::string getUniqueID(std::string mesh);
|
std::string getUniqueID(std::string mesh);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Animation(MWWorld::Environment& _env, OEngine::Render::OgreRenderer& _rend);
|
Animation(OEngine::Render::OgreRenderer& _rend);
|
||||||
virtual void runAnimation(float timepassed) = 0;
|
virtual void runAnimation(float timepassed) = 0;
|
||||||
void startScript(std::string groupname, int mode, int loops);
|
void startScript(std::string groupname, int mode, int loops);
|
||||||
void stopScript();
|
void stopScript();
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace MWRender{
|
||||||
CreatureAnimation::~CreatureAnimation(){
|
CreatureAnimation::~CreatureAnimation(){
|
||||||
|
|
||||||
}
|
}
|
||||||
CreatureAnimation::CreatureAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env,OEngine::Render::OgreRenderer& _rend): Animation(_env,_rend){
|
CreatureAnimation::CreatureAnimation(const MWWorld::Ptr& ptr, OEngine::Render::OgreRenderer& _rend): Animation(_rend){
|
||||||
insert = ptr.getRefData().getBaseNode();
|
insert = ptr.getRefData().getBaseNode();
|
||||||
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Creature>();
|
ptr.get<ESM::Creature>();
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
#include "../mwworld/refdata.hpp"
|
#include "../mwworld/refdata.hpp"
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "components/nifogre/ogre_nif_loader.hpp"
|
#include "components/nifogre/ogre_nif_loader.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +16,7 @@ class CreatureAnimation: public Animation{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~CreatureAnimation();
|
virtual ~CreatureAnimation();
|
||||||
CreatureAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env, OEngine::Render::OgreRenderer& _rend);
|
CreatureAnimation(const MWWorld::Ptr& ptr, OEngine::Render::OgreRenderer& _rend);
|
||||||
virtual void runAnimation(float timepassed);
|
virtual void runAnimation(float timepassed);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include <OgreMaterialManager.h>
|
#include <OgreMaterialManager.h>
|
||||||
|
|
||||||
#include "../mwworld/world.hpp" // these includes can be removed once the static-hack is gone
|
#include "../mwworld/world.hpp" // these includes can be removed once the static-hack is gone
|
||||||
#include "../mwworld/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include <components/esm/loadstat.hpp>
|
#include <components/esm/loadstat.hpp>
|
||||||
#include <components/esm/loadpgrd.hpp>
|
#include <components/esm/loadpgrd.hpp>
|
||||||
|
@ -138,8 +138,8 @@ ManualObject *Debugging::createPathgridPoints(const ESM::Pathgrid *pathgrid)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debugging::Debugging(SceneNode *mwRoot, MWWorld::Environment &env, OEngine::Physic::PhysicEngine *engine) :
|
Debugging::Debugging(SceneNode *mwRoot, OEngine::Physic::PhysicEngine *engine) :
|
||||||
mMwRoot(mwRoot), mEnvironment(env), mEngine(engine),
|
mMwRoot(mwRoot), mEngine(engine),
|
||||||
mSceneMgr(mwRoot->getCreator()),
|
mSceneMgr(mwRoot->getCreator()),
|
||||||
mPathgridEnabled(false),
|
mPathgridEnabled(false),
|
||||||
mInteriorPathgridNode(NULL), mPathGridRoot(NULL),
|
mInteriorPathgridNode(NULL), mPathGridRoot(NULL),
|
||||||
|
@ -218,7 +218,7 @@ void Debugging::togglePathgrid()
|
||||||
|
|
||||||
void Debugging::enableCellPathgrid(MWWorld::Ptr::CellStore *store)
|
void Debugging::enableCellPathgrid(MWWorld::Ptr::CellStore *store)
|
||||||
{
|
{
|
||||||
ESM::Pathgrid *pathgrid = mEnvironment.mWorld->getStore().pathgrids.search(*store->cell);
|
ESM::Pathgrid *pathgrid = MWBase::Environment::get().getWorld()->getStore().pathgrids.search(*store->cell);
|
||||||
if (!pathgrid) return;
|
if (!pathgrid) return;
|
||||||
|
|
||||||
Vector3 cellPathGridPos(0, 0, 0);
|
Vector3 cellPathGridPos(0, 0, 0);
|
||||||
|
|
|
@ -23,7 +23,6 @@ namespace Ogre
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
class World;
|
class World;
|
||||||
class Environment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MWRender
|
namespace MWRender
|
||||||
|
@ -34,7 +33,6 @@ namespace MWRender
|
||||||
{
|
{
|
||||||
OEngine::Physic::PhysicEngine* mEngine;
|
OEngine::Physic::PhysicEngine* mEngine;
|
||||||
Ogre::SceneManager *mSceneMgr;
|
Ogre::SceneManager *mSceneMgr;
|
||||||
MWWorld::Environment& mEnvironment;
|
|
||||||
|
|
||||||
// Path grid stuff
|
// Path grid stuff
|
||||||
bool mPathgridEnabled;
|
bool mPathgridEnabled;
|
||||||
|
@ -68,7 +66,7 @@ namespace MWRender
|
||||||
Ogre::ManualObject *createPathgridLines(const ESM::Pathgrid *pathgrid);
|
Ogre::ManualObject *createPathgridLines(const ESM::Pathgrid *pathgrid);
|
||||||
Ogre::ManualObject *createPathgridPoints(const ESM::Pathgrid *pathgrid);
|
Ogre::ManualObject *createPathgridPoints(const ESM::Pathgrid *pathgrid);
|
||||||
public:
|
public:
|
||||||
Debugging(Ogre::SceneNode* mwRoot, MWWorld::Environment &env, OEngine::Physic::PhysicEngine *engine);
|
Debugging(Ogre::SceneNode* mwRoot, OEngine::Physic::PhysicEngine *engine);
|
||||||
~Debugging();
|
~Debugging();
|
||||||
bool toggleRenderMode (int mode);
|
bool toggleRenderMode (int mode);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "localmap.hpp"
|
#include "localmap.hpp"
|
||||||
#include "renderingmanager.hpp"
|
#include "renderingmanager.hpp"
|
||||||
|
|
||||||
#include "../mwworld/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwgui/window_manager.hpp"
|
||||||
#include "renderconst.hpp"
|
#include "renderconst.hpp"
|
||||||
|
@ -12,12 +12,11 @@
|
||||||
using namespace MWRender;
|
using namespace MWRender;
|
||||||
using namespace Ogre;
|
using namespace Ogre;
|
||||||
|
|
||||||
LocalMap::LocalMap(OEngine::Render::OgreRenderer* rend, MWRender::RenderingManager* rendering, MWWorld::Environment* env) :
|
LocalMap::LocalMap(OEngine::Render::OgreRenderer* rend, MWRender::RenderingManager* rendering) :
|
||||||
mInterior(false), mCellX(0), mCellY(0)
|
mInterior(false), mCellX(0), mCellY(0)
|
||||||
{
|
{
|
||||||
mRendering = rend;
|
mRendering = rend;
|
||||||
mRenderingManager = rendering;
|
mRenderingManager = rendering;
|
||||||
mEnvironment = env;
|
|
||||||
|
|
||||||
mCameraPosNode = mRendering->getScene()->getRootSceneNode()->createChildSceneNode();
|
mCameraPosNode = mRendering->getScene()->getRootSceneNode()->createChildSceneNode();
|
||||||
mCameraRotNode = mCameraPosNode->createChildSceneNode();
|
mCameraRotNode = mCameraPosNode->createChildSceneNode();
|
||||||
|
@ -123,7 +122,7 @@ void LocalMap::requestMap(MWWorld::Ptr::CellStore* cell,
|
||||||
|
|
||||||
Vector2 z(mBounds.getMaximum().y, mBounds.getMinimum().y);
|
Vector2 z(mBounds.getMaximum().y, mBounds.getMinimum().y);
|
||||||
|
|
||||||
const Vector2& north = mEnvironment->mWorld->getNorthVector(cell);
|
const Vector2& north = MWBase::Environment::get().getWorld()->getNorthVector(cell);
|
||||||
Radian angle(std::atan2(-north.x, -north.y));
|
Radian angle(std::atan2(-north.x, -north.y));
|
||||||
mAngle = angle.valueRadians();
|
mAngle = angle.valueRadians();
|
||||||
mCameraRotNode->setOrientation(Quaternion(Math::Cos(angle/2.f), 0, Math::Sin(angle/2.f), 0));
|
mCameraRotNode->setOrientation(Quaternion(Math::Cos(angle/2.f), 0, Math::Sin(angle/2.f), 0));
|
||||||
|
@ -303,7 +302,7 @@ void LocalMap::updatePlayer (const Ogre::Vector3& position, const Ogre::Quaterni
|
||||||
x = std::ceil((pos.x - min.x)/sSize)-1;
|
x = std::ceil((pos.x - min.x)/sSize)-1;
|
||||||
y = std::ceil((pos.y - min.y)/sSize)-1;
|
y = std::ceil((pos.y - min.y)/sSize)-1;
|
||||||
|
|
||||||
mEnvironment->mWindowManager->setInteriorMapTexture(x,y);
|
MWBase::Environment::get().getWindowManager()->setInteriorMapTexture(x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert from world coordinates to texture UV coordinates
|
// convert from world coordinates to texture UV coordinates
|
||||||
|
@ -323,8 +322,8 @@ void LocalMap::updatePlayer (const Ogre::Vector3& position, const Ogre::Quaterni
|
||||||
texName = mInteriorName + "_" + coordStr(x,y);
|
texName = mInteriorName + "_" + coordStr(x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
mEnvironment->mWindowManager->setPlayerPos(u, v);
|
MWBase::Environment::get().getWindowManager()->setPlayerPos(u, v);
|
||||||
mEnvironment->mWindowManager->setPlayerDir(playerdirection.x, -playerdirection.z);
|
MWBase::Environment::get().getWindowManager()->setPlayerDir(playerdirection.x, -playerdirection.z);
|
||||||
|
|
||||||
// explore radius (squared)
|
// explore radius (squared)
|
||||||
const float sqrExploreRadius = 0.01 * sFogOfWarResolution*sFogOfWarResolution;
|
const float sqrExploreRadius = 0.01 * sFogOfWarResolution*sFogOfWarResolution;
|
||||||
|
|
|
@ -5,11 +5,6 @@
|
||||||
|
|
||||||
#include <openengine/ogre/renderer.hpp>
|
#include <openengine/ogre/renderer.hpp>
|
||||||
|
|
||||||
namespace MWWorld
|
|
||||||
{
|
|
||||||
class Environment;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace MWRender
|
namespace MWRender
|
||||||
{
|
{
|
||||||
class RenderingManager;
|
class RenderingManager;
|
||||||
|
@ -20,7 +15,7 @@ namespace MWRender
|
||||||
class LocalMap
|
class LocalMap
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LocalMap(OEngine::Render::OgreRenderer*, MWRender::RenderingManager* rendering, MWWorld::Environment* env);
|
LocalMap(OEngine::Render::OgreRenderer*, MWRender::RenderingManager* rendering);
|
||||||
~LocalMap();
|
~LocalMap();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,7 +56,6 @@ namespace MWRender
|
||||||
private:
|
private:
|
||||||
OEngine::Render::OgreRenderer* mRendering;
|
OEngine::Render::OgreRenderer* mRendering;
|
||||||
MWRender::RenderingManager* mRenderingManager;
|
MWRender::RenderingManager* mRenderingManager;
|
||||||
MWWorld::Environment* mEnvironment;
|
|
||||||
|
|
||||||
// 1024*1024 pixels for a cell
|
// 1024*1024 pixels for a cell
|
||||||
static const int sMapResolution = 1024;
|
static const int sMapResolution = 1024;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
#include "renderconst.hpp"
|
#include "renderconst.hpp"
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
using namespace Ogre;
|
using namespace Ogre;
|
||||||
using namespace NifOgre;
|
using namespace NifOgre;
|
||||||
|
@ -12,7 +12,7 @@ NpcAnimation::~NpcAnimation(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env,OEngine::Render::OgreRenderer& _rend, MWWorld::InventoryStore& _inv): Animation(_env,_rend), mStateID(-1), inv(_inv), timeToChange(0),
|
NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, OEngine::Render::OgreRenderer& _rend, MWWorld::InventoryStore& _inv): Animation(_rend), mStateID(-1), inv(_inv), timeToChange(0),
|
||||||
robe(inv.end()), helmet(inv.end()), shirt(inv.end()),
|
robe(inv.end()), helmet(inv.end()), shirt(inv.end()),
|
||||||
cuirass(inv.end()), greaves(inv.end()),
|
cuirass(inv.end()), greaves(inv.end()),
|
||||||
leftpauldron(inv.end()), rightpauldron(inv.end()),
|
leftpauldron(inv.end()), rightpauldron(inv.end()),
|
||||||
|
@ -77,14 +77,14 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env,O
|
||||||
std::string hairID = ref->base->hair;
|
std::string hairID = ref->base->hair;
|
||||||
std::string headID = ref->base->head;
|
std::string headID = ref->base->head;
|
||||||
headModel = "meshes\\" +
|
headModel = "meshes\\" +
|
||||||
mEnvironment.mWorld->getStore().bodyParts.find(headID)->model;
|
MWBase::Environment::get().getWorld()->getStore().bodyParts.find(headID)->model;
|
||||||
|
|
||||||
hairModel = "meshes\\" +
|
hairModel = "meshes\\" +
|
||||||
mEnvironment.mWorld->getStore().bodyParts.find(hairID)->model;
|
MWBase::Environment::get().getWorld()->getStore().bodyParts.find(hairID)->model;
|
||||||
npcName = ref->base->name;
|
npcName = ref->base->name;
|
||||||
|
|
||||||
//ESMStore::Races r =
|
//ESMStore::Races r =
|
||||||
const ESM::Race* race = mEnvironment.mWorld->getStore().races.find(ref->base->race);
|
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().races.find(ref->base->race);
|
||||||
|
|
||||||
|
|
||||||
bodyRaceID = headID.substr(0, headID.find_last_of("head_") - 4);
|
bodyRaceID = headID.substr(0, headID.find_last_of("head_") - 4);
|
||||||
|
@ -159,7 +159,6 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env,O
|
||||||
insert->scale(race->data.height.female, race->data.height.female, race->data.height.female);
|
insert->scale(race->data.height.female, race->data.height.female, race->data.height.female);
|
||||||
else
|
else
|
||||||
insert->scale(race->data.height.male, race->data.height.male, race->data.height.male);
|
insert->scale(race->data.height.male, race->data.height.male, race->data.height.male);
|
||||||
std::cout << "Inv" << inv.getStateId() << "\n";
|
|
||||||
updateParts();
|
updateParts();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -370,116 +369,116 @@ void NpcAnimation::updateParts(){
|
||||||
addOrReplaceIndividualPart(ESM::PRT_Hair, -1,1,hairModel);
|
addOrReplaceIndividualPart(ESM::PRT_Hair, -1,1,hairModel);
|
||||||
}
|
}
|
||||||
if(partpriorities[ESM::PRT_Neck] < 1){
|
if(partpriorities[ESM::PRT_Neck] < 1){
|
||||||
const ESM::BodyPart *neckPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "neck");
|
const ESM::BodyPart *neckPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "neck");
|
||||||
if(neckPart)
|
if(neckPart)
|
||||||
addOrReplaceIndividualPart(ESM::PRT_Neck, -1,1,"meshes\\" + neckPart->model);
|
addOrReplaceIndividualPart(ESM::PRT_Neck, -1,1,"meshes\\" + neckPart->model);
|
||||||
}
|
}
|
||||||
if(partpriorities[ESM::PRT_Cuirass] < 1){
|
if(partpriorities[ESM::PRT_Cuirass] < 1){
|
||||||
const ESM::BodyPart *chestPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "chest");
|
const ESM::BodyPart *chestPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "chest");
|
||||||
if(chestPart)
|
if(chestPart)
|
||||||
addOrReplaceIndividualPart(ESM::PRT_Cuirass, -1,1,"meshes\\" + chestPart->model);
|
addOrReplaceIndividualPart(ESM::PRT_Cuirass, -1,1,"meshes\\" + chestPart->model);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(partpriorities[ESM::PRT_Groin] < 1){
|
if(partpriorities[ESM::PRT_Groin] < 1){
|
||||||
const ESM::BodyPart *groinPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "groin");
|
const ESM::BodyPart *groinPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "groin");
|
||||||
if(groinPart)
|
if(groinPart)
|
||||||
addOrReplaceIndividualPart(ESM::PRT_Groin, -1,1,"meshes\\" + groinPart->model);
|
addOrReplaceIndividualPart(ESM::PRT_Groin, -1,1,"meshes\\" + groinPart->model);
|
||||||
}
|
}
|
||||||
if(partpriorities[ESM::PRT_RHand] < 1){
|
if(partpriorities[ESM::PRT_RHand] < 1){
|
||||||
const ESM::BodyPart *handPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "hand");
|
const ESM::BodyPart *handPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "hand");
|
||||||
if(!handPart)
|
if(!handPart)
|
||||||
handPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "hands");
|
handPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "hands");
|
||||||
if(handPart)
|
if(handPart)
|
||||||
addOrReplaceIndividualPart(ESM::PRT_RHand, -1,1,"meshes\\" + handPart->model);
|
addOrReplaceIndividualPart(ESM::PRT_RHand, -1,1,"meshes\\" + handPart->model);
|
||||||
}
|
}
|
||||||
if(partpriorities[ESM::PRT_LHand] < 1){
|
if(partpriorities[ESM::PRT_LHand] < 1){
|
||||||
const ESM::BodyPart *handPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "hand");
|
const ESM::BodyPart *handPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "hand");
|
||||||
if(!handPart)
|
if(!handPart)
|
||||||
handPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "hands");
|
handPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "hands");
|
||||||
if(handPart)
|
if(handPart)
|
||||||
addOrReplaceIndividualPart(ESM::PRT_LHand, -1,1,"meshes\\" + handPart->model);
|
addOrReplaceIndividualPart(ESM::PRT_LHand, -1,1,"meshes\\" + handPart->model);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(partpriorities[ESM::PRT_RWrist] < 1){
|
if(partpriorities[ESM::PRT_RWrist] < 1){
|
||||||
const ESM::BodyPart *wristPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "wrist");
|
const ESM::BodyPart *wristPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "wrist");
|
||||||
if(wristPart)
|
if(wristPart)
|
||||||
addOrReplaceIndividualPart(ESM::PRT_RWrist, -1,1,"meshes\\" + wristPart->model);
|
addOrReplaceIndividualPart(ESM::PRT_RWrist, -1,1,"meshes\\" + wristPart->model);
|
||||||
}
|
}
|
||||||
if(partpriorities[ESM::PRT_LWrist] < 1){
|
if(partpriorities[ESM::PRT_LWrist] < 1){
|
||||||
const ESM::BodyPart *wristPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "wrist");
|
const ESM::BodyPart *wristPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "wrist");
|
||||||
if(wristPart)
|
if(wristPart)
|
||||||
addOrReplaceIndividualPart(ESM::PRT_LWrist, -1,1,"meshes\\" + wristPart->model);
|
addOrReplaceIndividualPart(ESM::PRT_LWrist, -1,1,"meshes\\" + wristPart->model);
|
||||||
}
|
}
|
||||||
if(partpriorities[ESM::PRT_RForearm] < 1){
|
if(partpriorities[ESM::PRT_RForearm] < 1){
|
||||||
const ESM::BodyPart *forearmPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "forearm");
|
const ESM::BodyPart *forearmPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "forearm");
|
||||||
if(bodyRaceID == "b_n_argonian_f_")
|
if(bodyRaceID == "b_n_argonian_f_")
|
||||||
forearmPart = mEnvironment.mWorld->getStore().bodyParts.search ("b_n_argonian_m_forearm");
|
forearmPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search ("b_n_argonian_m_forearm");
|
||||||
if(forearmPart)
|
if(forearmPart)
|
||||||
addOrReplaceIndividualPart(ESM::PRT_RForearm, -1,1,"meshes\\" + forearmPart->model);
|
addOrReplaceIndividualPart(ESM::PRT_RForearm, -1,1,"meshes\\" + forearmPart->model);
|
||||||
}
|
}
|
||||||
if(partpriorities[ESM::PRT_LForearm] < 1){
|
if(partpriorities[ESM::PRT_LForearm] < 1){
|
||||||
const ESM::BodyPart *forearmPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "forearm");
|
const ESM::BodyPart *forearmPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "forearm");
|
||||||
if(bodyRaceID == "b_n_argonian_f_")
|
if(bodyRaceID == "b_n_argonian_f_")
|
||||||
forearmPart = mEnvironment.mWorld->getStore().bodyParts.search ("b_n_argonian_m_forearm");
|
forearmPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search ("b_n_argonian_m_forearm");
|
||||||
if(forearmPart)
|
if(forearmPart)
|
||||||
addOrReplaceIndividualPart(ESM::PRT_LForearm, -1,1,"meshes\\" + forearmPart->model);
|
addOrReplaceIndividualPart(ESM::PRT_LForearm, -1,1,"meshes\\" + forearmPart->model);
|
||||||
}
|
}
|
||||||
if(partpriorities[ESM::PRT_RUpperarm] < 1){
|
if(partpriorities[ESM::PRT_RUpperarm] < 1){
|
||||||
const ESM::BodyPart *armPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "upper arm");
|
const ESM::BodyPart *armPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "upper arm");
|
||||||
if(armPart)
|
if(armPart)
|
||||||
addOrReplaceIndividualPart(ESM::PRT_RUpperarm, -1,1,"meshes\\" + armPart->model);
|
addOrReplaceIndividualPart(ESM::PRT_RUpperarm, -1,1,"meshes\\" + armPart->model);
|
||||||
}
|
}
|
||||||
if(partpriorities[ESM::PRT_LUpperarm] < 1){
|
if(partpriorities[ESM::PRT_LUpperarm] < 1){
|
||||||
const ESM::BodyPart *armPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "upper arm");
|
const ESM::BodyPart *armPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "upper arm");
|
||||||
if(armPart)
|
if(armPart)
|
||||||
addOrReplaceIndividualPart(ESM::PRT_LUpperarm, -1,1,"meshes\\" + armPart->model);
|
addOrReplaceIndividualPart(ESM::PRT_LUpperarm, -1,1,"meshes\\" + armPart->model);
|
||||||
}
|
}
|
||||||
if(partpriorities[ESM::PRT_RFoot] < 1){
|
if(partpriorities[ESM::PRT_RFoot] < 1){
|
||||||
const ESM::BodyPart *footPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "foot");
|
const ESM::BodyPart *footPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "foot");
|
||||||
if(isBeast && !footPart)
|
if(isBeast && !footPart)
|
||||||
footPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "feet");
|
footPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "feet");
|
||||||
if(footPart)
|
if(footPart)
|
||||||
addOrReplaceIndividualPart(ESM::PRT_RFoot, -1,1,"meshes\\" + footPart->model);
|
addOrReplaceIndividualPart(ESM::PRT_RFoot, -1,1,"meshes\\" + footPart->model);
|
||||||
}
|
}
|
||||||
if(partpriorities[ESM::PRT_LFoot] < 1){
|
if(partpriorities[ESM::PRT_LFoot] < 1){
|
||||||
const ESM::BodyPart *footPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "foot");
|
const ESM::BodyPart *footPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "foot");
|
||||||
if(isBeast && !footPart)
|
if(isBeast && !footPart)
|
||||||
footPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "feet");
|
footPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "feet");
|
||||||
if(footPart)
|
if(footPart)
|
||||||
addOrReplaceIndividualPart(ESM::PRT_LFoot, -1,1,"meshes\\" + footPart->model);
|
addOrReplaceIndividualPart(ESM::PRT_LFoot, -1,1,"meshes\\" + footPart->model);
|
||||||
}
|
}
|
||||||
if(partpriorities[ESM::PRT_RAnkle] < 1){
|
if(partpriorities[ESM::PRT_RAnkle] < 1){
|
||||||
const ESM::BodyPart *anklePart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "ankle");
|
const ESM::BodyPart *anklePart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "ankle");
|
||||||
if(anklePart)
|
if(anklePart)
|
||||||
addOrReplaceIndividualPart(ESM::PRT_RAnkle, -1,1,"meshes\\" + anklePart->model);
|
addOrReplaceIndividualPart(ESM::PRT_RAnkle, -1,1,"meshes\\" + anklePart->model);
|
||||||
}
|
}
|
||||||
if(partpriorities[ESM::PRT_LAnkle] < 1){
|
if(partpriorities[ESM::PRT_LAnkle] < 1){
|
||||||
const ESM::BodyPart *anklePart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "ankle");
|
const ESM::BodyPart *anklePart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "ankle");
|
||||||
if(anklePart)
|
if(anklePart)
|
||||||
addOrReplaceIndividualPart(ESM::PRT_LAnkle, -1,1,"meshes\\" + anklePart->model);
|
addOrReplaceIndividualPart(ESM::PRT_LAnkle, -1,1,"meshes\\" + anklePart->model);
|
||||||
}
|
}
|
||||||
if(partpriorities[ESM::PRT_RKnee] < 1){
|
if(partpriorities[ESM::PRT_RKnee] < 1){
|
||||||
const ESM::BodyPart *kneePart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "knee");
|
const ESM::BodyPart *kneePart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "knee");
|
||||||
if(kneePart)
|
if(kneePart)
|
||||||
addOrReplaceIndividualPart(ESM::PRT_RKnee, -1,1,"meshes\\" + kneePart->model);
|
addOrReplaceIndividualPart(ESM::PRT_RKnee, -1,1,"meshes\\" + kneePart->model);
|
||||||
}
|
}
|
||||||
if(partpriorities[ESM::PRT_LKnee] < 1){
|
if(partpriorities[ESM::PRT_LKnee] < 1){
|
||||||
const ESM::BodyPart *kneePart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "knee");
|
const ESM::BodyPart *kneePart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "knee");
|
||||||
if(kneePart)
|
if(kneePart)
|
||||||
addOrReplaceIndividualPart(ESM::PRT_LKnee, -1,1,"meshes\\" + kneePart->model);
|
addOrReplaceIndividualPart(ESM::PRT_LKnee, -1,1,"meshes\\" + kneePart->model);
|
||||||
}
|
}
|
||||||
if(partpriorities[ESM::PRT_RLeg] < 1){
|
if(partpriorities[ESM::PRT_RLeg] < 1){
|
||||||
const ESM::BodyPart *legPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "upper leg");
|
const ESM::BodyPart *legPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "upper leg");
|
||||||
if(legPart)
|
if(legPart)
|
||||||
addOrReplaceIndividualPart(ESM::PRT_RLeg, -1,1,"meshes\\" + legPart->model);
|
addOrReplaceIndividualPart(ESM::PRT_RLeg, -1,1,"meshes\\" + legPart->model);
|
||||||
}
|
}
|
||||||
if(partpriorities[ESM::PRT_LLeg] < 1){
|
if(partpriorities[ESM::PRT_LLeg] < 1){
|
||||||
const ESM::BodyPart *legPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "upper leg");
|
const ESM::BodyPart *legPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "upper leg");
|
||||||
if(legPart)
|
if(legPart)
|
||||||
addOrReplaceIndividualPart(ESM::PRT_LLeg, -1,1,"meshes\\" + legPart->model);
|
addOrReplaceIndividualPart(ESM::PRT_LLeg, -1,1,"meshes\\" + legPart->model);
|
||||||
}
|
}
|
||||||
if(partpriorities[ESM::PRT_Tail] < 1){
|
if(partpriorities[ESM::PRT_Tail] < 1){
|
||||||
const ESM::BodyPart *tailPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "tail");
|
const ESM::BodyPart *tailPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "tail");
|
||||||
if(tailPart)
|
if(tailPart)
|
||||||
addOrReplaceIndividualPart(ESM::PRT_Tail, -1,1,"meshes\\" + tailPart->model);
|
addOrReplaceIndividualPart(ESM::PRT_Tail, -1,1,"meshes\\" + tailPart->model);
|
||||||
}
|
}
|
||||||
|
@ -848,9 +847,9 @@ void NpcAnimation::removeIndividualPart(int type){
|
||||||
const ESM::BodyPart *bodypart = 0;
|
const ESM::BodyPart *bodypart = 0;
|
||||||
|
|
||||||
if(isFemale)
|
if(isFemale)
|
||||||
bodypart = mEnvironment.mWorld->getStore().bodyParts.search (part.female);
|
bodypart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (part.female);
|
||||||
if(!bodypart)
|
if(!bodypart)
|
||||||
bodypart = mEnvironment.mWorld->getStore().bodyParts.search (part.male);
|
bodypart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (part.male);
|
||||||
if(bodypart){
|
if(bodypart){
|
||||||
addOrReplaceIndividualPart(part.part, group,priority,"meshes\\" + bodypart->model);
|
addOrReplaceIndividualPart(part.part, group,priority,"meshes\\" + bodypart->model);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
#include "../mwworld/refdata.hpp"
|
#include "../mwworld/refdata.hpp"
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "components/nifogre/ogre_nif_loader.hpp"
|
#include "components/nifogre/ogre_nif_loader.hpp"
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwclass/npc.hpp"
|
#include "../mwclass/npc.hpp"
|
||||||
|
@ -82,7 +81,7 @@ private:
|
||||||
MWWorld::ContainerStoreIterator skirtiter;
|
MWWorld::ContainerStoreIterator skirtiter;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NpcAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env, OEngine::Render::OgreRenderer& _rend, MWWorld::InventoryStore& _inv);
|
NpcAnimation(const MWWorld::Ptr& ptr, OEngine::Render::OgreRenderer& _rend, MWWorld::InventoryStore& _inv);
|
||||||
virtual ~NpcAnimation();
|
virtual ~NpcAnimation();
|
||||||
Ogre::Entity* insertBoundedPart(const std::string &mesh, std::string bonename);
|
Ogre::Entity* insertBoundedPart(const std::string &mesh, std::string bonename);
|
||||||
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> insertFreePart(const std::string &mesh, const std::string suffix);
|
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> insertFreePart(const std::string &mesh, const std::string suffix);
|
||||||
|
|
|
@ -24,8 +24,8 @@ using namespace Ogre;
|
||||||
|
|
||||||
namespace MWRender {
|
namespace MWRender {
|
||||||
|
|
||||||
RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, OEngine::Physic::PhysicEngine* engine, MWWorld::Environment& environment)
|
RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, OEngine::Physic::PhysicEngine* engine)
|
||||||
:mRendering(_rend), mObjects(mRendering), mActors(mRendering, environment), mAmbientMode(0), mSunEnabled(0)
|
:mRendering(_rend), mObjects(mRendering), mActors(mRendering), mAmbientMode(0), mSunEnabled(0)
|
||||||
{
|
{
|
||||||
mRendering.createScene("PlayerCam", Settings::Manager::getFloat("field of view", "General"), 5);
|
mRendering.createScene("PlayerCam", Settings::Manager::getFloat("field of view", "General"), 5);
|
||||||
|
|
||||||
|
@ -93,19 +93,18 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
||||||
mShadows = new Shadows(&mRendering);
|
mShadows = new Shadows(&mRendering);
|
||||||
mShaderHelper = new ShaderHelper(this);
|
mShaderHelper = new ShaderHelper(this);
|
||||||
|
|
||||||
mTerrainManager = new TerrainManager(mRendering.getScene(), this,
|
mTerrainManager = new TerrainManager(mRendering.getScene(), this);
|
||||||
environment);
|
|
||||||
|
|
||||||
//mSkyManager = 0;
|
//mSkyManager = 0;
|
||||||
mSkyManager = new SkyManager(mMwRoot, mRendering.getCamera(), &environment);
|
mSkyManager = new SkyManager(mMwRoot, mRendering.getCamera());
|
||||||
|
|
||||||
mOcclusionQuery = new OcclusionQuery(&mRendering, mSkyManager->getSunNode());
|
mOcclusionQuery = new OcclusionQuery(&mRendering, mSkyManager->getSunNode());
|
||||||
|
|
||||||
mPlayer = new MWRender::Player (mRendering.getCamera(), playerNode);
|
mPlayer = new MWRender::Player (mRendering.getCamera(), playerNode);
|
||||||
mSun = 0;
|
mSun = 0;
|
||||||
|
|
||||||
mDebugging = new Debugging(mMwRoot, environment, engine);
|
mDebugging = new Debugging(mMwRoot, engine);
|
||||||
mLocalMap = new MWRender::LocalMap(&mRendering, this, &environment);
|
mLocalMap = new MWRender::LocalMap(&mRendering, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderingManager::~RenderingManager ()
|
RenderingManager::~RenderingManager ()
|
||||||
|
|
|
@ -57,7 +57,7 @@ class RenderingManager: private RenderingInterface {
|
||||||
virtual MWRender::Actors& getActors();
|
virtual MWRender::Actors& getActors();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RenderingManager(OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, OEngine::Physic::PhysicEngine* engine, MWWorld::Environment& environment);
|
RenderingManager(OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, OEngine::Physic::PhysicEngine* engine);
|
||||||
virtual ~RenderingManager();
|
virtual ~RenderingManager();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#include <components/nifogre/ogre_nif_loader.hpp>
|
#include <components/nifogre/ogre_nif_loader.hpp>
|
||||||
|
|
||||||
#include "../mwworld/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
#include "renderconst.hpp"
|
#include "renderconst.hpp"
|
||||||
#include "renderingmanager.hpp"
|
#include "renderingmanager.hpp"
|
||||||
|
@ -365,9 +365,8 @@ void SkyManager::ModVertexAlpha(Entity* ent, unsigned int meshType)
|
||||||
ent->getMesh()->getSubMesh(0)->vertexData->vertexBufferBinding->getBuffer(ves_diffuse->getSource())->unlock();
|
ent->getMesh()->getSubMesh(0)->vertexData->vertexBufferBinding->getBuffer(ves_diffuse->getSource())->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
SkyManager::SkyManager (SceneNode* pMwRoot, Camera* pCamera, MWWorld::Environment* env)
|
SkyManager::SkyManager (SceneNode* pMwRoot, Camera* pCamera)
|
||||||
: mEnvironment(env)
|
: mHour(0.0f)
|
||||||
, mHour(0.0f)
|
|
||||||
, mDay(0)
|
, mDay(0)
|
||||||
, mMonth(0)
|
, mMonth(0)
|
||||||
, mSun(NULL)
|
, mSun(NULL)
|
||||||
|
@ -713,7 +712,7 @@ void SkyManager::update(float duration)
|
||||||
if (!mEnabled) return;
|
if (!mEnabled) return;
|
||||||
|
|
||||||
// UV Scroll the clouds
|
// UV Scroll the clouds
|
||||||
mCloudMaterial->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstantFromTime("time", mEnvironment->mWorld->getTimeScaleFactor()/30.f);
|
mCloudMaterial->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstantFromTime("time", MWBase::Environment::get().getWorld()->getTimeScaleFactor()/30.f);
|
||||||
|
|
||||||
/// \todo improve this
|
/// \todo improve this
|
||||||
mMasser->setPhase( static_cast<Moon::Phase>( (int) ((mDay % 32)/4.f)) );
|
mMasser->setPhase( static_cast<Moon::Phase>( (int) ((mDay % 32)/4.f)) );
|
||||||
|
@ -752,7 +751,7 @@ void SkyManager::update(float duration)
|
||||||
mSecunda->setVisible(mSecundaEnabled);
|
mSecunda->setVisible(mSecundaEnabled);
|
||||||
|
|
||||||
// rotate the stars by 360 degrees every 4 days
|
// rotate the stars by 360 degrees every 4 days
|
||||||
mAtmosphereNight->roll(Degree(mEnvironment->mWorld->getTimeScaleFactor()*duration*360 / (3600*96.f)));
|
mAtmosphereNight->roll(Degree(MWBase::Environment::get().getWorld()->getTimeScaleFactor()*duration*360 / (3600*96.f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkyManager::enable()
|
void SkyManager::enable()
|
||||||
|
|
|
@ -108,7 +108,7 @@ namespace MWRender
|
||||||
class SkyManager
|
class SkyManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SkyManager(Ogre::SceneNode* pMwRoot, Ogre::Camera* pCamera, MWWorld::Environment* env);
|
SkyManager(Ogre::SceneNode* pMwRoot, Ogre::Camera* pCamera);
|
||||||
~SkyManager();
|
~SkyManager();
|
||||||
|
|
||||||
void update(float duration);
|
void update(float duration);
|
||||||
|
@ -176,7 +176,6 @@ namespace MWRender
|
||||||
private:
|
private:
|
||||||
bool mCreated;
|
bool mCreated;
|
||||||
|
|
||||||
MWWorld::Environment* mEnvironment;
|
|
||||||
float mHour;
|
float mHour;
|
||||||
int mDay;
|
int mDay;
|
||||||
int mMonth;
|
int mMonth;
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "terrainmaterial.hpp"
|
#include "terrainmaterial.hpp"
|
||||||
#include "terrain.hpp"
|
#include "terrain.hpp"
|
||||||
#include "renderconst.hpp"
|
#include "renderconst.hpp"
|
||||||
|
@ -17,8 +19,8 @@ namespace MWRender
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
TerrainManager::TerrainManager(Ogre::SceneManager* mgr, RenderingManager* rend, const MWWorld::Environment& evn) :
|
TerrainManager::TerrainManager(Ogre::SceneManager* mgr, RenderingManager* rend) :
|
||||||
mEnvironment(evn), mTerrainGroup(TerrainGroup(mgr, Terrain::ALIGN_X_Z, mLandSize, mWorldSize)), mRendering(rend)
|
mTerrainGroup(TerrainGroup(mgr, Terrain::ALIGN_X_Z, mLandSize, mWorldSize)), mRendering(rend)
|
||||||
{
|
{
|
||||||
|
|
||||||
TerrainMaterialGeneratorPtr matGen;
|
TerrainMaterialGeneratorPtr matGen;
|
||||||
|
@ -107,7 +109,7 @@ namespace MWRender
|
||||||
const int cellX = store->cell->getGridX();
|
const int cellX = store->cell->getGridX();
|
||||||
const int cellY = store->cell->getGridY();
|
const int cellY = store->cell->getGridY();
|
||||||
|
|
||||||
ESM::Land* land = mEnvironment.mWorld->getStore().lands.search(cellX, cellY);
|
ESM::Land* land = MWBase::Environment::get().getWorld()->getStore().lands.search(cellX, cellY);
|
||||||
if ( land != NULL )
|
if ( land != NULL )
|
||||||
{
|
{
|
||||||
if (!land->dataLoaded)
|
if (!land->dataLoaded)
|
||||||
|
@ -268,7 +270,7 @@ namespace MWRender
|
||||||
{
|
{
|
||||||
//NB: All vtex ids are +1 compared to the ltex ids
|
//NB: All vtex ids are +1 compared to the ltex ids
|
||||||
|
|
||||||
assert( (int)mEnvironment.mWorld->getStore().landTexts.getSize() >= (int)ltexIndex - 1 &&
|
assert( (int)MWBase::Environment::get().getWorld()->getStore().landTexts.getSize() >= (int)ltexIndex - 1 &&
|
||||||
"LAND.VTEX must be within the bounds of the LTEX array");
|
"LAND.VTEX must be within the bounds of the LTEX array");
|
||||||
|
|
||||||
std::string texture;
|
std::string texture;
|
||||||
|
@ -278,7 +280,7 @@ namespace MWRender
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
texture = mEnvironment.mWorld->getStore().landTexts.search(ltexIndex-1)->texture;
|
texture = MWBase::Environment::get().getWorld()->getStore().landTexts.search(ltexIndex-1)->texture;
|
||||||
//TODO this is needed due to MWs messed up texture handling
|
//TODO this is needed due to MWs messed up texture handling
|
||||||
texture = texture.substr(0, texture.rfind(".")) + ".dds";
|
texture = texture.substr(0, texture.rfind(".")) + ".dds";
|
||||||
}
|
}
|
||||||
|
@ -434,7 +436,7 @@ namespace MWRender
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ESM::Land* land = mEnvironment.mWorld->getStore().lands.search(cellX, cellY);
|
ESM::Land* land = MWBase::Environment::get().getWorld()->getStore().lands.search(cellX, cellY);
|
||||||
if ( land != NULL )
|
if ( land != NULL )
|
||||||
{
|
{
|
||||||
if (!land->dataLoaded)
|
if (!land->dataLoaded)
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace MWRender{
|
||||||
*/
|
*/
|
||||||
class TerrainManager{
|
class TerrainManager{
|
||||||
public:
|
public:
|
||||||
TerrainManager(Ogre::SceneManager* mgr, RenderingManager* rend, const MWWorld::Environment& env);
|
TerrainManager(Ogre::SceneManager* mgr, RenderingManager* rend);
|
||||||
virtual ~TerrainManager();
|
virtual ~TerrainManager();
|
||||||
|
|
||||||
void setDiffuse(const Ogre::ColourValue& diffuse);
|
void setDiffuse(const Ogre::ColourValue& diffuse);
|
||||||
|
@ -36,7 +36,6 @@ namespace MWRender{
|
||||||
Ogre::TerrainGlobalOptions mTerrainGlobals;
|
Ogre::TerrainGlobalOptions mTerrainGlobals;
|
||||||
Ogre::TerrainGroup mTerrainGroup;
|
Ogre::TerrainGroup mTerrainGroup;
|
||||||
|
|
||||||
const MWWorld::Environment& mEnvironment;
|
|
||||||
RenderingManager* mRendering;
|
RenderingManager* mRendering;
|
||||||
|
|
||||||
Ogre::TerrainMaterialGeneratorB::SM2Profile* mActiveProfile;
|
Ogre::TerrainMaterialGeneratorB::SM2Profile* mActiveProfile;
|
||||||
|
|
|
@ -27,10 +27,7 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = R()(runtime);
|
MWWorld::Ptr ptr = R()(runtime);
|
||||||
|
|
||||||
InterpreterContext& context =
|
MWBase::Environment::get().getWorld()->skipAnimation (ptr);
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
context.getWorld().skipAnimation (ptr);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -43,9 +40,6 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = R()(runtime);
|
MWWorld::Ptr ptr = R()(runtime);
|
||||||
|
|
||||||
InterpreterContext& context =
|
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
std::string group = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string group = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
|
@ -60,7 +54,7 @@ namespace MWScript
|
||||||
throw std::runtime_error ("animation mode out of range");
|
throw std::runtime_error ("animation mode out of range");
|
||||||
}
|
}
|
||||||
|
|
||||||
context.getWorld().playAnimationGroup (ptr, group, mode, 1);
|
MWBase::Environment::get().getWorld()->playAnimationGroup (ptr, group, mode, 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -73,9 +67,6 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = R()(runtime);
|
MWWorld::Ptr ptr = R()(runtime);
|
||||||
|
|
||||||
InterpreterContext& context =
|
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
std::string group = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string group = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
|
@ -96,7 +87,7 @@ namespace MWScript
|
||||||
throw std::runtime_error ("animation mode out of range");
|
throw std::runtime_error ("animation mode out of range");
|
||||||
}
|
}
|
||||||
|
|
||||||
context.getWorld().playAnimationGroup (ptr, group, mode, loops);
|
MWBase::Environment::get().getWorld()->playAnimationGroup (ptr, group, mode, loops);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include <components/interpreter/runtime.hpp>
|
#include <components/interpreter/runtime.hpp>
|
||||||
#include <components/interpreter/opcodes.hpp>
|
#include <components/interpreter/opcodes.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
|
|
||||||
|
@ -22,10 +24,7 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context
|
runtime.push (MWBase::Environment::get().getWorld()->hasCellChanged() ? 1 : 0);
|
||||||
= static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
runtime.push (context.getWorld().hasCellChanged() ? 1 : 0);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -35,9 +34,6 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context
|
|
||||||
= static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
std::string cell = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string cell = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
|
@ -45,16 +41,16 @@ namespace MWScript
|
||||||
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
||||||
pos.pos[2] = 0;
|
pos.pos[2] = 0;
|
||||||
|
|
||||||
if (const ESM::Cell *exterior = context.getWorld().getExterior (cell))
|
if (const ESM::Cell *exterior = MWBase::Environment::get().getWorld()->getExterior (cell))
|
||||||
{
|
{
|
||||||
context.getWorld().indexToPosition (exterior->data.gridX, exterior->data.gridY,
|
MWBase::Environment::get().getWorld()->indexToPosition (exterior->data.gridX, exterior->data.gridY,
|
||||||
pos.pos[0], pos.pos[1], true);
|
pos.pos[0], pos.pos[1], true);
|
||||||
context.getWorld().changeToExteriorCell (pos);
|
MWBase::Environment::get().getWorld()->changeToExteriorCell (pos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pos.pos[0] = pos.pos[1] = 0;
|
pos.pos[0] = pos.pos[1] = 0;
|
||||||
context.getWorld().changeToInteriorCell (cell, pos);
|
MWBase::Environment::get().getWorld()->changeToInteriorCell (cell, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -65,9 +61,6 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context
|
|
||||||
= static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
Interpreter::Type_Integer x = runtime[0].mInteger;
|
Interpreter::Type_Integer x = runtime[0].mInteger;
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
|
@ -76,12 +69,12 @@ namespace MWScript
|
||||||
|
|
||||||
ESM::Position pos;
|
ESM::Position pos;
|
||||||
|
|
||||||
context.getWorld().indexToPosition (x, y, pos.pos[0], pos.pos[1], true);
|
MWBase::Environment::get().getWorld()->indexToPosition (x, y, pos.pos[0], pos.pos[1], true);
|
||||||
pos.pos[2] = 0;
|
pos.pos[2] = 0;
|
||||||
|
|
||||||
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
||||||
|
|
||||||
context.getWorld().changeToExteriorCell (pos);
|
MWBase::Environment::get().getWorld()->changeToExteriorCell (pos);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -91,11 +84,8 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context
|
|
||||||
= static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
bool interior =
|
bool interior =
|
||||||
context.getWorld().getPlayer().getPlayer().getCell()->cell->data.flags &
|
MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell->data.flags &
|
||||||
ESM::Cell::Interior;
|
ESM::Cell::Interior;
|
||||||
|
|
||||||
runtime.push (interior ? 1 : 0);
|
runtime.push (interior ? 1 : 0);
|
||||||
|
@ -108,20 +98,17 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context
|
|
||||||
= static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
std::string name = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string name = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
const ESM::Cell *cell = context.getWorld().getPlayer().getPlayer().getCell()->cell;
|
const ESM::Cell *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell;
|
||||||
|
|
||||||
std::string current = cell->name;
|
std::string current = cell->name;
|
||||||
|
|
||||||
if (!(cell->data.flags & ESM::Cell::Interior) && current.empty())
|
if (!(cell->data.flags & ESM::Cell::Interior) && current.empty())
|
||||||
{
|
{
|
||||||
const ESM::Region *region =
|
const ESM::Region *region =
|
||||||
context.getWorld().getStore().regions.find (cell->region);
|
MWBase::Environment::get().getWorld()->getStore().regions.find (cell->region);
|
||||||
|
|
||||||
current = region->name;
|
current = region->name;
|
||||||
}
|
}
|
||||||
|
@ -139,10 +126,7 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context
|
MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell();
|
||||||
= static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
MWWorld::Ptr::CellStore *cell = context.getWorld().getPlayer().getPlayer().getCell();
|
|
||||||
runtime.push (cell->mWaterLevel);
|
runtime.push (cell->mWaterLevel);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -153,18 +137,15 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context
|
|
||||||
= static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
Interpreter::Type_Float level = runtime[0].mFloat;
|
Interpreter::Type_Float level = runtime[0].mFloat;
|
||||||
|
|
||||||
MWWorld::Ptr::CellStore *cell = context.getWorld().getPlayer().getPlayer().getCell();
|
MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell();
|
||||||
|
|
||||||
if (!(cell->cell->data.flags & ESM::Cell::Interior))
|
if (!(cell->cell->data.flags & ESM::Cell::Interior))
|
||||||
throw std::runtime_error("Can't set water level in exterior cell");
|
throw std::runtime_error("Can't set water level in exterior cell");
|
||||||
|
|
||||||
cell->mWaterLevel = level;
|
cell->mWaterLevel = level;
|
||||||
context.getEnvironment().mWorld->setWaterHeight(cell->mWaterLevel);
|
MWBase::Environment::get().getWorld()->setWaterHeight(cell->mWaterLevel);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -174,18 +155,15 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context
|
|
||||||
= static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
Interpreter::Type_Float level = runtime[0].mFloat;
|
Interpreter::Type_Float level = runtime[0].mFloat;
|
||||||
|
|
||||||
MWWorld::Ptr::CellStore *cell = context.getWorld().getPlayer().getPlayer().getCell();
|
MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell();
|
||||||
|
|
||||||
if (!(cell->cell->data.flags & ESM::Cell::Interior))
|
if (!(cell->cell->data.flags & ESM::Cell::Interior))
|
||||||
throw std::runtime_error("Can't set water level in exterior cell");
|
throw std::runtime_error("Can't set water level in exterior cell");
|
||||||
|
|
||||||
cell->mWaterLevel +=level;
|
cell->mWaterLevel +=level;
|
||||||
context.getEnvironment().mWorld->setWaterHeight(cell->mWaterLevel);
|
MWBase::Environment::get().getWorld()->setWaterHeight(cell->mWaterLevel);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
|
|
||||||
#include "compilercontext.hpp"
|
#include "compilercontext.hpp"
|
||||||
|
|
||||||
#include "../mwworld/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
namespace MWScript
|
namespace MWScript
|
||||||
{
|
{
|
||||||
CompilerContext::CompilerContext (Type type, const MWWorld::Environment& environment)
|
CompilerContext::CompilerContext (Type type)
|
||||||
: mType (type), mEnvironment (environment)
|
: mType (type)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool CompilerContext::canDeclareLocals() const
|
bool CompilerContext::canDeclareLocals() const
|
||||||
|
@ -17,32 +18,31 @@ namespace MWScript
|
||||||
|
|
||||||
char CompilerContext::getGlobalType (const std::string& name) const
|
char CompilerContext::getGlobalType (const std::string& name) const
|
||||||
{
|
{
|
||||||
return mEnvironment.mWorld->getGlobalVariableType (name);
|
return MWBase::Environment::get().getWorld()->getGlobalVariableType (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CompilerContext::isId (const std::string& name) const
|
bool CompilerContext::isId (const std::string& name) const
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
mEnvironment.mWorld->getStore().activators.search (name) ||
|
MWBase::Environment::get().getWorld()->getStore().activators.search (name) ||
|
||||||
mEnvironment.mWorld->getStore().potions.search (name) ||
|
MWBase::Environment::get().getWorld()->getStore().potions.search (name) ||
|
||||||
mEnvironment.mWorld->getStore().appas.search (name) ||
|
MWBase::Environment::get().getWorld()->getStore().appas.search (name) ||
|
||||||
mEnvironment.mWorld->getStore().armors.search (name) ||
|
MWBase::Environment::get().getWorld()->getStore().armors.search (name) ||
|
||||||
mEnvironment.mWorld->getStore().books.search (name) ||
|
MWBase::Environment::get().getWorld()->getStore().books.search (name) ||
|
||||||
mEnvironment.mWorld->getStore().clothes.search (name) ||
|
MWBase::Environment::get().getWorld()->getStore().clothes.search (name) ||
|
||||||
mEnvironment.mWorld->getStore().containers.search (name) ||
|
MWBase::Environment::get().getWorld()->getStore().containers.search (name) ||
|
||||||
mEnvironment.mWorld->getStore().creatures.search (name) ||
|
MWBase::Environment::get().getWorld()->getStore().creatures.search (name) ||
|
||||||
mEnvironment.mWorld->getStore().doors.search (name) ||
|
MWBase::Environment::get().getWorld()->getStore().doors.search (name) ||
|
||||||
mEnvironment.mWorld->getStore().ingreds.search (name) ||
|
MWBase::Environment::get().getWorld()->getStore().ingreds.search (name) ||
|
||||||
mEnvironment.mWorld->getStore().creatureLists.search (name) ||
|
MWBase::Environment::get().getWorld()->getStore().creatureLists.search (name) ||
|
||||||
mEnvironment.mWorld->getStore().itemLists.search (name) ||
|
MWBase::Environment::get().getWorld()->getStore().itemLists.search (name) ||
|
||||||
mEnvironment.mWorld->getStore().lights.search (name) ||
|
MWBase::Environment::get().getWorld()->getStore().lights.search (name) ||
|
||||||
mEnvironment.mWorld->getStore().lockpicks.search (name) ||
|
MWBase::Environment::get().getWorld()->getStore().lockpicks.search (name) ||
|
||||||
mEnvironment.mWorld->getStore().miscItems.search (name) ||
|
MWBase::Environment::get().getWorld()->getStore().miscItems.search (name) ||
|
||||||
mEnvironment.mWorld->getStore().npcs.search (name) ||
|
MWBase::Environment::get().getWorld()->getStore().npcs.search (name) ||
|
||||||
mEnvironment.mWorld->getStore().probes.search (name) ||
|
MWBase::Environment::get().getWorld()->getStore().probes.search (name) ||
|
||||||
mEnvironment.mWorld->getStore().repairs.search (name) ||
|
MWBase::Environment::get().getWorld()->getStore().repairs.search (name) ||
|
||||||
mEnvironment.mWorld->getStore().statics.search (name) ||
|
MWBase::Environment::get().getWorld()->getStore().statics.search (name) ||
|
||||||
mEnvironment.mWorld->getStore().weapons.search (name);
|
MWBase::Environment::get().getWorld()->getStore().weapons.search (name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,6 @@
|
||||||
|
|
||||||
#include <components/compiler/context.hpp>
|
#include <components/compiler/context.hpp>
|
||||||
|
|
||||||
namespace MWWorld
|
|
||||||
{
|
|
||||||
class Environment;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace MWScript
|
namespace MWScript
|
||||||
{
|
{
|
||||||
class CompilerContext : public Compiler::Context
|
class CompilerContext : public Compiler::Context
|
||||||
|
@ -24,11 +19,10 @@ namespace MWScript
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Type mType;
|
Type mType;
|
||||||
const MWWorld::Environment& mEnvironment;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CompilerContext (Type type, const MWWorld::Environment& environment);
|
CompilerContext (Type type);
|
||||||
|
|
||||||
/// Is the compiler allowed to declare local variables?
|
/// Is the compiler allowed to declare local variables?
|
||||||
virtual bool canDeclareLocals() const;
|
virtual bool canDeclareLocals() const;
|
||||||
|
@ -42,5 +36,3 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include <components/interpreter/runtime.hpp>
|
#include <components/interpreter/runtime.hpp>
|
||||||
#include <components/interpreter/opcodes.hpp>
|
#include <components/interpreter/opcodes.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/manualref.hpp"
|
#include "../mwworld/manualref.hpp"
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
#include "../mwworld/containerstore.hpp"
|
#include "../mwworld/containerstore.hpp"
|
||||||
|
@ -29,9 +31,6 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = R()(runtime);
|
MWWorld::Ptr ptr = R()(runtime);
|
||||||
|
|
||||||
MWScript::InterpreterContext& context
|
|
||||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
std::string item = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string item = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
|
@ -41,7 +40,7 @@ namespace MWScript
|
||||||
if (count<0)
|
if (count<0)
|
||||||
throw std::runtime_error ("second argument for AddItem must be non-negative");
|
throw std::runtime_error ("second argument for AddItem must be non-negative");
|
||||||
|
|
||||||
MWWorld::ManualRef ref (context.getWorld().getStore(), item);
|
MWWorld::ManualRef ref (MWBase::Environment::get().getWorld()->getStore(), item);
|
||||||
|
|
||||||
ref.getPtr().getRefData().setCount (count);
|
ref.getPtr().getRefData().setCount (count);
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include <components/interpreter/runtime.hpp>
|
#include <components/interpreter/runtime.hpp>
|
||||||
#include <components/interpreter/opcodes.hpp>
|
#include <components/interpreter/opcodes.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
|
|
||||||
#include "interpretercontext.hpp"
|
#include "interpretercontext.hpp"
|
||||||
|
@ -46,7 +48,7 @@ namespace MWScript
|
||||||
InterpreterContext& context
|
InterpreterContext& context
|
||||||
= static_cast<InterpreterContext&> (runtime.getContext());
|
= static_cast<InterpreterContext&> (runtime.getContext());
|
||||||
|
|
||||||
bool enabled = context.getWorld().toggleCollisionMode();
|
bool enabled = MWBase::Environment::get().getWorld()->toggleCollisionMode();
|
||||||
|
|
||||||
context.report (enabled ? "Collision -> On" : "Collision -> Off");
|
context.report (enabled ? "Collision -> On" : "Collision -> Off");
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,16 +23,13 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
MWScript::InterpreterContext& context
|
|
||||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
std::string quest = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string quest = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
Interpreter::Type_Integer index = runtime[0].mInteger;
|
Interpreter::Type_Integer index = runtime[0].mInteger;
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
context.getEnvironment().mJournal->addEntry (quest, index);
|
MWBase::Environment::get().getJournal()->addEntry (quest, index);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,16 +39,13 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
MWScript::InterpreterContext& context
|
|
||||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
std::string quest = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string quest = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
Interpreter::Type_Integer index = runtime[0].mInteger;
|
Interpreter::Type_Integer index = runtime[0].mInteger;
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
context.getEnvironment().mJournal->setJournalIndex (quest, index);
|
MWBase::Environment::get().getJournal()->setJournalIndex (quest, index);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,13 +55,10 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
MWScript::InterpreterContext& context
|
|
||||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
std::string quest = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string quest = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
int index = context.getEnvironment().mJournal->getJournalIndex (quest);
|
int index = MWBase::Environment::get().getJournal()->getJournalIndex (quest);
|
||||||
|
|
||||||
runtime.push (index);
|
runtime.push (index);
|
||||||
|
|
||||||
|
@ -80,13 +71,10 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
MWScript::InterpreterContext& context
|
|
||||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
std::string topic = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string topic = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
context.getEnvironment().mDialogueManager->addTopic(topic);
|
MWBase::Environment::get().getDialogueManager()->addTopic(topic);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -96,9 +84,7 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
||||||
{
|
{
|
||||||
MWScript::InterpreterContext& context
|
MWDialogue::DialogueManager* dialogue = MWBase::Environment::get().getDialogueManager();
|
||||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
||||||
MWDialogue::DialogueManager* dialogue = context.getEnvironment().mDialogueManager;
|
|
||||||
while(arg0>0)
|
while(arg0>0)
|
||||||
{
|
{
|
||||||
std::string question = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string question = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
|
@ -124,9 +110,8 @@ namespace MWScript
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = R()(runtime);
|
MWWorld::Ptr ptr = R()(runtime);
|
||||||
MWScript::InterpreterContext& context
|
|
||||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
MWBase::Environment::get().getDialogueManager()->startDialogue (ptr);
|
||||||
context.getEnvironment().mDialogueManager->startDialogue (ptr);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -51,14 +51,14 @@ namespace MWScript
|
||||||
return iter->second.first;
|
return iter->second.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalScripts::run (MWWorld::Environment& environment)
|
void GlobalScripts::run()
|
||||||
{
|
{
|
||||||
for (std::map<std::string, std::pair<bool, Locals> >::iterator iter (mScripts.begin());
|
for (std::map<std::string, std::pair<bool, Locals> >::iterator iter (mScripts.begin());
|
||||||
iter!=mScripts.end(); ++iter)
|
iter!=mScripts.end(); ++iter)
|
||||||
{
|
{
|
||||||
if (iter->second.first)
|
if (iter->second.first)
|
||||||
{
|
{
|
||||||
MWScript::InterpreterContext interpreterContext (environment,
|
MWScript::InterpreterContext interpreterContext (
|
||||||
&iter->second.second, MWWorld::Ptr());
|
&iter->second.second, MWWorld::Ptr());
|
||||||
mScriptManager.run (iter->first, interpreterContext);
|
mScriptManager.run (iter->first, interpreterContext);
|
||||||
}
|
}
|
||||||
|
@ -66,4 +66,3 @@ namespace MWScript
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,6 @@ namespace ESMS
|
||||||
struct ESMStore;
|
struct ESMStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MWWorld
|
|
||||||
{
|
|
||||||
class Environment;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace MWScript
|
namespace MWScript
|
||||||
{
|
{
|
||||||
class ScriptManager;
|
class ScriptManager;
|
||||||
|
@ -36,10 +31,9 @@ namespace MWScript
|
||||||
|
|
||||||
bool isRunning (const std::string& name) const;
|
bool isRunning (const std::string& name) const;
|
||||||
|
|
||||||
void run (MWWorld::Environment& environment);
|
void run();
|
||||||
///< run all active global scripts
|
///< run all active global scripts
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include <components/interpreter/runtime.hpp>
|
#include <components/interpreter/runtime.hpp>
|
||||||
#include <components/interpreter/opcodes.hpp>
|
#include <components/interpreter/opcodes.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwgui/window_manager.hpp"
|
||||||
#include "../mwinput/inputmanager.hpp"
|
#include "../mwinput/inputmanager.hpp"
|
||||||
|
|
||||||
|
@ -26,10 +28,7 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context =
|
MWBase::Environment::get().getWindowManager()->allow (mWindow);
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
context.getWindowManager().allow (mWindow);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -45,10 +44,7 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context =
|
MWBase::Environment::get().getInputManager()->setGuiMode(mDialogue);
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
context.getInputManager().setGuiMode(mDialogue);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -63,7 +59,7 @@ namespace MWScript
|
||||||
|
|
||||||
MWWorld::Ptr ptr = context.getReference();
|
MWWorld::Ptr ptr = context.getReference();
|
||||||
|
|
||||||
runtime.push (context.getWindowManager().readPressedButton());
|
runtime.push (MWBase::Environment::get().getWindowManager()->readPressedButton());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -73,10 +69,7 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context =
|
MWBase::Environment::get().getWindowManager()->toggleFogOfWar();
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
context.getEnvironment().mWindowManager->toggleFogOfWar();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -86,10 +79,7 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context =
|
MWBase::Environment::get().getWindowManager()->toggleFullHelp();
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
context.getEnvironment().mWindowManager->toggleFullHelp();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
#include <components/interpreter/types.hpp>
|
#include <components/interpreter/types.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwgui/window_manager.hpp"
|
||||||
|
@ -15,6 +17,7 @@
|
||||||
|
|
||||||
#include "locals.hpp"
|
#include "locals.hpp"
|
||||||
#include "globalscripts.hpp"
|
#include "globalscripts.hpp"
|
||||||
|
#include "scriptmanager.hpp"
|
||||||
|
|
||||||
namespace MWScript
|
namespace MWScript
|
||||||
{
|
{
|
||||||
|
@ -23,7 +26,7 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
if (!id.empty())
|
if (!id.empty())
|
||||||
{
|
{
|
||||||
return mEnvironment.mWorld->getPtr (id, activeOnly);
|
return MWBase::Environment::get().getWorld()->getPtr (id, activeOnly);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -39,7 +42,7 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
if (!id.empty())
|
if (!id.empty())
|
||||||
{
|
{
|
||||||
return mEnvironment.mWorld->getPtr (id, activeOnly);
|
return MWBase::Environment::get().getWorld()->getPtr (id, activeOnly);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -50,9 +53,9 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InterpreterContext::InterpreterContext (MWWorld::Environment& environment,
|
InterpreterContext::InterpreterContext (
|
||||||
MWScript::Locals *locals, MWWorld::Ptr reference)
|
MWScript::Locals *locals, MWWorld::Ptr reference)
|
||||||
: mEnvironment (environment), mLocals (locals), mReference (reference),
|
: mLocals (locals), mReference (reference),
|
||||||
mActivationHandled (false)
|
mActivationHandled (false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -107,7 +110,7 @@ namespace MWScript
|
||||||
void InterpreterContext::messageBox (const std::string& message,
|
void InterpreterContext::messageBox (const std::string& message,
|
||||||
const std::vector<std::string>& buttons)
|
const std::vector<std::string>& buttons)
|
||||||
{
|
{
|
||||||
mEnvironment.mWindowManager->messageBox (message, buttons);
|
MWBase::Environment::get().getWindowManager()->messageBox (message, buttons);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InterpreterContext::report (const std::string& message)
|
void InterpreterContext::report (const std::string& message)
|
||||||
|
@ -117,74 +120,74 @@ namespace MWScript
|
||||||
|
|
||||||
bool InterpreterContext::menuMode()
|
bool InterpreterContext::menuMode()
|
||||||
{
|
{
|
||||||
return mEnvironment.mWindowManager->isGuiMode();
|
return MWBase::Environment::get().getWindowManager()->isGuiMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterpreterContext::getGlobalShort (const std::string& name) const
|
int InterpreterContext::getGlobalShort (const std::string& name) const
|
||||||
{
|
{
|
||||||
return mEnvironment.mWorld->getGlobalVariable (name).mShort;
|
return MWBase::Environment::get().getWorld()->getGlobalVariable (name).mShort;
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterpreterContext::getGlobalLong (const std::string& name) const
|
int InterpreterContext::getGlobalLong (const std::string& name) const
|
||||||
{
|
{
|
||||||
// a global long is internally a float.
|
// a global long is internally a float.
|
||||||
return mEnvironment.mWorld->getGlobalVariable (name).mLong;
|
return MWBase::Environment::get().getWorld()->getGlobalVariable (name).mLong;
|
||||||
}
|
}
|
||||||
|
|
||||||
float InterpreterContext::getGlobalFloat (const std::string& name) const
|
float InterpreterContext::getGlobalFloat (const std::string& name) const
|
||||||
{
|
{
|
||||||
return mEnvironment.mWorld->getGlobalVariable (name).mFloat;
|
return MWBase::Environment::get().getWorld()->getGlobalVariable (name).mFloat;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InterpreterContext::setGlobalShort (const std::string& name, int value)
|
void InterpreterContext::setGlobalShort (const std::string& name, int value)
|
||||||
{
|
{
|
||||||
if (name=="gamehour")
|
if (name=="gamehour")
|
||||||
mEnvironment.mWorld->setHour (value);
|
MWBase::Environment::get().getWorld()->setHour (value);
|
||||||
else if (name=="day")
|
else if (name=="day")
|
||||||
mEnvironment.mWorld->setDay (value);
|
MWBase::Environment::get().getWorld()->setDay (value);
|
||||||
else if (name=="month")
|
else if (name=="month")
|
||||||
mEnvironment.mWorld->setMonth (value);
|
MWBase::Environment::get().getWorld()->setMonth (value);
|
||||||
else
|
else
|
||||||
mEnvironment.mWorld->getGlobalVariable (name).mShort = value;
|
MWBase::Environment::get().getWorld()->getGlobalVariable (name).mShort = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InterpreterContext::setGlobalLong (const std::string& name, int value)
|
void InterpreterContext::setGlobalLong (const std::string& name, int value)
|
||||||
{
|
{
|
||||||
if (name=="gamehour")
|
if (name=="gamehour")
|
||||||
mEnvironment.mWorld->setHour (value);
|
MWBase::Environment::get().getWorld()->setHour (value);
|
||||||
else if (name=="day")
|
else if (name=="day")
|
||||||
mEnvironment.mWorld->setDay (value);
|
MWBase::Environment::get().getWorld()->setDay (value);
|
||||||
else if (name=="month")
|
else if (name=="month")
|
||||||
mEnvironment.mWorld->setMonth (value);
|
MWBase::Environment::get().getWorld()->setMonth (value);
|
||||||
else
|
else
|
||||||
mEnvironment.mWorld->getGlobalVariable (name).mLong = value;
|
MWBase::Environment::get().getWorld()->getGlobalVariable (name).mLong = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InterpreterContext::setGlobalFloat (const std::string& name, float value)
|
void InterpreterContext::setGlobalFloat (const std::string& name, float value)
|
||||||
{
|
{
|
||||||
if (name=="gamehour")
|
if (name=="gamehour")
|
||||||
mEnvironment.mWorld->setHour (value);
|
MWBase::Environment::get().getWorld()->setHour (value);
|
||||||
else if (name=="day")
|
else if (name=="day")
|
||||||
mEnvironment.mWorld->setDay (value);
|
MWBase::Environment::get().getWorld()->setDay (value);
|
||||||
else if (name=="month")
|
else if (name=="month")
|
||||||
mEnvironment.mWorld->setMonth (value);
|
MWBase::Environment::get().getWorld()->setMonth (value);
|
||||||
else
|
else
|
||||||
mEnvironment.mWorld->getGlobalVariable (name).mFloat = value;
|
MWBase::Environment::get().getWorld()->getGlobalVariable (name).mFloat = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InterpreterContext::isScriptRunning (const std::string& name) const
|
bool InterpreterContext::isScriptRunning (const std::string& name) const
|
||||||
{
|
{
|
||||||
return mEnvironment.mGlobalScripts->isRunning (name);
|
return MWBase::Environment::get().getScriptManager()->getGlobalScripts().isRunning (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InterpreterContext::startScript (const std::string& name)
|
void InterpreterContext::startScript (const std::string& name)
|
||||||
{
|
{
|
||||||
mEnvironment.mGlobalScripts->addScript (name);
|
MWBase::Environment::get().getScriptManager()->getGlobalScripts().addScript (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InterpreterContext::stopScript (const std::string& name)
|
void InterpreterContext::stopScript (const std::string& name)
|
||||||
{
|
{
|
||||||
mEnvironment.mGlobalScripts->removeScript (name);
|
MWBase::Environment::get().getScriptManager()->getGlobalScripts().removeScript (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
float InterpreterContext::getDistance (const std::string& name, const std::string& id) const
|
float InterpreterContext::getDistance (const std::string& name, const std::string& id) const
|
||||||
|
@ -192,7 +195,7 @@ namespace MWScript
|
||||||
// TODO handle exterior cells (when ref and ref2 are located in different cells)
|
// TODO handle exterior cells (when ref and ref2 are located in different cells)
|
||||||
const MWWorld::Ptr ref2 = getReference (id, false);
|
const MWWorld::Ptr ref2 = getReference (id, false);
|
||||||
|
|
||||||
const MWWorld::Ptr ref = mEnvironment.mWorld->getPtr (name, true);
|
const MWWorld::Ptr ref = MWBase::Environment::get().getWorld()->getPtr (name, true);
|
||||||
|
|
||||||
double diff[3];
|
double diff[3];
|
||||||
|
|
||||||
|
@ -233,7 +236,7 @@ namespace MWScript
|
||||||
if (!mAction.get())
|
if (!mAction.get())
|
||||||
throw std::runtime_error ("activation failed, because no action to perform");
|
throw std::runtime_error ("activation failed, because no action to perform");
|
||||||
|
|
||||||
mAction->execute (mEnvironment);
|
mAction->execute();
|
||||||
mActivationHandled = true;
|
mActivationHandled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +249,7 @@ namespace MWScript
|
||||||
|
|
||||||
float InterpreterContext::getSecondsPassed() const
|
float InterpreterContext::getSecondsPassed() const
|
||||||
{
|
{
|
||||||
return mEnvironment.mFrameDuration;
|
return MWBase::Environment::get().getFrameDuration();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InterpreterContext::isDisabled (const std::string& id) const
|
bool InterpreterContext::isDisabled (const std::string& id) const
|
||||||
|
@ -258,38 +261,13 @@ namespace MWScript
|
||||||
void InterpreterContext::enable (const std::string& id)
|
void InterpreterContext::enable (const std::string& id)
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ref = getReference (id, false);
|
MWWorld::Ptr ref = getReference (id, false);
|
||||||
mEnvironment.mWorld->enable (ref);
|
MWBase::Environment::get().getWorld()->enable (ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InterpreterContext::disable (const std::string& id)
|
void InterpreterContext::disable (const std::string& id)
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ref = getReference (id, false);
|
MWWorld::Ptr ref = getReference (id, false);
|
||||||
mEnvironment.mWorld->disable (ref);
|
MWBase::Environment::get().getWorld()->disable (ref);
|
||||||
}
|
|
||||||
|
|
||||||
MWWorld::Environment& InterpreterContext::getEnvironment()
|
|
||||||
{
|
|
||||||
return mEnvironment;
|
|
||||||
}
|
|
||||||
|
|
||||||
MWGui::WindowManager& InterpreterContext::getWindowManager()
|
|
||||||
{
|
|
||||||
return *mEnvironment.mWindowManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
MWInput::MWInputManager& InterpreterContext::getInputManager()
|
|
||||||
{
|
|
||||||
return *mEnvironment.mInputManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
MWWorld::World& InterpreterContext::getWorld()
|
|
||||||
{
|
|
||||||
return *mEnvironment.mWorld;
|
|
||||||
}
|
|
||||||
|
|
||||||
MWSound::SoundManager& InterpreterContext::getSoundManager()
|
|
||||||
{
|
|
||||||
return *mEnvironment.mSoundManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MWWorld::Ptr InterpreterContext::getReference()
|
MWWorld::Ptr InterpreterContext::getReference()
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#include <components/interpreter/context.hpp>
|
#include <components/interpreter/context.hpp>
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
#include "../mwworld/action.hpp"
|
#include "../mwworld/action.hpp"
|
||||||
|
|
||||||
|
@ -26,7 +25,6 @@ namespace MWScript
|
||||||
|
|
||||||
class InterpreterContext : public Interpreter::Context
|
class InterpreterContext : public Interpreter::Context
|
||||||
{
|
{
|
||||||
MWWorld::Environment& mEnvironment;
|
|
||||||
Locals *mLocals;
|
Locals *mLocals;
|
||||||
MWWorld::Ptr mReference;
|
MWWorld::Ptr mReference;
|
||||||
|
|
||||||
|
@ -40,8 +38,7 @@ namespace MWScript
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
InterpreterContext (MWWorld::Environment& environment,
|
InterpreterContext (MWScript::Locals *locals, MWWorld::Ptr reference);
|
||||||
MWScript::Locals *locals, MWWorld::Ptr reference);
|
|
||||||
///< The ownership of \a locals is not transferred. 0-pointer allowed.
|
///< The ownership of \a locals is not transferred. 0-pointer allowed.
|
||||||
|
|
||||||
virtual int getLocalShort (int index) const;
|
virtual int getLocalShort (int index) const;
|
||||||
|
@ -110,18 +107,6 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void disable (const std::string& id = "");
|
virtual void disable (const std::string& id = "");
|
||||||
|
|
||||||
MWWorld::Environment& getEnvironment();
|
|
||||||
|
|
||||||
/// \todo remove the following functions (extentions should use getEnvironment instead)
|
|
||||||
|
|
||||||
MWWorld::World& getWorld();
|
|
||||||
|
|
||||||
MWSound::SoundManager& getSoundManager();
|
|
||||||
|
|
||||||
MWGui::WindowManager& getWindowManager();
|
|
||||||
|
|
||||||
MWInput::MWInputManager& getInputManager();
|
|
||||||
|
|
||||||
MWWorld::Ptr getReference();
|
MWWorld::Ptr getReference();
|
||||||
///< Reference, that the script is running from (can be empty)
|
///< Reference, that the script is running from (can be empty)
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include <components/interpreter/runtime.hpp>
|
#include <components/interpreter/runtime.hpp>
|
||||||
#include <components/interpreter/opcodes.hpp>
|
#include <components/interpreter/opcodes.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
|
|
||||||
#include "interpretercontext.hpp"
|
#include "interpretercontext.hpp"
|
||||||
|
@ -100,7 +102,7 @@ namespace MWScript
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
static_cast<InterpreterContext&> (runtime.getContext());
|
||||||
|
|
||||||
bool enabled =
|
bool enabled =
|
||||||
context.getWorld().toggleRenderMode (MWWorld::World::Render_CollisionDebug);
|
MWBase::Environment::get().getWorld()->toggleRenderMode (MWWorld::World::Render_CollisionDebug);
|
||||||
|
|
||||||
context.report (enabled ?
|
context.report (enabled ?
|
||||||
"Collision Mesh Rendering -> On" : "Collision Mesh Rendering -> Off");
|
"Collision Mesh Rendering -> On" : "Collision Mesh Rendering -> Off");
|
||||||
|
@ -117,7 +119,7 @@ namespace MWScript
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
static_cast<InterpreterContext&> (runtime.getContext());
|
||||||
|
|
||||||
bool enabled =
|
bool enabled =
|
||||||
context.getWorld().toggleRenderMode (MWWorld::World::Render_Wireframe);
|
MWBase::Environment::get().getWorld()->toggleRenderMode (MWWorld::World::Render_Wireframe);
|
||||||
|
|
||||||
context.report (enabled ?
|
context.report (enabled ?
|
||||||
"Wireframe Rendering -> On" : "Wireframe Rendering -> Off");
|
"Wireframe Rendering -> On" : "Wireframe Rendering -> Off");
|
||||||
|
@ -133,7 +135,7 @@ namespace MWScript
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
static_cast<InterpreterContext&> (runtime.getContext());
|
||||||
|
|
||||||
bool enabled =
|
bool enabled =
|
||||||
context.getWorld().toggleRenderMode (MWWorld::World::Render_Pathgrid);
|
MWBase::Environment::get().getWorld()->toggleRenderMode (MWWorld::World::Render_Pathgrid);
|
||||||
|
|
||||||
context.report (enabled ?
|
context.report (enabled ?
|
||||||
"Path Grid rendering -> On" : "Path Grid Rendering -> Off");
|
"Path Grid rendering -> On" : "Path Grid Rendering -> Off");
|
||||||
|
@ -146,13 +148,10 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context =
|
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
Interpreter::Type_Float time = runtime[0].mFloat;
|
Interpreter::Type_Float time = runtime[0].mFloat;
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
context.getWorld().getFader()->fadeIn(time);
|
MWBase::Environment::get().getWorld()->getFader()->fadeIn(time);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -162,13 +161,10 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context =
|
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
Interpreter::Type_Float time = runtime[0].mFloat;
|
Interpreter::Type_Float time = runtime[0].mFloat;
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
context.getWorld().getFader()->fadeOut(time);
|
MWBase::Environment::get().getWorld()->getFader()->fadeOut(time);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -178,16 +174,13 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context =
|
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
Interpreter::Type_Float alpha = runtime[0].mFloat;
|
Interpreter::Type_Float alpha = runtime[0].mFloat;
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
Interpreter::Type_Float time = runtime[0].mFloat;
|
Interpreter::Type_Float time = runtime[0].mFloat;
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
context.getWorld().getFader()->fadeTo(alpha, time);
|
MWBase::Environment::get().getWorld()->getFader()->fadeTo(alpha, time);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -197,10 +190,7 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context =
|
MWBase::Environment::get().getWorld()->toggleWater();
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
context.getWorld().toggleWater();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
#include <components/interpreter/runtime.hpp>
|
#include <components/interpreter/runtime.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
|
@ -16,13 +18,10 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
MWWorld::Ptr operator() (Interpreter::Runtime& runtime) const
|
MWWorld::Ptr operator() (Interpreter::Runtime& runtime) const
|
||||||
{
|
{
|
||||||
MWScript::InterpreterContext& context
|
|
||||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
return context.getWorld().getPtr (id, false);
|
return MWBase::Environment::get().getWorld()->getPtr (id, false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace MWScript
|
||||||
Compiler::Context& compilerContext)
|
Compiler::Context& compilerContext)
|
||||||
: mErrorHandler (std::cerr), mStore (store), mVerbose (verbose),
|
: mErrorHandler (std::cerr), mStore (store), mVerbose (verbose),
|
||||||
mCompilerContext (compilerContext), mParser (mErrorHandler, mCompilerContext),
|
mCompilerContext (compilerContext), mParser (mErrorHandler, mCompilerContext),
|
||||||
mOpcodesInstalled (false)
|
mOpcodesInstalled (false), mGlobalScripts (store, *this)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool ScriptManager::compile (const std::string& name)
|
bool ScriptManager::compile (const std::string& name)
|
||||||
|
@ -151,4 +151,9 @@ namespace MWScript
|
||||||
|
|
||||||
return iter->second.second;
|
return iter->second.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GlobalScripts& ScriptManager::getGlobalScripts()
|
||||||
|
{
|
||||||
|
return mGlobalScripts;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
#include <components/interpreter/interpreter.hpp>
|
#include <components/interpreter/interpreter.hpp>
|
||||||
#include <components/interpreter/types.hpp>
|
#include <components/interpreter/types.hpp>
|
||||||
|
|
||||||
|
#include "globalscripts.hpp"
|
||||||
|
|
||||||
namespace ESMS
|
namespace ESMS
|
||||||
{
|
{
|
||||||
struct ESMStore;
|
struct ESMStore;
|
||||||
|
@ -42,8 +44,8 @@ namespace MWScript
|
||||||
typedef std::pair<std::vector<Interpreter::Type_Code>, Compiler::Locals> CompiledScript;
|
typedef std::pair<std::vector<Interpreter::Type_Code>, Compiler::Locals> CompiledScript;
|
||||||
typedef std::map<std::string, CompiledScript> ScriptCollection;
|
typedef std::map<std::string, CompiledScript> ScriptCollection;
|
||||||
|
|
||||||
|
|
||||||
ScriptCollection mScripts;
|
ScriptCollection mScripts;
|
||||||
|
GlobalScripts mGlobalScripts;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -63,6 +65,8 @@ namespace MWScript
|
||||||
|
|
||||||
Compiler::Locals& getLocals (const std::string& name);
|
Compiler::Locals& getLocals (const std::string& name);
|
||||||
///< Return locals for script \a name.
|
///< Return locals for script \a name.
|
||||||
|
|
||||||
|
GlobalScripts& getGlobalScripts();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include <components/interpreter/runtime.hpp>
|
#include <components/interpreter/runtime.hpp>
|
||||||
#include <components/interpreter/opcodes.hpp>
|
#include <components/interpreter/opcodes.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "interpretercontext.hpp"
|
#include "interpretercontext.hpp"
|
||||||
|
|
||||||
namespace MWScript
|
namespace MWScript
|
||||||
|
@ -19,11 +21,11 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
|
bool enabled = MWBase::Environment::get().getWorld()->toggleSky();
|
||||||
|
|
||||||
InterpreterContext& context =
|
InterpreterContext& context =
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
static_cast<InterpreterContext&> (runtime.getContext());
|
||||||
|
|
||||||
bool enabled = context.getWorld().toggleSky();
|
|
||||||
|
|
||||||
context.report (enabled ? "Sky -> On" : "Sky -> Off");
|
context.report (enabled ? "Sky -> On" : "Sky -> Off");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -34,10 +36,7 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context =
|
MWBase::Environment::get().getWorld()->setMoonColour (false);
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
context.getWorld().setMoonColour (false);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,10 +46,7 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context =
|
MWBase::Environment::get().getWorld()->setMoonColour (true);
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
context.getWorld().setMoonColour (true);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -60,10 +56,7 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context =
|
runtime.push (MWBase::Environment::get().getWorld()->getMasserPhase());
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
runtime.push (context.getWorld().getMasserPhase());
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -73,10 +66,7 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context =
|
runtime.push (MWBase::Environment::get().getWorld()->getSecundaPhase());
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
runtime.push (context.getWorld().getSecundaPhase());
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -86,10 +76,7 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context =
|
runtime.push (MWBase::Environment::get().getWorld()->getCurrentWeather());
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
runtime.push (context.getWorld().getCurrentWeather());
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -99,16 +86,13 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
InterpreterContext& context =
|
|
||||||
static_cast<InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
std::string region = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string region = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
Interpreter::Type_Integer id = runtime[0].mInteger;
|
Interpreter::Type_Integer id = runtime[0].mInteger;
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
context.getWorld().changeWeather(region, id);
|
MWBase::Environment::get().getWorld()->changeWeather(region, id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include <components/interpreter/runtime.hpp>
|
#include <components/interpreter/runtime.hpp>
|
||||||
#include <components/interpreter/opcodes.hpp>
|
#include <components/interpreter/opcodes.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
#include "../mwsound/soundmanager.hpp"
|
#include "../mwsound/soundmanager.hpp"
|
||||||
|
@ -36,7 +38,7 @@ namespace MWScript
|
||||||
std::string text = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string text = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
context.getSoundManager().say (ptr, file);
|
MWBase::Environment::get().getSoundManager()->say (ptr, file);
|
||||||
context.messageBox (text);
|
context.messageBox (text);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -50,10 +52,7 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = R()(runtime);
|
MWWorld::Ptr ptr = R()(runtime);
|
||||||
|
|
||||||
MWScript::InterpreterContext& context
|
runtime.push (MWBase::Environment::get().getSoundManager()->sayDone (ptr));
|
||||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
runtime.push (context.getSoundManager().sayDone (ptr));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -63,13 +62,10 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
MWScript::InterpreterContext& context
|
|
||||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
context.getSoundManager().streamMusic (sound);
|
MWBase::Environment::get().getSoundManager()->streamMusic (sound);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -79,13 +75,10 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
MWScript::InterpreterContext& context
|
|
||||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
context.getSoundManager().playSound (sound, 1.0, 1.0);
|
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -95,9 +88,6 @@ namespace MWScript
|
||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime)
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
MWScript::InterpreterContext& context
|
|
||||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
|
@ -107,7 +97,7 @@ namespace MWScript
|
||||||
Interpreter::Type_Float pitch = runtime[0].mFloat;
|
Interpreter::Type_Float pitch = runtime[0].mFloat;
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
context.getSoundManager().playSound (sound, volume, pitch);
|
MWBase::Environment::get().getSoundManager()->playSound (sound, volume, pitch);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -124,13 +114,10 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = R()(runtime);
|
MWWorld::Ptr ptr = R()(runtime);
|
||||||
|
|
||||||
MWScript::InterpreterContext& context
|
|
||||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
context.getSoundManager().playSound3D (ptr, sound, 1.0, 1.0, mLoop ? MWSound::Play_Loop : 0);
|
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, sound, 1.0, 1.0, mLoop ? MWSound::Play_Loop : 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -147,9 +134,6 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = R()(runtime);
|
MWWorld::Ptr ptr = R()(runtime);
|
||||||
|
|
||||||
MWScript::InterpreterContext& context
|
|
||||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
|
@ -159,7 +143,7 @@ namespace MWScript
|
||||||
Interpreter::Type_Float pitch = runtime[0].mFloat;
|
Interpreter::Type_Float pitch = runtime[0].mFloat;
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
context.getSoundManager().playSound3D (ptr, sound, volume, pitch, mLoop ? MWSound::Play_Loop : 0);
|
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, sound, volume, pitch, mLoop ? MWSound::Play_Loop : 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -173,13 +157,10 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = R()(runtime);
|
MWWorld::Ptr ptr = R()(runtime);
|
||||||
|
|
||||||
MWScript::InterpreterContext& context
|
|
||||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
context.getSoundManager().stopSound3D (ptr, sound);
|
MWBase::Environment::get().getSoundManager()->stopSound3D (ptr, sound);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -192,13 +173,10 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = R()(runtime);
|
MWWorld::Ptr ptr = R()(runtime);
|
||||||
|
|
||||||
MWScript::InterpreterContext& context
|
|
||||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
||||||
|
|
||||||
int index = runtime[0].mInteger;
|
int index = runtime[0].mInteger;
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
runtime.push (context.getSoundManager().getSoundPlaying (
|
runtime.push (MWBase::Environment::get().getSoundManager()->getSoundPlaying (
|
||||||
ptr, runtime.getStringLiteral (index)));
|
ptr, runtime.getStringLiteral (index)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,8 +7,9 @@
|
||||||
#include <components/interpreter/runtime.hpp>
|
#include <components/interpreter/runtime.hpp>
|
||||||
#include <components/interpreter/opcodes.hpp>
|
#include <components/interpreter/opcodes.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/creaturestats.hpp"
|
#include "../mwmechanics/creaturestats.hpp"
|
||||||
|
@ -351,11 +352,10 @@ namespace MWScript
|
||||||
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
||||||
{
|
{
|
||||||
std::string factionID = "";
|
std::string factionID = "";
|
||||||
MWScript::InterpreterContext& context
|
|
||||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
||||||
if(arg0==0)
|
if(arg0==0)
|
||||||
{
|
{
|
||||||
factionID = context.getEnvironment().mDialogueManager->getFaction();
|
factionID = MWBase::Environment::get().getDialogueManager()->getFaction();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -364,7 +364,7 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
if(factionID != "")
|
if(factionID != "")
|
||||||
{
|
{
|
||||||
MWWorld::Ptr player = context.getEnvironment().mWorld->getPlayer().getPlayer();
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||||
if(MWWorld::Class::get(player).getNpcStats(player).mFactionRank.find(factionID) == MWWorld::Class::get(player).getNpcStats(player).mFactionRank.end())
|
if(MWWorld::Class::get(player).getNpcStats(player).mFactionRank.find(factionID) == MWWorld::Class::get(player).getNpcStats(player).mFactionRank.end())
|
||||||
{
|
{
|
||||||
MWWorld::Class::get(player).getNpcStats(player).mFactionRank[factionID] = 0;
|
MWWorld::Class::get(player).getNpcStats(player).mFactionRank[factionID] = 0;
|
||||||
|
@ -380,11 +380,10 @@ namespace MWScript
|
||||||
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
||||||
{
|
{
|
||||||
std::string factionID = "";
|
std::string factionID = "";
|
||||||
MWScript::InterpreterContext& context
|
|
||||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
||||||
if(arg0==0)
|
if(arg0==0)
|
||||||
{
|
{
|
||||||
factionID = context.getEnvironment().mDialogueManager->getFaction();
|
factionID = MWBase::Environment::get().getDialogueManager()->getFaction();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -393,7 +392,7 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
if(factionID != "")
|
if(factionID != "")
|
||||||
{
|
{
|
||||||
MWWorld::Ptr player = context.getEnvironment().mWorld->getPlayer().getPlayer();
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||||
if(MWWorld::Class::get(player).getNpcStats(player).mFactionRank.find(factionID) == MWWorld::Class::get(player).getNpcStats(player).mFactionRank.end())
|
if(MWWorld::Class::get(player).getNpcStats(player).mFactionRank.find(factionID) == MWWorld::Class::get(player).getNpcStats(player).mFactionRank.end())
|
||||||
{
|
{
|
||||||
MWWorld::Class::get(player).getNpcStats(player).mFactionRank[factionID] = 0;
|
MWWorld::Class::get(player).getNpcStats(player).mFactionRank[factionID] = 0;
|
||||||
|
@ -413,11 +412,10 @@ namespace MWScript
|
||||||
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
||||||
{
|
{
|
||||||
std::string factionID = "";
|
std::string factionID = "";
|
||||||
MWScript::InterpreterContext& context
|
|
||||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
||||||
if(arg0==0)
|
if(arg0==0)
|
||||||
{
|
{
|
||||||
factionID = context.getEnvironment().mDialogueManager->getFaction();
|
factionID = MWBase::Environment::get().getDialogueManager()->getFaction();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -426,7 +424,7 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
if(factionID != "")
|
if(factionID != "")
|
||||||
{
|
{
|
||||||
MWWorld::Ptr player = context.getEnvironment().mWorld->getPlayer().getPlayer();
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||||
if(MWWorld::Class::get(player).getNpcStats(player).mFactionRank.find(factionID) != MWWorld::Class::get(player).getNpcStats(player).mFactionRank.end())
|
if(MWWorld::Class::get(player).getNpcStats(player).mFactionRank.find(factionID) != MWWorld::Class::get(player).getNpcStats(player).mFactionRank.end())
|
||||||
{
|
{
|
||||||
MWWorld::Class::get(player).getNpcStats(player).mFactionRank[factionID] = MWWorld::Class::get(player).getNpcStats(player).mFactionRank[factionID] -1;
|
MWWorld::Class::get(player).getNpcStats(player).mFactionRank[factionID] = MWWorld::Class::get(player).getNpcStats(player).mFactionRank[factionID] -1;
|
||||||
|
@ -461,9 +459,7 @@ namespace MWScript
|
||||||
factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).mFactionRank.begin()->first;
|
factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).mFactionRank.begin()->first;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MWScript::InterpreterContext& context
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
||||||
MWWorld::Ptr player = context.getEnvironment().mWorld->getPlayer().getPlayer();
|
|
||||||
if(factionID!="")
|
if(factionID!="")
|
||||||
{
|
{
|
||||||
if(MWWorld::Class::get(player).getNpcStats(player).mFactionRank.find(factionID) != MWWorld::Class::get(player).getNpcStats(player).mFactionRank.end())
|
if(MWWorld::Class::get(player).getNpcStats(player).mFactionRank.find(factionID) != MWWorld::Class::get(player).getNpcStats(player).mFactionRank.end())
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue