mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-25 16:46:17 +00:00
Changed: Add next weather tooltip to ingame map
--HG-- branch : develop
This commit is contained in:
parent
753d9efccb
commit
3752884a91
4 changed files with 24 additions and 1 deletions
|
@ -194,6 +194,7 @@
|
|||
|
||||
<view type="text" id="time" x="12" y="0" posparent="center" posref="MR ML" color="255 255 255 255" fontsize="12" shadow="true" hardtext="" />
|
||||
<view type="text" id="weather" x="8" y="-16" posref="TL TL" color="255 255 255 255" fontsize="12" shadow="true" hardtext="" />
|
||||
<ctrl type="tooltip" id="weather_tt" posparent="weather" sizeref="wh" w="0" h="0" tooltip="" tooltip_parent="ctrl" tooltip_posref="BL TL" />
|
||||
|
||||
<instance template="box_widget" id="back" posref="TL TL" sizeref="wh" w="-2" h="-32" x="1" y="-32" render_layer="0" />
|
||||
|
||||
|
|
|
@ -1504,6 +1504,15 @@ void CInterfaceManager::updateFrameEvents()
|
|||
if (pVT != NULL)
|
||||
pVT->setText(str);
|
||||
|
||||
CCtrlBase *pTooltip= dynamic_cast<CCtrlBase*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:weather_tt"));
|
||||
if (pTooltip != NULL)
|
||||
{
|
||||
ucstring tt = toString("%02d", WeatherManager.getNextWeatherHour()) + CI18N::get("uiMissionTimerHour") +
|
||||
" - " + CI18N::get("uiHumidity") + " " +
|
||||
toString("%d", (uint)(roundWeatherValue(WeatherManager.getNextWeatherValue()) * 100.f)) + "%";
|
||||
pTooltip->setDefaultContextHelp(tt);
|
||||
}
|
||||
|
||||
// The date feature is temporarily disabled
|
||||
str.clear();
|
||||
|
||||
|
|
|
@ -144,6 +144,13 @@ void CWeatherManagerClient::update(uint64 day, float hour, const CWeatherContext
|
|||
// get the weather value for the current date
|
||||
nlassert(wc.WFP);
|
||||
float weatherValue = ::getBlendedWeather(day, hour, *(wc.WFP), wc.WF);
|
||||
|
||||
// calculate next weather cycle and ingame hour for it
|
||||
uint64 cycle = ((day * wc.WFP->DayLength) + (uint) hour) / wc.WFP->CycleLength;
|
||||
uint64 cycleDay = ((cycle + 1) * wc.WFP->CycleLength) / wc.WFP->DayLength;
|
||||
_NextWeatherHour = ((cycle + 1) * wc.WFP->CycleLength) % wc.WFP->DayLength;
|
||||
_NextWeatherValue = ::getBlendedWeather(cycleDay, _NextWeatherHour, *(wc.WFP), wc.WF);
|
||||
|
||||
// build current weather state
|
||||
EGSPD::CSeason::TSeason season = CRyzomTime::getSeasonByDay((uint32)day);
|
||||
//
|
||||
|
|
|
@ -76,6 +76,10 @@ public:
|
|||
void update(uint64 day, float hour, const CWeatherContext &wc, const NLMISC::CMatrix &camMat, const class CContinent &continent);
|
||||
/// Get the current weather value. Updated after each call to 'update'
|
||||
float getWeatherValue() const { return _WeatherValue; }
|
||||
/// Get the weather value for next cycle
|
||||
float getNextWeatherValue() const { return _NextWeatherValue; }
|
||||
/// Get the hour for next weather cycle
|
||||
uint32 getNextWeatherHour() const { return _NextWeatherHour; }
|
||||
/** Does the same than 'update', but let the user choose the weather value. The weather value ranges from 0 to 1.
|
||||
* The day and hour are needed only to manage phenomena like thunder (need a clock to know when there are thunder strikes)
|
||||
* Small update, only to update current weather state
|
||||
|
@ -123,6 +127,8 @@ private:
|
|||
float _LastEvalHour;
|
||||
uint64 _LastEvalDay;
|
||||
float _LocalPrecipitationFactor;
|
||||
uint32 _NextWeatherHour;
|
||||
float _NextWeatherValue;
|
||||
private:
|
||||
void initPrecipitationFXs();
|
||||
void setupFXs(const NLMISC::CMatrix &camMat, NLPACS::UGlobalRetriever *gr, const class CContinent &continent);
|
||||
|
|
Loading…
Reference in a new issue