PresenterNameDispatch (#137)

* PresenterNameDispatch

* Use reference for PresenterNameDispatch param
- fix or add const markers so we can use a const reference
This commit is contained in:
MS 2023-09-22 17:42:23 -04:00 committed by GitHub
parent b4258da0f5
commit 6dd94d3626
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 69 additions and 2 deletions

View file

@ -12,6 +12,7 @@ class MxDSAction : public MxDSObject
public:
enum
{
Flag_Looping = 0x01,
Flag_Enabled = 0x20,
Flag_Parsed = 0x80,
};
@ -55,6 +56,8 @@ class MxDSAction : public MxDSObject
inline const MxVector3Data &GetLocation() const { return m_location; }
inline void SetOmni(MxOmni *p_omni) { m_omni = p_omni; }
inline MxBool IsLooping() const { return this->m_flags & Flag_Looping; }
private:
MxU32 m_sizeOnDisk;
MxU32 m_flags;

View file

@ -32,6 +32,8 @@ class MxDSMediaAction : public MxDSAction
virtual void Deserialize(char **p_source, MxS16 p_unk24); // vtable+1c;
void CopyMediaSrcPath(const char *p_mediaSrcPath);
inline MxS32 GetMediaFormat() const { return this->m_mediaFormat; }
private:
MxU32 m_sizeOnDisk;
char *m_mediaSrcPath;

View file

@ -40,9 +40,10 @@ class MxDSObject : public MxCore
inline void SetObjectId(MxU32 p_objectId) { this->m_objectId = p_objectId; }
inline void SetUnknown24(MxS16 p_unk24) { this->m_unk24 = p_unk24; }
protected:
inline char *GetSourceName() const { return this->m_sourceName; }
inline void SetType(MxDSType p_type) { this->m_type = p_type; }
inline MxDSType GetType() { return (MxDSType) this->m_type; }
inline MxDSType GetType() const { return (MxDSType) this->m_type; }
private:
MxU32 m_sizeOnDisk;

View file

@ -2,6 +2,8 @@
#include "mxautolocker.h"
#include "mxparam.h"
#include "legoomni.h"
#include "mxdsanim.h"
#include "mxdssound.h"
#include <string.h>
#include "decomp.h"
@ -155,6 +157,63 @@ void MxPresenter::Enable(MxBool p_enable)
}
}
// OFFSET: LEGO1 0x100b5310
char *PresenterNameDispatch(const MxDSAction &p_action)
{
char *name = p_action.GetSourceName();
MxS32 format;
if (!name || strlen(name) == 0) {
switch (p_action.GetType()) {
case MxDSType_Anim:
format = ((MxDSAnim&)p_action).GetMediaFormat();
switch (format) {
case FOURCC(' ', 'F', 'L', 'C'):
name = !p_action.IsLooping() ?
"MxFlcPresenter" :
"MxLoopingFlcPresenter";
break;
case FOURCC(' ', 'S', 'M', 'K'):
name = !p_action.IsLooping() ?
"MxSmkPresenter" :
"MxLoopingSmkPresenter";
break;
}
break;
case MxDSType_Sound:
format = ((MxDSSound&)p_action).GetMediaFormat();
switch(format) {
case FOURCC(' ', 'M', 'I', 'D'):
name = !p_action.IsLooping() ?
"MxMIDIPresenter" :
"MxLoopingMIDIPresenter";
break;
case FOURCC(' ', 'W', 'A', 'V'):
name = "MxWavePresenter";
break;
}
break;
case MxDSType_SerialAction:
case MxDSType_ParallelAction:
case MxDSType_SelectAction:
name = "MxCompositePresenter";
break;
case MxDSType_Event:
name = "MxEventPresenter";
break;
case MxDSType_Still:
name = "MxStillPresenter";
break;
}
}
return name;
}
// OFFSET: LEGO1 0x100b54c0
MxBool MxPresenter::IsEnabled()
{

View file

@ -84,4 +84,6 @@ class MxPresenter : public MxCore
MxPresenter *m_unkPresenter; // 0x3c
};
char *PresenterNameDispatch(const MxDSAction &);
#endif // MXPRESENTER_H