diff --git a/LEGO1/lego/legoomni/include/legopathedgecontainer.h b/LEGO1/lego/legoomni/include/legopathedgecontainer.h index 5d6a79aa..bba8547b 100644 --- a/LEGO1/lego/legoomni/include/legopathedgecontainer.h +++ b/LEGO1/lego/legoomni/include/legopathedgecontainer.h @@ -106,4 +106,10 @@ struct LegoPathEdgeContainer : public list { MxU8 m_flags; // 0x38 }; +// SYNTHETIC: BETA10 0x10012080 +// LegoPathEdgeContainer::`scalar deleting destructor' + +// SYNTHETIC: BETA10 0x100120d0 +// LegoPathEdgeContainer::~LegoPathEdgeContainer + #endif // LEGOPATHEDGECONTAINER_H diff --git a/LEGO1/lego/legoomni/src/actors/doors.cpp b/LEGO1/lego/legoomni/src/actors/doors.cpp index 92ab5fc8..8fff7290 100644 --- a/LEGO1/lego/legoomni/src/actors/doors.cpp +++ b/LEGO1/lego/legoomni/src/actors/doors.cpp @@ -122,7 +122,9 @@ void Doors::ParseAction(char* p_extra) assert(m_ltDoor == NULL && m_rtDoor == NULL); assert(m_roi); - assert(!strncmp(m_roi->GetName(), "rcdor", 5)); + // clang-format off + assert(!strncmp( m_roi->GetName(), "rcdor", 5 )); + // clang-format on const CompoundObject* comp = m_roi->GetComp(); diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index f359d33a..6ad8cc85 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -2833,7 +2833,7 @@ void LegoAnimationManager::FUN_100648f0(LegoTranInfo* p_tranInfo, MxLong p_unk0x actor->SetWorldSpeed(0.0f); } - LegoLocation* location = NavController()->GetLocation(p_tranInfo->m_location); + const LegoLocation* location = NavController()->GetLocation(p_tranInfo->m_location); if (location != NULL) { CalcLocalTransform(location->m_position, location->m_direction, location->m_up, m_unk0x484); m_unk0x4cc.SetStartEnd(m_unk0x43c, m_unk0x484); diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 0b9d019c..1cf40934 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -640,6 +640,7 @@ MxResult LegoPathActor::VTable0x9c() case 1: break; default: + assert(0); return FAILURE; } } @@ -656,10 +657,14 @@ MxResult LegoPathActor::VTable0x9c() if (local20 != 0) { Mx3DPointFloat local78; - Vector3& v1 = *m_destEdge->CWVertex(*m_boundary); - Vector3& v2 = *m_destEdge->CCWVertex(*m_boundary); + assert(m_boundary && m_destEdge); - LERP3(local34, v1, v2, m_unk0xe4); + Vector3* v1 = m_destEdge->CWVertex(*m_boundary); + Vector3* v2 = m_destEdge->CCWVertex(*m_boundary); + + assert(v1 && v2); + + LERP3(local34, *v1, *v2, m_unk0xe4); m_destEdge->GetFaceNormal(*m_boundary, local78); local48.EqualsCross(*m_boundary->GetUp(), local78); @@ -695,6 +700,7 @@ MxResult LegoPathActor::VTable0x9c() } if (VTable0x80(localc0, local84, local34, local48) != SUCCESS) { + MxTrace("Warning: m_BADuration = %g, roi = %s\n", m_BADuration, m_roi->GetName()); return FAILURE; } diff --git a/LEGO1/library_msvc.h b/LEGO1/library_msvc.h index 04e9a674..5b4971d9 100644 --- a/LEGO1/library_msvc.h +++ b/LEGO1/library_msvc.h @@ -65,6 +65,9 @@ // LIBRARY: LEGO1 0x1008b680 // _strncmp +// LIBRARY: BETA10 0x100f9a80 +// strncmp + // LIBRARY: LEGO1 0x1008b6c0 // _atof @@ -718,6 +721,7 @@ // __fmode // GLOBAL: LEGO1 0x101028da +// GLOBAL: BETA10 0x101fbcca // __OP_POWjmptab // GLOBAL: LEGO1 0x1010292a @@ -841,6 +845,12 @@ // LIBRARY: BETA10 0x100f9420 // memcpy +// Issue: These symbols are inside `memcpy`. If enabled, the tail of the function mismatches. +// // GLOBAL: BETA10 0x100f9458 +// TrailingVecs +// // GLOBAL: BETA10 0x100f94f0 +// TrailingVecs_copydown + // LIBRARY: BETA10 0x100faa00 // memcmp @@ -877,6 +887,9 @@ // LIBRARY: BETA10 0x100ff82b // __ctrandisp1 +// LIBRARY: BETA10 0x100ff6ab +// __ctrandisp2 + // LIBRARY: BETA10 0x100f8a92 // operator delete @@ -943,6 +956,93 @@ // GLOBAL: LEGO1 0x100fd8ec // __newmode +// LIBRARY: BETA10 0x1018f410 +// _pow + +// GLOBAL: BETA10 0x101fa910 +// _assertstring + +// GLOBAL: BETA10 0x101fa940 +// dblnewline + +// GLOBAL: BETA10 0x101fa938 +// dotdotdot + +// GLOBAL: BETA10 0x101fa93c +// newline + +// LIBRARY: BETA10 0x100fbe10 +// doexit + +// LIBRARY: BETA10 0x100feeb0 +// xtoa + +// LIBRARY: BETA10 0x100ff330 +// flsall + +// GLOBAL: BETA10 0x101fbb08 +// rterrs + +// GLOBAL: BETA10 0x101faf64 +// __proc_attached + +// GLOBAL: BETA10 0x10211f6c +// _pRawDllMain + +// GLOBAL: BETA10 0x101fafa0 +// ctrlc_action + +// GLOBAL: BETA10 0x101fafa4 +// ctrlbreak_action + +// GLOBAL: BETA10 0x101fafa8 +// abort_action + +// GLOBAL: BETA10 0x101fafac +// term_action + +// GLOBAL: BETA10 0x101fbc18 +// _First_FPE_Indx + +// GLOBAL: BETA10 0x101fbc1c +// _Num_FPE + +// GLOBAL: BETA10 0x101fafe8 +// _crtAssertBusy + +// GLOBAL: BETA10 0x101fb01c +// pfnwsprintfA + +// GLOBAL: BETA10 0x10211f50 +// _pfnReportHook + +// GLOBAL: BETA10 0x101faff0 +// _CrtDbgMode + +// GLOBAL: BETA10 0x101fb000 +// _CrtDbgFile + +// LIBRARY: BETA10 0x100fc740 +// _CRT_INIT + +// LIBRARY: BETA10 0x100feb90 +// siglookup + +// LIBRARY: BETA10 0x10109920 +// $$$00001(2) + +// LIBRARY: BETA10 0x10100a70 +// _CrtDbgBreak + +// LIBRARY: BETA10 0x100fc650 +// _vsnprintf + +// LIBRARY: BETA10 0x1010cc20 +// _snprintf + +// LIBRARY: BETA10 0x10100fe0 +// CrtMessageWindow + // Cannot be handled right now due to anonymous pointer in struct. // We can annotate it on the original side, but we have no symbol on the recomp side. // We would need a way of annotating "the pointer at c_dfDIKeyboard+0x14 has orig address 0x10097f80". diff --git a/LEGO1/realtime/realtimeview.cpp b/LEGO1/realtime/realtimeview.cpp index afe0e790..0117b513 100644 --- a/LEGO1/realtime/realtimeview.cpp +++ b/LEGO1/realtime/realtimeview.cpp @@ -3,18 +3,23 @@ #include // GLOBAL: LEGO1 0x10109598 +// GLOBAL: BETA10 0x10211dc0 float g_userMaxLodPower; // GLOBAL: LEGO1 0x10101044 +// GLOBAL: BETA10 0x10204fd8 float g_userMaxBase = 4.0f; // GLOBAL: LEGO1 0x10101048 +// GLOBAL: BETA10 0x10204fdc float g_userMaxLod = 3.6f; // GLOBAL: LEGO1 0x1010104c +// GLOBAL: BETA10 0x10204fe0 float g_partsThreshold = 1000.0f; // FUNCTION: LEGO1 0x100a5dc0 +// FUNCTION: BETA10 0x10168840 RealtimeView::RealtimeView() { UpdateMaxLOD(); @@ -26,6 +31,7 @@ RealtimeView::~RealtimeView() } // FUNCTION: LEGO1 0x100a5de0 +// FUNCTION: BETA10 0x10168874 void RealtimeView::SetUserMaxLOD(float p_lod) { g_userMaxLod = p_lod; @@ -33,24 +39,28 @@ void RealtimeView::SetUserMaxLOD(float p_lod) } // FUNCTION: LEGO1 0x100a5df0 +// FUNCTION: BETA10 0x10168891 void RealtimeView::SetPartsThreshold(float p_threshold) { g_partsThreshold = p_threshold; } // FUNCTION: LEGO1 0x100a5e00 +// FUNCTION: BETA10 0x101688a9 float RealtimeView::GetUserMaxLOD() { return g_userMaxLod; } // FUNCTION: LEGO1 0x100a5e10 +// FUNCTION: BETA10 0x101688bf float RealtimeView::GetPartsThreshold() { return g_partsThreshold; } // FUNCTION: LEGO1 0x100a5e20 +// FUNCTION: BETA10 0x101688d5 void RealtimeView::UpdateMaxLOD() { g_userMaxLodPower = pow(g_userMaxBase, -g_userMaxLod); diff --git a/LEGO1/realtime/roi.h b/LEGO1/realtime/roi.h index 25829f7e..73e837d6 100644 --- a/LEGO1/realtime/roi.h +++ b/LEGO1/realtime/roi.h @@ -20,11 +20,13 @@ public: // FUNCTION: BETA10 0x1004a7a0 const Vector3& Min() const { return min; } + // FUNCTION: BETA10 0x10174c30 Vector3& Min() { return min; } // FUNCTION: BETA10 0x1004a7c0 const Vector3& Max() const { return max; } + // FUNCTION: BETA10 0x10174c50 Vector3& Max() { return max; } private: diff --git a/LEGO1/viewmanager/viewmanager.cpp b/LEGO1/viewmanager/viewmanager.cpp index e6a2d726..9bf1db44 100644 --- a/LEGO1/viewmanager/viewmanager.cpp +++ b/LEGO1/viewmanager/viewmanager.cpp @@ -9,6 +9,7 @@ DECOMP_SIZE_ASSERT(ViewManager, 0x1bc) // GLOBAL: LEGO1 0x100dbc78 +// GLOBAL: BETA10 0x101c3398 int g_boundingBoxCornerMap[8][3] = {{0, 0, 0}, {0, 0, 1}, {0, 1, 0}, {1, 0, 0}, {0, 1, 1}, {1, 0, 1}, {1, 1, 0}, {1, 1, 1}}; @@ -16,12 +17,15 @@ int g_boundingBoxCornerMap[8][3] = int g_planePointIndexMap[18] = {0, 1, 5, 6, 2, 3, 3, 0, 4, 1, 2, 6, 0, 3, 2, 4, 5, 6}; // GLOBAL: LEGO1 0x10101050 +// GLOBAL: BETA10 0x10205914 float g_LODScaleFactor = 4.0F; // GLOBAL: LEGO1 0x10101054 -float g_minLODThreshold = 0.00097656297; +// GLOBAL: BETA10 0x10205918 +float g_minLODThreshold = 1.0000005F / 1024; // GLOBAL: LEGO1 0x10101058 +// GLOBAL: BETA10 0x1020591c int g_maxLODLevels = 6; // GLOBAL: LEGO1 0x1010105c @@ -32,16 +36,51 @@ float g_elapsedSeconds = 0; inline void SetAppData(ViewROI* p_roi, LPD3DRM_APPDATA data); inline undefined4 GetD3DRM(IDirect3DRM2*& d3drm, Tgl::Renderer* pRenderer); -inline undefined4 GetFrame(IDirect3DRMFrame2*& frame, Tgl::Group* scene); +inline undefined4 GetFrame(IDirect3DRMFrame2** frame, Tgl::Group* scene); + +// STUB: BETA10 0x1017202e +int userVisualCallback( + LPDIRECT3DRMUSERVISUAL obj, + LPVOID arg, + D3DRMUSERVISUALREASON reason, + LPDIRECT3DRMDEVICE dev, + LPDIRECT3DRMVIEWPORT view +) +{ + // This function calls into LegoBSP.cpp, which has likely been removed in LEGO1 + return 0; +} + +// FUNCTION: BETA10 0x10172074 +void addDestroyCallback(LPDIRECT3DRMOBJECT obj, LPVOID arg) +{ + // intentionally empty +} // FUNCTION: LEGO1 0x100a5eb0 +// FUNCTION: BETA10 0x10171cb3 ViewManager::ViewManager(Tgl::Renderer* pRenderer, Tgl::Group* scene, const OrientableROI* point_of_view) : scene(scene), flags(c_bit1 | c_bit2 | c_bit3 | c_bit4) { SetPOVSource(point_of_view); prev_render_time = 0.09; GetD3DRM(d3drm, pRenderer); - GetFrame(frame, scene); + GetFrame(&frame, scene); + +#ifdef BETA10 + LPDIRECT3DRMUSERVISUAL userVisual; + if (d3drm->CreateUserVisual(userVisualCallback, this, &userVisual)) { + assert(0); + } + if (userVisual->AddDestroyCallback(addDestroyCallback, this)) { + assert(0); + } + if (frame->AddVisual(userVisual)) { + assert(0); + } + userVisual->Release(); +#endif + width = 0.0; height = 0.0; view_angle = 0.0; @@ -366,6 +405,7 @@ inline int ViewManager::CalculateLODLevel(float p_maximumScale, float p_initialS return 0; } else { + // LINE: BETA10 0x10172c4d lodLevel = 1; } } @@ -476,6 +516,7 @@ void ViewManager::SetFrustrum(float fov, float front, float back) } // FUNCTION: LEGO1 0x100a6da0 +// FUNCTION: BETA10 0x10173977 void ViewManager::SetPOVSource(const OrientableROI* point_of_view) { if (point_of_view != NULL) { @@ -554,19 +595,28 @@ inline void SetAppData(ViewROI* p_roi, LPD3DRM_APPDATA data) { IDirect3DRMFrame2* frame = NULL; - if (GetFrame(frame, p_roi->GetGeometry()) == 0) { + if (GetFrame(&frame, p_roi->GetGeometry()) == 0) { frame->SetAppData(data); } } -inline undefined4 GetD3DRM(IDirect3DRM2*& d3drm, Tgl::Renderer* pRenderer) +// FUNCTION: BETA10 0x10171f30 +inline undefined4 GetD3DRM(IDirect3DRM2*& d3drm, Tgl::Renderer* p_tglRenderer) { - d3drm = ((TglImpl::RendererImpl*) pRenderer)->ImplementationData(); + assert(p_tglRenderer); + TglImpl::RendererImpl* renderer = (TglImpl::RendererImpl*) p_tglRenderer; + // Note: Diff in BETA10 (thunked in recompile but not in orig) + d3drm = renderer->ImplementationData(); return 0; } -inline undefined4 GetFrame(IDirect3DRMFrame2*& frame, Tgl::Group* scene) +// FUNCTION: BETA10 0x10171f82 +inline undefined4 GetFrame(IDirect3DRMFrame2** p_f, Tgl::Group* p_group) { - frame = ((TglImpl::GroupImpl*) scene)->ImplementationData(); + assert(p_f && p_group); + TglImpl::GroupImpl* cast = (TglImpl::GroupImpl*) p_group; + assert(cast); + *p_f = cast->ImplementationData(); + assert(p_f); return 0; } diff --git a/LEGO1/viewmanager/viewmanager.h b/LEGO1/viewmanager/viewmanager.h index 1f12cb28..2c4bc0fc 100644 --- a/LEGO1/viewmanager/viewmanager.h +++ b/LEGO1/viewmanager/viewmanager.h @@ -8,6 +8,7 @@ #include // VTABLE: LEGO1 0x100dbd88 +// VTABLE: BETA10 0x101c34bc // SIZE 0x1bc class ViewManager { public: @@ -46,6 +47,7 @@ public: void Add(ViewROI* p_roi) { rois.push_back(p_roi); } // SYNTHETIC: LEGO1 0x100a6000 + // SYNTHETIC: BETA10 0x10174410 // ViewManager::`scalar deleting destructor' private: @@ -73,10 +75,17 @@ private: // TEMPLATE: LEGO1 0x10022030 // list >::insert +// TEMPLATE: BETA10 0x1007b0b0 +// List::List + // TEMPLATE: LEGO1 0x100a6020 // List::~List +// TEMPLATE: BETA10 0x101755d0 +// Vector::Vector + // TEMPLATE: LEGO1 0x100a6070 +// TEMPLATE: BETA10 0x10174510 // Vector::~Vector // TEMPLATE: LEGO1 0x100a6f80