mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-26 17:46:38 -05:00
fix bug in MxPresenter::CreateEntity (#626)
* fix bug in MxPresenter::CreateEntity * Match 100% --------- Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
parent
a78b1c7d49
commit
068760056a
2 changed files with 16 additions and 14 deletions
|
@ -107,7 +107,7 @@ class MxPresenter : public MxCore {
|
||||||
|
|
||||||
virtual void Enable(MxBool p_enable); // vtable+0x54
|
virtual void Enable(MxBool p_enable); // vtable+0x54
|
||||||
|
|
||||||
MxEntity* CreateEntity(const char* p_name);
|
MxEntity* CreateEntity(const char* p_defaultName);
|
||||||
void SendToCompositePresenter(MxOmni*);
|
void SendToCompositePresenter(MxOmni*);
|
||||||
MxBool IsEnabled();
|
MxBool IsEnabled();
|
||||||
|
|
||||||
|
|
|
@ -239,24 +239,26 @@ const char* PresenterNameDispatch(const MxDSAction& p_action)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100b5410
|
// FUNCTION: LEGO1 0x100b5410
|
||||||
MxEntity* MxPresenter::CreateEntity(const char* p_name)
|
MxEntity* MxPresenter::CreateEntity(const char* p_defaultName)
|
||||||
{
|
{
|
||||||
char buffer[512];
|
// create an object from LegoObjectFactory based on OBJECT: value in extra data.
|
||||||
char buffer2[512];
|
// If that is missing, p_defaultName is used
|
||||||
strcpy(buffer, p_name);
|
|
||||||
|
|
||||||
MxU16 extraLen = m_action->GetExtraLength();
|
char objectName[512];
|
||||||
|
strcpy(objectName, p_defaultName);
|
||||||
|
|
||||||
buffer[0] = extraLen;
|
MxU16 extraLength;
|
||||||
buffer[1] = extraLen >> 8;
|
char* extraData;
|
||||||
if (extraLen) {
|
m_action->GetExtra(extraLength, extraData);
|
||||||
extraLen &= MAXWORD;
|
|
||||||
memcpy(buffer2 + 2, m_action->GetExtraData(), extraLen);
|
if (extraLength & MAXWORD) {
|
||||||
buffer2[extraLen + 2] = 0;
|
char extraCopy[512];
|
||||||
KeyValueStringParse(buffer, g_strOBJECT, buffer2 + 2);
|
memcpy(extraCopy, extraData, extraLength & MAXWORD);
|
||||||
|
extraCopy[extraLength & MAXWORD] = '\0';
|
||||||
|
KeyValueStringParse(objectName, g_strOBJECT, extraCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (MxEntity*) ObjectFactory()->Create(buffer);
|
return (MxEntity*) ObjectFactory()->Create(objectName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100b54c0
|
// FUNCTION: LEGO1 0x100b54c0
|
||||||
|
|
Loading…
Reference in a new issue