MxBackgroundAudioManager::PlayMusic

This commit is contained in:
Misha 2023-11-04 20:21:19 -04:00
parent 618bf5db12
commit 09f7be4565
No known key found for this signature in database
GPG Key ID: 8441D12AEF33FED8
7 changed files with 60 additions and 5 deletions

View File

@ -212,12 +212,29 @@ GifManager* GetGifManager()
return LegoOmni::GetInstance()->GetGifManager();
}
// OFFSET: LEGO1 0x100158e0
MxDSAction& GetCurrentAction()
{
return LegoOmni::GetInstance()->GetCurrentAction();
}
// OFFSET: LEGO1 0x10015900
MxTransitionManager* TransitionManager()
{
return LegoOmni::GetInstance()->GetTransitionManager();
}
// OFFSET: LEGO1 0x10015910
void PlayMusic(MxU32 p_index)
{
// index is the entityid of the music in jukebox.si
MxDSAction action;
action.SetAtomId(*g_jukeboxScript);
action.SetObjectId(p_index);
LegoOmni::GetInstance()->GetBackgroundAudioManager()->PlayMusic(action, 5, 4);
}
// OFFSET: LEGO1 0x100c0280
MxDSObject* CreateStreamObject(MxDSFile* p_file, MxS16 p_ofs)
{

View File

@ -79,6 +79,7 @@ class LegoOmni : public MxOmni {
LegoGameState* GetGameState() { return m_gameState; }
MxBackgroundAudioManager* GetBackgroundAudioManager() { return m_bkgAudioManager; }
MxTransitionManager* GetTransitionManager() { return m_transitionManager; }
MxDSAction& GetCurrentAction() { return m_action; }
private:
undefined4 m_unk68;
@ -124,5 +125,6 @@ LegoPlantManager* PlantManager();
MxBool KeyValueStringParse(char*, const char*, const char*);
LegoWorld* GetCurrentWorld();
GifManager* GetGifManager();
MxDSAction& GetCurrentAction();
#endif // LEGOOMNI_H

View File

@ -183,6 +183,41 @@ void MxBackgroundAudioManager::StopAction(MxParam& p)
Lego()->HandleNotificationType2(p);
}
// OFFSET: LEGO1 0x1007f2f0
MxResult MxBackgroundAudioManager::PlayMusic(MxDSAction& p_action, undefined4 p_unknown, undefined4 p_unknown2)
{
if (!m_musicEnabled)
{
return SUCCESS;
}
if (m_action2.GetObjectId() == -1 && m_action1.GetObjectId() != p_action.GetObjectId())
{
MxDSAction action;
action.SetAtomId(GetCurrentAction().GetAtomId());
action.SetObjectId(GetCurrentAction().GetObjectId());
action.SetUnknown24(GetCurrentAction().GetUnknown24());
m_action2.SetAtomId(p_action.GetAtomId());
m_action2.SetObjectId(p_action.GetObjectId());
m_action2.SetUnknown84(this);
m_action2.SetUnknown8c(this);
MxResult result = Start(&m_action2);
GetCurrentAction().SetAtomId(action.GetAtomId());
GetCurrentAction().SetObjectId(action.GetObjectId());
GetCurrentAction().SetUnknown24(action.GetUnknown24());
if (result == SUCCESS)
{
m_unk13c = p_unknown2;
m_unk140 = p_unknown;
}
return result;
}
return FAILURE;
}
// OFFSET: LEGO1 0x1007ee40 STUB
MxResult MxBackgroundAudioManager::Tickle()
{

View File

@ -32,6 +32,7 @@ class MxBackgroundAudioManager : public MxCore {
void StartAction(MxParam& p);
void StopAction(MxParam& p);
MxResult PlayMusic(MxDSAction& p_action, undefined4 p_unknown, undefined4 p_unknown2);
virtual MxResult Tickle() override;
__declspec(dllexport) void Enable(unsigned char p);

View File

@ -28,7 +28,7 @@ MxDSAction::MxDSAction()
this->m_up.Fill(FLT_MAX);
this->m_unk84 = NULL;
this->m_unk88 = 0;
this->m_omni = NULL;
this->m_unk8c = NULL;
this->m_unkTimingField = INT_MIN;
}
@ -54,7 +54,7 @@ void MxDSAction::CopyFrom(MxDSAction& p_dsAction)
AppendData(p_dsAction.m_extraLength, p_dsAction.m_extraData);
this->m_unk84 = p_dsAction.m_unk84;
this->m_unk88 = p_dsAction.m_unk88;
this->m_omni = p_dsAction.m_omni;
this->m_unk8c = p_dsAction.m_unk8c;
this->m_unkTimingField = p_dsAction.m_unkTimingField;
}

View File

@ -63,7 +63,7 @@ class MxDSAction : public MxDSObject {
inline void SetLoopCount(MxS32 p_loopCount) { m_loopCount = p_loopCount; }
inline const MxVector3Data& GetLocation() const { return m_location; }
inline void SetUnknown84(MxCore* p_unk84) { m_unk84 = p_unk84; }
inline void SetOmni(MxOmni* p_omni) { m_omni = p_omni; }
inline void SetUnknown8c(MxCore* p_unk8c) { m_unk8c = p_unk8c; }
inline MxBool IsLooping() const { return m_flags & Flag_Looping; }
inline MxBool IsBit3() const { return m_flags & Flag_Bit3; }
@ -85,7 +85,7 @@ class MxDSAction : public MxDSObject {
MxU16 m_extraLength;
MxCore* m_unk84;
undefined4 m_unk88;
MxOmni* m_omni; // 0x8c
MxCore* m_unk8c;
protected:
MxLong m_unkTimingField; // 0x90

View File

@ -65,7 +65,7 @@ void MxPresenter::SendTo_unkPresenter(MxOmni* p_omni)
NotificationManager()->Send(m_unkPresenter, &MxNotificationParam(MXPRESENTER_NOTIFICATION, this));
m_action->SetOmni(p_omni ? p_omni : MxOmni::GetInstance());
m_action->SetUnknown8c(p_omni ? p_omni : MxOmni::GetInstance());
m_unkPresenter = NULL;
}
}