mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 16:56:42 +00:00 
			
		
		
		
	Preliminary region sound framework2
This commit is contained in:
		
							parent
							
								
									cab2341259
								
							
						
					
					
						commit
						a038c67e5a
					
				
					 3 changed files with 15 additions and 58 deletions
				
			
		|  | @ -1,10 +1,12 @@ | |||
| #include "engine.hpp" | ||||
| #include "components/esm/loadcell.hpp" | ||||
| 
 | ||||
| #include <cassert> | ||||
| 
 | ||||
| #include <iostream> | ||||
| #include <utility> | ||||
| 
 | ||||
| #include <components/esm_store/cell_store.hpp> | ||||
| #include <components/misc/fileops.hpp> | ||||
| #include <components/bsa/bsa_archive.hpp> | ||||
| #include <components/esm/loadregn.hpp> | ||||
|  | @ -107,11 +109,14 @@ bool OMW::Engine::frameStarted(const Ogre::FrameEvent& evt) | |||
| 	} | ||||
| 		     | ||||
| 	                                            //If the region has changed
 | ||||
| 	if(mEnvironment.mWorld->getIsExterior() && test.name != mEnvironment.mWorld->getCurrentRegion().name){ | ||||
| 			test = mEnvironment.mWorld->getCurrentRegion(); | ||||
| 	MWWorld::Ptr::CellStore *current = mEnvironment.mWorld->getPlayerPos().getPlayer().getCell(); | ||||
| 	if(!(current->cell->data.flags & current->cell->Interior) && (test.name != current->cell->region)){ | ||||
| 			test = *(mEnvironment.mWorld->getStore().regions.find(current->cell->region)); | ||||
| 			if(test.soundList.size() > 0) | ||||
| 			{ | ||||
| 				std::vector<ESM::Region::SoundRef>::iterator soundIter = test.soundList.begin(); | ||||
| 				mEnvironment.mWorld->getPlayerPos().getPlayer().getCell(); | ||||
| 				//mEnvironment.mSoundManager
 | ||||
| 				while (!(soundIter == test.soundList.end())) | ||||
| 				{ | ||||
| 					ESM::NAME32 go = soundIter->sound; | ||||
|  | @ -126,7 +131,7 @@ bool OMW::Engine::frameStarted(const Ogre::FrameEvent& evt) | |||
| 			//printf("REGION: %s\n", test.name);
 | ||||
| 
 | ||||
| 		} | ||||
| 	else if(!mEnvironment.mWorld->getIsExterior()) | ||||
| 	else if(current->cell->data.flags & current->cell->Interior) | ||||
| 	{ | ||||
| 		test.name = ""; | ||||
| 	} | ||||
|  |  | |||
|  | @ -66,30 +66,7 @@ namespace | |||
| 
 | ||||
| namespace MWWorld | ||||
| { | ||||
| 	ESM::ESMReader World::getEsmReader(){ | ||||
| 		return mEsm; | ||||
| 	} | ||||
| 
 | ||||
| 	Ptr::CellStore World::getMCurrentCell() | ||||
| 	{ | ||||
| 		return *mCurrentCell; | ||||
| 	} | ||||
| 
 | ||||
| 	 | ||||
| 	ESM::Region World::getCurrentRegion() | ||||
| 	{ | ||||
| 		return *currentRegion; | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| 	bool World::getIsExterior() | ||||
| 	{ | ||||
| 		return isExterior; | ||||
| 	} | ||||
| 	void World::setIsExterior(bool set) | ||||
| 	{ | ||||
| 		isExterior = set; | ||||
| 	} | ||||
|     void World::insertInteriorScripts (ESMS::CellStore<RefData>& cell) | ||||
|     { | ||||
|         listCellScripts (mStore, cell.activators, mLocalScripts, &cell); | ||||
|  | @ -343,7 +320,6 @@ namespace MWWorld | |||
|     : mSkyManager (0), mScene (renderer), mPlayerPos (0), mCurrentCell (0), mGlobalVariables (0), | ||||
|       mSky (false), mCellChanged (false), mEnvironment (environment) | ||||
|     { | ||||
| 		isExterior = false; | ||||
|         boost::filesystem::path masterPath (dataDir); | ||||
|         masterPath /= master; | ||||
| 
 | ||||
|  | @ -634,7 +610,6 @@ namespace MWWorld | |||
|         adjustSky(); | ||||
| 
 | ||||
|         mCellChanged = true; | ||||
| 		isExterior = false; | ||||
| 		//currentRegion->name = "";
 | ||||
|     } | ||||
| 
 | ||||
|  | @ -712,11 +687,11 @@ namespace MWWorld | |||
|         mCellChanged = true; | ||||
|     } | ||||
| 
 | ||||
|     void World::changeToExteriorCell (const ESM::Position& position) | ||||
| 
 | ||||
|  void World::changeToExteriorCell (const ESM::Position& position) | ||||
|     { | ||||
|         int x = 0; | ||||
|         int y = 0; | ||||
| 		isExterior = true; | ||||
| 
 | ||||
|         positionToIndex (position.pos[0], position.pos[1], x, y); | ||||
| 
 | ||||
|  | @ -727,21 +702,9 @@ namespace MWWorld | |||
|     { | ||||
|         // first try named cells
 | ||||
|         if (const ESM::Cell *cell = mStore.cells.searchExtByName (cellName)) | ||||
| 		{ | ||||
| 			//mCellChanged = true;
 | ||||
| 			 | ||||
| 			getExteriorRegion(cell->region); | ||||
|             return cell; | ||||
| 
 | ||||
| 		} | ||||
| 
 | ||||
| 
 | ||||
|         return getExteriorRegion(cellName); | ||||
|     } | ||||
| 
 | ||||
| 	const ESM::Cell *World::getExteriorRegion(const std::string& cellName) const | ||||
| 	{ | ||||
| 		// didn't work -> now check for regions
 | ||||
|         // didn't work -> now check for regions
 | ||||
|         std::string cellName2 = ESMS::RecListT<ESM::Region>::toLower (cellName); | ||||
| 
 | ||||
|         for (ESMS::RecListT<ESM::Region>::MapType::const_iterator iter (mStore.regions.list.begin()); | ||||
|  | @ -749,7 +712,6 @@ namespace MWWorld | |||
|         { | ||||
|             if (ESMS::RecListT<ESM::Region>::toLower (iter->second.name)==cellName2) | ||||
|             { | ||||
| 				*currentRegion = iter->second; | ||||
|                 if (const ESM::Cell *cell = mStore.cells.searchExtByRegion (iter->first)) | ||||
|                     return cell; | ||||
| 
 | ||||
|  | @ -757,9 +719,8 @@ namespace MWWorld | |||
|             } | ||||
|         } | ||||
| 
 | ||||
| 		return 0; | ||||
| 	} | ||||
| 
 | ||||
|         return 0; | ||||
|     } | ||||
|     void World::markCellAsUnchanged() | ||||
|     { | ||||
|         mCellChanged = false; | ||||
|  |  | |||
|  | @ -43,12 +43,6 @@ namespace MWWorld | |||
|         public: | ||||
|             typedef std::list<std::pair<std::string, Ptr> > ScriptList; | ||||
| 
 | ||||
| 			ESM::ESMReader getEsmReader();  | ||||
| 			Ptr::CellStore getMCurrentCell(); | ||||
| 			ESM::Region getCurrentRegion(); | ||||
| 			bool  getIsExterior(); | ||||
| 			void setIsExterior(bool set); | ||||
| 
 | ||||
|         private: | ||||
| 
 | ||||
|             typedef std::map<Ptr::CellStore *, MWRender::CellRender *> CellRenderCollection; | ||||
|  | @ -56,7 +50,7 @@ namespace MWWorld | |||
|             MWRender::SkyManager* mSkyManager; | ||||
|             MWRender::MWScene mScene; | ||||
|             MWRender::PlayerPos *mPlayerPos; | ||||
|             Ptr::CellStore *mCurrentCell; // the cell, the player is in
 | ||||
| 			Ptr::CellStore *mCurrentCell; // the cell, the player is in
 | ||||
|             CellRenderCollection mActiveCells; | ||||
|             CellRenderCollection mBufferedCells; // loaded, but not active (buffering not implementd yet)
 | ||||
|             ESM::ESMReader mEsm; | ||||
|  | @ -67,9 +61,7 @@ namespace MWWorld | |||
|             MWWorld::Globals *mGlobalVariables; | ||||
|             bool mSky; | ||||
|             bool mCellChanged; | ||||
| 			bool isExterior; | ||||
|             Environment& mEnvironment; | ||||
| 			ESM::Region *currentRegion; | ||||
| 
 | ||||
|             // not implemented
 | ||||
|             World (const World&); | ||||
|  | @ -104,7 +96,7 @@ namespace MWWorld | |||
| 
 | ||||
|             MWRender::PlayerPos& getPlayerPos(); | ||||
| 
 | ||||
|             ESMS::ESMStore& getStore(); | ||||
| 			ESMS::ESMStore& getStore(); | ||||
| 
 | ||||
|             const ScriptList& getLocalScripts() const; | ||||
|             ///< Names and local variable state of all local scripts in active cells.
 | ||||
|  | @ -154,7 +146,6 @@ namespace MWWorld | |||
|             void changeToExteriorCell (const ESM::Position& position); | ||||
| 
 | ||||
|             const ESM::Cell *getExterior (const std::string& cellName) const; | ||||
| 			const ESM::Cell *getExteriorRegion (const std::string& cellName) const; | ||||
|             ///< Return a cell matching the given name or a 0-pointer, if there is no such cell.
 | ||||
| 
 | ||||
|             void markCellAsUnchanged(); | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue