Merge remote-tracking branch 'isle/master'

This commit is contained in:
Christian Semmler 2025-07-23 13:21:39 -07:00
commit c774a8edde
No known key found for this signature in database
GPG Key ID: 086DAA1360BEEE5C
46 changed files with 489 additions and 243 deletions

View File

@ -313,10 +313,10 @@ target_sources(lego1 PRIVATE
LEGO1/omni/src/common/mxcompositepresenter.cpp LEGO1/omni/src/common/mxcompositepresenter.cpp
LEGO1/omni/src/common/mxcore.cpp LEGO1/omni/src/common/mxcore.cpp
LEGO1/omni/src/common/mxdebug.cpp LEGO1/omni/src/common/mxdebug.cpp
LEGO1/omni/src/common/mxmediamanager.cpp
LEGO1/omni/src/common/mxmediapresenter.cpp LEGO1/omni/src/common/mxmediapresenter.cpp
LEGO1/omni/src/common/mxmisc.cpp LEGO1/omni/src/common/mxmisc.cpp
LEGO1/omni/src/common/mxobjectfactory.cpp LEGO1/omni/src/common/mxobjectfactory.cpp
LEGO1/omni/src/common/mxpresentationmanager.cpp
LEGO1/omni/src/common/mxpresenter.cpp LEGO1/omni/src/common/mxpresenter.cpp
LEGO1/omni/src/common/mxstring.cpp LEGO1/omni/src/common/mxstring.cpp
LEGO1/omni/src/common/mxticklemanager.cpp LEGO1/omni/src/common/mxticklemanager.cpp

View File

@ -287,7 +287,7 @@ void IsleApp::SetupVideoFlags(
m_videoParam.Flags().SetLacksLightSupport(!hasLightSupport); m_videoParam.Flags().SetLacksLightSupport(!hasLightSupport);
m_videoParam.Flags().SetF1bit7(param_7); m_videoParam.Flags().SetF1bit7(param_7);
m_videoParam.Flags().SetWideViewAngle(wideViewAngle); m_videoParam.Flags().SetWideViewAngle(wideViewAngle);
m_videoParam.Flags().SetF2bit1(1); m_videoParam.Flags().SetEnabled(TRUE);
m_videoParam.SetDeviceName(deviceId); m_videoParam.SetDeviceName(deviceId);
if (using8bit) { if (using8bit) {
m_videoParam.Flags().Set16Bit(0); m_videoParam.Flags().Set16Bit(0);

View File

@ -211,7 +211,7 @@ class Ambulance : public IslePathActor {
MxS16 m_atPoliceTask; // 0x16c MxS16 m_atPoliceTask; // 0x16c
MxS16 m_atBeachTask; // 0x16e MxS16 m_atBeachTask; // 0x16e
MxS16 m_taskState; // 0x170 MxS16 m_taskState; // 0x170
MxS16 m_unk0x172; // 0x172 MxS16 m_enableRandomAudio; // 0x172
IsleScript::Script m_lastAction; // 0x174 IsleScript::Script m_lastAction; // 0x174
IsleScript::Script m_lastAnimation; // 0x178 IsleScript::Script m_lastAnimation; // 0x178
MxFloat m_fuel; // 0x17c MxFloat m_fuel; // 0x17c

View File

@ -48,10 +48,13 @@ typedef set<LegoCacheSoundEntry, Set100d6b4cComparator> Set100d6b4c;
typedef list<LegoCacheSoundEntry> List100d6b4c; typedef list<LegoCacheSoundEntry> List100d6b4c;
// VTABLE: LEGO1 0x100d6b4c // VTABLE: LEGO1 0x100d6b4c
// VTABLE: BETA10 0x101becac
// SIZE 0x20 // SIZE 0x20
class LegoCacheSoundManager { class LegoCacheSoundManager {
public: public:
// FUNCTION: BETA10 0x100d0a60
LegoCacheSoundManager() {} LegoCacheSoundManager() {}
~LegoCacheSoundManager(); ~LegoCacheSoundManager();
virtual MxResult Tickle(); // vtable+0x00 virtual MxResult Tickle(); // vtable+0x00
@ -68,6 +71,9 @@ class LegoCacheSoundManager {
List100d6b4c m_list; // 0x14 List100d6b4c m_list; // 0x14
}; };
// SYNTHETIC: BETA10 0x100d06b0
// LegoCacheSoundManager::`scalar deleting destructor'
// TODO: Function names subject to change. // TODO: Function names subject to change.
// clang-format off // clang-format off

View File

@ -38,17 +38,17 @@ class LegoCameraController : public LegoPointOfViewController {
virtual MxResult Create(); // vtable+0x44 virtual MxResult Create(); // vtable+0x44
void SetWorldTransform(const Vector3& p_at, const Vector3& p_dir, const Vector3& p_up); void SetWorldTransform(const Vector3& p_at, const Vector3& p_dir, const Vector3& p_up);
void FUN_10012290(float p_angle); void RotateZ(float p_angle);
void FUN_10012320(float p_angle); void RotateY(float p_angle);
MxResult FUN_100123b0(Matrix4& p_matrix); MxResult GetPointOfView(Matrix4& p_matrix);
void FUN_100123e0(const Matrix4& p_transform, MxU32 p_und); void TransformPointOfView(const Matrix4& p_transform, MxU32 p_multiply);
Mx3DPointFloat GetWorldUp(); Mx3DPointFloat GetWorldUp();
Mx3DPointFloat GetWorldLocation(); Mx3DPointFloat GetWorldLocation();
Mx3DPointFloat GetWorldDirection(); Mx3DPointFloat GetWorldDirection();
private: private:
MxMatrix m_matrix1; // 0x38 MxMatrix m_currentTransform; // 0x38
MxMatrix m_matrix2; // 0x80 MxMatrix m_originalTransform; // 0x80
}; };
// SYNTHETIC: LEGO1 0x10011f50 // SYNTHETIC: LEGO1 0x10011f50

View File

@ -48,6 +48,7 @@ struct LegoActorInfo;
typedef map<char*, LegoCharacter*, LegoCharacterComparator> LegoCharacterMap; typedef map<char*, LegoCharacter*, LegoCharacterComparator> LegoCharacterMap;
// VTABLE: LEGO1 0x100da878 // VTABLE: LEGO1 0x100da878
// VTABLE: BETA10 0x101bc028
// SIZE 0x24 // SIZE 0x24
class CustomizeAnimFileVariable : public MxVariable { class CustomizeAnimFileVariable : public MxVariable {
public: public:

View File

@ -30,6 +30,7 @@ struct InternationalCharacter {
}; };
// VTABLE: LEGO1 0x100d74a8 // VTABLE: LEGO1 0x100d74a8
// VTABLE: BETA10 0x101bc4f0
// SIZE 0x30 // SIZE 0x30
class LegoBackgroundColor : public MxVariable { class LegoBackgroundColor : public MxVariable {
public: public:
@ -50,9 +51,11 @@ class LegoBackgroundColor : public MxVariable {
}; };
// VTABLE: LEGO1 0x100d74b8 // VTABLE: LEGO1 0x100d74b8
// VTABLE: BETA10 0x101bc500
// SIZE 0x24 // SIZE 0x24
class LegoFullScreenMovie : public MxVariable { class LegoFullScreenMovie : public MxVariable {
public: public:
LegoFullScreenMovie();
LegoFullScreenMovie(const char* p_key, const char* p_value); LegoFullScreenMovie(const char* p_key, const char* p_value);
void SetValue(const char* p_option) override; // vtable+0x04 void SetValue(const char* p_option) override; // vtable+0x04

View File

@ -17,15 +17,15 @@ class LegoSoundManager : public MxSoundManager {
void Destroy() override; // vtable+0x18 void Destroy() override; // vtable+0x18
MxResult Create(MxU32 p_frequencyMS, MxBool p_createThread) override; // vtable+0x30 MxResult Create(MxU32 p_frequencyMS, MxBool p_createThread) override; // vtable+0x30
// SYNTHETIC: LEGO1 0x10029920
// SYNTHETIC: BETA10 0x100d0660
// LegoSoundManager::`scalar deleting destructor'
void UpdateListener(const float* p_position, const float* p_direction, const float* p_up, const float* p_velocity); void UpdateListener(const float* p_position, const float* p_direction, const float* p_up, const float* p_velocity);
// FUNCTION: BETA10 0x1000f350 // FUNCTION: BETA10 0x1000f350
LegoCacheSoundManager* GetCacheSoundManager() { return m_cacheSoundManager; } LegoCacheSoundManager* GetCacheSoundManager() { return m_cacheSoundManager; }
// SYNTHETIC: LEGO1 0x10029920
// SYNTHETIC: BETA10 0x100d0660
// LegoSoundManager::`scalar deleting destructor'
private: private:
void Init(); void Init();
void Destroy(MxBool p_fromDestructor); void Destroy(MxBool p_fromDestructor);

View File

@ -17,41 +17,60 @@ extern const char* g_varVISIBILITY;
extern const char* g_varCAMERALOCATION; extern const char* g_varCAMERALOCATION;
extern const char* g_varCURSOR; extern const char* g_varCURSOR;
extern const char* g_varWHOAMI; extern const char* g_varWHOAMI;
extern const char* g_varDEBUG;
// VTABLE: LEGO1 0x100d86c8 // VTABLE: LEGO1 0x100d86c8
// VTABLE: BETA10 0x101bc980
// SIZE 0x24 // SIZE 0x24
class VisibilityVariable : public MxVariable { class VisibilityVariable : public MxVariable {
public: public:
// FUNCTION: BETA10 0x10093470
VisibilityVariable() { m_key = g_varVISIBILITY; } VisibilityVariable() { m_key = g_varVISIBILITY; }
void SetValue(const char* p_value) override; // vtable+0x04 void SetValue(const char* p_value) override; // vtable+0x04
}; };
// VTABLE: LEGO1 0x100d86b8 // VTABLE: LEGO1 0x100d86b8
// VTABLE: BETA10 0x101bc990
// SIZE 0x24 // SIZE 0x24
class CameraLocationVariable : public MxVariable { class CameraLocationVariable : public MxVariable {
public: public:
// FUNCTION: BETA10 0x10093510
CameraLocationVariable() { m_key = g_varCAMERALOCATION; } CameraLocationVariable() { m_key = g_varCAMERALOCATION; }
void SetValue(const char* p_value) override; // vtable+0x04 void SetValue(const char* p_value) override; // vtable+0x04
}; };
// VTABLE: LEGO1 0x100d86a8 // VTABLE: LEGO1 0x100d86a8
// VTABLE: BETA10 0x101bc9a0
// SIZE 0x24 // SIZE 0x24
class CursorVariable : public MxVariable { class CursorVariable : public MxVariable {
public: public:
// FUNCTION: BETA10 0x100935b0
CursorVariable() { m_key = g_varCURSOR; } CursorVariable() { m_key = g_varCURSOR; }
void SetValue(const char* p_value) override; // vtable+0x04 void SetValue(const char* p_value) override; // vtable+0x04
}; };
// VTABLE: LEGO1 0x100d8698 // VTABLE: LEGO1 0x100d8698
// VTABLE: BETA10 0x101bc9b0
// SIZE 0x24 // SIZE 0x24
class WhoAmIVariable : public MxVariable { class WhoAmIVariable : public MxVariable {
public: public:
// FUNCTION: BETA10 0x10093650
WhoAmIVariable() { m_key = g_varWHOAMI; } WhoAmIVariable() { m_key = g_varWHOAMI; }
void SetValue(const char* p_value) override; // vtable+0x04 void SetValue(const char* p_value) override; // vtable+0x04
}; };
// VTABLE: BETA10 0x101bc9c0
// SIZE 0x24
class DebugVariable : public MxVariable {
public:
// FUNCTION: BETA10 0x100936f0
DebugVariable() { m_key = g_varDEBUG; }
void SetValue(const char* p_value) override; // vtable+0x04
};
#endif // LEGOVARIABLES_H #endif // LEGOVARIABLES_H

View File

@ -44,7 +44,7 @@ Ambulance::Ambulance()
m_atBeachTask = 0; m_atBeachTask = 0;
m_taskState = Ambulance::e_none; m_taskState = Ambulance::e_none;
m_lastAction = IsleScript::c_noneIsle; m_lastAction = IsleScript::c_noneIsle;
m_unk0x172 = 0; m_enableRandomAudio = 0;
m_lastAnimation = IsleScript::c_noneIsle; m_lastAnimation = IsleScript::c_noneIsle;
m_fuel = 1.0; m_fuel = 1.0;
} }
@ -176,7 +176,7 @@ MxLong Ambulance::HandleEndAction(MxEndActionNotificationParam& p_param)
m_state->m_state = AmbulanceMissionState::e_enteredAmbulance; m_state->m_state = AmbulanceMissionState::e_enteredAmbulance;
CurrentWorld()->PlaceActor(UserActor()); CurrentWorld()->PlaceActor(UserActor());
HandleClick(); HandleClick();
m_unk0x172 = 0; m_enableRandomAudio = 0;
TickleManager()->RegisterClient(this, 40000); TickleManager()->RegisterClient(this, 40000);
} }
else if (objectId == IsleScript::c_hpz047pe_RunAnim || objectId == IsleScript::c_hpz048pe_RunAnim || objectId == IsleScript::c_hpz049bd_RunAnim || objectId == IsleScript::c_hpz053pa_RunAnim) { else if (objectId == IsleScript::c_hpz047pe_RunAnim || objectId == IsleScript::c_hpz048pe_RunAnim || objectId == IsleScript::c_hpz049bd_RunAnim || objectId == IsleScript::c_hpz053pa_RunAnim) {
@ -201,7 +201,7 @@ MxLong Ambulance::HandleEndAction(MxEndActionNotificationParam& p_param)
CurrentWorld()->PlaceActor(UserActor()); CurrentWorld()->PlaceActor(UserActor());
HandleClick(); HandleClick();
SpawnPlayer(LegoGameState::e_pizzeriaExterior, TRUE, 0); SpawnPlayer(LegoGameState::e_pizzeriaExterior, TRUE, 0);
m_unk0x172 = 0; m_enableRandomAudio = 0;
TickleManager()->RegisterClient(this, 40000); TickleManager()->RegisterClient(this, 40000);
if (m_atPoliceTask != 0) { if (m_atPoliceTask != 0) {
@ -225,7 +225,7 @@ MxLong Ambulance::HandleEndAction(MxEndActionNotificationParam& p_param)
CurrentWorld()->PlaceActor(UserActor()); CurrentWorld()->PlaceActor(UserActor());
HandleClick(); HandleClick();
SpawnPlayer(LegoGameState::e_policeExited, TRUE, 0); SpawnPlayer(LegoGameState::e_policeExited, TRUE, 0);
m_unk0x172 = 0; m_enableRandomAudio = 0;
TickleManager()->RegisterClient(this, 40000); TickleManager()->RegisterClient(this, 40000);
if (m_atBeachTask != 0) { if (m_atBeachTask != 0) {
@ -516,8 +516,8 @@ void Ambulance::ActivateSceneActions()
// FUNCTION: BETA10 0x100237df // FUNCTION: BETA10 0x100237df
MxResult Ambulance::Tickle() MxResult Ambulance::Tickle()
{ {
if (m_unk0x172 == 0) { if (m_enableRandomAudio == 0) {
m_unk0x172 = 1; m_enableRandomAudio = 1;
} }
else if (m_lastAction == IsleScript::c_noneIsle) { else if (m_lastAction == IsleScript::c_noneIsle) {
IsleScript::Script objectId; IsleScript::Script objectId;

View File

@ -426,7 +426,7 @@ void Helicopter::Animate(float p_time)
v2 *= f2; v2 *= f2;
v2 += v1; v2 += v1;
m_world->GetCameraController()->FUN_100123e0(mat, 0); m_world->GetCameraController()->TransformPointOfView(mat, 0);
} }
else { else {
if (m_state->m_unk0x08 == 4) { if (m_state->m_unk0x08 == 4) {
@ -459,7 +459,7 @@ void Helicopter::FUN_100042a0(const Matrix4& p_matrix)
// the typecast makes this function match for unknown reasons // the typecast makes this function match for unknown reasons
Vector3 vec6((const float*) m_unk0x1a8[3]); // locala0 // esp+0x28 Vector3 vec6((const float*) m_unk0x1a8[3]); // locala0 // esp+0x28
m_world->GetCameraController()->FUN_100123b0(local48); m_world->GetCameraController()->GetPointOfView(local48);
m_unk0x1a8.SetIdentity(); m_unk0x1a8.SetIdentity();
local90 = p_matrix; local90 = p_matrix;

View File

@ -7,6 +7,7 @@ DECOMP_SIZE_ASSERT(LegoCacheSoundEntry, 0x08)
DECOMP_SIZE_ASSERT(LegoCacheSoundManager, 0x20) DECOMP_SIZE_ASSERT(LegoCacheSoundManager, 0x20)
// FUNCTION: LEGO1 0x1003cf20 // FUNCTION: LEGO1 0x1003cf20
// STUB: BETA10 0x100d0700
LegoCacheSoundManager::~LegoCacheSoundManager() LegoCacheSoundManager::~LegoCacheSoundManager()
{ {
LegoCacheSound* sound; LegoCacheSound* sound;
@ -28,6 +29,7 @@ LegoCacheSoundManager::~LegoCacheSoundManager()
} }
// FUNCTION: LEGO1 0x1003d050 // FUNCTION: LEGO1 0x1003d050
// STUB: BETA10 0x100652f0
MxResult LegoCacheSoundManager::Tickle() MxResult LegoCacheSoundManager::Tickle()
{ {
#ifdef COMPAT_MODE #ifdef COMPAT_MODE

View File

@ -9,24 +9,28 @@
DECOMP_SIZE_ASSERT(LegoSoundManager, 0x44) DECOMP_SIZE_ASSERT(LegoSoundManager, 0x44)
// FUNCTION: LEGO1 0x100298a0 // FUNCTION: LEGO1 0x100298a0
// FUNCTION: BETA10 0x100cffb0
LegoSoundManager::LegoSoundManager() LegoSoundManager::LegoSoundManager()
{ {
Init(); Init();
} }
// FUNCTION: LEGO1 0x10029940 // FUNCTION: LEGO1 0x10029940
// FUNCTION: BETA10 0x100d0027
LegoSoundManager::~LegoSoundManager() LegoSoundManager::~LegoSoundManager()
{ {
Destroy(TRUE); Destroy(TRUE);
} }
// FUNCTION: LEGO1 0x100299a0 // FUNCTION: LEGO1 0x100299a0
// FUNCTION: BETA10 0x100d0099
void LegoSoundManager::Init() void LegoSoundManager::Init()
{ {
m_cacheSoundManager = NULL; m_cacheSoundManager = NULL;
} }
// FUNCTION: LEGO1 0x100299b0 // FUNCTION: LEGO1 0x100299b0
// FUNCTION: BETA10 0x100d00c9
void LegoSoundManager::Destroy(MxBool p_fromDestructor) void LegoSoundManager::Destroy(MxBool p_fromDestructor)
{ {
delete m_cacheSoundManager; delete m_cacheSoundManager;
@ -41,16 +45,18 @@ void LegoSoundManager::Destroy(MxBool p_fromDestructor)
// FUNCTION: BETA10 0x100d0129 // FUNCTION: BETA10 0x100d0129
MxResult LegoSoundManager::Create(MxU32 p_frequencyMS, MxBool p_createThread) MxResult LegoSoundManager::Create(MxU32 p_frequencyMS, MxBool p_createThread)
{ {
MxBool locked = FALSE;
MxResult result = FAILURE; MxResult result = FAILURE;
MxBool locked = FALSE;
if (MxSoundManager::Create(10, FALSE) != SUCCESS) {
goto done;
}
if (MxSoundManager::Create(10, FALSE) == SUCCESS) {
ENTER(m_criticalSection); ENTER(m_criticalSection);
locked = TRUE; locked = TRUE;
m_cacheSoundManager = new LegoCacheSoundManager; m_cacheSoundManager = new LegoCacheSoundManager;
assert(m_cacheSoundManager); assert(m_cacheSoundManager);
result = SUCCESS; result = SUCCESS;
}
done: done:
if (result != SUCCESS) { if (result != SUCCESS) {

View File

@ -1092,6 +1092,7 @@ LegoROI* LegoCharacterManager::FUN_10085a80(const char* p_name, const char* p_lo
} }
// FUNCTION: LEGO1 0x10085aa0 // FUNCTION: LEGO1 0x10085aa0
// FUNCTION: BETA10 0x1007703d
CustomizeAnimFileVariable::CustomizeAnimFileVariable(const char* p_key) CustomizeAnimFileVariable::CustomizeAnimFileVariable(const char* p_key)
{ {
m_key = p_key; m_key = p_key;
@ -1099,6 +1100,7 @@ CustomizeAnimFileVariable::CustomizeAnimFileVariable(const char* p_key)
} }
// FUNCTION: LEGO1 0x10085b50 // FUNCTION: LEGO1 0x10085b50
// FUNCTION: BETA10 0x100770c8
void CustomizeAnimFileVariable::SetValue(const char* p_value) void CustomizeAnimFileVariable::SetValue(const char* p_value)
{ {
// STRING: LEGO1 0x100fc4f4 // STRING: LEGO1 0x100fc4f4

View File

@ -1349,6 +1349,11 @@ void LegoBackgroundColor::SetLightColor()
SetLightColor(convertedR, convertedG, convertedB); SetLightColor(convertedR, convertedG, convertedB);
} }
// FUNCTION: BETA10 0x10086a87
LegoFullScreenMovie::LegoFullScreenMovie()
{
}
// FUNCTION: LEGO1 0x1003c500 // FUNCTION: LEGO1 0x1003c500
// FUNCTION: BETA10 0x10086af6 // FUNCTION: BETA10 0x10086af6
LegoFullScreenMovie::LegoFullScreenMovie(const char* p_key, const char* p_value) LegoFullScreenMovie::LegoFullScreenMovie(const char* p_key, const char* p_value)

View File

@ -6,6 +6,7 @@
#include "legonavcontroller.h" #include "legonavcontroller.h"
#include "legovideomanager.h" #include "legovideomanager.h"
#include "misc.h" #include "misc.h"
#include "mxdebug.h"
#include "roi/legoroi.h" #include "roi/legoroi.h"
#include <SDL3/SDL_stdinc.h> #include <SDL3/SDL_stdinc.h>
@ -103,6 +104,10 @@ const char* g_nick = "Nick";
// STRING: LEGO1 0x100f39e0 // STRING: LEGO1 0x100f39e0
const char* g_laura = "Laura"; const char* g_laura = "Laura";
// GLOBAL: BETA10 0x101f6ce4
// STRING: BETA10 0x101f6d54
const char* g_varDEBUG = "DEBUG";
// FUNCTION: LEGO1 0x10037d00 // FUNCTION: LEGO1 0x10037d00
// FUNCTION: BETA10 0x100d5620 // FUNCTION: BETA10 0x100d5620
void VisibilityVariable::SetValue(const char* p_value) void VisibilityVariable::SetValue(const char* p_value)
@ -132,6 +137,7 @@ void VisibilityVariable::SetValue(const char* p_value)
} }
// FUNCTION: LEGO1 0x10037d80 // FUNCTION: LEGO1 0x10037d80
// FUNCTION: BETA10 0x100d56ee
void CameraLocationVariable::SetValue(const char* p_value) void CameraLocationVariable::SetValue(const char* p_value)
{ {
char buffer[256]; char buffer[256];
@ -139,22 +145,25 @@ void CameraLocationVariable::SetValue(const char* p_value)
strcpy(buffer, p_value); strcpy(buffer, p_value);
char* location = strtok(buffer, ","); char* token = strtok(buffer, ",");
NavController()->UpdateLocation(location); assert(token);
NavController()->UpdateLocation(token);
location = strtok(NULL, ","); token = strtok(NULL, ",");
if (location) { if (token) {
MxFloat pov = (MxFloat) atof(location); MxFloat pov = (MxFloat) atof(token);
VideoManager()->Get3DManager()->SetFrustrum(pov, 0.1f, 250.0f); VideoManager()->Get3DManager()->SetFrustrum(pov, 0.1f, 250.0f);
} }
} }
// FUNCTION: LEGO1 0x10037e30 // FUNCTION: LEGO1 0x10037e30
// FUNCTION: BETA10 0x100d57e2
void CursorVariable::SetValue(const char* p_value) void CursorVariable::SetValue(const char* p_value)
{ {
} }
// FUNCTION: LEGO1 0x10037e40 // FUNCTION: LEGO1 0x10037e40
// FUNCTION: BETA10 0x100d57fa
void WhoAmIVariable::SetValue(const char* p_value) void WhoAmIVariable::SetValue(const char* p_value)
{ {
MxVariable::SetValue(p_value); MxVariable::SetValue(p_value);
@ -175,3 +184,10 @@ void WhoAmIVariable::SetValue(const char* p_value)
GameState()->SetActorId(LegoActor::c_laura); GameState()->SetActorId(LegoActor::c_laura);
} }
} }
// FUNCTION: BETA10 0x100d58fa
void DebugVariable::SetValue(const char* p_value)
{
MxVariable::SetValue(p_value);
MxTrace("%s\n", p_value);
}

View File

@ -124,28 +124,28 @@ void LegoCameraController::OnMouseMove(MxU8 p_modifier, MxPoint32 p_point)
// FUNCTION: LEGO1 0x10012260 // FUNCTION: LEGO1 0x10012260
void LegoCameraController::SetWorldTransform(const Vector3& p_at, const Vector3& p_dir, const Vector3& p_up) void LegoCameraController::SetWorldTransform(const Vector3& p_at, const Vector3& p_dir, const Vector3& p_up)
{ {
CalcLocalTransform(p_at, p_dir, p_up, m_matrix1); CalcLocalTransform(p_at, p_dir, p_up, m_currentTransform);
m_matrix2 = m_matrix1; m_originalTransform = m_currentTransform;
} }
// FUNCTION: LEGO1 0x10012290 // FUNCTION: LEGO1 0x10012290
// FUNCTION: BETA10 0x10068c34 // FUNCTION: BETA10 0x10068c34
void LegoCameraController::FUN_10012290(float p_angle) void LegoCameraController::RotateZ(float p_angle)
{ {
m_matrix1 = m_matrix2; m_currentTransform = m_originalTransform;
m_matrix1.RotateZ(p_angle); m_currentTransform.RotateZ(p_angle);
} }
// FUNCTION: LEGO1 0x10012320 // FUNCTION: LEGO1 0x10012320
// FUNCTION: BETA10 0x10068c73 // FUNCTION: BETA10 0x10068c73
void LegoCameraController::FUN_10012320(float p_angle) void LegoCameraController::RotateY(float p_angle)
{ {
m_matrix1 = m_matrix2; m_currentTransform = m_originalTransform;
m_matrix1.RotateY(p_angle); m_currentTransform.RotateY(p_angle);
} }
// FUNCTION: LEGO1 0x100123b0 // FUNCTION: LEGO1 0x100123b0
MxResult LegoCameraController::FUN_100123b0(Matrix4& p_matrix) MxResult LegoCameraController::GetPointOfView(Matrix4& p_matrix)
{ {
if (m_lego3DView) { if (m_lego3DView) {
ViewROI* pov = m_lego3DView->GetPointOfView(); ViewROI* pov = m_lego3DView->GetPointOfView();
@ -160,7 +160,7 @@ MxResult LegoCameraController::FUN_100123b0(Matrix4& p_matrix)
// FUNCTION: LEGO1 0x100123e0 // FUNCTION: LEGO1 0x100123e0
// FUNCTION: BETA10 0x10068cb2 // FUNCTION: BETA10 0x10068cb2
void LegoCameraController::FUN_100123e0(const Matrix4& p_transform, MxU32 p_und) void LegoCameraController::TransformPointOfView(const Matrix4& p_transform, MxU32 p_multiply)
{ {
if (m_lego3DView != NULL) { if (m_lego3DView != NULL) {
ViewROI* pov = m_lego3DView->GetPointOfView(); ViewROI* pov = m_lego3DView->GetPointOfView();
@ -168,8 +168,8 @@ void LegoCameraController::FUN_100123e0(const Matrix4& p_transform, MxU32 p_und)
if (pov != NULL) { if (pov != NULL) {
MxMatrix mat; MxMatrix mat;
if (p_und) { if (p_multiply) {
MXM4(mat, m_matrix1, p_transform); MXM4(mat, m_currentTransform, p_transform);
} }
else { else {
mat = p_transform; mat = p_transform;

View File

@ -197,7 +197,7 @@ void LegoEntity::FUN_10010c30()
LegoWorld* world = CurrentWorld(); LegoWorld* world = CurrentWorld();
if (m_cameraFlag && world && world->GetCameraController() && m_roi) { if (m_cameraFlag && world && world->GetCameraController() && m_roi) {
world->GetCameraController()->FUN_100123e0(m_roi->GetLocal2World(), 1); world->GetCameraController()->TransformPointOfView(m_roi->GetLocal2World(), 1);
} }
} }

View File

@ -555,7 +555,7 @@ MxResult LegoNavController::ProcessJoystickInput(MxBool& p_und)
LegoWorld* world = CurrentWorld(); LegoWorld* world = CurrentWorld();
if (world && world->GetCameraController()) { if (world && world->GetCameraController()) {
world->GetCameraController()->FUN_10012320(DTOR(povPosition)); world->GetCameraController()->RotateY(DTOR(povPosition));
p_und = TRUE; p_und = TRUE;
} }
} }

View File

@ -440,7 +440,7 @@ void LegoPathActor::Animate(float p_time)
LegoWorld* world = CurrentWorld(); LegoWorld* world = CurrentWorld();
if (world) { if (world) {
world->GetCameraController()->FUN_10012290(DTOR(m_unk0x14c)); world->GetCameraController()->RotateZ(DTOR(m_unk0x14c));
} }
} }
} }

View File

@ -340,10 +340,10 @@ void LegoRaceCar::KickCamera(float p_param)
transformationMatrix.SetIdentity(); transformationMatrix.SetIdentity();
// Possible bug in the original code: The first argument is not initialized // Possible bug in the original code: The first argument is not initialized
a->GetAnimTreePtr()->GetCamAnim()->FUN_1009f490(deltaTime, transformationMatrix); a->GetAnimTreePtr()->GetCamAnim()->CalculateCameraTransform(deltaTime, transformationMatrix);
if (r->GetCameraController()) { if (r->GetCameraController()) {
r->GetCameraController()->FUN_100123e0(transformationMatrix, 0); r->GetCameraController()->TransformPointOfView(transformationMatrix, 0);
} }
m_roi->SetLocal2World(transformationMatrix); m_roi->SetLocal2World(transformationMatrix);

View File

@ -941,10 +941,10 @@ void LegoAnimPresenter::FUN_1006b9a0(LegoAnim* p_anim, MxLong p_time, Matrix4* p
if (p_anim->GetCamAnim() != NULL) { if (p_anim->GetCamAnim() != NULL) {
MxMatrix transform(mat); MxMatrix transform(mat);
p_anim->GetCamAnim()->FUN_1009f490(p_time, transform); p_anim->GetCamAnim()->CalculateCameraTransform(p_time, transform);
if (m_currentWorld != NULL && m_currentWorld->GetCameraController() != NULL) { if (m_currentWorld != NULL && m_currentWorld->GetCameraController() != NULL) {
m_currentWorld->GetCameraController()->FUN_100123e0(transform, 0); m_currentWorld->GetCameraController()->TransformPointOfView(transform, FALSE);
} }
} }

View File

@ -545,14 +545,14 @@ void LegoVideoManager::EnableFullScreenMovie(MxBool p_enable, MxBool p_scale)
m_palette = m_videoParam.GetPalette()->Clone(); m_palette = m_videoParam.GetPalette()->Clone();
OverrideSkyColor(FALSE); OverrideSkyColor(FALSE);
m_displaySurface->GetVideoParam().Flags().SetF1bit3(p_scale); m_displaySurface->GetVideoParam().Flags().SetDoubleScaling(p_scale);
m_render3d = FALSE; m_render3d = FALSE;
m_fullScreenMovie = TRUE; m_fullScreenMovie = TRUE;
} }
else { else {
m_displaySurface->ClearScreen(); m_displaySurface->ClearScreen();
m_displaySurface->GetVideoParam().Flags().SetF1bit3(FALSE); m_displaySurface->GetVideoParam().Flags().SetDoubleScaling(FALSE);
// restore previous pallete // restore previous pallete
RealizePalette(m_palette); RealizePalette(m_palette);
@ -577,10 +577,10 @@ void LegoVideoManager::EnableFullScreenMovie(MxBool p_enable, MxBool p_scale)
} }
if (p_enable) { if (p_enable) {
m_displaySurface->GetVideoParam().Flags().SetF1bit3(p_scale); m_displaySurface->GetVideoParam().Flags().SetDoubleScaling(p_scale);
} }
else { else {
m_displaySurface->GetVideoParam().Flags().SetF1bit3(FALSE); m_displaySurface->GetVideoParam().Flags().SetDoubleScaling(FALSE);
} }
} }

View File

@ -10,20 +10,20 @@ DECOMP_SIZE_ASSERT(LegoTranslationKey, 0x14)
DECOMP_SIZE_ASSERT(LegoRotationKey, 0x18) DECOMP_SIZE_ASSERT(LegoRotationKey, 0x18)
DECOMP_SIZE_ASSERT(LegoScaleKey, 0x14) DECOMP_SIZE_ASSERT(LegoScaleKey, 0x14)
DECOMP_SIZE_ASSERT(LegoMorphKey, 0x0c) DECOMP_SIZE_ASSERT(LegoMorphKey, 0x0c)
DECOMP_SIZE_ASSERT(LegoUnknownKey, 0x0c) DECOMP_SIZE_ASSERT(LegoRotationZKey, 0x0c)
DECOMP_SIZE_ASSERT(LegoAnimNodeData, 0x34) DECOMP_SIZE_ASSERT(LegoAnimNodeData, 0x34)
DECOMP_SIZE_ASSERT(LegoAnimActorEntry, 0x08) DECOMP_SIZE_ASSERT(LegoAnimActorEntry, 0x08)
DECOMP_SIZE_ASSERT(LegoAnimScene, 0x24) DECOMP_SIZE_ASSERT(LegoAnimScene, 0x24)
DECOMP_SIZE_ASSERT(LegoAnim, 0x18) DECOMP_SIZE_ASSERT(LegoAnim, 0x18)
// FUNCTION: LEGO1 0x1009f000 // FUNCTION: LEGO1 0x1009f000
LegoUnknownKey::LegoUnknownKey() LegoRotationZKey::LegoRotationZKey()
{ {
m_z = 0.0f; m_z = 0.0f;
} }
// FUNCTION: LEGO1 0x1009f020 // FUNCTION: LEGO1 0x1009f020
LegoResult LegoUnknownKey::Read(LegoStorage* p_storage) LegoResult LegoRotationZKey::Read(LegoStorage* p_storage)
{ {
LegoResult result; LegoResult result;
@ -40,7 +40,7 @@ LegoResult LegoUnknownKey::Read(LegoStorage* p_storage)
// FUNCTION: LEGO1 0x1009f060 // FUNCTION: LEGO1 0x1009f060
// FUNCTION: BETA10 0x1018133f // FUNCTION: BETA10 0x1018133f
LegoResult LegoUnknownKey::Write(LegoStorage* p_storage) LegoResult LegoRotationZKey::Write(LegoStorage* p_storage)
{ {
LegoResult result; LegoResult result;
@ -58,33 +58,33 @@ LegoResult LegoUnknownKey::Write(LegoStorage* p_storage)
// FUNCTION: LEGO1 0x1009f0a0 // FUNCTION: LEGO1 0x1009f0a0
LegoAnimScene::LegoAnimScene() LegoAnimScene::LegoAnimScene()
{ {
m_unk0x00 = 0; m_translationKeysCount = 0;
m_unk0x04 = NULL; m_translationKeys = NULL;
m_unk0x08 = 0; m_targetKeysCount = 0;
m_unk0x0c = NULL; m_targetKeys = NULL;
m_unk0x10 = 0; m_rotationKeysCount = 0;
m_unk0x14 = NULL; m_rotationKeys = NULL;
m_unk0x18 = 0; m_targetIndex = 0;
m_unk0x1c = 0; m_translationIndex = 0;
m_unk0x20 = 0; m_rotationIndex = 0;
} }
// FUNCTION: LEGO1 0x1009f0d0 // FUNCTION: LEGO1 0x1009f0d0
LegoAnimScene::~LegoAnimScene() LegoAnimScene::~LegoAnimScene()
{ {
if (m_unk0x04 != NULL) { if (m_translationKeys != NULL) {
delete[] m_unk0x04; delete[] m_translationKeys;
m_unk0x04 = NULL; m_translationKeys = NULL;
} }
if (m_unk0x0c != NULL) { if (m_targetKeys != NULL) {
delete[] m_unk0x0c; delete[] m_targetKeys;
m_unk0x0c = NULL; m_targetKeys = NULL;
} }
if (m_unk0x14 != NULL) { if (m_rotationKeys != NULL) {
delete[] m_unk0x14; delete[] m_rotationKeys;
m_unk0x14 = NULL; m_rotationKeys = NULL;
} }
} }
@ -95,34 +95,34 @@ LegoResult LegoAnimScene::Write(LegoStorage* p_storage)
LegoResult result; LegoResult result;
LegoS32 i; LegoS32 i;
if ((result = p_storage->Write(&m_unk0x00, sizeof(LegoU16))) != SUCCESS) { if ((result = p_storage->Write(&m_translationKeysCount, sizeof(LegoU16))) != SUCCESS) {
return result; return result;
} }
if (m_unk0x00 != 0) { if (m_translationKeysCount != 0) {
for (i = 0; i < m_unk0x00; i++) { for (i = 0; i < m_translationKeysCount; i++) {
if ((result = m_unk0x04[i].Write(p_storage)) != SUCCESS) { if ((result = m_translationKeys[i].Write(p_storage)) != SUCCESS) {
return result; return result;
} }
} }
} }
if ((result = p_storage->Write(&m_unk0x08, sizeof(LegoU16))) != SUCCESS) { if ((result = p_storage->Write(&m_targetKeysCount, sizeof(LegoU16))) != SUCCESS) {
return result; return result;
} }
if (m_unk0x08 != 0) { if (m_targetKeysCount != 0) {
for (i = 0; i < m_unk0x08; i++) { for (i = 0; i < m_targetKeysCount; i++) {
if ((result = m_unk0x0c[i].Write(p_storage)) != SUCCESS) { if ((result = m_targetKeys[i].Write(p_storage)) != SUCCESS) {
return result; return result;
} }
} }
} }
if ((result = p_storage->Write(&m_unk0x10, sizeof(LegoU16))) != SUCCESS) { if ((result = p_storage->Write(&m_rotationKeysCount, sizeof(LegoU16))) != SUCCESS) {
return result; return result;
} }
if (m_unk0x10 != 0) { if (m_rotationKeysCount != 0) {
for (i = 0; i < m_unk0x10; i++) { for (i = 0; i < m_rotationKeysCount; i++) {
if ((result = m_unk0x14[i].Write(p_storage)) != SUCCESS) { if ((result = m_rotationKeys[i].Write(p_storage)) != SUCCESS) {
return result; return result;
} }
} }
@ -137,37 +137,37 @@ LegoResult LegoAnimScene::Read(LegoStorage* p_storage)
LegoResult result; LegoResult result;
LegoS32 i; LegoS32 i;
if ((result = p_storage->Read(&m_unk0x00, sizeof(LegoU16))) != SUCCESS) { if ((result = p_storage->Read(&m_translationKeysCount, sizeof(LegoU16))) != SUCCESS) {
return result; return result;
} }
if (m_unk0x00 != 0) { if (m_translationKeysCount != 0) {
m_unk0x04 = new LegoTranslationKey[m_unk0x00]; m_translationKeys = new LegoTranslationKey[m_translationKeysCount];
for (i = 0; i < m_unk0x00; i++) { for (i = 0; i < m_translationKeysCount; i++) {
if ((result = m_unk0x04[i].Read(p_storage)) != SUCCESS) { if ((result = m_translationKeys[i].Read(p_storage)) != SUCCESS) {
goto done; goto done;
} }
} }
} }
if ((result = p_storage->Read(&m_unk0x08, sizeof(LegoU16))) != SUCCESS) { if ((result = p_storage->Read(&m_targetKeysCount, sizeof(LegoU16))) != SUCCESS) {
return result; return result;
} }
if (m_unk0x08 != 0) { if (m_targetKeysCount != 0) {
m_unk0x0c = new LegoTranslationKey[m_unk0x08]; m_targetKeys = new LegoTranslationKey[m_targetKeysCount];
for (i = 0; i < m_unk0x08; i++) { for (i = 0; i < m_targetKeysCount; i++) {
if ((result = m_unk0x0c[i].Read(p_storage)) != SUCCESS) { if ((result = m_targetKeys[i].Read(p_storage)) != SUCCESS) {
goto done; goto done;
} }
} }
} }
if ((result = p_storage->Read(&m_unk0x10, sizeof(LegoU16))) != SUCCESS) { if ((result = p_storage->Read(&m_rotationKeysCount, sizeof(LegoU16))) != SUCCESS) {
return result; return result;
} }
if (m_unk0x10 != 0) { if (m_rotationKeysCount != 0) {
m_unk0x14 = new LegoUnknownKey[m_unk0x10]; m_rotationKeys = new LegoRotationZKey[m_rotationKeysCount];
for (i = 0; i < m_unk0x10; i++) { for (i = 0; i < m_rotationKeysCount; i++) {
if ((result = m_unk0x14[i].Read(p_storage)) != SUCCESS) { if ((result = m_rotationKeys[i].Read(p_storage)) != SUCCESS) {
goto done; goto done;
} }
} }
@ -176,22 +176,22 @@ LegoResult LegoAnimScene::Read(LegoStorage* p_storage)
return SUCCESS; return SUCCESS;
done: done:
if (m_unk0x04 != NULL) { if (m_translationKeys != NULL) {
delete[] m_unk0x04; delete[] m_translationKeys;
m_unk0x00 = 0; m_translationKeysCount = 0;
m_unk0x04 = NULL; m_translationKeys = NULL;
} }
if (m_unk0x0c != NULL) { if (m_targetKeys != NULL) {
delete[] m_unk0x0c; delete[] m_targetKeys;
m_unk0x08 = 0; m_targetKeysCount = 0;
m_unk0x0c = NULL; m_targetKeys = NULL;
} }
if (m_unk0x14 != NULL) { if (m_rotationKeys != NULL) {
delete[] m_unk0x14; delete[] m_rotationKeys;
m_unk0x10 = 0; m_rotationKeysCount = 0;
m_unk0x14 = NULL; m_rotationKeys = NULL;
} }
return result; return result;
@ -199,82 +199,95 @@ LegoResult LegoAnimScene::Read(LegoStorage* p_storage)
// FUNCTION: LEGO1 0x1009f490 // FUNCTION: LEGO1 0x1009f490
// FUNCTION: BETA10 0x10181a83 // FUNCTION: BETA10 0x10181a83
LegoResult LegoAnimScene::FUN_1009f490(LegoFloat p_time, Matrix4& p_matrix) LegoResult LegoAnimScene::CalculateCameraTransform(LegoFloat p_time, Matrix4& p_matrix)
{ {
MxMatrix localb0; MxMatrix tempMatrix;
MxMatrix local4c; MxMatrix original;
Vector3 local5c(localb0[0]); Vector3 column0(tempMatrix[0]);
Vector3 local68(localb0[1]); Vector3 column1(tempMatrix[1]);
Vector3 local54(localb0[2]); Vector3 column2(tempMatrix[2]);
Vector3 localb8(localb0[3]); Vector3 column3(tempMatrix[3]);
Mx3DPointFloat localcc; Mx3DPointFloat tempTranslation;
localb0.SetIdentity(); tempMatrix.SetIdentity();
LegoU32 local60; LegoU32 translationIndex;
if (m_unk0x08 != 0) { if (m_targetKeysCount != 0) {
local60 = GetUnknown0x18(); translationIndex = GetTargetIndex();
LegoAnimNodeData::GetTranslation(m_unk0x08, m_unk0x0c, p_time, localb0, local60); LegoAnimNodeData::GetTranslation(m_targetKeysCount, m_targetKeys, p_time, tempMatrix, translationIndex);
SetUnknown0x18(local60); SetTargetIndex(translationIndex);
localcc = localb8; tempTranslation = column3;
localb8.Clear(); column3.Clear();
} }
if (m_unk0x00 != 0) { if (m_translationKeysCount != 0) {
local60 = GetUnknown0x1c(); translationIndex = GetTranslationIndex();
LegoAnimNodeData::GetTranslation(m_unk0x00, m_unk0x04, p_time, localb0, local60); LegoAnimNodeData::GetTranslation(
SetUnknown0x1c(local60); m_translationKeysCount,
m_translationKeys,
p_time,
tempMatrix,
translationIndex
);
SetTranslationIndex(translationIndex);
} }
local54 = localcc; column2 = tempTranslation;
local54 -= localb8; column2 -= column3;
if (local54.Unitize() == 0) { if (column2.Unitize() == 0) {
local5c.EqualsCross(local68, local54); column0.EqualsCross(column1, column2);
if (local5c.Unitize() == 0) { if (column0.Unitize() == 0) {
local68.EqualsCross(local54, local5c); column1.EqualsCross(column2, column0);
localcc = p_matrix[3]; tempTranslation = p_matrix[3];
localcc += localb0[3]; tempTranslation += tempMatrix[3];
p_matrix[3][0] = p_matrix[3][1] = p_matrix[3][2] = localb0[3][0] = localb0[3][1] = localb0[3][2] = 0; p_matrix[3][0] = p_matrix[3][1] = p_matrix[3][2] = tempMatrix[3][0] = tempMatrix[3][1] = tempMatrix[3][2] =
0;
if (m_unk0x10 != 0) { if (m_rotationKeysCount != 0) {
LegoU32 locald0 = -1; LegoU32 old_index = -1;
LegoU32 locald8; LegoU32 i;
locald0 = GetUnknown0x20(); old_index = GetRotationIndex();
LegoU32 localdc = LegoU32 count = LegoAnimNodeData::FindKeys(
LegoAnimNodeData::FindKeys(p_time, m_unk0x10, m_unk0x14, sizeof(*m_unk0x14), locald8, locald0); p_time,
m_rotationKeysCount,
m_rotationKeys,
sizeof(*m_rotationKeys),
i,
old_index
);
SetUnknown0x20(locald0); SetRotationIndex(old_index);
switch (localdc) { switch (count) {
case 1: case 1:
p_matrix.RotateZ(m_unk0x14[locald8].GetZ()); p_matrix.RotateZ(m_rotationKeys[i].GetZ());
break; break;
case 2: case 2:
// Seems to be unused // Seems to be unused
LegoFloat z = LegoAnimNodeData::Interpolate( LegoFloat z = LegoAnimNodeData::Interpolate(
p_time, p_time,
m_unk0x14[locald8], m_rotationKeys[i],
m_unk0x14[locald8].GetZ(), m_rotationKeys[i].GetZ(),
m_unk0x14[locald8 + 1], m_rotationKeys[i + 1],
m_unk0x14[locald8 + 1].GetZ() m_rotationKeys[i + 1].GetZ()
); );
p_matrix.RotateZ(m_unk0x14[locald8].GetZ()); p_matrix.RotateZ(m_rotationKeys[i].GetZ());
break; break;
} }
} }
local4c = p_matrix; original = p_matrix;
p_matrix.Product(local4c.GetData(), localb0.GetData()); p_matrix.Product(original.GetData(), tempMatrix.GetData());
p_matrix[3][0] = localcc[0]; p_matrix[3][0] = tempTranslation[0];
p_matrix[3][1] = localcc[1]; p_matrix[3][1] = tempTranslation[1];
p_matrix[3][2] = localcc[2]; p_matrix[3][2] = tempTranslation[2];
} }
} }

View File

@ -137,9 +137,9 @@ class LegoMorphKey : public LegoAnimKey {
}; };
// SIZE 0x0c // SIZE 0x0c
class LegoUnknownKey : public LegoAnimKey { class LegoRotationZKey : public LegoAnimKey {
public: public:
LegoUnknownKey(); LegoRotationZKey();
LegoResult Read(LegoStorage* p_storage); LegoResult Read(LegoStorage* p_storage);
LegoResult Write(LegoStorage* p_storage); LegoResult Write(LegoStorage* p_storage);
@ -309,26 +309,26 @@ class LegoAnimScene {
~LegoAnimScene(); ~LegoAnimScene();
LegoResult Read(LegoStorage* p_storage); LegoResult Read(LegoStorage* p_storage);
LegoResult Write(LegoStorage* p_storage); LegoResult Write(LegoStorage* p_storage);
LegoResult FUN_1009f490(LegoFloat p_time, Matrix4& p_matrix); LegoResult CalculateCameraTransform(LegoFloat p_time, Matrix4& p_matrix);
LegoU32 GetUnknown0x18() { return m_unk0x18; } LegoU32 GetTargetIndex() { return m_targetIndex; }
LegoU32 GetUnknown0x1c() { return m_unk0x1c; } LegoU32 GetTranslationIndex() { return m_translationIndex; }
LegoU32 GetUnknown0x20() { return m_unk0x20; } LegoU32 GetRotationIndex() { return m_rotationIndex; }
void SetUnknown0x18(LegoU32 p_unk0x18) { m_unk0x18 = p_unk0x18; } void SetTargetIndex(LegoU32 p_targetIndex) { m_targetIndex = p_targetIndex; }
void SetUnknown0x1c(LegoU32 p_unk0x1c) { m_unk0x1c = p_unk0x1c; } void SetTranslationIndex(LegoU32 p_translationIndex) { m_translationIndex = p_translationIndex; }
void SetUnknown0x20(LegoU32 p_unk0x20) { m_unk0x20 = p_unk0x20; } void SetRotationIndex(LegoU32 p_rotationIndex) { m_rotationIndex = p_rotationIndex; }
private: private:
LegoU16 m_unk0x00; // 0x00 LegoU16 m_translationKeysCount; // 0x00
LegoTranslationKey* m_unk0x04; // 0x04 LegoTranslationKey* m_translationKeys; // 0x04
LegoU16 m_unk0x08; // 0x08 LegoU16 m_targetKeysCount; // 0x08
LegoTranslationKey* m_unk0x0c; // 0x0c LegoTranslationKey* m_targetKeys; // 0x0c
LegoU16 m_unk0x10; // 0x10 LegoU16 m_rotationKeysCount; // 0x10
LegoUnknownKey* m_unk0x14; // 0x14 LegoRotationZKey* m_rotationKeys; // 0x14
LegoU32 m_unk0x18; // 0x18 LegoU32 m_targetIndex; // 0x18
LegoU32 m_unk0x1c; // 0x1c LegoU32 m_translationIndex; // 0x1c
LegoU32 m_unk0x20; // 0x20 LegoU32 m_rotationIndex; // 0x20
}; };
// VTABLE: LEGO1 0x100db8d8 // VTABLE: LEGO1 0x100db8d8

View File

@ -236,7 +236,6 @@
#include "omni/include/mxlist.h" #include "omni/include/mxlist.h"
#include "omni/include/mxloopingflcpresenter.h" #include "omni/include/mxloopingflcpresenter.h"
#include "omni/include/mxloopingsmkpresenter.h" #include "omni/include/mxloopingsmkpresenter.h"
#include "omni/include/mxmediamanager.h"
#include "omni/include/mxmediapresenter.h" #include "omni/include/mxmediapresenter.h"
#include "omni/include/mxmemorypool.h" #include "omni/include/mxmemorypool.h"
#include "omni/include/mxmisc.h" #include "omni/include/mxmisc.h"
@ -249,6 +248,7 @@
#include "omni/include/mxomnicreateparam.h" #include "omni/include/mxomnicreateparam.h"
#include "omni/include/mxpalette.h" #include "omni/include/mxpalette.h"
#include "omni/include/mxparam.h" #include "omni/include/mxparam.h"
#include "omni/include/mxpresentationmanager.h"
#include "omni/include/mxpresenter.h" #include "omni/include/mxpresenter.h"
#include "omni/include/mxpresenterlist.h" #include "omni/include/mxpresenterlist.h"
#include "omni/include/mxqueue.h" #include "omni/include/mxqueue.h"

View File

@ -2,11 +2,12 @@
#define MXAUDIOMANAGER_H #define MXAUDIOMANAGER_H
#include "decomp.h" #include "decomp.h"
#include "mxmediamanager.h" #include "mxpresentationmanager.h"
// VTABLE: LEGO1 0x100dc6e0 // VTABLE: LEGO1 0x100dc6e0
// VTABLE: BETA10 0x101c2348
// SIZE 0x30 // SIZE 0x30
class MxAudioManager : public MxMediaManager { class MxAudioManager : public MxPresentationManager {
public: public:
MxAudioManager(); MxAudioManager();
~MxAudioManager() override; ~MxAudioManager() override;
@ -15,11 +16,13 @@ class MxAudioManager : public MxMediaManager {
void Destroy() override; // vtable+18 void Destroy() override; // vtable+18
// FUNCTION: LEGO1 0x10029910 // FUNCTION: LEGO1 0x10029910
// FUNCTION: BETA10 0x100d0630
virtual MxS32 GetVolume() { return m_volume; } // vtable+28 virtual MxS32 GetVolume() { return m_volume; } // vtable+28
virtual void SetVolume(MxS32 p_volume); // vtable+2c virtual void SetVolume(MxS32 p_volume); // vtable+2c
// SYNTHETIC: LEGO1 0x100b8d70 // SYNTHETIC: LEGO1 0x100b8d70
// SYNTHETIC: BETA10 0x10145110
// MxAudioManager::`scalar deleting destructor' // MxAudioManager::`scalar deleting destructor'
private: private:

View File

@ -2,11 +2,11 @@
#define MXEVENTMANAGER_H #define MXEVENTMANAGER_H
#include "decomp.h" #include "decomp.h"
#include "mxmediamanager.h" #include "mxpresentationmanager.h"
// VTABLE: LEGO1 0x100dc900 // VTABLE: LEGO1 0x100dc900
// SIZE 0x2c // SIZE 0x2c
class MxEventManager : public MxMediaManager { class MxEventManager : public MxPresentationManager {
public: public:
MxEventManager(); MxEventManager();
~MxEventManager() override; ~MxEventManager() override;

View File

@ -1,5 +1,5 @@
#ifndef MXMEDIAMANGER_H #ifndef MXPRESENTATIONMANAGER_H
#define MXMEDIAMANGER_H #define MXPRESENTATIONMANAGER_H
#include "mxcore.h" #include "mxcore.h"
#include "mxcriticalsection.h" #include "mxcriticalsection.h"
@ -9,11 +9,12 @@
class MxThread; class MxThread;
// VTABLE: LEGO1 0x100dc6b0 // VTABLE: LEGO1 0x100dc6b0
// VTABLE: BETA10 0x101c2318
// SIZE 0x2c // SIZE 0x2c
class MxMediaManager : public MxCore { class MxPresentationManager : public MxCore {
public: public:
MxMediaManager(); MxPresentationManager();
~MxMediaManager() override; ~MxPresentationManager() override;
MxResult Tickle() override; // vtable+08 MxResult Tickle() override; // vtable+08
virtual MxResult Create(); // vtable+14 virtual MxResult Create(); // vtable+14
@ -25,7 +26,8 @@ class MxMediaManager : public MxCore {
MxResult Init(); MxResult Init();
// SYNTHETIC: LEGO1 0x100b8540 // SYNTHETIC: LEGO1 0x100b8540
// MxMediaManager::`scalar deleting destructor' // SYNTHETIC: BETA10 0x10144db0
// MxPresentationManager::`scalar deleting destructor'
protected: protected:
MxPresenterList* m_presenters; // 0x08 MxPresenterList* m_presenters; // 0x08
@ -33,4 +35,4 @@ class MxMediaManager : public MxCore {
MxCriticalSection m_criticalSection; // 0x10 MxCriticalSection m_criticalSection; // 0x10
}; };
#endif // MXMEDIAMANGER_H #endif // MXPRESENTATIONMANAGER_H

View File

@ -5,12 +5,15 @@
#include "mxpresenter.h" #include "mxpresenter.h"
// VTABLE: LEGO1 0x100d62f0 // VTABLE: LEGO1 0x100d62f0
// VTABLE: BETA10 0x101bf070
// class MxPtrList<MxPresenter> // class MxPtrList<MxPresenter>
// VTABLE: LEGO1 0x100d6308 // VTABLE: LEGO1 0x100d6308
// VTABLE: BETA10 0x101bf050
// SIZE 0x18 // SIZE 0x18
class MxPresenterList : public MxPtrList<MxPresenter> { class MxPresenterList : public MxPtrList<MxPresenter> {
public: public:
// FUNCTION: BETA10 0x100dc900
MxPresenterList(MxBool p_ownership = FALSE) : MxPtrList<MxPresenter>(p_ownership) {} MxPresenterList(MxBool p_ownership = FALSE) : MxPtrList<MxPresenter>(p_ownership) {}
// FUNCTION: LEGO1 0x1001cd00 // FUNCTION: LEGO1 0x1001cd00
@ -35,6 +38,13 @@ class MxPresenterListCursor : public MxPtrListCursor<MxPresenter> {
public: public:
// FUNCTION: BETA10 0x1007d130 // FUNCTION: BETA10 0x1007d130
MxPresenterListCursor(MxPresenterList* p_list) : MxPtrListCursor<MxPresenter>(p_list) {} MxPresenterListCursor(MxPresenterList* p_list) : MxPtrListCursor<MxPresenter>(p_list) {}
// SYNTHETIC: LEGO1 0x1001eed0
// MxPresenterListCursor::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x1001f0c0
// SYNTHETIC: BETA10 0x1007d510
// MxPresenterListCursor::~MxPresenterListCursor
}; };
// VTABLE: LEGO1 0x100d6350 // VTABLE: LEGO1 0x100d6350
@ -58,7 +68,11 @@ class MxPresenterListCursor : public MxPtrListCursor<MxPresenter> {
// TEMPLATE: LEGO1 0x1001ce20 // TEMPLATE: LEGO1 0x1001ce20
// MxList<MxPresenter *>::~MxList<MxPresenter *> // MxList<MxPresenter *>::~MxList<MxPresenter *>
// TEMPLATE: BETA10 0x100dc9f0
// MxPtrList<MxPresenter>::MxPtrList<MxPresenter>
// TEMPLATE: LEGO1 0x1001cf20 // TEMPLATE: LEGO1 0x1001cf20
// TEMPLATE: BETA10 0x100dce70
// MxPtrList<MxPresenter>::~MxPtrList<MxPresenter> // MxPtrList<MxPresenter>::~MxPtrList<MxPresenter>
// SYNTHETIC: LEGO1 0x1001cf70 // SYNTHETIC: LEGO1 0x1001cf70
@ -73,10 +87,8 @@ class MxPresenterListCursor : public MxPtrListCursor<MxPresenter> {
// SYNTHETIC: LEGO1 0x1001d100 // SYNTHETIC: LEGO1 0x1001d100
// MxPresenterList::~MxPresenterList // MxPresenterList::~MxPresenterList
// SYNTHETIC: LEGO1 0x1001eed0
// MxPresenterListCursor::`scalar deleting destructor'
// TEMPLATE: LEGO1 0x1001ef40 // TEMPLATE: LEGO1 0x1001ef40
// TEMPLATE: BETA10 0x1007d370
// MxPtrListCursor<MxPresenter>::~MxPtrListCursor<MxPresenter> // MxPtrListCursor<MxPresenter>::~MxPtrListCursor<MxPresenter>
// SYNTHETIC: LEGO1 0x1001ef90 // SYNTHETIC: LEGO1 0x1001ef90
@ -86,11 +98,9 @@ class MxPresenterListCursor : public MxPtrListCursor<MxPresenter> {
// MxPtrListCursor<MxPresenter>::`scalar deleting destructor' // MxPtrListCursor<MxPresenter>::`scalar deleting destructor'
// TEMPLATE: LEGO1 0x1001f070 // TEMPLATE: LEGO1 0x1001f070
// TEMPLATE: BETA10 0x1007d490
// MxListCursor<MxPresenter *>::~MxListCursor<MxPresenter *> // MxListCursor<MxPresenter *>::~MxListCursor<MxPresenter *>
// FUNCTION: LEGO1 0x1001f0c0
// MxPresenterListCursor::~MxPresenterListCursor
// TEMPLATE: LEGO1 0x10020760 // TEMPLATE: LEGO1 0x10020760
// MxListCursor<MxPresenter *>::MxListCursor<MxPresenter *> // MxListCursor<MxPresenter *>::MxListCursor<MxPresenter *>
@ -106,6 +116,18 @@ class MxPresenterListCursor : public MxPtrListCursor<MxPresenter> {
// TEMPLATE: BETA10 0x1007d270 // TEMPLATE: BETA10 0x1007d270
// MxListCursor<MxPresenter *>::MxListCursor<MxPresenter *> // MxListCursor<MxPresenter *>::MxListCursor<MxPresenter *>
// TEMPLATE: BETA10 0x1007dc60
// MxListCursor<MxPresenter *>::Next
// TEMPLATE: BETA10 0x100d8f20
// MxListCursor<MxPresenter *>::Reset
// TEMPLATE: BETA10 0x1007e070
// MxListEntry<MxPresenter *>::GetNext
// TEMPLATE: BETA10 0x1007e0a0
// MxListEntry<MxPresenter *>::GetValue
// TEMPLATE: BETA10 0x100d9420 // TEMPLATE: BETA10 0x100d9420
// ?Prev@?$MxListCursor@PAVMxPresenter@@@@QAEEAAPAVMxPresenter@@@Z // ?Prev@?$MxListCursor@PAVMxPresenter@@@@QAEEAAPAVMxPresenter@@@Z

View File

@ -6,17 +6,20 @@
#include <SDL3/SDL_mutex.h> #include <SDL3/SDL_mutex.h>
// VTABLE: LEGO1 0x100dccf0 // VTABLE: LEGO1 0x100dccf0
// VTABLE: BETA10 0x101c28ac
// SIZE 0x08 // SIZE 0x08
class MxSemaphore { class MxSemaphore {
public: public:
MxSemaphore(); MxSemaphore();
// FUNCTION: LEGO1 0x100c87e0 // FUNCTION: LEGO1 0x100c87e0
// FUNCTION: BETA10 0x101592a9
~MxSemaphore() { SDL_DestroySemaphore(m_semaphore); } ~MxSemaphore() { SDL_DestroySemaphore(m_semaphore); }
virtual MxResult Init(MxU32 p_initialCount, MxU32 p_maxCount); virtual MxResult Init(MxU32 p_initialCount, MxU32 p_maxCount);
void Wait(); void Acquire();
void TryAcquire();
void Release(); void Release();
private: private:

View File

@ -28,6 +28,10 @@ class MxSoundManager : public MxAudioManager {
MxPresenter* FindPresenter(const MxAtomId& p_atomId, MxU32 p_objectId); MxPresenter* FindPresenter(const MxAtomId& p_atomId, MxU32 p_objectId);
// SYNTHETIC: LEGO1 0x100ae7b0
// SYNTHETIC: BETA10 0x10133460
// MxSoundManager::`scalar deleting destructor'
protected: protected:
void Init(); void Init();
void Destroy(MxBool p_fromDestructor); void Destroy(MxBool p_fromDestructor);
@ -49,7 +53,4 @@ class MxSoundManager : public MxAudioManager {
undefined m_unk0x38[4]; undefined m_unk0x38[4];
}; };
// SYNTHETIC: LEGO1 0x100ae7b0
// MxSoundManager::`scalar deleting destructor'
#endif // MXSOUNDMANAGER_H #endif // MXSOUNDMANAGER_H

View File

@ -10,6 +10,7 @@
class MxCore; class MxCore;
// VTABLE: LEGO1 0x100dc860 // VTABLE: LEGO1 0x100dc860
// VTABLE: BETA10 0x101c23e8
// SIZE 0x1c // SIZE 0x1c
class MxThread { class MxThread {
public: public:
@ -21,9 +22,16 @@ class MxThread {
void Terminate(); void Terminate();
void Sleep(MxS32 p_milliseconds); void Sleep(MxS32 p_milliseconds);
void ResumeThread();
void SuspendThread();
bool TerminateThread(MxU32 p_exitCode);
MxS32 GetThreadPriority(MxU16& p_priority);
bool SetThreadPriority(MxU16 p_priority);
MxBool IsRunning() { return m_running; } MxBool IsRunning() { return m_running; }
// SYNTHETIC: LEGO1 0x100bf580 // SYNTHETIC: LEGO1 0x100bf580
// SYNTHETIC: BETA10 0x10147880
// MxThread::`scalar deleting destructor' // MxThread::`scalar deleting destructor'
protected: protected:

View File

@ -9,6 +9,7 @@
// SIZE 0x24 // SIZE 0x24
class MxVariable { class MxVariable {
public: public:
// FUNCTION: BETA10 0x1007b750
MxVariable() {} MxVariable() {}
// FUNCTION: BETA10 0x1012a840 // FUNCTION: BETA10 0x1012a840
@ -41,12 +42,16 @@ class MxVariable {
// FUNCTION: BETA10 0x1012a7f0 // FUNCTION: BETA10 0x1012a7f0
const MxString* GetKey() const { return &m_key; } const MxString* GetKey() const { return &m_key; }
// SYNTHETIC: BETA10 0x1007b8c0
// MxVariable::`scalar deleting destructor'
protected: protected:
MxString m_key; // 0x04 MxString m_key; // 0x04
MxString m_value; // 0x14 MxString m_value; // 0x14
}; };
// SYNTHETIC: LEGO1 0x1003bf40 // SYNTHETIC: LEGO1 0x1003bf40
// SYNTHETIC: BETA10 0x1007b910
// MxVariable::~MxVariable // MxVariable::~MxVariable
#endif // MXVARIABLE_H #endif // MXVARIABLE_H

View File

@ -1,7 +1,7 @@
#ifndef MXVIDEOMANAGER_H #ifndef MXVIDEOMANAGER_H
#define MXVIDEOMANAGER_H #define MXVIDEOMANAGER_H
#include "mxmediamanager.h" #include "mxpresentationmanager.h"
#include "mxvideoparam.h" #include "mxvideoparam.h"
#ifdef MINIWIN #ifdef MINIWIN
@ -15,8 +15,9 @@ class MxRect32;
class MxRegion; class MxRegion;
// VTABLE: LEGO1 0x100dc810 // VTABLE: LEGO1 0x100dc810
// VTABLE: BETA10 0x101c1bf8
// SIZE 0x64 // SIZE 0x64
class MxVideoManager : public MxMediaManager { class MxVideoManager : public MxPresentationManager {
public: public:
MxVideoManager(); MxVideoManager();
~MxVideoManager() override; ~MxVideoManager() override;
@ -52,6 +53,7 @@ class MxVideoManager : public MxMediaManager {
MxRegion* GetRegion() { return this->m_region; } MxRegion* GetRegion() { return this->m_region; }
// SYNTHETIC: LEGO1 0x100be280 // SYNTHETIC: LEGO1 0x100be280
// SYNTHETIC: BETA10 0x1012de00
// MxVideoManager::`scalar deleting destructor' // MxVideoManager::`scalar deleting destructor'
protected: protected:

View File

@ -24,7 +24,7 @@ class MxVideoParamFlags {
void SetBackBuffers(MxBool p_e) { m_flags1.m_bit2 = p_e; } void SetBackBuffers(MxBool p_e) { m_flags1.m_bit2 = p_e; }
// FUNCTION: BETA10 0x100d9250 // FUNCTION: BETA10 0x100d9250
void SetF1bit3(MxBool p_e) { m_flags1.m_bit3 = p_e; } void SetDoubleScaling(MxBool p_e) { m_flags1.m_bit3 = p_e; }
// inlined in ISLE // inlined in ISLE
void Set16Bit(MxBool p_e) { m_flags1.m_bit5 = p_e; } void Set16Bit(MxBool p_e) { m_flags1.m_bit5 = p_e; }
@ -39,7 +39,7 @@ class MxVideoParamFlags {
void SetLacksLightSupport(MxBool p_e) { m_flags2.m_bit0 = p_e; } void SetLacksLightSupport(MxBool p_e) { m_flags2.m_bit0 = p_e; }
// inlined in ISLE // inlined in ISLE
void SetF2bit1(MxBool p_e) { m_flags2.m_bit1 = p_e; } void SetEnabled(MxBool p_e) { m_flags2.m_bit1 = p_e; }
// FUNCTION: BETA10 0x1009e770 // FUNCTION: BETA10 0x1009e770
MxBool GetFullScreen() { return m_flags1.m_bit0; } MxBool GetFullScreen() { return m_flags1.m_bit0; }
@ -51,7 +51,7 @@ class MxVideoParamFlags {
MxBool GetBackBuffers() { return m_flags1.m_bit2; } MxBool GetBackBuffers() { return m_flags1.m_bit2; }
// FUNCTION: BETA10 0x10142010 // FUNCTION: BETA10 0x10142010
MxBool GetF1bit3() { return m_flags1.m_bit3; } MxBool GetDoubleScaling() { return m_flags1.m_bit3; }
// FUNCTION: BETA10 0x100d8150 // FUNCTION: BETA10 0x100d8150
MxBool Get16Bit() { return m_flags1.m_bit5; } MxBool Get16Bit() { return m_flags1.m_bit5; }
@ -63,7 +63,7 @@ class MxVideoParamFlags {
MxBool GetLacksLightSupport() { return m_flags2.m_bit0; } MxBool GetLacksLightSupport() { return m_flags2.m_bit0; }
// FUNCTION: BETA10 0x10142050 // FUNCTION: BETA10 0x10142050
MxBool GetF2bit1() { return m_flags2.m_bit1; } MxBool GetEnabled() { return m_flags2.m_bit1; }
private: private:
FlagBitfield m_flags1; FlagBitfield m_flags1;

View File

@ -3,27 +3,32 @@
DECOMP_SIZE_ASSERT(MxAudioManager, 0x30); DECOMP_SIZE_ASSERT(MxAudioManager, 0x30);
// GLOBAL: LEGO1 0x10102108 // GLOBAL: LEGO1 0x10102108
// GLOBAL: BETA10 0x10203a60
MxS32 MxAudioManager::g_count = 0; MxS32 MxAudioManager::g_count = 0;
// FUNCTION: LEGO1 0x100b8d00 // FUNCTION: LEGO1 0x100b8d00
// FUNCTION: BETA10 0x10144e90
MxAudioManager::MxAudioManager() MxAudioManager::MxAudioManager()
{ {
Init(); Init();
} }
// FUNCTION: LEGO1 0x100b8d90 // FUNCTION: LEGO1 0x100b8d90
// STUB: BETA10 0x10144f07
MxAudioManager::~MxAudioManager() MxAudioManager::~MxAudioManager()
{ {
Destroy(TRUE); Destroy(TRUE);
} }
// FUNCTION: LEGO1 0x100b8df0 // FUNCTION: LEGO1 0x100b8df0
// FUNCTION: BETA10 0x10144f79
void MxAudioManager::Init() void MxAudioManager::Init()
{ {
m_volume = 100; m_volume = 100;
} }
// FUNCTION: LEGO1 0x100b8e00 // FUNCTION: LEGO1 0x100b8e00
// FUNCTION: BETA10 0x10144f9c
void MxAudioManager::Destroy(MxBool p_fromDestructor) void MxAudioManager::Destroy(MxBool p_fromDestructor)
{ {
ENTER(m_criticalSection); ENTER(m_criticalSection);
@ -32,17 +37,49 @@ void MxAudioManager::Destroy(MxBool p_fromDestructor)
m_criticalSection.Leave(); m_criticalSection.Leave();
if (!p_fromDestructor) { if (!p_fromDestructor) {
MxMediaManager::Destroy(); MxPresentationManager::Destroy();
} }
} }
#ifdef BETA10
// FUNCTION: BETA10 0x10144ffe
MxResult MxAudioManager::Create()
{
MxResult result = FAILURE;
MxBool success = FALSE;
if (MxPresentationManager::Create() != SUCCESS) {
goto exit;
}
ENTER(m_criticalSection);
success = TRUE;
if (!g_count++) {
// This is correct. It was likely refactored later.
}
exit:
result = SUCCESS;
if (result) {
Destroy();
}
if (success) {
m_criticalSection.Leave();
}
return result;
}
#else
// FUNCTION: LEGO1 0x100b8e40 // FUNCTION: LEGO1 0x100b8e40
MxResult MxAudioManager::Create() MxResult MxAudioManager::Create()
{ {
MxResult result = FAILURE; MxResult result = FAILURE;
MxBool success = FALSE; MxBool success = FALSE;
if (MxMediaManager::Create() == SUCCESS) { if (MxPresentationManager::Create() == SUCCESS) {
ENTER(m_criticalSection); ENTER(m_criticalSection);
success = TRUE; success = TRUE;
result = SUCCESS; result = SUCCESS;
@ -59,14 +96,17 @@ MxResult MxAudioManager::Create()
return result; return result;
} }
#endif
// FUNCTION: LEGO1 0x100b8e90 // FUNCTION: LEGO1 0x100b8e90
// FUNCTION: BETA10 0x101450a7
void MxAudioManager::Destroy() void MxAudioManager::Destroy()
{ {
Destroy(FALSE); Destroy(FALSE);
} }
// FUNCTION: LEGO1 0x100b8ea0 // FUNCTION: LEGO1 0x100b8ea0
// FUNCTION: BETA10 0x101450c7
void MxAudioManager::SetVolume(MxS32 p_volume) void MxAudioManager::SetVolume(MxS32 p_volume)
{ {
ENTER(m_criticalSection); ENTER(m_criticalSection);

View File

@ -25,18 +25,21 @@ MxS32 g_volumeAttenuation[100] = {-6643, -5643, -5058, -4643, -4321, -4058, -383
-43, -29, -14, 0}; -43, -29, -14, 0};
// FUNCTION: LEGO1 0x100ae740 // FUNCTION: LEGO1 0x100ae740
// FUNCTION: BETA10 0x10132c70
MxSoundManager::MxSoundManager() MxSoundManager::MxSoundManager()
{ {
Init(); Init();
} }
// FUNCTION: LEGO1 0x100ae7d0 // FUNCTION: LEGO1 0x100ae7d0
// FUNCTION: BETA10 0x10132ce7
MxSoundManager::~MxSoundManager() MxSoundManager::~MxSoundManager()
{ {
Destroy(TRUE); Destroy(TRUE);
} }
// FUNCTION: LEGO1 0x100ae830 // FUNCTION: LEGO1 0x100ae830
// FUNCTION: BETA10 0x10132d59
void MxSoundManager::Init() void MxSoundManager::Init()
{ {
SDL_zero(m_engine); SDL_zero(m_engine);
@ -44,6 +47,7 @@ void MxSoundManager::Init()
} }
// FUNCTION: LEGO1 0x100ae840 // FUNCTION: LEGO1 0x100ae840
// FUNCTION: BETA10 0x10132d89
void MxSoundManager::Destroy(MxBool p_fromDestructor) void MxSoundManager::Destroy(MxBool p_fromDestructor)
{ {
if (m_thread) { if (m_thread) {
@ -157,12 +161,14 @@ void MxSoundManager::AudioStreamCallback(
} }
// FUNCTION: LEGO1 0x100aeab0 // FUNCTION: LEGO1 0x100aeab0
// FUNCTION: BETA10 0x101331e3
void MxSoundManager::Destroy() void MxSoundManager::Destroy()
{ {
Destroy(FALSE); Destroy(FALSE);
} }
// FUNCTION: LEGO1 0x100aeac0 // FUNCTION: LEGO1 0x100aeac0
// FUNCTION: BETA10 0x10133203
void MxSoundManager::SetVolume(MxS32 p_volume) void MxSoundManager::SetVolume(MxS32 p_volume)
{ {
MxAudioManager::SetVolume(p_volume); MxAudioManager::SetVolume(p_volume);
@ -180,6 +186,7 @@ void MxSoundManager::SetVolume(MxS32 p_volume)
} }
// FUNCTION: LEGO1 0x100aebd0 // FUNCTION: LEGO1 0x100aebd0
// FUNCTION: BETA10 0x101332cf
MxPresenter* MxSoundManager::FindPresenter(const MxAtomId& p_atomId, MxU32 p_objectId) MxPresenter* MxSoundManager::FindPresenter(const MxAtomId& p_atomId, MxU32 p_objectId)
{ {
AUTOLOCK(m_criticalSection); AUTOLOCK(m_criticalSection);
@ -188,8 +195,7 @@ MxPresenter* MxSoundManager::FindPresenter(const MxAtomId& p_atomId, MxU32 p_obj
MxPresenterListCursor cursor(m_presenters); MxPresenterListCursor cursor(m_presenters);
while (cursor.Next(presenter)) { while (cursor.Next(presenter)) {
if (presenter->GetAction()->GetAtomId().GetInternal() == p_atomId.GetInternal() && if (presenter->GetAction()->GetAtomId() == p_atomId && presenter->GetAction()->GetObjectId() == p_objectId) {
presenter->GetAction()->GetObjectId() == p_objectId) {
return presenter; return presenter;
} }
} }

View File

@ -131,6 +131,7 @@ MxResult MxMediaPresenter::StartAction(MxStreamController* p_controller, MxDSAct
} }
// FUNCTION: LEGO1 0x100b5bc0 // FUNCTION: LEGO1 0x100b5bc0
// STUB: BETA10 0x1013623c
void MxMediaPresenter::EndAction() void MxMediaPresenter::EndAction()
{ {
AUTOLOCK(m_criticalSection); AUTOLOCK(m_criticalSection);

View File

@ -1,4 +1,4 @@
#include "mxmediamanager.h" #include "mxpresentationmanager.h"
#include "decomp.h" #include "decomp.h"
#include "mxautolock.h" #include "mxautolock.h"
@ -6,24 +6,27 @@
#include "mxpresenter.h" #include "mxpresenter.h"
#include "mxticklemanager.h" #include "mxticklemanager.h"
DECOMP_SIZE_ASSERT(MxMediaManager, 0x2c); DECOMP_SIZE_ASSERT(MxPresentationManager, 0x2c);
DECOMP_SIZE_ASSERT(MxPresenterList, 0x18); DECOMP_SIZE_ASSERT(MxPresenterList, 0x18);
DECOMP_SIZE_ASSERT(MxPresenterListCursor, 0x10); DECOMP_SIZE_ASSERT(MxPresenterListCursor, 0x10);
// FUNCTION: LEGO1 0x100b84c0 // FUNCTION: LEGO1 0x100b84c0
MxMediaManager::MxMediaManager() // FUNCTION: BETA10 0x10144680
MxPresentationManager::MxPresentationManager()
{ {
Init(); Init();
} }
// FUNCTION: LEGO1 0x100b8560 // FUNCTION: LEGO1 0x100b8560
MxMediaManager::~MxMediaManager() // FUNCTION: BETA10 0x10144712
MxPresentationManager::~MxPresentationManager()
{ {
Destroy(); Destroy();
} }
// FUNCTION: LEGO1 0x100b85d0 // FUNCTION: LEGO1 0x100b85d0
MxResult MxMediaManager::Init() // FUNCTION: BETA10 0x1014479b
MxResult MxPresentationManager::Init()
{ {
this->m_presenters = NULL; this->m_presenters = NULL;
this->m_thread = NULL; this->m_thread = NULL;
@ -31,8 +34,10 @@ MxResult MxMediaManager::Init()
} }
// FUNCTION: LEGO1 0x100b85e0 // FUNCTION: LEGO1 0x100b85e0
MxResult MxMediaManager::Create() // FUNCTION: BETA10 0x101447c5
MxResult MxPresentationManager::Create()
{ {
// This validates the name of the source code file (and hence also the name of the class)
AUTOLOCK(m_criticalSection); AUTOLOCK(m_criticalSection);
this->m_presenters = new MxPresenterList; this->m_presenters = new MxPresenterList;
@ -46,7 +51,8 @@ MxResult MxMediaManager::Create()
} }
// FUNCTION: LEGO1 0x100b8710 // FUNCTION: LEGO1 0x100b8710
void MxMediaManager::Destroy() // FUNCTION: BETA10 0x101448e4
void MxPresentationManager::Destroy()
{ {
AUTOLOCK(m_criticalSection); AUTOLOCK(m_criticalSection);
@ -58,7 +64,8 @@ void MxMediaManager::Destroy()
} }
// FUNCTION: LEGO1 0x100b8790 // FUNCTION: LEGO1 0x100b8790
MxResult MxMediaManager::Tickle() // FUNCTION: BETA10 0x10144993
MxResult MxPresentationManager::Tickle()
{ {
AUTOLOCK(m_criticalSection); AUTOLOCK(m_criticalSection);
MxPresenter* presenter; MxPresenter* presenter;
@ -78,7 +85,8 @@ MxResult MxMediaManager::Tickle()
} }
// FUNCTION: LEGO1 0x100b88c0 // FUNCTION: LEGO1 0x100b88c0
void MxMediaManager::RegisterPresenter(MxPresenter& p_presenter) // FUNCTION: BETA10 0x10144a8b
void MxPresentationManager::RegisterPresenter(MxPresenter& p_presenter)
{ {
AUTOLOCK(m_criticalSection); AUTOLOCK(m_criticalSection);
@ -86,7 +94,8 @@ void MxMediaManager::RegisterPresenter(MxPresenter& p_presenter)
} }
// FUNCTION: LEGO1 0x100b8980 // FUNCTION: LEGO1 0x100b8980
void MxMediaManager::UnregisterPresenter(MxPresenter& p_presenter) // FUNCTION: BETA10 0x10144b0c
void MxPresentationManager::UnregisterPresenter(MxPresenter& p_presenter)
{ {
AUTOLOCK(m_criticalSection); AUTOLOCK(m_criticalSection);
MxPresenterListCursor cursor(this->m_presenters); MxPresenterListCursor cursor(this->m_presenters);
@ -97,7 +106,8 @@ void MxMediaManager::UnregisterPresenter(MxPresenter& p_presenter)
} }
// FUNCTION: LEGO1 0x100b8ac0 // FUNCTION: LEGO1 0x100b8ac0
void MxMediaManager::StopPresenters() // FUNCTION: BETA10 0x10144bc3
void MxPresentationManager::StopPresenters()
{ {
AUTOLOCK(m_criticalSection); AUTOLOCK(m_criticalSection);
MxPresenter* presenter; MxPresenter* presenter;

View File

@ -35,7 +35,7 @@ void MxEventManager::Destroy(MxBool p_fromDestructor)
} }
if (!p_fromDestructor) { if (!p_fromDestructor) {
MxMediaManager::Destroy(); MxPresentationManager::Destroy();
} }
} }
@ -45,7 +45,7 @@ MxResult MxEventManager::Create(MxU32 p_frequencyMS, MxBool p_createThread)
MxResult status = FAILURE; MxResult status = FAILURE;
MxBool locked = FALSE; MxBool locked = FALSE;
MxResult result = MxMediaManager::Create(); MxResult result = MxPresentationManager::Create();
if (result == SUCCESS) { if (result == SUCCESS) {
if (p_createThread) { if (p_createThread) {
ENTER(this->m_criticalSection); ENTER(this->m_criticalSection);

View File

@ -161,10 +161,11 @@ void MxDiskStreamProvider::VTable0x20(MxDSAction* p_action)
} }
// FUNCTION: LEGO1 0x100d1750 // FUNCTION: LEGO1 0x100d1750
// FUNCTION: BETA10 0x101632b8
MxResult MxDiskStreamProvider::WaitForWorkToComplete() MxResult MxDiskStreamProvider::WaitForWorkToComplete()
{ {
while (m_remainingWork) { while (m_remainingWork) {
m_busySemaphore.Wait(); m_busySemaphore.Acquire();
if (m_unk0x35) { if (m_unk0x35) {
PerformWork(); PerformWork();
} }

View File

@ -6,32 +6,46 @@
DECOMP_SIZE_ASSERT(MxSemaphore, 0x08) DECOMP_SIZE_ASSERT(MxSemaphore, 0x08)
// FUNCTION: LEGO1 0x100c87d0 // FUNCTION: LEGO1 0x100c87d0
// FUNCTION: BETA10 0x10159260
MxSemaphore::MxSemaphore() MxSemaphore::MxSemaphore()
{ {
m_semaphore = NULL; m_semaphore = NULL;
} }
// FUNCTION: LEGO1 0x100c8800 // FUNCTION: LEGO1 0x100c8800
// FUNCTION: BETA10 0x101592d5
MxResult MxSemaphore::Init(MxU32 p_initialCount, MxU32 p_maxCount) MxResult MxSemaphore::Init(MxU32 p_initialCount, MxU32 p_maxCount)
{ {
// [library:synchronization] No support for max count, but shouldn't be necessary // [library:synchronization] No support for max count, but shouldn't be necessary
MxResult result = FAILURE; MxResult result = FAILURE;
if ((m_semaphore = SDL_CreateSemaphore(p_initialCount))) { m_semaphore = SDL_CreateSemaphore(p_initialCount);
result = SUCCESS; if (!m_semaphore) {
goto done;
} }
result = SUCCESS;
done:
return result; return result;
} }
// FUNCTION: LEGO1 0x100c8830 // FUNCTION: LEGO1 0x100c8830
void MxSemaphore::Wait() // FUNCTION: BETA10 0x10159332
void MxSemaphore::Acquire()
{ {
// [library:synchronization] Removed timeout since only INFINITE is ever requested // [library:synchronization] Removed timeout since only INFINITE is ever requested
SDL_WaitSemaphore(m_semaphore); SDL_WaitSemaphore(m_semaphore);
} }
// FUNCTION: BETA10 0x10159385
void MxSemaphore::TryAcquire()
{
// unused
}
// FUNCTION: LEGO1 0x100c8850 // FUNCTION: LEGO1 0x100c8850
// FUNCTION: BETA10 0x101593aa
void MxSemaphore::Release() void MxSemaphore::Release()
{ {
// [library:synchronization] Removed release count since only 1 is ever requested // [library:synchronization] Removed release count since only 1 is ever requested

View File

@ -7,6 +7,7 @@
DECOMP_SIZE_ASSERT(MxThread, 0x1c) DECOMP_SIZE_ASSERT(MxThread, 0x1c)
// FUNCTION: LEGO1 0x100bf510 // FUNCTION: LEGO1 0x100bf510
// FUNCTION: BETA10 0x10147540
MxThread::MxThread() MxThread::MxThread()
{ {
m_thread = NULL; m_thread = NULL;
@ -14,6 +15,7 @@ MxThread::MxThread()
} }
// FUNCTION: LEGO1 0x100bf5a0 // FUNCTION: LEGO1 0x100bf5a0
// FUNCTION: BETA10 0x101475d0
MxThread::~MxThread() MxThread::~MxThread()
{ {
if (m_thread) { if (m_thread) {
@ -22,46 +24,91 @@ MxThread::~MxThread()
} }
// FUNCTION: LEGO1 0x100bf610 // FUNCTION: LEGO1 0x100bf610
// FUNCTION: BETA10 0x10147655
MxResult MxThread::Start(MxS32 p_stackSize, MxS32 p_flag) MxResult MxThread::Start(MxS32 p_stackSize, MxS32 p_flag)
{ {
MxResult result = FAILURE; MxResult result = FAILURE;
if (m_semaphore.Init(0, 1) == SUCCESS) { if (m_semaphore.Init(0, 1) != SUCCESS) {
goto done;
}
{
const SDL_PropertiesID props = SDL_CreateProperties(); const SDL_PropertiesID props = SDL_CreateProperties();
SDL_SetPointerProperty(props, SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER, (void*) MxThread::ThreadProc); SDL_SetPointerProperty(props, SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER, (void*) MxThread::ThreadProc);
SDL_SetPointerProperty(props, SDL_PROP_THREAD_CREATE_USERDATA_POINTER, this); SDL_SetPointerProperty(props, SDL_PROP_THREAD_CREATE_USERDATA_POINTER, this);
SDL_SetNumberProperty(props, SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER, p_stackSize * 4); SDL_SetNumberProperty(props, SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER, p_stackSize * 4);
if ((m_thread = SDL_CreateThreadWithProperties(props))) { if (!(m_thread = SDL_CreateThreadWithProperties(props))) {
result = SUCCESS; goto done;
} }
SDL_DestroyProperties(props); SDL_DestroyProperties(props);
} }
result = SUCCESS;
done:
return result; return result;
} }
// FUNCTION: LEGO1 0x100bf660 // FUNCTION: LEGO1 0x100bf660
// FUNCTION: BETA10 0x101476ee
void MxThread::Sleep(MxS32 p_milliseconds) void MxThread::Sleep(MxS32 p_milliseconds)
{ {
SDL_Delay(p_milliseconds); SDL_Delay(p_milliseconds);
} }
// FUNCTION: BETA10 0x10147710
void MxThread::ResumeThread()
{
// unused
}
// FUNCTION: BETA10 0x10147733
void MxThread::SuspendThread()
{
// unused
}
// FUNCTION: BETA10 0x10147756
bool MxThread::TerminateThread(MxU32 p_exitCode)
{
// unused
return false;
}
// FUNCTION: BETA10 0x10147793
MxS32 MxThread::GetThreadPriority(MxU16& p_priority)
{
// unused
return -1;
}
// FUNCTION: BETA10 0x101477c8
bool MxThread::SetThreadPriority(MxU16 p_priority)
{
// unused
return false;
}
// FUNCTION: LEGO1 0x100bf670 // FUNCTION: LEGO1 0x100bf670
// FUNCTION: BETA10 0x1014780a
void MxThread::Terminate() void MxThread::Terminate()
{ {
m_running = FALSE; m_running = FALSE;
m_semaphore.Wait(); m_semaphore.Acquire();
} }
// FUNCTION: LEGO1 0x100bf680 // FUNCTION: LEGO1 0x100bf680
// FUNCTION: BETA10 0x1014783b
int MxThread::ThreadProc(void* p_thread) int MxThread::ThreadProc(void* p_thread)
{ {
return static_cast<MxThread*>(p_thread)->Run(); return static_cast<MxThread*>(p_thread)->Run();
} }
// FUNCTION: LEGO1 0x100bf690 // FUNCTION: LEGO1 0x100bf690
// FUNCTION: BETA10 0x10147855
MxResult MxThread::Run() MxResult MxThread::Run()
{ {
m_semaphore.Release(); m_semaphore.Release();

View File

@ -482,7 +482,7 @@ void MxDisplaySurface::VTable0x28(
tempSurface->Unlock(NULL); tempSurface->Unlock(NULL);
if (m_videoParam.Flags().GetF1bit3()) { if (m_videoParam.Flags().GetDoubleScaling()) {
RECT destRect = {p_right, p_bottom, p_right + p_width * 2, p_bottom + p_height * 2}; RECT destRect = {p_right, p_bottom, p_right + p_width * 2, p_bottom + p_height * 2};
m_ddSurface2->Blt(&destRect, tempSurface, NULL, DDBLT_WAIT | DDBLT_KEYSRC, NULL); m_ddSurface2->Blt(&destRect, tempSurface, NULL, DDBLT_WAIT | DDBLT_KEYSRC, NULL);
} }
@ -749,7 +749,7 @@ void MxDisplaySurface::DrawTransparentRLE(
// FUNCTION: LEGO1 0x100bba50 // FUNCTION: LEGO1 0x100bba50
void MxDisplaySurface::Display(MxS32 p_left, MxS32 p_top, MxS32 p_left2, MxS32 p_top2, MxS32 p_width, MxS32 p_height) void MxDisplaySurface::Display(MxS32 p_left, MxS32 p_top, MxS32 p_left2, MxS32 p_top2, MxS32 p_width, MxS32 p_height)
{ {
if (m_videoParam.Flags().GetF2bit1()) { if (m_videoParam.Flags().GetEnabled()) {
if (m_videoParam.Flags().GetFlipSurfaces()) { if (m_videoParam.Flags().GetFlipSurfaces()) {
if (g_unk0x1010215c < 2) { if (g_unk0x1010215c < 2) {
g_unk0x1010215c++; g_unk0x1010215c++;
@ -1012,7 +1012,7 @@ void MxDisplaySurface::VTable0x24(
MxU8* data = p_bitmap->GetStart(p_left, p_top); MxU8* data = p_bitmap->GetStart(p_left, p_top);
if (m_videoParam.Flags().GetF1bit3()) { if (m_videoParam.Flags().GetDoubleScaling()) {
p_bottom *= 2; p_bottom *= 2;
p_right *= 2; p_right *= 2;

View File

@ -21,17 +21,20 @@ MxVideoManager::MxVideoManager()
} }
// FUNCTION: LEGO1 0x100be270 // FUNCTION: LEGO1 0x100be270
// FUNCTION: BETA10 0x1012dde0
void MxVideoManager::UpdateView(MxU32 p_x, MxU32 p_y, MxU32 p_width, MxU32 p_height) void MxVideoManager::UpdateView(MxU32 p_x, MxU32 p_y, MxU32 p_width, MxU32 p_height)
{ {
} }
// FUNCTION: LEGO1 0x100be2a0 // FUNCTION: LEGO1 0x100be2a0
// FUNCTION: BETA10 0x1012cad8
MxVideoManager::~MxVideoManager() MxVideoManager::~MxVideoManager()
{ {
Destroy(TRUE); Destroy(TRUE);
} }
// FUNCTION: LEGO1 0x100be320 // FUNCTION: LEGO1 0x100be320
// FUNCTION: BETA10 0x1012cb66
MxResult MxVideoManager::Init() MxResult MxVideoManager::Init()
{ {
m_pDirectDraw = NULL; m_pDirectDraw = NULL;
@ -44,6 +47,7 @@ MxResult MxVideoManager::Init()
} }
// FUNCTION: LEGO1 0x100be340 // FUNCTION: LEGO1 0x100be340
// FUNCTION: BETA10 0x1012cbca
void MxVideoManager::Destroy(MxBool p_fromDestructor) void MxVideoManager::Destroy(MxBool p_fromDestructor)
{ {
if (m_thread) { if (m_thread) {
@ -81,7 +85,7 @@ void MxVideoManager::Destroy(MxBool p_fromDestructor)
m_criticalSection.Leave(); m_criticalSection.Leave();
if (!p_fromDestructor) { if (!p_fromDestructor) {
MxMediaManager::Destroy(); MxPresentationManager::Destroy();
} }
} }
@ -134,6 +138,7 @@ void MxVideoManager::SortPresenterList()
} }
// FUNCTION: LEGO1 0x100be600 // FUNCTION: LEGO1 0x100be600
// STUB: BETA10 0x1012cfbc
MxResult MxVideoManager::VTable0x28( MxResult MxVideoManager::VTable0x28(
MxVideoParam& p_videoParam, MxVideoParam& p_videoParam,
LPDIRECTDRAW p_pDirectDraw, LPDIRECTDRAW p_pDirectDraw,
@ -150,7 +155,7 @@ MxResult MxVideoManager::VTable0x28(
m_unk0x60 = FALSE; m_unk0x60 = FALSE;
if (MxMediaManager::Create() != SUCCESS) { if (MxPresentationManager::Create() != SUCCESS) {
goto done; goto done;
} }
@ -216,6 +221,7 @@ MxResult MxVideoManager::VTable0x28(
} }
// FUNCTION: LEGO1 0x100be820 // FUNCTION: LEGO1 0x100be820
// STUB: BETA10 0x1012d3f1
MxResult MxVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS, MxBool p_createThread) MxResult MxVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS, MxBool p_createThread)
{ {
MxBool locked = FALSE; MxBool locked = FALSE;
@ -224,8 +230,8 @@ MxResult MxVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS,
m_unk0x60 = TRUE; m_unk0x60 = TRUE;
if (MxMediaManager::Create() != SUCCESS) { if (MxPresentationManager::Create() != SUCCESS) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "MxMediaManager::Create failed"); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "MxPresentationManager::Create failed");
goto done; goto done;
} }
@ -308,6 +314,7 @@ MxResult MxVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS,
} }
// FUNCTION: LEGO1 0x100bea50 // FUNCTION: LEGO1 0x100bea50
// FUNCTION: BETA10 0x1012d85f
void MxVideoManager::Destroy() void MxVideoManager::Destroy()
{ {
Destroy(FALSE); Destroy(FALSE);
@ -326,6 +333,7 @@ void MxVideoManager::InvalidateRect(MxRect32& p_rect)
} }
// FUNCTION: LEGO1 0x100bea90 // FUNCTION: LEGO1 0x100bea90
// FUNCTION: BETA10 0x1012d8e3
MxResult MxVideoManager::Tickle() MxResult MxVideoManager::Tickle()
{ {
AUTOLOCK(m_criticalSection); AUTOLOCK(m_criticalSection);