2023-08-03 12:54:08 -04:00
|
|
|
#include "legoactor.h"
|
|
|
|
|
2024-04-08 08:23:31 -04:00
|
|
|
#include "define.h"
|
2024-05-03 12:19:12 -04:00
|
|
|
#include "legocachesoundmanager.h"
|
2024-04-08 08:23:31 -04:00
|
|
|
#include "legosoundmanager.h"
|
|
|
|
#include "misc.h"
|
|
|
|
#include "mxutilities.h"
|
2024-05-03 12:19:12 -04:00
|
|
|
#include "roi/legoroi.h"
|
2024-04-08 08:23:31 -04:00
|
|
|
|
2023-08-03 12:54:08 -04:00
|
|
|
DECOMP_SIZE_ASSERT(LegoActor, 0x78)
|
2023-09-30 19:25:33 -04:00
|
|
|
|
2024-02-23 12:51:49 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f32d0
|
2024-02-26 11:19:16 -05:00
|
|
|
const char* g_actorNames[] = {"none", "pepper", "mama", "papa", "nick", "laura", "The_Brickster!"};
|
2024-02-23 12:51:49 -05:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x1002d110
|
2023-09-30 19:25:33 -04:00
|
|
|
LegoActor::LegoActor()
|
|
|
|
{
|
2023-12-13 05:48:14 -05:00
|
|
|
m_unk0x68 = 0.0f;
|
2024-02-23 12:51:49 -05:00
|
|
|
m_sound = NULL;
|
2023-12-13 05:48:14 -05:00
|
|
|
m_unk0x70 = 0.0f;
|
|
|
|
m_unk0x10 = 0;
|
2024-02-26 11:19:16 -05:00
|
|
|
m_actorId = 0;
|
2023-10-24 08:37:02 -04:00
|
|
|
}
|
2024-01-14 16:28:46 -05:00
|
|
|
|
2024-02-23 12:51:49 -05:00
|
|
|
// FUNCTION: LEGO1 0x1002d320
|
2024-01-14 16:28:46 -05:00
|
|
|
LegoActor::~LegoActor()
|
|
|
|
{
|
2024-02-23 12:51:49 -05:00
|
|
|
if (m_sound) {
|
|
|
|
m_sound->FUN_10006b80();
|
|
|
|
}
|
2024-01-14 16:28:46 -05:00
|
|
|
}
|
2024-01-20 18:04:46 -05:00
|
|
|
|
2024-04-08 08:23:31 -04:00
|
|
|
// FUNCTION: LEGO1 0x1002d390
|
|
|
|
void LegoActor::ParseAction(char* p_extra)
|
2024-01-20 18:04:46 -05:00
|
|
|
{
|
2024-04-08 08:23:31 -04:00
|
|
|
MxFloat speed = 0.0F;
|
|
|
|
char value[256];
|
|
|
|
value[0] = '\0';
|
|
|
|
|
|
|
|
if (KeyValueStringParse(value, g_strATTACH_CAMERA, p_extra)) {
|
|
|
|
GetROI()->SetVisibility(FALSE);
|
|
|
|
|
|
|
|
if (value[0]) {
|
|
|
|
Mx3DPointFloat location(0.0F, 0.0F, 0.0F);
|
|
|
|
Mx3DPointFloat direction(0.0F, 0.0F, 1.0F);
|
|
|
|
Mx3DPointFloat up(0.0F, 1.0F, 0.0F);
|
|
|
|
|
|
|
|
char* token = strtok(value, g_parseExtraTokens);
|
|
|
|
if (token != NULL) {
|
|
|
|
location[0] = atof(token);
|
|
|
|
}
|
|
|
|
|
|
|
|
token = strtok(NULL, g_parseExtraTokens);
|
|
|
|
if (token != NULL) {
|
|
|
|
location[1] = atof(token);
|
|
|
|
}
|
|
|
|
|
|
|
|
token = strtok(NULL, g_parseExtraTokens);
|
|
|
|
if (token != NULL) {
|
|
|
|
location[2] = atof(token);
|
|
|
|
}
|
|
|
|
|
|
|
|
token = strtok(NULL, g_parseExtraTokens);
|
|
|
|
if (token != NULL) {
|
|
|
|
direction[0] = atof(token);
|
|
|
|
}
|
|
|
|
|
|
|
|
token = strtok(NULL, g_parseExtraTokens);
|
|
|
|
if (token != NULL) {
|
|
|
|
direction[1] = atof(token);
|
|
|
|
}
|
|
|
|
|
|
|
|
token = strtok(NULL, g_parseExtraTokens);
|
|
|
|
if (token != NULL) {
|
|
|
|
direction[2] = atof(token);
|
|
|
|
}
|
|
|
|
|
|
|
|
token = strtok(NULL, g_parseExtraTokens);
|
|
|
|
if (token != NULL) {
|
|
|
|
up[0] = atof(token);
|
|
|
|
}
|
|
|
|
|
|
|
|
token = strtok(NULL, g_parseExtraTokens);
|
|
|
|
if (token != NULL) {
|
|
|
|
up[1] = atof(token);
|
|
|
|
}
|
|
|
|
|
|
|
|
token = strtok(NULL, g_parseExtraTokens);
|
|
|
|
if (token != NULL) {
|
|
|
|
up[2] = atof(token);
|
|
|
|
}
|
|
|
|
|
|
|
|
SetWorldTransform(location, direction, up);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ResetWorldTransform(TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (KeyValueStringParse(value, g_strSPEED, p_extra)) {
|
|
|
|
speed = atof(value);
|
|
|
|
SetWorldSpeed(speed);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (KeyValueStringParse(value, g_strSOUND, p_extra)) {
|
|
|
|
m_sound = SoundManager()->GetCacheSoundManager()->FUN_1003dae0(value, GetROI()->GetName(), TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (KeyValueStringParse(value, g_strMUTE, p_extra)) {
|
|
|
|
FUN_1002d6e0(TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (KeyValueStringParse(value, g_strVISIBILITY, p_extra)) {
|
|
|
|
GetROI()->SetVisibility(strcmpi(value, "FALSE") != 0);
|
|
|
|
}
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-02-26 11:19:16 -05:00
|
|
|
// FUNCTION: LEGO1 0x1002d660
|
|
|
|
const char* LegoActor::GetActorName(MxU8 p_id)
|
|
|
|
{
|
|
|
|
return g_actorNames[p_id];
|
|
|
|
}
|
|
|
|
|
2024-02-23 12:51:49 -05:00
|
|
|
// FUNCTION: LEGO1 0x1002d670
|
2024-01-20 18:04:46 -05:00
|
|
|
void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
|
|
|
|
{
|
2024-02-23 12:51:49 -05:00
|
|
|
if (p_roi) {
|
|
|
|
const char* name = p_roi->GetName();
|
|
|
|
|
2024-02-26 11:19:16 -05:00
|
|
|
for (MxU32 i = 1; i <= _countof(g_actorNames) - 1; i++) {
|
|
|
|
if (!strcmpi(name, g_actorNames[i])) {
|
2024-04-26 10:03:13 -04:00
|
|
|
m_type = e_character;
|
2024-02-26 11:19:16 -05:00
|
|
|
m_actorId = i;
|
2024-02-23 12:51:49 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LegoEntity::SetROI(p_roi, p_bool1, p_bool2);
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
2024-04-08 08:23:31 -04:00
|
|
|
|
|
|
|
// STUB: LEGO1 0x1002d6e0
|
|
|
|
void LegoActor::FUN_1002d6e0(MxBool)
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|