mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 08:24:16 +00:00
MxPresenter::ParseExtra (#123)
* MxPresenter::ParseExtra and surrounding functions * Named extra data is MxDSAction, added Parsed flag to enum
This commit is contained in:
@@ -1,26 +1,77 @@
|
||||
#include "mxpresenter.h"
|
||||
#include "mxautolocker.h"
|
||||
#include "mxparam.h"
|
||||
#include "legoomni.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "decomp.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxPresenter, 0x40);
|
||||
|
||||
// 0x10101eac
|
||||
char *g_parseExtraTokens = ":;";
|
||||
|
||||
// 0x10101edc
|
||||
char *g_strWORLD = "WORLD";
|
||||
|
||||
// OFFSET: LEGO1 0x100b4d50
|
||||
void MxPresenter::Init()
|
||||
{
|
||||
m_currentTickleState = TickleState_Idle;
|
||||
m_action = NULL;
|
||||
m_unk0x18 = 0;
|
||||
m_unk0x3c = 0;
|
||||
m_unkPresenter = NULL;
|
||||
m_previousTickleStates = 0;
|
||||
m_unk0x10 = 0;
|
||||
m_unk0x14 = 0;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100b4fc0 STUB
|
||||
// OFFSET: LEGO1 0x100b4fc0
|
||||
void MxPresenter::ParseExtra()
|
||||
{
|
||||
// TODO
|
||||
|
||||
MxAutoLocker lock(&m_criticalSection);
|
||||
MxU32 len = m_action->GetExtraLength();
|
||||
char *extraData = m_action->GetExtraData();
|
||||
|
||||
if (len) {
|
||||
len &= MAXWORD;
|
||||
char extraCopy[512];
|
||||
memcpy(extraCopy, extraData, len);
|
||||
extraCopy[len] = '\0';
|
||||
|
||||
char t_worldValue[512];
|
||||
if (KeyValueStringParse(t_worldValue, g_strWORLD, extraCopy)) {
|
||||
char *token = strtok(t_worldValue, g_parseExtraTokens);
|
||||
char t_token[256];
|
||||
strcpy(t_token, token);
|
||||
|
||||
token = strtok(NULL, g_parseExtraTokens);
|
||||
int val = token ? atoi(token) : 0;
|
||||
|
||||
int result = MxOmni::GetInstance()->vtable0x30(t_token, val, this);
|
||||
|
||||
m_action->SetFlags(m_action->GetFlags() | MxDSAction::Flag_Parsed);
|
||||
|
||||
if (result)
|
||||
SendTo_unkPresenter(MxOmni::GetInstance());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100b5120
|
||||
void MxPresenter::SendTo_unkPresenter(MxOmni *p_omni)
|
||||
{
|
||||
if (m_unkPresenter) {
|
||||
MxAutoLocker lock(&m_criticalSection);
|
||||
|
||||
// TOOD: magic number used for notification type. replace with enum
|
||||
NotificationManager()->Send(m_unkPresenter, &MxParam(5, this));
|
||||
|
||||
m_action->SetOmni(p_omni ? p_omni : MxOmni::GetInstance());
|
||||
m_unkPresenter = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1000bf00
|
||||
|
Reference in New Issue
Block a user