2023-06-29 04:10:08 -04:00
|
|
|
#include "legoentity.h"
|
|
|
|
|
2023-09-27 15:16:46 -04:00
|
|
|
#include "legoomni.h"
|
|
|
|
#include "legoutil.h"
|
|
|
|
#include "define.h"
|
|
|
|
|
2023-08-03 14:10:54 -04:00
|
|
|
DECOMP_SIZE_ASSERT(LegoEntity, 0x68)
|
|
|
|
|
2023-06-29 04:10:08 -04:00
|
|
|
// OFFSET: LEGO1 0x1000c290
|
|
|
|
LegoEntity::~LegoEntity()
|
|
|
|
{
|
2023-10-01 09:06:29 -04:00
|
|
|
Destroy(TRUE);
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// OFFSET: LEGO1 0x100114f0 STUB
|
2023-07-02 04:05:49 -04:00
|
|
|
MxLong LegoEntity::Notify(MxParam &p)
|
2023-06-29 04:10:08 -04:00
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-10-01 09:06:29 -04:00
|
|
|
// OFFSET: LEGO1 0x100105f0
|
|
|
|
void LegoEntity::Reset()
|
|
|
|
{
|
2023-10-07 14:00:20 -04:00
|
|
|
m_vec1.Fill(0);
|
|
|
|
m_vec2.Fill(0);
|
2023-10-01 09:06:29 -04:00
|
|
|
m_unk50 = 0;
|
|
|
|
m_unk54 = 0;
|
|
|
|
m_unk58 = 0;
|
|
|
|
m_actionArgString = NULL;
|
|
|
|
m_unk10 = 0;
|
|
|
|
m_unk11 = 0;
|
|
|
|
m_actionType = ExtraActionType_unknown;
|
|
|
|
m_actionArgNumber = -1;
|
|
|
|
m_unk59 = 4;
|
|
|
|
}
|
|
|
|
|
2023-10-11 18:15:36 -04:00
|
|
|
// OFFSET: LEGO1 0x100107e0
|
|
|
|
MxResult LegoEntity::InitFromMxDSObject(MxDSObject& p_object)
|
2023-09-27 15:16:46 -04:00
|
|
|
{
|
2023-10-11 18:15:36 -04:00
|
|
|
m_mxEntityId = p_object.GetObjectId();
|
|
|
|
m_atom = p_object.GetAtomId();
|
|
|
|
AddToCurrentWorld();
|
|
|
|
return SUCCESS;
|
2023-09-27 15:16:46 -04:00
|
|
|
}
|
|
|
|
|
2023-06-29 04:10:08 -04:00
|
|
|
// OFFSET: LEGO1 0x10010810 STUB
|
2023-10-13 12:43:45 -04:00
|
|
|
void LegoEntity::Destroy(MxBool p_fromDestructor)
|
2023-06-29 04:10:08 -04:00
|
|
|
{
|
2023-10-01 09:06:29 -04:00
|
|
|
if (m_unk54) {
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
delete[] m_actionArgString;
|
|
|
|
Reset();
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
2023-09-27 15:16:46 -04:00
|
|
|
|
2023-10-11 18:15:36 -04:00
|
|
|
// OFFSET: LEGO1 0x10010880 STUB
|
|
|
|
void LegoEntity::AddToCurrentWorld()
|
|
|
|
{
|
|
|
|
LegoWorld* world = GetCurrentWorld();
|
|
|
|
if (world != NULL && world != (LegoWorld*)this)
|
|
|
|
{
|
|
|
|
// TODO: world->vtable58(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-27 15:16:46 -04:00
|
|
|
// OFFSET: LEGO1 0x10010e10
|
|
|
|
void LegoEntity::ParseAction(char *p_extra)
|
|
|
|
{
|
|
|
|
char copy[1024];
|
|
|
|
char actionValue[1024];
|
|
|
|
strcpy(copy, p_extra);
|
|
|
|
|
|
|
|
if (KeyValueStringParse(actionValue, g_strACTION, copy)) {
|
|
|
|
m_actionType = MatchActionString(strtok(actionValue, g_parseExtraTokens));
|
|
|
|
|
|
|
|
if (m_actionType != ExtraActionType_exit) {
|
|
|
|
char *token = strtok(NULL, g_parseExtraTokens);
|
|
|
|
|
|
|
|
m_actionArgString = new char[strlen(token) + 1];
|
|
|
|
strcpy(m_actionArgString, token);
|
|
|
|
|
|
|
|
if (m_actionType != ExtraActionType_run) {
|
|
|
|
m_actionArgNumber = atoi(strtok(NULL, g_parseExtraTokens));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|