mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 17:26:38 +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) | ||||
| 
 | ||||
| if(WIN32) | ||||
|     FILE(GLOB files "${OpenMW_BINARY_DIR}/Release/*.*") | ||||
|     INSTALL(FILES ${files} DESTINATION ".") | ||||
|     FILE(GLOB dll_files "${OpenMW_BINARY_DIR}/Release/*.dll") | ||||
|     INSTALL(FILES ${dll_files} DESTINATION ".") | ||||
|     INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "." RENAME "openmw.cfg") | ||||
|     INSTALL(FILES | ||||
|         "${OpenMW_BINARY_DIR}/plugins.cfg" | ||||
|         "${OpenMW_SOURCE_DIR}/readme.txt" | ||||
|         "${OpenMW_BINARY_DIR}/launcher.qss" | ||||
|         "${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 ".") | ||||
|     INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION ".") | ||||
| 
 | ||||
|  | @ -390,7 +395,7 @@ if(WIN32) | |||
|     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_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") | ||||
|     if(EXISTS ${VCREDIST32}) | ||||
|  |  | |||
|  | @ -44,7 +44,7 @@ add_openmw_dir (mwsound | |||
|     ) | ||||
| 
 | ||||
| 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 | ||||
|     cells localscripts customdata weather inventorystore ptr | ||||
|     ) | ||||
|  | @ -58,6 +58,10 @@ add_openmw_dir (mwmechanics | |||
|     mechanicsmanager stat creaturestats magiceffects movement actors drawstate spells | ||||
|     ) | ||||
| 
 | ||||
| add_openmw_dir (mwbase | ||||
|     environment | ||||
|     ) | ||||
| 
 | ||||
| # Main executable | ||||
| IF(OGRE_STATIC) | ||||
| IF(WIN32) | ||||
|  |  | |||
|  | @ -50,10 +50,12 @@ | |||
| 
 | ||||
| #include "mwmechanics/mechanicsmanager.hpp" | ||||
| 
 | ||||
| #include "mwbase/environment.hpp" | ||||
| 
 | ||||
| 
 | ||||
| void OMW::Engine::executeLocalScripts() | ||||
| { | ||||
|     MWWorld::LocalScripts& localScripts = mEnvironment.mWorld->getLocalScripts(); | ||||
|     MWWorld::LocalScripts& localScripts = MWBase::Environment::get().getWorld()->getLocalScripts(); | ||||
| 
 | ||||
|     localScripts.startIteration(); | ||||
| 
 | ||||
|  | @ -61,11 +63,11 @@ void OMW::Engine::executeLocalScripts() | |||
|     { | ||||
|         std::pair<std::string, MWWorld::Ptr> script = localScripts.getNext(); | ||||
| 
 | ||||
|         MWScript::InterpreterContext interpreterContext (mEnvironment, | ||||
|         MWScript::InterpreterContext interpreterContext ( | ||||
|             &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; | ||||
|     } | ||||
| 
 | ||||
|  | @ -83,19 +85,19 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt) | |||
| { | ||||
|     try | ||||
|     { | ||||
|         mEnvironment.mFrameDuration = evt.timeSinceLastFrame; | ||||
|         mEnvironment.setFrameDuration (evt.timeSinceLastFrame); | ||||
| 
 | ||||
|         // update input
 | ||||
|         mEnvironment.mInputManager->update(); | ||||
|         MWBase::Environment::get().getInputManager()->update(); | ||||
| 
 | ||||
|         // sound
 | ||||
|         if (mUseSound) | ||||
|             mEnvironment.mSoundManager->update (evt.timeSinceLastFrame); | ||||
|             MWBase::Environment::get().getSoundManager()->update (evt.timeSinceLastFrame); | ||||
| 
 | ||||
|         // 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
 | ||||
|         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.
 | ||||
| 
 | ||||
|         // passing of time
 | ||||
|         if (mEnvironment.mWindowManager->getMode()==MWGui::GM_Game) | ||||
|             mEnvironment.mWorld->advanceTime ( | ||||
|                 mEnvironment.mFrameDuration*mEnvironment.mWorld->getTimeScaleFactor()/3600); | ||||
|         if (MWBase::Environment::get().getWindowManager()->getMode()==MWGui::GM_Game) | ||||
|             MWBase::Environment::get().getWorld()->advanceTime ( | ||||
|                 mEnvironment.getFrameDuration()*MWBase::Environment::get().getWorld()->getTimeScaleFactor()/3600); | ||||
| 
 | ||||
| 
 | ||||
|         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
 | ||||
|         std::vector<std::pair<std::string, Ogre::Vector3> > movement; | ||||
|         mEnvironment.mMechanicsManager->update (movement, mEnvironment.mFrameDuration, | ||||
|             mEnvironment.mWindowManager->getMode()!=MWGui::GM_Game); | ||||
|         MWBase::Environment::get().getMechanicsManager()->update (movement, mEnvironment.getFrameDuration(), | ||||
|             MWBase::Environment::get().getWindowManager()->getMode()!=MWGui::GM_Game); | ||||
| 
 | ||||
|         if (mEnvironment.mWindowManager->getMode()==MWGui::GM_Game) | ||||
|             mEnvironment.mWorld->doPhysics (movement, mEnvironment.mFrameDuration); | ||||
|         if (MWBase::Environment::get().getWindowManager()->getMode()==MWGui::GM_Game) | ||||
|             MWBase::Environment::get().getWorld()->doPhysics (movement, mEnvironment.getFrameDuration()); | ||||
| 
 | ||||
|         // update world
 | ||||
|         mEnvironment.mWorld->update (evt.timeSinceLastFrame); | ||||
|         MWBase::Environment::get().getWorld()->update (evt.timeSinceLastFrame); | ||||
| 
 | ||||
|         // update GUI
 | ||||
|         Ogre::RenderWindow* window = mOgre->getWindow(); | ||||
|         mEnvironment.mWindowManager->wmUpdateFps(window->getLastFPS(), | ||||
|         MWBase::Environment::get().getWindowManager()->wmUpdateFps(window->getLastFPS(), | ||||
|                                                  window->getTriangleCount(), | ||||
|                                                  window->getBatchCount()); | ||||
| 
 | ||||
|         mEnvironment.mWindowManager->onFrame(mEnvironment.mFrameDuration); | ||||
|         MWBase::Environment::get().getWindowManager()->onFrame(evt.timeSinceLastFrame); | ||||
|     } | ||||
|     catch (const std::exception& e) | ||||
|     { | ||||
|  | @ -157,13 +159,13 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager) | |||
| 
 | ||||
| OMW::Engine::~Engine() | ||||
| { | ||||
|     delete mEnvironment.mWorld; | ||||
|     delete mEnvironment.mSoundManager; | ||||
|     delete mEnvironment.mGlobalScripts; | ||||
|     delete mEnvironment.mMechanicsManager; | ||||
|     delete mEnvironment.mDialogueManager; | ||||
|     delete mEnvironment.mJournal; | ||||
|     delete mEnvironment.mScriptManager; | ||||
|     delete MWBase::Environment::get().getInputManager(); | ||||
|     delete MWBase::Environment::get().getSoundManager(); | ||||
|     delete MWBase::Environment::get().getMechanicsManager(); | ||||
|     delete MWBase::Environment::get().getDialogueManager(); | ||||
|     delete MWBase::Environment::get().getJournal(); | ||||
|     delete MWBase::Environment::get().getScriptManager(); | ||||
|     delete MWBase::Environment::get().getWorld(); | ||||
|     delete mScriptContext; | ||||
|     delete mOgre; | ||||
| } | ||||
|  | @ -173,7 +175,7 @@ OMW::Engine::~Engine() | |||
| void OMW::Engine::loadBSA() | ||||
| { | ||||
|     const Files::MultiDirCollection& bsa = mFileCollections.getCollection (".bsa"); | ||||
|      | ||||
| 
 | ||||
|     for (Files::MultiDirCollection::TIter iter(bsa.begin()); iter!=bsa.end(); ++iter) | ||||
|     { | ||||
|         std::cout << "Adding " << iter->second.string() << std::endl; | ||||
|  | @ -262,7 +264,6 @@ void OMW::Engine::setNewGame(bool newGame) | |||
| void OMW::Engine::go() | ||||
| { | ||||
|     mFocusTDiff = 0; | ||||
|     assert (!mEnvironment.mWorld); | ||||
|     assert (!mCellName.empty()); | ||||
|     assert (!mMaster.empty()); | ||||
|     assert (!mOgre); | ||||
|  | @ -331,69 +332,66 @@ void OMW::Engine::go() | |||
|     MWGui::CursorReplace replacer; | ||||
| 
 | ||||
|     // Create the world
 | ||||
|     mEnvironment.mWorld = new MWWorld::World (*mOgre, mFileCollections, mMaster, | ||||
|         mResDir, mNewGame, mEnvironment, mEncoding, mFallbackMap); | ||||
|     mEnvironment.setWorld (new MWWorld::World (*mOgre, mFileCollections, mMaster, | ||||
|         mResDir, mNewGame, mEncoding, mFallbackMap)); | ||||
| 
 | ||||
|     // Create window manager - this manages all the MW-specific GUI windows
 | ||||
|     MWScript::registerExtensions (mExtensions); | ||||
| 
 | ||||
|     mEnvironment.mWindowManager = new MWGui::WindowManager(mEnvironment, | ||||
|         mExtensions, mFpsLevel, mNewGame, mOgre, mCfgMgr.getLogPath().string() + std::string("/")); | ||||
|     mEnvironment.setWindowManager (new MWGui::WindowManager( | ||||
|         mExtensions, mFpsLevel, mNewGame, mOgre, mCfgMgr.getLogPath().string() + std::string("/"))); | ||||
| 
 | ||||
|     // Create sound system
 | ||||
|     mEnvironment.mSoundManager = new MWSound::SoundManager(mUseSound, mEnvironment); | ||||
|     mEnvironment.setSoundManager (new MWSound::SoundManager(mUseSound)); | ||||
| 
 | ||||
|     // Create script system
 | ||||
|     mScriptContext = new MWScript::CompilerContext (MWScript::CompilerContext::Type_Full, | ||||
|         mEnvironment); | ||||
|     mScriptContext = new MWScript::CompilerContext (MWScript::CompilerContext::Type_Full); | ||||
|     mScriptContext->setExtensions (&mExtensions); | ||||
| 
 | ||||
|     mEnvironment.mScriptManager = new MWScript::ScriptManager (mEnvironment.mWorld->getStore(), | ||||
|         mVerboseScripts, *mScriptContext); | ||||
| 
 | ||||
|     mEnvironment.mGlobalScripts = new MWScript::GlobalScripts (mEnvironment.mWorld->getStore(), | ||||
|         *mEnvironment.mScriptManager); | ||||
|     mEnvironment.setScriptManager (new MWScript::ScriptManager (MWBase::Environment::get().getWorld()->getStore(), | ||||
|         mVerboseScripts, *mScriptContext)); | ||||
| 
 | ||||
|     // Create game mechanics system
 | ||||
|     mEnvironment.mMechanicsManager = new MWMechanics::MechanicsManager (mEnvironment); | ||||
|     mEnvironment.setMechanicsManager (new MWMechanics::MechanicsManager); | ||||
| 
 | ||||
|     // Create dialog system
 | ||||
|     mEnvironment.mJournal = new MWDialogue::Journal (mEnvironment); | ||||
|     mEnvironment.mDialogueManager = new MWDialogue::DialogueManager (mEnvironment,mExtensions); | ||||
|     mEnvironment.setJournal (new MWDialogue::Journal); | ||||
|     mEnvironment.setDialogueManager (new MWDialogue::DialogueManager (mExtensions)); | ||||
| 
 | ||||
|     // load cell
 | ||||
|     ESM::Position pos; | ||||
|     pos.rot[0] = pos.rot[1] = pos.rot[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); | ||||
|         mEnvironment.mWorld->changeToExteriorCell (pos); | ||||
|         MWBase::Environment::get().getWorld()->changeToExteriorCell (pos); | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         pos.pos[0] = pos.pos[1] = 0; | ||||
|         mEnvironment.mWorld->changeToInteriorCell (mCellName, pos); | ||||
|         MWBase::Environment::get().getWorld()->changeToInteriorCell (mCellName, pos); | ||||
|     } | ||||
| 
 | ||||
|     // Sets up the input system
 | ||||
|     MWInput::MWInputManager input(*mOgre, mEnvironment.mWorld->getPlayer(), | ||||
|                                   *mEnvironment.mWindowManager, mDebug, *this); | ||||
|     mEnvironment.mInputManager = &input; | ||||
| 
 | ||||
|     mEnvironment.setInputManager (new MWInput::MWInputManager (*mOgre, | ||||
|         MWBase::Environment::get().getWorld()->getPlayer(), | ||||
|         *MWBase::Environment::get().getWindowManager(), mDebug, *this)); | ||||
| 
 | ||||
|     std::cout << "\nPress Q/ESC or close window to exit.\n"; | ||||
| 
 | ||||
|     mOgre->getRoot()->addFrameListener (this); | ||||
| 
 | ||||
|     // Play some good 'ol tunes
 | ||||
|     mEnvironment.mSoundManager->playPlaylist(std::string("Explore")); | ||||
|     MWBase::Environment::get().getSoundManager()->playPlaylist(std::string("Explore")); | ||||
| 
 | ||||
|     // scripts
 | ||||
|     if (mCompileAll) | ||||
|     { | ||||
|         std::pair<int, int> result = mEnvironment.mScriptManager->compileAll(); | ||||
|         std::pair<int, int> result = MWBase::Environment::get().getScriptManager()->compileAll(); | ||||
| 
 | ||||
|         if (result.first) | ||||
|             std::cout | ||||
|  | @ -414,10 +412,10 @@ void OMW::Engine::go() | |||
| 
 | ||||
| void OMW::Engine::activate() | ||||
| { | ||||
|     if (mEnvironment.mWindowManager->getMode()!=MWGui::GM_Game) | ||||
|     if (MWBase::Environment::get().getWindowManager()->getMode()!=MWGui::GM_Game) | ||||
|         return; | ||||
| 
 | ||||
|     std::string handle = mEnvironment.mWorld->getFacedHandle(); | ||||
|     std::string handle = MWBase::Environment::get().getWorld()->getFacedHandle(); | ||||
| 
 | ||||
|     if (handle.empty()) | ||||
|         return; | ||||
|  | @ -428,7 +426,7 @@ void OMW::Engine::activate() | |||
|     MWWorld::Ptr ptr; | ||||
|     try | ||||
|     { | ||||
|         ptr = mEnvironment.mWorld->getPtrViaHandle (handle); | ||||
|         ptr = MWBase::Environment::get().getWorld()->getPtrViaHandle (handle); | ||||
| 
 | ||||
|         if (ptr.isEmpty()) | ||||
|             return; | ||||
|  | @ -438,12 +436,10 @@ void OMW::Engine::activate() | |||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     MWScript::InterpreterContext interpreterContext (mEnvironment, | ||||
|         &ptr.getRefData().getLocals(), ptr); | ||||
|     MWScript::InterpreterContext interpreterContext (&ptr.getRefData().getLocals(), ptr); | ||||
| 
 | ||||
|     boost::shared_ptr<MWWorld::Action> action = | ||||
|         MWWorld::Class::get (ptr).activate (ptr, mEnvironment.mWorld->getPlayer().getPlayer(), | ||||
|         mEnvironment); | ||||
|         MWWorld::Class::get (ptr).activate (ptr, MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); | ||||
| 
 | ||||
|     interpreterContext.activate (ptr, action); | ||||
| 
 | ||||
|  | @ -451,8 +447,8 @@ void OMW::Engine::activate() | |||
| 
 | ||||
|     if (!script.empty()) | ||||
|     { | ||||
|         mEnvironment.mWorld->getLocalScripts().setIgnore (ptr); | ||||
|         mEnvironment.mScriptManager->run (script, interpreterContext); | ||||
|         MWBase::Environment::get().getWorld()->getLocalScripts().setIgnore (ptr); | ||||
|         MWBase::Environment::get().getScriptManager()->run (script, interpreterContext); | ||||
|     } | ||||
| 
 | ||||
|     if (!interpreterContext.hasActivationBeenHandled()) | ||||
|  |  | |||
|  | @ -10,7 +10,8 @@ | |||
| #include <components/compiler/extensions.hpp> | ||||
| #include <components/files/collections.hpp> | ||||
| 
 | ||||
| #include "mwworld/environment.hpp" | ||||
| #include "mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "mwworld/ptr.hpp" | ||||
| 
 | ||||
| namespace Compiler | ||||
|  | @ -77,7 +78,7 @@ namespace OMW | |||
|             std::string mFocusName; | ||||
|             std::map<std::string,std::string> mFallbackMap; | ||||
| 
 | ||||
|             MWWorld::Environment mEnvironment; | ||||
|             MWBase::Environment mEnvironment; | ||||
|             Compiler::Extensions mExtensions; | ||||
|             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 "../mwrender/objects.hpp" | ||||
| 
 | ||||
| #include <components/esm/loadacti.hpp> | ||||
| 
 | ||||
| #include <components/esm_store/cell_store.hpp> | ||||
| 
 | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwrender/objects.hpp" | ||||
| #include "../mwbase/environment.hpp" | ||||
| #include "../mwgui/window_manager.hpp" | ||||
| 
 | ||||
| namespace MWClass | ||||
|  | @ -19,7 +19,7 @@ namespace MWClass | |||
| 
 | ||||
|         assert (ref->base != NULL); | ||||
|         const std::string &model = ref->base->model; | ||||
|          | ||||
| 
 | ||||
|         if (!model.empty()) | ||||
|         { | ||||
|             MWRender::Objects& objects = renderingInterface.getObjects(); | ||||
|  | @ -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 = | ||||
|             ptr.get<ESM::Activator>(); | ||||
|  | @ -73,7 +73,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::Activator>(); | ||||
|  | @ -82,7 +82,7 @@ namespace MWClass | |||
|         info.caption = ref->base->name; | ||||
| 
 | ||||
|         std::string text; | ||||
|         if (environment.mWindowManager->getFullHelp()) | ||||
|         if (MWBase::Environment::get().getWindowManager()->getFullHelp()) | ||||
|             text += MWGui::ToolTips::getMiscString(ref->base->script, "Script"); | ||||
|         info.text = text; | ||||
| 
 | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ namespace MWClass | |||
|             virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const; | ||||
|             ///< 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; | ||||
|             ///< \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; | ||||
|             ///< @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.
 | ||||
| 
 | ||||
|             virtual std::string getScript (const MWWorld::Ptr& ptr) const; | ||||
|  |  | |||
|  | @ -5,9 +5,10 @@ | |||
| 
 | ||||
| #include <components/esm_store/cell_store.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/actiontake.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwworld/world.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 = | ||||
|             ptr.get<ESM::Apparatus>(); | ||||
|  | @ -58,9 +59,9 @@ namespace MWClass | |||
|     } | ||||
| 
 | ||||
|     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> ( | ||||
|             new MWWorld::ActionTake (ptr)); | ||||
|  | @ -107,7 +108,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::Apparatus>(); | ||||
|  | @ -116,12 +117,14 @@ namespace MWClass | |||
|         info.caption = ref->base->name; | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         std::string text; | ||||
|         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); | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
| 
 | ||||
|         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->base->script, "Script"); | ||||
|         } | ||||
|  |  | |||
|  | @ -12,14 +12,14 @@ namespace MWClass | |||
|             virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const; | ||||
|             ///< 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; | ||||
|             ///< \return name (the one that is to be presented to the user; not the internal one);
 | ||||
|             /// can return an empty string.
 | ||||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             virtual std::string getScript (const MWWorld::Ptr& ptr) const; | ||||
|  | @ -31,7 +31,7 @@ namespace MWClass | |||
|             virtual bool hasToolTip (const MWWorld::Ptr& ptr) const; | ||||
|             ///< @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.
 | ||||
| 
 | ||||
|             static void registerSelf(); | ||||
|  |  | |||
|  | @ -9,11 +9,11 @@ | |||
| 
 | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/actiontake.hpp" | ||||
| 
 | ||||
| #include "../mwworld/inventorystore.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwworld/world.hpp" | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwrender/objects.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 = | ||||
|             ptr.get<ESM::Armor>(); | ||||
|  | @ -60,9 +60,9 @@ namespace MWClass | |||
|     } | ||||
| 
 | ||||
|     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> ( | ||||
|             new MWWorld::ActionTake (ptr)); | ||||
|  | @ -123,7 +123,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::Armor>(); | ||||
|  | @ -149,13 +149,13 @@ namespace MWClass | |||
|         if (typeGmst.empty()) | ||||
|             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) | ||||
|             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) | ||||
|             return ESM::Skill::MediumArmor; | ||||
| 
 | ||||
|  | @ -177,9 +177,9 @@ namespace MWClass | |||
|         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) | ||||
|             return std::string("Item Armor Light Up"); | ||||
|         else if (es == ESM::Skill::MediumArmor) | ||||
|  | @ -188,9 +188,9 @@ namespace MWClass | |||
|             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) | ||||
|             return std::string("Item Armor Light Down"); | ||||
|         else if (es == ESM::Skill::MediumArmor) | ||||
|  | @ -207,7 +207,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::Armor>(); | ||||
|  | @ -218,25 +218,27 @@ namespace MWClass | |||
| 
 | ||||
|         std::string text; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
| 
 | ||||
|         // get armor type string (light/medium/heavy)
 | ||||
|         int armorType = getEquipmentSkill(ptr, environment); | ||||
|         int armorType = getEquipmentSkill(ptr); | ||||
|         std::string typeText; | ||||
|         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) | ||||
|             typeText = environment.mWorld->getStore().gameSettings.search("sMedium")->str; | ||||
|             typeText = store.gameSettings.search("sMedium")->str; | ||||
|         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
 | ||||
|         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 += 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) + " (" + typeText + ")"; | ||||
|         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->base->script, "Script"); | ||||
|         } | ||||
|  |  | |||
|  | @ -12,14 +12,14 @@ namespace MWClass | |||
|             virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const; | ||||
|             ///< 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; | ||||
|             ///< \return name (the one that is to be presented to the user; not the internal one);
 | ||||
|             /// can return an empty string.
 | ||||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             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
 | ||||
|             /// stay stacked when equipped?
 | ||||
| 
 | ||||
|             virtual int getEquipmentSkill (const MWWorld::Ptr& ptr, | ||||
|                 const MWWorld::Environment& environment) const; | ||||
|             virtual int getEquipmentSkill (const MWWorld::Ptr& ptr) const; | ||||
|             /// Return the index of the skill this item corresponds to when equiopped or -1, if there is
 | ||||
|             /// no such skill.
 | ||||
| 
 | ||||
|             virtual bool hasToolTip (const MWWorld::Ptr& ptr) const; | ||||
|             ///< @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.
 | ||||
| 
 | ||||
|             virtual int getValue (const MWWorld::Ptr& ptr) const; | ||||
|  | @ -51,10 +50,10 @@ namespace MWClass | |||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             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
 | ||||
|     }; | ||||
| } | ||||
|  |  | |||
|  | @ -5,9 +5,10 @@ | |||
| 
 | ||||
| #include <components/esm_store/cell_store.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/actiontake.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwworld/world.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 = | ||||
|             ptr.get<ESM::Book>(); | ||||
|  | @ -57,11 +58,11 @@ namespace MWClass | |||
|     } | ||||
| 
 | ||||
|     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
 | ||||
| 
 | ||||
|         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> ( | ||||
|             new MWWorld::ActionTake (ptr)); | ||||
|  | @ -90,12 +91,12 @@ namespace MWClass | |||
|         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"); | ||||
|     } | ||||
| 
 | ||||
|     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"); | ||||
|     } | ||||
|  | @ -108,7 +109,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::Book>(); | ||||
|  | @ -117,12 +118,14 @@ namespace MWClass | |||
|         info.caption = ref->base->name; | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
| 
 | ||||
|         std::string text; | ||||
| 
 | ||||
|         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); | ||||
|         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->base->script, "Script"); | ||||
|         } | ||||
|  |  | |||
|  | @ -12,14 +12,14 @@ namespace MWClass | |||
|             virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const; | ||||
|             ///< 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; | ||||
|             ///< \return name (the one that is to be presented to the user; not the internal one);
 | ||||
|             /// can return an empty string.
 | ||||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             virtual std::string getScript (const MWWorld::Ptr& ptr) const; | ||||
|  | @ -28,7 +28,7 @@ namespace MWClass | |||
|             virtual bool hasToolTip (const MWWorld::Ptr& ptr) const; | ||||
|             ///< @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.
 | ||||
| 
 | ||||
|             virtual int getValue (const MWWorld::Ptr& ptr) const; | ||||
|  | @ -36,10 +36,10 @@ namespace MWClass | |||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             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
 | ||||
|     }; | ||||
| } | ||||
|  |  | |||
|  | @ -5,9 +5,10 @@ | |||
| 
 | ||||
| #include <components/esm_store/cell_store.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/actiontake.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwworld/inventorystore.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 = | ||||
|             ptr.get<ESM::Clothing>(); | ||||
|  | @ -59,9 +60,9 @@ namespace MWClass | |||
|     } | ||||
| 
 | ||||
|     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> ( | ||||
|             new MWWorld::ActionTake (ptr)); | ||||
|  | @ -115,8 +116,7 @@ namespace MWClass | |||
|         return std::make_pair (slots, false); | ||||
|     } | ||||
| 
 | ||||
|     int Clothing::getEquipmentSkill (const MWWorld::Ptr& ptr, | ||||
|         const MWWorld::Environment& environment) const | ||||
|     int Clothing::getEquipmentSkill (const MWWorld::Ptr& ptr) const | ||||
|     { | ||||
|         ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref = | ||||
|             ptr.get<ESM::Clothing>(); | ||||
|  | @ -142,7 +142,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::Clothing>(); | ||||
|  | @ -154,7 +154,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::Clothing>(); | ||||
|  | @ -174,7 +174,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::Clothing>(); | ||||
|  | @ -183,12 +183,14 @@ namespace MWClass | |||
|         info.caption = ref->base->name; | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
| 
 | ||||
|         std::string text; | ||||
| 
 | ||||
|         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); | ||||
|         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->base->script, "Script"); | ||||
|         } | ||||
|  |  | |||
|  | @ -12,14 +12,14 @@ namespace MWClass | |||
|             virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const; | ||||
|             ///< 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; | ||||
|             ///< \return name (the one that is to be presented to the user; not the internal one);
 | ||||
|             /// can return an empty string.
 | ||||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             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
 | ||||
|             /// stay stacked when equipped?
 | ||||
| 
 | ||||
|             virtual int getEquipmentSkill (const MWWorld::Ptr& ptr, | ||||
|                 const MWWorld::Environment& environment) const; | ||||
|             virtual int getEquipmentSkill (const MWWorld::Ptr& ptr) const; | ||||
|             /// Return the index of the skill this item corresponds to when equiopped or -1, if there is
 | ||||
|             /// no such skill.
 | ||||
| 
 | ||||
|             virtual bool hasToolTip (const MWWorld::Ptr& ptr) const; | ||||
|             ///< @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.
 | ||||
| 
 | ||||
|             virtual int getValue (const MWWorld::Ptr& ptr) const; | ||||
|  | @ -45,10 +44,10 @@ namespace MWClass | |||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             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
 | ||||
|     }; | ||||
| } | ||||
|  |  | |||
|  | @ -5,11 +5,12 @@ | |||
| 
 | ||||
| #include <components/esm_store/cell_store.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/nullaction.hpp" | ||||
| #include "../mwworld/containerstore.hpp" | ||||
| #include "../mwworld/customdata.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwworld/world.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 = | ||||
|             ptr.get<ESM::Container>(); | ||||
|  | @ -80,7 +81,7 @@ namespace MWClass | |||
|     } | ||||
| 
 | ||||
|     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 trapActivationSound = "Disarm Trap Fail"; | ||||
|  | @ -89,7 +90,7 @@ namespace MWClass | |||
|         { | ||||
|             // TODO check for key
 | ||||
|             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); | ||||
|         } | ||||
|         else | ||||
|  | @ -104,7 +105,7 @@ namespace MWClass | |||
|             { | ||||
|                 // Trap activation goes here
 | ||||
|                 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 = ""; | ||||
|                 return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction); | ||||
|             } | ||||
|  | @ -150,7 +151,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::Container>(); | ||||
|  | @ -158,13 +159,15 @@ namespace MWClass | |||
|         MWGui::ToolTipInfo info; | ||||
|         info.caption = ref->base->name; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
| 
 | ||||
|         std::string text; | ||||
|         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 != "") | ||||
|             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->base->script, "Script"); | ||||
|         } | ||||
|  |  | |||
|  | @ -14,20 +14,20 @@ namespace MWClass | |||
|             virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const; | ||||
|             ///< 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; | ||||
|             ///< \return name (the one that is to be presented to the user; not the internal one);
 | ||||
|             /// can return an empty string.
 | ||||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             virtual bool hasToolTip (const MWWorld::Ptr& ptr) const; | ||||
|             ///< @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.
 | ||||
| 
 | ||||
|             virtual MWWorld::ContainerStore& getContainerStore (const MWWorld::Ptr& ptr) const; | ||||
|  |  | |||
|  | @ -6,9 +6,10 @@ | |||
| #include "../mwmechanics/creaturestats.hpp" | ||||
| #include "../mwmechanics/mechanicsmanager.hpp" | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/actiontalk.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwworld/customdata.hpp" | ||||
| #include "../mwworld/containerstore.hpp" | ||||
| 
 | ||||
|  | @ -76,7 +77,7 @@ namespace MWClass | |||
|         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 = | ||||
|             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 | ||||
|  | @ -115,7 +116,7 @@ namespace MWClass | |||
|     } | ||||
| 
 | ||||
|     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)); | ||||
|     } | ||||
|  | @ -150,7 +151,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::Creature>(); | ||||
|  | @ -159,7 +160,7 @@ namespace MWClass | |||
|         info.caption = ref->base->name; | ||||
| 
 | ||||
|         std::string text; | ||||
|         if (environment.mWindowManager->getFullHelp()) | ||||
|         if (MWBase::Environment::get().getWindowManager()->getFullHelp()) | ||||
|             text += MWGui::ToolTips::getMiscString(ref->base->script, "Script"); | ||||
|         info.text = text; | ||||
| 
 | ||||
|  |  | |||
|  | @ -20,12 +20,12 @@ namespace MWClass | |||
|              virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const; | ||||
|             ///< 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
 | ||||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             virtual std::string getName (const MWWorld::Ptr& ptr) const; | ||||
|  | @ -35,14 +35,14 @@ namespace MWClass | |||
|             virtual bool hasToolTip (const MWWorld::Ptr& ptr) const; | ||||
|             ///< @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.
 | ||||
| 
 | ||||
|             virtual MWMechanics::CreatureStats& getCreatureStats (const MWWorld::Ptr& ptr) const; | ||||
|             ///< Return creature stats
 | ||||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             virtual MWWorld::ContainerStore& getContainerStore ( | ||||
|  |  | |||
|  | @ -5,11 +5,12 @@ | |||
| 
 | ||||
| #include <components/esm_store/cell_store.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/player.hpp" | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/nullaction.hpp" | ||||
| #include "../mwworld/actionteleport.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwworld/world.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 = | ||||
|             ptr.get<ESM::Door>(); | ||||
|  | @ -61,7 +62,7 @@ namespace MWClass | |||
|     } | ||||
| 
 | ||||
|     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 = | ||||
|             ptr.get<ESM::Door>(); | ||||
|  | @ -76,7 +77,7 @@ namespace MWClass | |||
|             // TODO check for key
 | ||||
|             // TODO report failure to player (message, sound?). Look up behaviour of original MW.
 | ||||
|             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); | ||||
|         } | ||||
| 
 | ||||
|  | @ -84,7 +85,7 @@ namespace MWClass | |||
|         { | ||||
|             // Trap activation
 | ||||
|             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 = ""; | ||||
|             return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction); | ||||
|         } | ||||
|  | @ -92,11 +93,11 @@ namespace MWClass | |||
|         if (ref->ref.teleport) | ||||
|         { | ||||
|             // teleport door
 | ||||
|             if (environment.mWorld->getPlayer().getPlayer()==actor) | ||||
|             if (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()==actor) | ||||
|             { | ||||
|                 // the player is using the door
 | ||||
|                 // The reason this is not 3D is that it would get interrupted when you teleport
 | ||||
|                 environment.mSoundManager->playSound(openSound, 1.0, 1.0); | ||||
|                 MWBase::Environment::get().getSoundManager()->playSound(openSound, 1.0, 1.0); | ||||
|                 return boost::shared_ptr<MWWorld::Action> ( | ||||
|                     new MWWorld::ActionTeleportPlayer (ref->ref.destCell, ref->ref.doorDest)); | ||||
|             } | ||||
|  | @ -113,7 +114,7 @@ namespace MWClass | |||
|             // TODO return action for rotating the door
 | ||||
| 
 | ||||
|             // 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); | ||||
|         } | ||||
|     } | ||||
|  | @ -154,7 +155,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::Door>(); | ||||
|  | @ -164,6 +165,8 @@ namespace MWClass | |||
| 
 | ||||
|         std::string text; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
| 
 | ||||
|         if (ref->ref.teleport) | ||||
|         { | ||||
|             std::string dest; | ||||
|  | @ -176,26 +179,26 @@ namespace MWClass | |||
|             { | ||||
|                 // door leads to exterior, use cell name (if any), otherwise translated region name
 | ||||
|                 int x,y; | ||||
|                 environment.mWorld->positionToIndex (ref->ref.doorDest.pos[0], ref->ref.doorDest.pos[1], x, y); | ||||
|                 const ESM::Cell* cell = environment.mWorld->getStore().cells.findExt(x,y); | ||||
|                 MWBase::Environment::get().getWorld()->positionToIndex (ref->ref.doorDest.pos[0], ref->ref.doorDest.pos[1], x, y); | ||||
|                 const ESM::Cell* cell = store.cells.findExt(x,y); | ||||
|                 if (cell->name != "") | ||||
|                     dest = cell->name; | ||||
|                 else | ||||
|                 { | ||||
|                     const ESM::Region* region = environment.mWorld->getStore().regions.search(cell->region); | ||||
|                     const ESM::Region* region = store.regions.search(cell->region); | ||||
|                     dest = region->name; | ||||
|                 } | ||||
|             } | ||||
|             text += "\n" + environment.mWorld->getStore().gameSettings.search("sTo")->str; | ||||
|             text += "\n" + store.gameSettings.search("sTo")->str; | ||||
|             text += "\n"+dest; | ||||
|         } | ||||
| 
 | ||||
|         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 != "") | ||||
|             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"); | ||||
| 
 | ||||
|         info.text = text; | ||||
|  |  | |||
|  | @ -12,20 +12,20 @@ namespace MWClass | |||
|             virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const; | ||||
|             ///< 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; | ||||
|             ///< \return name (the one that is to be presented to the user; not the internal one);
 | ||||
|             /// can return an empty string.
 | ||||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             virtual bool hasToolTip (const MWWorld::Ptr& ptr) const; | ||||
|             ///< @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.
 | ||||
| 
 | ||||
|             virtual void lock (const MWWorld::Ptr& ptr, int lockLevel) const; | ||||
|  |  | |||
|  | @ -5,9 +5,10 @@ | |||
| 
 | ||||
| #include <components/esm_store/cell_store.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/actiontake.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwworld/world.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 = | ||||
|             ptr.get<ESM::Ingredient>(); | ||||
|  | @ -56,9 +57,9 @@ namespace MWClass | |||
|     } | ||||
| 
 | ||||
|     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> ( | ||||
|             new MWWorld::ActionTake (ptr)); | ||||
|  | @ -87,12 +88,12 @@ namespace MWClass | |||
|         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"); | ||||
|     } | ||||
| 
 | ||||
|     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"); | ||||
|     } | ||||
|  | @ -105,7 +106,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::Ingredient>(); | ||||
|  | @ -114,12 +115,14 @@ namespace MWClass | |||
|         info.caption = ref->base->name; | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
| 
 | ||||
|         std::string text; | ||||
| 
 | ||||
|         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); | ||||
|         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->base->script, "Script"); | ||||
|         } | ||||
|  |  | |||
|  | @ -12,20 +12,20 @@ namespace MWClass | |||
|             virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const; | ||||
|             ///< 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; | ||||
|             ///< \return name (the one that is to be presented to the user; not the internal one);
 | ||||
|             /// can return an empty string.
 | ||||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             virtual bool hasToolTip (const MWWorld::Ptr& ptr) const; | ||||
|             ///< @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.
 | ||||
| 
 | ||||
|             virtual std::string getScript (const MWWorld::Ptr& ptr) const; | ||||
|  | @ -36,10 +36,10 @@ namespace MWClass | |||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             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
 | ||||
|     }; | ||||
| } | ||||
|  |  | |||
|  | @ -5,10 +5,11 @@ | |||
| 
 | ||||
| #include <components/esm_store/cell_store.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/actiontake.hpp" | ||||
| #include "../mwworld/nullaction.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwworld/inventorystore.hpp" | ||||
| #include "../mwworld/world.hpp" | ||||
| 
 | ||||
|  | @ -43,7 +44,7 @@ namespace MWClass | |||
|         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 = | ||||
|             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 = | ||||
|             ptr.get<ESM::Light>(); | ||||
| 
 | ||||
|         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, | ||||
|         const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const | ||||
|         const MWWorld::Ptr& actor) const | ||||
|     { | ||||
|         ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref = | ||||
|             ptr.get<ESM::Light>(); | ||||
|  | @ -87,7 +88,7 @@ namespace MWClass | |||
|         if (!(ref->base->data.flags & ESM::Light::Carry)) | ||||
|             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> ( | ||||
|             new MWWorld::ActionTake (ptr)); | ||||
|  | @ -129,12 +130,12 @@ namespace MWClass | |||
|         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"); | ||||
|     } | ||||
| 
 | ||||
|     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"); | ||||
|     } | ||||
|  | @ -147,7 +148,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::Light>(); | ||||
|  | @ -156,12 +157,14 @@ namespace MWClass | |||
|         info.caption = ref->base->name; | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
| 
 | ||||
|         std::string text; | ||||
| 
 | ||||
|         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); | ||||
|         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->base->script, "Script"); | ||||
|         } | ||||
|  |  | |||
|  | @ -12,9 +12,9 @@ namespace MWClass | |||
|              virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const; | ||||
|             ///< 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
 | ||||
|             /// \attention This is not the same as the script instruction with the same name. References
 | ||||
|             /// should only be enabled while in an active cell.
 | ||||
|  | @ -26,11 +26,11 @@ namespace MWClass | |||
|             virtual bool hasToolTip (const MWWorld::Ptr& ptr) const; | ||||
|             ///< @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.
 | ||||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             virtual std::string getScript (const MWWorld::Ptr& ptr) const; | ||||
|  | @ -45,10 +45,10 @@ namespace MWClass | |||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             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
 | ||||
|     }; | ||||
| } | ||||
|  |  | |||
|  | @ -5,9 +5,10 @@ | |||
| 
 | ||||
| #include <components/esm_store/cell_store.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/actiontake.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwworld/inventorystore.hpp" | ||||
| #include "../mwworld/world.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 = | ||||
|             ptr.get<ESM::Tool>(); | ||||
|  | @ -59,9 +60,9 @@ namespace MWClass | |||
|     } | ||||
| 
 | ||||
|     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> ( | ||||
|             new MWWorld::ActionTake (ptr)); | ||||
|  | @ -99,12 +100,12 @@ namespace MWClass | |||
|         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"); | ||||
|     } | ||||
| 
 | ||||
|     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"); | ||||
|     } | ||||
|  | @ -117,7 +118,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::Tool>(); | ||||
|  | @ -126,16 +127,18 @@ namespace MWClass | |||
|         info.caption = ref->base->name; | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
| 
 | ||||
|         std::string text; | ||||
| 
 | ||||
|         /// \todo store remaining uses somewhere
 | ||||
| 
 | ||||
|         text += "\n" + environment.mWorld->getStore().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" + 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); | ||||
|         text += "\n" + store.gameSettings.search("sUses")->str + ": " + MWGui::ToolTips::toString(ref->base->data.uses); | ||||
|         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 (environment.mWindowManager->getFullHelp()) { | ||||
|         if (MWBase::Environment::get().getWindowManager()->getFullHelp()) { | ||||
|             text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner"); | ||||
|             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; | ||||
|             ///< 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; | ||||
|             ///< \return name (the one that is to be presented to the user; not the internal one);
 | ||||
|             /// can return an empty string.
 | ||||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             virtual bool hasToolTip (const MWWorld::Ptr& ptr) const; | ||||
|             ///< @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.
 | ||||
| 
 | ||||
|             virtual std::string getScript (const MWWorld::Ptr& ptr) const; | ||||
|  | @ -40,10 +40,10 @@ namespace MWClass | |||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             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
 | ||||
|     }; | ||||
| } | ||||
|  |  | |||
|  | @ -5,10 +5,11 @@ | |||
| 
 | ||||
| #include <components/esm_store/cell_store.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/actiontake.hpp" | ||||
| #include "../mwworld/world.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| 
 | ||||
| #include "../mwgui/window_manager.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 = | ||||
|             ptr.get<ESM::Miscellaneous>(); | ||||
|  | @ -60,9 +61,9 @@ namespace MWClass | |||
|     } | ||||
| 
 | ||||
|     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> ( | ||||
|             new MWWorld::ActionTake (ptr)); | ||||
|  | @ -91,24 +92,24 @@ namespace MWClass | |||
|         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 = | ||||
|             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 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 = | ||||
|             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"); | ||||
|         } | ||||
|  | @ -123,7 +124,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::Miscellaneous>(); | ||||
|  | @ -132,23 +133,25 @@ namespace MWClass | |||
|         info.caption = ref->base->name; | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
| 
 | ||||
|         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 + ")"; | ||||
|         } | ||||
| 
 | ||||
|         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) + ")"; | ||||
|         else | ||||
|         { | ||||
|             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); | ||||
|             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->base->script, "Script"); | ||||
|         } | ||||
|  |  | |||
|  | @ -12,20 +12,20 @@ namespace MWClass | |||
|              virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const; | ||||
|             ///< 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; | ||||
|             ///< \return name (the one that is to be presented to the user; not the internal one);
 | ||||
|             /// can return an empty string.
 | ||||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             virtual bool hasToolTip (const MWWorld::Ptr& ptr) const; | ||||
|             ///< @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.
 | ||||
| 
 | ||||
|             virtual std::string getScript (const MWWorld::Ptr& ptr) const; | ||||
|  | @ -36,10 +36,10 @@ namespace MWClass | |||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             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
 | ||||
|     }; | ||||
| } | ||||
|  |  | |||
|  | @ -14,13 +14,14 @@ | |||
| 
 | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/actiontalk.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwworld/world.hpp" | ||||
| #include "../mwworld/inventorystore.hpp" | ||||
| #include "../mwworld/customdata.hpp" | ||||
| 
 | ||||
| #include "../mwgui/window_manager.hpp" | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| namespace | ||||
| { | ||||
|     const Ogre::Radian kOgrePi (Ogre::Math::PI); | ||||
|  | @ -107,13 +108,13 @@ namespace MWClass | |||
| 
 | ||||
|     void Npc::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const | ||||
|     { | ||||
| 		 | ||||
| 			 | ||||
| 
 | ||||
| 
 | ||||
|         renderingInterface.getActors().insertNPC(ptr, getInventoryStore(ptr)); | ||||
| 		 | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     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 | ||||
|  | @ -168,7 +169,7 @@ namespace MWClass | |||
|     } | ||||
| 
 | ||||
|     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)); | ||||
|     } | ||||
|  | @ -309,7 +310,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::NPC>(); | ||||
|  | @ -318,7 +319,7 @@ namespace MWClass | |||
|         info.caption = ref->base->name; | ||||
| 
 | ||||
|         std::string text; | ||||
|         if (environment.mWindowManager->getFullHelp()) | ||||
|         if (MWBase::Environment::get().getWindowManager()->getFullHelp()) | ||||
|             text += MWGui::ToolTips::getMiscString(ref->base->script, "Script"); | ||||
|         info.text = text; | ||||
| 
 | ||||
|  |  | |||
|  | @ -17,12 +17,12 @@ namespace MWClass | |||
|             virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const; | ||||
|             ///< 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
 | ||||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             virtual std::string getName (const MWWorld::Ptr& ptr) const; | ||||
|  | @ -41,14 +41,14 @@ namespace MWClass | |||
|             virtual bool hasToolTip (const MWWorld::Ptr& ptr) const; | ||||
|             ///< @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.
 | ||||
| 
 | ||||
|             virtual MWWorld::InventoryStore& getInventoryStore (const MWWorld::Ptr& ptr) const; | ||||
|             ///< Return inventory store
 | ||||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             virtual std::string getScript (const MWWorld::Ptr& ptr) const; | ||||
|  |  | |||
|  | @ -5,9 +5,10 @@ | |||
| 
 | ||||
| #include <components/esm_store/cell_store.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/actiontake.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwworld/world.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 = | ||||
|             ptr.get<ESM::Potion>(); | ||||
|  | @ -58,9 +59,9 @@ namespace MWClass | |||
|     } | ||||
| 
 | ||||
|     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> ( | ||||
|             new MWWorld::ActionTake (ptr)); | ||||
|  | @ -89,12 +90,12 @@ namespace MWClass | |||
|         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"); | ||||
|     } | ||||
| 
 | ||||
|     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"); | ||||
|     } | ||||
|  | @ -107,7 +108,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::Potion>(); | ||||
|  | @ -116,12 +117,14 @@ namespace MWClass | |||
|         info.caption = ref->base->name; | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
| 
 | ||||
|         std::string text; | ||||
| 
 | ||||
|         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); | ||||
|         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->base->script, "Script"); | ||||
|         } | ||||
|  |  | |||
|  | @ -12,20 +12,20 @@ namespace MWClass | |||
|              virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const; | ||||
|             ///< 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; | ||||
|             ///< \return name (the one that is to be presented to the user; not the internal one);
 | ||||
|             /// can return an empty string.
 | ||||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             virtual bool hasToolTip (const MWWorld::Ptr& ptr) const; | ||||
|             ///< @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.
 | ||||
| 
 | ||||
|             virtual std::string getScript (const MWWorld::Ptr& ptr) const; | ||||
|  | @ -36,10 +36,10 @@ namespace MWClass | |||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             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
 | ||||
|     }; | ||||
| } | ||||
|  |  | |||
|  | @ -5,9 +5,10 @@ | |||
| 
 | ||||
| #include <components/esm_store/cell_store.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/actiontake.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwworld/inventorystore.hpp" | ||||
| #include "../mwworld/world.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 = | ||||
|             ptr.get<ESM::Probe>(); | ||||
|  | @ -58,9 +59,9 @@ namespace MWClass | |||
|         return ref->base->name; | ||||
|     } | ||||
|     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> ( | ||||
|             new MWWorld::ActionTake (ptr)); | ||||
|  | @ -98,12 +99,12 @@ namespace MWClass | |||
|         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"); | ||||
|     } | ||||
| 
 | ||||
|     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"); | ||||
|     } | ||||
|  | @ -116,7 +117,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::Probe>(); | ||||
|  | @ -125,16 +126,18 @@ namespace MWClass | |||
|         info.caption = ref->base->name; | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
| 
 | ||||
|         std::string text; | ||||
| 
 | ||||
|         /// \todo store remaining uses somewhere
 | ||||
| 
 | ||||
|         text += "\n" + environment.mWorld->getStore().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" + 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); | ||||
|         text += "\n" + store.gameSettings.search("sUses")->str + ": " + MWGui::ToolTips::toString(ref->base->data.uses); | ||||
|         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 (environment.mWindowManager->getFullHelp()) { | ||||
|         if (MWBase::Environment::get().getWindowManager()->getFullHelp()) { | ||||
|             text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner"); | ||||
|             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; | ||||
|             ///< 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; | ||||
|             ///< \return name (the one that is to be presented to the user; not the internal one);
 | ||||
|             /// can return an empty string.
 | ||||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             virtual bool hasToolTip (const MWWorld::Ptr& ptr) const; | ||||
|             ///< @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.
 | ||||
| 
 | ||||
|             virtual std::string getScript (const MWWorld::Ptr& ptr) const; | ||||
|  | @ -40,10 +40,10 @@ namespace MWClass | |||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             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
 | ||||
|     }; | ||||
| } | ||||
|  |  | |||
|  | @ -5,9 +5,10 @@ | |||
| 
 | ||||
| #include <components/esm_store/cell_store.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/actiontake.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwworld/world.hpp" | ||||
| #include "../mwgui/window_manager.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 = | ||||
|             ptr.get<ESM::Repair>(); | ||||
|  | @ -57,9 +58,9 @@ namespace MWClass | |||
|     } | ||||
| 
 | ||||
|     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> ( | ||||
|             new MWWorld::ActionTake (ptr)); | ||||
|  | @ -88,12 +89,12 @@ namespace MWClass | |||
|         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"); | ||||
|     } | ||||
| 
 | ||||
|     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"); | ||||
|     } | ||||
|  | @ -106,7 +107,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::Repair>(); | ||||
|  | @ -119,12 +120,13 @@ namespace MWClass | |||
| 
 | ||||
|         /// \todo store remaining uses somewhere
 | ||||
| 
 | ||||
|         text += "\n" + environment.mWorld->getStore().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" + 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); | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
|         text += "\n" + store.gameSettings.search("sUses")->str + ": " + MWGui::ToolTips::toString(ref->base->data.uses); | ||||
|         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 (environment.mWindowManager->getFullHelp()) { | ||||
|         if (MWBase::Environment::get().getWindowManager()->getFullHelp()) { | ||||
|             text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner"); | ||||
|             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; | ||||
|             ///< 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; | ||||
|             ///< \return name (the one that is to be presented to the user; not the internal one);
 | ||||
|             /// can return an empty string.
 | ||||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             virtual bool hasToolTip (const MWWorld::Ptr& ptr) const; | ||||
|             ///< @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.
 | ||||
| 
 | ||||
|             virtual std::string getScript (const MWWorld::Ptr& ptr) const; | ||||
|  | @ -36,10 +36,10 @@ namespace MWClass | |||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             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
 | ||||
|     }; | ||||
| } | ||||
|  |  | |||
|  | @ -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 = | ||||
|             ptr.get<ESM::Static>(); | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ namespace MWClass | |||
|              virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const; | ||||
|             ///< 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; | ||||
|             ///< \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 "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/actiontake.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwworld/inventorystore.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 = | ||||
|             ptr.get<ESM::Weapon>(); | ||||
|  | @ -59,9 +60,9 @@ namespace MWClass | |||
|     } | ||||
| 
 | ||||
|     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> ( | ||||
|             new MWWorld::ActionTake (ptr)); | ||||
|  | @ -112,8 +113,7 @@ namespace MWClass | |||
|         return std::make_pair (slots, stack); | ||||
|     } | ||||
| 
 | ||||
|     int Weapon::getEquipmentSkill (const MWWorld::Ptr& ptr, | ||||
|         const MWWorld::Environment& environment) const | ||||
|     int Weapon::getEquipmentSkill (const MWWorld::Ptr& ptr) const | ||||
|     { | ||||
|         ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref = | ||||
|             ptr.get<ESM::Weapon>(); | ||||
|  | @ -158,7 +158,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::Weapon>(); | ||||
|  | @ -204,7 +204,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::Weapon>(); | ||||
|  | @ -258,7 +258,7 @@ namespace MWClass | |||
|         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 = | ||||
|             ptr.get<ESM::Weapon>(); | ||||
|  | @ -267,12 +267,14 @@ namespace MWClass | |||
|         info.caption = ref->base->name; | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
| 
 | ||||
|         std::string text; | ||||
| 
 | ||||
|         // weapon type & damage. arrows / bolts don't have his info.
 | ||||
|         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; | ||||
|             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 oneOrTwoHanded = mapping[ref->base->data.type].second; | ||||
| 
 | ||||
|             text += environment.mWorld->getStore().gameSettings.search(type)->str + | ||||
|                 ((oneOrTwoHanded != "") ? ", " + environment.mWorld->getStore().gameSettings.search(oneOrTwoHanded)->str : ""); | ||||
|             text += store.gameSettings.search(type)->str + | ||||
|                 ((oneOrTwoHanded != "") ? ", " + store.gameSettings.search(oneOrTwoHanded)->str : ""); | ||||
| 
 | ||||
|             // weapon damage
 | ||||
|             if (ref->base->data.type >= 9) | ||||
|             { | ||||
|                 // 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[1])); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 // 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[1])); | ||||
|                 // 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[1])); | ||||
|                 // 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[1])); | ||||
|             } | ||||
|  | @ -321,10 +323,10 @@ namespace MWClass | |||
| 
 | ||||
|         /// \todo store the current weapon health somewhere
 | ||||
|         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 += 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); | ||||
| 
 | ||||
|         // this should be going into a custom mygui widget MWEnchantment
 | ||||
|         /*
 | ||||
|  | @ -352,11 +354,11 @@ namespace MWClass | |||
|         */ | ||||
|         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; | ||||
|         } | ||||
| 
 | ||||
|         if (environment.mWindowManager->getFullHelp()) { | ||||
|         if (MWBase::Environment::get().getWindowManager()->getFullHelp()) { | ||||
|             text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner"); | ||||
|             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; | ||||
|             ///< 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; | ||||
|             ///< \return name (the one that is to be presented to the user; not the internal one);
 | ||||
|             /// can return an empty string.
 | ||||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             virtual bool hasToolTip (const MWWorld::Ptr& ptr) const; | ||||
|             ///< @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.
 | ||||
| 
 | ||||
|             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
 | ||||
|             /// stay stacked when equipped?
 | ||||
| 
 | ||||
|             virtual int getEquipmentSkill (const MWWorld::Ptr& ptr, | ||||
|                 const MWWorld::Environment& environment) const; | ||||
|             virtual int getEquipmentSkill (const MWWorld::Ptr& ptr) const; | ||||
|             /// Return the index of the skill this item corresponds to when equiopped or -1, if there is
 | ||||
|             /// no such skill.
 | ||||
| 
 | ||||
|  | @ -51,10 +50,10 @@ namespace MWClass | |||
| 
 | ||||
|             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
 | ||||
| 
 | ||||
|             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
 | ||||
|     }; | ||||
| } | ||||
|  |  | |||
|  | @ -9,9 +9,9 @@ | |||
| 
 | ||||
| #include <components/esm_store/store.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/class.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwworld/world.hpp" | ||||
| #include "../mwworld/refdata.hpp" | ||||
| #include "../mwworld/player.hpp" | ||||
|  | @ -181,7 +181,7 @@ namespace MWDialogue | |||
| 
 | ||||
|                 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); | ||||
|                     int sameFaction = 0; | ||||
|                     if(!NPCstats.mFactionRank.empty()) | ||||
|  | @ -288,12 +288,12 @@ namespace MWDialogue | |||
|                 if (select.type==ESM::VT_Short || select.type==ESM::VT_Int || | ||||
|                     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; | ||||
|                 } | ||||
|                 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; | ||||
|                 } | ||||
|                 else | ||||
|  | @ -308,13 +308,13 @@ namespace MWDialogue | |||
|                     select.type==ESM::VT_Long) | ||||
|                 { | ||||
|                     if (!checkLocal (comp, toLower (name), select.i, actor, | ||||
|                         mEnvironment.mWorld->getStore())) | ||||
|                         MWBase::Environment::get().getWorld()->getStore())) | ||||
|                         return false; | ||||
|                 } | ||||
|                 else if (select.type==ESM::VT_Float) | ||||
|                 { | ||||
|                     if (!checkLocal (comp, toLower (name), select.f, actor, | ||||
|                         mEnvironment.mWorld->getStore())) | ||||
|                         MWBase::Environment::get().getWorld()->getStore())) | ||||
|                         return false; | ||||
|                 } | ||||
|                 else | ||||
|  | @ -326,7 +326,7 @@ namespace MWDialogue | |||
|             case '4'://journal
 | ||||
|                 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 | ||||
|                     throw std::runtime_error ( | ||||
|  | @ -336,7 +336,7 @@ namespace MWDialogue | |||
| 
 | ||||
|             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); | ||||
| 
 | ||||
|                 int sum = 0; | ||||
|  | @ -424,13 +424,13 @@ namespace MWDialogue | |||
|                     select.type==ESM::VT_Long) | ||||
|                 { | ||||
|                     if (checkLocal (comp, toLower (name), select.i, actor, | ||||
|                         mEnvironment.mWorld->getStore())) | ||||
|                         MWBase::Environment::get().getWorld()->getStore())) | ||||
|                         return false; | ||||
|                 } | ||||
|                 else if (select.type==ESM::VT_Float) | ||||
|                 { | ||||
|                     if (checkLocal (comp, toLower (name), select.f, actor, | ||||
|                         mEnvironment.mWorld->getStore())) | ||||
|                         MWBase::Environment::get().getWorld()->getStore())) | ||||
|                         return false; | ||||
|                 } | ||||
|                 else | ||||
|  | @ -500,7 +500,7 @@ namespace MWDialogue | |||
|         // TODO check player faction
 | ||||
|         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); | ||||
|             if(it!=stats.mFactionRank.end()) | ||||
|             { | ||||
|  | @ -528,7 +528,7 @@ namespace MWDialogue | |||
| 
 | ||||
|         // check cell
 | ||||
|         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; | ||||
| 
 | ||||
|         // TODO check DATAstruct
 | ||||
|  | @ -540,8 +540,8 @@ namespace MWDialogue | |||
|         return true; | ||||
|     } | ||||
| 
 | ||||
|     DialogueManager::DialogueManager (MWWorld::Environment& environment,const Compiler::Extensions& extensions) : | ||||
|     mEnvironment (environment),mCompilerContext (MWScript::CompilerContext::Type_Dialgoue, environment), | ||||
|     DialogueManager::DialogueManager (const Compiler::Extensions& extensions) : | ||||
|       mCompilerContext (MWScript::CompilerContext::Type_Dialgoue), | ||||
|         mErrorStream(std::cout.rdbuf()),mErrorHandler(mErrorStream) | ||||
|     { | ||||
|         mChoice = -1; | ||||
|  | @ -549,10 +549,10 @@ namespace MWDialogue | |||
|         mCompilerContext.setExtensions (&extensions); | ||||
|         mDialogueMap.clear(); | ||||
|         actorKnownTopics.clear(); | ||||
|         ESMS::RecListT<ESM::Dialogue>::MapType dialogueList = mEnvironment.mWorld->getStore().dialogs.list; | ||||
|         for(ESMS::RecListT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++) | ||||
|         ESMS::RecListCaseT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list; | ||||
|         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(); | ||||
| 
 | ||||
|         //initialise the GUI
 | ||||
|         mEnvironment.mInputManager->setGuiMode(MWGui::GM_Dialogue); | ||||
|         MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow(); | ||||
|         MWBase::Environment::get().getInputManager()->setGuiMode(MWGui::GM_Dialogue); | ||||
|         MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow(); | ||||
|         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
 | ||||
|  | @ -601,9 +601,9 @@ namespace MWDialogue | |||
| 
 | ||||
|         //greeting
 | ||||
|         bool greetingFound = false; | ||||
|         //ESMS::RecListT<ESM::Dialogue>::MapType dialogueList = mEnvironment.mWorld->getStore().dialogs.list;
 | ||||
|         ESMS::RecListT<ESM::Dialogue>::MapType dialogueList = mEnvironment.mWorld->getStore().dialogs.list; | ||||
|         for(ESMS::RecListT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++) | ||||
|         //ESMS::RecListT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list;
 | ||||
|         ESMS::RecListCaseT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list; | ||||
|         for(ESMS::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++) | ||||
|         { | ||||
|             ESM::Dialogue ndialogue = it->second; | ||||
|             if(ndialogue.type == ESM::Dialogue::Greeting) | ||||
|  | @ -650,7 +650,7 @@ namespace MWDialogue | |||
|             if (!actorScript.empty()) | ||||
|             { | ||||
|                 // 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); | ||||
|  | @ -677,13 +677,12 @@ namespace MWDialogue | |||
| 
 | ||||
|     void DialogueManager::executeScript(std::string script) | ||||
|     { | ||||
|         std::cout << script; | ||||
|         std::vector<Interpreter::Type_Code> code; | ||||
|         if(compile(script,code)) | ||||
|         { | ||||
|             try | ||||
|             { | ||||
|                 MWScript::InterpreterContext interpreterContext(mEnvironment,&mActor.getRefData().getLocals(),mActor); | ||||
|                 MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor); | ||||
|                 Interpreter::Interpreter interpreter; | ||||
|                 MWScript::installOpcodes (interpreter); | ||||
|                 interpreter.run (&code[0], code.size(), interpreterContext); | ||||
|  | @ -701,9 +700,9 @@ namespace MWDialogue | |||
|         int choice = mChoice; | ||||
|         mChoice = -1; | ||||
|         actorKnownTopics.clear(); | ||||
|         MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow(); | ||||
|         ESMS::RecListT<ESM::Dialogue>::MapType dialogueList = mEnvironment.mWorld->getStore().dialogs.list; | ||||
|         for(ESMS::RecListT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++) | ||||
|         MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow(); | ||||
|         ESMS::RecListCaseT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list; | ||||
|         for(ESMS::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++) | ||||
|         { | ||||
|             ESM::Dialogue ndialogue = it->second; | ||||
|             if(ndialogue.type == ESM::Dialogue::Topic) | ||||
|  | @ -713,7 +712,7 @@ namespace MWDialogue | |||
|                 { | ||||
|                     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?
 | ||||
|                         if(knownTopics.find(toLower(it->first)) != knownTopics.end()) | ||||
|                         { | ||||
|  | @ -747,7 +746,7 @@ namespace MWDialogue | |||
| 
 | ||||
|                             parseText(text); | ||||
| 
 | ||||
|                             MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow(); | ||||
|                             MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow(); | ||||
|                             win->addTitle(keyword); | ||||
|                             win->addText(iter->response); | ||||
| 
 | ||||
|  | @ -767,7 +766,7 @@ namespace MWDialogue | |||
| 
 | ||||
|     void DialogueManager::goodbyeSelected() | ||||
|     { | ||||
|         mEnvironment.mInputManager->setGuiMode(MWGui::GM_Game); | ||||
|         MWBase::Environment::get().getInputManager()->setGuiMode(MWGui::GM_Game); | ||||
|     } | ||||
| 
 | ||||
|     void DialogueManager::questionAnswered(std::string answere) | ||||
|  | @ -790,7 +789,7 @@ namespace MWDialogue | |||
|                             mChoiceMap.clear(); | ||||
|                             mChoice = -1; | ||||
|                             mIsInChoice = false; | ||||
|                             MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow(); | ||||
|                             MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow(); | ||||
|                             std::string text = iter->response; | ||||
|                             parseText(text); | ||||
|                             win->addText(text); | ||||
|  | @ -808,13 +807,13 @@ namespace MWDialogue | |||
| 
 | ||||
|     void DialogueManager::printError(std::string error) | ||||
|     { | ||||
|         MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow(); | ||||
|         MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow(); | ||||
|         win->addText(error); | ||||
|     } | ||||
| 
 | ||||
|     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); | ||||
|         mChoiceMap[question] = choice; | ||||
|         mIsInChoice = true; | ||||
|  |  | |||
|  | @ -11,17 +11,10 @@ | |||
| #include "../mwworld/ptr.hpp" | ||||
| #include <map> | ||||
| 
 | ||||
| namespace MWWorld | ||||
| { | ||||
|     class Environment; | ||||
| } | ||||
| 
 | ||||
| namespace MWDialogue | ||||
| { | ||||
|     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& info) const; | ||||
|  | @ -39,7 +32,7 @@ namespace MWDialogue | |||
|             MWScript::CompilerContext mCompilerContext; | ||||
|             std::ostream mErrorStream; | ||||
|             Compiler::StreamErrorHandler mErrorHandler; | ||||
|              | ||||
| 
 | ||||
| 
 | ||||
|             bool compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code); | ||||
|             void executeScript(std::string script); | ||||
|  | @ -55,7 +48,7 @@ namespace MWDialogue | |||
| 
 | ||||
|         public: | ||||
| 
 | ||||
|             DialogueManager (MWWorld::Environment& environment,const Compiler::Extensions& extensions); | ||||
|             DialogueManager (const Compiler::Extensions& extensions); | ||||
| 
 | ||||
|             void startDialogue (const MWWorld::Ptr& actor); | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| 
 | ||||
| #include "journal.hpp" | ||||
| 
 | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwgui/window_manager.hpp" | ||||
| #include "../mwgui/messagebox.hpp" | ||||
|  | @ -23,31 +23,30 @@ namespace MWDialogue | |||
|         return iter->second; | ||||
|     } | ||||
| 
 | ||||
|     Journal::Journal (MWWorld::Environment& environment) | ||||
|     : mEnvironment (environment) | ||||
|     Journal::Journal() | ||||
|     {} | ||||
| 
 | ||||
|     void Journal::addEntry (const std::string& id, int index) | ||||
|     { | ||||
|         StampedJournalEntry entry = | ||||
|             StampedJournalEntry::makeFromQuest (id, index, *mEnvironment.mWorld); | ||||
|             StampedJournalEntry::makeFromQuest (id, index, *MWBase::Environment::get().getWorld()); | ||||
| 
 | ||||
|         mJournal.push_back (entry); | ||||
| 
 | ||||
|         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::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) | ||||
|     { | ||||
|         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) | ||||
|  | @ -62,7 +61,7 @@ namespace MWDialogue | |||
|             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 | ||||
|  |  | |||
|  | @ -8,11 +8,6 @@ | |||
| #include "journalentry.hpp" | ||||
| #include "quest.hpp" | ||||
| 
 | ||||
| namespace MWWorld | ||||
| { | ||||
|     struct Environment; | ||||
| } | ||||
| 
 | ||||
| namespace MWDialogue | ||||
| { | ||||
|     /// \brief The player's journal
 | ||||
|  | @ -29,7 +24,6 @@ namespace MWDialogue | |||
| 
 | ||||
|         private: | ||||
| 
 | ||||
|             MWWorld::Environment& mEnvironment; | ||||
|             TEntryContainer mJournal; | ||||
|             TQuestContainer mQuests; | ||||
|             TTopicContainer mTopics; | ||||
|  | @ -38,7 +32,7 @@ namespace MWDialogue | |||
| 
 | ||||
|         public: | ||||
| 
 | ||||
|             Journal (MWWorld::Environment& environment); | ||||
|             Journal(); | ||||
| 
 | ||||
|             void addEntry (const std::string& id, int index); | ||||
|             ///< Add a journal entry.
 | ||||
|  |  | |||
|  | @ -8,6 +8,8 @@ | |||
| #include "dialogue.hpp" | ||||
| #include "mode.hpp" | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| namespace | ||||
| { | ||||
|     struct Step | ||||
|  | @ -93,7 +95,7 @@ namespace | |||
| 
 | ||||
| using namespace MWGui; | ||||
| 
 | ||||
| CharacterCreation::CharacterCreation(WindowManager* _wm, MWWorld::Environment* _environment) | ||||
| CharacterCreation::CharacterCreation(WindowManager* _wm) | ||||
|     : mNameDialog(0) | ||||
|     , mRaceDialog(0) | ||||
|     , mDialogueWindow(0) | ||||
|  | @ -105,7 +107,6 @@ CharacterCreation::CharacterCreation(WindowManager* _wm, MWWorld::Environment* _ | |||
|     , mBirthSignDialog(0) | ||||
|     , mReviewDialog(0) | ||||
|     , mWM(_wm) | ||||
|     , mEnvironment(_environment) | ||||
| { | ||||
|     mCreationStage = CSE_NotStarted; | ||||
| } | ||||
|  | @ -279,8 +280,8 @@ void CharacterCreation::onPickClassDialogDone(WindowBase* parWindow) | |||
|     { | ||||
|         const std::string &classId = mPickClassDialog->getClassId(); | ||||
|         if (!classId.empty()) | ||||
|             mEnvironment->mMechanicsManager->setPlayerClass(classId); | ||||
|         const ESM::Class *klass = mEnvironment->mWorld->getStore().classes.find(classId); | ||||
|             MWBase::Environment::get().getMechanicsManager()->setPlayerClass(classId); | ||||
|         const ESM::Class *klass = MWBase::Environment::get().getWorld()->getStore().classes.find(classId); | ||||
|         if (klass) | ||||
|         { | ||||
|             mPlayerClass = *klass; | ||||
|  | @ -307,7 +308,7 @@ void CharacterCreation::onPickClassDialogBack() | |||
|     { | ||||
|         const std::string classId = mPickClassDialog->getClassId(); | ||||
|         if (!classId.empty()) | ||||
|             mEnvironment->mMechanicsManager->setPlayerClass(classId); | ||||
|             MWBase::Environment::get().getMechanicsManager()->setPlayerClass(classId); | ||||
|         mWM->removeDialog(mPickClassDialog); | ||||
|     } | ||||
| 
 | ||||
|  | @ -345,7 +346,7 @@ void CharacterCreation::onNameDialogDone(WindowBase* parWindow) | |||
|     { | ||||
|         mPlayerName = mNameDialog->getTextInput(); | ||||
|         mWM->setValue("name", mPlayerName); | ||||
|         mEnvironment->mMechanicsManager->setPlayerName(mPlayerName); | ||||
|         MWBase::Environment::get().getMechanicsManager()->setPlayerName(mPlayerName); | ||||
|         mWM->removeDialog(mNameDialog); | ||||
|     } | ||||
| 
 | ||||
|  | @ -366,7 +367,7 @@ void CharacterCreation::onRaceDialogBack() | |||
|     { | ||||
|         mPlayerRaceId = mRaceDialog->getRaceId(); | ||||
|         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); | ||||
|     } | ||||
| 
 | ||||
|  | @ -380,7 +381,7 @@ void CharacterCreation::onRaceDialogDone(WindowBase* parWindow) | |||
|         mPlayerRaceId = mRaceDialog->getRaceId(); | ||||
|         mWM->setValue("race", mPlayerRaceId); | ||||
|         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); | ||||
|     } | ||||
| 
 | ||||
|  | @ -402,7 +403,7 @@ void CharacterCreation::onBirthSignDialogDone(WindowBase* parWindow) | |||
|         mPlayerBirthSignId = mBirthSignDialog->getBirthId(); | ||||
|         mWM->setBirthSign(mPlayerBirthSignId); | ||||
|         if (!mPlayerBirthSignId.empty()) | ||||
|             mEnvironment->mMechanicsManager->setPlayerBirthsign(mPlayerBirthSignId); | ||||
|             MWBase::Environment::get().getMechanicsManager()->setPlayerBirthsign(mPlayerBirthSignId); | ||||
|         mWM->removeDialog(mBirthSignDialog); | ||||
|     } | ||||
| 
 | ||||
|  | @ -419,7 +420,7 @@ void CharacterCreation::onBirthSignDialogBack() | |||
| { | ||||
|     if (mBirthSignDialog) | ||||
|     { | ||||
|         mEnvironment->mMechanicsManager->setPlayerBirthsign(mBirthSignDialog->getBirthId()); | ||||
|         MWBase::Environment::get().getMechanicsManager()->setPlayerBirthsign(mBirthSignDialog->getBirthId()); | ||||
|         mWM->removeDialog(mBirthSignDialog); | ||||
|     } | ||||
| 
 | ||||
|  | @ -450,7 +451,7 @@ void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow) | |||
|             klass.data.skills[i][1] = majorSkills[i]; | ||||
|             klass.data.skills[i][0] = minorSkills[i]; | ||||
|         } | ||||
|         mEnvironment->mMechanicsManager->setPlayerClass(klass); | ||||
|         MWBase::Environment::get().getMechanicsManager()->setPlayerClass(klass); | ||||
|         mPlayerClass = klass; | ||||
|         mWM->setPlayerClass(klass); | ||||
| 
 | ||||
|  | @ -592,7 +593,7 @@ void CharacterCreation::onGenerateClassBack() | |||
| 
 | ||||
|     if (mGenerateClassResultDialog) | ||||
|         mWM->removeDialog(mGenerateClassResultDialog); | ||||
|     mEnvironment->mMechanicsManager->setPlayerClass(mGenerateClass); | ||||
|     MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass); | ||||
| 
 | ||||
|     mWM->setGuiMode(GM_Class); | ||||
| } | ||||
|  | @ -601,7 +602,7 @@ void CharacterCreation::onGenerateClassDone(WindowBase* parWindow) | |||
| { | ||||
|     if (mGenerateClassResultDialog) | ||||
|         mWM->removeDialog(mGenerateClassResultDialog); | ||||
|     mEnvironment->mMechanicsManager->setPlayerClass(mGenerateClass); | ||||
|     MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass); | ||||
| 
 | ||||
|     if (mCreationStage == CSE_ReviewNext) | ||||
|         mWM->setGuiMode(GM_Review); | ||||
|  |  | |||
|  | @ -30,7 +30,7 @@ namespace MWGui | |||
|     public: | ||||
|     typedef std::vector<int> SkillList; | ||||
| 
 | ||||
|     CharacterCreation(WindowManager* _wm, MWWorld::Environment* _environment); | ||||
|     CharacterCreation(WindowManager* _wm); | ||||
|     ~CharacterCreation(); | ||||
| 
 | ||||
|     //Show a dialog
 | ||||
|  | @ -56,7 +56,6 @@ namespace MWGui | |||
|     ReviewDialog* mReviewDialog; | ||||
| 
 | ||||
|     WindowManager* mWM; | ||||
|     MWWorld::Environment* mEnvironment; | ||||
| 
 | ||||
|     //Player data
 | ||||
|     std::string mPlayerName; | ||||
|  |  | |||
|  | @ -7,6 +7,8 @@ | |||
| 
 | ||||
| #include "../mwscript/extensions.hpp" | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| namespace MWGui | ||||
| { | ||||
|     class ConsoleInterpreterContext : public MWScript::InterpreterContext | ||||
|  | @ -15,15 +17,14 @@ namespace MWGui | |||
| 
 | ||||
|         public: | ||||
| 
 | ||||
|             ConsoleInterpreterContext (Console& console, MWWorld::Environment& environment, | ||||
|                 MWWorld::Ptr reference); | ||||
|             ConsoleInterpreterContext (Console& console, MWWorld::Ptr reference); | ||||
| 
 | ||||
|             virtual void report (const std::string& message); | ||||
|     }; | ||||
| 
 | ||||
|     ConsoleInterpreterContext::ConsoleInterpreterContext (Console& console, | ||||
|         MWWorld::Environment& environment, MWWorld::Ptr reference) | ||||
|     : MWScript::InterpreterContext (environment, | ||||
|         MWWorld::Ptr reference) | ||||
|     : MWScript::InterpreterContext ( | ||||
|         reference.isEmpty() ? 0 : &reference.getRefData().getLocals(), reference), | ||||
|       mConsole (console) | ||||
|     {} | ||||
|  | @ -88,7 +89,7 @@ namespace MWGui | |||
|             scanner.listKeywords (mNames); | ||||
| 
 | ||||
|             // 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()); | ||||
|                 iter!=store.recLists.end(); ++iter) | ||||
|  | @ -101,11 +102,9 @@ namespace MWGui | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     Console::Console(int w, int h, MWWorld::Environment& environment, | ||||
|         const Compiler::Extensions& extensions) | ||||
|     Console::Console(int w, int h, const Compiler::Extensions& extensions) | ||||
|       : Layout("openmw_console_layout.xml"), | ||||
|         mCompilerContext (MWScript::CompilerContext::Type_Console, environment), | ||||
|         mEnvironment (environment) | ||||
|         mCompilerContext (MWScript::CompilerContext::Type_Console) | ||||
|     { | ||||
|         setCoord(10,10, w-10, h/2); | ||||
| 
 | ||||
|  | @ -139,7 +138,7 @@ namespace MWGui | |||
|     void Console::disable() | ||||
|     { | ||||
|         setVisible(false); | ||||
|         // Remove keyboard focus from the console input whenever the 
 | ||||
|         // Remove keyboard focus from the console input whenever the
 | ||||
|         // console is turned off
 | ||||
|         MyGUI::InputManager::getInstance().setKeyFocusWidget(NULL); | ||||
|     } | ||||
|  | @ -241,7 +240,7 @@ namespace MWGui | |||
|         { | ||||
|             try | ||||
|             { | ||||
|                 ConsoleInterpreterContext interpreterContext (*this, mEnvironment, MWWorld::Ptr()); | ||||
|                 ConsoleInterpreterContext interpreterContext (*this, MWWorld::Ptr()); | ||||
|                 Interpreter::Interpreter interpreter; | ||||
|                 MWScript::installOpcodes (interpreter); | ||||
|                 std::vector<Interpreter::Type_Code> code; | ||||
|  |  | |||
|  | @ -23,7 +23,6 @@ namespace MWGui | |||
|     private: | ||||
| 
 | ||||
|         MWScript::CompilerContext mCompilerContext; | ||||
|         MWWorld::Environment& mEnvironment; | ||||
|         std::vector<std::string> mNames; | ||||
| 
 | ||||
|         bool compile (const std::string& cmd, Compiler::Output& output); | ||||
|  | @ -51,7 +50,7 @@ namespace MWGui | |||
|     StringList::iterator current; | ||||
|     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(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ | |||
| #include "window_manager.hpp" | ||||
| #include "widgets.hpp" | ||||
| #include "components/esm_store/store.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwbase/environment.hpp" | ||||
| #include "../mwdialogue/dialoguemanager.hpp" | ||||
| 
 | ||||
| #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) | ||||
|     : WindowBase("openmw_dialogue_window_layout.xml", parWindowManager), | ||||
|     mEnvironment(environment) | ||||
| DialogueWindow::DialogueWindow(WindowManager& parWindowManager) | ||||
|     : WindowBase("openmw_dialogue_window_layout.xml", parWindowManager) | ||||
| { | ||||
|     // Centre dialog
 | ||||
|     center(); | ||||
|  | @ -54,7 +53,7 @@ DialogueWindow::DialogueWindow(WindowManager& parWindowManager,MWWorld::Environm | |||
|     /// \todo scrolling the dialogue history with the mouse wheel doesn't work using this solution
 | ||||
|     getWidget(eventbox, "EventBox"); | ||||
|     eventbox->eventMouseButtonClick += MyGUI::newDelegate(this, &DialogueWindow::onHistoryClicked); | ||||
|      | ||||
| 
 | ||||
|     //Topics list
 | ||||
|     getWidget(topicsList, "TopicsList"); | ||||
|     topicsList->setScrollVisible(true); | ||||
|  | @ -83,9 +82,9 @@ void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender) | |||
|     if(color != "#B29154") | ||||
|     { | ||||
|         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) | ||||
| { | ||||
|     mEnvironment.mDialogueManager->goodbyeSelected(); | ||||
|     MWBase::Environment::get().getDialogueManager()->goodbyeSelected(); | ||||
| } | ||||
| 
 | ||||
| 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) | ||||
|         return; | ||||
|     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) | ||||
|  | @ -183,6 +182,16 @@ void DialogueWindow::addText(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); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -9,11 +9,6 @@ namespace MWGui | |||
|     class WindowManager; | ||||
| } | ||||
| 
 | ||||
| namespace MWWorld | ||||
| { | ||||
|     class Environment; | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|   This file contains the dialouge window | ||||
|   Layout is defined by resources/mygui/openmw_dialogue_window_layout.xml. | ||||
|  | @ -23,17 +18,15 @@ namespace MWGui | |||
| { | ||||
|     class DialogueHistory; | ||||
| 
 | ||||
|     using namespace MyGUI; | ||||
| 
 | ||||
|     class DialogueWindow: public WindowBase | ||||
|     { | ||||
|     public: | ||||
|         DialogueWindow(WindowManager& parWindowManager,MWWorld::Environment& environment); | ||||
|         DialogueWindow(WindowManager& parWindowManager); | ||||
| 
 | ||||
|         void open(); | ||||
| 
 | ||||
|         // Events
 | ||||
|         typedef delegates::CMultiDelegate0 EventHandle_Void; | ||||
|         typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void; | ||||
| 
 | ||||
|         /** Event : Dialog finished, OK button clicked.\n
 | ||||
|             signature : void method()\n | ||||
|  | @ -65,8 +58,6 @@ namespace MWGui | |||
|         MyGUI::ProgressPtr pDispositionBar; | ||||
|         MyGUI::EditPtr pDispositionText; | ||||
|         std::map<std::string,std::string> pTopicsText;// this map links keyword and "real" text.
 | ||||
| 
 | ||||
|         MWWorld::Environment& mEnvironment; | ||||
|     }; | ||||
| } | ||||
| #endif | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| #include "journalwindow.hpp" | ||||
| #include "window_manager.hpp" | ||||
| #include "../mwdialogue/journal.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwbase/environment.hpp" | ||||
| #include "../mwworld/world.hpp" | ||||
| 
 | ||||
| #include "../mwsound/soundmanager.hpp" | ||||
|  | @ -118,20 +118,20 @@ void MWGui::JournalWindow::open() | |||
| { | ||||
|     mPageNumber = 0; | ||||
|     std::string journalOpenSound = "book open"; | ||||
|     mWindowManager.getEnvironment().mSoundManager->playSound (journalOpenSound, 1.0, 1.0); | ||||
|     if(mWindowManager.getEnvironment().mJournal->begin()!=mWindowManager.getEnvironment().mJournal->end()) | ||||
|     MWBase::Environment::get().getSoundManager()->playSound (journalOpenSound, 1.0, 1.0); | ||||
|     if(MWBase::Environment::get().getJournal()->begin()!=MWBase::Environment::get().getJournal()->end()) | ||||
|     { | ||||
|         book journal; | ||||
|         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.endLine = journal.endLine +1; | ||||
|             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);
 | ||||
|         bool left = true; | ||||
|         for(std::list<std::string>::iterator it = journal.pages.begin(); it != journal.pages.end();it++) | ||||
|  | @ -155,7 +155,7 @@ void MWGui::JournalWindow::open() | |||
|     } | ||||
|     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) | ||||
|     { | ||||
|         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; | ||||
|         displayLeftText(leftPages[mPageNumber]); | ||||
|         displayRightText(rightPages[mPageNumber]); | ||||
|  | @ -193,7 +193,7 @@ void MWGui::JournalWindow::notifyPrevPage(MyGUI::WidgetPtr _sender) | |||
|     if(mPageNumber > 0) | ||||
|     { | ||||
|         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; | ||||
|         displayLeftText(leftPages[mPageNumber]); | ||||
|         displayRightText(rightPages[mPageNumber]); | ||||
|  |  | |||
|  | @ -145,7 +145,7 @@ IntSize ToolTips::getToolTipViaPtr () | |||
|     { | ||||
|         mDynamicToolTipBox->setVisible(true); | ||||
| 
 | ||||
|         ToolTipInfo info = object.getToolTipInfo(mFocusObject, mWindowManager->getEnvironment()); | ||||
|         ToolTipInfo info = object.getToolTipInfo(mFocusObject); | ||||
|         tooltipSize = createToolTip(info); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -12,6 +12,8 @@ | |||
| #include "../mwmechanics/mechanicsmanager.hpp" | ||||
| #include "../mwinput/inputmanager.hpp" | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "console.hpp" | ||||
| #include "journalwindow.hpp" | ||||
| #include "charactercreation.hpp" | ||||
|  | @ -24,10 +26,9 @@ | |||
| 
 | ||||
| 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) | ||||
|   : mGuiManager(NULL) | ||||
|   , environment(environment) | ||||
|   , hud(NULL) | ||||
|   , map(NULL) | ||||
|   , menu(NULL) | ||||
|  | @ -78,16 +79,16 @@ WindowManager::WindowManager(MWWorld::Environment& environment, | |||
|     menu = new MainMenu(w,h); | ||||
|     map = new MapWindow(*this); | ||||
|     stats = new StatsWindow(*this); | ||||
|     console = new Console(w,h, environment, extensions); | ||||
|     console = new Console(w,h, extensions); | ||||
|     mJournal = new JournalWindow(*this); | ||||
|     mMessageBoxManager = new MessageBoxManager(this); | ||||
|     dialogueWindow = new DialogueWindow(*this,environment); | ||||
|     dialogueWindow = new DialogueWindow(*this); | ||||
|     mToolTips = new ToolTips(this); | ||||
| 
 | ||||
|     // The HUD is always on
 | ||||
|     hud->setVisible(true); | ||||
| 
 | ||||
|     mCharGen = new CharacterCreation(this, &environment); | ||||
|     mCharGen = new CharacterCreation(this); | ||||
| 
 | ||||
|     // Setup player stats
 | ||||
|     for (int i = 0; i < ESM::Attribute::Length; ++i) | ||||
|  | @ -147,7 +148,7 @@ void WindowManager::update() | |||
|     if (needModeChange) | ||||
|     { | ||||
|         needModeChange = false; | ||||
|         environment.mInputManager->setGuiMode(nextMode); | ||||
|         MWBase::Environment::get().getInputManager()->setGuiMode(nextMode); | ||||
|         nextMode = GM_Game; | ||||
|     } | ||||
|     if (showFPSLevel > 0) | ||||
|  | @ -158,11 +159,6 @@ void WindowManager::update() | |||
|     } | ||||
| } | ||||
| 
 | ||||
| MWWorld::Environment& WindowManager::getEnvironment() | ||||
| { | ||||
|     return environment; | ||||
| } | ||||
| 
 | ||||
| void WindowManager::setNextMode(GuiMode newMode) | ||||
| { | ||||
|     nextMode = newMode; | ||||
|  | @ -171,7 +167,7 @@ void WindowManager::setNextMode(GuiMode newMode) | |||
| 
 | ||||
| void WindowManager::setGuiMode(GuiMode newMode) | ||||
| { | ||||
|     environment.mInputManager->setGuiMode(newMode); | ||||
|     MWBase::Environment::get().getInputManager()->setGuiMode(newMode); | ||||
| } | ||||
| 
 | ||||
| void WindowManager::updateVisible() | ||||
|  | @ -397,7 +393,7 @@ int WindowManager::readPressedButton () | |||
| 
 | ||||
| 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) | ||||
|         return setting->str; | ||||
|     return default_; | ||||
|  | @ -422,7 +418,7 @@ void WindowManager::onFrame (float frameDuration) | |||
| 
 | ||||
| const ESMS::ESMStore& WindowManager::getStore() const | ||||
| { | ||||
|     return environment.mWorld->getStore(); | ||||
|     return MWBase::Environment::get().getWorld()->getStore(); | ||||
| } | ||||
| 
 | ||||
| void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell) | ||||
|  | @ -434,7 +430,7 @@ void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell) | |||
|             name = cell->cell->name; | ||||
|         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; | ||||
|         } | ||||
| 
 | ||||
|  |  | |||
|  | @ -34,7 +34,6 @@ namespace Compiler | |||
| 
 | ||||
| namespace MWWorld | ||||
| { | ||||
|     class Environment; | ||||
|     class World; | ||||
| } | ||||
| 
 | ||||
|  | @ -84,7 +83,7 @@ namespace MWGui | |||
|     typedef std::vector<Faction> FactionList; | ||||
|     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(); | ||||
| 
 | ||||
|     void setGuiMode(GuiMode newMode); | ||||
|  | @ -96,8 +95,6 @@ namespace MWGui | |||
|      */ | ||||
|     void update(); | ||||
| 
 | ||||
|     MWWorld::Environment& getEnvironment(); | ||||
| 
 | ||||
|     void setMode(GuiMode newMode) | ||||
|     { | ||||
|       if (newMode==GM_Inventory && allowed==GW_None) | ||||
|  | @ -197,7 +194,6 @@ namespace MWGui | |||
| 
 | ||||
|   private: | ||||
|     OEngine::GUI::MyGUIManager *mGuiManager; | ||||
|     MWWorld::Environment& environment; | ||||
|     HUD *hud; | ||||
|     MapWindow *map; | ||||
|     MainMenu *menu; | ||||
|  |  | |||
|  | @ -97,34 +97,36 @@ namespace MWInput | |||
| 
 | ||||
|     void toggleSpell() | ||||
|     { | ||||
|          DrawState state = player.getDrawState(); | ||||
|          if(state == DrawState_Weapon || state == DrawState_Nothing) | ||||
|          { | ||||
|              player.setDrawState(DrawState_Spell); | ||||
|              std::cout << "Player has now readied his hands for spellcasting!\n"; | ||||
|          } | ||||
|          else | ||||
|          { | ||||
|              player.setDrawState(DrawState_Nothing); | ||||
|              std::cout << "Player does not have any kind of attack ready now.\n"; | ||||
|          } | ||||
|         if (windows.isGuiMode()) return; | ||||
| 
 | ||||
|         DrawState state = player.getDrawState(); | ||||
|         if (state == DrawState_Weapon || state == DrawState_Nothing) | ||||
|         { | ||||
|             player.setDrawState(DrawState_Spell); | ||||
|             std::cout << "Player has now readied his hands for spellcasting!\n"; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             player.setDrawState(DrawState_Nothing); | ||||
|             std::cout << "Player does not have any kind of attack ready now.\n"; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     void toggleWeapon() | ||||
|     { | ||||
|          DrawState state = player.getDrawState(); | ||||
|          if(state == DrawState_Spell || state == DrawState_Nothing) | ||||
|          { | ||||
|              player.setDrawState(DrawState_Weapon); | ||||
|              std::cout << "Player is now drawing his weapon.\n"; | ||||
|          } | ||||
|          else | ||||
|          { | ||||
|              player.setDrawState(DrawState_Nothing); | ||||
|              std::cout << "Player does not have any kind of attack ready now.\n"; | ||||
|          } | ||||
|         if (windows.isGuiMode()) return; | ||||
| 
 | ||||
|         DrawState state = player.getDrawState(); | ||||
|         if (state == DrawState_Spell || state == DrawState_Nothing) | ||||
|         { | ||||
|             player.setDrawState(DrawState_Weapon); | ||||
|             std::cout << "Player is now drawing his weapon.\n"; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             player.setDrawState(DrawState_Nothing); | ||||
|             std::cout << "Player does not have any kind of attack ready now.\n"; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     void screenshot() | ||||
|  | @ -184,11 +186,13 @@ namespace MWInput | |||
| 
 | ||||
|     void toggleAutoMove() | ||||
|     { | ||||
|         if (windows.isGuiMode()) return; | ||||
|         player.setAutoMove (!player.getAutoMove()); | ||||
|     } | ||||
| 
 | ||||
|     void toggleWalking() | ||||
|     { | ||||
|         if (windows.isGuiMode()) return; | ||||
|         player.toggleRunning(); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -19,10 +19,10 @@ namespace MWMechanics | |||
|     { | ||||
|         if (!paused && ptr.getRefData().getHandle()!="player") | ||||
|             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) | ||||
|     { | ||||
|  |  | |||
|  | @ -12,16 +12,10 @@ namespace Ogre | |||
|     class Vector3; | ||||
| } | ||||
| 
 | ||||
| namespace MWWorld | ||||
| { | ||||
|     class Environment; | ||||
| } | ||||
| 
 | ||||
| namespace MWMechanics | ||||
| { | ||||
|     class Actors | ||||
|     { | ||||
|             MWWorld::Environment& mEnvironment; | ||||
|             std::set<MWWorld::Ptr> mActors; | ||||
|             float mDuration; | ||||
| 
 | ||||
|  | @ -31,7 +25,7 @@ namespace MWMechanics | |||
| 
 | ||||
|         public: | ||||
| 
 | ||||
|             Actors (MWWorld::Environment& environment); | ||||
|             Actors(); | ||||
| 
 | ||||
|             void addActor (const MWWorld::Ptr& ptr); | ||||
|             ///< Register an actor for stats management
 | ||||
|  |  | |||
|  | @ -5,8 +5,9 @@ | |||
| 
 | ||||
| #include "../mwgui/window_manager.hpp" | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/class.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwworld/world.hpp" | ||||
| #include "../mwworld/player.hpp" | ||||
| 
 | ||||
|  | @ -14,7 +15,7 @@ namespace MWMechanics | |||
| { | ||||
|     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::NpcStats& npcStats = MWWorld::Class::get (ptr).getNpcStats (ptr); | ||||
|  | @ -33,10 +34,10 @@ namespace MWMechanics | |||
|         if (mRaceSelected) | ||||
|         { | ||||
|             const ESM::Race *race = | ||||
|                 mEnvironment.mWorld->getStore().races.find ( | ||||
|                 mEnvironment.mWorld->getPlayer().getRace()); | ||||
|                 MWBase::Environment::get().getWorld()->getStore().races.find ( | ||||
|                 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) | ||||
|             { | ||||
|  | @ -76,11 +77,11 @@ namespace MWMechanics | |||
|         } | ||||
| 
 | ||||
|         // birthsign
 | ||||
|         if (!mEnvironment.mWorld->getPlayer().getBirthsign().empty()) | ||||
|         if (!MWBase::Environment::get().getWorld()->getPlayer().getBirthsign().empty()) | ||||
|         { | ||||
|             const ESM::BirthSign *sign = | ||||
|                 mEnvironment.mWorld->getStore().birthSigns.find ( | ||||
|                 mEnvironment.mWorld->getPlayer().getBirthsign()); | ||||
|                 MWBase::Environment::get().getWorld()->getStore().birthSigns.find ( | ||||
|                 MWBase::Environment::get().getWorld()->getPlayer().getBirthsign()); | ||||
| 
 | ||||
|             for (std::vector<std::string>::const_iterator iter (sign->powers.list.begin()); | ||||
|                 iter!=sign->powers.list.end(); ++iter) | ||||
|  | @ -92,7 +93,7 @@ namespace MWMechanics | |||
|         // class
 | ||||
|         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) | ||||
|             { | ||||
|  | @ -121,7 +122,7 @@ namespace MWMechanics | |||
|             } | ||||
| 
 | ||||
|             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) | ||||
|             { | ||||
|  | @ -164,7 +165,7 @@ namespace MWMechanics | |||
|         MWMechanics::CreatureStats& creatureStats = | ||||
|             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
 | ||||
| 
 | ||||
|  | @ -175,9 +176,9 @@ namespace MWMechanics | |||
|         // TODO apply diff to other stats
 | ||||
|     } | ||||
| 
 | ||||
|     MechanicsManager::MechanicsManager (MWWorld::Environment& environment) | ||||
|     : mEnvironment (environment), mUpdatePlayer (true), mClassSelected (false), | ||||
|       mRaceSelected (false), mActors (environment) | ||||
|     MechanicsManager::MechanicsManager() | ||||
|     : mUpdatePlayer (true), mClassSelected (false), | ||||
|       mRaceSelected (false) | ||||
|     { | ||||
|         buildPlayer(); | ||||
|     } | ||||
|  | @ -236,7 +237,7 @@ namespace MWMechanics | |||
|                 { | ||||
|                     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]; | ||||
| 
 | ||||
|                     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; | ||||
|                     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) | ||||
|                 mEnvironment.mWindowManager->updateSkillArea(); | ||||
|                 MWBase::Environment::get().getWindowManager()->updateSkillArea(); | ||||
| 
 | ||||
|             mEnvironment.mWindowManager->setValue ("level", stats.mLevel); | ||||
|             MWBase::Environment::get().getWindowManager()->setValue ("level", stats.mLevel); | ||||
|         } | ||||
| 
 | ||||
|         if (mUpdatePlayer) | ||||
|         { | ||||
|             // basic player profile; should not change anymore after the creation phase is finished.
 | ||||
|             mEnvironment.mWindowManager->setValue ("name", mEnvironment.mWorld->getPlayer().getName()); | ||||
|             mEnvironment.mWindowManager->setValue ("race", | ||||
|                 mEnvironment.mWorld->getStore().races.find (mEnvironment.mWorld->getPlayer(). | ||||
|             MWBase::Environment::get().getWindowManager()->setValue ("name", MWBase::Environment::get().getWorld()->getPlayer().getName()); | ||||
|             MWBase::Environment::get().getWindowManager()->setValue ("race", | ||||
|                 MWBase::Environment::get().getWorld()->getStore().races.find (MWBase::Environment::get().getWorld()->getPlayer(). | ||||
|                 getRace())->name); | ||||
|             mEnvironment.mWindowManager->setValue ("class", | ||||
|                 mEnvironment.mWorld->getPlayer().getClass().name); | ||||
|             MWBase::Environment::get().getWindowManager()->setValue ("class", | ||||
|                 MWBase::Environment::get().getWorld()->getPlayer().getClass().name); | ||||
|             mUpdatePlayer = false; | ||||
| 
 | ||||
|             MWGui::WindowManager::SkillList majorSkills (5); | ||||
|  | @ -285,11 +286,11 @@ namespace MWMechanics | |||
| 
 | ||||
|             for (int i=0; i<5; ++i) | ||||
|             { | ||||
|                 minorSkills[i] = mEnvironment.mWorld->getPlayer().getClass().data.skills[i][0]; | ||||
|                 majorSkills[i] = mEnvironment.mWorld->getPlayer().getClass().data.skills[i][1]; | ||||
|                 minorSkills[i] = MWBase::Environment::get().getWorld()->getPlayer().getClass().data.skills[i][0]; | ||||
|                 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); | ||||
|  | @ -297,14 +298,14 @@ namespace MWMechanics | |||
| 
 | ||||
|     void MechanicsManager::setPlayerName (const std::string& name) | ||||
|     { | ||||
|         mEnvironment.mWorld->getPlayer().setName (name); | ||||
|         MWBase::Environment::get().getWorld()->getPlayer().setName (name); | ||||
|         mUpdatePlayer = true; | ||||
|     } | ||||
| 
 | ||||
|     void MechanicsManager::setPlayerRace (const std::string& race, bool male) | ||||
|     { | ||||
|         mEnvironment.mWorld->getPlayer().setGender (male); | ||||
|         mEnvironment.mWorld->getPlayer().setRace (race); | ||||
|         MWBase::Environment::get().getWorld()->getPlayer().setGender (male); | ||||
|         MWBase::Environment::get().getWorld()->getPlayer().setRace (race); | ||||
|         mRaceSelected = true; | ||||
|         buildPlayer(); | ||||
|         mUpdatePlayer = true; | ||||
|  | @ -312,14 +313,14 @@ namespace MWMechanics | |||
| 
 | ||||
|     void MechanicsManager::setPlayerBirthsign (const std::string& id) | ||||
|     { | ||||
|         mEnvironment.mWorld->getPlayer().setBirthsign (id); | ||||
|         MWBase::Environment::get().getWorld()->getPlayer().setBirthsign (id); | ||||
|         buildPlayer(); | ||||
|         mUpdatePlayer = true; | ||||
|     } | ||||
| 
 | ||||
|     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; | ||||
|         buildPlayer(); | ||||
|         mUpdatePlayer = true; | ||||
|  | @ -327,7 +328,7 @@ namespace MWMechanics | |||
| 
 | ||||
|     void MechanicsManager::setPlayerClass (const ESM::Class& class_) | ||||
|     { | ||||
|         mEnvironment.mWorld->getPlayer().setClass (class_); | ||||
|         MWBase::Environment::get().getWorld()->getPlayer().setClass (class_); | ||||
|         mClassSelected = true; | ||||
|         buildPlayer(); | ||||
|         mUpdatePlayer = true; | ||||
|  |  | |||
|  | @ -15,16 +15,10 @@ namespace Ogre | |||
|     class Vector3; | ||||
| } | ||||
| 
 | ||||
| namespace MWWorld | ||||
| { | ||||
|     class Environment; | ||||
| } | ||||
| 
 | ||||
| namespace MWMechanics | ||||
| { | ||||
|     class MechanicsManager | ||||
|     { | ||||
|             MWWorld::Environment& mEnvironment; | ||||
|             MWWorld::Ptr mWatched; | ||||
|             CreatureStats mWatchedCreature; | ||||
|             NpcStats mWatchedNpc; | ||||
|  | @ -41,7 +35,7 @@ namespace MWMechanics | |||
| 
 | ||||
|         public: | ||||
| 
 | ||||
|             MechanicsManager (MWWorld::Environment& environment); | ||||
|             MechanicsManager (); | ||||
| 
 | ||||
|             void configureGUI(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -3,7 +3,8 @@ | |||
| 
 | ||||
| #include <components/esm/loadspel.hpp> | ||||
| 
 | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/world.hpp" | ||||
| 
 | ||||
| #include "magiceffects.hpp" | ||||
|  | @ -48,13 +49,13 @@ namespace MWMechanics | |||
|             mSelectedSpell.clear(); | ||||
|     } | ||||
| 
 | ||||
|     MagicEffects Spells::getMagicEffects (const MWWorld::Environment& environment) const | ||||
|     MagicEffects Spells::getMagicEffects() const | ||||
|     { | ||||
|         MagicEffects effects; | ||||
| 
 | ||||
|         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 || | ||||
|                 spell->data.type==ESM::Spell::ST_Disease || spell->data.type==ESM::Spell::ST_Curse) | ||||
|  |  | |||
|  | @ -9,11 +9,6 @@ namespace ESM | |||
|     struct Spell; | ||||
| } | ||||
| 
 | ||||
| namespace MWWorld | ||||
| { | ||||
|     struct Environment; | ||||
| } | ||||
| 
 | ||||
| namespace MWMechanics | ||||
| { | ||||
|     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
 | ||||
|             /// 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.
 | ||||
| 
 | ||||
|             void clear(); | ||||
|  |  | |||
|  | @ -22,10 +22,10 @@ void Actors::setMwRoot(Ogre::SceneNode* root){ | |||
| } | ||||
| void Actors::insertNPC(const MWWorld::Ptr& ptr, MWWorld::InventoryStore& inv){ | ||||
| 
 | ||||
|         insertBegin(ptr, true, true); | ||||
|          NpcAnimation* anim = new MWRender::NpcAnimation(ptr, mEnvironment, mRend, inv); | ||||
|     insertBegin(ptr, true, true); | ||||
|     NpcAnimation* anim = new MWRender::NpcAnimation(ptr, mRend, inv); | ||||
| 
 | ||||
|         mAllActors[ptr] = anim; | ||||
|     mAllActors[ptr] = anim; | ||||
| } | ||||
| void Actors::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_){ | ||||
|     Ogre::SceneNode* cellnode; | ||||
|  | @ -68,7 +68,7 @@ void Actors::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_){ | |||
| void Actors::insertCreature (const MWWorld::Ptr& ptr){ | ||||
| 
 | ||||
|     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));
 | ||||
|     delete mAllActors[ptr]; | ||||
|     mAllActors[ptr] = anim; | ||||
|  |  | |||
|  | @ -13,7 +13,6 @@ | |||
| #include "../mwworld/refdata.hpp" | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/actiontalk.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "npcanimation.hpp" | ||||
| #include "creatureanimation.hpp" | ||||
| #include <openengine/bullet/physic.hpp> | ||||
|  | @ -23,13 +22,12 @@ namespace MWRender{ | |||
|         OEngine::Render::OgreRenderer &mRend; | ||||
|         std::map<MWWorld::Ptr::CellStore *, Ogre::SceneNode *> mCellSceneNodes; | ||||
|         Ogre::SceneNode* mMwRoot; | ||||
|         MWWorld::Environment& mEnvironment; | ||||
| 		std::map<MWWorld::Ptr, Animation*> mAllActors; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         public: | ||||
|         Actors(OEngine::Render::OgreRenderer& _rend, MWWorld::Environment& _env): mRend(_rend), mEnvironment(_env){} | ||||
|         Actors(OEngine::Render::OgreRenderer& _rend): mRend(_rend) {} | ||||
|         ~Actors(); | ||||
|         void setMwRoot(Ogre::SceneNode* root); | ||||
|         void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_); | ||||
|  |  | |||
|  | @ -4,10 +4,9 @@ | |||
| namespace MWRender{ | ||||
|     std::map<std::string, int> Animation::mUniqueIDs; | ||||
| 
 | ||||
|     Animation::Animation(MWWorld::Environment& _env, OEngine::Render::OgreRenderer& _rend) | ||||
|     Animation::Animation(OEngine::Render::OgreRenderer& _rend) | ||||
|         : insert(NULL) | ||||
|         , mRend(_rend) | ||||
|         , mEnvironment(_env) | ||||
|         , vecRotPos() | ||||
|         , time(0.0f) | ||||
|         , startTime(0.0f) | ||||
|  | @ -428,7 +427,7 @@ namespace MWRender{ | |||
|      //base->_updateAnimation();
 | ||||
|    //base->_notifyMoved();
 | ||||
| 
 | ||||
|    | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     std::vector<Nif::NiKeyframeData>::iterator iter; | ||||
|  |  | |||
|  | @ -5,7 +5,6 @@ | |||
| #include "../mwworld/refdata.hpp" | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/actiontalk.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include <components/nif/node.hpp> | ||||
| #include <map> | ||||
| #include <openengine/bullet/physic.hpp> | ||||
|  | @ -21,16 +20,15 @@ struct PosAndRot{ | |||
| }; | ||||
| 
 | ||||
| class Animation{ | ||||
|      | ||||
| 
 | ||||
|    protected: | ||||
|     Ogre::SceneNode* insert; | ||||
|     OEngine::Render::OgreRenderer &mRend; | ||||
|     MWWorld::Environment& mEnvironment; | ||||
|     std::map<Nif::NiSkinData::BoneInfoCopy*, PosAndRot> vecRotPos; | ||||
|     static std::map<std::string, int> mUniqueIDs; | ||||
| 	 | ||||
|      | ||||
|     | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     float time; | ||||
|  | @ -41,14 +39,14 @@ class Animation{ | |||
| 	std::vector<int>rindexI; | ||||
|     //Represents a translation index for each bone
 | ||||
| 	std::vector<int>tindexI; | ||||
| 	 | ||||
| 
 | ||||
| 	//Only shapes with morphing data will use a shape number
 | ||||
| 	int shapeNumber; | ||||
| 	std::vector<std::vector<int> > shapeIndexI; | ||||
| 
 | ||||
| 	//Ogre::SkeletonInstance* skel;
 | ||||
|      std::vector<Nif::NiTriShapeCopy>* shapes;          //All the NiTriShapeData for a creature
 | ||||
|       | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     std::vector<Nif::NiKeyframeData>* transformations; | ||||
|  | @ -58,16 +56,16 @@ class Animation{ | |||
|     void handleAnimationTransforms(); | ||||
|     bool timeIndex( float time, const std::vector<float> & times, int & i, int & j, float & x ); | ||||
|     std::string getUniqueID(std::string mesh); | ||||
| 	 | ||||
| 
 | ||||
|     public: | ||||
|         Animation(MWWorld::Environment& _env, OEngine::Render::OgreRenderer& _rend); | ||||
|         Animation(OEngine::Render::OgreRenderer& _rend); | ||||
|         virtual void runAnimation(float timepassed) = 0; | ||||
|         void startScript(std::string groupname, int mode, int loops); | ||||
|         void stopScript(); | ||||
| 
 | ||||
| 
 | ||||
|         virtual ~Animation(); | ||||
|   | ||||
| 
 | ||||
| }; | ||||
| } | ||||
| #endif | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ namespace MWRender{ | |||
| 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(); | ||||
|     ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref = | ||||
|             ptr.get<ESM::Creature>(); | ||||
|  |  | |||
|  | @ -7,20 +7,19 @@ | |||
| 
 | ||||
| #include "../mwworld/refdata.hpp" | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "components/nifogre/ogre_nif_loader.hpp" | ||||
| 
 | ||||
| 
 | ||||
| namespace MWRender{ | ||||
| 
 | ||||
| class CreatureAnimation: public Animation{ | ||||
|     | ||||
| 
 | ||||
|     public: | ||||
|     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); | ||||
| 	 | ||||
| 
 | ||||
| 
 | ||||
| }; | ||||
| } | ||||
| #endif | ||||
| #endif | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ | |||
| #include <OgreMaterialManager.h> | ||||
| 
 | ||||
| #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 <components/esm/loadstat.hpp> | ||||
| #include <components/esm/loadpgrd.hpp> | ||||
|  | @ -138,8 +138,8 @@ ManualObject *Debugging::createPathgridPoints(const ESM::Pathgrid *pathgrid) | |||
|     return result; | ||||
| } | ||||
| 
 | ||||
| Debugging::Debugging(SceneNode *mwRoot, MWWorld::Environment &env, OEngine::Physic::PhysicEngine *engine) : | ||||
|     mMwRoot(mwRoot), mEnvironment(env), mEngine(engine), | ||||
| Debugging::Debugging(SceneNode *mwRoot, OEngine::Physic::PhysicEngine *engine) : | ||||
|     mMwRoot(mwRoot), mEngine(engine), | ||||
|     mSceneMgr(mwRoot->getCreator()), | ||||
|     mPathgridEnabled(false), | ||||
|     mInteriorPathgridNode(NULL), mPathGridRoot(NULL), | ||||
|  | @ -218,7 +218,7 @@ void Debugging::togglePathgrid() | |||
| 
 | ||||
| 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; | ||||
| 
 | ||||
|     Vector3 cellPathGridPos(0, 0, 0); | ||||
|  |  | |||
|  | @ -23,7 +23,6 @@ namespace Ogre | |||
| namespace MWWorld | ||||
| { | ||||
|     class World; | ||||
|     class Environment; | ||||
| } | ||||
| 
 | ||||
| namespace MWRender | ||||
|  | @ -34,7 +33,6 @@ namespace MWRender | |||
|     { | ||||
|         OEngine::Physic::PhysicEngine* mEngine; | ||||
|         Ogre::SceneManager *mSceneMgr; | ||||
|         MWWorld::Environment& mEnvironment; | ||||
| 
 | ||||
|         // Path grid stuff
 | ||||
|         bool mPathgridEnabled; | ||||
|  | @ -68,7 +66,7 @@ namespace MWRender | |||
|         Ogre::ManualObject *createPathgridLines(const ESM::Pathgrid *pathgrid); | ||||
|         Ogre::ManualObject *createPathgridPoints(const ESM::Pathgrid *pathgrid); | ||||
|     public: | ||||
|         Debugging(Ogre::SceneNode* mwRoot, MWWorld::Environment &env, OEngine::Physic::PhysicEngine *engine); | ||||
|         Debugging(Ogre::SceneNode* mwRoot, OEngine::Physic::PhysicEngine *engine); | ||||
|         ~Debugging(); | ||||
|         bool toggleRenderMode (int mode); | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| #include "localmap.hpp" | ||||
| #include "renderingmanager.hpp" | ||||
| 
 | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwbase/environment.hpp" | ||||
| #include "../mwworld/world.hpp" | ||||
| #include "../mwgui/window_manager.hpp" | ||||
| #include "renderconst.hpp" | ||||
|  | @ -12,12 +12,11 @@ | |||
| using namespace MWRender; | ||||
| 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) | ||||
| { | ||||
|     mRendering = rend; | ||||
|     mRenderingManager = rendering; | ||||
|     mEnvironment = env; | ||||
| 
 | ||||
|     mCameraPosNode = mRendering->getScene()->getRootSceneNode()->createChildSceneNode(); | ||||
|     mCameraRotNode = mCameraPosNode->createChildSceneNode(); | ||||
|  | @ -54,12 +53,12 @@ void LocalMap::saveTexture(const std::string& texname, const std::string& filena | |||
|     if (tex.isNull()) return; | ||||
|     HardwarePixelBufferSharedPtr readbuffer = tex->getBuffer(); | ||||
|     readbuffer->lock(HardwareBuffer::HBL_NORMAL ); | ||||
|     const PixelBox &readrefpb = readbuffer->getCurrentLock();     | ||||
|     uchar *readrefdata = static_cast<uchar*>(readrefpb.data);         | ||||
|     const PixelBox &readrefpb = readbuffer->getCurrentLock(); | ||||
|     uchar *readrefdata = static_cast<uchar*>(readrefpb.data); | ||||
| 
 | ||||
|     Image img; | ||||
|     img = img.loadDynamicImage (readrefdata, tex->getWidth(), | ||||
|         tex->getHeight(), tex->getFormat());     | ||||
|         tex->getHeight(), tex->getFormat()); | ||||
|     img.save("./" + filename); | ||||
| 
 | ||||
|     readbuffer->unlock(); | ||||
|  | @ -82,7 +81,7 @@ void LocalMap::saveFogOfWar(MWWorld::Ptr::CellStore* cell) | |||
|         Vector2 min(mBounds.getMinimum().x, mBounds.getMinimum().z); | ||||
|         Vector2 max(mBounds.getMaximum().x, mBounds.getMaximum().z); | ||||
|         Vector2 length = max-min; | ||||
|          | ||||
| 
 | ||||
|         // divide into segments
 | ||||
|         const int segsX = std::ceil( length.x / sSize ); | ||||
|         const int segsY = std::ceil( length.y / sSize ); | ||||
|  | @ -123,7 +122,7 @@ void LocalMap::requestMap(MWWorld::Ptr::CellStore* cell, | |||
| 
 | ||||
|     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)); | ||||
|     mAngle = angle.valueRadians(); | ||||
|     mCameraRotNode->setOrientation(Quaternion(Math::Cos(angle/2.f), 0, Math::Sin(angle/2.f), 0)); | ||||
|  | @ -213,7 +212,7 @@ void LocalMap::render(const float x, const float y, | |||
|                             texture, | ||||
|                             ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, | ||||
|                             TEX_TYPE_2D, | ||||
|                             xw*sMapResolution/sSize, yw*sMapResolution/sSize,  | ||||
|                             xw*sMapResolution/sSize, yw*sMapResolution/sSize, | ||||
|                             0, | ||||
|                             PF_R8G8B8, | ||||
|                             TU_RENDERTARGET); | ||||
|  | @ -236,7 +235,7 @@ void LocalMap::render(const float x, const float y, | |||
|                             texture + "_fog", | ||||
|                             ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, | ||||
|                             TEX_TYPE_2D, | ||||
|                             xw*sFogOfWarResolution/sSize, yw*sFogOfWarResolution/sSize,  | ||||
|                             xw*sFogOfWarResolution/sSize, yw*sFogOfWarResolution/sSize, | ||||
|                             0, | ||||
|                             PF_A8R8G8B8, | ||||
|                             TU_DYNAMIC_WRITE_ONLY_DISCARDABLE); | ||||
|  | @ -276,7 +275,7 @@ void LocalMap::updatePlayer (const Ogre::Vector3& position, const Ogre::Quaterni | |||
|             return; | ||||
|     } | ||||
| 
 | ||||
|     // retrieve the x,y grid coordinates the player is in 
 | ||||
|     // retrieve the x,y grid coordinates the player is in
 | ||||
|     int x,y; | ||||
|     Vector3 _pos(position.x, 0, position.z); | ||||
|     Vector2 pos(_pos.x, _pos.z); | ||||
|  | @ -303,7 +302,7 @@ void LocalMap::updatePlayer (const Ogre::Vector3& position, const Ogre::Quaterni | |||
|         x = std::ceil((pos.x - min.x)/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
 | ||||
|  | @ -323,8 +322,8 @@ void LocalMap::updatePlayer (const Ogre::Vector3& position, const Ogre::Quaterni | |||
|         texName = mInteriorName + "_" + coordStr(x,y); | ||||
|     } | ||||
| 
 | ||||
|     mEnvironment->mWindowManager->setPlayerPos(u, v); | ||||
|     mEnvironment->mWindowManager->setPlayerDir(playerdirection.x, -playerdirection.z); | ||||
|     MWBase::Environment::get().getWindowManager()->setPlayerPos(u, v); | ||||
|     MWBase::Environment::get().getWindowManager()->setPlayerDir(playerdirection.x, -playerdirection.z); | ||||
| 
 | ||||
|     // explore radius (squared)
 | ||||
|     const float sqrExploreRadius = 0.01 * sFogOfWarResolution*sFogOfWarResolution; | ||||
|  |  | |||
|  | @ -5,11 +5,6 @@ | |||
| 
 | ||||
| #include <openengine/ogre/renderer.hpp> | ||||
| 
 | ||||
| namespace MWWorld | ||||
| { | ||||
|     class Environment; | ||||
| } | ||||
| 
 | ||||
| namespace MWRender | ||||
| { | ||||
|     class RenderingManager; | ||||
|  | @ -20,7 +15,7 @@ namespace MWRender | |||
|     class LocalMap | ||||
|     { | ||||
|     public: | ||||
|         LocalMap(OEngine::Render::OgreRenderer*, MWRender::RenderingManager* rendering, MWWorld::Environment* env); | ||||
|         LocalMap(OEngine::Render::OgreRenderer*, MWRender::RenderingManager* rendering); | ||||
|         ~LocalMap(); | ||||
| 
 | ||||
|         /**
 | ||||
|  | @ -61,7 +56,6 @@ namespace MWRender | |||
|     private: | ||||
|         OEngine::Render::OgreRenderer* mRendering; | ||||
|         MWRender::RenderingManager* mRenderingManager; | ||||
|         MWWorld::Environment* mEnvironment; | ||||
| 
 | ||||
|         // 1024*1024 pixels for a cell
 | ||||
|         static const int sMapResolution = 1024; | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ | |||
| #include "../mwworld/world.hpp" | ||||
| #include "renderconst.hpp" | ||||
| 
 | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| using namespace Ogre; | ||||
| 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()), | ||||
|     cuirass(inv.end()), greaves(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 headID = ref->base->head; | ||||
|         headModel = "meshes\\" + | ||||
|             mEnvironment.mWorld->getStore().bodyParts.find(headID)->model; | ||||
|             MWBase::Environment::get().getWorld()->getStore().bodyParts.find(headID)->model; | ||||
| 
 | ||||
| 		hairModel = "meshes\\" + | ||||
|             mEnvironment.mWorld->getStore().bodyParts.find(hairID)->model; | ||||
|             MWBase::Environment::get().getWorld()->getStore().bodyParts.find(hairID)->model; | ||||
| 		npcName = ref->base->name; | ||||
| 
 | ||||
|         //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); | ||||
|  | @ -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); | ||||
|         else | ||||
|             insert->scale(race->data.height.male, race->data.height.male, race->data.height.male); | ||||
| 		std::cout << "Inv" << inv.getStateId() << "\n"; | ||||
|         updateParts(); | ||||
| 
 | ||||
| } | ||||
|  | @ -370,116 +369,116 @@ void NpcAnimation::updateParts(){ | |||
|                         addOrReplaceIndividualPart(ESM::PRT_Hair, -1,1,hairModel); | ||||
|                 } | ||||
|                  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) | ||||
|                         addOrReplaceIndividualPart(ESM::PRT_Neck, -1,1,"meshes\\" + neckPart->model); | ||||
|                 } | ||||
|                 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) | ||||
|                         addOrReplaceIndividualPart(ESM::PRT_Cuirass, -1,1,"meshes\\" + chestPart->model); | ||||
|                 } | ||||
| 
 | ||||
|                  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) | ||||
|                         addOrReplaceIndividualPart(ESM::PRT_Groin, -1,1,"meshes\\" + groinPart->model); | ||||
|                 } | ||||
|                 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) | ||||
|                         handPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "hands"); | ||||
|                         handPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "hands"); | ||||
|                     if(handPart) | ||||
|                         addOrReplaceIndividualPart(ESM::PRT_RHand, -1,1,"meshes\\" + handPart->model); | ||||
|                 } | ||||
|                 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) | ||||
|                         handPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "hands"); | ||||
|                         handPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "hands"); | ||||
|                     if(handPart) | ||||
|                         addOrReplaceIndividualPart(ESM::PRT_LHand, -1,1,"meshes\\" + handPart->model); | ||||
|                 } | ||||
| 
 | ||||
|                 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) | ||||
|                         addOrReplaceIndividualPart(ESM::PRT_RWrist, -1,1,"meshes\\" + wristPart->model); | ||||
|                 } | ||||
|                  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) | ||||
|                         addOrReplaceIndividualPart(ESM::PRT_LWrist, -1,1,"meshes\\" + wristPart->model); | ||||
|                 } | ||||
|                   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_") | ||||
|                         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) | ||||
|                         addOrReplaceIndividualPart(ESM::PRT_RForearm, -1,1,"meshes\\" + forearmPart->model); | ||||
|                 } | ||||
|                  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_") | ||||
|                         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) | ||||
|                         addOrReplaceIndividualPart(ESM::PRT_LForearm, -1,1,"meshes\\" + forearmPart->model); | ||||
|                 } | ||||
|                   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) | ||||
|                         addOrReplaceIndividualPart(ESM::PRT_RUpperarm, -1,1,"meshes\\" + armPart->model); | ||||
|                 } | ||||
|                  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) | ||||
|                         addOrReplaceIndividualPart(ESM::PRT_LUpperarm, -1,1,"meshes\\" + armPart->model); | ||||
|                 } | ||||
|                   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) | ||||
|                         footPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "feet"); | ||||
|                         footPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "feet"); | ||||
|                     if(footPart) | ||||
|                         addOrReplaceIndividualPart(ESM::PRT_RFoot, -1,1,"meshes\\" + footPart->model); | ||||
|                 } | ||||
|                   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) | ||||
|                         footPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "feet"); | ||||
|                         footPart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (bodyRaceID + "feet"); | ||||
|                     if(footPart) | ||||
|                         addOrReplaceIndividualPart(ESM::PRT_LFoot, -1,1,"meshes\\" + footPart->model); | ||||
|                 } | ||||
|                  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) | ||||
|                         addOrReplaceIndividualPart(ESM::PRT_RAnkle, -1,1,"meshes\\" + anklePart->model); | ||||
|                 } | ||||
|                  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) | ||||
|                         addOrReplaceIndividualPart(ESM::PRT_LAnkle, -1,1,"meshes\\" + anklePart->model); | ||||
|                 } | ||||
|                      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) | ||||
|                         addOrReplaceIndividualPart(ESM::PRT_RKnee, -1,1,"meshes\\" + kneePart->model); | ||||
|                 } | ||||
|                  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) | ||||
|                         addOrReplaceIndividualPart(ESM::PRT_LKnee, -1,1,"meshes\\" + kneePart->model); | ||||
|                 } | ||||
|                    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) | ||||
|                         addOrReplaceIndividualPart(ESM::PRT_RLeg, -1,1,"meshes\\" + legPart->model); | ||||
|                 } | ||||
|                  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) | ||||
|                         addOrReplaceIndividualPart(ESM::PRT_LLeg, -1,1,"meshes\\" + legPart->model); | ||||
|                 } | ||||
|                  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) | ||||
|                         addOrReplaceIndividualPart(ESM::PRT_Tail, -1,1,"meshes\\" + tailPart->model); | ||||
|                 } | ||||
|  | @ -848,9 +847,9 @@ void NpcAnimation::removeIndividualPart(int type){ | |||
|                         const ESM::BodyPart *bodypart = 0; | ||||
| 
 | ||||
|                         if(isFemale) | ||||
|                             bodypart = mEnvironment.mWorld->getStore().bodyParts.search (part.female); | ||||
|                             bodypart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (part.female); | ||||
|                         if(!bodypart) | ||||
|                             bodypart = mEnvironment.mWorld->getStore().bodyParts.search (part.male); | ||||
|                             bodypart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search (part.male); | ||||
|                         if(bodypart){ | ||||
|                             addOrReplaceIndividualPart(part.part, group,priority,"meshes\\" + bodypart->model); | ||||
|                         } | ||||
|  |  | |||
|  | @ -10,7 +10,6 @@ | |||
| 
 | ||||
| #include "../mwworld/refdata.hpp" | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "components/nifogre/ogre_nif_loader.hpp" | ||||
| #include "../mwworld/inventorystore.hpp" | ||||
| #include "../mwclass/npc.hpp" | ||||
|  | @ -36,8 +35,8 @@ private: | |||
|        int partpriorities[27]; | ||||
|        std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> zero; | ||||
| 
 | ||||
| 	 | ||||
| 	 | ||||
| 
 | ||||
| 
 | ||||
| 	//Bounded Parts
 | ||||
| 	Ogre::Entity* lclavicle; | ||||
| 	Ogre::Entity* rclavicle; | ||||
|  | @ -59,7 +58,7 @@ private: | |||
| 	Ogre::Entity* rfoot; | ||||
| 	Ogre::Entity* hair; | ||||
| 	Ogre::Entity* head; | ||||
|      | ||||
| 
 | ||||
| 	Ogre::SceneNode* insert; | ||||
|     bool isBeast; | ||||
|     bool isFemale; | ||||
|  | @ -80,9 +79,9 @@ private: | |||
|     MWWorld::ContainerStoreIterator leftglove; | ||||
|     MWWorld::ContainerStoreIterator rightglove; | ||||
|     MWWorld::ContainerStoreIterator skirtiter; | ||||
|      | ||||
| 
 | ||||
|     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(); | ||||
|     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); | ||||
|  | @ -91,12 +90,12 @@ private: | |||
| 	void updateParts(); | ||||
|     void removeIndividualPart(int type); | ||||
|     void reserveIndividualPart(int type, int group, int priority); | ||||
|     | ||||
| 
 | ||||
|     bool addOrReplaceIndividualPart(int type, int group, int priority, const std::string &mesh); | ||||
|      void removePartGroup(int group); | ||||
|     void addPartGroup(int group, int priority, std::vector<ESM::PartReference>& parts); | ||||
| 
 | ||||
| 	 | ||||
| 
 | ||||
| }; | ||||
| } | ||||
| #endif | ||||
| #endif | ||||
|  |  | |||
|  | @ -24,8 +24,8 @@ using namespace Ogre; | |||
| 
 | ||||
| namespace MWRender { | ||||
| 
 | ||||
| RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, OEngine::Physic::PhysicEngine* engine, MWWorld::Environment& environment) | ||||
|     :mRendering(_rend), mObjects(mRendering), mActors(mRendering, environment), mAmbientMode(0), mSunEnabled(0) | ||||
| RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, OEngine::Physic::PhysicEngine* engine) | ||||
|     :mRendering(_rend), mObjects(mRendering), mActors(mRendering), mAmbientMode(0), mSunEnabled(0) | ||||
| { | ||||
|     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); | ||||
|     mShaderHelper = new ShaderHelper(this); | ||||
| 
 | ||||
|     mTerrainManager = new TerrainManager(mRendering.getScene(), this, | ||||
|                                          environment); | ||||
|     mTerrainManager = new TerrainManager(mRendering.getScene(), this); | ||||
| 
 | ||||
|     //mSkyManager = 0;
 | ||||
|     mSkyManager = new SkyManager(mMwRoot, mRendering.getCamera(), &environment); | ||||
|     mSkyManager = new SkyManager(mMwRoot, mRendering.getCamera()); | ||||
| 
 | ||||
|     mOcclusionQuery = new OcclusionQuery(&mRendering, mSkyManager->getSunNode()); | ||||
| 
 | ||||
|     mPlayer = new MWRender::Player (mRendering.getCamera(), playerNode); | ||||
|     mSun = 0; | ||||
| 
 | ||||
|     mDebugging = new Debugging(mMwRoot, environment, engine); | ||||
|     mLocalMap = new MWRender::LocalMap(&mRendering, this, &environment); | ||||
|     mDebugging = new Debugging(mMwRoot, engine); | ||||
|     mLocalMap = new MWRender::LocalMap(&mRendering, this); | ||||
| } | ||||
| 
 | ||||
| RenderingManager::~RenderingManager () | ||||
|  |  | |||
|  | @ -57,7 +57,7 @@ class RenderingManager: private RenderingInterface { | |||
|     virtual MWRender::Actors& getActors(); | ||||
| 
 | ||||
|   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(); | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ | |||
| 
 | ||||
| #include <components/nifogre/ogre_nif_loader.hpp> | ||||
| 
 | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwbase/environment.hpp" | ||||
| #include "../mwworld/world.hpp" | ||||
| #include "renderconst.hpp" | ||||
| #include "renderingmanager.hpp" | ||||
|  | @ -271,10 +271,10 @@ void Moon::setPhase(const Moon::Phase& phase) | |||
| { | ||||
|     // Colour texture
 | ||||
|     Ogre::String textureName = "textures\\tx_"; | ||||
|      | ||||
| 
 | ||||
|     if (mType == Moon::Type_Secunda) textureName += "secunda_"; | ||||
|     else textureName += "masser_"; | ||||
|      | ||||
| 
 | ||||
|     if      (phase == Moon::Phase_New)              textureName += "new"; | ||||
|     else if (phase == Moon::Phase_WaxingCrescent)   textureName += "one_wax"; | ||||
|     else if (phase == Moon::Phase_WaxingHalf)       textureName += "half_wax"; | ||||
|  | @ -283,9 +283,9 @@ void Moon::setPhase(const Moon::Phase& phase) | |||
|     else if (phase == Moon::Phase_WaningHalf)       textureName += "half_wan"; | ||||
|     else if (phase == Moon::Phase_WaningGibbous)    textureName += "three_wan"; | ||||
|     else if (phase == Moon::Phase_Full)             textureName += "full"; | ||||
|      | ||||
| 
 | ||||
|     textureName += ".dds"; | ||||
|      | ||||
| 
 | ||||
|     mMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName(textureName); | ||||
| 
 | ||||
|     mPhase = phase; | ||||
|  | @ -365,9 +365,8 @@ void SkyManager::ModVertexAlpha(Entity* ent, unsigned int meshType) | |||
|     ent->getMesh()->getSubMesh(0)->vertexData->vertexBufferBinding->getBuffer(ves_diffuse->getSource())->unlock(); | ||||
| } | ||||
| 
 | ||||
| SkyManager::SkyManager (SceneNode* pMwRoot, Camera* pCamera, MWWorld::Environment* env) | ||||
|     : mEnvironment(env) | ||||
|     , mHour(0.0f) | ||||
| SkyManager::SkyManager (SceneNode* pMwRoot, Camera* pCamera) | ||||
|     : mHour(0.0f) | ||||
|     , mDay(0) | ||||
|     , mMonth(0) | ||||
|     , mSun(NULL) | ||||
|  | @ -713,7 +712,7 @@ void SkyManager::update(float duration) | |||
|     if (!mEnabled) return; | ||||
| 
 | ||||
|     // 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
 | ||||
|     mMasser->setPhase( static_cast<Moon::Phase>( (int) ((mDay % 32)/4.f)) ); | ||||
|  | @ -752,7 +751,7 @@ void SkyManager::update(float duration) | |||
|     mSecunda->setVisible(mSecundaEnabled); | ||||
| 
 | ||||
|     // 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() | ||||
|  |  | |||
|  | @ -59,8 +59,8 @@ namespace MWRender | |||
|         Ogre::MaterialPtr mMaterial; | ||||
|         Ogre::BillboardSet* mBBSet; | ||||
|     }; | ||||
|      | ||||
|      | ||||
| 
 | ||||
| 
 | ||||
|     /*
 | ||||
|      * The moons need a seperate class because of their shader (which allows them to be partially transparent) | ||||
|      */ | ||||
|  | @ -104,11 +104,11 @@ namespace MWRender | |||
|         Type mType; | ||||
|         Phase mPhase; | ||||
|     }; | ||||
|          | ||||
| 
 | ||||
|     class SkyManager | ||||
|     { | ||||
|     public: | ||||
|         SkyManager(Ogre::SceneNode* pMwRoot, Ogre::Camera* pCamera, MWWorld::Environment* env); | ||||
|         SkyManager(Ogre::SceneNode* pMwRoot, Ogre::Camera* pCamera); | ||||
|         ~SkyManager(); | ||||
| 
 | ||||
|         void update(float duration); | ||||
|  | @ -176,7 +176,6 @@ namespace MWRender | |||
|     private: | ||||
|         bool mCreated; | ||||
| 
 | ||||
|         MWWorld::Environment* mEnvironment; | ||||
|         float mHour; | ||||
|         int mDay; | ||||
|         int mMonth; | ||||
|  |  | |||
|  | @ -4,6 +4,8 @@ | |||
| 
 | ||||
| #include "../mwworld/world.hpp" | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "terrainmaterial.hpp" | ||||
| #include "terrain.hpp" | ||||
| #include "renderconst.hpp" | ||||
|  | @ -17,8 +19,8 @@ namespace MWRender | |||
| 
 | ||||
|     //----------------------------------------------------------------------------------------------
 | ||||
| 
 | ||||
|     TerrainManager::TerrainManager(Ogre::SceneManager* mgr, RenderingManager* rend, const MWWorld::Environment& evn) : | ||||
|         mEnvironment(evn), mTerrainGroup(TerrainGroup(mgr, Terrain::ALIGN_X_Z, mLandSize, mWorldSize)), mRendering(rend) | ||||
|     TerrainManager::TerrainManager(Ogre::SceneManager* mgr, RenderingManager* rend) : | ||||
|          mTerrainGroup(TerrainGroup(mgr, Terrain::ALIGN_X_Z, mLandSize, mWorldSize)), mRendering(rend) | ||||
|     { | ||||
| 
 | ||||
|         TerrainMaterialGeneratorPtr matGen; | ||||
|  | @ -107,7 +109,7 @@ namespace MWRender | |||
|         const int cellX = store->cell->getGridX(); | ||||
|         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->dataLoaded) | ||||
|  | @ -268,7 +270,7 @@ namespace MWRender | |||
|             { | ||||
|                 //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"); | ||||
| 
 | ||||
|                 std::string texture; | ||||
|  | @ -278,7 +280,7 @@ namespace MWRender | |||
|                 } | ||||
|                 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
 | ||||
|                     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->dataLoaded) | ||||
|  |  | |||
|  | @ -24,7 +24,7 @@ namespace MWRender{ | |||
|      */ | ||||
|     class TerrainManager{ | ||||
|     public: | ||||
|         TerrainManager(Ogre::SceneManager* mgr, RenderingManager* rend, const MWWorld::Environment& env); | ||||
|         TerrainManager(Ogre::SceneManager* mgr, RenderingManager* rend); | ||||
|         virtual ~TerrainManager(); | ||||
| 
 | ||||
|         void setDiffuse(const Ogre::ColourValue& diffuse); | ||||
|  | @ -36,7 +36,6 @@ namespace MWRender{ | |||
|         Ogre::TerrainGlobalOptions mTerrainGlobals; | ||||
|         Ogre::TerrainGroup mTerrainGroup; | ||||
| 
 | ||||
|         const MWWorld::Environment& mEnvironment; | ||||
|         RenderingManager* mRendering; | ||||
| 
 | ||||
|         Ogre::TerrainMaterialGeneratorB::SM2Profile* mActiveProfile; | ||||
|  |  | |||
|  | @ -27,10 +27,7 @@ namespace MWScript | |||
|                 { | ||||
|                     MWWorld::Ptr ptr = R()(runtime); | ||||
| 
 | ||||
|                     InterpreterContext& context = | ||||
|                         static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     context.getWorld().skipAnimation (ptr); | ||||
|                     MWBase::Environment::get().getWorld()->skipAnimation (ptr); | ||||
|                } | ||||
|         }; | ||||
| 
 | ||||
|  | @ -43,9 +40,6 @@ namespace MWScript | |||
|                 { | ||||
|                     MWWorld::Ptr ptr = R()(runtime); | ||||
| 
 | ||||
|                     InterpreterContext& context = | ||||
|                         static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     std::string group = runtime.getStringLiteral (runtime[0].mInteger); | ||||
|                     runtime.pop(); | ||||
| 
 | ||||
|  | @ -60,7 +54,7 @@ namespace MWScript | |||
|                             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); | ||||
| 
 | ||||
|                     InterpreterContext& context = | ||||
|                         static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     std::string group = runtime.getStringLiteral (runtime[0].mInteger); | ||||
|                     runtime.pop(); | ||||
| 
 | ||||
|  | @ -96,7 +87,7 @@ namespace MWScript | |||
|                             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/opcodes.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/world.hpp" | ||||
| #include "../mwworld/player.hpp" | ||||
| 
 | ||||
|  | @ -22,10 +24,7 @@ namespace MWScript | |||
| 
 | ||||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     InterpreterContext& context | ||||
|                         = static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     runtime.push (context.getWorld().hasCellChanged() ? 1 : 0); | ||||
|                     runtime.push (MWBase::Environment::get().getWorld()->hasCellChanged() ? 1 : 0); | ||||
|                 } | ||||
|         }; | ||||
| 
 | ||||
|  | @ -35,9 +34,6 @@ namespace MWScript | |||
| 
 | ||||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     InterpreterContext& context | ||||
|                         = static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     std::string cell = runtime.getStringLiteral (runtime[0].mInteger); | ||||
|                     runtime.pop(); | ||||
| 
 | ||||
|  | @ -45,16 +41,16 @@ namespace MWScript | |||
|                     pos.rot[0] = pos.rot[1] = pos.rot[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); | ||||
|                         context.getWorld().changeToExteriorCell (pos); | ||||
|                         MWBase::Environment::get().getWorld()->changeToExteriorCell (pos); | ||||
|                     } | ||||
|                     else | ||||
|                     { | ||||
|                         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) | ||||
|                 { | ||||
|                     InterpreterContext& context | ||||
|                         = static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     Interpreter::Type_Integer x = runtime[0].mInteger; | ||||
|                     runtime.pop(); | ||||
| 
 | ||||
|  | @ -76,12 +69,12 @@ namespace MWScript | |||
| 
 | ||||
|                     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.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) | ||||
|                 { | ||||
|                     InterpreterContext& context | ||||
|                         = static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     bool interior = | ||||
|                         context.getWorld().getPlayer().getPlayer().getCell()->cell->data.flags & | ||||
|                         MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell->data.flags & | ||||
|                             ESM::Cell::Interior; | ||||
| 
 | ||||
|                     runtime.push (interior ? 1 : 0); | ||||
|  | @ -108,20 +98,17 @@ namespace MWScript | |||
| 
 | ||||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     InterpreterContext& context | ||||
|                         = static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     std::string name = runtime.getStringLiteral (runtime[0].mInteger); | ||||
|                     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; | ||||
| 
 | ||||
|                     if (!(cell->data.flags & ESM::Cell::Interior) && current.empty()) | ||||
|                     { | ||||
|                         const ESM::Region *region = | ||||
|                             context.getWorld().getStore().regions.find (cell->region); | ||||
|                             MWBase::Environment::get().getWorld()->getStore().regions.find (cell->region); | ||||
| 
 | ||||
|                         current = region->name; | ||||
|                     } | ||||
|  | @ -139,10 +126,7 @@ namespace MWScript | |||
| 
 | ||||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     InterpreterContext& context | ||||
|                         = static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     MWWorld::Ptr::CellStore *cell = context.getWorld().getPlayer().getPlayer().getCell(); | ||||
|                     MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell(); | ||||
|                     runtime.push (cell->mWaterLevel); | ||||
|                 } | ||||
|         }; | ||||
|  | @ -153,18 +137,15 @@ namespace MWScript | |||
| 
 | ||||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     InterpreterContext& context | ||||
|                         = static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     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)) | ||||
|                         throw std::runtime_error("Can't set water level in exterior cell"); | ||||
| 
 | ||||
|                     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) | ||||
|                 { | ||||
|                     InterpreterContext& context | ||||
|                         = static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     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)) | ||||
|                         throw std::runtime_error("Can't set water level in exterior cell"); | ||||
|                      | ||||
| 
 | ||||
|                     cell->mWaterLevel +=level; | ||||
|                     context.getEnvironment().mWorld->setWaterHeight(cell->mWaterLevel); | ||||
|                     MWBase::Environment::get().getWorld()->setWaterHeight(cell->mWaterLevel); | ||||
|                 } | ||||
|         }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,48 +1,48 @@ | |||
| 
 | ||||
| #include "compilercontext.hpp" | ||||
| 
 | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/world.hpp" | ||||
| 
 | ||||
| namespace MWScript | ||||
| { | ||||
|     CompilerContext::CompilerContext (Type type, const MWWorld::Environment& environment) | ||||
|     : mType (type), mEnvironment (environment) | ||||
|     CompilerContext::CompilerContext (Type type) | ||||
|     : mType (type) | ||||
|     {} | ||||
| 
 | ||||
|     bool CompilerContext::canDeclareLocals() const | ||||
|     { | ||||
|         return mType==Type_Full; | ||||
|     }    | ||||
|      | ||||
|     } | ||||
| 
 | ||||
|     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 | ||||
|     { | ||||
|         return | ||||
|             mEnvironment.mWorld->getStore().activators.search (name) || | ||||
|             mEnvironment.mWorld->getStore().potions.search (name) ||  | ||||
|             mEnvironment.mWorld->getStore().appas.search (name) ||  | ||||
|             mEnvironment.mWorld->getStore().armors.search (name) ||  | ||||
|             mEnvironment.mWorld->getStore().books.search (name) ||  | ||||
|             mEnvironment.mWorld->getStore().clothes.search (name) ||  | ||||
|             mEnvironment.mWorld->getStore().containers.search (name) ||  | ||||
|             mEnvironment.mWorld->getStore().creatures.search (name) ||  | ||||
|             mEnvironment.mWorld->getStore().doors.search (name) ||  | ||||
|             mEnvironment.mWorld->getStore().ingreds.search (name) ||  | ||||
|             mEnvironment.mWorld->getStore().creatureLists.search (name) ||  | ||||
|             mEnvironment.mWorld->getStore().itemLists.search (name) ||  | ||||
|             mEnvironment.mWorld->getStore().lights.search (name) ||  | ||||
|             mEnvironment.mWorld->getStore().lockpicks.search (name) ||  | ||||
|             mEnvironment.mWorld->getStore().miscItems.search (name) ||  | ||||
|             mEnvironment.mWorld->getStore().npcs.search (name) ||  | ||||
|             mEnvironment.mWorld->getStore().probes.search (name) ||  | ||||
|             mEnvironment.mWorld->getStore().repairs.search (name) ||  | ||||
|             mEnvironment.mWorld->getStore().statics.search (name) ||  | ||||
|             mEnvironment.mWorld->getStore().weapons.search (name); | ||||
|             MWBase::Environment::get().getWorld()->getStore().activators.search (name) || | ||||
|             MWBase::Environment::get().getWorld()->getStore().potions.search (name) || | ||||
|             MWBase::Environment::get().getWorld()->getStore().appas.search (name) || | ||||
|             MWBase::Environment::get().getWorld()->getStore().armors.search (name) || | ||||
|             MWBase::Environment::get().getWorld()->getStore().books.search (name) || | ||||
|             MWBase::Environment::get().getWorld()->getStore().clothes.search (name) || | ||||
|             MWBase::Environment::get().getWorld()->getStore().containers.search (name) || | ||||
|             MWBase::Environment::get().getWorld()->getStore().creatures.search (name) || | ||||
|             MWBase::Environment::get().getWorld()->getStore().doors.search (name) || | ||||
|             MWBase::Environment::get().getWorld()->getStore().ingreds.search (name) || | ||||
|             MWBase::Environment::get().getWorld()->getStore().creatureLists.search (name) || | ||||
|             MWBase::Environment::get().getWorld()->getStore().itemLists.search (name) || | ||||
|             MWBase::Environment::get().getWorld()->getStore().lights.search (name) || | ||||
|             MWBase::Environment::get().getWorld()->getStore().lockpicks.search (name) || | ||||
|             MWBase::Environment::get().getWorld()->getStore().miscItems.search (name) || | ||||
|             MWBase::Environment::get().getWorld()->getStore().npcs.search (name) || | ||||
|             MWBase::Environment::get().getWorld()->getStore().probes.search (name) || | ||||
|             MWBase::Environment::get().getWorld()->getStore().repairs.search (name) || | ||||
|             MWBase::Environment::get().getWorld()->getStore().statics.search (name) || | ||||
|             MWBase::Environment::get().getWorld()->getStore().weapons.search (name); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -3,44 +3,36 @@ | |||
| 
 | ||||
| #include <components/compiler/context.hpp> | ||||
| 
 | ||||
| namespace MWWorld | ||||
| { | ||||
|     class Environment; | ||||
| } | ||||
| 
 | ||||
| namespace MWScript | ||||
| { | ||||
|     class CompilerContext : public Compiler::Context | ||||
|     { | ||||
|         public: | ||||
|          | ||||
| 
 | ||||
|             enum Type | ||||
|             { | ||||
|                 Type_Full, // global, local, targetted
 | ||||
|                 Type_Dialgoue, | ||||
|                 Type_Console | ||||
|             }; | ||||
|              | ||||
| 
 | ||||
|         private: | ||||
|          | ||||
| 
 | ||||
|             Type mType; | ||||
|             const MWWorld::Environment& mEnvironment; | ||||
|      | ||||
| 
 | ||||
|         public: | ||||
|          | ||||
|             CompilerContext (Type type, const MWWorld::Environment& environment); | ||||
|          | ||||
| 
 | ||||
|             CompilerContext (Type type); | ||||
| 
 | ||||
|             /// Is the compiler allowed to declare local variables?
 | ||||
|             virtual bool canDeclareLocals() const;   | ||||
|              | ||||
|             /// 'l: long, 's': short, 'f': float, ' ': does not exist.              
 | ||||
|             virtual bool canDeclareLocals() const; | ||||
| 
 | ||||
|             /// 'l: long, 's': short, 'f': float, ' ': does not exist.
 | ||||
|             virtual char getGlobalType (const std::string& name) const; | ||||
| 
 | ||||
|             virtual bool isId (const std::string& name) const; | ||||
|             ///< Does \a name match an ID, that can be referenced?            
 | ||||
|             ///< Does \a name match an ID, that can be referenced?
 | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -9,6 +9,8 @@ | |||
| #include <components/interpreter/runtime.hpp> | ||||
| #include <components/interpreter/opcodes.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/manualref.hpp" | ||||
| #include "../mwworld/class.hpp" | ||||
| #include "../mwworld/containerstore.hpp" | ||||
|  | @ -29,9 +31,6 @@ namespace MWScript | |||
|                 { | ||||
|                     MWWorld::Ptr ptr = R()(runtime); | ||||
| 
 | ||||
|                     MWScript::InterpreterContext& context | ||||
|                         = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     std::string item = runtime.getStringLiteral (runtime[0].mInteger); | ||||
|                     runtime.pop(); | ||||
| 
 | ||||
|  | @ -41,7 +40,7 @@ namespace MWScript | |||
|                     if (count<0) | ||||
|                         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); | ||||
| 
 | ||||
|  |  | |||
|  | @ -7,6 +7,8 @@ | |||
| #include <components/interpreter/runtime.hpp> | ||||
| #include <components/interpreter/opcodes.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/player.hpp" | ||||
| 
 | ||||
| #include "interpretercontext.hpp" | ||||
|  | @ -46,7 +48,7 @@ namespace MWScript | |||
|                     InterpreterContext& context | ||||
|                         = static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     bool enabled = context.getWorld().toggleCollisionMode(); | ||||
|                     bool enabled = MWBase::Environment::get().getWorld()->toggleCollisionMode(); | ||||
| 
 | ||||
|                     context.report (enabled ? "Collision -> On" : "Collision -> Off"); | ||||
|                 } | ||||
|  |  | |||
|  | @ -23,16 +23,13 @@ namespace MWScript | |||
| 
 | ||||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     MWScript::InterpreterContext& context | ||||
|                         = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     std::string quest = runtime.getStringLiteral (runtime[0].mInteger); | ||||
|                     runtime.pop(); | ||||
| 
 | ||||
|                     Interpreter::Type_Integer index = runtime[0].mInteger; | ||||
|                     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) | ||||
|                 { | ||||
|                     MWScript::InterpreterContext& context | ||||
|                         = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     std::string quest = runtime.getStringLiteral (runtime[0].mInteger); | ||||
|                     runtime.pop(); | ||||
| 
 | ||||
|                     Interpreter::Type_Integer index = runtime[0].mInteger; | ||||
|                     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) | ||||
|                 { | ||||
|                     MWScript::InterpreterContext& context | ||||
|                         = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     std::string quest = runtime.getStringLiteral (runtime[0].mInteger); | ||||
|                     runtime.pop(); | ||||
| 
 | ||||
|                     int index = context.getEnvironment().mJournal->getJournalIndex (quest); | ||||
|                     int index = MWBase::Environment::get().getJournal()->getJournalIndex (quest); | ||||
| 
 | ||||
|                     runtime.push (index); | ||||
| 
 | ||||
|  | @ -80,13 +71,10 @@ namespace MWScript | |||
| 
 | ||||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     MWScript::InterpreterContext& context | ||||
|                         = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     std::string topic = runtime.getStringLiteral (runtime[0].mInteger); | ||||
|                     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) | ||||
|                 { | ||||
|                     MWScript::InterpreterContext& context | ||||
|                         = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); | ||||
|                     MWDialogue::DialogueManager* dialogue = context.getEnvironment().mDialogueManager; | ||||
|                     MWDialogue::DialogueManager* dialogue = MWBase::Environment::get().getDialogueManager(); | ||||
|                     while(arg0>0) | ||||
|                     { | ||||
|                         std::string question = runtime.getStringLiteral (runtime[0].mInteger); | ||||
|  | @ -124,9 +110,8 @@ namespace MWScript | |||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     MWWorld::Ptr ptr = R()(runtime); | ||||
|                     MWScript::InterpreterContext& context | ||||
|                         = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); | ||||
|                     context.getEnvironment().mDialogueManager->startDialogue (ptr); | ||||
| 
 | ||||
|                     MWBase::Environment::get().getDialogueManager()->startDialogue (ptr); | ||||
|                 } | ||||
|         }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -12,9 +12,9 @@ namespace MWScript | |||
|     : mStore (store), mScriptManager (scriptManager) | ||||
|     { | ||||
|         addScript ("Main"); | ||||
|          | ||||
|         for (ESMS::RecListT<ESM::StartScript>::MapType::const_iterator iter  | ||||
|             (store.startScripts.list.begin());  | ||||
| 
 | ||||
|         for (ESMS::RecListT<ESM::StartScript>::MapType::const_iterator iter | ||||
|             (store.startScripts.list.begin()); | ||||
|             iter != store.startScripts.list.end(); ++iter) | ||||
|             addScript (iter->second.script); | ||||
|     } | ||||
|  | @ -23,15 +23,15 @@ namespace MWScript | |||
|     { | ||||
|         if (mScripts.find (name)==mScripts.end()) | ||||
|             if (const ESM::Script *script = mStore.scripts.find (name)) | ||||
|             {            | ||||
|             { | ||||
|                 Locals locals; | ||||
|                  | ||||
| 
 | ||||
|                 locals.configure (*script); | ||||
| 
 | ||||
|                 mScripts.insert (std::make_pair (name, std::make_pair (true, locals)));  | ||||
|                 mScripts.insert (std::make_pair (name, std::make_pair (true, locals))); | ||||
|             } | ||||
|     } | ||||
|      | ||||
| 
 | ||||
|     void GlobalScripts::removeScript (const std::string& name) | ||||
|     { | ||||
|         std::map<std::string, std::pair<bool, Locals> >::iterator iter = mScripts.find (name); | ||||
|  | @ -39,31 +39,30 @@ namespace MWScript | |||
|         if (iter!=mScripts.end()) | ||||
|             iter->second.first = false; | ||||
|     } | ||||
|          | ||||
| 
 | ||||
|     bool GlobalScripts::isRunning (const std::string& name) const | ||||
|     { | ||||
|         std::map<std::string, std::pair<bool, Locals> >::const_iterator iter = | ||||
|             mScripts.find (name); | ||||
|              | ||||
| 
 | ||||
|         if (iter==mScripts.end()) | ||||
|             return false; | ||||
|              | ||||
| 
 | ||||
|         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()); | ||||
|             iter!=mScripts.end(); ++iter) | ||||
|         { | ||||
|             if (iter->second.first) | ||||
|             { | ||||
|                 MWScript::InterpreterContext interpreterContext (environment, | ||||
|                 MWScript::InterpreterContext interpreterContext ( | ||||
|                     &iter->second.second, MWWorld::Ptr()); | ||||
|                 mScriptManager.run (iter->first, interpreterContext);         | ||||
|                 mScriptManager.run (iter->first, interpreterContext); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -11,11 +11,6 @@ namespace ESMS | |||
|     struct ESMStore; | ||||
| } | ||||
| 
 | ||||
| namespace MWWorld | ||||
| { | ||||
|     class Environment; | ||||
| } | ||||
| 
 | ||||
| namespace MWScript | ||||
| { | ||||
|     class ScriptManager; | ||||
|  | @ -25,21 +20,20 @@ namespace MWScript | |||
|             const ESMS::ESMStore& mStore; | ||||
|             ScriptManager& mScriptManager; | ||||
|             std::map<std::string, std::pair<bool, Locals> > mScripts; // running, local variables
 | ||||
|              | ||||
| 
 | ||||
|         public: | ||||
|          | ||||
| 
 | ||||
|             GlobalScripts (const ESMS::ESMStore& store, ScriptManager& scriptManager); | ||||
|      | ||||
| 
 | ||||
|             void addScript (const std::string& name); | ||||
|              | ||||
| 
 | ||||
|             void removeScript (const std::string& name); | ||||
|              | ||||
| 
 | ||||
|             bool isRunning (const std::string& name) const; | ||||
|              | ||||
|             void run (MWWorld::Environment& environment); | ||||
| 
 | ||||
|             void run(); | ||||
|             ///< run all active global scripts
 | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
| 
 | ||||
|  |  | |||
|  | @ -7,6 +7,8 @@ | |||
| #include <components/interpreter/runtime.hpp> | ||||
| #include <components/interpreter/opcodes.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwgui/window_manager.hpp" | ||||
| #include "../mwinput/inputmanager.hpp" | ||||
| 
 | ||||
|  | @ -26,10 +28,7 @@ namespace MWScript | |||
| 
 | ||||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     InterpreterContext& context = | ||||
|                         static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     context.getWindowManager().allow (mWindow); | ||||
|                     MWBase::Environment::get().getWindowManager()->allow (mWindow); | ||||
|                 } | ||||
|         }; | ||||
| 
 | ||||
|  | @ -45,10 +44,7 @@ namespace MWScript | |||
| 
 | ||||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     InterpreterContext& context = | ||||
|                         static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     context.getInputManager().setGuiMode(mDialogue); | ||||
|                     MWBase::Environment::get().getInputManager()->setGuiMode(mDialogue); | ||||
|                 } | ||||
|         }; | ||||
| 
 | ||||
|  | @ -63,7 +59,7 @@ namespace MWScript | |||
| 
 | ||||
|                     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) | ||||
|                 { | ||||
|                     InterpreterContext& context = | ||||
|                         static_cast<InterpreterContext&> (runtime.getContext()); | ||||
|                      | ||||
|                     context.getEnvironment().mWindowManager->toggleFogOfWar(); | ||||
|                     MWBase::Environment::get().getWindowManager()->toggleFogOfWar(); | ||||
|                 } | ||||
|         }; | ||||
| 
 | ||||
|  | @ -86,10 +79,7 @@ namespace MWScript | |||
| 
 | ||||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     InterpreterContext& context = | ||||
|                         static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     context.getEnvironment().mWindowManager->toggleFullHelp(); | ||||
|                     MWBase::Environment::get().getWindowManager()->toggleFullHelp(); | ||||
|                 } | ||||
|         }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -7,6 +7,8 @@ | |||
| 
 | ||||
| #include <components/interpreter/types.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/world.hpp" | ||||
| 
 | ||||
| #include "../mwgui/window_manager.hpp" | ||||
|  | @ -15,6 +17,7 @@ | |||
| 
 | ||||
| #include "locals.hpp" | ||||
| #include "globalscripts.hpp" | ||||
| #include "scriptmanager.hpp" | ||||
| 
 | ||||
| namespace MWScript | ||||
| { | ||||
|  | @ -23,7 +26,7 @@ namespace MWScript | |||
|     { | ||||
|         if (!id.empty()) | ||||
|         { | ||||
|             return mEnvironment.mWorld->getPtr (id, activeOnly); | ||||
|             return MWBase::Environment::get().getWorld()->getPtr (id, activeOnly); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|  | @ -39,7 +42,7 @@ namespace MWScript | |||
|     { | ||||
|         if (!id.empty()) | ||||
|         { | ||||
|             return mEnvironment.mWorld->getPtr (id, activeOnly); | ||||
|             return MWBase::Environment::get().getWorld()->getPtr (id, activeOnly); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|  | @ -50,9 +53,9 @@ namespace MWScript | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     InterpreterContext::InterpreterContext (MWWorld::Environment& environment, | ||||
|     InterpreterContext::InterpreterContext ( | ||||
|         MWScript::Locals *locals, MWWorld::Ptr reference) | ||||
|     : mEnvironment (environment), mLocals (locals), mReference (reference), | ||||
|     : mLocals (locals), mReference (reference), | ||||
|       mActivationHandled (false) | ||||
|     {} | ||||
| 
 | ||||
|  | @ -107,7 +110,7 @@ namespace MWScript | |||
|     void InterpreterContext::messageBox (const std::string& message, | ||||
|         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) | ||||
|  | @ -117,74 +120,74 @@ namespace MWScript | |||
| 
 | ||||
|     bool InterpreterContext::menuMode() | ||||
|     { | ||||
|         return mEnvironment.mWindowManager->isGuiMode(); | ||||
|         return MWBase::Environment::get().getWindowManager()->isGuiMode(); | ||||
|     } | ||||
| 
 | ||||
|     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 | ||||
|     { | ||||
|         // 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 | ||||
|     { | ||||
|         return mEnvironment.mWorld->getGlobalVariable (name).mFloat; | ||||
|         return MWBase::Environment::get().getWorld()->getGlobalVariable (name).mFloat; | ||||
|     } | ||||
| 
 | ||||
|     void InterpreterContext::setGlobalShort (const std::string& name, int value) | ||||
|     { | ||||
|         if (name=="gamehour") | ||||
|             mEnvironment.mWorld->setHour (value); | ||||
|             MWBase::Environment::get().getWorld()->setHour (value); | ||||
|         else if (name=="day") | ||||
|             mEnvironment.mWorld->setDay (value); | ||||
|             MWBase::Environment::get().getWorld()->setDay (value); | ||||
|         else if (name=="month") | ||||
|             mEnvironment.mWorld->setMonth (value); | ||||
|             MWBase::Environment::get().getWorld()->setMonth (value); | ||||
|         else | ||||
|             mEnvironment.mWorld->getGlobalVariable (name).mShort = value; | ||||
|             MWBase::Environment::get().getWorld()->getGlobalVariable (name).mShort = value; | ||||
|     } | ||||
| 
 | ||||
|     void InterpreterContext::setGlobalLong (const std::string& name, int value) | ||||
|     { | ||||
|         if (name=="gamehour") | ||||
|             mEnvironment.mWorld->setHour (value); | ||||
|             MWBase::Environment::get().getWorld()->setHour (value); | ||||
|         else if (name=="day") | ||||
|             mEnvironment.mWorld->setDay (value); | ||||
|             MWBase::Environment::get().getWorld()->setDay (value); | ||||
|         else if (name=="month") | ||||
|             mEnvironment.mWorld->setMonth (value); | ||||
|             MWBase::Environment::get().getWorld()->setMonth (value); | ||||
|         else | ||||
|             mEnvironment.mWorld->getGlobalVariable (name).mLong = value; | ||||
|             MWBase::Environment::get().getWorld()->getGlobalVariable (name).mLong = value; | ||||
|     } | ||||
| 
 | ||||
|     void InterpreterContext::setGlobalFloat (const std::string& name, float value) | ||||
|     { | ||||
|         if (name=="gamehour") | ||||
|             mEnvironment.mWorld->setHour (value); | ||||
|             MWBase::Environment::get().getWorld()->setHour (value); | ||||
|         else if (name=="day") | ||||
|             mEnvironment.mWorld->setDay (value); | ||||
|             MWBase::Environment::get().getWorld()->setDay (value); | ||||
|         else if (name=="month") | ||||
|             mEnvironment.mWorld->setMonth (value); | ||||
|             MWBase::Environment::get().getWorld()->setMonth (value); | ||||
|         else | ||||
|             mEnvironment.mWorld->getGlobalVariable (name).mFloat = value; | ||||
|             MWBase::Environment::get().getWorld()->getGlobalVariable (name).mFloat = value; | ||||
|     } | ||||
| 
 | ||||
|     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) | ||||
|     { | ||||
|         mEnvironment.mGlobalScripts->addScript (name); | ||||
|         MWBase::Environment::get().getScriptManager()->getGlobalScripts().addScript (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 | ||||
|  | @ -192,7 +195,7 @@ namespace MWScript | |||
|         // TODO handle exterior cells (when ref and ref2 are located in different cells)
 | ||||
|         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]; | ||||
| 
 | ||||
|  | @ -233,7 +236,7 @@ namespace MWScript | |||
|         if (!mAction.get()) | ||||
|             throw std::runtime_error ("activation failed, because no action to perform"); | ||||
| 
 | ||||
|         mAction->execute (mEnvironment); | ||||
|         mAction->execute(); | ||||
|         mActivationHandled = true; | ||||
|     } | ||||
| 
 | ||||
|  | @ -246,7 +249,7 @@ namespace MWScript | |||
| 
 | ||||
|     float InterpreterContext::getSecondsPassed() const | ||||
|     { | ||||
|         return mEnvironment.mFrameDuration; | ||||
|         return MWBase::Environment::get().getFrameDuration(); | ||||
|     } | ||||
| 
 | ||||
|     bool InterpreterContext::isDisabled (const std::string& id) const | ||||
|  | @ -258,38 +261,13 @@ namespace MWScript | |||
|     void InterpreterContext::enable (const std::string& id) | ||||
|     { | ||||
|         MWWorld::Ptr ref = getReference (id, false); | ||||
|         mEnvironment.mWorld->enable (ref); | ||||
|         MWBase::Environment::get().getWorld()->enable (ref); | ||||
|     } | ||||
| 
 | ||||
|     void InterpreterContext::disable (const std::string& id) | ||||
|     { | ||||
|         MWWorld::Ptr ref = getReference (id, false); | ||||
|         mEnvironment.mWorld->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; | ||||
|         MWBase::Environment::get().getWorld()->disable (ref); | ||||
|     } | ||||
| 
 | ||||
|     MWWorld::Ptr InterpreterContext::getReference() | ||||
|  |  | |||
|  | @ -6,7 +6,6 @@ | |||
| #include <components/interpreter/context.hpp> | ||||
| 
 | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwworld/world.hpp" | ||||
| #include "../mwworld/action.hpp" | ||||
| 
 | ||||
|  | @ -26,7 +25,6 @@ namespace MWScript | |||
| 
 | ||||
|     class InterpreterContext : public Interpreter::Context | ||||
|     { | ||||
|             MWWorld::Environment& mEnvironment; | ||||
|             Locals *mLocals; | ||||
|             MWWorld::Ptr mReference; | ||||
| 
 | ||||
|  | @ -40,8 +38,7 @@ namespace MWScript | |||
| 
 | ||||
|         public: | ||||
| 
 | ||||
|             InterpreterContext (MWWorld::Environment& environment, | ||||
|                 MWScript::Locals *locals, MWWorld::Ptr reference); | ||||
|             InterpreterContext (MWScript::Locals *locals, MWWorld::Ptr reference); | ||||
|             ///< The ownership of \a locals is not transferred. 0-pointer allowed.
 | ||||
| 
 | ||||
|             virtual int getLocalShort (int index) const; | ||||
|  | @ -110,18 +107,6 @@ namespace MWScript | |||
| 
 | ||||
|             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(); | ||||
|             ///< Reference, that the script is running from (can be empty)
 | ||||
|     }; | ||||
|  |  | |||
|  | @ -7,6 +7,8 @@ | |||
| #include <components/interpreter/runtime.hpp> | ||||
| #include <components/interpreter/opcodes.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/class.hpp" | ||||
| 
 | ||||
| #include "interpretercontext.hpp" | ||||
|  | @ -100,7 +102,7 @@ namespace MWScript | |||
|                         static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     bool enabled = | ||||
|                         context.getWorld().toggleRenderMode (MWWorld::World::Render_CollisionDebug); | ||||
|                         MWBase::Environment::get().getWorld()->toggleRenderMode (MWWorld::World::Render_CollisionDebug); | ||||
| 
 | ||||
|                     context.report (enabled ? | ||||
|                         "Collision Mesh Rendering -> On" : "Collision Mesh Rendering -> Off"); | ||||
|  | @ -117,7 +119,7 @@ namespace MWScript | |||
|                         static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     bool enabled = | ||||
|                         context.getWorld().toggleRenderMode (MWWorld::World::Render_Wireframe); | ||||
|                         MWBase::Environment::get().getWorld()->toggleRenderMode (MWWorld::World::Render_Wireframe); | ||||
| 
 | ||||
|                     context.report (enabled ? | ||||
|                         "Wireframe Rendering -> On" : "Wireframe Rendering -> Off"); | ||||
|  | @ -133,7 +135,7 @@ namespace MWScript | |||
|                     static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                 bool enabled = | ||||
|                     context.getWorld().toggleRenderMode (MWWorld::World::Render_Pathgrid); | ||||
|                     MWBase::Environment::get().getWorld()->toggleRenderMode (MWWorld::World::Render_Pathgrid); | ||||
| 
 | ||||
|                 context.report (enabled ? | ||||
|                     "Path Grid rendering -> On" : "Path Grid Rendering -> Off"); | ||||
|  | @ -146,13 +148,10 @@ namespace MWScript | |||
| 
 | ||||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     InterpreterContext& context = | ||||
|                         static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     Interpreter::Type_Float time = runtime[0].mFloat; | ||||
|                     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) | ||||
|                 { | ||||
|                     InterpreterContext& context = | ||||
|                         static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     Interpreter::Type_Float time = runtime[0].mFloat; | ||||
|                     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) | ||||
|                 { | ||||
|                     InterpreterContext& context = | ||||
|                         static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     Interpreter::Type_Float alpha = runtime[0].mFloat; | ||||
|                     runtime.pop(); | ||||
| 
 | ||||
|                     Interpreter::Type_Float time = runtime[0].mFloat; | ||||
|                     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) | ||||
|                 { | ||||
|                     InterpreterContext& context = | ||||
|                         static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     context.getWorld().toggleWater(); | ||||
|                     MWBase::Environment::get().getWorld()->toggleWater(); | ||||
|                 } | ||||
|         }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -5,6 +5,8 @@ | |||
| 
 | ||||
| #include <components/interpreter/runtime.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/world.hpp" | ||||
| 
 | ||||
|  | @ -16,13 +18,10 @@ namespace MWScript | |||
|     { | ||||
|         MWWorld::Ptr operator() (Interpreter::Runtime& runtime) const | ||||
|         { | ||||
|             MWScript::InterpreterContext& context | ||||
|                 = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|             std::string id = runtime.getStringLiteral (runtime[0].mInteger); | ||||
|             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) | ||||
|     : mErrorHandler (std::cerr), mStore (store), mVerbose (verbose), | ||||
|       mCompilerContext (compilerContext), mParser (mErrorHandler, mCompilerContext), | ||||
|       mOpcodesInstalled (false) | ||||
|       mOpcodesInstalled (false), mGlobalScripts (store, *this) | ||||
|     {} | ||||
| 
 | ||||
|     bool ScriptManager::compile (const std::string& name) | ||||
|  | @ -151,4 +151,9 @@ namespace MWScript | |||
| 
 | ||||
|         return iter->second.second; | ||||
|     } | ||||
| 
 | ||||
|     GlobalScripts& ScriptManager::getGlobalScripts() | ||||
|     { | ||||
|         return mGlobalScripts; | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -11,6 +11,8 @@ | |||
| #include <components/interpreter/interpreter.hpp> | ||||
| #include <components/interpreter/types.hpp> | ||||
| 
 | ||||
| #include "globalscripts.hpp" | ||||
| 
 | ||||
| namespace ESMS | ||||
| { | ||||
|     struct ESMStore; | ||||
|  | @ -42,8 +44,8 @@ namespace MWScript | |||
|             typedef std::pair<std::vector<Interpreter::Type_Code>, Compiler::Locals> CompiledScript; | ||||
|             typedef std::map<std::string, CompiledScript> ScriptCollection; | ||||
| 
 | ||||
| 
 | ||||
|             ScriptCollection mScripts; | ||||
|             GlobalScripts mGlobalScripts; | ||||
| 
 | ||||
|         public: | ||||
| 
 | ||||
|  | @ -63,6 +65,8 @@ namespace MWScript | |||
| 
 | ||||
|             Compiler::Locals& getLocals (const std::string& name); | ||||
|             ///< Return locals for script \a name.
 | ||||
| 
 | ||||
|             GlobalScripts& getGlobalScripts(); | ||||
|     }; | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -7,6 +7,8 @@ | |||
| #include <components/interpreter/runtime.hpp> | ||||
| #include <components/interpreter/opcodes.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "interpretercontext.hpp" | ||||
| 
 | ||||
| namespace MWScript | ||||
|  | @ -19,11 +21,11 @@ namespace MWScript | |||
| 
 | ||||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     bool enabled = MWBase::Environment::get().getWorld()->toggleSky(); | ||||
| 
 | ||||
|                     InterpreterContext& context = | ||||
|                         static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     bool enabled = context.getWorld().toggleSky(); | ||||
| 
 | ||||
|                     context.report (enabled ? "Sky -> On" : "Sky -> Off"); | ||||
|                 } | ||||
|         }; | ||||
|  | @ -34,10 +36,7 @@ namespace MWScript | |||
| 
 | ||||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     InterpreterContext& context = | ||||
|                         static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     context.getWorld().setMoonColour (false); | ||||
|                     MWBase::Environment::get().getWorld()->setMoonColour (false); | ||||
|                 } | ||||
|         }; | ||||
| 
 | ||||
|  | @ -47,10 +46,7 @@ namespace MWScript | |||
| 
 | ||||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     InterpreterContext& context = | ||||
|                         static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     context.getWorld().setMoonColour (true); | ||||
|                     MWBase::Environment::get().getWorld()->setMoonColour (true); | ||||
|                 } | ||||
|         }; | ||||
| 
 | ||||
|  | @ -60,10 +56,7 @@ namespace MWScript | |||
| 
 | ||||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     InterpreterContext& context = | ||||
|                         static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     runtime.push (context.getWorld().getMasserPhase()); | ||||
|                     runtime.push (MWBase::Environment::get().getWorld()->getMasserPhase()); | ||||
|                 } | ||||
|         }; | ||||
| 
 | ||||
|  | @ -73,42 +66,33 @@ namespace MWScript | |||
| 
 | ||||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     InterpreterContext& context = | ||||
|                         static_cast<InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     runtime.push (context.getWorld().getSecundaPhase()); | ||||
|                     runtime.push (MWBase::Environment::get().getWorld()->getSecundaPhase()); | ||||
|                 } | ||||
|         }; | ||||
|          | ||||
| 
 | ||||
|         class OpGetCurrentWeather : public Interpreter::Opcode0 | ||||
|         { | ||||
|             public: | ||||
|                  | ||||
| 
 | ||||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     InterpreterContext& context = | ||||
|                         static_cast<InterpreterContext&> (runtime.getContext()); | ||||
|                      | ||||
|                     runtime.push (context.getWorld().getCurrentWeather()); | ||||
|                     runtime.push (MWBase::Environment::get().getWorld()->getCurrentWeather()); | ||||
|                 } | ||||
|         }; | ||||
|          | ||||
| 
 | ||||
|         class OpChangeWeather : public Interpreter::Opcode0 | ||||
|         { | ||||
|             public: | ||||
|              | ||||
| 
 | ||||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     InterpreterContext& context = | ||||
|                         static_cast<InterpreterContext&> (runtime.getContext()); | ||||
|                      | ||||
|                     std::string region = runtime.getStringLiteral (runtime[0].mInteger); | ||||
|                     runtime.pop(); | ||||
|                      | ||||
| 
 | ||||
|                     Interpreter::Type_Integer id = runtime[0].mInteger; | ||||
|                     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/opcodes.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/world.hpp" | ||||
| 
 | ||||
| #include "../mwsound/soundmanager.hpp" | ||||
|  | @ -36,7 +38,7 @@ namespace MWScript | |||
|                     std::string text = runtime.getStringLiteral (runtime[0].mInteger); | ||||
|                     runtime.pop(); | ||||
| 
 | ||||
|                     context.getSoundManager().say (ptr, file); | ||||
|                     MWBase::Environment::get().getSoundManager()->say (ptr, file); | ||||
|                     context.messageBox (text); | ||||
|                 } | ||||
|         }; | ||||
|  | @ -50,10 +52,7 @@ namespace MWScript | |||
|                 { | ||||
|                     MWWorld::Ptr ptr = R()(runtime); | ||||
| 
 | ||||
|                     MWScript::InterpreterContext& context | ||||
|                         = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     runtime.push (context.getSoundManager().sayDone (ptr)); | ||||
|                     runtime.push (MWBase::Environment::get().getSoundManager()->sayDone (ptr)); | ||||
|                 } | ||||
|         }; | ||||
| 
 | ||||
|  | @ -63,13 +62,10 @@ namespace MWScript | |||
| 
 | ||||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     MWScript::InterpreterContext& context | ||||
|                         = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     std::string sound = runtime.getStringLiteral (runtime[0].mInteger); | ||||
|                     runtime.pop(); | ||||
| 
 | ||||
|                     context.getSoundManager().streamMusic (sound); | ||||
|                     MWBase::Environment::get().getSoundManager()->streamMusic (sound); | ||||
|                 } | ||||
|         }; | ||||
| 
 | ||||
|  | @ -79,13 +75,10 @@ namespace MWScript | |||
| 
 | ||||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     MWScript::InterpreterContext& context | ||||
|                         = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     std::string sound = runtime.getStringLiteral (runtime[0].mInteger); | ||||
|                     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) | ||||
|                 { | ||||
|                     MWScript::InterpreterContext& context | ||||
|                         = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     std::string sound = runtime.getStringLiteral (runtime[0].mInteger); | ||||
|                     runtime.pop(); | ||||
| 
 | ||||
|  | @ -107,7 +97,7 @@ namespace MWScript | |||
|                     Interpreter::Type_Float pitch = runtime[0].mFloat; | ||||
|                     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); | ||||
| 
 | ||||
|                     MWScript::InterpreterContext& context | ||||
|                         = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     std::string sound = runtime.getStringLiteral (runtime[0].mInteger); | ||||
|                     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); | ||||
| 
 | ||||
|                     MWScript::InterpreterContext& context | ||||
|                         = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     std::string sound = runtime.getStringLiteral (runtime[0].mInteger); | ||||
|                     runtime.pop(); | ||||
| 
 | ||||
|  | @ -159,7 +143,7 @@ namespace MWScript | |||
|                     Interpreter::Type_Float pitch = runtime[0].mFloat; | ||||
|                     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); | ||||
| 
 | ||||
|                     MWScript::InterpreterContext& context | ||||
|                         = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     std::string sound = runtime.getStringLiteral (runtime[0].mInteger); | ||||
|                     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); | ||||
| 
 | ||||
|                     MWScript::InterpreterContext& context | ||||
|                         = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     int index = runtime[0].mInteger; | ||||
|                     runtime.pop(); | ||||
| 
 | ||||
|                     runtime.push (context.getSoundManager().getSoundPlaying ( | ||||
|                     runtime.push (MWBase::Environment::get().getSoundManager()->getSoundPlaying ( | ||||
|                         ptr, runtime.getStringLiteral (index))); | ||||
|                 } | ||||
|         }; | ||||
|  |  | |||
|  | @ -7,8 +7,9 @@ | |||
| #include <components/interpreter/runtime.hpp> | ||||
| #include <components/interpreter/opcodes.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/class.hpp" | ||||
| #include "../mwworld/environment.hpp" | ||||
| #include "../mwworld/player.hpp" | ||||
| 
 | ||||
| #include "../mwmechanics/creaturestats.hpp" | ||||
|  | @ -351,11 +352,10 @@ namespace MWScript | |||
|                 virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) | ||||
|                 { | ||||
|                     std::string factionID = ""; | ||||
|                     MWScript::InterpreterContext& context | ||||
|                         = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     if(arg0==0) | ||||
|                     { | ||||
|                         factionID = context.getEnvironment().mDialogueManager->getFaction(); | ||||
|                         factionID = MWBase::Environment::get().getDialogueManager()->getFaction(); | ||||
|                     } | ||||
|                     else | ||||
|                     { | ||||
|  | @ -364,7 +364,7 @@ namespace MWScript | |||
|                     } | ||||
|                     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()) | ||||
|                         { | ||||
|                             MWWorld::Class::get(player).getNpcStats(player).mFactionRank[factionID] = 0; | ||||
|  | @ -380,11 +380,10 @@ namespace MWScript | |||
|                 virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) | ||||
|                 { | ||||
|                     std::string factionID = ""; | ||||
|                     MWScript::InterpreterContext& context | ||||
|                         = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     if(arg0==0) | ||||
|                     { | ||||
|                         factionID = context.getEnvironment().mDialogueManager->getFaction(); | ||||
|                         factionID = MWBase::Environment::get().getDialogueManager()->getFaction(); | ||||
|                     } | ||||
|                     else | ||||
|                     { | ||||
|  | @ -393,7 +392,7 @@ namespace MWScript | |||
|                     } | ||||
|                     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()) | ||||
|                         { | ||||
|                             MWWorld::Class::get(player).getNpcStats(player).mFactionRank[factionID] = 0; | ||||
|  | @ -413,11 +412,10 @@ namespace MWScript | |||
|                 virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) | ||||
|                 { | ||||
|                     std::string factionID = ""; | ||||
|                     MWScript::InterpreterContext& context | ||||
|                         = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); | ||||
| 
 | ||||
|                     if(arg0==0) | ||||
|                     { | ||||
|                         factionID = context.getEnvironment().mDialogueManager->getFaction(); | ||||
|                         factionID = MWBase::Environment::get().getDialogueManager()->getFaction(); | ||||
|                     } | ||||
|                     else | ||||
|                     { | ||||
|  | @ -426,7 +424,7 @@ namespace MWScript | |||
|                     } | ||||
|                     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()) | ||||
|                         { | ||||
|                             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; | ||||
|                         } | ||||
|                     } | ||||
|                     MWScript::InterpreterContext& context | ||||
|                         = static_cast<MWScript::InterpreterContext&> (runtime.getContext()); | ||||
|                     MWWorld::Ptr player = context.getEnvironment().mWorld->getPlayer().getPlayer(); | ||||
|                     MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); | ||||
|                     if(factionID!="") | ||||
|                     { | ||||
|                         if(MWWorld::Class::get(player).getNpcStats(player).mFactionRank.find(factionID) != MWWorld::Class::get(player).getNpcStats(player).mFactionRank.end()) | ||||
|  | @ -481,7 +477,7 @@ namespace MWScript | |||
|                     } | ||||
|                 } | ||||
|         }; | ||||
|          | ||||
| 
 | ||||
|         template<class R> | ||||
|         class OpModDisposition : public Interpreter::Opcode0 | ||||
|         { | ||||
|  |  | |||
Some files were not shown because too many files have changed in this diff Show more
		Loading…
	
		Reference in a new issue