1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 08:23:53 +00:00

Merge remote branch 'scrawl/weather'

This commit is contained in:
Marc Zinnschlag 2012-03-20 10:08:43 +01:00
commit ef711ffdc1

View file

@ -271,7 +271,8 @@ WeatherManager::WeatherManager(MWRender::RenderingManager* rendering, Environmen
blight.mGlareView = 0; blight.mGlareView = 0;
blight.mAmbientLoopSoundID = "blight"; blight.mAmbientLoopSoundID = "blight";
mWeatherSettings["blight"] = blight; mWeatherSettings["blight"] = blight;
/*
Weather snow; Weather snow;
snow.mCloudTexture = "tx_bm_sky_snow.dds"; snow.mCloudTexture = "tx_bm_sky_snow.dds";
snow.mCloudsMaximumPercent = 1.0; snow.mCloudsMaximumPercent = 1.0;
@ -328,6 +329,7 @@ WeatherManager::WeatherManager(MWRender::RenderingManager* rendering, Environmen
blizzard.mGlareView = 0; blizzard.mGlareView = 0;
blizzard.mAmbientLoopSoundID = "BM Blizzard"; blizzard.mAmbientLoopSoundID = "BM Blizzard";
mWeatherSettings["blizzard"] = blizzard; mWeatherSettings["blizzard"] = blizzard;
*/
} }
void WeatherManager::setWeather(const String& weather, bool instant) void WeatherManager::setWeather(const String& weather, bool instant)
@ -509,32 +511,32 @@ void WeatherManager::update(float duration)
float thunder = region->data.thunder/255.f; float thunder = region->data.thunder/255.f;
float ash = region->data.ash/255.f; float ash = region->data.ash/255.f;
float blight = region->data.blight/255.f; float blight = region->data.blight/255.f;
float snow = region->data.a/255.f; //float snow = region->data.a/255.f;
float blizzard = region->data.b/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;
srand(time(NULL)); srand(time(NULL));
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";