Fix thunder update

This commit is contained in:
kaetemi 2016-03-10 12:08:48 +01:00
parent c576897390
commit 56bbcfacd3
3 changed files with 24 additions and 11 deletions

View file

@ -430,6 +430,9 @@ void displayDebug()
TextContext->printfAt(1.f, line, "TEST WEATHER FUNCTION"); TextContext->printfAt(1.f, line, "TEST WEATHER FUNCTION");
line += lineStep; line += lineStep;
} }
// thunder
TextContext->printfAt(1.f, line, "Thunder level : %.02f", WeatherManager.getThunderLevel());
line += lineStep;
// season // season
TextContext->printfAt(1.f, line, "Season : %s", EGSPD::CSeason::toString(CurrSeason).c_str()); TextContext->printfAt(1.f, line, "Season : %s", EGSPD::CSeason::toString(CurrSeason).c_str());
line += lineStep; line += lineStep;

View file

@ -132,7 +132,7 @@ void CWeatherManagerClient::update(uint64 day, float hour, const CWeatherContext
// build current weather state // build current weather state
EGSPD::CSeason::TSeason season = CRyzomTime::getSeasonByDay((uint32)day); EGSPD::CSeason::TSeason season = CRyzomTime::getSeasonByDay((uint32)day);
// //
manualUpdate(day, hour, wc, weatherValue, season); manualUpdateImpl(day, hour, wc, weatherValue, season);
_LastEvalHour = hour; _LastEvalHour = hour;
_LastEvalDay = day; _LastEvalDay = day;
} }
@ -147,25 +147,29 @@ void CWeatherManagerClient::update(uint64 day, float hour, const CWeatherContext
// build current weather state // build current weather state
EGSPD::CSeason::TSeason season = CRyzomTime::getSeasonByDay((uint32)day); EGSPD::CSeason::TSeason season = CRyzomTime::getSeasonByDay((uint32)day);
// //
manualUpdate(day, hour, wc, weatherValue, season, camMat, continent); manualUpdateImpl(day, hour, wc, weatherValue, season, camMat, continent);
_LastEvalHour = hour; _LastEvalHour = hour;
_LastEvalDay = day; _LastEvalDay = day;
} }
//================================================================================================ //================================================================================================
void CWeatherManagerClient::manualUpdate(uint64 day, float hour, const CWeatherContext &wc, float weatherValue, EGSPD::CSeason::TSeason season, const NLMISC::CMatrix &camMat, const CContinent &continent) void CWeatherManagerClient::manualUpdate(uint64 day, float hour, const CWeatherContext &wc, float weatherValue, EGSPD::CSeason::TSeason season, const NLMISC::CMatrix &camMat, const CContinent &continent)
{
manualUpdateImpl(day, hour, wc, weatherValue, season, camMat, continent);
_LastEvalHour = hour;
_LastEvalDay = day;
}
//================================================================================================
void CWeatherManagerClient::manualUpdateImpl(uint64 day, float hour, const CWeatherContext &wc, float weatherValue, EGSPD::CSeason::TSeason season, const NLMISC::CMatrix &camMat, const CContinent &continent)
{ {
H_AUTO_USE(RZ_WeatherManagerClient) H_AUTO_USE(RZ_WeatherManagerClient)
if (!wc.WF) return; if (!wc.WF) return;
manualUpdate(day, hour, wc, weatherValue, season); manualUpdateImpl(day, hour, wc, weatherValue, season);
setupFXs(camMat, wc.GR, continent); setupFXs(camMat, wc.GR, continent);
setupWind(&(wc.WF[season])); setupWind(&(wc.WF[season]));
float scaledWeatherValue = weatherValue * (wc.WF[season].getNumWeatherSetups() - 1); float scaledWeatherValue = weatherValue * (wc.WF[season].getNumWeatherSetups() - 1);
updateThunder(day, hour, wc, true, scaledWeatherValue, season); updateThunder(day, hour, wc, true, scaledWeatherValue, season);
_LastEvalHour = hour;
_LastEvalDay = day;
// Sound stuff // Sound stuff
if (SoundMngr != 0) if (SoundMngr != 0)
@ -250,9 +254,16 @@ void CWeatherManagerClient::manualUpdate(uint64 day, float hour, const CWeatherC
} }
} }
//================================================================================================ //================================================================================================
void CWeatherManagerClient::manualUpdate(uint64 day, float hour, const CWeatherContext &wc, float weatherValue, EGSPD::CSeason::TSeason season) void CWeatherManagerClient::manualUpdate(uint64 day, float hour, const CWeatherContext &wc, float weatherValue, EGSPD::CSeason::TSeason season)
{
manualUpdateImpl(day, hour, wc, weatherValue, season);
_LastEvalHour = hour;
_LastEvalDay = day;
}
//================================================================================================
void CWeatherManagerClient::manualUpdateImpl(uint64 day, float hour, const CWeatherContext &wc, float weatherValue, EGSPD::CSeason::TSeason season)
{ {
H_AUTO_USE(RZ_WeatherManagerClient) H_AUTO_USE(RZ_WeatherManagerClient)
if (!wc.WF) return; if (!wc.WF) return;
@ -269,11 +280,8 @@ void CWeatherManagerClient::manualUpdate(uint64 day, float hour, const CWeatherC
// blend client specific part // blend client specific part
CWeatherStateClient::blend(_CurrWeatherStateClient, safe_cast<const CWeatherSetupClient *>(floorSetup)->WeatherStateClient, safe_cast<const CWeatherSetupClient *>(ceilSetup)->WeatherStateClient, blendFactor); CWeatherStateClient::blend(_CurrWeatherStateClient, safe_cast<const CWeatherSetupClient *>(floorSetup)->WeatherStateClient, safe_cast<const CWeatherSetupClient *>(ceilSetup)->WeatherStateClient, blendFactor);
} }
_LastEvalHour = hour;
_LastEvalDay = day;
} }
//================================================================================================ //================================================================================================
void CWeatherManagerClient::setupWind(const CWeatherFunction *wf) void CWeatherManagerClient::setupWind(const CWeatherFunction *wf)
{ {

View file

@ -105,6 +105,8 @@ protected:
// from CWeatherManager // from CWeatherManager
virtual void setupLoaded(CWeatherSetup *setup); virtual void setupLoaded(CWeatherSetup *setup);
private: private:
void manualUpdateImpl(uint64 day, float hour, const CWeatherContext &wc, float weatherValue, EGSPD::CSeason::TSeason season);
void manualUpdateImpl(uint64 day, float hour, const CWeatherContext &wc, float weatherValue, EGSPD::CSeason::TSeason season, const NLMISC::CMatrix &camMat, const class CContinent &continent);
typedef std::map<std::string, CPrecipitation> TPrecipitationMap; typedef std::map<std::string, CPrecipitation> TPrecipitationMap;
// A vector of precipitation pointers // A vector of precipitation pointers
typedef std::vector<CPrecipitation *> TPrecipitationVect; typedef std::vector<CPrecipitation *> TPrecipitationVect;