From 4762b33ac0b2c513083529f09afe314ad9e2d335 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 10 Mar 2016 12:08:48 +0100 Subject: [PATCH] Fix thunder update --HG-- branch : develop --- code/ryzom/client/src/main_loop_debug.cpp | 3 ++ .../client/src/weather_manager_client.cpp | 30 ++++++++++++------- .../ryzom/client/src/weather_manager_client.h | 2 ++ 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/code/ryzom/client/src/main_loop_debug.cpp b/code/ryzom/client/src/main_loop_debug.cpp index cc19ab478..5d2dcf9ac 100644 --- a/code/ryzom/client/src/main_loop_debug.cpp +++ b/code/ryzom/client/src/main_loop_debug.cpp @@ -430,6 +430,9 @@ void displayDebug() TextContext->printfAt(1.f, line, "TEST WEATHER FUNCTION"); line += lineStep; } + // thunder + TextContext->printfAt(1.f, line, "Thunder level : %.02f", WeatherManager.getThunderLevel()); + line += lineStep; // season TextContext->printfAt(1.f, line, "Season : %s", EGSPD::CSeason::toString(CurrSeason).c_str()); line += lineStep; diff --git a/code/ryzom/client/src/weather_manager_client.cpp b/code/ryzom/client/src/weather_manager_client.cpp index 6bff68b49..96f7bebf7 100644 --- a/code/ryzom/client/src/weather_manager_client.cpp +++ b/code/ryzom/client/src/weather_manager_client.cpp @@ -132,7 +132,7 @@ void CWeatherManagerClient::update(uint64 day, float hour, const CWeatherContext // build current weather state EGSPD::CSeason::TSeason season = CRyzomTime::getSeasonByDay((uint32)day); // - manualUpdate(day, hour, wc, weatherValue, season); + manualUpdateImpl(day, hour, wc, weatherValue, season); _LastEvalHour = hour; _LastEvalDay = day; } @@ -147,25 +147,29 @@ void CWeatherManagerClient::update(uint64 day, float hour, const CWeatherContext // build current weather state 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; _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) +{ + 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) if (!wc.WF) return; - manualUpdate(day, hour, wc, weatherValue, season); + manualUpdateImpl(day, hour, wc, weatherValue, season); setupFXs(camMat, wc.GR, continent); setupWind(&(wc.WF[season])); float scaledWeatherValue = weatherValue * (wc.WF[season].getNumWeatherSetups() - 1); updateThunder(day, hour, wc, true, scaledWeatherValue, season); - _LastEvalHour = hour; - _LastEvalDay = day; // Sound stuff 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) +{ + 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) if (!wc.WF) return; @@ -269,11 +280,8 @@ void CWeatherManagerClient::manualUpdate(uint64 day, float hour, const CWeatherC // blend client specific part CWeatherStateClient::blend(_CurrWeatherStateClient, safe_cast(floorSetup)->WeatherStateClient, safe_cast(ceilSetup)->WeatherStateClient, blendFactor); } - _LastEvalHour = hour; - _LastEvalDay = day; } - //================================================================================================ void CWeatherManagerClient::setupWind(const CWeatherFunction *wf) { diff --git a/code/ryzom/client/src/weather_manager_client.h b/code/ryzom/client/src/weather_manager_client.h index 543dc2039..97388a7a4 100644 --- a/code/ryzom/client/src/weather_manager_client.h +++ b/code/ryzom/client/src/weather_manager_client.h @@ -105,6 +105,8 @@ protected: // from CWeatherManager virtual void setupLoaded(CWeatherSetup *setup); 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 TPrecipitationMap; // A vector of precipitation pointers typedef std::vector TPrecipitationVect;