diff --git a/LEGO1/mxtransitionmanager.cpp b/LEGO1/mxtransitionmanager.cpp index 12bd0931..c5a0cb27 100644 --- a/LEGO1/mxtransitionmanager.cpp +++ b/LEGO1/mxtransitionmanager.cpp @@ -4,16 +4,30 @@ DECOMP_SIZE_ASSERT(MxTransitionManager, 0x900); -// OFFSET: LEGO1 0x1004b8d0 STUB +// OFFSET: LEGO1 0x1004b8d0 MxTransitionManager::MxTransitionManager() { - // TODO + m_animationTimer = 0; + m_transitionType = NOT_TRANSITIONING; + m_ddSurface = NULL; + m_unk08 = 0; + m_unk1c = 0; + m_unk20.bit0 = FALSE; + m_unk28.bit0 = FALSE; + m_unk24 = 0; } -// OFFSET: LEGO1 0x1004ba00 STUB +// OFFSET: LEGO1 0x1004ba00 MxTransitionManager::~MxTransitionManager() { - // TODO + free(m_unk1c); + + if (m_unk08 != NULL) { + delete m_unk08->m_unk1c; + delete m_unk08; + } + + TickleManager()->UnregisterClient(this); } // OFFSET: LEGO1 0x1004bac0 STUB @@ -40,36 +54,43 @@ MxResult MxTransitionManager::GetDDrawSurfaceFromVideoManager() // vtable+0x14 // OFFSET: LEGO1 0x1004bb70 MxResult MxTransitionManager::StartTransition(TransitionType p_animationType, MxS32 p_speed, - undefined p_unk, MxBool p_playMusicInAnim) + MxBool 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 + this->m_transitionType = p_animationType; - MxU32 time = timeGetTime(); - this->m_systemTime = time; + m_unk20.bit0 = p_unk; - this->m_animationSpeed = p_speed; + if (m_unk20.bit0 && m_unk08 != NULL) { + m_unk08->vtable54(1); - MxTickleManager *tickleManager = TickleManager(); - tickleManager->RegisterClient(this, p_speed); + MxTransitionManagerUnknownSubclass2 *iVar2 = m_unk08->m_unk1c; + iVar2->m_unk3c = 10000; + iVar2->m_unk30 |= 0x200; + } - LegoInputManager *inputManager = InputManager(); - inputManager->m_unk88 = TRUE; - inputManager->m_unk336 = FALSE; + MxU32 time = timeGetTime(); + this->m_systemTime = time; - LegoVideoManager *videoManager = VideoManager(); - videoManager->SetUnkE4(FALSE); + this->m_animationSpeed = p_speed; - SetAppCursor(1); - return SUCCESS; + 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 1b662e98..723366c1 100644 --- a/LEGO1/mxtransitionmanager.h +++ b/LEGO1/mxtransitionmanager.h @@ -5,6 +5,52 @@ #include "mxvideopresenter.h" #include "legoomni.h" +class MxTransitionManagerUnknownSubclass2 +{ +public: + virtual ~MxTransitionManagerUnknownSubclass2(){} + + undefined m_unk04[0x2c]; + undefined4 m_unk30; + undefined4 m_unk34; + undefined4 m_unk38; + undefined4 m_unk3c; + +}; + +// TODO: Don't know what this is yet +class MxTransitionManagerUnknownSubclass1 +{ +public: + virtual ~MxTransitionManagerUnknownSubclass1(){} + + virtual void vtable04(); + virtual void vtable08(); + virtual void vtable0c(); + virtual void vtable10(); + virtual void vtable14(); + virtual void vtable18(); + virtual void vtable1c(); + virtual void vtable20(); + virtual void vtable24(); + virtual void vtable28(); + virtual void vtable2c(); + virtual void vtable30(); + virtual void vtable34(); + virtual void vtable38(); + virtual void vtable3c(); + virtual void vtable40(); + virtual void vtable44(); + virtual void vtable48(); + virtual void vtable4c(); + virtual void vtable50(); + virtual void vtable54(undefined4 p_unk1); + + undefined m_unk04[0x18]; + MxTransitionManagerUnknownSubclass2 *m_unk1c; + +}; + // VTABLE 0x100d7ea0 class MxTransitionManager : public MxCore { @@ -40,11 +86,19 @@ class MxTransitionManager : public MxCore 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); + MxResult StartTransition(TransitionType p_animationType, MxS32 p_speed, MxBool p_unk, MxBool p_playMusicInAnim); private: - undefined m_pad00[0x20]; - undefined m_pad20[0x04]; + MxTransitionManagerUnknownSubclass1 *m_unk08; + undefined4 m_unk0c; + undefined4 m_unk10; + undefined4 m_unk14; + undefined4 m_unk18; + void *m_unk1c; + flag_bitfield m_unk20; + undefined4 m_unk24; + flag_bitfield m_unk28; + TransitionType m_transitionType; LPDIRECTDRAWSURFACE m_ddSurface; MxU16 m_animationTimer; diff --git a/LEGO1/mxtypes.h b/LEGO1/mxtypes.h index fc8d47b5..75f19d4a 100644 --- a/LEGO1/mxtypes.h +++ b/LEGO1/mxtypes.h @@ -44,4 +44,19 @@ typedef MxU8 MxBool; #define TWOCC(a, b) (((a) << 0) | ((b) << 8)) #define FOURCC(a, b, c, d) (((a) << 0) | ((b) << 8) | ((c) << 16) | ((d) << 24)) +// Must be union with struct for match. +typedef union { + struct { + MxU8 bit0: 1; + MxU8 bit1: 1; + MxU8 bit2: 1; + MxU8 bit3: 1; + MxU8 bit4: 1; + MxU8 bit5: 1; + MxU8 bit6: 1; + MxU8 bit7: 1; + }; + // BYTE all; // ? +} flag_bitfield; + #endif // MXTYPE_H diff --git a/LEGO1/mxvideoparamflags.h b/LEGO1/mxvideoparamflags.h index f25ab4bd..8d1714ed 100644 --- a/LEGO1/mxvideoparamflags.h +++ b/LEGO1/mxvideoparamflags.h @@ -3,20 +3,7 @@ #include -// Must be union with struct for match. -typedef union { - struct { - BYTE bit0: 1; - BYTE bit1: 1; - BYTE bit2: 1; - BYTE bit3: 1; - BYTE bit4: 1; - BYTE bit5: 1; - BYTE bit6: 1; - BYTE bit7: 1; - }; - // BYTE all; // ? -} flag_bitfield; +#include "mxtypes.h" class MxVideoParamFlags {