implement LegoOmni::FUN_1005b4f0 (#450)

* push changes

* push changes

* fixes

* Changes

* Use proper values

* Name vtable function

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha 2024-01-17 15:48:48 -05:00 committed by GitHub
parent cf7466f901
commit c0af1dbac4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 72 additions and 21 deletions

View file

@ -46,6 +46,7 @@ class LegoInputManager : public MxPresenter {
MxResult GetJoystickState(MxU32* p_joystickX, MxU32* p_joystickY, DWORD* p_buttonsState, MxU32* p_povPosition);
void SetTimer();
void KillTimer();
void EnableInputProcessing();
void SetCamera(LegoCameraController* p_camera);
void ClearCamera();
void SetWorld(LegoWorld* p_world);
@ -57,6 +58,12 @@ class LegoInputManager : public MxPresenter {
inline void SetUseJoystick(MxBool p_useJoystick) { m_useJoystick = p_useJoystick; }
inline void SetJoystickIndex(MxS32 p_joystickIndex) { m_joystickIndex = p_joystickIndex; }
inline void DisableInputProcessing()
{
m_unk0x88 = TRUE;
m_unk0x336 = FALSE;
}
inline LegoControlManager* GetControlManager() { return m_controlManager; }
inline LegoWorld* GetWorld() { return m_world; }
inline LegoCameraController* GetCamera() { return m_camera; }

View file

@ -62,6 +62,12 @@ extern MxAtomId* g_nocdSourceName;
// SIZE 0x140
class LegoOmni : public MxOmni {
public:
enum {
c_disableInput = 0x01,
c_disable3d = 0x02,
c_clearScreen = 0x04
};
__declspec(dllexport) void CreateBackgroundAudio();
__declspec(dllexport) void RemoveWorld(const MxAtomId&, MxLong);
__declspec(dllexport) static int GetCurrPathInfo(LegoPathBoundary**, MxS32&);
@ -99,6 +105,7 @@ class LegoOmni : public MxOmni {
LegoEntity* FindByEntityIdOrAtomId(const MxAtomId& p_atom, MxS32 p_entityid);
void AddWorld(LegoWorld* p_world);
void FUN_1005b4f0(MxBool p_disable, MxU16 p_flags);
LegoVideoManager* GetVideoManager() { return (LegoVideoManager*) m_videoManager; }
LegoSoundManager* GetSoundManager() { return (LegoSoundManager*) m_soundManager; }
@ -162,7 +169,7 @@ LegoPlantManager* PlantManager();
LegoWorld* GetCurrentWorld();
LegoUnkSaveDataWriter* GetUnkSaveDataWriter();
GifManager* GetGifManager();
void FUN_10015820(MxU32, MxU32);
void FUN_10015820(MxBool p_disable, MxU16 p_flags);
void FUN_10015860(const char*, MxU8);
LegoEntity* FindEntityByAtomIdOrEntityId(const MxAtomId& p_atom, MxS32 p_entityid);
MxDSAction& GetCurrentAction();

View file

@ -30,7 +30,7 @@ class LegoVideoManager : public MxVideoManager {
virtual MxResult Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS, MxBool p_createThread)
override; // vtable+0x2c
virtual MxResult RealizePalette(MxPalette*) override; // vtable+0x30
virtual void VTable0x34(MxU32 p_x, MxU32 p_y, MxU32 p_width, MxU32 p_height) override; // vtable+0x34
virtual void UpdateView(MxU32 p_x, MxU32 p_y, MxU32 p_width, MxU32 p_height) override; // vtable+0x34
virtual void VTable0x38(undefined4, undefined4); // vtable+0x38
// FUNCTION: LGEO1 0x1007ab10
virtual LegoUnknown100d9d00* VTable0x3c() { return m_unk0x100d9d00; } // vtable+0x3c

View file

@ -99,7 +99,7 @@ MxU32 Helicopter::VTable0xcc()
AnimationManager()->FUN_10064670(FALSE);
VTable0xe8(0x29, TRUE, 7);
((Isle*) GetCurrentWorld())->SetUnknown13c(0x3c);
FUN_10015820(1, 0);
FUN_10015820(TRUE, 0);
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, TRUE);
SetUnknownDC(4);
PlayMusic(9);

View file

@ -45,7 +45,7 @@ LegoWorldPresenter::~LegoWorldPresenter()
}
if (result == FALSE) {
FUN_10015820(0, 7);
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
}
if (m_entity) {

View file

@ -304,7 +304,7 @@ void Infocenter::VTable0x50()
PlayDialogue(c_letsGetStartedDialogue);
PlayMusic(11);
FUN_10015820(0, 7);
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
return;
default:
PlayMusic(11);
@ -313,7 +313,7 @@ void Infocenter::VTable0x50()
case 8:
PlayMusic(11);
PlayDialogue(c_exitConfirmationDialogue);
FUN_10015820(0, 7);
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
return;
case 0xf:
if (m_infocenterState->GetInfocenterBufferElement(0) == 0) {
@ -322,7 +322,7 @@ void Infocenter::VTable0x50()
PlayDialogue(c_clickOnInfomanDialogue);
PlayMusic(11);
FUN_10015820(0, 7);
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
return;
}
break;
@ -334,7 +334,7 @@ void Infocenter::VTable0x50()
break;
default:
m_infocenterState->SetUnknown0x74(11);
FUN_10015820(0, 7);
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
return;
}
}
@ -469,7 +469,7 @@ void Infocenter::StopCutscene()
VideoManager()->EnableFullScreenMovie(FALSE);
InputManager()->SetUnknown335(FALSE);
SetAppCursor(0); // Restore cursor to arrow
FUN_10015820(0, 7);
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
}
// FUNCTION: LEGO1 0x10070d00

View file

@ -147,7 +147,7 @@ void Score::VTable0x50()
else
PlayMusic(11);
FUN_10015820(0, 7);
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
}
// FUNCTION: LEGO1 0x100016d0

View file

@ -7,6 +7,12 @@
DECOMP_SIZE_ASSERT(LegoInputManager, 0x338);
DECOMP_SIZE_ASSERT(LegoEventQueue, 0x18);
// GLOBAL: LEGO1 0x100f31b0
MxS32 g_unk0x100f31b0 = -1;
// GLOBAL: LEGO1 0x100f31b4
MxS32 g_unk0x100f31b4 = 0;
// FUNCTION: LEGO1 0x1005b790
LegoInputManager::LegoInputManager()
{
@ -271,3 +277,11 @@ void LegoInputManager::KillTimer()
::KillTimer(omni->GetWindowHandle(), m_timer);
}
}
// FUNCTION: LEGO1 0x1005cff0
void LegoInputManager::EnableInputProcessing()
{
m_unk0x88 = FALSE;
g_unk0x100f31b0 = -1;
g_unk0x100f31b4 = 0;
}

View file

@ -166,7 +166,7 @@ void Isle::VTable0x50()
FUN_1003ef00(TRUE);
FUN_10032620();
m_act1state->FUN_10034d00();
FUN_10015820(0, 7);
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
}
}

View file

@ -206,10 +206,10 @@ GifManager* GetGifManager()
return LegoOmni::GetInstance()->GetGifManager();
}
// STUB: LEGO1 0x10015820
void FUN_10015820(MxU32, MxU32)
// FUNCTION: LEGO1 0x10015820
void FUN_10015820(MxBool p_disable, MxU16 p_flags)
{
// TODO
LegoOmni::GetInstance()->FUN_1005b4f0(p_disable, p_flags);
}
// STUB: LEGO1 0x10015860
@ -680,6 +680,29 @@ MxS32 LegoOmni::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value)
return GetCurrentWorld()->GetCurrPathInfo(p_path, p_value);
}
// FUNCTION: LEGO1 0x1005b4f0
void LegoOmni::FUN_1005b4f0(MxBool p_disable, MxU16 p_flags)
{
if (p_disable) {
if (p_flags & c_disableInput) {
m_inputMgr->DisableInputProcessing();
}
if (p_flags & c_disable3d) {
((LegoVideoManager*) m_videoManager)->SetRender3D(FALSE);
}
if (p_flags & c_clearScreen) {
m_videoManager->GetDisplaySurface()->ClearScreen();
}
}
else {
m_inputMgr->EnableInputProcessing();
((LegoVideoManager*) m_videoManager)->SetRender3D(TRUE);
((LegoVideoManager*) m_videoManager)->UpdateView(0, 0, 0, 0);
}
}
// FUNCTION: LEGO1 0x1005b560
void LegoOmni::CreateBackgroundAudio()
{

View file

@ -423,7 +423,7 @@ void LegoVideoManager::OverrideSkyColor(MxBool p_shouldOverride)
}
// FUNCTION: LEGO1 0x1007c4d0
void LegoVideoManager::VTable0x34(MxU32 p_x, MxU32 p_y, MxU32 p_width, MxU32 p_height)
void LegoVideoManager::UpdateView(MxU32 p_x, MxU32 p_y, MxU32 p_width, MxU32 p_height)
{
if (p_width == 0) {
p_width = m_videoParam.GetRect().GetWidth();

View file

@ -32,7 +32,7 @@ class MxVideoManager : public MxMediaManager {
__declspec(dllexport) void InvalidateRect(MxRect32&);
__declspec(dllexport) virtual MxResult RealizePalette(MxPalette*); // vtable+0x30
virtual void VTable0x34(MxU32 p_x, MxU32 p_y, MxU32 p_width, MxU32 p_height); // vtable+0x34
virtual void UpdateView(MxU32 p_x, MxU32 p_y, MxU32 p_width, MxU32 p_height); // vtable+0x34
MxResult Init();
void Destroy(MxBool p_fromDestructor);

View file

@ -155,10 +155,10 @@ void MxStillPresenter::VTable0x88(MxS32 p_x, MxS32 p_y)
MxRect32 rectB(m_location.GetX(), m_location.GetY(), width + m_location.GetX(), height + m_location.GetY());
MVideoManager()->InvalidateRect(rectA);
MVideoManager()->VTable0x34(rectA.GetLeft(), rectA.GetTop(), rectA.GetWidth(), rectA.GetHeight());
MVideoManager()->UpdateView(rectA.GetLeft(), rectA.GetTop(), rectA.GetWidth(), rectA.GetHeight());
MVideoManager()->InvalidateRect(rectB);
MVideoManager()->VTable0x34(rectB.GetLeft(), rectB.GetTop(), rectB.GetWidth(), rectB.GetHeight());
MVideoManager()->UpdateView(rectB.GetLeft(), rectB.GetTop(), rectB.GetWidth(), rectB.GetHeight());
}
}
@ -176,7 +176,7 @@ void MxStillPresenter::Enable(MxBool p_enable)
MxRect32 rect(x, y, width + x, height + y);
MVideoManager()->InvalidateRect(rect);
MVideoManager()->VTable0x34(rect.GetLeft(), rect.GetTop(), rect.GetWidth(), rect.GetHeight());
MVideoManager()->UpdateView(rect.GetLeft(), rect.GetTop(), rect.GetWidth(), rect.GetHeight());
}
}

View file

@ -13,7 +13,7 @@ MxVideoManager::MxVideoManager()
}
// FUNCTION: LEGO1 0x100be270
void MxVideoManager::VTable0x34(MxU32 p_x, MxU32 p_y, MxU32 p_width, MxU32 p_height)
void MxVideoManager::UpdateView(MxU32 p_x, MxU32 p_y, MxU32 p_width, MxU32 p_height)
{
}

View file

@ -151,7 +151,7 @@ void MxVideoPresenter::Destroy(MxBool p_fromDestructor)
MxRect32 rect(x, y, x + width, y + height);
MVideoManager()->InvalidateRect(rect);
MVideoManager()->VTable0x34(rect.GetLeft(), rect.GetTop(), rect.GetWidth(), rect.GetHeight());
MVideoManager()->UpdateView(rect.GetLeft(), rect.GetTop(), rect.GetWidth(), rect.GetHeight());
}
delete m_bitmap;