Merge with develop
--HG-- branch : compatibility-develop
This commit is contained in:
commit
b8a3405ad7
5 changed files with 49 additions and 5 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" />
|
||||
|
||||
|
@ -447,4 +448,4 @@
|
|||
</tree>
|
||||
|
||||
|
||||
</interface_config>
|
||||
</interface_config>
|
||||
|
|
|
@ -1433,6 +1433,23 @@ void CInterfaceManager::flushDebugWindow()
|
|||
ChatDisplayer->update();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Make sure 0.166 is displayed as 16% and 0.167 as 17%
|
||||
// because they belong to different weather conditions
|
||||
static float roundWeatherValue(float weatherValue)
|
||||
{
|
||||
// Number of possible weather setups in server
|
||||
const static uint NB_WEATHER_SETUPS = 6;
|
||||
float floorValue = floorf(weatherValue * 100.f) / 100.f;
|
||||
uint weatherIndex = min((uint)(weatherValue * NB_WEATHER_SETUPS), NB_WEATHER_SETUPS - 1);
|
||||
uint floorIndex = min((uint)(floorValue * NB_WEATHER_SETUPS), NB_WEATHER_SETUPS - 1);
|
||||
|
||||
if (weatherIndex > floorIndex)
|
||||
return ceilf(weatherValue * 100.f) / 100.f;
|
||||
|
||||
return weatherValue;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CInterfaceManager::updateFrameEvents()
|
||||
{
|
||||
|
@ -1471,20 +1488,31 @@ void CInterfaceManager::updateFrameEvents()
|
|||
// Update string if some waiting
|
||||
CEncyclopediaManager::getInstance()->updateAllFrame();
|
||||
|
||||
// Setup the weather setup in the player's map
|
||||
if ((T0 - _UpdateWeatherTime) > (1 * 5 * 1000))
|
||||
// Setup the weather setup in the player's map every 3 sec (1 ingame minute)
|
||||
if ((T0 - _UpdateWeatherTime) > (1 * 3 * 1000))
|
||||
{
|
||||
_UpdateWeatherTime = T0;
|
||||
ucstring str = CI18N::get ("uiTheSeasonIs") +
|
||||
CI18N::get ("uiSeason"+toStringEnum(computeCurrSeason())) +
|
||||
CI18N::get ("uiAndTheWeatherIs") +
|
||||
CI18N::get (WeatherManager.getCurrWeatherState().LocalizedName);
|
||||
CI18N::get (WeatherManager.getCurrWeatherState().LocalizedName) +
|
||||
toString(", %d", (uint)(roundWeatherValue(WeatherManager.getWeatherValue()) * 100.f)) + "% " +CI18N::get("uiHumidity");
|
||||
|
||||
|
||||
|
||||
CViewText *pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:weather"));
|
||||
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();
|
||||
|
||||
|
@ -1498,7 +1526,8 @@ void CInterfaceManager::updateFrameEvents()
|
|||
|
||||
// literal version
|
||||
// str = CI18N::get("uiDate");
|
||||
str += toString("%02d", (sint)RT.getRyzomTime()) + CI18N::get("uiMissionTimerHour") + " - ";
|
||||
uint minutes = ((RT.getRyzomTime() - (sint)RT.getRyzomTime()) * (float) RYZOM_HOUR_IN_MINUTES);
|
||||
str += toString("%02d:%02d", (sint)RT.getRyzomTime(), minutes) + " - ";
|
||||
str += CI18N::get("ui"+WEEKDAY::toString( (WEEKDAY::EWeekDay)RT.getRyzomDayOfWeek() )) + ", ";
|
||||
str += CI18N::get("ui"+MONTH::toString( (MONTH::EMonth)RT.getRyzomMonthInCurrentCycle() )) + " ";
|
||||
str += toString("%02d", RT.getRyzomDayOfMonth()+1) + ", ";
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
const uint RYZOM_HOURS_IN_TICKS = 1800;
|
||||
const uint RYZOM_DAY_IN_HOUR = 24;
|
||||
const uint RYZOM_HOUR_IN_MINUTES = 60;
|
||||
const uint RYZOM_DAY_IN_TICKS = RYZOM_HOURS_IN_TICKS * RYZOM_DAY_IN_HOUR;
|
||||
const uint RYZOM_SEASON_IN_DAY = 90;
|
||||
const uint RYZOM_MONTH_IN_DAY = 30;
|
||||
|
|
Loading…
Reference in a new issue