Implement/match LegoActor::ParseAction (#785)

* Implement/match LegoActor::ParseAction

* Add call to parent
This commit is contained in:
Christian Semmler 2024-04-08 08:23:31 -04:00 committed by GitHub
parent cf18aa8072
commit 5cf04bc3c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 117 additions and 10 deletions

View file

@ -8,6 +8,10 @@ const char* g_strACTION = "ACTION";
// STRING: LEGO1 0x10102034 // STRING: LEGO1 0x10102034
const char* g_strANIMATION = "ANIMATION"; const char* g_strANIMATION = "ANIMATION";
// GLOBAL: LEGO1 0x10102050
// STRING: LEGO1 0x10102024
const char* g_strATTACH_CAMERA = "ATTACH_CAMERA";
// GLOBAL: LEGO1 0x1010209c // GLOBAL: LEGO1 0x1010209c
// STRING: LEGO1 0x10101f58 // STRING: LEGO1 0x10101f58
const char* g_strOBJECT = "OBJECT"; const char* g_strOBJECT = "OBJECT";
@ -16,6 +20,14 @@ const char* g_strOBJECT = "OBJECT";
// STRING: LEGO1 0x10101f20 // STRING: LEGO1 0x10101f20
const char* g_strSOUND = "SOUND"; const char* g_strSOUND = "SOUND";
// GLOBAL: LEGO1 0x101020b4
// STRING: LEGO1 0x10101f18
const char* g_strMUTE = "MUTE";
// GLOBAL: LEGO1 0x101020b8
// STRING: LEGO1 0x100f09cc
const char* g_strSPEED = "SPEED";
// GLOBAL: LEGO1 0x101020cc // GLOBAL: LEGO1 0x101020cc
// STRING: LEGO1 0x100f3808 // STRING: LEGO1 0x100f3808
const char* g_strVISIBILITY = "VISIBILITY"; const char* g_strVISIBILITY = "VISIBILITY";

View file

@ -10,5 +10,8 @@ extern const char* g_strOBJECT;
extern const char* g_strANIMATION; extern const char* g_strANIMATION;
extern const char* g_strACTION; extern const char* g_strACTION;
extern const char* g_strVISIBILITY; extern const char* g_strVISIBILITY;
extern const char* g_strSPEED;
extern const char* g_strATTACH_CAMERA;
extern const char* g_strMUTE;
#endif // DEFINE_H #endif // DEFINE_H

View file

@ -25,7 +25,7 @@ class LegoActor : public LegoEntity {
return !strcmp(p_name, LegoActor::ClassName()) || LegoEntity::IsA(p_name); return !strcmp(p_name, LegoActor::ClassName()) || LegoEntity::IsA(p_name);
} }
void ParseAction(char*) override; // vtable+0x20 void ParseAction(char* p_extra) override; // vtable+0x20
void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) override; // vtable+0x24 void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) override; // vtable+0x24
// FUNCTION: LEGO1 0x10002cc0 // FUNCTION: LEGO1 0x10002cc0
@ -49,6 +49,8 @@ class LegoActor : public LegoEntity {
static const char* GetActorName(MxU8 p_id); static const char* GetActorName(MxU8 p_id);
protected: protected:
void FUN_1002d6e0(MxBool);
MxFloat m_unk0x68; // 0x68 MxFloat m_unk0x68; // 0x68
LegoCacheSound* m_sound; // 0x6c LegoCacheSound* m_sound; // 0x6c
MxFloat m_unk0x70; // 0x70 MxFloat m_unk0x70; // 0x70

View file

@ -54,7 +54,7 @@ class LegoCacheSoundManager {
LegoCacheSound* FUN_1003d170(const char* p_key); LegoCacheSound* FUN_1003d170(const char* p_key);
LegoCacheSound* FUN_1003d290(LegoCacheSound* p_sound); LegoCacheSound* FUN_1003d290(LegoCacheSound* p_sound);
void FUN_1003dae0(const char* p_one, const char* p_two, MxBool p_three); LegoCacheSound* FUN_1003dae0(const char* p_one, const char* p_two, MxBool p_three);
LegoCacheSound* FUN_1003db10(LegoCacheSound* p_one, const char* p_two, MxBool p_three); LegoCacheSound* FUN_1003db10(LegoCacheSound* p_one, const char* p_two, MxBool p_three);
void FUN_1003dc40(LegoCacheSound** p_und); void FUN_1003dc40(LegoCacheSound** p_und);

View file

@ -29,7 +29,7 @@ class LegoPathActor : public LegoActor {
return !strcmp(p_name, LegoPathActor::ClassName()) || LegoActor::IsA(p_name); return !strcmp(p_name, LegoPathActor::ClassName()) || LegoActor::IsA(p_name);
} }
void ParseAction(char*) override; // vtable+0x20 void ParseAction(char* p_extra) override; // vtable+0x20
virtual void VTable0x68(Mx3DPointFloat&, Mx3DPointFloat&, Mx3DPointFloat&); // vtable+0x68 virtual void VTable0x68(Mx3DPointFloat&, Mx3DPointFloat&, Mx3DPointFloat&); // vtable+0x68
virtual void VTable0x6c(); // vtable+0x6c virtual void VTable0x6c(); // vtable+0x6c
virtual void VTable0x70(float p_float); // vtable+0x70 virtual void VTable0x70(float p_float); // vtable+0x70

View file

@ -104,10 +104,10 @@ LegoCacheSound* LegoCacheSoundManager::FUN_1003d290(LegoCacheSound* p_sound)
} }
// FUNCTION: LEGO1 0x1003dae0 // FUNCTION: LEGO1 0x1003dae0
void LegoCacheSoundManager::FUN_1003dae0(const char* p_one, const char* p_two, MxBool p_three) LegoCacheSound* LegoCacheSoundManager::FUN_1003dae0(const char* p_one, const char* p_two, MxBool p_three)
{ {
// DECOMP: Second parameter is LegoRoi::m_name (0xe4) // DECOMP: Second parameter is LegoRoi::m_name (0xe4)
FUN_1003db10(FUN_1003d170(p_one), p_two, p_three); return FUN_1003db10(FUN_1003d170(p_one), p_two, p_three);
} }
// FUNCTION: LEGO1 0x1003db10 // FUNCTION: LEGO1 0x1003db10

View file

@ -1,5 +1,10 @@
#include "legoactor.h" #include "legoactor.h"
#include "define.h"
#include "legosoundmanager.h"
#include "misc.h"
#include "mxutilities.h"
DECOMP_SIZE_ASSERT(LegoActor, 0x78) DECOMP_SIZE_ASSERT(LegoActor, 0x78)
// GLOBAL: LEGO1 0x100f32d0 // GLOBAL: LEGO1 0x100f32d0
@ -23,10 +28,89 @@ LegoActor::~LegoActor()
} }
} }
// STUB: LEGO1 0x1002d390 // FUNCTION: LEGO1 0x1002d390
void LegoActor::ParseAction(char*) void LegoActor::ParseAction(char* p_extra)
{ {
// TODO 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);
}
} }
// FUNCTION: LEGO1 0x1002d660 // FUNCTION: LEGO1 0x1002d660
@ -52,3 +136,9 @@ void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
LegoEntity::SetROI(p_roi, p_bool1, p_bool2); LegoEntity::SetROI(p_roi, p_bool1, p_bool2);
} }
// STUB: LEGO1 0x1002d6e0
void LegoActor::FUN_1002d6e0(MxBool)
{
// TODO
}

View file

@ -101,9 +101,9 @@ void LegoPathActor::VTable0x68(Mx3DPointFloat&, Mx3DPointFloat&, Mx3DPointFloat&
} }
// STUB: LEGO1 0x1002f020 // STUB: LEGO1 0x1002f020
void LegoPathActor::ParseAction(char*) void LegoPathActor::ParseAction(char* p_extra)
{ {
// TODO LegoActor::ParseAction(p_extra);
} }
// STUB: LEGO1 0x1002f1b0 // STUB: LEGO1 0x1002f1b0