diff --git a/LEGO1/legoinputmanager.h b/LEGO1/legoinputmanager.h index 3a35d4b1..56b77445 100644 --- a/LEGO1/legoinputmanager.h +++ b/LEGO1/legoinputmanager.h @@ -28,10 +28,22 @@ class LegoInputManager : public MxPresenter virtual MxResult Tickle() override; // vtable+0x8 - undefined m_pad40[0x15c]; + undefined m_pad40[0x48]; + + MxBool m_unk88; + undefined m_unk89[0x113]; + + // 0x19C int m_joystickIndex; - undefined m_pad200[0x194]; + + undefined m_pad1a0[0x194]; + + // 0x334 MxBool m_useJoystick; + + undefined m_unk335; + MxBool m_unk336; + undefined m_unk337; }; #endif // LEGOINPUTMANAGER_H diff --git a/LEGO1/legoomni.h b/LEGO1/legoomni.h index a9cce9cf..4e772cae 100644 --- a/LEGO1/legoomni.h +++ b/LEGO1/legoomni.h @@ -21,6 +21,7 @@ #include "legoplantmanager.h" class LegoSoundManager; +class MxTransitionManager; // VTABLE 0x100d8638 // SIZE: 0x140 diff --git a/LEGO1/legovideomanager.h b/LEGO1/legovideomanager.h index 60f670fb..d71c39a1 100644 --- a/LEGO1/legovideomanager.h +++ b/LEGO1/legovideomanager.h @@ -23,6 +23,7 @@ class LegoVideoManager : public MxVideoManager inline MxDirect3D *GetDirect3D() { return this->m_direct3d; } void SetSkyColor(float r, float g, float b); + inline void SetUnkE4(MxBool p_value) { this->m_unke4 = p_value; } private: undefined4 m_unk64; @@ -30,6 +31,8 @@ class LegoVideoManager : public MxVideoManager undefined4 m_unk6c; undefined4 m_unk70; MxDirect3D *m_direct3d; + undefined m_pad78[0x6c]; + MxBool m_unke4; }; #endif // LEGOVIDEOMANAGER_H diff --git a/LEGO1/mxbackgroundaudiomanager.h b/LEGO1/mxbackgroundaudiomanager.h index c6f2f1e7..a2c4cae3 100644 --- a/LEGO1/mxbackgroundaudiomanager.h +++ b/LEGO1/mxbackgroundaudiomanager.h @@ -28,8 +28,9 @@ class MxBackgroundAudioManager : public MxCore } __declspec(dllexport) void Enable(unsigned char p); -private: + void Stop(); +private: void Init(); MxBool m_musicEnabled; // 0x8 diff --git a/LEGO1/mxdisplaysurface.h b/LEGO1/mxdisplaysurface.h index c76266d7..4c2c3866 100644 --- a/LEGO1/mxdisplaysurface.h +++ b/LEGO1/mxdisplaysurface.h @@ -33,6 +33,8 @@ class MxDisplaySurface : public MxCore virtual void ReleaseDC(HDC p_hdc); virtual undefined4 vtable44(undefined4, undefined4*, undefined4, undefined4); + inline LPDIRECTDRAWSURFACE GetDirectDrawSurface2() { return this->m_ddSurface2; } + private: MxVideoParam m_videoParam; LPDIRECTDRAWSURFACE m_ddSurface1; diff --git a/LEGO1/mxomni.cpp b/LEGO1/mxomni.cpp index 22cc2a70..17de7d73 100644 --- a/LEGO1/mxomni.cpp +++ b/LEGO1/mxomni.cpp @@ -289,3 +289,9 @@ MxEventManager* EventManager() { return MxOmni::GetInstance()->GetEventManager(); } + +// OFFSET: LEGO1 0x1003ef40 +void SetAppCursor(WPARAM p_wparam) +{ + PostMessageA(MxOmni::GetInstance()->GetWindowHandle(), 0x5400, p_wparam, 0); +} diff --git a/LEGO1/mxomni.h b/LEGO1/mxomni.h index a8fa9db8..28e47124 100644 --- a/LEGO1/mxomni.h +++ b/LEGO1/mxomni.h @@ -92,4 +92,6 @@ __declspec(dllexport) MxNotificationManager * NotificationManager(); MxVideoManager * MVideoManager(); MxAtomIdCounterSet* AtomIdCounterSet(); +void SetAppCursor(WPARAM p_wparam); + #endif // MXOMNI_H diff --git a/LEGO1/mxtransitionmanager.cpp b/LEGO1/mxtransitionmanager.cpp index fdae06ea..ea295dda 100644 --- a/LEGO1/mxtransitionmanager.cpp +++ b/LEGO1/mxtransitionmanager.cpp @@ -1,4 +1,7 @@ #include "mxtransitionmanager.h" +#include "legovideomanager.h" + +DECOMP_SIZE_ASSERT(MxTransitionManager, 0x900); // OFFSET: LEGO1 0x1004b8d0 STUB MxTransitionManager::MxTransitionManager() @@ -25,3 +28,47 @@ void MxTransitionManager::SetWaitIndicator(MxVideoPresenter *videoPresenter) { // TODO } + +// OFFSET: LEGO1 0x1004baa0 +MxResult MxTransitionManager::GetDDrawSurfaceFromVideoManager() // vtable+0x14 +{ + LegoVideoManager *videoManager = VideoManager(); + this->m_ddSurface = videoManager->GetDisplaySurface()->GetDirectDrawSurface2(); + return SUCCESS; +} + +// OFFSET: LEGO1 0x1004bb70 +MxResult MxTransitionManager::StartTransition(TransitionType p_animationType, MxS32 p_speed, + undefined p_unk, MxBool p_playMusicInAnim) +{ + // TODO: Incomplete and far from matching + + if (this->m_transitionType == NOT_TRANSITIONING) { + if (!p_playMusicInAnim) { + MxBackgroundAudioManager *backgroundAudioManager = BackgroundAudioManager(); + backgroundAudioManager->Stop(); + } + this->m_transitionType = p_animationType; + + // TODO: This part of the function is mangled and I can't make out what it's doing right now + + MxU32 time = timeGetTime(); + this->m_systemTime = time; + + this->m_animationSpeed = p_speed; + + MxTickleManager *tickleManager = TickleManager(); + tickleManager->RegisterClient(this, p_speed); + + LegoInputManager *inputManager = InputManager(); + inputManager->m_unk88 = TRUE; + inputManager->m_unk336 = FALSE; + + LegoVideoManager *videoManager = VideoManager(); + videoManager->SetUnkE4(FALSE); + + SetAppCursor(1); + return SUCCESS; + } + return FAILURE; +} \ No newline at end of file diff --git a/LEGO1/mxtransitionmanager.h b/LEGO1/mxtransitionmanager.h index 215cd2d7..2276219d 100644 --- a/LEGO1/mxtransitionmanager.h +++ b/LEGO1/mxtransitionmanager.h @@ -2,10 +2,11 @@ #define MXTRANSITIONMANAGER_H #include "mxcore.h" +#include "mxvideopresenter.h" +#include "legoomni.h" -class MxVideoPresenter; -// 0x100d7ea0 +// VTABLE 0x100d7ea0 class MxTransitionManager : public MxCore { public: @@ -15,6 +16,42 @@ class MxTransitionManager : public MxCore __declspec(dllexport) void SetWaitIndicator(MxVideoPresenter *videoPresenter); virtual MxResult Tickle(); // vtable+0x8 + + // OFFSET: LEGO1 0x1004b950 + inline virtual const char *ClassName() const override // vtable+0x0c + { + return "MxTransitionManager"; + } + + // OFFSET: LEGO1 0x1004b960 + inline virtual MxBool IsA(const char *name) const override // vtable+0x10 + { + return !strcmp(name, MxTransitionManager::ClassName()) || MxCore::IsA(name); + } + + virtual MxResult GetDDrawSurfaceFromVideoManager(); // vtable+0x14 + + enum TransitionType { + NOT_TRANSITIONING, + NO_ANIMATION, + DISSOLVE, + PIXELATION, + SCREEN_WIPE, + WINDOWS, + BROKEN // Unknown what this is supposed to be, it locks the game up + }; + + MxResult StartTransition(TransitionType p_animationType, MxS32 p_speed, undefined p_unk, MxBool p_playMusicInAnim); + +private: + undefined m_pad00[0x20]; + undefined m_pad20[0x04]; + TransitionType m_transitionType; + LPDIRECTDRAWSURFACE m_ddSurface; + MxU16 m_animationTimer; + undefined m_pad36[0x8c2]; + MxULong m_systemTime; + MxS32 m_animationSpeed; }; #endif // MXTRANSITIONMANAGER_H diff --git a/LEGO1/mxvideomanager.h b/LEGO1/mxvideomanager.h index 4068b793..7888f7e7 100644 --- a/LEGO1/mxvideomanager.h +++ b/LEGO1/mxvideomanager.h @@ -26,6 +26,7 @@ class MxVideoManager : public MxMediaManager inline MxVideoParam& GetVideoParam() { return this->m_videoParam; } inline LPDIRECTDRAW GetDirectDraw() { return this->m_pDirectDraw; } + inline MxDisplaySurface *GetDisplaySurface() { return this->m_displaySurface; } private: MxVideoParam m_videoParam; LPDIRECTDRAW m_pDirectDraw;