diff --git a/LEGO1/define.cpp b/LEGO1/define.cpp index 32577f04..df5dde53 100644 --- a/LEGO1/define.cpp +++ b/LEGO1/define.cpp @@ -8,6 +8,10 @@ const char* g_strACTION = "ACTION"; // STRING: LEGO1 0x10102034 const char* g_strANIMATION = "ANIMATION"; +// GLOBAL: LEGO1 0x10102050 +// STRING: LEGO1 0x10102024 +const char* g_strATTACH_CAMERA = "ATTACH_CAMERA"; + // GLOBAL: LEGO1 0x1010209c // STRING: LEGO1 0x10101f58 const char* g_strOBJECT = "OBJECT"; @@ -16,6 +20,14 @@ const char* g_strOBJECT = "OBJECT"; // STRING: LEGO1 0x10101f20 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 // STRING: LEGO1 0x100f3808 const char* g_strVISIBILITY = "VISIBILITY"; diff --git a/LEGO1/define.h b/LEGO1/define.h index bb049a0e..9c176a11 100644 --- a/LEGO1/define.h +++ b/LEGO1/define.h @@ -10,5 +10,8 @@ extern const char* g_strOBJECT; extern const char* g_strANIMATION; extern const char* g_strACTION; extern const char* g_strVISIBILITY; +extern const char* g_strSPEED; +extern const char* g_strATTACH_CAMERA; +extern const char* g_strMUTE; #endif // DEFINE_H diff --git a/LEGO1/lego/legoomni/include/legoactor.h b/LEGO1/lego/legoomni/include/legoactor.h index 5c3fe3e0..358ca600 100644 --- a/LEGO1/lego/legoomni/include/legoactor.h +++ b/LEGO1/lego/legoomni/include/legoactor.h @@ -25,7 +25,7 @@ class LegoActor : public LegoEntity { 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 // FUNCTION: LEGO1 0x10002cc0 @@ -49,6 +49,8 @@ class LegoActor : public LegoEntity { static const char* GetActorName(MxU8 p_id); protected: + void FUN_1002d6e0(MxBool); + MxFloat m_unk0x68; // 0x68 LegoCacheSound* m_sound; // 0x6c MxFloat m_unk0x70; // 0x70 diff --git a/LEGO1/lego/legoomni/include/legocachesoundmanager.h b/LEGO1/lego/legoomni/include/legocachesoundmanager.h index 2e045621..097cc41a 100644 --- a/LEGO1/lego/legoomni/include/legocachesoundmanager.h +++ b/LEGO1/lego/legoomni/include/legocachesoundmanager.h @@ -54,7 +54,7 @@ class LegoCacheSoundManager { LegoCacheSound* FUN_1003d170(const char* p_key); 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); void FUN_1003dc40(LegoCacheSound** p_und); diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index 7b0498b5..0baddf60 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -29,7 +29,7 @@ class LegoPathActor : public LegoActor { 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 VTable0x6c(); // vtable+0x6c virtual void VTable0x70(float p_float); // vtable+0x70 diff --git a/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp b/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp index e3003756..e611484b 100644 --- a/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp +++ b/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp @@ -104,10 +104,10 @@ LegoCacheSound* LegoCacheSoundManager::FUN_1003d290(LegoCacheSound* p_sound) } // 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) - FUN_1003db10(FUN_1003d170(p_one), p_two, p_three); + return FUN_1003db10(FUN_1003d170(p_one), p_two, p_three); } // FUNCTION: LEGO1 0x1003db10 diff --git a/LEGO1/lego/legoomni/src/entity/legoactor.cpp b/LEGO1/lego/legoomni/src/entity/legoactor.cpp index 8932217e..3d41dc34 100644 --- a/LEGO1/lego/legoomni/src/entity/legoactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoactor.cpp @@ -1,5 +1,10 @@ #include "legoactor.h" +#include "define.h" +#include "legosoundmanager.h" +#include "misc.h" +#include "mxutilities.h" + DECOMP_SIZE_ASSERT(LegoActor, 0x78) // GLOBAL: LEGO1 0x100f32d0 @@ -23,10 +28,89 @@ LegoActor::~LegoActor() } } -// STUB: LEGO1 0x1002d390 -void LegoActor::ParseAction(char*) +// FUNCTION: LEGO1 0x1002d390 +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 @@ -52,3 +136,9 @@ void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) LegoEntity::SetROI(p_roi, p_bool1, p_bool2); } + +// STUB: LEGO1 0x1002d6e0 +void LegoActor::FUN_1002d6e0(MxBool) +{ + // TODO +} diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index e8f37cba..48b3ceaf 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -101,9 +101,9 @@ void LegoPathActor::VTable0x68(Mx3DPointFloat&, Mx3DPointFloat&, Mx3DPointFloat& } // STUB: LEGO1 0x1002f020 -void LegoPathActor::ParseAction(char*) +void LegoPathActor::ParseAction(char* p_extra) { - // TODO + LegoActor::ParseAction(p_extra); } // STUB: LEGO1 0x1002f1b0