Implement a few LegoBackgroundColor functions (#694)

* Update legobackgroundcolor.cpp

* Update legobackgroundcolor.cpp

* minor style

* minor style

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha 2024-03-19 10:22:11 -04:00 committed by GitHub
parent e454e56b52
commit fd1b371864
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -67,16 +67,50 @@ void LegoBackgroundColor::SetValue(const char* p_colorString)
delete[] colorStringCopy; delete[] colorStringCopy;
} }
// STUB: LEGO1 0x1003c230 // FUNCTION: LEGO1 0x1003c230
void LegoBackgroundColor::ToggleDayNight(MxBool) void LegoBackgroundColor::ToggleDayNight(MxBool p_sun)
{ {
// TODO char buffer[30];
if (p_sun) {
m_s += 0.1;
if (m_s > 0.9) {
m_s = 1.0;
}
}
else {
m_s -= 0.1;
if (m_s < 0.1) {
m_s = 0.1;
}
} }
// STUB: LEGO1 0x1003c330 sprintf(buffer, "set %d %d %d", (MxU32) (m_h * 100.0f), (MxU32) (m_s * 100.0f), (MxU32) (m_v * 100.0f));
m_value = buffer;
float convertedR, convertedG, convertedB;
ConvertHSVToRGB(m_h, m_s, m_v, &convertedR, &convertedG, &convertedB);
VideoManager()->SetSkyColor(convertedR, convertedG, convertedB);
SetLights(convertedR, convertedG, convertedB);
}
// FUNCTION: LEGO1 0x1003c330
void LegoBackgroundColor::ToggleSkyColor() void LegoBackgroundColor::ToggleSkyColor()
{ {
// TODO char buffer[30];
m_h += 0.05;
if (m_h > 1.0) {
m_h -= 1.0;
}
sprintf(buffer, "set %d %d %d", (MxU32) (m_h * 100.0f), (MxU32) (m_s * 100.0f), (MxU32) (m_v * 100.0f));
m_value = buffer;
float convertedR, convertedG, convertedB;
ConvertHSVToRGB(m_h, m_s, m_v, &convertedR, &convertedG, &convertedB);
VideoManager()->SetSkyColor(convertedR, convertedG, convertedB);
SetLights(convertedR, convertedG, convertedB);
} }
// STUB: LEGO1 0x1003c400 // STUB: LEGO1 0x1003c400