Aoxomoxoa
Dev
Hello,
I'm searching through game.cpp looking for variables targeting the day/night/sunset/sunrise colors within TFS but can only seem to find timers. Is there any explicit way to change the colors of day/night in the game?
All that I have found is this:
Is this the controller of the light color?
Where 0xD7 = 215?
If so, how could I seperate that color into different variables for day / night / sunrise / sunset color?
I'm searching through game.cpp looking for variables targeting the day/night/sunset/sunrise colors within TFS but can only seem to find timers. Is there any explicit way to change the colors of day/night in the game?
All that I have found is this:
C++:
void Game::checkLight()
{
g_scheduler.addEvent(createSchedulerTask(EVENT_LIGHTINTERVAL, std::bind(&Game::checkLight, this)));
lightHour += lightHourDelta;
if (lightHour > 1440) {
lightHour -= 1440;
}
if (std::abs(lightHour - SUNRISE) < 2 * lightHourDelta) {
lightState = LIGHT_STATE_SUNRISE;
} else if (std::abs(lightHour - SUNSET) < 2 * lightHourDelta) {
lightState = LIGHT_STATE_SUNSET;
}
int32_t newLightLevel = lightLevel;
bool lightChange = false;
switch (lightState) {
case LIGHT_STATE_SUNRISE: {
newLightLevel += (LIGHT_LEVEL_DAY - LIGHT_LEVEL_NIGHT) / 30;
lightChange = true;
break;
}
case LIGHT_STATE_SUNSET: {
newLightLevel -= (LIGHT_LEVEL_DAY - LIGHT_LEVEL_NIGHT) / 30;
lightChange = true;
break;
}
default:
break;
}
if (newLightLevel <= LIGHT_LEVEL_NIGHT) {
lightLevel = LIGHT_LEVEL_NIGHT;
lightState = LIGHT_STATE_NIGHT;
} else if (newLightLevel >= LIGHT_LEVEL_DAY) {
lightLevel = LIGHT_LEVEL_DAY;
lightState = LIGHT_STATE_DAY;
} else {
lightLevel = newLightLevel;
}
if (lightChange) {
LightInfo lightInfo = getWorldLightInfo();
for (const auto& it : players) {
it.second->sendWorldLight(lightInfo);
}
}
}
LightInfo Game::getWorldLightInfo() const
{
return {lightLevel, 0xD7};
}
Is this the controller of the light color?
C++:
return {lightLevel, 0xD7};
If so, how could I seperate that color into different variables for day / night / sunrise / sunset color?