mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 12:23:51 +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 "engine.hpp"
|
||||||
|
#include "components/esm/loadcell.hpp"
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
#include <components/esm_store/cell_store.hpp>
|
||||||
#include <components/misc/fileops.hpp>
|
#include <components/misc/fileops.hpp>
|
||||||
#include <components/bsa/bsa_archive.hpp>
|
#include <components/bsa/bsa_archive.hpp>
|
||||||
#include <components/esm/loadregn.hpp>
|
#include <components/esm/loadregn.hpp>
|
||||||
|
@ -107,11 +109,14 @@ bool OMW::Engine::frameStarted(const Ogre::FrameEvent& evt)
|
||||||
}
|
}
|
||||||
|
|
||||||
//If the region has changed
|
//If the region has changed
|
||||||
if(mEnvironment.mWorld->getIsExterior() && test.name != mEnvironment.mWorld->getCurrentRegion().name){
|
MWWorld::Ptr::CellStore *current = mEnvironment.mWorld->getPlayerPos().getPlayer().getCell();
|
||||||
test = mEnvironment.mWorld->getCurrentRegion();
|
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)
|
if(test.soundList.size() > 0)
|
||||||
{
|
{
|
||||||
std::vector<ESM::Region::SoundRef>::iterator soundIter = test.soundList.begin();
|
std::vector<ESM::Region::SoundRef>::iterator soundIter = test.soundList.begin();
|
||||||
|
mEnvironment.mWorld->getPlayerPos().getPlayer().getCell();
|
||||||
|
//mEnvironment.mSoundManager
|
||||||
while (!(soundIter == test.soundList.end()))
|
while (!(soundIter == test.soundList.end()))
|
||||||
{
|
{
|
||||||
ESM::NAME32 go = soundIter->sound;
|
ESM::NAME32 go = soundIter->sound;
|
||||||
|
@ -126,7 +131,7 @@ bool OMW::Engine::frameStarted(const Ogre::FrameEvent& evt)
|
||||||
//printf("REGION: %s\n", test.name);
|
//printf("REGION: %s\n", test.name);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(!mEnvironment.mWorld->getIsExterior())
|
else if(current->cell->data.flags & current->cell->Interior)
|
||||||
{
|
{
|
||||||
test.name = "";
|
test.name = "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,30 +66,7 @@ namespace
|
||||||
|
|
||||||
namespace MWWorld
|
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)
|
void World::insertInteriorScripts (ESMS::CellStore<RefData>& cell)
|
||||||
{
|
{
|
||||||
listCellScripts (mStore, cell.activators, mLocalScripts, &cell);
|
listCellScripts (mStore, cell.activators, mLocalScripts, &cell);
|
||||||
|
@ -343,7 +320,6 @@ namespace MWWorld
|
||||||
: mSkyManager (0), mScene (renderer), mPlayerPos (0), mCurrentCell (0), mGlobalVariables (0),
|
: mSkyManager (0), mScene (renderer), mPlayerPos (0), mCurrentCell (0), mGlobalVariables (0),
|
||||||
mSky (false), mCellChanged (false), mEnvironment (environment)
|
mSky (false), mCellChanged (false), mEnvironment (environment)
|
||||||
{
|
{
|
||||||
isExterior = false;
|
|
||||||
boost::filesystem::path masterPath (dataDir);
|
boost::filesystem::path masterPath (dataDir);
|
||||||
masterPath /= master;
|
masterPath /= master;
|
||||||
|
|
||||||
|
@ -634,7 +610,6 @@ namespace MWWorld
|
||||||
adjustSky();
|
adjustSky();
|
||||||
|
|
||||||
mCellChanged = true;
|
mCellChanged = true;
|
||||||
isExterior = false;
|
|
||||||
//currentRegion->name = "";
|
//currentRegion->name = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -712,11 +687,11 @@ namespace MWWorld
|
||||||
mCellChanged = true;
|
mCellChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void World::changeToExteriorCell (const ESM::Position& position)
|
void World::changeToExteriorCell (const ESM::Position& position)
|
||||||
{
|
{
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
isExterior = true;
|
|
||||||
|
|
||||||
positionToIndex (position.pos[0], position.pos[1], x, y);
|
positionToIndex (position.pos[0], position.pos[1], x, y);
|
||||||
|
|
||||||
|
@ -727,20 +702,8 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
// first try named cells
|
// first try named cells
|
||||||
if (const ESM::Cell *cell = mStore.cells.searchExtByName (cellName))
|
if (const ESM::Cell *cell = mStore.cells.searchExtByName (cellName))
|
||||||
{
|
|
||||||
//mCellChanged = true;
|
|
||||||
|
|
||||||
getExteriorRegion(cell->region);
|
|
||||||
return cell;
|
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);
|
std::string cellName2 = ESMS::RecListT<ESM::Region>::toLower (cellName);
|
||||||
|
|
||||||
|
@ -749,7 +712,6 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
if (ESMS::RecListT<ESM::Region>::toLower (iter->second.name)==cellName2)
|
if (ESMS::RecListT<ESM::Region>::toLower (iter->second.name)==cellName2)
|
||||||
{
|
{
|
||||||
*currentRegion = iter->second;
|
|
||||||
if (const ESM::Cell *cell = mStore.cells.searchExtByRegion (iter->first))
|
if (const ESM::Cell *cell = mStore.cells.searchExtByRegion (iter->first))
|
||||||
return cell;
|
return cell;
|
||||||
|
|
||||||
|
@ -759,7 +721,6 @@ namespace MWWorld
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::markCellAsUnchanged()
|
void World::markCellAsUnchanged()
|
||||||
{
|
{
|
||||||
mCellChanged = false;
|
mCellChanged = false;
|
||||||
|
|
|
@ -43,12 +43,6 @@ namespace MWWorld
|
||||||
public:
|
public:
|
||||||
typedef std::list<std::pair<std::string, Ptr> > ScriptList;
|
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:
|
private:
|
||||||
|
|
||||||
typedef std::map<Ptr::CellStore *, MWRender::CellRender *> CellRenderCollection;
|
typedef std::map<Ptr::CellStore *, MWRender::CellRender *> CellRenderCollection;
|
||||||
|
@ -67,9 +61,7 @@ namespace MWWorld
|
||||||
MWWorld::Globals *mGlobalVariables;
|
MWWorld::Globals *mGlobalVariables;
|
||||||
bool mSky;
|
bool mSky;
|
||||||
bool mCellChanged;
|
bool mCellChanged;
|
||||||
bool isExterior;
|
|
||||||
Environment& mEnvironment;
|
Environment& mEnvironment;
|
||||||
ESM::Region *currentRegion;
|
|
||||||
|
|
||||||
// not implemented
|
// not implemented
|
||||||
World (const World&);
|
World (const World&);
|
||||||
|
@ -154,7 +146,6 @@ namespace MWWorld
|
||||||
void changeToExteriorCell (const ESM::Position& position);
|
void changeToExteriorCell (const ESM::Position& position);
|
||||||
|
|
||||||
const ESM::Cell *getExterior (const std::string& cellName) const;
|
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.
|
///< Return a cell matching the given name or a 0-pointer, if there is no such cell.
|
||||||
|
|
||||||
void markCellAsUnchanged();
|
void markCellAsUnchanged();
|
||||||
|
|
Loading…
Reference in a new issue