Merge commit '828b35e9d2' into new-isle-decomp

This commit is contained in:
Anonymous Maarten 2024-06-25 17:55:25 +02:00
commit 8d5bfb40d9
40 changed files with 808 additions and 392 deletions

View file

@ -1,13 +1,13 @@
root = true root = true
[*.{py,txt,editorconfig}] [*.{py,txt,editorconfig}]
indent_style = space indent_style = space
indent_size = 4 indent_size = 4
insert_final_newline = true insert_final_newline = true
trim_trailing_whitespace = true trim_trailing_whitespace = true
[*.{cpp,h}] [*.{cpp,h}]
indent_style = tab indent_style = tab
tab_width = 4 tab_width = 4
insert_final_newline = true insert_final_newline = true
trim_trailing_whitespace = true trim_trailing_whitespace = true

View file

@ -355,11 +355,11 @@ add_library(lego1 SHARED
LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp
LEGO1/lego/legoomni/src/common/animstate.cpp LEGO1/lego/legoomni/src/common/animstate.cpp
LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp
LEGO1/lego/legoomni/src/common/legoactors.cpp
LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp
LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp
LEGO1/lego/legoomni/src/common/legobackgroundcolor.cpp LEGO1/lego/legoomni/src/common/legobackgroundcolor.cpp
LEGO1/lego/legoomni/src/common/legocharactermanager.cpp LEGO1/lego/legoomni/src/common/legocharactermanager.cpp
LEGO1/lego/legoomni/src/common/legocharacters.cpp
LEGO1/lego/legoomni/src/common/legofullscreenmovie.cpp LEGO1/lego/legoomni/src/common/legofullscreenmovie.cpp
LEGO1/lego/legoomni/src/common/legogamestate.cpp LEGO1/lego/legoomni/src/common/legogamestate.cpp
LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp

View file

@ -6,6 +6,7 @@
#include <dsound.h> #include <dsound.h>
class LegoActor;
class LegoROI; class LegoROI;
// VTABLE: LEGO1 0x100d5778 // VTABLE: LEGO1 0x100d5778
@ -16,25 +17,29 @@ public:
virtual ~Lego3DSound(); virtual ~Lego3DSound();
void Init(); void Init();
MxResult Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char*, MxS32 p_volume); MxResult Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char* p_name, MxS32 p_volume);
void Destroy(); void Destroy();
undefined4 FUN_100118e0(LPDIRECTSOUNDBUFFER p_directSoundBuffer); MxU32 UpdatePosition(LPDIRECTSOUNDBUFFER p_directSoundBuffer);
void FUN_10011ca0(); void FUN_10011a60(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char* p_name);
MxS32 FUN_10011cf0(undefined4, undefined4); void Reset();
MxS32 SetDistance(MxS32 p_min, MxS32 p_max);
// SYNTHETIC: LEGO1 0x10011650 // SYNTHETIC: LEGO1 0x10011650
// Lego3DSound::`scalar deleting destructor' // Lego3DSound::`scalar deleting destructor'
private: private:
undefined m_unk0x04[4]; // 0x04 LPDIRECTSOUND3DBUFFER m_ds3dBuffer; // 0x08
LPDIRECTSOUNDBUFFER m_dsBuffer; // 0x08 LegoROI* m_roi; // 0x0c
LegoROI* m_unk0x0c; // 0x0c LegoROI* m_positionROI; // 0x10
undefined4 m_unk0x10; // 0x10 MxBool m_enabled; // 0x14
MxBool m_unk0x14; // 0x14 MxBool m_isActor; // 0x15
MxBool m_unk0x15; // 0x15 LegoActor* m_actor; // 0x18
undefined4 m_unk0x18; // 0x18 double m_frequencyFactor; // 0x20
undefined m_unk0x1c[0x10]; // 0x1c DWORD m_dwFrequency; // 0x28
MxS32 m_volume; // 0x2c MxS32 m_volume; // 0x2c
}; };
// GLOBAL: LEGO1 0x100db6c0
// IID_IDirectSound3DBuffer
#endif // LEGO3DSOUND_H #endif // LEGO3DSOUND_H

View file

@ -30,10 +30,13 @@ public:
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
virtual MxFloat VTable0x50() { return m_unk0x68; } // vtable+0x50 virtual MxFloat GetSoundFrequencyFactor() { return m_frequencyFactor; } // vtable+0x50
// FUNCTION: LEGO1 0x10002cd0 // FUNCTION: LEGO1 0x10002cd0
virtual void VTable0x54(MxFloat p_unk0x68) { m_unk0x68 = p_unk0x68; } // vtable+0x54 virtual void SetSoundFrequencyFactor(MxFloat p_frequencyFactor)
{
m_frequencyFactor = p_frequencyFactor;
} // vtable+0x54
// FUNCTION: LEGO1 0x10002ce0 // FUNCTION: LEGO1 0x10002ce0
virtual void VTable0x58(MxFloat p_unk0x70) { m_unk0x70 = p_unk0x70; } // vtable+0x58 virtual void VTable0x58(MxFloat p_unk0x70) { m_unk0x70 = p_unk0x70; } // vtable+0x58
@ -52,10 +55,10 @@ public:
protected: protected:
void FUN_1002d6e0(MxBool); void FUN_1002d6e0(MxBool);
MxFloat m_unk0x68; // 0x68 MxFloat m_frequencyFactor; // 0x68
LegoCacheSound* m_sound; // 0x6c LegoCacheSound* m_sound; // 0x6c
MxFloat m_unk0x70; // 0x70 MxFloat m_unk0x70; // 0x70
MxU8 m_actorId; // 0x74 MxU8 m_actorId; // 0x74
}; };
// SYNTHETIC: LEGO1 0x1002d300 // SYNTHETIC: LEGO1 0x1002d300

View file

@ -1,5 +1,5 @@
#ifndef LEGOCHARACTERS_H #ifndef LEGOACTORS_H
#define LEGOCHARACTERS_H #define LEGOACTORS_H
#include "decomp.h" #include "decomp.h"
#include "mxtypes.h" #include "mxtypes.h"
@ -8,7 +8,7 @@ class LegoExtraActor;
class LegoROI; class LegoROI;
// SIZE 0x108 // SIZE 0x108
struct LegoCharacterInfo { struct LegoActorInfo {
// SIZE 0x18 // SIZE 0x18
struct Part { struct Part {
MxU8* m_unk0x00; // 0x00 MxU8* m_unk0x00; // 0x00
@ -29,7 +29,7 @@ struct LegoCharacterInfo {
}; };
// SIZE 0x58 // SIZE 0x58
struct LegoCharacterLOD { struct LegoActorLOD {
enum { enum {
c_flag1 = 0x01, c_flag1 = 0x01,
c_flag2 = 0x02 c_flag2 = 0x02
@ -45,7 +45,7 @@ struct LegoCharacterLOD {
float m_up[3]; // 0x4c float m_up[3]; // 0x4c
}; };
enum LegoCharacterLODs { enum LegoActorLODs {
c_topLOD, c_topLOD,
c_bodyLOD, c_bodyLOD,
c_infohatLOD, c_infohatLOD,
@ -59,7 +59,7 @@ enum LegoCharacterLODs {
c_legrtLOD c_legrtLOD
}; };
enum LegoCharacterParts { enum LegoActorParts {
c_bodyPart, c_bodyPart,
c_infohatPart, c_infohatPart,
c_infogronPart, c_infogronPart,
@ -72,7 +72,7 @@ enum LegoCharacterParts {
c_legrtPart c_legrtPart
}; };
extern LegoCharacterInfo g_characterInfoInit[66]; extern LegoActorInfo g_actorInfoInit[66];
extern LegoCharacterLOD g_characterLODs[11]; extern LegoActorLOD g_actorLODs[11];
#endif // LEGOCHARACTERS_H #endif // LEGOACTORS_H

View file

@ -12,7 +12,7 @@
struct LegoCacheSoundEntry { struct LegoCacheSoundEntry {
LegoCacheSoundEntry() : m_sound(NULL), m_name(NULL) {} LegoCacheSoundEntry() : m_sound(NULL), m_name(NULL) {}
LegoCacheSoundEntry(LegoCacheSound* p_sound, const char* p_name) : m_sound(p_sound), m_name(p_name) {} LegoCacheSoundEntry(LegoCacheSound* p_sound, const char* p_name) : m_sound(p_sound), m_name(p_name) {}
LegoCacheSoundEntry(LegoCacheSound* p_sound) : m_sound(p_sound), m_name(p_sound->GetString0x48().GetData()) {} LegoCacheSoundEntry(LegoCacheSound* p_sound) : m_sound(p_sound), m_name(p_sound->GetUnknown0x48().GetData()) {}
// FUNCTION: LEGO1 0x1003d030 // FUNCTION: LEGO1 0x1003d030
~LegoCacheSoundEntry() ~LegoCacheSoundEntry()
@ -56,11 +56,12 @@ public:
LegoCacheSound* FindSoundByKey(const char* p_key); LegoCacheSound* FindSoundByKey(const char* p_key);
LegoCacheSound* ManageSoundEntry(LegoCacheSound* p_sound); LegoCacheSound* ManageSoundEntry(LegoCacheSound* p_sound);
LegoCacheSound* FUN_1003dae0(const char* p_one, const char* p_two, MxBool p_three); LegoCacheSound* Play(const char* p_key, const char* p_name, MxBool p_looping);
LegoCacheSound* FUN_1003db10(LegoCacheSound* p_one, const char* p_two, MxBool p_three); void Destroy(LegoCacheSound*& p_sound);
void FUN_1003dc40(LegoCacheSound** p_und);
private: private:
LegoCacheSound* Play(LegoCacheSound* p_sound, const char* p_name, MxBool p_looping);
Set100d6b4c m_set; // 0x04 Set100d6b4c m_set; // 0x04
List100d6b4c m_list; // 0x14 List100d6b4c m_list; // 0x14
}; };

View file

@ -26,38 +26,46 @@ public:
return !strcmp(p_name, LegoCacheSound::ClassName()) || MxCore::IsA(p_name); return !strcmp(p_name, LegoCacheSound::ClassName()) || MxCore::IsA(p_name);
} }
virtual MxResult FUN_10006710(); // vtable+0x14 virtual MxResult Create(
LPPCMWAVEFORMAT p_pwfx,
MxString p_mediaSrcPath,
MxS32 p_volume,
MxU8* p_data,
MxU32 p_dataSize
); // vtable+0x14
virtual void Destroy(); // vtable+0x18 virtual void Destroy(); // vtable+0x18
virtual void FUN_10006cd0(undefined4, undefined4); // vtable+0x1c virtual void FUN_10006cd0(undefined4, undefined4); // vtable+0x1c
inline const MxString& GetString0x48() const { return m_string0x48; } inline const MxString& GetUnknown0x48() const { return m_unk0x48; }
inline const undefined GetUnk0x58() const { return m_unk0x58; } inline const MxBool GetUnknown0x58() const { return m_unk0x58; }
LegoCacheSound* FUN_10006960(); LegoCacheSound* Clone();
MxResult FUN_10006a30(const char* p_str, MxBool); MxResult Play(const char* p_name, MxBool p_looping);
void FUN_10006b80(); void FUN_10006b80();
void FUN_10006be0(); void FUN_10006be0();
void FUN_10006cb0(undefined4 p_und1, undefined4 p_und2); void SetDistance(MxS32 p_min, MxS32 p_max);
// SYNTHETIC: LEGO1 0x10006610 // SYNTHETIC: LEGO1 0x10006610
// LegoCacheSound::`scalar deleting destructor' // LegoCacheSound::`scalar deleting destructor'
private: private:
void Init(); void Init();
void CopyData(MxU8* p_data, MxU32 p_dataSize);
MxString FUN_10006d80(const MxString& p_str);
LPDIRECTSOUNDBUFFER m_dsBuffer; // 0x08 LPDIRECTSOUNDBUFFER m_dsBuffer; // 0x08
undefined m_unk0xc[4]; // 0x0c undefined m_unk0x0c[4]; // 0x0c
Lego3DSound m_unk0x10; // 0x10 Lego3DSound m_sound; // 0x10
undefined* m_unk0x40; // 0x40 MxU8* m_data; // 0x40
undefined4 m_unk0x44; // 0x44 MxU32 m_dataSize; // 0x44
MxString m_string0x48; // 0x48 MxString m_unk0x48; // 0x48
undefined m_unk0x58; // 0x58 MxBool m_unk0x58; // 0x58
PCMWAVEFORMAT m_unk0x59; // 0x59 PCMWAVEFORMAT m_wfx; // 0x59
MxBool m_isLooping; // 0x69 MxBool m_looping; // 0x69
MxBool m_unk0x6a; // 0x6a MxBool m_unk0x6a; // 0x6a
undefined4 m_unk0x6c; // 0x6c MxS32 m_volume; // 0x6c
undefined m_unk0x70; // 0x70 MxBool m_unk0x70; // 0x70
MxString m_string0x74; // 0x74 MxString m_unk0x74; // 0x74
undefined m_unk0x84; // 0x84 undefined m_unk0x84; // 0x84
}; };

View file

@ -41,7 +41,7 @@ struct LegoCharacter {
MxU32 m_refCount; // 0x04 MxU32 m_refCount; // 0x04
}; };
struct LegoCharacterInfo; struct LegoActorInfo;
typedef map<char*, LegoCharacter*, LegoCharacterComparator> LegoCharacterMap; typedef map<char*, LegoCharacter*, LegoCharacterComparator> LegoCharacterMap;
@ -53,32 +53,32 @@ public:
MxResult Write(LegoStorage* p_storage); MxResult Write(LegoStorage* p_storage);
MxResult Read(LegoStorage* p_storage); MxResult Read(LegoStorage* p_storage);
LegoROI* GetROI(const char* p_key, MxBool p_createEntity); LegoROI* GetActorROI(const char* p_name, MxBool p_createEntity);
void Init(); void Init();
static void SetCustomizeAnimFile(const char* p_value); static void SetCustomizeAnimFile(const char* p_value);
static MxBool Exists(const char* p_key); static MxBool IsActor(const char* p_name);
void FUN_100832a0(); void ReleaseAllActors();
MxBool FUN_10083b20(const char* p_key); MxBool Exists(const char* p_name);
MxU32 GetRefCount(LegoROI* p_roi); MxU32 GetRefCount(LegoROI* p_roi);
void FUN_10083c30(const char* p_name); void ReleaseActor(const char* p_name);
void FUN_10083db0(LegoROI* p_roi); void ReleaseActor(LegoROI* p_roi);
void FUN_10083f10(LegoROI* p_roi); void ReleaseAutoROI(LegoROI* p_roi);
MxBool FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_textureInfo); MxBool FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_textureInfo);
LegoExtraActor* GetActor(const char* p_key); LegoExtraActor* GetExtraActor(const char* p_name);
LegoCharacterInfo* GetInfo(const char* p_key); LegoActorInfo* GetActorInfo(const char* p_name);
LegoCharacterInfo* GetInfo(LegoROI* p_roi); LegoActorInfo* GetActorInfo(LegoROI* p_roi);
MxBool SwitchHat(LegoROI* p_roi); MxBool SwitchHat(LegoROI* p_roi);
MxU32 FUN_10085140(LegoROI* p_roi, MxBool p_und); MxU32 FUN_10085140(LegoROI* p_roi, MxBool p_und);
MxU8 GetMood(LegoROI* p_roi); MxU8 GetMood(LegoROI* p_roi);
LegoROI* FUN_10085210(const char* p_name, const char* p_lodName, MxBool p_createEntity); LegoROI* CreateAutoROI(const char* p_name, const char* p_lodName, MxBool p_createEntity);
LegoROI* FUN_10085a80(const char* p_name, const char* p_lodName, MxBool p_createEntity); LegoROI* FUN_10085a80(const char* p_name, const char* p_lodName, MxBool p_createEntity);
static const char* GetCustomizeAnimFile() { return g_customizeAnimFile; } static const char* GetCustomizeAnimFile() { return g_customizeAnimFile; }
private: private:
LegoROI* CreateROI(const char* p_key); LegoROI* CreateActorROI(const char* p_key);
void RemoveROI(LegoROI* p_roi); void RemoveROI(LegoROI* p_roi);
LegoROI* FindChildROI(LegoROI* p_roi, const char* p_name); LegoROI* FindChildROI(LegoROI* p_roi, const char* p_name);
MxResult FUN_10085870(LegoROI* p_roi); MxResult FUN_10085870(LegoROI* p_roi);

View file

@ -14,16 +14,16 @@ class Vector3;
class LegoEntity : public MxEntity { class LegoEntity : public MxEntity {
public: public:
enum Type { enum Type {
e_character = 0, e_actor = 0,
e_unk1, e_unk1,
e_plant, e_plant,
e_building, e_building,
e_unk4 e_autoROI
}; };
enum { enum {
c_bit1 = 0x01, c_bit1 = 0x01,
c_bit2 = 0x02 c_managerOwned = 0x02
}; };
enum { enum {

View file

@ -37,10 +37,10 @@ private:
void Destroy(MxBool p_fromDestructor); void Destroy(MxBool p_fromDestructor);
LegoCacheSound* m_cacheSound; // 0x6c LegoCacheSound* m_cacheSound; // 0x6c
undefined* m_unk0x70; // 0x70 MxU8* m_data; // 0x70
undefined* m_unk0x74; // 0x74 MxU8* m_pData; // 0x74
undefined4 m_unk0x78; // 0x78 MxU32 m_dataSize; // 0x78
undefined m_unk0x7c; // 0x7c MxBool m_unk0x7c; // 0x7c
PCMWAVEFORMAT m_pcmWaveFormat; // 0x7d PCMWAVEFORMAT m_pcmWaveFormat; // 0x7d
}; };

View file

@ -19,7 +19,7 @@ public:
// SYNTHETIC: LEGO1 0x10029920 // SYNTHETIC: LEGO1 0x10029920
// LegoSoundManager::`scalar deleting destructor' // LegoSoundManager::`scalar deleting destructor'
void FUN_1002a410(const float* p_pos, const float* p_dir, const float* p_up, const float* p_vel); void UpdateListener(const float* p_position, const float* p_direction, const float* p_up, const float* p_velocity);
inline LegoCacheSoundManager* GetCacheSoundManager() { return m_cacheSoundManager; } inline LegoCacheSoundManager* GetCacheSoundManager() { return m_cacheSoundManager; }

View file

@ -1,14 +1,14 @@
#ifndef LEGOWORLD_H #ifndef LEGOWORLD_H
#define LEGOWORLD_H #define LEGOWORLD_H
#include "legocachesoundlist.h"
#include "legoentity.h" #include "legoentity.h"
#include "legoentitylist.h"
#include "legopathcontrollerlist.h" #include "legopathcontrollerlist.h"
#include "mxpresenterlist.h" #include "mxpresenterlist.h"
#include "roi/legoroi.h" #include "roi/legoroi.h"
class LegoCacheSoundList;
class LegoCameraController; class LegoCameraController;
class LegoEntityList;
class LegoPathBoundary; class LegoPathBoundary;
class LegoHideAnimPresenter; class LegoHideAnimPresenter;

View file

@ -1,9 +1,14 @@
#include "lego3dsound.h" #include "lego3dsound.h"
#include "legoactor.h"
#include "legocharactermanager.h" #include "legocharactermanager.h"
#include "legosoundmanager.h"
#include "legovideomanager.h"
#include "misc.h" #include "misc.h"
#include "mxomni.h" #include "mxomni.h"
#include <vec.h>
DECOMP_SIZE_ASSERT(Lego3DSound, 0x30) DECOMP_SIZE_ASSERT(Lego3DSound, 0x30)
// FUNCTION: LEGO1 0x10011630 // FUNCTION: LEGO1 0x10011630
@ -21,31 +26,83 @@ Lego3DSound::~Lego3DSound()
// FUNCTION: LEGO1 0x10011680 // FUNCTION: LEGO1 0x10011680
void Lego3DSound::Init() void Lego3DSound::Init()
{ {
m_dsBuffer = NULL; m_ds3dBuffer = NULL;
m_unk0x0c = NULL; m_roi = NULL;
m_unk0x10 = 0; m_positionROI = NULL;
m_unk0x18 = 0; m_actor = NULL;
m_unk0x14 = FALSE; m_enabled = FALSE;
m_unk0x15 = FALSE; m_isActor = FALSE;
m_volume = 79; m_volume = 79;
} }
// STUB: LEGO1 0x100116a0 // FUNCTION: LEGO1 0x100116a0
// FUNCTION: BETA10 0x10039647 // FUNCTION: BETA10 0x10039647
MxResult Lego3DSound::Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char*, MxS32 p_volume) MxResult Lego3DSound::Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char* p_name, MxS32 p_volume)
{ {
m_volume = p_volume; m_volume = p_volume;
if (MxOmni::IsSound3D()) { if (MxOmni::IsSound3D()) {
p_directSoundBuffer->QueryInterface(IID_IDirectSoundBuffer, (LPVOID*) &m_dsBuffer); p_directSoundBuffer->QueryInterface(IID_IDirectSound3DBuffer, (LPVOID*) &m_ds3dBuffer);
if (m_dsBuffer == NULL) { if (m_ds3dBuffer == NULL) {
return FAILURE; return FAILURE;
} }
// TODO m_ds3dBuffer->SetMinDistance(15.0f, DS3D_IMMEDIATE);
m_ds3dBuffer->SetMaxDistance(100.0f, DS3D_IMMEDIATE);
m_ds3dBuffer->SetPosition(0.0f, 0.0f, -40.0f, DS3D_IMMEDIATE);
m_ds3dBuffer->SetConeOutsideVolume(-10000, DS3D_IMMEDIATE);
} }
// TODO if (m_ds3dBuffer == NULL || p_name == NULL) {
return SUCCESS;
}
if (CharacterManager()->IsActor(p_name)) {
m_roi = CharacterManager()->GetActorROI(p_name, TRUE);
m_enabled = m_isActor = TRUE;
}
else {
m_roi = FindROI(p_name);
}
if (m_roi == NULL) {
m_roi = CharacterManager()->CreateAutoROI(NULL, p_name, TRUE);
if (m_roi != NULL) {
m_enabled = TRUE;
}
}
if (m_roi == NULL) {
return SUCCESS;
}
if (m_isActor) {
m_positionROI = m_roi->FindChildROI("head", m_roi);
}
else {
m_positionROI = m_roi;
}
if (MxOmni::IsSound3D()) {
const float* position = m_positionROI->GetWorldPosition();
m_ds3dBuffer->SetPosition(position[0], position[1], position[2], DS3D_IMMEDIATE);
}
LegoEntity* entity = m_roi->GetEntity();
if (entity != NULL && entity->IsA("LegoActor") && ((LegoActor*) entity)->GetSoundFrequencyFactor() != 0.0f) {
m_actor = ((LegoActor*) entity);
}
p_directSoundBuffer->GetFrequency(&m_dwFrequency);
if (m_actor != NULL) {
m_frequencyFactor = m_actor->GetSoundFrequencyFactor();
if (m_frequencyFactor != 0.0) {
p_directSoundBuffer->SetFrequency(m_frequencyFactor * m_dwFrequency);
}
}
return SUCCESS; return SUCCESS;
} }
@ -53,40 +110,203 @@ MxResult Lego3DSound::Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char
// FUNCTION: LEGO1 0x10011880 // FUNCTION: LEGO1 0x10011880
void Lego3DSound::Destroy() void Lego3DSound::Destroy()
{ {
if (m_dsBuffer) { if (m_ds3dBuffer) {
m_dsBuffer->Release(); m_ds3dBuffer->Release();
m_dsBuffer = NULL; m_ds3dBuffer = NULL;
} }
if (m_unk0x14 && m_unk0x0c && CharacterManager()) { if (m_enabled && m_roi && CharacterManager()) {
if (m_unk0x15) { if (m_isActor) {
CharacterManager()->FUN_10083db0(m_unk0x0c); CharacterManager()->ReleaseActor(m_roi);
} }
else { else {
CharacterManager()->FUN_10083f10(m_unk0x0c); CharacterManager()->ReleaseAutoROI(m_roi);
} }
} }
Init(); Init();
} }
// STUB: LEGO1 0x100118e0 // FUNCTION: LEGO1 0x100118e0
// FUNCTION: BETA10 0x10039a2a // FUNCTION: BETA10 0x10039a2a
undefined4 Lego3DSound::FUN_100118e0(LPDIRECTSOUNDBUFFER p_directSoundBuffer) MxU32 Lego3DSound::UpdatePosition(LPDIRECTSOUNDBUFFER p_directSoundBuffer)
{ {
// TODO MxU32 updated = FALSE;
return 0;
if (m_positionROI != NULL) {
const float* position = m_positionROI->GetWorldPosition();
ViewROI* pov = VideoManager()->GetViewROI();
assert(pov);
const float* povPosition = pov->GetWorldPosition();
float distance = DISTSQRD3(povPosition, position);
if (distance > 10000.0f) {
return FALSE;
}
if (m_ds3dBuffer != NULL) {
m_ds3dBuffer->SetPosition(position[0], position[1], position[2], DS3D_IMMEDIATE);
}
else {
MxS32 newVolume = m_volume;
if (distance < 100.0f) {
newVolume = m_volume;
}
else if (distance < 400.0f) {
newVolume *= 0.4;
}
else if (distance < 3600.0f) {
newVolume *= 0.1;
}
else if (distance < 10000.0f) {
newVolume = 0;
}
newVolume = newVolume * SoundManager()->GetVolume() / 100;
newVolume = SoundManager()->GetAttenuation(newVolume);
p_directSoundBuffer->SetVolume(newVolume);
}
updated = TRUE;
}
if (m_actor != NULL) {
if (abs(m_frequencyFactor - m_actor->GetSoundFrequencyFactor()) > 0.0001) {
m_frequencyFactor = m_actor->GetSoundFrequencyFactor();
p_directSoundBuffer->SetFrequency(m_frequencyFactor * m_dwFrequency);
updated = TRUE;
}
}
return updated;
} }
// STUB: LEGO1 0x10011ca0 // FUNCTION: LEGO1 0x10011a60
void Lego3DSound::FUN_10011ca0() // FUNCTION: BETA10 0x10039d04
void Lego3DSound::FUN_10011a60(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char* p_name)
{ {
// TODO assert(p_directSoundBuffer);
if (p_name == NULL) {
if (m_ds3dBuffer != NULL) {
m_ds3dBuffer->SetMode(DS3DMODE_DISABLE, DS3D_IMMEDIATE);
}
}
else {
if (CharacterManager()->IsActor(p_name)) {
m_roi = CharacterManager()->GetActorROI(p_name, TRUE);
m_enabled = m_isActor = TRUE;
}
else {
m_roi = FindROI(p_name);
}
if (m_roi == NULL) {
m_roi = CharacterManager()->CreateAutoROI(NULL, p_name, TRUE);
if (m_roi != NULL) {
m_enabled = TRUE;
}
}
if (m_roi == NULL) {
return;
}
if (m_isActor) {
m_positionROI = m_roi->FindChildROI("head", m_roi);
}
else {
m_positionROI = m_roi;
}
if (m_ds3dBuffer != NULL) {
DWORD dwMode;
m_ds3dBuffer->GetMode(&dwMode);
if (dwMode & DS3DMODE_DISABLE) {
m_ds3dBuffer->SetMode(DS3DMODE_NORMAL, DS3D_IMMEDIATE);
}
const float* position = m_positionROI->GetWorldPosition();
m_ds3dBuffer->SetPosition(position[0], position[1], position[2], DS3D_IMMEDIATE);
}
else {
const float* position = m_positionROI->GetWorldPosition();
ViewROI* pov = VideoManager()->GetViewROI();
if (pov != NULL) {
const float* povPosition = pov->GetWorldPosition();
float distance = DISTSQRD3(povPosition, position);
MxS32 newVolume;
if (distance < 100.0f) {
newVolume = m_volume;
}
else if (distance < 400.0f) {
newVolume = m_volume * 0.4;
}
else if (distance < 3600.0f) {
newVolume = m_volume * 0.1;
}
else {
newVolume = 0;
}
newVolume = newVolume * SoundManager()->GetVolume() / 100;
newVolume = SoundManager()->GetAttenuation(newVolume);
p_directSoundBuffer->SetVolume(newVolume);
}
}
LegoEntity* entity = m_roi->GetEntity();
if (entity != NULL && entity->IsA("LegoActor") && ((LegoActor*) entity)->GetSoundFrequencyFactor() != 0.0f) {
m_actor = ((LegoActor*) entity);
}
p_directSoundBuffer->GetFrequency(&m_dwFrequency);
if (m_actor != NULL) {
m_frequencyFactor = m_actor->GetSoundFrequencyFactor();
if (m_frequencyFactor != 0.0) {
p_directSoundBuffer->SetFrequency(m_frequencyFactor * m_dwFrequency);
}
}
}
} }
// STUB: LEGO1 0x10011cf0 // FUNCTION: LEGO1 0x10011ca0
MxS32 Lego3DSound::FUN_10011cf0(undefined4, undefined4) void Lego3DSound::Reset()
{ {
// TODO if (m_enabled && m_roi && CharacterManager()) {
return 0; if (m_isActor) {
CharacterManager()->ReleaseActor(m_roi);
}
else {
CharacterManager()->ReleaseAutoROI(m_roi);
}
}
m_roi = NULL;
m_positionROI = NULL;
m_actor = NULL;
}
// FUNCTION: LEGO1 0x10011cf0
MxS32 Lego3DSound::SetDistance(MxS32 p_min, MxS32 p_max)
{
if (MxOmni::IsSound3D()) {
if (m_ds3dBuffer == NULL) {
return -1;
}
m_ds3dBuffer->SetMinDistance(p_min, DS3D_IMMEDIATE);
m_ds3dBuffer->SetMaxDistance(p_max, DS3D_IMMEDIATE);
return 0;
}
return 1;
} }

View file

@ -62,5 +62,5 @@ void Lego3DWavePresenter::StartingTickle()
void Lego3DWavePresenter::StreamingTickle() void Lego3DWavePresenter::StreamingTickle()
{ {
MxWavePresenter::StreamingTickle(); MxWavePresenter::StreamingTickle();
m_sound.FUN_100118e0(m_dsBuffer); m_sound.UpdatePosition(m_dsBuffer);
} }

View file

@ -37,7 +37,7 @@ MxResult LegoCacheSoundManager::Tickle()
for (Set100d6b4c::iterator setIter = m_set.begin(); setIter != m_set.end(); setIter++) { for (Set100d6b4c::iterator setIter = m_set.begin(); setIter != m_set.end(); setIter++) {
#endif #endif
LegoCacheSound* sound = (*setIter).GetSound(); LegoCacheSound* sound = (*setIter).GetSound();
if (sound->GetUnk0x58()) { if (sound->GetUnknown0x58()) {
sound->FUN_10006be0(); sound->FUN_10006be0();
} }
} }
@ -46,7 +46,7 @@ MxResult LegoCacheSoundManager::Tickle()
while (listIter != m_list.end()) { while (listIter != m_list.end()) {
LegoCacheSound* sound = (*listIter).GetSound(); LegoCacheSound* sound = (*listIter).GetSound();
if (sound->GetUnk0x58()) { if (sound->GetUnknown0x58()) {
sound->FUN_10006be0(); sound->FUN_10006be0();
listIter++; listIter++;
} }
@ -84,7 +84,7 @@ LegoCacheSound* LegoCacheSoundManager::ManageSoundEntry(LegoCacheSound* p_sound)
if (it != m_set.end()) { if (it != m_set.end()) {
LegoCacheSound* sound = (*it).GetSound(); LegoCacheSound* sound = (*it).GetSound();
if (sound->GetUnk0x58()) { if (sound->GetUnknown0x58()) {
m_list.push_back(LegoCacheSoundEntry(p_sound)); m_list.push_back(LegoCacheSoundEntry(p_sound));
return p_sound; return p_sound;
} }
@ -104,53 +104,48 @@ LegoCacheSound* LegoCacheSoundManager::ManageSoundEntry(LegoCacheSound* p_sound)
} }
// FUNCTION: LEGO1 0x1003dae0 // FUNCTION: LEGO1 0x1003dae0
LegoCacheSound* LegoCacheSoundManager::FUN_1003dae0(const char* p_one, const char* p_two, MxBool p_three) LegoCacheSound* LegoCacheSoundManager::Play(const char* p_key, const char* p_name, MxBool p_looping)
{ {
// DECOMP: Second parameter is LegoRoi::m_name (0xe4) return Play(FindSoundByKey(p_key), p_name, p_looping);
return FUN_1003db10(FindSoundByKey(p_one), p_two, p_three);
} }
// FUNCTION: LEGO1 0x1003db10 // FUNCTION: LEGO1 0x1003db10
LegoCacheSound* LegoCacheSoundManager::FUN_1003db10(LegoCacheSound* p_one, const char* p_two, MxBool p_three) LegoCacheSound* LegoCacheSoundManager::Play(LegoCacheSound* p_sound, const char* p_name, MxBool p_looping)
{ {
if (!p_one) { if (!p_sound) {
return NULL; return NULL;
} }
if (p_one->GetUnk0x58()) { if (p_sound->GetUnknown0x58()) {
LegoCacheSound* result = p_one->FUN_10006960(); LegoCacheSound* clone = p_sound->Clone();
if (result) { if (clone) {
LegoCacheSound* t = ManageSoundEntry(result); LegoCacheSound* sound = ManageSoundEntry(clone);
t->FUN_10006a30(p_two, p_three); sound->Play(p_name, p_looping);
return t; return sound;
} }
} }
else { else {
p_one->FUN_10006a30(p_two, p_three); p_sound->Play(p_name, p_looping);
return p_one; return p_sound;
} }
return NULL; return NULL;
} }
// FUNCTION: LEGO1 0x1003dc40 // FUNCTION: LEGO1 0x1003dc40
void LegoCacheSoundManager::FUN_1003dc40(LegoCacheSound** p_und) void LegoCacheSoundManager::Destroy(LegoCacheSound*& p_sound)
{ {
// Called during LegoWorld::Destroy like this:
// SoundManager()->GetCacheSoundManager()->FUN_1003dc40(&sound);
// LegoCacheSound*& p_sound?
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
Set100d6b4c::iterator setIter; Set100d6b4c::iterator setIter;
for (setIter = m_set.begin(); setIter != m_set.end(); setIter++) { for (setIter = m_set.begin(); setIter != m_set.end(); setIter++) {
#else #else
for (Set100d6b4c::iterator setIter = m_set.begin(); setIter != m_set.end(); setIter++) { for (Set100d6b4c::iterator setIter = m_set.begin(); setIter != m_set.end(); setIter++) {
#endif #endif
if ((*setIter).GetSound() == *p_und) { if ((*setIter).GetSound() == p_sound) {
(*p_und)->FUN_10006b80(); p_sound->FUN_10006b80();
delete *p_und; delete p_sound;
m_set.erase(setIter); m_set.erase(setIter);
return; return;
} }
@ -167,8 +162,8 @@ void LegoCacheSoundManager::FUN_1003dc40(LegoCacheSound** p_und)
} }
LegoCacheSound* sound = (*listIter).GetSound(); LegoCacheSound* sound = (*listIter).GetSound();
if (sound == *p_und) { if (sound == p_sound) {
(*p_und)->FUN_10006b80(); p_sound->FUN_10006b80();
delete sound; delete sound;
m_list.erase(listIter); m_list.erase(listIter);

View file

@ -12,10 +12,9 @@ LegoCacheSound::LegoCacheSound()
Init(); Init();
} }
// STUB: LEGO1 0x10006630 // FUNCTION: LEGO1 0x10006630
LegoCacheSound::~LegoCacheSound() LegoCacheSound::~LegoCacheSound()
{ {
// TODO
Destroy(); Destroy();
} }
@ -23,38 +22,85 @@ LegoCacheSound::~LegoCacheSound()
void LegoCacheSound::Init() void LegoCacheSound::Init()
{ {
m_dsBuffer = NULL; m_dsBuffer = NULL;
m_unk0x40 = NULL; m_data = NULL;
m_unk0x58 = 0; m_unk0x58 = FALSE;
memset(&m_unk0x59, 0, sizeof(m_unk0x59)); memset(&m_wfx, 0, sizeof(m_wfx));
m_unk0x6a = FALSE; m_unk0x6a = FALSE;
m_unk0x70 = 0; m_unk0x70 = FALSE;
m_isLooping = TRUE; m_looping = TRUE;
m_unk0x6c = 79; m_volume = 79;
m_unk0x84 = 0; m_unk0x84 = 0;
} }
// STUB: LEGO1 0x10006710 // FUNCTION: LEGO1 0x10006710
MxResult LegoCacheSound::FUN_10006710() // FUNCTION: BETA10 0x10066505
MxResult LegoCacheSound::Create(
LPPCMWAVEFORMAT p_pwfx,
MxString p_mediaSrcPath,
MxS32 p_volume,
MxU8* p_data,
MxU32 p_dataSize
)
{ {
// TODO WAVEFORMATEX wfx;
wfx.wFormatTag = p_pwfx->wf.wFormatTag;
wfx.nChannels = p_pwfx->wf.nChannels;
wfx.nSamplesPerSec = p_pwfx->wf.nSamplesPerSec;
wfx.nAvgBytesPerSec = p_pwfx->wf.nAvgBytesPerSec;
wfx.nBlockAlign = p_pwfx->wf.nBlockAlign;
wfx.wBitsPerSample = p_pwfx->wBitsPerSample;
wfx.cbSize = 0;
DSBUFFERDESC desc; DSBUFFERDESC desc;
memset(&desc, 0, sizeof(desc)); memset(&desc, 0, sizeof(desc));
desc.dwSize = sizeof(desc); desc.dwSize = sizeof(desc);
if (MxOmni::IsSound3D()) { if (MxOmni::IsSound3D()) {
desc.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_CTRL3D; desc.dwFlags =
DSBCAPS_STATIC | DSBCAPS_LOCSOFTWARE | DSBCAPS_CTRL3D | DSBCAPS_CTRLFREQUENCY | DSBCAPS_CTRLVOLUME;
} }
else { else {
desc.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_CTRLVOLUME; desc.dwFlags = DSBCAPS_CTRLFREQUENCY | DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME;
} }
desc.dwBufferBytes = p_dataSize;
desc.lpwfxFormat = &wfx;
if (SoundManager()->GetDirectSound()->CreateSoundBuffer(&desc, &m_dsBuffer, NULL) != DS_OK) { if (SoundManager()->GetDirectSound()->CreateSoundBuffer(&desc, &m_dsBuffer, NULL) != DS_OK) {
return FAILURE; return FAILURE;
} }
m_volume = p_volume;
MxS32 volume = m_volume * SoundManager()->GetVolume() / 100;
MxS32 attenuation = SoundManager()->GetAttenuation(volume);
m_dsBuffer->SetVolume(attenuation);
if (m_sound.Create(m_dsBuffer, NULL, m_volume) != SUCCESS) {
m_dsBuffer->Release();
m_dsBuffer = NULL;
return FAILURE;
}
if (p_data != NULL && p_dataSize != 0) {
CopyData(p_data, p_dataSize);
}
m_unk0x48 = FUN_10006d80(p_mediaSrcPath);
m_wfx = *p_pwfx;
return SUCCESS; return SUCCESS;
} }
// FUNCTION: LEGO1 0x100068e0
// FUNCTION: BETA10 0x100667a0
void LegoCacheSound::CopyData(MxU8* p_data, MxU32 p_dataSize)
{
delete[] m_data;
m_dataSize = p_dataSize;
m_data = new MxU8[m_dataSize];
memcpy(m_data, p_data, m_dataSize);
}
// FUNCTION: LEGO1 0x10006920 // FUNCTION: LEGO1 0x10006920
void LegoCacheSound::Destroy() void LegoCacheSound::Destroy()
{ {
@ -64,26 +110,73 @@ void LegoCacheSound::Destroy()
m_dsBuffer = NULL; m_dsBuffer = NULL;
} }
delete m_unk0x40; delete[] m_data;
Init(); Init();
} }
// STUB: LEGO1 0x10006960 // FUNCTION: LEGO1 0x10006960
LegoCacheSound* LegoCacheSound::FUN_10006960() // FUNCTION: BETA10 0x100668cf
LegoCacheSound* LegoCacheSound::Clone()
{ {
// TODO LegoCacheSound* pnew = new LegoCacheSound();
if (pnew->Create(&m_wfx, m_unk0x48, m_volume, m_data, m_dataSize) == SUCCESS) {
return pnew;
}
delete pnew;
return NULL; return NULL;
} }
// STUB: LEGO1 0x10006a30 // FUNCTION: LEGO1 0x10006a30
MxResult LegoCacheSound::FUN_10006a30(const char* p_str, MxBool) // FUNCTION: BETA10 0x10066a23
MxResult LegoCacheSound::Play(const char* p_name, MxBool p_looping)
{ {
// TODO if (m_data == NULL || m_dataSize == 0) {
// gets param2 from FUN_1003db10
if (!m_unk0x40 && !m_unk0x44) {
return FAILURE; return FAILURE;
} }
m_unk0x6a = FALSE;
m_sound.FUN_10011a60(m_dsBuffer, p_name);
if (p_name != NULL) {
m_unk0x74 = p_name;
}
DWORD dwStatus;
m_dsBuffer->GetStatus(&dwStatus);
if (dwStatus == DSBSTATUS_BUFFERLOST) {
m_dsBuffer->Restore();
m_dsBuffer->GetStatus(&dwStatus);
}
if (dwStatus != DSBSTATUS_BUFFERLOST) {
LPVOID pvAudioPtr1, pvAudioPtr2;
DWORD dwAudioBytes1, dwAudioBytes2;
if (m_dsBuffer->Lock(0, m_dataSize, &pvAudioPtr1, &dwAudioBytes1, &pvAudioPtr2, &dwAudioBytes2, 0) == DS_OK) {
memcpy(pvAudioPtr1, m_data, dwAudioBytes1);
if (dwAudioBytes2 != 0) {
memcpy(pvAudioPtr2, m_data + dwAudioBytes1, dwAudioBytes2);
}
m_dsBuffer->Unlock(pvAudioPtr1, dwAudioBytes1, pvAudioPtr2, dwAudioBytes2);
m_dsBuffer->SetCurrentPosition(0);
m_dsBuffer->Play(0, 0, p_looping);
}
}
if (p_looping == FALSE) {
m_looping = FALSE;
}
else {
m_looping = TRUE;
}
m_unk0x58 = TRUE;
m_unk0x70 = TRUE;
return SUCCESS; return SUCCESS;
} }
@ -91,25 +184,25 @@ MxResult LegoCacheSound::FUN_10006a30(const char* p_str, MxBool)
void LegoCacheSound::FUN_10006b80() void LegoCacheSound::FUN_10006b80()
{ {
DWORD dwStatus; DWORD dwStatus;
m_dsBuffer->GetStatus(&dwStatus); m_dsBuffer->GetStatus(&dwStatus);
if (dwStatus) { if (dwStatus) {
m_dsBuffer->Stop(); m_dsBuffer->Stop();
} }
m_unk0x58 = 0; m_unk0x58 = FALSE;
m_unk0x6a = FALSE; m_unk0x6a = FALSE;
m_unk0x10.FUN_10011ca0(); m_sound.Reset();
if (m_string0x74.GetLength() != 0) { if (m_unk0x74.GetLength() != 0) {
m_string0x74 = ""; m_unk0x74 = "";
} }
} }
// FUNCTION: LEGO1 0x10006be0 // FUNCTION: LEGO1 0x10006be0
void LegoCacheSound::FUN_10006be0() void LegoCacheSound::FUN_10006be0()
{ {
if (!m_isLooping) { if (!m_looping) {
DWORD dwStatus; DWORD dwStatus;
m_dsBuffer->GetStatus(&dwStatus); m_dsBuffer->GetStatus(&dwStatus);
@ -118,23 +211,23 @@ void LegoCacheSound::FUN_10006be0()
return; return;
} }
m_unk0x70 = 0; m_unk0x70 = FALSE;
} }
if (dwStatus == 0) { if (dwStatus == 0) {
m_dsBuffer->Stop(); m_dsBuffer->Stop();
m_unk0x10.FUN_10011ca0(); m_sound.Reset();
if (m_string0x74.GetLength() != 0) { if (m_unk0x74.GetLength() != 0) {
m_string0x74 = ""; m_unk0x74 = "";
} }
m_unk0x58 = 0; m_unk0x58 = FALSE;
return; return;
} }
} }
if (m_string0x74.GetLength() != 0 && !m_unk0x84) { if (m_unk0x74.GetLength() != 0 && !m_unk0x84) {
if (!m_unk0x10.FUN_100118e0(m_dsBuffer)) { if (!m_sound.UpdatePosition(m_dsBuffer)) {
if (m_unk0x6a) { if (m_unk0x6a) {
return; return;
} }
@ -143,19 +236,52 @@ void LegoCacheSound::FUN_10006be0()
m_unk0x6a = TRUE; m_unk0x6a = TRUE;
} }
else if (m_unk0x6a) { else if (m_unk0x6a) {
m_dsBuffer->Play(0, 0, m_isLooping); m_dsBuffer->Play(0, 0, m_looping);
m_unk0x6a = FALSE; m_unk0x6a = FALSE;
} }
} }
} }
// FUNCTION: LEGO1 0x10006cb0 // FUNCTION: LEGO1 0x10006cb0
void LegoCacheSound::FUN_10006cb0(undefined4 p_und1, undefined4 p_und2) void LegoCacheSound::SetDistance(MxS32 p_min, MxS32 p_max)
{ {
m_unk0x10.FUN_10011cf0(p_und1, p_und2); m_sound.SetDistance(p_min, p_max);
} }
// FUNCTION: LEGO1 0x10006cd0 // FUNCTION: LEGO1 0x10006cd0
void LegoCacheSound::FUN_10006cd0(undefined4, undefined4) void LegoCacheSound::FUN_10006cd0(undefined4, undefined4)
{ {
} }
// FUNCTION: LEGO1 0x10006d80
// FUNCTION: BETA10 0x100670e7
MxString LegoCacheSound::FUN_10006d80(const MxString& p_str)
{
// TODO: Clean up code
char* str = p_str.GetData();
MxU32 length = strlen(str);
char* local28 = str + length;
char* local14 = local28;
char* pVar1 = local28;
do {
local14 = pVar1;
pVar1 = local14 + -1;
if (str == local14) {
break;
}
if (*pVar1 == '.') {
local28 = pVar1;
}
} while (*pVar1 != '\\');
local14 = pVar1;
MxString local24;
local14++;
*local28 = '\0';
return local24 = local14;
}

View file

@ -4,6 +4,7 @@
#include "legocachsound.h" #include "legocachsound.h"
#include "legosoundmanager.h" #include "legosoundmanager.h"
#include "misc.h" #include "misc.h"
#include "mxdssound.h"
#include "mxdssubscriber.h" #include "mxdssubscriber.h"
#include "mxstreamchunk.h" #include "mxstreamchunk.h"
#include "mxwavepresenter.h" #include "mxwavepresenter.h"
@ -25,50 +26,71 @@ LegoLoadCacheSoundPresenter::~LegoLoadCacheSoundPresenter()
// FUNCTION: LEGO1 0x100184e0 // FUNCTION: LEGO1 0x100184e0
void LegoLoadCacheSoundPresenter::Init() void LegoLoadCacheSoundPresenter::Init()
{ {
this->m_unk0x70 = NULL; m_data = NULL;
this->m_unk0x78 = 0; m_dataSize = 0;
this->m_unk0x7c = 0; m_unk0x7c = FALSE;
} }
// FUNCTION: LEGO1 0x100184f0 // FUNCTION: LEGO1 0x100184f0
void LegoLoadCacheSoundPresenter::Destroy(MxBool p_fromDestructor) void LegoLoadCacheSoundPresenter::Destroy(MxBool p_fromDestructor)
{ {
delete[] this->m_unk0x70; delete[] m_data;
MxWavePresenter::Destroy(p_fromDestructor); MxWavePresenter::Destroy(p_fromDestructor);
} }
// FUNCTION: LEGO1 0x10018510 // FUNCTION: LEGO1 0x10018510
// FUNCTION: BETA10 0x1008c305
void LegoLoadCacheSoundPresenter::ReadyTickle() void LegoLoadCacheSoundPresenter::ReadyTickle()
{ {
MxStreamChunk* chunk = NextChunk(); MxStreamChunk* chunk = NextChunk();
if (chunk) { if (chunk) {
WaveFormat* header = (WaveFormat*) chunk->GetData(); WaveFormat* header = (WaveFormat*) chunk->GetData();
m_unk0x78 = 0; m_dataSize = 0;
MxU8* data = new MxU8[header->m_dataSize]; MxU8* data = new MxU8[header->m_dataSize];
m_unk0x70 = data; m_data = data;
m_unk0x74 = data; m_pData = data;
m_cacheSound = new LegoCacheSound; m_cacheSound = new LegoCacheSound();
memcpy(&m_pcmWaveFormat, &header->m_pcmWaveFormat, sizeof(m_pcmWaveFormat)); m_pcmWaveFormat = header->m_pcmWaveFormat;
m_subscriber->FreeDataChunk(chunk); m_subscriber->FreeDataChunk(chunk);
ProgressTickleState(e_streaming); ProgressTickleState(e_streaming);
} }
} }
// STUB: LEGO1 0x100185f0 // FUNCTION: LEGO1 0x100185f0
// FUNCTION: BETA10 0x1008c48f
void LegoLoadCacheSoundPresenter::StreamingTickle() void LegoLoadCacheSoundPresenter::StreamingTickle()
{ {
// TODO MxStreamChunk* chunk = NextChunk();
EndAction();
if (chunk) {
if (chunk->GetChunkFlags() & DS_CHUNK_END_OF_STREAM) {
m_cacheSound->Create(
&m_pcmWaveFormat,
((MxDSSound*) m_action)->GetMediaSrcPath(),
((MxDSSound*) m_action)->GetVolume(),
m_data + 2,
m_dataSize - 2
);
ProgressTickleState(e_done);
}
else {
memcpy(m_pData, chunk->GetData(), chunk->GetLength());
m_dataSize += chunk->GetLength();
m_pData += chunk->GetLength();
}
m_subscriber->FreeDataChunk(chunk);
}
} }
// FUNCTION: LEGO1 0x100186f0 // FUNCTION: LEGO1 0x100186f0
void LegoLoadCacheSoundPresenter::DoneTickle() void LegoLoadCacheSoundPresenter::DoneTickle()
{ {
if (m_unk0x7c != 0) { if (m_unk0x7c) {
EndAction(); EndAction();
} }
} }
@ -80,7 +102,7 @@ MxResult LegoLoadCacheSoundPresenter::PutData()
if (m_currentTickleState == e_done) { if (m_currentTickleState == e_done) {
m_cacheSound = SoundManager()->GetCacheSoundManager()->ManageSoundEntry(m_cacheSound); m_cacheSound = SoundManager()->GetCacheSoundManager()->ManageSoundEntry(m_cacheSound);
m_unk0x7c = 1; m_unk0x7c = TRUE;
} }
m_criticalSection.Leave(); m_criticalSection.Leave();

View file

@ -97,8 +97,38 @@ MxResult LegoSoundManager::Tickle()
return m_cacheSoundManager->Tickle(); return m_cacheSoundManager->Tickle();
} }
// STUB: LEGO1 0x1002a410 // FUNCTION: LEGO1 0x1002a410
void LegoSoundManager::FUN_1002a410(const float* p_pos, const float* p_dir, const float* p_up, const float* p_vel) // FUNCTION: BETA10 0x100d03a5
void LegoSoundManager::UpdateListener(
const float* p_position,
const float* p_direction,
const float* p_up,
const float* p_velocity
)
{ {
// TODO if (m_listener != NULL) {
if (p_position != NULL) {
m_listener->SetPosition(p_position[0], p_position[1], p_position[2], DS3D_DEFERRED);
}
if (p_direction != NULL && p_up != NULL) {
m_listener->SetOrientation(
p_direction[0],
p_direction[1],
p_direction[2],
p_up[0],
p_up[1],
p_up[2],
DS3D_DEFERRED
);
}
if (p_velocity != NULL) {
m_listener->SetVelocity(p_velocity[0], p_velocity[1], p_velocity[2], DS3D_DEFERRED);
}
if (p_position != NULL || (p_direction != NULL && p_up != NULL) || p_velocity != NULL) {
m_listener->CommitDeferredSettings();
}
}
} }

View file

@ -619,7 +619,7 @@ void LegoBuildingManager::ScheduleAnimation(LegoEntity* p_entity, MxU32 p_length
if (p_haveSound) { if (p_haveSound) {
m_sound = SoundManager()->GetCacheSoundManager()->FindSoundByKey("bcrash"); m_sound = SoundManager()->GetCacheSoundManager()->FindSoundByKey("bcrash");
m_sound->FUN_10006cb0(35, 60); m_sound->SetDistance(35, 60);
} }
if (m_numEntries == 0) { if (m_numEntries == 0) {

View file

@ -1,16 +1,16 @@
#include "legocharacters.h" #include "legoactors.h"
DECOMP_SIZE_ASSERT(LegoCharacterInfo, 0x108) DECOMP_SIZE_ASSERT(LegoActorInfo, 0x108)
DECOMP_SIZE_ASSERT(LegoCharacterInfo::Part, 0x18) DECOMP_SIZE_ASSERT(LegoActorInfo::Part, 0x18)
DECOMP_SIZE_ASSERT(LegoCharacterLOD, 0x58) DECOMP_SIZE_ASSERT(LegoActorLOD, 0x58)
// Unclear whether g_characterLODs[0] (top) is its own global, see: LegoCharacterManager::CreateROI // Unclear whether g_actorLODs[0] (top) is its own global, see: LegoCharacterManager::CreateActorROI
// GLOBAL: LEGO1 0x100da3b0 // GLOBAL: LEGO1 0x100da3b0
LegoCharacterLOD g_characterLODs[] = { LegoActorLOD g_actorLODs[] = {
{"top", "top", 0, 0.000267, 0.780808, -0.01906, 0.951612, -0.461166, -0.002794, -0.299442, 0.4617, {"top", "top", 0, 0.000267, 0.780808, -0.01906, 0.951612, -0.461166, -0.002794, -0.299442, 0.4617,
1.56441, 0.261321, 0, 0, 0, 0, 0, 1, 0, 1, 0}, 1.56441, 0.261321, 0, 0, 0, 0, 0, 1, 0, 1, 0},
{"body", "body", LegoCharacterLOD::c_flag1, {"body", "body", LegoActorLOD::c_flag1,
0.00158332, 0.401828, -0.00048697, 0.00158332, 0.401828, -0.00048697,
0.408071, -0.287507, 0.150419, 0.408071, -0.287507, 0.150419,
-0.147452, 0.289219, 0.649774, -0.147452, 0.289219, 0.649774,
@ -18,7 +18,7 @@ LegoCharacterLOD g_characterLODs[] = {
0.007277, 0, 0, 0.007277, 0, 0,
1, 0, 1, 1, 0, 1,
0}, 0},
{"infohat", "infohat", LegoCharacterLOD::c_flag2, {"infohat", "infohat", LegoActorLOD::c_flag2,
0, -0.00938, -0.01955, 0, -0.00938, -0.01955,
0.35, -0.231822, -0.140237, 0.35, -0.231822, -0.140237,
-0.320954, 0.234149, 0.076968, -0.320954, 0.234149, 0.076968,
@ -26,7 +26,7 @@ LegoCharacterLOD g_characterLODs[] = {
0.001767, 0, 0, 0.001767, 0, 0,
1, 0, 1, 1, 0, 1,
0}, 0},
{"infogron", "infogron", LegoCharacterLOD::c_flag2, {"infogron", "infogron", LegoActorLOD::c_flag2,
0, 0.11477, 0.00042, 0, 0.11477, 0.00042,
0.26, -0.285558, -0.134391, 0.26, -0.285558, -0.134391,
-0.142231, 0.285507, 0.152986, -0.142231, 0.285507, 0.152986,
@ -34,7 +34,7 @@ LegoCharacterLOD g_characterLODs[] = {
0.007277, 0, 0, 0.007277, 0, 0,
1, 0, 1, 1, 0, 1,
0}, 0},
{"head", "head", LegoCharacterLOD::c_flag1, {"head", "head", LegoActorLOD::c_flag1,
0, -0.03006, 0, 0, -0.03006, 0,
0.3, -0.189506, -0.209665, 0.3, -0.189506, -0.209665,
-0.189824, 0.189532, 0.228822, -0.189824, 0.189532, 0.228822,
@ -42,7 +42,7 @@ LegoCharacterLOD g_characterLODs[] = {
0.001781, 0, 0, 0.001781, 0, 0,
1, 0, 1, 1, 0, 1,
0}, 0},
{"arm-lft", "arm-lft", LegoCharacterLOD::c_flag2, {"arm-lft", "arm-lft", LegoActorLOD::c_flag2,
-0.06815, -0.0973747, 0.0154655, -0.06815, -0.0973747, 0.0154655,
0.237, -0.137931, -0.282775, 0.237, -0.137931, -0.282775,
-0.105316, 0.000989, 0.100221, -0.105316, 0.000989, 0.100221,
@ -50,7 +50,7 @@ LegoCharacterLOD g_characterLODs[] = {
0.023286, -0.003031, -0.017187, 0.023286, -0.003031, -0.017187,
0.999848, 0.173622, 0.984658, 0.999848, 0.173622, 0.984658,
0.017453}, 0.017453},
{"arm-rt", "arm-rt", LegoCharacterLOD::c_flag2, {"arm-rt", "arm-rt", LegoActorLOD::c_flag2,
0.0680946, -0.097152, 0.0152722, 0.0680946, -0.097152, 0.0152722,
0.237, 0.00141, -0.289604, 0.237, 0.00141, -0.289604,
-0.100831, 0.138786, 0.09291, -0.100831, 0.138786, 0.09291,
@ -58,7 +58,7 @@ LegoCharacterLOD g_characterLODs[] = {
0.018302, 0, 0, 0.018302, 0, 0,
1, -0.173648, 0.984808, 1, -0.173648, 0.984808,
0}, 0},
{"claw-lft", "claw-lft", LegoCharacterLOD::c_flag2, {"claw-lft", "claw-lft", LegoActorLOD::c_flag2,
0.000773381, -0.101422, -0.0237761, 0.000773381, -0.101422, -0.0237761,
0.15, -0.089838, -0.246208, 0.15, -0.089838, -0.246208,
-0.117735, 0.091275, 0.000263, -0.117735, 0.091275, 0.000263,
@ -66,7 +66,7 @@ LegoCharacterLOD g_characterLODs[] = {
0.092779, 0.000001, 0.000003, 0.092779, 0.000001, 0.000003,
1, 0.190812, 0.981627, 1, 0.190812, 0.981627,
-0.000003}, -0.000003},
{"claw-rt", "claw-lft", LegoCharacterLOD::c_flag2, {"claw-rt", "claw-lft", LegoActorLOD::c_flag2,
0.000773381, -0.101422, -0.0237761, 0.000773381, -0.101422, -0.0237761,
0.15, -0.095016, -0.245349, 0.15, -0.095016, -0.245349,
-0.117979, 0.086528, 0.00067, -0.117979, 0.086528, 0.00067,
@ -74,7 +74,7 @@ LegoCharacterLOD g_characterLODs[] = {
0.096123, 0.00606, -0.034369, 0.096123, 0.00606, -0.034369,
0.999391, -0.190704, 0.981027, 0.999391, -0.190704, 0.981027,
0.034894}, 0.034894},
{"leg-lft", "leg", LegoCharacterLOD::c_flag2, {"leg-lft", "leg", LegoActorLOD::c_flag2,
0.00433584, -0.177404, -0.0313928, 0.00433584, -0.177404, -0.0313928,
0.33, -0.129782, -0.440428, 0.33, -0.129782, -0.440428,
-0.184207, 0.13817, 0.118415, -0.184207, 0.13817, 0.118415,
@ -82,7 +82,7 @@ LegoCharacterLOD g_characterLODs[] = {
0.006822, 0, 0, 0.006822, 0, 0,
1, 0, 1, 1, 0, 1,
0}, 0},
{"leg-rt", "leg", LegoCharacterLOD::c_flag2, {"leg-rt", "leg", LegoActorLOD::c_flag2,
0.00433584, -0.177404, -0.0313928, 0.00433584, -0.177404, -0.0313928,
0.33, -0.132864, -0.437138, 0.33, -0.132864, -0.437138,
-0.183944, 0.134614, 0.12043, -0.183944, 0.134614, 0.12043,
@ -172,7 +172,7 @@ const char* g_unk0x100f80a0[] =
{"lego white", "lego black", "lego yellow", "lego red", "lego blue", "lego brown", "lego lt grey", "lego green"}; {"lego white", "lego black", "lego yellow", "lego red", "lego blue", "lego brown", "lego lt grey", "lego green"};
// GLOBAL: LEGO1 0x100f80c0 // GLOBAL: LEGO1 0x100f80c0
LegoCharacterInfo g_characterInfoInit[] = { LegoActorInfo g_actorInfoInit[] = {
{"pepper", {"pepper",
NULL, NULL,
NULL, NULL,

View file

@ -9,6 +9,7 @@
#include "legoanimpresenter.h" #include "legoanimpresenter.h"
#include "legocharactermanager.h" #include "legocharactermanager.h"
#include "legoendanimnotificationparam.h" #include "legoendanimnotificationparam.h"
#include "legoentitylist.h"
#include "legoextraactor.h" #include "legoextraactor.h"
#include "legogamestate.h" #include "legogamestate.h"
#include "legolocomotionanimpresenter.h" #include "legolocomotionanimpresenter.h"
@ -344,14 +345,14 @@ LegoAnimationManager::~LegoAnimationManager()
LegoROI* roi = m_extras[i].m_roi; LegoROI* roi = m_extras[i].m_roi;
if (roi != NULL) { if (roi != NULL) {
LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); LegoPathActor* actor = CharacterManager()->GetExtraActor(roi->GetName());
if (actor != NULL && actor->GetController() != NULL && CurrentWorld() != NULL) { if (actor != NULL && actor->GetController() != NULL && CurrentWorld() != NULL) {
CurrentWorld()->RemoveActor(actor); CurrentWorld()->RemoveActor(actor);
actor->SetController(NULL); actor->SetController(NULL);
} }
CharacterManager()->FUN_10083db0(roi); CharacterManager()->ReleaseActor(roi);
} }
} }
@ -430,14 +431,14 @@ void LegoAnimationManager::Suspend()
LegoROI* roi = m_extras[i].m_roi; LegoROI* roi = m_extras[i].m_roi;
if (roi != NULL) { if (roi != NULL) {
LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); LegoPathActor* actor = CharacterManager()->GetExtraActor(roi->GetName());
if (actor != NULL && actor->GetController() != NULL) { if (actor != NULL && actor->GetController() != NULL) {
actor->GetController()->RemoveActor(actor); actor->GetController()->RemoveActor(actor);
actor->SetController(NULL); actor->SetController(NULL);
} }
CharacterManager()->FUN_10083db0(roi); CharacterManager()->ReleaseActor(roi);
} }
if (m_extras[i].m_unk0x14) { if (m_extras[i].m_unk0x14) {
@ -1069,8 +1070,8 @@ MxResult LegoAnimationManager::StartEntityAction(MxDSAction& p_dsAction, LegoEnt
MxResult result = FAILURE; MxResult result = FAILURE;
LegoROI* roi = p_entity->GetROI(); LegoROI* roi = p_entity->GetROI();
if (p_entity->GetType() == LegoEntity::e_character) { if (p_entity->GetType() == LegoEntity::e_actor) {
LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); LegoPathActor* actor = CharacterManager()->GetExtraActor(roi->GetName());
if (actor) { if (actor) {
LegoPathController* controller = actor->GetController(); LegoPathController* controller = actor->GetController();
@ -1395,7 +1396,7 @@ MxLong LegoAnimationManager::Notify(MxParam& p_param)
LegoROI* roi = m_extras[i].m_roi; LegoROI* roi = m_extras[i].m_roi;
if (roi != NULL) { if (roi != NULL) {
LegoExtraActor* actor = CharacterManager()->GetActor(roi->GetName()); LegoExtraActor* actor = CharacterManager()->GetExtraActor(roi->GetName());
if (actor != NULL) { if (actor != NULL) {
actor->Restart(); actor->Restart();
} }
@ -1444,14 +1445,14 @@ MxResult LegoAnimationManager::Tickle()
LegoROI* roi = m_extras[i].m_roi; LegoROI* roi = m_extras[i].m_roi;
if (roi != NULL && m_extras[i].m_unk0x0d) { if (roi != NULL && m_extras[i].m_unk0x0d) {
LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); LegoPathActor* actor = CharacterManager()->GetExtraActor(roi->GetName());
if (actor != NULL && actor->GetController() != NULL) { if (actor != NULL && actor->GetController() != NULL) {
actor->GetController()->RemoveActor(actor); actor->GetController()->RemoveActor(actor);
actor->SetController(NULL); actor->SetController(NULL);
} }
CharacterManager()->FUN_10083db0(roi); CharacterManager()->ReleaseActor(roi);
if (m_extras[i].m_unk0x14) { if (m_extras[i].m_unk0x14) {
m_extras[i].m_unk0x14 = FALSE; m_extras[i].m_unk0x14 = FALSE;
@ -1701,7 +1702,7 @@ void LegoAnimationManager::FUN_10062580(AnimInfo& p_info)
if (models != NULL && modelCount) { if (models != NULL && modelCount) {
for (MxU8 i = 0; i < modelCount; i++) { for (MxU8 i = 0; i < modelCount; i++) {
LegoPathActor* actor = CharacterManager()->GetActor(models[i].m_name); LegoPathActor* actor = CharacterManager()->GetExtraActor(models[i].m_name);
if (actor) { if (actor) {
LegoPathController* controller = actor->GetController(); LegoPathController* controller = actor->GetController();
@ -1814,13 +1815,13 @@ void LegoAnimationManager::PurgeExtra(MxBool p_und)
!viewManager->FUN_100a6150(roi->GetWorldBoundingBox()))) { !viewManager->FUN_100a6150(roi->GetWorldBoundingBox()))) {
m_unk0x414--; m_unk0x414--;
LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); LegoPathActor* actor = CharacterManager()->GetExtraActor(roi->GetName());
if (actor != NULL && actor->GetController() != NULL) { if (actor != NULL && actor->GetController() != NULL) {
actor->GetController()->RemoveActor(actor); actor->GetController()->RemoveActor(actor);
actor->SetController(NULL); actor->SetController(NULL);
} }
CharacterManager()->FUN_10083db0(roi); CharacterManager()->ReleaseActor(roi);
if (m_extras[i].m_unk0x14) { if (m_extras[i].m_unk0x14) {
m_extras[i].m_unk0x14 = FALSE; m_extras[i].m_unk0x14 = FALSE;
@ -1930,15 +1931,15 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und)
g_characters[m_lastExtraCharacterId].m_unk0x08 && g_characters[m_lastExtraCharacterId].m_unk0x08 &&
!g_characters[m_lastExtraCharacterId].m_inExtras && !g_characters[m_lastExtraCharacterId].m_inExtras &&
g_characters[m_lastExtraCharacterId].m_active == active) { g_characters[m_lastExtraCharacterId].m_active == active) {
if (!CharacterManager()->FUN_10083b20(g_characters[m_lastExtraCharacterId].m_name if (!CharacterManager()->Exists(g_characters[m_lastExtraCharacterId].m_name)) {
)) { m_extras[i].m_roi = CharacterManager()->GetActorROI(
m_extras[i].m_roi = CharacterManager()->GetROI(
g_characters[m_lastExtraCharacterId].m_name, g_characters[m_lastExtraCharacterId].m_name,
TRUE TRUE
); );
LegoExtraActor* actor = LegoExtraActor* actor = CharacterManager()->GetExtraActor(
CharacterManager()->GetActor(g_characters[m_lastExtraCharacterId].m_name); g_characters[m_lastExtraCharacterId].m_name
);
switch (g_unk0x100f7504++ % 4) { switch (g_unk0x100f7504++ % 4) {
case 0: case 0:
@ -2002,7 +2003,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und)
return; return;
} }
else { else {
CharacterManager()->FUN_10083db0(m_extras[i].m_roi); CharacterManager()->ReleaseActor(m_extras[i].m_roi);
m_extras[i].m_roi = NULL; m_extras[i].m_roi = NULL;
continue; continue;
} }
@ -2042,7 +2043,7 @@ MxBool LegoAnimationManager::FUN_10062e20(LegoROI* p_roi, LegoAnimPresenter* p_p
MxBool inExtras = FALSE; MxBool inExtras = FALSE;
const char* name = p_roi->GetName(); const char* name = p_roi->GetName();
LegoExtraActor* actor = CharacterManager()->GetActor(name); LegoExtraActor* actor = CharacterManager()->GetExtraActor(name);
if (actor != NULL) { if (actor != NULL) {
MxS32 characterId = -1; MxS32 characterId = -1;
MxS32 i; MxS32 i;
@ -2104,7 +2105,7 @@ MxBool LegoAnimationManager::FUN_10062e20(LegoROI* p_roi, LegoAnimPresenter* p_p
return FALSE; return FALSE;
} }
CharacterManager()->FUN_10083db0(p_roi); CharacterManager()->ReleaseActor(p_roi);
} }
else { else {
if (inExtras) { if (inExtras) {
@ -2216,7 +2217,7 @@ void LegoAnimationManager::FUN_10063270(LegoROIList* p_list, LegoAnimPresenter*
FUN_10063950(roi); FUN_10063950(roi);
} }
else { else {
LegoExtraActor* actor = CharacterManager()->GetActor(roi->GetName()); LegoExtraActor* actor = CharacterManager()->GetExtraActor(roi->GetName());
if (actor != NULL) { if (actor != NULL) {
for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_extras); i++) { for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_extras); i++) {
@ -2277,7 +2278,7 @@ void LegoAnimationManager::FUN_10063780(LegoROIList* p_list)
while (cursor.Next(roi)) { while (cursor.Next(roi)) {
const char* name = roi->GetName(); const char* name = roi->GetName();
if (CharacterManager()->Exists(name)) { if (CharacterManager()->IsActor(name)) {
m_unk0x424->Append(roi); m_unk0x424->Append(roi);
cursor.Detach(); cursor.Detach();
} }
@ -2292,7 +2293,7 @@ void LegoAnimationManager::FUN_10063950(LegoROI* p_roi)
LegoROIListCursor cursor(m_unk0x424); LegoROIListCursor cursor(m_unk0x424);
if (cursor.Find(p_roi)) { if (cursor.Find(p_roi)) {
CharacterManager()->FUN_10083db0(p_roi); CharacterManager()->ReleaseActor(p_roi);
cursor.Detach(); cursor.Detach();
} }
} }
@ -2305,7 +2306,7 @@ void LegoAnimationManager::FUN_10063aa0()
LegoROI* roi; LegoROI* roi;
while (cursor.Next(roi)) { while (cursor.Next(roi)) {
CharacterManager()->FUN_10083db0(roi); CharacterManager()->ReleaseActor(roi);
} }
} }
@ -2388,7 +2389,7 @@ void LegoAnimationManager::FUN_10063d10()
m_extras[i].m_unk0x0c = FALSE; m_extras[i].m_unk0x0c = FALSE;
LegoExtraActor* actor = CharacterManager()->GetActor(roi->GetName()); LegoExtraActor* actor = CharacterManager()->GetExtraActor(roi->GetName());
if (actor != NULL) { if (actor != NULL) {
float speed = m_extras[i].m_speed; float speed = m_extras[i].m_speed;
@ -2405,7 +2406,7 @@ void LegoAnimationManager::FUN_10063d10()
} }
} }
else { else {
LegoExtraActor* actor = CharacterManager()->GetActor(roi->GetName()); LegoExtraActor* actor = CharacterManager()->GetExtraActor(roi->GetName());
if (actor != NULL) { if (actor != NULL) {
actor->Restart(); actor->Restart();
} }
@ -2424,7 +2425,7 @@ void LegoAnimationManager::FUN_10063e40(LegoAnimPresenter* p_presenter)
while (cursor.Next(roi)) { while (cursor.Next(roi)) {
if (!FUN_10062e20(roi, p_presenter)) { if (!FUN_10062e20(roi, p_presenter)) {
CharacterManager()->FUN_10083db0(roi); CharacterManager()->ReleaseActor(roi);
} }
cursor.Detach(); cursor.Detach();
@ -2594,7 +2595,7 @@ MxResult LegoAnimationManager::FUN_10064380(
} }
if (roi != NULL && !strcmpi(roi->GetName(), p_name)) { if (roi != NULL && !strcmpi(roi->GetName(), p_name)) {
actor = CharacterManager()->GetActor(p_name); actor = CharacterManager()->GetExtraActor(p_name);
if (actor != NULL && actor->GetController() != NULL) { if (actor != NULL && actor->GetController() != NULL) {
actor->GetController()->RemoveActor(actor); actor->GetController()->RemoveActor(actor);
@ -2620,11 +2621,11 @@ MxResult LegoAnimationManager::FUN_10064380(
return FAILURE; return FAILURE;
} }
m_extras[extraIndex].m_roi = CharacterManager()->GetROI(p_name, TRUE); m_extras[extraIndex].m_roi = CharacterManager()->GetActorROI(p_name, TRUE);
m_extras[extraIndex].m_characterId = characterId; m_extras[extraIndex].m_characterId = characterId;
m_extras[extraIndex].m_speed = p_speed; m_extras[extraIndex].m_speed = p_speed;
actor = CharacterManager()->GetActor(p_name); actor = CharacterManager()->GetExtraActor(p_name);
m_unk0x414++; m_unk0x414++;
} }
@ -2634,7 +2635,7 @@ MxResult LegoAnimationManager::FUN_10064380(
actor->SetWorldSpeed(0.0f); actor->SetWorldSpeed(0.0f);
if (world->PlaceActor(actor, p_boundaryName, p_src, p_srcScale, p_dest, p_destScale) != SUCCESS) { if (world->PlaceActor(actor, p_boundaryName, p_src, p_srcScale, p_dest, p_destScale) != SUCCESS) {
CharacterManager()->FUN_10083db0(m_extras[i].m_roi); CharacterManager()->ReleaseActor(m_extras[i].m_roi);
m_extras[i].m_roi = NULL; m_extras[i].m_roi = NULL;
m_unk0x414--; m_unk0x414--;
return FAILURE; return FAILURE;
@ -2811,7 +2812,7 @@ void LegoAnimationManager::FUN_10064b50(MxLong p_time)
viewROI->WrappedSetLocalTransform(mat); viewROI->WrappedSetLocalTransform(mat);
VideoManager()->Get3DManager()->Moved(*viewROI); VideoManager()->Get3DManager()->Moved(*viewROI);
SoundManager()->FUN_1002a410( SoundManager()->UpdateListener(
viewROI->GetWorldPosition(), viewROI->GetWorldPosition(),
viewROI->GetWorldDirection(), viewROI->GetWorldDirection(),
viewROI->GetWorldUp(), viewROI->GetWorldUp(),

View file

@ -1,8 +1,8 @@
#include "legocharactermanager.h" #include "legocharactermanager.h"
#include "3dmanager/lego3dmanager.h" #include "3dmanager/lego3dmanager.h"
#include "legoactors.h"
#include "legoanimactor.h" #include "legoanimactor.h"
#include "legocharacters.h"
#include "legoextraactor.h" #include "legoextraactor.h"
#include "legogamestate.h" #include "legogamestate.h"
#include "legovariables.h" #include "legovariables.h"
@ -40,7 +40,7 @@ MxU32 g_unk0x100fc4ec = 2;
MxU32 g_unk0x100fc4f0 = 0; MxU32 g_unk0x100fc4f0 = 0;
// GLOBAL: LEGO1 0x10104f20 // GLOBAL: LEGO1 0x10104f20
LegoCharacterInfo g_characterInfo[66]; LegoActorInfo g_actorInfo[66];
// FUNCTION: LEGO1 0x10082a20 // FUNCTION: LEGO1 0x10082a20
LegoCharacterManager::LegoCharacterManager() LegoCharacterManager::LegoCharacterManager()
@ -75,26 +75,26 @@ LegoCharacterManager::~LegoCharacterManager()
// FUNCTION: LEGO1 0x10083270 // FUNCTION: LEGO1 0x10083270
void LegoCharacterManager::Init() void LegoCharacterManager::Init()
{ {
for (MxS32 i = 0; i < sizeOfArray(g_characterInfo); i++) { for (MxS32 i = 0; i < sizeOfArray(g_actorInfo); i++) {
g_characterInfo[i] = g_characterInfoInit[i]; g_actorInfo[i] = g_actorInfoInit[i];
} }
} }
// FUNCTION: LEGO1 0x100832a0 // FUNCTION: LEGO1 0x100832a0
void LegoCharacterManager::FUN_100832a0() void LegoCharacterManager::ReleaseAllActors()
{ {
for (MxS32 i = 0; i < sizeOfArray(g_characterInfo); i++) { for (MxS32 i = 0; i < sizeOfArray(g_actorInfo); i++) {
LegoCharacterInfo* info = GetInfo(g_characterInfo[i].m_name); LegoActorInfo* info = GetActorInfo(g_actorInfo[i].m_name);
if (info != NULL) { if (info != NULL) {
LegoExtraActor* actor = info->m_actor; LegoExtraActor* actor = info->m_actor;
if (actor != NULL && actor->IsA("LegoExtraActor")) { if (actor != NULL && actor->IsA("LegoExtraActor")) {
LegoROI* roi = g_characterInfo[i].m_roi; LegoROI* roi = g_actorInfo[i].m_roi;
MxU32 refCount = GetRefCount(roi); MxU32 refCount = GetRefCount(roi);
while (refCount != 0) { while (refCount != 0) {
FUN_10083db0(roi); ReleaseActor(roi);
refCount = GetRefCount(roi); refCount = GetRefCount(roi);
} }
} }
@ -107,8 +107,8 @@ MxResult LegoCharacterManager::Write(LegoStorage* p_storage)
{ {
MxResult result = FAILURE; MxResult result = FAILURE;
for (MxS32 i = 0; i < sizeOfArray(g_characterInfo); i++) { for (MxS32 i = 0; i < sizeOfArray(g_actorInfo); i++) {
LegoCharacterInfo* info = &g_characterInfo[i]; LegoActorInfo* info = &g_actorInfo[i];
if (p_storage->Write(&info->m_unk0x0c, sizeof(info->m_unk0x0c)) != SUCCESS) { if (p_storage->Write(&info->m_unk0x0c, sizeof(info->m_unk0x0c)) != SUCCESS) {
goto done; goto done;
@ -162,8 +162,8 @@ MxResult LegoCharacterManager::Read(LegoStorage* p_storage)
{ {
MxResult result = FAILURE; MxResult result = FAILURE;
for (MxS32 i = 0; i < sizeOfArray(g_characterInfo); i++) { for (MxS32 i = 0; i < sizeOfArray(g_actorInfo); i++) {
LegoCharacterInfo* info = &g_characterInfo[i]; LegoActorInfo* info = &g_actorInfo[i];
if (p_storage->Read(&info->m_unk0x0c, sizeof(info->m_unk0x0c)) != SUCCESS) { if (p_storage->Read(&info->m_unk0x0c, sizeof(info->m_unk0x0c)) != SUCCESS) {
goto done; goto done;
@ -213,10 +213,10 @@ done:
} }
// FUNCTION: LEGO1 0x10083500 // FUNCTION: LEGO1 0x10083500
LegoROI* LegoCharacterManager::GetROI(const char* p_key, MxBool p_createEntity) LegoROI* LegoCharacterManager::GetActorROI(const char* p_name, MxBool p_createEntity)
{ {
LegoCharacter* character = NULL; LegoCharacter* character = NULL;
LegoCharacterMap::iterator it = m_characters->find(const_cast<char*>(p_key)); LegoCharacterMap::iterator it = m_characters->find(const_cast<char*>(p_name));
if (it != m_characters->end()) { if (it != m_characters->end()) {
character = (*it).second; character = (*it).second;
@ -224,7 +224,7 @@ LegoROI* LegoCharacterManager::GetROI(const char* p_key, MxBool p_createEntity)
} }
if (character == NULL) { if (character == NULL) {
LegoROI* roi = CreateROI(p_key); LegoROI* roi = CreateActorROI(p_name);
if (roi == NULL) { if (roi == NULL) {
goto done; goto done;
@ -234,11 +234,11 @@ LegoROI* LegoCharacterManager::GetROI(const char* p_key, MxBool p_createEntity)
if (roi != NULL) { if (roi != NULL) {
character = new LegoCharacter(roi); character = new LegoCharacter(roi);
char* key = new char[strlen(p_key) + 1]; char* name = new char[strlen(p_name) + 1];
if (key != NULL) { if (name != NULL) {
strcpy(key, p_key); strcpy(name, p_name);
(*m_characters)[key] = character; (*m_characters)[name] = character;
VideoManager()->Get3DManager()->Add(*roi); VideoManager()->Get3DManager()->Add(*roi);
} }
} }
@ -254,9 +254,9 @@ done:
LegoExtraActor* actor = new LegoExtraActor(); LegoExtraActor* actor = new LegoExtraActor();
actor->SetROI(character->m_roi, FALSE, FALSE); actor->SetROI(character->m_roi, FALSE, FALSE);
actor->SetType(LegoEntity::e_character); actor->SetType(LegoEntity::e_actor);
actor->SetFlag(LegoActor::c_bit2); actor->SetFlag(LegoEntity::c_managerOwned);
GetInfo(p_key)->m_actor = actor; GetActorInfo(p_name)->m_actor = actor;
} }
return character->m_roi; return character->m_roi;
@ -267,10 +267,10 @@ done:
// FUNCTION: LEGO1 0x10083b20 // FUNCTION: LEGO1 0x10083b20
// FUNCTION: BETA10 0x10074608 // FUNCTION: BETA10 0x10074608
MxBool LegoCharacterManager::FUN_10083b20(const char* p_key) MxBool LegoCharacterManager::Exists(const char* p_name)
{ {
LegoCharacter* character = NULL; LegoCharacter* character = NULL;
LegoCharacterMap::iterator it = m_characters->find(const_cast<char*>(p_key)); LegoCharacterMap::iterator it = m_characters->find(const_cast<char*>(p_name));
if (it != m_characters->end()) { if (it != m_characters->end()) {
return TRUE; return TRUE;
@ -298,7 +298,7 @@ MxU32 LegoCharacterManager::GetRefCount(LegoROI* p_roi)
// FUNCTION: LEGO1 0x10083c30 // FUNCTION: LEGO1 0x10083c30
// FUNCTION: BETA10 0x10074701 // FUNCTION: BETA10 0x10074701
void LegoCharacterManager::FUN_10083c30(const char* p_name) void LegoCharacterManager::ReleaseActor(const char* p_name)
{ {
LegoCharacter* character = NULL; LegoCharacter* character = NULL;
LegoCharacterMap::iterator it = m_characters->find(const_cast<char*>(p_name)); LegoCharacterMap::iterator it = m_characters->find(const_cast<char*>(p_name));
@ -307,7 +307,7 @@ void LegoCharacterManager::FUN_10083c30(const char* p_name)
character = (*it).second; character = (*it).second;
if (character->RemoveRef() == 0) { if (character->RemoveRef() == 0) {
LegoCharacterInfo* info = GetInfo(p_name); LegoActorInfo* info = GetActorInfo(p_name);
LegoEntity* entity = character->m_roi->GetEntity(); LegoEntity* entity = character->m_roi->GetEntity();
if (entity != NULL) { if (entity != NULL) {
@ -323,11 +323,11 @@ void LegoCharacterManager::FUN_10083c30(const char* p_name)
if (info != NULL) { if (info != NULL) {
if (info->m_actor != NULL) { if (info->m_actor != NULL) {
info->m_actor->ClearFlag(LegoEntity::c_bit2); info->m_actor->ClearFlag(LegoEntity::c_managerOwned);
delete info->m_actor; delete info->m_actor;
} }
else if (entity != NULL && entity->GetFlagsIsSet(LegoEntity::c_bit2)) { else if (entity != NULL && entity->GetFlagsIsSet(LegoEntity::c_managerOwned)) {
entity->ClearFlag(LegoEntity::c_bit2); entity->ClearFlag(LegoEntity::c_managerOwned);
delete entity; delete entity;
} }
@ -339,7 +339,7 @@ void LegoCharacterManager::FUN_10083c30(const char* p_name)
} }
// FUNCTION: LEGO1 0x10083db0 // FUNCTION: LEGO1 0x10083db0
void LegoCharacterManager::FUN_10083db0(LegoROI* p_roi) void LegoCharacterManager::ReleaseActor(LegoROI* p_roi)
{ {
LegoCharacter* character = NULL; LegoCharacter* character = NULL;
LegoCharacterMap::iterator it; LegoCharacterMap::iterator it;
@ -349,7 +349,7 @@ void LegoCharacterManager::FUN_10083db0(LegoROI* p_roi)
if (character->m_roi == p_roi) { if (character->m_roi == p_roi) {
if (character->RemoveRef() == 0) { if (character->RemoveRef() == 0) {
LegoCharacterInfo* info = GetInfo(character->m_roi->GetName()); LegoActorInfo* info = GetActorInfo(character->m_roi->GetName());
LegoEntity* entity = character->m_roi->GetEntity(); LegoEntity* entity = character->m_roi->GetEntity();
if (entity != NULL) { if (entity != NULL) {
@ -365,11 +365,11 @@ void LegoCharacterManager::FUN_10083db0(LegoROI* p_roi)
if (info != NULL) { if (info != NULL) {
if (info->m_actor != NULL) { if (info->m_actor != NULL) {
info->m_actor->ClearFlag(LegoEntity::c_bit2); info->m_actor->ClearFlag(LegoEntity::c_managerOwned);
delete info->m_actor; delete info->m_actor;
} }
else if (entity != NULL && entity->GetFlagsIsSet(LegoEntity::c_bit2)) { else if (entity != NULL && entity->GetFlagsIsSet(LegoEntity::c_managerOwned)) {
entity->ClearFlag(LegoEntity::c_bit2); entity->ClearFlag(LegoEntity::c_managerOwned);
delete entity; delete entity;
} }
@ -384,7 +384,7 @@ void LegoCharacterManager::FUN_10083db0(LegoROI* p_roi)
} }
// FUNCTION: LEGO1 0x10083f10 // FUNCTION: LEGO1 0x10083f10
void LegoCharacterManager::FUN_10083f10(LegoROI* p_roi) void LegoCharacterManager::ReleaseAutoROI(LegoROI* p_roi)
{ {
LegoCharacter* character = NULL; LegoCharacter* character = NULL;
LegoCharacterMap::iterator it; LegoCharacterMap::iterator it;
@ -407,8 +407,8 @@ void LegoCharacterManager::FUN_10083f10(LegoROI* p_roi)
m_characters->erase(it); m_characters->erase(it);
if (entity != NULL && entity->GetFlagsIsSet(LegoEntity::c_bit2)) { if (entity != NULL && entity->GetFlagsIsSet(LegoEntity::c_managerOwned)) {
entity->ClearFlag(LegoEntity::c_bit2); entity->ClearFlag(LegoEntity::c_managerOwned);
delete entity; delete entity;
} }
} }
@ -425,7 +425,7 @@ void LegoCharacterManager::RemoveROI(LegoROI* p_roi)
} }
// FUNCTION: LEGO1 0x10084030 // FUNCTION: LEGO1 0x10084030
LegoROI* LegoCharacterManager::CreateROI(const char* p_key) LegoROI* LegoCharacterManager::CreateActorROI(const char* p_key)
{ {
MxBool success = FALSE; MxBool success = FALSE;
LegoROI* roi = NULL; LegoROI* roi = NULL;
@ -438,14 +438,14 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key)
Tgl::Renderer* renderer = VideoManager()->GetRenderer(); Tgl::Renderer* renderer = VideoManager()->GetRenderer();
ViewLODListManager* lodManager = GetViewLODListManager(); ViewLODListManager* lodManager = GetViewLODListManager();
LegoTextureContainer* textureContainer = TextureContainer(); LegoTextureContainer* textureContainer = TextureContainer();
LegoCharacterInfo* info = GetInfo(p_key); LegoActorInfo* info = GetActorInfo(p_key);
if (info == NULL) { if (info == NULL) {
goto done; goto done;
} }
if (!strcmpi(p_key, "pep")) { if (!strcmpi(p_key, "pep")) {
LegoCharacterInfo* pepper = GetInfo("pepper"); LegoActorInfo* pepper = GetActorInfo("pepper");
info->m_unk0x0c = pepper->m_unk0x0c; info->m_unk0x0c = pepper->m_unk0x0c;
info->m_unk0x10 = pepper->m_unk0x10; info->m_unk0x10 = pepper->m_unk0x10;
@ -459,33 +459,33 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key)
roi = new LegoROI(renderer); roi = new LegoROI(renderer);
roi->SetName(p_key); roi->SetName(p_key);
boundingSphere.Center()[0] = g_characterLODs[c_topLOD].m_boundingSphere[0]; boundingSphere.Center()[0] = g_actorLODs[c_topLOD].m_boundingSphere[0];
boundingSphere.Center()[1] = g_characterLODs[c_topLOD].m_boundingSphere[1]; boundingSphere.Center()[1] = g_actorLODs[c_topLOD].m_boundingSphere[1];
boundingSphere.Center()[2] = g_characterLODs[c_topLOD].m_boundingSphere[2]; boundingSphere.Center()[2] = g_actorLODs[c_topLOD].m_boundingSphere[2];
boundingSphere.Radius() = g_characterLODs[c_topLOD].m_boundingSphere[3]; boundingSphere.Radius() = g_actorLODs[c_topLOD].m_boundingSphere[3];
roi->SetBoundingSphere(boundingSphere); roi->SetBoundingSphere(boundingSphere);
boundingBox.Min()[0] = g_characterLODs[c_topLOD].m_boundingBox[0]; boundingBox.Min()[0] = g_actorLODs[c_topLOD].m_boundingBox[0];
boundingBox.Min()[1] = g_characterLODs[c_topLOD].m_boundingBox[1]; boundingBox.Min()[1] = g_actorLODs[c_topLOD].m_boundingBox[1];
boundingBox.Min()[2] = g_characterLODs[c_topLOD].m_boundingBox[2]; boundingBox.Min()[2] = g_actorLODs[c_topLOD].m_boundingBox[2];
boundingBox.Max()[0] = g_characterLODs[c_topLOD].m_boundingBox[3]; boundingBox.Max()[0] = g_actorLODs[c_topLOD].m_boundingBox[3];
boundingBox.Max()[1] = g_characterLODs[c_topLOD].m_boundingBox[4]; boundingBox.Max()[1] = g_actorLODs[c_topLOD].m_boundingBox[4];
boundingBox.Max()[2] = g_characterLODs[c_topLOD].m_boundingBox[5]; boundingBox.Max()[2] = g_actorLODs[c_topLOD].m_boundingBox[5];
roi->SetUnknown0x80(boundingBox); roi->SetUnknown0x80(boundingBox);
comp = new CompoundObject(); comp = new CompoundObject();
roi->SetComp(comp); roi->SetComp(comp);
for (i = 0; i < sizeOfArray(g_characterLODs) - 1; i++) { for (i = 0; i < sizeOfArray(g_actorLODs) - 1; i++) {
char lodName[256]; char lodName[256];
LegoCharacterInfo::Part& part = info->m_parts[i]; LegoActorInfo::Part& part = info->m_parts[i];
const char* parentName; const char* parentName;
if (i == 0 || i == 1) { if (i == 0 || i == 1) {
parentName = part.m_unk0x04[part.m_unk0x00[part.m_unk0x08]]; parentName = part.m_unk0x04[part.m_unk0x00[part.m_unk0x08]];
} }
else { else {
parentName = g_characterLODs[i + 1].m_parentName; parentName = g_actorLODs[i + 1].m_parentName;
} }
ViewLODList* lodList = lodManager->Lookup(parentName); ViewLODList* lodList = lodManager->Lookup(parentName);
@ -505,35 +505,34 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key)
LegoROI* childROI = new LegoROI(renderer, lodList); LegoROI* childROI = new LegoROI(renderer, lodList);
lodList->Release(); lodList->Release();
childROI->SetName(g_characterLODs[i + 1].m_name); childROI->SetName(g_actorLODs[i + 1].m_name);
childROI->SetParentROI(roi); childROI->SetParentROI(roi);
BoundingSphere childBoundingSphere; BoundingSphere childBoundingSphere;
childBoundingSphere.Center()[0] = g_characterLODs[i + 1].m_boundingSphere[0]; childBoundingSphere.Center()[0] = g_actorLODs[i + 1].m_boundingSphere[0];
childBoundingSphere.Center()[1] = g_characterLODs[i + 1].m_boundingSphere[1]; childBoundingSphere.Center()[1] = g_actorLODs[i + 1].m_boundingSphere[1];
childBoundingSphere.Center()[2] = g_characterLODs[i + 1].m_boundingSphere[2]; childBoundingSphere.Center()[2] = g_actorLODs[i + 1].m_boundingSphere[2];
childBoundingSphere.Radius() = g_characterLODs[i + 1].m_boundingSphere[3]; childBoundingSphere.Radius() = g_actorLODs[i + 1].m_boundingSphere[3];
childROI->SetBoundingSphere(childBoundingSphere); childROI->SetBoundingSphere(childBoundingSphere);
BoundingBox childBoundingBox; BoundingBox childBoundingBox;
childBoundingBox.Min()[0] = g_characterLODs[i + 1].m_boundingBox[0]; childBoundingBox.Min()[0] = g_actorLODs[i + 1].m_boundingBox[0];
childBoundingBox.Min()[1] = g_characterLODs[i + 1].m_boundingBox[1]; childBoundingBox.Min()[1] = g_actorLODs[i + 1].m_boundingBox[1];
childBoundingBox.Min()[2] = g_characterLODs[i + 1].m_boundingBox[2]; childBoundingBox.Min()[2] = g_actorLODs[i + 1].m_boundingBox[2];
childBoundingBox.Max()[0] = g_characterLODs[i + 1].m_boundingBox[3]; childBoundingBox.Max()[0] = g_actorLODs[i + 1].m_boundingBox[3];
childBoundingBox.Max()[1] = g_characterLODs[i + 1].m_boundingBox[4]; childBoundingBox.Max()[1] = g_actorLODs[i + 1].m_boundingBox[4];
childBoundingBox.Max()[2] = g_characterLODs[i + 1].m_boundingBox[5]; childBoundingBox.Max()[2] = g_actorLODs[i + 1].m_boundingBox[5];
childROI->SetUnknown0x80(childBoundingBox); childROI->SetUnknown0x80(childBoundingBox);
CalcLocalTransform( CalcLocalTransform(
Mx3DPointFloat(g_characterLODs[i + 1].m_position), Mx3DPointFloat(g_actorLODs[i + 1].m_position),
Mx3DPointFloat(g_characterLODs[i + 1].m_direction), Mx3DPointFloat(g_actorLODs[i + 1].m_direction),
Mx3DPointFloat(g_characterLODs[i + 1].m_up), Mx3DPointFloat(g_actorLODs[i + 1].m_up),
mat mat
); );
childROI->WrappedSetLocalTransform(mat); childROI->WrappedSetLocalTransform(mat);
if (g_characterLODs[i + 1].m_flags & LegoCharacterLOD::c_flag1 && if (g_actorLODs[i + 1].m_flags & LegoActorLOD::c_flag1 && (i != 0 || part.m_unk0x00[part.m_unk0x08] != 0)) {
(i != 0 || part.m_unk0x00[part.m_unk0x08] != 0)) {
LegoTextureInfo* textureInfo = textureContainer->Get(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]]); LegoTextureInfo* textureInfo = textureContainer->Get(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]]);
@ -542,7 +541,7 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key)
childROI->FUN_100a9170(1.0F, 1.0F, 1.0F, 0.0F); childROI->FUN_100a9170(1.0F, 1.0F, 1.0F, 0.0F);
} }
} }
else if (g_characterLODs[i + 1].m_flags & LegoCharacterLOD::c_flag2 || (i == 0 && part.m_unk0x00[part.m_unk0x08] == 0)) { else if (g_actorLODs[i + 1].m_flags & LegoActorLOD::c_flag2 || (i == 0 && part.m_unk0x00[part.m_unk0x08] == 0)) {
LegoFloat red, green, blue, alpha; LegoFloat red, green, blue, alpha;
childROI->FUN_100a9bf0(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]], red, green, blue, alpha); childROI->FUN_100a9bf0(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]], red, green, blue, alpha);
childROI->FUN_100a9170(red, green, blue, alpha); childROI->FUN_100a9170(red, green, blue, alpha);
@ -552,9 +551,9 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key)
} }
CalcLocalTransform( CalcLocalTransform(
Mx3DPointFloat(g_characterLODs[c_topLOD].m_position), Mx3DPointFloat(g_actorLODs[c_topLOD].m_position),
Mx3DPointFloat(g_characterLODs[c_topLOD].m_direction), Mx3DPointFloat(g_actorLODs[c_topLOD].m_direction),
Mx3DPointFloat(g_characterLODs[c_topLOD].m_up), Mx3DPointFloat(g_actorLODs[c_topLOD].m_up),
mat mat
); );
roi->WrappedSetLocalTransform(mat); roi->WrappedSetLocalTransform(mat);
@ -576,12 +575,12 @@ done:
MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_textureInfo) MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_textureInfo)
{ {
LegoResult result = SUCCESS; LegoResult result = SUCCESS;
LegoROI* head = FindChildROI(p_roi, g_characterLODs[c_headLOD].m_name); LegoROI* head = FindChildROI(p_roi, g_actorLODs[c_headLOD].m_name);
if (head != NULL) { if (head != NULL) {
char lodName[256]; char lodName[256];
ViewLODList* lodList = GetViewLODListManager()->Lookup(g_characterLODs[c_headLOD].m_parentName); ViewLODList* lodList = GetViewLODListManager()->Lookup(g_actorLODs[c_headLOD].m_parentName);
MxS32 lodSize = lodList->Size(); MxS32 lodSize = lodList->Size();
sprintf(lodName, "%s%s%d", p_roi->GetName(), "head", g_unk0x100fc4e8++); sprintf(lodName, "%s%s%d", p_roi->GetName(), "head", g_unk0x100fc4e8++);
ViewLODList* dupLodList = GetViewLODListManager()->Create(lodName, lodSize); ViewLODList* dupLodList = GetViewLODListManager()->Create(lodName, lodSize);
@ -589,8 +588,8 @@ MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_tex
Tgl::Renderer* renderer = VideoManager()->GetRenderer(); Tgl::Renderer* renderer = VideoManager()->GetRenderer();
if (p_textureInfo == NULL) { if (p_textureInfo == NULL) {
LegoCharacterInfo* info = GetInfo(p_roi->GetName()); LegoActorInfo* info = GetActorInfo(p_roi->GetName());
LegoCharacterInfo::Part& part = info->m_parts[c_headPart]; LegoActorInfo::Part& part = info->m_parts[c_headPart];
p_textureInfo = TextureContainer()->Get(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]]); p_textureInfo = TextureContainer()->Get(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]]);
} }
@ -620,10 +619,10 @@ MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_tex
} }
// FUNCTION: LEGO1 0x10084c00 // FUNCTION: LEGO1 0x10084c00
MxBool LegoCharacterManager::Exists(const char* p_key) MxBool LegoCharacterManager::IsActor(const char* p_name)
{ {
for (MxU32 i = 0; i < sizeOfArray(g_characterInfo); i++) { for (MxU32 i = 0; i < sizeOfArray(g_actorInfo); i++) {
if (!strcmpi(g_characterInfo[i].m_name, p_key)) { if (!strcmpi(g_actorInfo[i].m_name, p_name)) {
return TRUE; return TRUE;
} }
} }
@ -632,9 +631,9 @@ MxBool LegoCharacterManager::Exists(const char* p_key)
} }
// FUNCTION: LEGO1 0x10084c40 // FUNCTION: LEGO1 0x10084c40
LegoExtraActor* LegoCharacterManager::GetActor(const char* p_key) LegoExtraActor* LegoCharacterManager::GetExtraActor(const char* p_name)
{ {
LegoCharacterInfo* info = GetInfo(p_key); LegoActorInfo* info = GetActorInfo(p_name);
if (info != NULL) { if (info != NULL) {
return info->m_actor; return info->m_actor;
@ -644,36 +643,36 @@ LegoExtraActor* LegoCharacterManager::GetActor(const char* p_key)
} }
// FUNCTION: LEGO1 0x10084c60 // FUNCTION: LEGO1 0x10084c60
LegoCharacterInfo* LegoCharacterManager::GetInfo(const char* p_key) LegoActorInfo* LegoCharacterManager::GetActorInfo(const char* p_name)
{ {
MxU32 i; MxU32 i;
for (i = 0; i < sizeOfArray(g_characterInfo); i++) { for (i = 0; i < sizeOfArray(g_actorInfo); i++) {
if (!strcmpi(g_characterInfo[i].m_name, p_key)) { if (!strcmpi(g_actorInfo[i].m_name, p_name)) {
break; break;
} }
} }
if (i < sizeOfArray(g_characterInfo)) { if (i < sizeOfArray(g_actorInfo)) {
return &g_characterInfo[i]; return &g_actorInfo[i];
} }
return NULL; return NULL;
} }
// FUNCTION: LEGO1 0x10084cb0 // FUNCTION: LEGO1 0x10084cb0
LegoCharacterInfo* LegoCharacterManager::GetInfo(LegoROI* p_roi) LegoActorInfo* LegoCharacterManager::GetActorInfo(LegoROI* p_roi)
{ {
MxU32 i; MxU32 i;
for (i = 0; i < sizeOfArray(g_characterInfo); i++) { for (i = 0; i < sizeOfArray(g_actorInfo); i++) {
if (g_characterInfo[i].m_roi == p_roi) { if (g_actorInfo[i].m_roi == p_roi) {
break; break;
} }
} }
if (i < sizeOfArray(g_characterInfo)) { if (i < sizeOfArray(g_actorInfo)) {
return &g_characterInfo[i]; return &g_actorInfo[i];
} }
return NULL; return NULL;
@ -703,13 +702,13 @@ LegoROI* LegoCharacterManager::FindChildROI(LegoROI* p_roi, const char* p_name)
// FUNCTION: LEGO1 0x10084ec0 // FUNCTION: LEGO1 0x10084ec0
MxBool LegoCharacterManager::SwitchHat(LegoROI* p_roi) MxBool LegoCharacterManager::SwitchHat(LegoROI* p_roi)
{ {
LegoCharacterInfo* info = GetInfo(p_roi->GetName()); LegoActorInfo* info = GetActorInfo(p_roi->GetName());
if (info == NULL) { if (info == NULL) {
return FALSE; return FALSE;
} }
LegoCharacterInfo::Part& part = info->m_parts[c_infohatPart]; LegoActorInfo::Part& part = info->m_parts[c_infohatPart];
part.m_unk0x08++; part.m_unk0x08++;
MxU8 unk0x00 = part.m_unk0x00[part.m_unk0x08]; MxU8 unk0x00 = part.m_unk0x00[part.m_unk0x08];
@ -719,7 +718,7 @@ MxBool LegoCharacterManager::SwitchHat(LegoROI* p_roi)
unk0x00 = part.m_unk0x00[part.m_unk0x08]; unk0x00 = part.m_unk0x00[part.m_unk0x08];
} }
LegoROI* childROI = FindChildROI(p_roi, g_characterLODs[c_infohatLOD].m_name); LegoROI* childROI = FindChildROI(p_roi, g_actorLODs[c_infohatLOD].m_name);
if (childROI != NULL) { if (childROI != NULL) {
char lodName[256]; char lodName[256];
@ -757,7 +756,7 @@ MxBool LegoCharacterManager::SwitchHat(LegoROI* p_roi)
// FUNCTION: LEGO1 0x10085140 // FUNCTION: LEGO1 0x10085140
MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und) MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und)
{ {
LegoCharacterInfo* info = GetInfo(p_roi); LegoActorInfo* info = GetActorInfo(p_roi);
if (p_und) { if (p_und) {
return info->m_mood + g_unk0x100fc4dc; return info->m_mood + g_unk0x100fc4dc;
@ -774,7 +773,7 @@ MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und)
// FUNCTION: BETA10 0x100768c5 // FUNCTION: BETA10 0x100768c5
MxU8 LegoCharacterManager::GetMood(LegoROI* p_roi) MxU8 LegoCharacterManager::GetMood(LegoROI* p_roi)
{ {
LegoCharacterInfo* info = GetInfo(p_roi); LegoActorInfo* info = GetActorInfo(p_roi);
if (info != NULL) { if (info != NULL) {
return info->m_mood; return info->m_mood;
@ -803,7 +802,7 @@ void LegoCharacterManager::SetCustomizeAnimFile(const char* p_value)
} }
// FUNCTION: LEGO1 0x10085210 // FUNCTION: LEGO1 0x10085210
LegoROI* LegoCharacterManager::FUN_10085210(const char* p_name, const char* p_lodName, MxBool p_createEntity) LegoROI* LegoCharacterManager::CreateAutoROI(const char* p_name, const char* p_lodName, MxBool p_createEntity)
{ {
LegoROI* roi = NULL; LegoROI* roi = NULL;
@ -853,8 +852,8 @@ LegoROI* LegoCharacterManager::FUN_10085210(const char* p_name, const char* p_lo
LegoEntity* entity = new LegoEntity(); LegoEntity* entity = new LegoEntity();
entity->SetROI(roi, FALSE, FALSE); entity->SetROI(roi, FALSE, FALSE);
entity->SetType(LegoEntity::e_unk4); entity->SetType(LegoEntity::e_autoROI);
entity->SetFlag(LegoActor::c_bit2); entity->SetFlag(LegoEntity::c_managerOwned);
} }
} }
} }
@ -907,5 +906,5 @@ MxResult LegoCharacterManager::FUN_10085870(LegoROI* p_roi)
// FUNCTION: LEGO1 0x10085a80 // FUNCTION: LEGO1 0x10085a80
LegoROI* LegoCharacterManager::FUN_10085a80(const char* p_name, const char* p_lodName, MxBool p_createEntity) LegoROI* LegoCharacterManager::FUN_10085a80(const char* p_name, const char* p_lodName, MxBool p_createEntity)
{ {
return FUN_10085210(p_name, p_lodName, p_createEntity); return CreateAutoROI(p_name, p_lodName, p_createEntity);
} }

View file

@ -177,7 +177,7 @@ void LegoGameState::SetActor(MxU8 p_actorId)
IslePathActor* newActor = new IslePathActor(); IslePathActor* newActor = new IslePathActor();
const char* actorName = LegoActor::GetActorName(m_actorId); const char* actorName = LegoActor::GetActorName(m_actorId);
LegoROI* roi = CharacterManager()->GetROI(actorName, FALSE); LegoROI* roi = CharacterManager()->GetActorROI(actorName, FALSE);
MxDSAction action; MxDSAction action;
action.SetAtomId(*g_isleScript); action.SetAtomId(*g_isleScript);

View file

@ -370,7 +370,7 @@ void FUN_1003eda0()
LegoROI* viewROI = VideoManager()->GetViewROI(); LegoROI* viewROI = VideoManager()->GetViewROI();
if (viewROI) { if (viewROI) {
viewROI->FUN_100a5a30(vec); viewROI->FUN_100a5a30(vec);
SoundManager()->FUN_1002a410( SoundManager()->UpdateListener(
viewROI->GetWorldPosition(), viewROI->GetWorldPosition(),
viewROI->GetWorldDirection(), viewROI->GetWorldDirection(),
viewROI->GetWorldUp(), viewROI->GetWorldUp(),

View file

@ -15,7 +15,7 @@ const char* g_actorNames[] = {"none", "pepper", "mama", "papa", "nick", "laura",
// FUNCTION: LEGO1 0x1002d110 // FUNCTION: LEGO1 0x1002d110
LegoActor::LegoActor() LegoActor::LegoActor()
{ {
m_unk0x68 = 0.0f; m_frequencyFactor = 0.0f;
m_sound = NULL; m_sound = NULL;
m_unk0x70 = 0.0f; m_unk0x70 = 0.0f;
m_unk0x10 = 0; m_unk0x10 = 0;
@ -103,7 +103,7 @@ void LegoActor::ParseAction(char* p_extra)
} }
if (KeyValueStringParse(value, g_strSOUND, p_extra)) { if (KeyValueStringParse(value, g_strSOUND, p_extra)) {
m_sound = SoundManager()->GetCacheSoundManager()->FUN_1003dae0(value, GetROI()->GetName(), TRUE); m_sound = SoundManager()->GetCacheSoundManager()->Play(value, GetROI()->GetName(), TRUE);
} }
if (KeyValueStringParse(value, g_strMUTE, p_extra)) { if (KeyValueStringParse(value, g_strMUTE, p_extra)) {
@ -129,7 +129,7 @@ void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
for (MxU32 i = 1; i <= sizeOfArray(g_actorNames) - 1; i++) { for (MxU32 i = 1; i <= sizeOfArray(g_actorNames) - 1; i++) {
if (!strcmpi(name, g_actorNames[i])) { if (!strcmpi(name, g_actorNames[i])) {
m_type = e_character; m_type = e_actor;
m_actorId = i; m_actorId = i;
break; break;
} }

View file

@ -159,7 +159,7 @@ void LegoCameraController::FUN_100123e0(const Matrix4& p_transform, MxU32 p_und)
pov->WrappedSetLocalTransform(mat); pov->WrappedSetLocalTransform(mat);
m_lego3DView->Moved(*pov); m_lego3DView->Moved(*pov);
SoundManager()->FUN_1002a410( SoundManager()->UpdateListener(
pov->GetWorldPosition(), pov->GetWorldPosition(),
pov->GetWorldDirection(), pov->GetWorldDirection(),
pov->GetWorldUp(), pov->GetWorldUp(),

View file

@ -30,7 +30,7 @@ LegoCarRaceActor::LegoCarRaceActor()
m_unk0x70 = 0.0f; m_unk0x70 = 0.0f;
m_unk0x0c = 0; m_unk0x0c = 0;
m_unk0x13c = 0.0f; m_unk0x13c = 0.0f;
m_unk0x68 = 1.0f; m_frequencyFactor = 1.0f;
m_unk0x1c = 0; m_unk0x1c = 0;
m_unk0x10 = 0.65f; m_unk0x10 = 0.65f;
m_unk0x14 = 0.03f; m_unk0x14 = 0.03f;

View file

@ -31,7 +31,7 @@ void LegoEntity::Init()
m_flags = 0; m_flags = 0;
m_actionType = Extra::ActionType::e_unknown; m_actionType = Extra::ActionType::e_unknown;
m_targetEntityId = -1; m_targetEntityId = -1;
m_type = e_unk4; m_type = e_autoROI;
} }
// FUNCTION: LEGO1 0x10010650 // FUNCTION: LEGO1 0x10010650
@ -93,7 +93,7 @@ void LegoEntity::Destroy(MxBool p_fromDestructor)
m_roi->SetEntity(NULL); m_roi->SetEntity(NULL);
} }
CharacterManager()->FUN_10083db0(m_roi); CharacterManager()->ReleaseActor(m_roi);
} }
else { else {
VideoManager()->Get3DManager()->GetLego3DView()->Remove(*m_roi); VideoManager()->Get3DManager()->GetLego3DView()->Remove(*m_roi);
@ -252,7 +252,7 @@ void LegoEntity::VTable0x34(MxBool p_und)
const LegoChar* roiName = m_roi->GetName(); const LegoChar* roiName = m_roi->GetName();
switch (m_type) { switch (m_type) {
case e_character: case e_actor:
objectId = CharacterManager()->FUN_10085140(m_roi, p_und); objectId = CharacterManager()->FUN_10085140(m_roi, p_und);
break; break;
case e_unk1: case e_unk1:
@ -285,7 +285,7 @@ void LegoEntity::VTable0x38()
void LegoEntity::VTable0x3c() void LegoEntity::VTable0x3c()
{ {
switch (m_type) { switch (m_type) {
case e_character: case e_actor:
CharacterManager()->SwitchHat(m_roi); CharacterManager()->SwitchHat(m_roi);
break; break;
case e_unk1: case e_unk1:
@ -366,7 +366,7 @@ MxLong LegoEntity::Notify(MxParam& p_param)
break; break;
case 6: case 6:
switch (m_type) { switch (m_type) {
case e_character: case e_actor:
case e_unk1: case e_unk1:
break; break;
case e_plant: case e_plant:
@ -375,7 +375,7 @@ MxLong LegoEntity::Notify(MxParam& p_param)
case e_building: case e_building:
BuildingManager()->FUN_10030000(this); BuildingManager()->FUN_10030000(this);
break; break;
case e_unk4: case e_autoROI:
break; break;
} }
} }

View file

@ -421,7 +421,7 @@ MxResult LegoNavController::UpdateLocation(const char* p_location)
viewROI->WrappedSetLocalTransform(mat); viewROI->WrappedSetLocalTransform(mat);
VideoManager()->Get3DManager()->Moved(*viewROI); VideoManager()->Get3DManager()->Moved(*viewROI);
SoundManager()->FUN_1002a410( SoundManager()->UpdateListener(
viewROI->GetWorldPosition(), viewROI->GetWorldPosition(),
viewROI->GetWorldDirection(), viewROI->GetWorldDirection(),
viewROI->GetWorldUp(), viewROI->GetWorldUp(),
@ -458,7 +458,7 @@ MxResult LegoNavController::UpdateLocation(MxU32 p_location)
viewROI->WrappedSetLocalTransform(mat); viewROI->WrappedSetLocalTransform(mat);
VideoManager()->Get3DManager()->Moved(*viewROI); VideoManager()->Get3DManager()->Moved(*viewROI);
SoundManager()->FUN_1002a410( SoundManager()->UpdateListener(
viewROI->GetWorldPosition(), viewROI->GetWorldPosition(),
viewROI->GetWorldDirection(), viewROI->GetWorldDirection(),
viewROI->GetWorldUp(), viewROI->GetWorldUp(),

View file

@ -156,7 +156,7 @@ MxResult LegoPointOfViewController::Tickle()
pov->WrappedSetLocalTransform(mat); pov->WrappedSetLocalTransform(mat);
m_lego3DView->Moved(*pov); m_lego3DView->Moved(*pov);
SoundManager()->FUN_1002a410( SoundManager()->UpdateListener(
pov->GetWorldPosition(), pov->GetWorldPosition(),
pov->GetWorldDirection(), pov->GetWorldDirection(),
pov->GetWorldUp(), pov->GetWorldUp(),
@ -172,7 +172,7 @@ MxResult LegoPointOfViewController::Tickle()
vel.Clear(); vel.Clear();
pov->FUN_100a5a30(vel); pov->FUN_100a5a30(vel);
SoundManager()->FUN_1002a410( SoundManager()->UpdateListener(
pov->GetWorldPosition(), pov->GetWorldPosition(),
pov->GetWorldDirection(), pov->GetWorldDirection(),
pov->GetWorldUp(), pov->GetWorldUp(),

View file

@ -4,9 +4,11 @@
#include "legoanimationmanager.h" #include "legoanimationmanager.h"
#include "legoanimpresenter.h" #include "legoanimpresenter.h"
#include "legobuildingmanager.h" #include "legobuildingmanager.h"
#include "legocachesoundlist.h"
#include "legocachesoundmanager.h" #include "legocachesoundmanager.h"
#include "legocameracontroller.h" #include "legocameracontroller.h"
#include "legocontrolmanager.h" #include "legocontrolmanager.h"
#include "legoentitylist.h"
#include "legogamestate.h" #include "legogamestate.h"
#include "legoinputmanager.h" #include "legoinputmanager.h"
#include "legolocomotionanimpresenter.h" #include "legolocomotionanimpresenter.h"
@ -187,7 +189,7 @@ void LegoWorld::Destroy(MxBool p_fromDestructor)
while (cursor.First(entity)) { while (cursor.First(entity)) {
cursor.Detach(); cursor.Detach();
if (!(entity->GetFlags() & LegoEntity::c_bit2)) { if (!(entity->GetFlags() & LegoEntity::c_managerOwned)) {
delete entity; delete entity;
} }
} }
@ -202,7 +204,7 @@ void LegoWorld::Destroy(MxBool p_fromDestructor)
while (cursor.First(sound)) { while (cursor.First(sound)) {
cursor.Detach(); cursor.Detach();
SoundManager()->GetCacheSoundManager()->FUN_1003dc40(&sound); SoundManager()->GetCacheSoundManager()->Destroy(sound);
} }
delete m_cacheSoundList; delete m_cacheSoundList;

View file

@ -233,7 +233,7 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
m_roi->FUN_100a58f0(matrix2); m_roi->FUN_100a58f0(matrix2);
m_roi->VTable0x14(); m_roi->VTable0x14();
FUN_1002ad8a(); FUN_1002ad8a();
SoundManager()->GetCacheSoundManager()->FUN_1003dae0("crash5", m_roi->GetName(), FALSE); SoundManager()->GetCacheSoundManager()->Play("crash5", m_roi->GetName(), FALSE);
m_scheduledTime = Timer()->GetTime() + m_disAnim->GetDuration(); m_scheduledTime = Timer()->GetTime() + m_disAnim->GetDuration();
m_prevWorldSpeed = m_worldSpeed; m_prevWorldSpeed = m_worldSpeed;
VTable0xc4(); VTable0xc4();
@ -245,7 +245,7 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
if (b) { if (b) {
LegoROI* roi = m_roi; LegoROI* roi = m_roi;
SoundManager()->GetCacheSoundManager()->FUN_1003dae0("crash5", m_roi->GetName(), FALSE); SoundManager()->GetCacheSoundManager()->Play("crash5", m_roi->GetName(), FALSE);
VTable0xc4(); VTable0xc4();
m_state = 0x102; m_state = 0x102;
Mx3DPointFloat dir = p_actor->GetWorldDirection(); Mx3DPointFloat dir = p_actor->GetWorldDirection();

View file

@ -278,7 +278,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
const char* var = VariableTable()->GetVariable(g_strHIT_WALL_SOUND); const char* var = VariableTable()->GetVariable(g_strHIT_WALL_SOUND);
if (var && var[0] != 0) { if (var && var[0] != 0) {
SoundManager()->GetCacheSoundManager()->FUN_1003dae0(var, NULL, FALSE); SoundManager()->GetCacheSoundManager()->Play(var, NULL, FALSE);
} }
} }

View file

@ -188,7 +188,7 @@ LegoChar* LegoAnimPresenter::FUN_10069150(const LegoChar* p_und1)
{ {
LegoChar* str; LegoChar* str;
if (LegoCharacterManager::Exists(p_und1 + 1)) { if (LegoCharacterManager::IsActor(p_und1 + 1)) {
str = new LegoChar[strlen(p_und1)]; str = new LegoChar[strlen(p_und1)];
if (str != NULL) { if (str != NULL) {
@ -232,7 +232,7 @@ void LegoAnimPresenter::FUN_100692b0()
src = str; src = str;
} }
roi = CharacterManager()->GetROI(src, TRUE); roi = CharacterManager()->GetActorROI(src, TRUE);
if (roi != NULL && str[0] == '*') { if (roi != NULL && str[0] == '*') {
roi->SetVisibility(FALSE); roi->SetVisibility(FALSE);
@ -268,7 +268,7 @@ void LegoAnimPresenter::FUN_100692b0()
strlwr(lodName); strlwr(lodName);
LegoChar* und = FUN_10069150(str); LegoChar* und = FUN_10069150(str);
roi = CharacterManager()->FUN_10085210(und, lodName, TRUE); roi = CharacterManager()->CreateAutoROI(und, lodName, TRUE);
if (roi != NULL) { if (roi != NULL) {
roi->SetVisibility(FALSE); roi->SetVisibility(FALSE);
@ -313,7 +313,7 @@ void LegoAnimPresenter::FUN_100695c0()
strlwr(lodName); strlwr(lodName);
CharacterManager()->FUN_10085210(actorName, lodName, FALSE); CharacterManager()->CreateAutoROI(actorName, lodName, FALSE);
FUN_100698b0(rois, actorName); FUN_100698b0(rois, actorName);
} }
} }
@ -530,8 +530,8 @@ void LegoAnimPresenter::FUN_1006aa60()
while (cursor.Next(roi)) { while (cursor.Next(roi)) {
const char* name = roi->GetName(); const char* name = roi->GetName();
if (m_unk0x96 || !CharacterManager()->Exists(name)) { if (m_unk0x96 || !CharacterManager()->IsActor(name)) {
CharacterManager()->FUN_10083c30(name); CharacterManager()->ReleaseActor(name);
} }
} }
} }

View file

@ -224,7 +224,7 @@ MxResult LegoModelPresenter::FUN_1007ff70(
if (p_entity != NULL) { if (p_entity != NULL) {
p_entity->SetROI(m_roi, TRUE, TRUE); p_entity->SetROI(m_roi, TRUE, TRUE);
p_entity->ClearFlag(LegoEntity::c_bit2); p_entity->ClearFlag(LegoEntity::c_managerOwned);
} }
else { else {
p_world->GetROIList().push_back(m_roi); p_world->GetROIList().push_back(m_roi);
@ -249,9 +249,10 @@ void LegoModelPresenter::ReadyTickle()
((LegoEntityPresenter*) m_compositePresenter) ((LegoEntityPresenter*) m_compositePresenter)
->GetInternalEntity() ->GetInternalEntity()
->SetFlags( ->SetFlags(
((LegoEntityPresenter*) m_compositePresenter)->GetInternalEntity()->GetFlags() & ~LegoEntity::c_bit2 ((LegoEntityPresenter*) m_compositePresenter)->GetInternalEntity()->GetFlags() &
~LegoEntity::c_managerOwned
); );
((LegoEntityPresenter*) m_compositePresenter)->GetInternalEntity()->SetType(LegoEntity::e_character); ((LegoEntityPresenter*) m_compositePresenter)->GetInternalEntity()->SetType(LegoEntity::e_actor);
} }
ParseExtra(); ParseExtra();
@ -276,7 +277,7 @@ void LegoModelPresenter::ReadyTickle()
->GetInternalEntity() ->GetInternalEntity()
->SetFlags( ->SetFlags(
((LegoEntityPresenter*) m_compositePresenter)->GetInternalEntity()->GetFlags() & ((LegoEntityPresenter*) m_compositePresenter)->GetInternalEntity()->GetFlags() &
~LegoEntity::c_bit2 ~LegoEntity::c_managerOwned
); );
} }
@ -306,7 +307,7 @@ void LegoModelPresenter::ParseExtra()
char* token = strtok(output, g_parseExtraTokens); char* token = strtok(output, g_parseExtraTokens);
if (m_roi == NULL) { if (m_roi == NULL) {
m_roi = CharacterManager()->GetROI(token, FALSE); m_roi = CharacterManager()->GetActorROI(token, FALSE);
m_addedToView = FALSE; m_addedToView = FALSE;
} }
} }

View file

@ -52,7 +52,7 @@ void LegoPhonemePresenter::StartingTickle()
m_unk0x84 = TRUE; m_unk0x84 = TRUE;
} }
else { else {
entityROI = CharacterManager()->GetROI(m_roiName.GetData(), TRUE); entityROI = CharacterManager()->GetActorROI(m_roiName.GetData(), TRUE);
} }
head = entityROI->FindChildROI("head", entityROI); head = entityROI->FindChildROI("head", entityROI);
@ -143,7 +143,7 @@ void LegoPhonemePresenter::EndAction()
roi = FindROI(m_roiName.GetData()); roi = FindROI(m_roiName.GetData());
} }
else { else {
roi = CharacterManager()->GetROI(m_roiName.GetData(), TRUE); roi = CharacterManager()->GetActorROI(m_roiName.GetData(), TRUE);
} }
if (roi != NULL) { if (roi != NULL) {
@ -151,7 +151,7 @@ void LegoPhonemePresenter::EndAction()
} }
if (!m_unk0x84) { if (!m_unk0x84) {
CharacterManager()->FUN_10083c30(m_roiName.GetData()); CharacterManager()->ReleaseActor(m_roiName.GetData());
} }
TextureContainer()->EraseCached(phoneme->VTable0x10()); TextureContainer()->EraseCached(phoneme->VTable0x10());
@ -164,7 +164,7 @@ void LegoPhonemePresenter::EndAction()
} }
if (!m_unk0x84) { if (!m_unk0x84) {
CharacterManager()->FUN_10083c30(m_roiName.GetData()); CharacterManager()->ReleaseActor(m_roiName.GetData());
} }
} }
} }

View file

@ -1308,7 +1308,7 @@ void Infocenter::Reset()
PlantManager()->FUN_10027120(); PlantManager()->FUN_10027120();
BuildingManager()->FUN_10030590(); BuildingManager()->FUN_10030590();
AnimationManager()->Reset(FALSE); AnimationManager()->Reset(FALSE);
CharacterManager()->FUN_100832a0(); CharacterManager()->ReleaseAllActors();
GameState()->SetCurrentAct(LegoGameState::e_act1); GameState()->SetCurrentAct(LegoGameState::e_act1);
GameState()->SetPreviousArea(LegoGameState::e_undefined); GameState()->SetPreviousArea(LegoGameState::e_undefined);
GameState()->SetUnknown0x42c(LegoGameState::e_undefined); GameState()->SetUnknown0x42c(LegoGameState::e_undefined);

View file

@ -42,6 +42,9 @@ public:
void CopyMediaSrcPath(const char* p_mediaSrcPath); void CopyMediaSrcPath(const char* p_mediaSrcPath);
// FUNCTION: LEGO1 0x100186e0
inline const char* GetMediaSrcPath() { return m_mediaSrcPath; }
// FUNCTION: BETA10 0x1013c2e0 // FUNCTION: BETA10 0x1013c2e0
inline MxS32 GetFramesPerSecond() const { return m_framesPerSecond; } inline MxS32 GetFramesPerSecond() const { return m_framesPerSecond; }

View file

@ -36,8 +36,8 @@ public:
// MxDSSound::`scalar deleting destructor' // MxDSSound::`scalar deleting destructor'
private: private:
MxU32 m_sizeOnDisk; MxU32 m_sizeOnDisk; // 0xb8
MxS32 m_volume; // 0xbc MxS32 m_volume; // 0xbc
}; };
#endif // MXDSSOUND_H #endif // MXDSSOUND_H

View file

@ -299,8 +299,8 @@ void MxWavePresenter::SetVolume(MxS32 p_volume)
m_volume = p_volume; m_volume = p_volume;
if (m_dsBuffer != NULL) { if (m_dsBuffer != NULL) {
MxS32 volume = p_volume * MxOmni::GetInstance()->GetSoundManager()->GetVolume() / 100; MxS32 volume = p_volume * MxOmni::GetInstance()->GetSoundManager()->GetVolume() / 100;
MxS32 otherVolume = MxOmni::GetInstance()->GetSoundManager()->GetAttenuation(volume); MxS32 attenuation = MxOmni::GetInstance()->GetSoundManager()->GetAttenuation(volume);
m_dsBuffer->SetVolume(otherVolume); m_dsBuffer->SetVolume(attenuation);
} }
m_criticalSection.Leave(); m_criticalSection.Leave();