implement/match UpdateLightPosition() (#744)

This commit is contained in:
Ramen2X 2024-03-28 10:27:44 -04:00 committed by GitHub
parent 13d994a1ee
commit f157f01f71
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 33 additions and 7 deletions

View file

@ -25,7 +25,7 @@ void FUN_1003ef00(MxBool);
void SetAppCursor(WPARAM p_wparam); void SetAppCursor(WPARAM p_wparam);
MxBool FUN_1003ef60(); MxBool FUN_1003ef60();
MxBool RemoveFromWorld(MxAtomId& p_entityAtom, MxS32 p_entityId, MxAtomId& p_worldAtom, MxS32 p_worldEntityId); MxBool RemoveFromWorld(MxAtomId& p_entityAtom, MxS32 p_entityId, MxAtomId& p_worldAtom, MxS32 p_worldEntityId);
MxS32 FUN_1003f050(MxS32); MxS32 UpdateLightPosition(MxS32 p_value);
void SetLightPosition(MxU32); void SetLightPosition(MxU32);
LegoNamedTexture* ReadNamedTexture(LegoFile* p_file); LegoNamedTexture* ReadNamedTexture(LegoFile* p_file);
void FUN_1003f540(LegoFile* p_file, const char* p_filename); void FUN_1003f540(LegoFile* p_file, const char* p_filename);

View file

@ -339,11 +339,37 @@ MxBool FUN_1003ef60()
return FALSE; return FALSE;
} }
// STUB: LEGO1 0x1003f050 // FUNCTION: LEGO1 0x1003f050
MxS32 FUN_1003f050(MxS32) MxS32 UpdateLightPosition(MxS32 p_value)
{ {
// TODO // This function updates the light position
return 0; // relatively by the amount passed in p_value.
// Because it operates relatively, it does not set
// the light position to an arbitrary value.
MxS32 lightPosition = atoi(VariableTable()->GetVariable("lightposition"));
if (p_value > 0) {
lightPosition += 1;
if (lightPosition > 5) {
lightPosition = 5;
}
}
else {
lightPosition -= 1;
if (lightPosition < 0) {
lightPosition = 0;
}
}
SetLightPosition(lightPosition);
char lightPositionBuffer[32];
sprintf(lightPositionBuffer, "%d", lightPosition);
VariableTable()->SetVariable("lightposition", lightPositionBuffer);
return lightPosition;
} }
// STUB: LEGO1 0x1003f0d0 // STUB: LEGO1 0x1003f0d0

View file

@ -399,11 +399,11 @@ MxLong Isle::HandleClick(LegoControlManagerEvent& p_param)
FUN_10031590(); FUN_10031590();
break; break;
case IsleScript::c_Observe_GlobeLArrow_Ctl: case IsleScript::c_Observe_GlobeLArrow_Ctl:
FUN_1003f050(-1); UpdateLightPosition(-1);
FUN_10031590(); FUN_10031590();
break; break;
case IsleScript::c_Observe_GlobeRArrow_Ctl: case IsleScript::c_Observe_GlobeRArrow_Ctl:
FUN_1003f050(1); UpdateLightPosition(1);
FUN_10031590(); FUN_10031590();
break; break;
case IsleScript::c_Observe_Draw1_Ctl: case IsleScript::c_Observe_Draw1_Ctl: