1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +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 else
{ {
const ESM::Region* region = MWBase::Environment::get().getWorld()->getStore().regions.search(cell->cell->region); 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 ); map->setCellName( name );

View File

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

View File

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