mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 00:14:22 +00:00
Implement/match LegoBackgroundColor::SetLightColor and related (#758)
This commit is contained in:

committed by
GitHub

parent
369f3fba22
commit
ed9e9efdab
@@ -10,8 +10,8 @@ public:
|
||||
LegoBackgroundColor(const char* p_key, const char* p_value);
|
||||
|
||||
void SetValue(const char* p_colorString) override;
|
||||
void SetLights(float p_r, float p_g, float p_b);
|
||||
void SetLights();
|
||||
void SetLightColor(float p_r, float p_g, float p_b);
|
||||
void SetLightColor();
|
||||
void ToggleDayNight(MxBool);
|
||||
void ToggleSkyColor();
|
||||
|
||||
|
@@ -91,7 +91,7 @@ void LegoBackgroundColor::ToggleDayNight(MxBool p_sun)
|
||||
float convertedR, convertedG, convertedB;
|
||||
ConvertHSVToRGB(m_h, m_s, m_v, &convertedR, &convertedG, &convertedB);
|
||||
VideoManager()->SetSkyColor(convertedR, convertedG, convertedB);
|
||||
SetLights(convertedR, convertedG, convertedB);
|
||||
SetLightColor(convertedR, convertedG, convertedB);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1003c330
|
||||
@@ -110,18 +110,39 @@ void LegoBackgroundColor::ToggleSkyColor()
|
||||
float convertedR, convertedG, convertedB;
|
||||
ConvertHSVToRGB(m_h, m_s, m_v, &convertedR, &convertedG, &convertedB);
|
||||
VideoManager()->SetSkyColor(convertedR, convertedG, convertedB);
|
||||
SetLights(convertedR, convertedG, convertedB);
|
||||
SetLightColor(convertedR, convertedG, convertedB);
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1003c400
|
||||
void LegoBackgroundColor::SetLights(float p_r, float p_g, float p_b)
|
||||
// FUNCTION: LEGO1 0x1003c400
|
||||
void LegoBackgroundColor::SetLightColor(float p_r, float p_g, float p_b)
|
||||
{
|
||||
if (!VideoManager()->GetVideoParam().Flags().GetF2bit0()) {
|
||||
// TODO: Computed constants based on what?
|
||||
p_r *= 4.3478260869565215;
|
||||
p_g *= 1.5873015873015872;
|
||||
p_b *= 1.1764705882352942;
|
||||
|
||||
if (p_r > 1.0) {
|
||||
p_r = 1.0;
|
||||
}
|
||||
|
||||
if (p_g > 1.0) {
|
||||
p_g = 1.0;
|
||||
}
|
||||
|
||||
if (p_b > 1.0) {
|
||||
p_b = 1.0;
|
||||
}
|
||||
|
||||
VideoManager()->Get3DManager()->GetLego3DView()->SetLightColor(FALSE, p_r, p_g, p_b);
|
||||
VideoManager()->Get3DManager()->GetLego3DView()->SetLightColor(TRUE, p_r, p_g, p_b);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1003c4b0
|
||||
void LegoBackgroundColor::SetLights()
|
||||
void LegoBackgroundColor::SetLightColor()
|
||||
{
|
||||
float convertedR, convertedG, convertedB;
|
||||
ConvertHSVToRGB(m_h, m_s, m_v, &convertedR, &convertedG, &convertedB);
|
||||
SetLights(convertedR, convertedG, convertedB);
|
||||
SetLightColor(convertedR, convertedG, convertedB);
|
||||
}
|
||||
|
@@ -350,7 +350,7 @@ MxResult LegoGameState::Load(MxULong p_slot)
|
||||
}
|
||||
} while (status != 2);
|
||||
|
||||
m_backgroundColor->SetLights();
|
||||
m_backgroundColor->SetLightColor();
|
||||
lightPosition = VariableTable()->GetVariable("lightposition");
|
||||
|
||||
if (lightPosition) {
|
||||
@@ -1072,7 +1072,7 @@ void LegoGameState::RegisterState(LegoState* p_state)
|
||||
void LegoGameState::Init()
|
||||
{
|
||||
m_backgroundColor->SetValue("set 56 54 68");
|
||||
m_backgroundColor->SetLights();
|
||||
m_backgroundColor->SetLightColor();
|
||||
m_tempBackgroundColor->SetValue("set 56 54 68");
|
||||
VariableTable()->SetVariable("lightposition", "2");
|
||||
SetLightPosition(2);
|
||||
|
@@ -403,8 +403,8 @@ void SetLightPosition(MxS32 p_index)
|
||||
CalcLocalTransform(position, direction, up, transform);
|
||||
SETMAT4(in, transform);
|
||||
|
||||
VideoManager()->Get3DManager()->GetLego3DView()->SetLight(FALSE, matrix);
|
||||
VideoManager()->Get3DManager()->GetLego3DView()->SetLight(TRUE, matrix);
|
||||
VideoManager()->Get3DManager()->GetLego3DView()->SetLightTransform(FALSE, matrix);
|
||||
VideoManager()->Get3DManager()->GetLego3DView()->SetLightTransform(TRUE, matrix);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1003f3b0
|
||||
|
Reference in New Issue
Block a user