diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 58f9c578..5206d936 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -2478,6 +2478,8 @@ MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoUnkn Vector3* v1 = p_edge->CWVertex(*p_boundary); Vector3* v2 = p_edge->CCWVertex(*p_boundary); + assert(v1 && v2); + p1 = *v2; p1 -= *v1; p1 *= p_destScale; @@ -2490,7 +2492,12 @@ MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoUnkn boundingBox.Min() -= vec; boundingBox.Max() = p1; boundingBox.Max() += vec; - return GetViewManager()->IsBoundingBoxInFrustum(boundingBox) == FALSE; + + if (GetViewManager()->IsBoundingBoxInFrustum(boundingBox) == FALSE) { + return TRUE; + } + + return FALSE; } // FUNCTION: LEGO1 0x10064120 diff --git a/LEGO1/omni/include/mxdiskstreamcontroller.h b/LEGO1/omni/include/mxdiskstreamcontroller.h index d2950e49..6bf7c418 100644 --- a/LEGO1/omni/include/mxdiskstreamcontroller.h +++ b/LEGO1/omni/include/mxdiskstreamcontroller.h @@ -97,4 +97,7 @@ private: // TEMPLATE: BETA10 0x10150e60 // MxUtilityList::PushBack +// TEMPLATE: BETA10 0x10150ff0 +// MxUtilityList::PushBack + #endif // MXDISKSTREAMCONTROLLER_H diff --git a/LEGO1/omni/include/mxstreamcontroller.h b/LEGO1/omni/include/mxstreamcontroller.h index 67f6fed0..907b99f8 100644 --- a/LEGO1/omni/include/mxstreamcontroller.h +++ b/LEGO1/omni/include/mxstreamcontroller.h @@ -74,14 +74,14 @@ public: MxStreamProvider* GetProvider() { return m_provider; } MxDSObjectList& GetUnk0x3c() { return m_unk0x3c; } MxDSObjectList& GetUnk0x54() { return m_unk0x54; } - MxDSSubscriberList& GetSubscriberList() { return m_subscriberList; } + MxDSSubscriberList& GetSubscriberList() { return m_subscribers; } protected: MxCriticalSection m_criticalSection; // 0x08 MxAtomId m_atom; // 0x24 MxStreamProvider* m_provider; // 0x28 undefined4* m_unk0x2c; // 0x2c - MxDSSubscriberList m_subscriberList; // 0x30 + MxDSSubscriberList m_subscribers; // 0x30 MxDSObjectList m_unk0x3c; // 0x3c MxNextActionDataStartList m_nextActionList; // 0x48 MxDSObjectList m_unk0x54; // 0x54 diff --git a/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp b/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp index f7bae81d..40ae8ae9 100644 --- a/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp +++ b/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp @@ -8,6 +8,8 @@ #include "mxomni.h" #include "mxticklemanager.h" +#include + DECOMP_SIZE_ASSERT(MxDiskStreamController, 0xc8); // FUNCTION: LEGO1 0x100c7120 @@ -17,6 +19,7 @@ MxDiskStreamController::MxDiskStreamController() } // FUNCTION: LEGO1 0x100c7530 +// FUNCTION: BETA10 0x10153a2d MxDiskStreamController::~MxDiskStreamController() { AUTOLOCK(m_criticalSection); @@ -35,6 +38,8 @@ MxDiskStreamController::~MxDiskStreamController() #endif } + assert(m_subscribers.size() == 0); + MxDSObject* object; while (m_unk0x3c.PopFront(object)) { delete object; @@ -65,28 +70,32 @@ MxDiskStreamController::~MxDiskStreamController() } // FUNCTION: LEGO1 0x100c7790 +// FUNCTION: BETA10 0x10153ea8 MxResult MxDiskStreamController::Open(const char* p_filename) { AUTOLOCK(m_criticalSection); MxResult result = MxStreamController::Open(p_filename); - if (result == SUCCESS) { - m_provider = new MxDiskStreamProvider(); - if (m_provider == NULL) { - result = FAILURE; - } - else { - result = m_provider->SetResourceToGet(this); - if (result != SUCCESS) { - delete m_provider; - m_provider = NULL; - } - else { - TickleManager()->RegisterClient(this, 10); - } - } + if (result != SUCCESS) { + goto done; } + m_provider = new MxDiskStreamProvider(); + if (m_provider == NULL) { + result = FAILURE; + goto done; + } + + result = m_provider->SetResourceToGet(this); + if (result != SUCCESS) { + delete m_provider; + m_provider = NULL; + goto done; + } + + TickleManager()->RegisterClient(this, 10); + +done: return result; } @@ -97,6 +106,7 @@ MxResult MxDiskStreamController::VTable0x18(undefined4, undefined4) } // FUNCTION: LEGO1 0x100c7890 +// FUNCTION: BETA10 0x101543bb MxResult MxDiskStreamController::FUN_100c7890(MxDSStreamingAction* p_action) { AUTOLOCK(m_criticalSection); @@ -104,7 +114,7 @@ MxResult MxDiskStreamController::FUN_100c7890(MxDSStreamingAction* p_action) return FAILURE; } - m_list0x80.push_back(p_action); + m_list0x80.PushBack(p_action); FUN_100c7970(); return SUCCESS; } @@ -122,6 +132,7 @@ void MxDiskStreamController::FUN_100c7970() } // FUNCTION: LEGO1 0x100c7980 +// FUNCTION: BETA10 0x10154848 void MxDiskStreamController::FUN_100c7980() { MxDSBuffer* buffer; @@ -159,24 +170,33 @@ void MxDiskStreamController::FUN_100c7980() } // FUNCTION: LEGO1 0x100c7ac0 +// FUNCTION: BETA10 0x10154abb MxDSStreamingAction* MxDiskStreamController::VTable0x28() { AUTOLOCK(m_criticalSection); MxDSObject* oldAction; - MxDSStreamingAction* result = NULL; + + assert(m_provider); + MxDSStreamingAction* request = NULL; MxU32 filesize = m_provider->GetFileSize(); - if (m_unk0x3c.PopFront(oldAction)) { - result = new MxDSStreamingAction((MxDSStreamingAction&) *oldAction); - if (result) { - MxU32 offset = result->GetBufferOffset() + filesize; - ((MxDSStreamingAction*) oldAction)->SetUnknown94(offset); - ((MxDSStreamingAction*) oldAction)->SetBufferOffset(offset); - m_unk0x3c.push_back(oldAction); - } + if (!m_unk0x3c.PopFront(oldAction)) { + goto done; } - return result; + request = new MxDSStreamingAction((MxDSStreamingAction&) *oldAction); + assert(request); + + if (!request) { + goto done; + } + + ((MxDSStreamingAction*) oldAction)->SetUnknown94(request->GetBufferOffset() + filesize); + ((MxDSStreamingAction*) oldAction)->SetBufferOffset(((MxDSStreamingAction*) oldAction)->GetUnknown94()); + m_unk0x3c.PushBack(oldAction); + +done: + return request; } // FUNCTION: LEGO1 0x100c7c00 diff --git a/LEGO1/omni/src/stream/mxstreamcontroller.cpp b/LEGO1/omni/src/stream/mxstreamcontroller.cpp index 88919aef..958fa371 100644 --- a/LEGO1/omni/src/stream/mxstreamcontroller.cpp +++ b/LEGO1/omni/src/stream/mxstreamcontroller.cpp @@ -32,7 +32,7 @@ MxStreamController::~MxStreamController() AUTOLOCK(m_criticalSection); MxDSSubscriber* subscriber; - while (m_subscriberList.PopFront(subscriber)) { + while (m_subscribers.PopFront(subscriber)) { delete subscriber; } @@ -80,14 +80,14 @@ MxResult MxStreamController::Open(const char* p_filename) // FUNCTION: BETA10 0x1014e730 void MxStreamController::AddSubscriber(MxDSSubscriber* p_subscriber) { - m_subscriberList.PushBack(p_subscriber); + m_subscribers.PushBack(p_subscriber); } // FUNCTION: LEGO1 0x100c1620 // FUNCTION: BETA10 0x1014e7b4 void MxStreamController::RemoveSubscriber(MxDSSubscriber* p_subscriber) { - m_subscriberList.Remove(p_subscriber); + m_subscribers.Remove(p_subscriber); } // FUNCTION: LEGO1 0x100c1690 @@ -173,7 +173,7 @@ MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset) } if (newUnknown24 == -1) { - for (MxDSSubscriberList::iterator it = m_subscriberList.begin(); it != m_subscriberList.end(); it++) { + for (MxDSSubscriberList::iterator it = m_subscribers.begin(); it != m_subscribers.end(); it++) { MxDSSubscriber* subscriber = *it; if (subscriber->GetObjectId() == p_action->GetObjectId()) { @@ -288,7 +288,7 @@ MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action) chunk->SetChunkFlags(DS_CHUNK_BIT3); chunk->SetObjectId(objectId); - if (chunk->SendChunk(m_subscriberList, FALSE, p_action->GetUnknown24()) != SUCCESS) { + if (chunk->SendChunk(m_subscribers, FALSE, p_action->GetUnknown24()) != SUCCESS) { delete chunk; } @@ -318,7 +318,7 @@ MxNextActionDataStart* MxStreamController::FindNextActionDataStartFromStreamingA // FUNCTION: BETA10 0x1014f3b5 MxBool MxStreamController::IsStoped(MxDSObject* p_obj) { - MxDSSubscriber* subscriber = m_subscriberList.Find(p_obj); + MxDSSubscriber* subscriber = m_subscribers.Find(p_obj); if (subscriber) { MxTrace(