1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Allow fog color to be overriden properly (#14296)

This commit is contained in:
sfan5 2024-01-23 22:33:33 +01:00 committed by GitHub
parent a29d3cf074
commit 9e3a11534f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 96 additions and 84 deletions

View file

@ -1391,41 +1391,44 @@ void Client::handleCommand_HudSetSky(NetworkPacket* pkt)
star_event->type = CE_SET_STARS;
star_event->star_params = new StarParams(stars);
m_client_event_queue.push(star_event);
} else {
SkyboxParams skybox;
return;
}
SkyboxParams skybox;
*pkt >> skybox.bgcolor >> skybox.type >> skybox.clouds >>
skybox.fog_sun_tint >> skybox.fog_moon_tint >> skybox.fog_tint_type;
if (skybox.type == "skybox") {
u16 texture_count;
std::string texture;
*pkt >> skybox.bgcolor >> skybox.type >> skybox.clouds >>
skybox.fog_sun_tint >> skybox.fog_moon_tint >> skybox.fog_tint_type;
if (skybox.type == "skybox") {
*pkt >> texture_count;
for (int i = 0; i < texture_count; i++) {
*pkt >> texture;
skybox.textures.emplace_back(texture);
}
*pkt >> texture_count;
for (u16 i = 0; i < texture_count; i++) {
*pkt >> texture;
skybox.textures.emplace_back(texture);
}
else if (skybox.type == "regular") {
*pkt >> skybox.sky_color.day_sky >> skybox.sky_color.day_horizon
>> skybox.sky_color.dawn_sky >> skybox.sky_color.dawn_horizon
>> skybox.sky_color.night_sky >> skybox.sky_color.night_horizon
>> skybox.sky_color.indoors;
}
if (pkt->getRemainingBytes() >= 4) {
*pkt >> skybox.body_orbit_tilt;
}
if (pkt->getRemainingBytes() >= 6) {
*pkt >> skybox.fog_distance >> skybox.fog_start;
}
ClientEvent *event = new ClientEvent();
event->type = CE_SET_SKY;
event->set_sky = new SkyboxParams(skybox);
m_client_event_queue.push(event);
} else if (skybox.type == "regular") {
auto &c = skybox.sky_color;
*pkt >> c.day_sky >> c.day_horizon >> c.dawn_sky >> c.dawn_horizon
>> c.night_sky >> c.night_horizon >> c.indoors;
}
if (pkt->getRemainingBytes() >= 4) {
*pkt >> skybox.body_orbit_tilt;
}
if (pkt->getRemainingBytes() >= 6) {
*pkt >> skybox.fog_distance >> skybox.fog_start;
}
if (pkt->getRemainingBytes() >= 4) {
*pkt >> skybox.fog_color;
}
ClientEvent *event = new ClientEvent();
event->type = CE_SET_SKY;
event->set_sky = new SkyboxParams(skybox);
m_client_event_queue.push(event);
}
void Client::handleCommand_HudSetSun(NetworkPacket *pkt)