1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 06:35:30 +00:00

Merge branch 'master' into inventoryGUI

This commit is contained in:
scrawl 2012-05-17 19:03:41 +02:00
commit 1f85475536
3 changed files with 52 additions and 42 deletions

View File

@ -482,7 +482,8 @@ void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell)
else
{
const ESM::Region* region = MWBase::Environment::get().getWorld()->getStore().regions.search(cell->cell->region);
name = region->name;
if (region)
name = region->name;
}
map->setCellName( name );

View File

@ -86,7 +86,11 @@ namespace MWWorld
}
if (!((*iter)->cell->data.flags & ESM::Cell::Interior))
mPhysics->removeHeightField( (*iter)->cell->data.gridX, (*iter)->cell->data.gridY );
{
ESM::Land* land = mWorld->getStore().lands.search((*iter)->cell->data.gridX,(*iter)->cell->data.gridY);
if (land)
mPhysics->removeHeightField( (*iter)->cell->data.gridX, (*iter)->cell->data.gridY );
}
}
mRendering.removeCell(*iter);
@ -122,9 +126,10 @@ namespace MWWorld
if (!(cell->cell->data.flags & ESM::Cell::Interior))
{
ESM::Land* land = mWorld->getStore().lands.search(cell->cell->data.gridX,cell->cell->data.gridY);
mPhysics->addHeightField (land->landData->heights,
cell->cell->data.gridX, cell->cell->data.gridY,
0, ( worldsize/(verts-1) ), verts);
if (land)
mPhysics->addHeightField (land->landData->heights,
cell->cell->data.gridX, cell->cell->data.gridY,
0, ( worldsize/(verts-1) ), verts);
}
mRendering.configureAmbient(*cell);
@ -255,6 +260,9 @@ namespace MWWorld
void Scene::changeToInteriorCell (const std::string& cellName, const ESM::Position& position)
{
std::cout << "Changing to interior\n";
Ptr::CellStore *cell = mWorld->getInterior(cellName);
// remove active
CellStoreCollection::iterator active = mActiveCells.begin();
@ -265,11 +273,9 @@ namespace MWWorld
// Load cell.
std::cout << "cellName:" << cellName << std::endl;
Ptr::CellStore *cell = mWorld->getInterior(cellName);
loadCell (cell);
// adjust player
mCurrentCell = cell;
playerCellChange (cell, position);

View File

@ -499,51 +499,54 @@ void WeatherManager::update(float duration)
mCurrentRegion = regionstr;
mWeatherUpdateTime = WeatherGlobals::mWeatherUpdateTime*3600;
std::string weather;
std::string weather = "clear";
if (mRegionOverrides.find(regionstr) != mRegionOverrides.end())
weather = mRegionOverrides[regionstr];
else
{
// get weather probabilities for the current region
const ESM::Region *region = MWBase::Environment::get().getWorld()->getStore().regions.find (regionstr);
const ESM::Region *region = MWBase::Environment::get().getWorld()->getStore().regions.search (regionstr);
float clear = region->data.clear/255.f;
float cloudy = region->data.cloudy/255.f;
float foggy = region->data.foggy/255.f;
float overcast = region->data.overcast/255.f;
float rain = region->data.rain/255.f;
float thunder = region->data.thunder/255.f;
float ash = region->data.ash/255.f;
float blight = region->data.blight/255.f;
//float snow = region->data.a/255.f;
//float blizzard = region->data.b/255.f;
if (region != 0)
{
float clear = region->data.clear/255.f;
float cloudy = region->data.cloudy/255.f;
float foggy = region->data.foggy/255.f;
float overcast = region->data.overcast/255.f;
float rain = region->data.rain/255.f;
float thunder = region->data.thunder/255.f;
float ash = region->data.ash/255.f;
float blight = region->data.blight/255.f;
//float snow = region->data.a/255.f;
//float blizzard = region->data.b/255.f;
// re-scale to 100 percent
const float total = clear+cloudy+foggy+overcast+rain+thunder+ash+blight;//+snow+blizzard;
// re-scale to 100 percent
const float total = clear+cloudy+foggy+overcast+rain+thunder+ash+blight;//+snow+blizzard;
float random = ((rand()%100)/100.f) * total;
float random = ((rand()%100)/100.f) * total;
//if (random >= snow+blight+ash+thunder+rain+overcast+foggy+cloudy+clear)
// weather = "blizzard";
//else if (random >= blight+ash+thunder+rain+overcast+foggy+cloudy+clear)
// weather = "snow";
/*else*/ if (random >= ash+thunder+rain+overcast+foggy+cloudy+clear)
weather = "blight";
else if (random >= thunder+rain+overcast+foggy+cloudy+clear)
weather = "ashstorm";
else if (random >= rain+overcast+foggy+cloudy+clear)
weather = "thunderstorm";
else if (random >= overcast+foggy+cloudy+clear)
weather = "rain";
else if (random >= foggy+cloudy+clear)
weather = "overcast";
else if (random >= cloudy+clear)
weather = "foggy";
else if (random >= clear)
weather = "cloudy";
else
weather = "clear";
//if (random >= snow+blight+ash+thunder+rain+overcast+foggy+cloudy+clear)
// weather = "blizzard";
//else if (random >= blight+ash+thunder+rain+overcast+foggy+cloudy+clear)
// weather = "snow";
/*else*/ if (random >= ash+thunder+rain+overcast+foggy+cloudy+clear)
weather = "blight";
else if (random >= thunder+rain+overcast+foggy+cloudy+clear)
weather = "ashstorm";
else if (random >= rain+overcast+foggy+cloudy+clear)
weather = "thunderstorm";
else if (random >= overcast+foggy+cloudy+clear)
weather = "rain";
else if (random >= foggy+cloudy+clear)
weather = "overcast";
else if (random >= cloudy+clear)
weather = "foggy";
else if (random >= clear)
weather = "cloudy";
else
weather = "clear";
}
}
setWeather(weather, false);