From 8e54a20d7d1e88dde36b1eb6fcfb2903caa445d4 Mon Sep 17 00:00:00 2001 From: jonschz <17198703+jonschz@users.noreply.github.com> Date: Sun, 25 May 2025 07:59:58 +0200 Subject: [PATCH 1/8] Match `DecodeSS2` (#1476) --------- Co-authored-by: jonschz --- LEGO1/omni/src/video/flic.cpp | 133 +++++++++++++++++++++------------- 1 file changed, 84 insertions(+), 49 deletions(-) diff --git a/LEGO1/omni/src/video/flic.cpp b/LEGO1/omni/src/video/flic.cpp index cfd7541e..c040b83f 100644 --- a/LEGO1/omni/src/video/flic.cpp +++ b/LEGO1/omni/src/video/flic.cpp @@ -355,64 +355,99 @@ void DecodeLC(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_data // FUNCTION: BETA10 0x1013e61d void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_data, FLIC_HEADER* p_flcHeader) { - short width = (short) p_flcHeader->width - 1; - short row = (short) p_flcHeader->height - 1; - short lines = *((short*) p_data); - BYTE* data = p_data + 2; + short xofs = 0; + short yofs = 0; - while (--lines > 0) { - short token; + short width = p_flcHeader->width; + short token = 0; - while (TRUE) { - token = *((short*) data); - data += 2; + // LINE: BETA10 0x1013e643 + short xmax = xofs + width - 1; - if (token < 0) { - if (token & 0x4000) { - row += token; - } - else { - WritePixel(p_bitmapHeader, p_pixelData, width, row, token); - token = *((WORD*) data); - data += 2; + // LINE: BETA10 0x1013e652 + union { + BYTE* byte; + WORD* word; + } data = {p_data}; - if (!token) { - row--; - if (--lines <= 0) { - return; - } - } - else { - break; - } - } + // The first word in the data following the chunk header contains the number of lines in the chunk. + // The line count does not include skipped lines. + short lines = *(short*) data.word++; + + // LINE: BETA10 0x1013e666 + short row = p_flcHeader->height - yofs - 1; + + goto start_packet; + +skip_lines: + // The layout in BETA10 strongly suggests that lots of `goto`s are used. + // LINE: BETA10 0x1013e684 + row += token; + +start_packet: + // LINE: BETA10 0x1013e692 + token = *(short*) data.word++; + + if (token >= 0) { + goto column_loop; + } + + if ((unsigned short) token & 0x4000) { + goto skip_lines; + } + + WritePixel(p_bitmapHeader, p_pixelData, xmax, row, token); + token = *(short*) data.word++; + + // LINE: BETA10 0x1013e6ef + if (!token) { + row--; + if (--lines > 0) { + goto start_packet; + } + return; + } + else { + + column_loop: + // LINE: BETA10 0x1013e71e + short column = xofs; + + column_loop_inner: + // LINE: BETA10 0x1013e726 + column += *data.byte++; + // LINE: BETA10 0x1013e73a + short type = *(char*) data.byte++; + type += type; + + if (type >= 0) { + WritePixels(p_bitmapHeader, p_pixelData, column, row, data.byte, type); + column += type; + data.byte += type; + // LINE: BETA10 0x1013e797 + if (--token != 0) { + goto column_loop_inner; } - else { - break; + row--; + if (--lines > 0) { + goto start_packet; } + return; } - short column = 0; - do { - column += *(data++); - short type = *((char*) data++); - type += type; - - if (type >= 0) { - WritePixels(p_bitmapHeader, p_pixelData, column, row, data, type); - column += type; - data += type; - } - else { - type = -type; - short p_pixel = *((WORD*) data); - data += 2; - WritePixelPairs(p_bitmapHeader, p_pixelData, column, row, p_pixel, type >> 1); - column += type; - } - } while (--token); - + type = -type; + WORD* p_pixel = data.word++; + WritePixelPairs(p_bitmapHeader, p_pixelData, column, row, *p_pixel, type >> 1); + column += type; + // LINE: BETA10 0x1013e813 + if (--token != 0) { + goto column_loop_inner; + } row--; + if (--lines > 0) { + goto start_packet; + } + return; } } From 804632b13f425db287a574280beb7b6c44ee9ab8 Mon Sep 17 00:00:00 2001 From: Florian Kaiser Date: Sun, 25 May 2025 08:09:24 +0200 Subject: [PATCH 2/8] Refactor `LegoUnknown100db7f4` to `LegoOrientedEdge` (#1515) * Refactor `LegoUnknown100db7f4` to `LegoOrientedEdge` * Update LEGO1/lego/sources/geom/legoorientededge.h * Update legopathcontroller.h --------- Co-authored-by: Christian Semmler --- CMakeLists.txt | 2 +- LEGO1/lego/legoomni/include/act3actors.h | 2 +- .../legoomni/include/legoanimationmanager.h | 4 +- LEGO1/lego/legoomni/include/legopathactor.h | 10 ++-- .../lego/legoomni/include/legopathboundary.h | 10 +--- .../legoomni/include/legopathcontroller.h | 14 ++--- LEGO1/lego/legoomni/include/legoracers.h | 4 +- LEGO1/lego/legoomni/include/legoracespecial.h | 2 +- LEGO1/lego/legoomni/src/actors/act2actor.cpp | 2 +- LEGO1/lego/legoomni/src/actors/act3actors.cpp | 16 +++--- .../legoomni/src/actors/islepathactor.cpp | 4 +- .../src/common/legoanimationmanager.cpp | 24 ++++---- .../lego/legoomni/src/paths/legopathactor.cpp | 16 +++--- .../legoomni/src/paths/legopathboundary.cpp | 55 +++++++++---------- .../legoomni/src/paths/legopathcontroller.cpp | 25 ++++----- LEGO1/lego/legoomni/src/race/legoracers.cpp | 4 +- .../legoomni/src/race/legoracespecial.cpp | 16 +++--- LEGO1/lego/sources/geom/legoedge.h | 2 +- LEGO1/lego/sources/geom/legoorientededge.cpp | 12 ++++ ...egounkown100db7f4.h => legoorientededge.h} | 52 +++++++++--------- .../lego/sources/geom/legounkown100db7f4.cpp | 12 ---- LEGO1/lego/sources/geom/legoweedge.cpp | 6 +- LEGO1/lego/sources/geom/legoweedge.h | 10 ++-- LEGO1/lego/sources/geom/legowegedge.cpp | 20 +++---- 24 files changed, 158 insertions(+), 166 deletions(-) create mode 100644 LEGO1/lego/sources/geom/legoorientededge.cpp rename LEGO1/lego/sources/geom/{legounkown100db7f4.h => legoorientededge.h} (72%) delete mode 100644 LEGO1/lego/sources/geom/legounkown100db7f4.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index c4681228..37aa52ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -160,7 +160,7 @@ function(add_lego_libraries NAME) add_library(geom${ARG_SUFFIX} STATIC LEGO1/lego/sources/geom/legoedge.cpp LEGO1/lego/sources/geom/legoweedge.cpp - LEGO1/lego/sources/geom/legounkown100db7f4.cpp + LEGO1/lego/sources/geom/legoorientededge.cpp LEGO1/lego/sources/geom/legowegedge.cpp ) list(APPEND list_targets geom${ARG_SUFFIX}) diff --git a/LEGO1/lego/legoomni/include/act3actors.h b/LEGO1/lego/legoomni/include/act3actors.h index 02b3d22d..99b4c80b 100644 --- a/LEGO1/lego/legoomni/include/act3actors.h +++ b/LEGO1/lego/legoomni/include/act3actors.h @@ -140,7 +140,7 @@ class Act3Brickster : public Act3Actor { MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 void SwitchBoundary( LegoPathBoundary*& p_boundary, - LegoUnknown100db7f4*& p_edge, + LegoOrientedEdge*& p_edge, float& p_unk0xe4 ) override; // vtable+0x98 MxResult VTable0x9c() override; // vtable+0x9c diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 81a8b481..03f7d6d1 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -16,7 +16,7 @@ class LegoFile; class LegoPathActor; class LegoPathBoundary; class LegoROIList; -struct LegoUnknown100db7f4; +struct LegoOrientedEdge; class LegoWorld; class MxDSAction; @@ -240,7 +240,7 @@ class LegoAnimationManager : public MxCore { void FUN_10063d10(); void FUN_10063e40(LegoAnimPresenter* p_presenter); MxBool FUN_10063fb0(LegoLocation::Boundary* p_boundary, LegoWorld* p_world); - MxBool FUN_10064010(LegoPathBoundary* p_boundary, LegoUnknown100db7f4* p_edge, float p_destScale); + MxBool FUN_10064010(LegoPathBoundary* p_boundary, LegoOrientedEdge* p_edge, float p_destScale); MxBool FUN_10064120(LegoLocation::Boundary* p_boundary, MxBool p_bool1, MxBool p_bool2); MxResult FUN_10064380( const char* p_name, diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index f4a4117e..3002ccfe 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -10,7 +10,7 @@ struct LegoNamedPlane; class LegoPathBoundary; class LegoPathController; struct LegoPathEdgeContainer; -struct LegoUnknown100db7f4; +struct LegoOrientedEdge; class LegoWEEdge; extern MxLong g_unk0x100f3308; @@ -67,7 +67,7 @@ class LegoPathActor : public LegoActor { float p_time, Vector3& p_p1, Vector3& p_p4, - LegoUnknown100db7f4& p_destEdge, + LegoOrientedEdge& p_destEdge, float p_destScale ); // vtable+0x84 virtual MxResult VTable0x88( @@ -75,7 +75,7 @@ class LegoPathActor : public LegoActor { float p_time, LegoEdge& p_srcEdge, float p_srcScale, - LegoUnknown100db7f4& p_destEdge, + LegoOrientedEdge& p_destEdge, float p_destScale ); // vtable+0x88 virtual MxS32 VTable0x8c(float p_time, Matrix4& p_transform); // vtable+0x8c @@ -88,7 +88,7 @@ class LegoPathActor : public LegoActor { virtual void SwitchBoundary( LegoPathBoundary*& p_boundary, - LegoUnknown100db7f4*& p_edge, + LegoOrientedEdge*& p_edge, float& p_unk0xe4 ); // vtable+0x98 virtual MxResult VTable0x9c(); // vtable+0x9c @@ -182,7 +182,7 @@ class LegoPathActor : public LegoActor { LegoPathBoundary* m_boundary; // 0x88 LegoUnknown m_unk0x8c; // 0x8c MxU32 m_actorState; // 0xdc - LegoUnknown100db7f4* m_destEdge; // 0xe0 + LegoOrientedEdge* m_destEdge; // 0xe0 MxFloat m_unk0xe4; // 0xe4 MxBool m_collideBox; // 0xe8 MxBool m_unk0xe9; // 0xe9 diff --git a/LEGO1/lego/legoomni/include/legopathboundary.h b/LEGO1/lego/legoomni/include/legopathboundary.h index a2a2d6ba..7a34b9b6 100644 --- a/LEGO1/lego/legoomni/include/legopathboundary.h +++ b/LEGO1/lego/legoomni/include/legopathboundary.h @@ -43,16 +43,10 @@ class LegoPathBoundary : public LegoWEGEdge { void SwitchBoundary( LegoPathActor* p_actor, LegoPathBoundary*& p_boundary, - LegoUnknown100db7f4*& p_edge, + LegoOrientedEdge*& p_edge, float& p_unk0xe4 ); - MxU32 Intersect( - float p_scale, - Vector3& p_point1, - Vector3& p_point2, - Vector3& p_point3, - LegoUnknown100db7f4*& p_edge - ); + MxU32 Intersect(float p_scale, Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, LegoOrientedEdge*& p_edge); MxU32 FUN_10057fe0(LegoAnimPresenter* p_presenter); MxU32 FUN_100586e0(LegoAnimPresenter* p_presenter); diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index 1a13f961..5000ae9d 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -2,7 +2,7 @@ #define LEGOPATHCONTROLLER_H #include "decomp.h" -#include "geom/legounkown100db7f4.h" +#include "geom/legoorientededge.h" #include "legopathactor.h" #include "legopathboundary.h" #include "legopathstruct.h" @@ -21,7 +21,7 @@ class Vector3; // VTABLE: LEGO1 0x100d7da8 // SIZE 0x40 -struct LegoPathCtrlEdge : public LegoUnknown100db7f4 {}; +struct LegoPathCtrlEdge : public LegoOrientedEdge {}; struct LegoPathCtrlEdgeCompare { MxU32 operator()(const LegoPathCtrlEdge* p_lhs, const LegoPathCtrlEdge* p_rhs) const @@ -60,7 +60,7 @@ class LegoPathController : public MxCore { } LegoPathController* m_controller; // 0x00 - LegoUnknown100db7f4* m_edge; // 0x04 + LegoOrientedEdge* m_edge; // 0x04 }; LegoPathController(); @@ -126,7 +126,7 @@ class LegoPathController : public MxCore { Vector3& p_v1, Vector3& p_v2, float p_f1, - LegoUnknown100db7f4*& p_edge, + LegoOrientedEdge*& p_edge, LegoPathBoundary*& p_boundary ); MxResult FUN_1004a380( @@ -144,13 +144,13 @@ class LegoPathController : public MxCore { static MxResult Reset(); // FUNCTION: BETA10 0x100cf580 - static LegoUnknown100db7f4* GetControlEdgeA(MxS32 p_index) { return g_ctrlEdgesA[p_index].m_edge; } + static LegoOrientedEdge* GetControlEdgeA(MxS32 p_index) { return g_ctrlEdgesA[p_index].m_edge; } // FUNCTION: BETA10 0x100cf5b0 static LegoPathBoundary* GetControlBoundaryA(MxS32 p_index) { return g_ctrlBoundariesA[p_index].m_boundary; } // These two are an educated guess because BETA10 does not have the g_ctrl.*B globals - static LegoUnknown100db7f4* GetControlEdgeB(MxS32 p_index) { return g_ctrlEdgesB[p_index].m_edge; } + static LegoOrientedEdge* GetControlEdgeB(MxS32 p_index) { return g_ctrlEdgesB[p_index].m_edge; } static LegoPathBoundary* GetControlBoundaryB(MxS32 p_index) { return g_ctrlBoundariesB[p_index].m_boundary; } private: @@ -264,7 +264,7 @@ class LegoPathController : public MxCore { // LegoPathCtrlEdge::~LegoPathCtrlEdge // SYNTHETIC: LEGO1 0x10047ae0 -// LegoUnknown100db7f4::~LegoUnknown100db7f4 +// LegoOrientedEdge::~LegoOrientedEdge // TEMPLATE: LEGO1 0x10048f00 // list >::begin diff --git a/LEGO1/lego/legoomni/include/legoracers.h b/LEGO1/lego/legoomni/include/legoracers.h index 7709ebb7..76d1071d 100644 --- a/LEGO1/lego/legoomni/include/legoracers.h +++ b/LEGO1/lego/legoomni/include/legoracers.h @@ -72,7 +72,7 @@ class LegoJetski : public LegoJetskiRaceActor, public LegoRaceMap { MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 // FUNCTION: LEGO1 0x100141d0 - void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) override + void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEdge*& p_edge, float& p_unk0xe4) override { LegoJetskiRaceActor::SwitchBoundary(p_boundary, p_edge, p_unk0xe4); } // vtable+0x98 @@ -136,7 +136,7 @@ class LegoRaceCar : public LegoCarRaceActor, public LegoRaceMap { // FUNCTION: LEGO1 0x10014560 // FUNCTION: BETA10 0x100cd660 - void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) override + void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEdge*& p_edge, float& p_unk0xe4) override { LegoCarRaceActor::SwitchBoundary(p_boundary, p_edge, p_unk0xe4); } // vtable+0x98 diff --git a/LEGO1/lego/legoomni/include/legoracespecial.h b/LEGO1/lego/legoomni/include/legoracespecial.h index 3382a394..97fa7d9f 100644 --- a/LEGO1/lego/legoomni/include/legoracespecial.h +++ b/LEGO1/lego/legoomni/include/legoracespecial.h @@ -44,7 +44,7 @@ class LegoCarRaceActor : public virtual LegoRaceActor { Vector3& p_v3 ) override; // vtable+0x6c void Animate(float p_time) override; // vtable+0x70 - void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) + void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEdge*& p_edge, float& p_unk0xe4) override; // vtable+0x98 MxResult VTable0x9c() override; // vtable+0x9c diff --git a/LEGO1/lego/legoomni/src/actors/act2actor.cpp b/LEGO1/lego/legoomni/src/actors/act2actor.cpp index cc1a6d8a..df163a18 100644 --- a/LEGO1/lego/legoomni/src/actors/act2actor.cpp +++ b/LEGO1/lego/legoomni/src/actors/act2actor.cpp @@ -417,7 +417,7 @@ void Act2Actor::FUN_100192a0(undefined4 p_location) newPosition, newDirection, newBoundary, - LegoUnknown100db7f4::c_bit1, + LegoOrientedEdge::c_bit1, NULL ); diff --git a/LEGO1/lego/legoomni/src/actors/act3actors.cpp b/LEGO1/lego/legoomni/src/actors/act3actors.cpp index 9f17b70e..9d2f22a2 100644 --- a/LEGO1/lego/legoomni/src/actors/act3actors.cpp +++ b/LEGO1/lego/legoomni/src/actors/act3actors.cpp @@ -353,7 +353,7 @@ MxResult Act3Cop::FUN_10040360() local7c, local5c, boundary, - LegoUnknown100db7f4::c_bit1, + LegoOrientedEdge::c_bit1, &local34 ) != SUCCESS) { delete grec; @@ -391,7 +391,7 @@ MxResult Act3Cop::FUN_10040360() local88, localec, donut->GetBoundary(), - LegoUnknown100db7f4::c_bit1, + LegoOrientedEdge::c_bit1, &locald8 ) == SUCCESS && (grec == NULL || locald8 < local18)) { @@ -431,7 +431,7 @@ MxResult Act3Cop::FUN_10040360() localf8, local108, boundary, - LegoUnknown100db7f4::c_bit1, + LegoOrientedEdge::c_bit1, &local100 ) != SUCCESS) { local14c = local150 = grec; @@ -831,7 +831,7 @@ MxResult Act3Brickster::FUN_100417c0() local88, localec, pizza->GetBoundary(), - LegoUnknown100db7f4::c_bit1, + LegoOrientedEdge::c_bit1, &locald8 ) == SUCCESS && (grec == NULL || locald8 < local18)) { @@ -915,7 +915,7 @@ MxResult Act3Brickster::FUN_100417c0() local108, local138, localf4, - LegoUnknown100db7f4::c_bit1, + LegoOrientedEdge::c_bit1, &local13c ) != SUCCESS) { local1bc = local1c0 = grec; @@ -1055,7 +1055,7 @@ MxS32 Act3Brickster::FUN_10042300() assert(m_boundary && m_destEdge && m_roi); LegoPathBoundary* boundaries[2]; - LegoUnknown100db7f4* maxE = NULL; + LegoOrientedEdge* maxE = NULL; boundaries[0] = m_boundary; if (m_destEdge->FUN_10048c40(local38)) { @@ -1069,7 +1069,7 @@ MxS32 Act3Brickster::FUN_10042300() for (MxS32 i = 0; i < (MxS32) sizeOfArray(boundaries); i++) { if (boundaries[i] != NULL) { for (MxS32 j = 0; j < boundaries[i]->GetNumEdges(); j++) { - LegoUnknown100db7f4* e = boundaries[i]->GetEdges()[j]; + LegoOrientedEdge* e = boundaries[i]->GetEdges()[j]; if (e->GetMask0x03()) { Mx3DPointFloat local94(*e->GetPointA()); @@ -1109,7 +1109,7 @@ MxS32 Act3Brickster::FUN_10042300() // FUNCTION: LEGO1 0x10042990 // FUNCTION: BETA10 0x1001b6e2 -void Act3Brickster::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) +void Act3Brickster::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEdge*& p_edge, float& p_unk0xe4) { if (m_unk0x38 != 8) { m_boundary->SwitchBoundary(this, p_boundary, p_edge, p_unk0xe4); diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index 4d4f56f8..1055d58d 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -119,11 +119,11 @@ void IslePathActor::Exit() MxS32 i; for (i = 0; i < m_boundary->GetNumEdges(); i++) { - LegoUnknown100db7f4* e = (LegoUnknown100db7f4*) m_boundary->GetEdges()[i]; + LegoOrientedEdge* e = (LegoOrientedEdge*) m_boundary->GetEdges()[i]; assert(e); Mx3DPointFloat local20; - e->FUN_1002ddc0(*m_boundary, local20); + e->GetFaceNormal(*m_boundary, local20); local20 *= m_roi->GetWorldBoundingSphere().Radius(); local20 += GetWorldPosition(); diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 38db541c..04ff924a 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -2464,7 +2464,7 @@ MxBool LegoAnimationManager::FUN_10063fb0(LegoLocation::Boundary* p_boundary, Le if (p_boundary->m_name != NULL) { Mx3DPointFloat vec; LegoPathBoundary* boundary = p_world->FindPathBoundary(p_boundary->m_name); - LegoUnknown100db7f4* pSrcE = (LegoUnknown100db7f4*) boundary->GetEdges()[p_boundary->m_src]; + LegoOrientedEdge* pSrcE = (LegoOrientedEdge*) boundary->GetEdges()[p_boundary->m_src]; return FUN_10064010(boundary, pSrcE, p_boundary->m_srcScale); } @@ -2473,7 +2473,7 @@ MxBool LegoAnimationManager::FUN_10063fb0(LegoLocation::Boundary* p_boundary, Le // FUNCTION: LEGO1 0x10064010 // FUNCTION: BETA10 0x100453a5 -MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoUnknown100db7f4* p_edge, float p_destScale) +MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoOrientedEdge* p_edge, float p_destScale) { Mx3DPointFloat p1; Vector3* v1 = p_edge->CWVertex(*p_boundary); @@ -2521,15 +2521,15 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx Mx3DPointFloat direction = actor->GetWorldDirection(); float local4c = 0.0f; - LegoUnknown100db7f4* local50 = NULL; + LegoOrientedEdge* local50 = NULL; LegoS32 numEdges = boundary->GetNumEdges(); Mx3DPointFloat vec; - LegoUnknown100db7f4* e; + LegoOrientedEdge* e; MxS32 i; for (i = 0; i < numEdges; i++) { - e = (LegoUnknown100db7f4*) boundary->GetEdges()[i]; - e->FUN_1002ddc0(*boundary, vec); + e = (LegoOrientedEdge*) boundary->GetEdges()[i]; + e->GetFaceNormal(*boundary, vec); float dot = vec.Dot(direction, vec); if (dot > local4c) { @@ -2540,7 +2540,7 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx e = local50; do { - e = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(*boundary); + e = (LegoOrientedEdge*) e->GetCounterclockwiseEdge(*boundary); if (e->GetMask0x03()) { break; } @@ -2550,8 +2550,8 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx return FALSE; } - LegoUnknown100db7f4* local34 = e; - LegoUnknown100db7f4* local8 = local50; + LegoOrientedEdge* local34 = e; + LegoOrientedEdge* local8 = local50; while (local2c--) { if (local34 != NULL) { @@ -2562,7 +2562,7 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx numEdges = boundary->GetNumEdges(); for (i = 0; i < numEdges; i++) { - LegoUnknown100db7f4* e = (LegoUnknown100db7f4*) boundary->GetEdges()[i]; + LegoOrientedEdge* e = (LegoOrientedEdge*) boundary->GetEdges()[i]; if (local34 == e) { p_boundary->m_src = i; @@ -2581,10 +2581,10 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx do { if (p_bool1) { - local34 = (LegoUnknown100db7f4*) local34->GetCounterclockwiseEdge(*boundary); + local34 = (LegoOrientedEdge*) local34->GetCounterclockwiseEdge(*boundary); } else { - local34 = (LegoUnknown100db7f4*) local34->GetClockwiseEdge(*boundary); + local34 = (LegoOrientedEdge*) local34->GetClockwiseEdge(*boundary); } } while (!local34->GetMask0x03() && local34 != local50); diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 83d90611..c360794f 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -1,7 +1,7 @@ #include "legopathactor.h" #include "define.h" -#include "geom/legounkown100db7f4.h" +#include "geom/legoorientededge.h" #include "legocachesoundmanager.h" #include "legocameracontroller.h" #include "legonamedplane.h" @@ -95,7 +95,7 @@ MxResult LegoPathActor::VTable0x88( float p_time, LegoEdge& p_srcEdge, float p_srcScale, - LegoUnknown100db7f4& p_destEdge, + LegoOrientedEdge& p_destEdge, float p_destScale ) { @@ -122,7 +122,7 @@ MxResult LegoPathActor::VTable0x88( m_unk0x7c = 0; m_lastTime = p_time; m_actorTime = p_time; - p_destEdge.FUN_1002ddc0(*p_boundary, p3); + p_destEdge.GetFaceNormal(*p_boundary, p3); p4 = p2; p4 -= p1; @@ -172,7 +172,7 @@ MxResult LegoPathActor::VTable0x84( float p_time, Vector3& p_p1, Vector3& p_p4, - LegoUnknown100db7f4& p_destEdge, + LegoOrientedEdge& p_destEdge, float p_destScale ) { @@ -192,7 +192,7 @@ MxResult LegoPathActor::VTable0x84( m_unk0x7c = 0; m_lastTime = p_time; m_actorTime = p_time; - p_destEdge.FUN_1002ddc0(*p_boundary, p3); + p_destEdge.GetFaceNormal(*p_boundary, p3); MxMatrix matrix; Vector3 pos(matrix[3]); @@ -442,7 +442,7 @@ void LegoPathActor::Animate(float p_time) // FUNCTION: LEGO1 0x1002e8b0 // FUNCTION: BETA10 0x100af2f7 -void LegoPathActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) +void LegoPathActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEdge*& p_edge, float& p_unk0xe4) { assert(m_boundary); m_boundary->SwitchBoundary(this, p_boundary, p_edge, p_unk0xe4); @@ -516,7 +516,7 @@ inline MxU32 LegoPathActor::FUN_1002edd0( LegoS32 numEdges = p_boundary->GetNumEdges(); for (MxS32 i = 0; i < numEdges; i++) { - LegoUnknown100db7f4* edge = p_boundary->GetEdges()[i]; + LegoOrientedEdge* edge = p_boundary->GetEdges()[i]; LegoPathBoundary* boundary = (LegoPathBoundary*) edge->OtherFace(p_boundary); if (boundary != NULL) { @@ -652,7 +652,7 @@ MxResult LegoPathActor::VTable0x9c() LERP3(local34, v1, v2, m_unk0xe4); - m_destEdge->FUN_1002ddc0(*m_boundary, local78); + m_destEdge->GetFaceNormal(*m_boundary, local78); local48.EqualsCross(*m_boundary->GetUnknown0x14(), local78); local48.Unitize(); } diff --git a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp index 8f832630..cfacbf03 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp @@ -1,7 +1,7 @@ #include "legopathboundary.h" #include "decomp.h" -#include "geom/legounkown100db7f4.h" +#include "geom/legoorientededge.h" #include "legolocomotionanimpresenter.h" #include "legopathactor.h" #include "legopathstruct.h" @@ -86,11 +86,11 @@ void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPa void LegoPathBoundary::SwitchBoundary( LegoPathActor* p_actor, LegoPathBoundary*& p_boundary, - LegoUnknown100db7f4*& p_edge, + LegoOrientedEdge*& p_edge, float& p_unk0xe4 ) { - LegoUnknown100db7f4* e = p_edge; + LegoOrientedEdge* e = p_edge; if (p_edge->BETA_100b53b0(*p_boundary)) { LegoPathBoundary* newBoundary = (LegoPathBoundary*) p_edge->OtherFace(p_boundary); @@ -110,7 +110,7 @@ void LegoPathBoundary::SwitchBoundary( } do { - p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*newBoundary); + p_edge = (LegoOrientedEdge*) p_edge->GetCounterclockwiseEdge(*newBoundary); LegoPathBoundary* local20 = (LegoPathBoundary*) p_edge->OtherFace(newBoundary); if (p_edge->GetMask0x03() && (userNavFlag || p_edge->BETA_1004a830(*local20, 1))) { @@ -133,10 +133,10 @@ void LegoPathBoundary::SwitchBoundary( while (local8 > 0) { if (localc) { - p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*newBoundary); + p_edge = (LegoOrientedEdge*) p_edge->GetCounterclockwiseEdge(*newBoundary); } else { - p_edge = (LegoUnknown100db7f4*) p_edge->GetClockwiseEdge(*newBoundary); + p_edge = (LegoOrientedEdge*) p_edge->GetClockwiseEdge(*newBoundary); } LegoPathBoundary* local20 = (LegoPathBoundary*) p_edge->OtherFace(newBoundary); @@ -147,8 +147,8 @@ void LegoPathBoundary::SwitchBoundary( } if (p_edge == e) { - p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*newBoundary); - p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*newBoundary); + p_edge = (LegoOrientedEdge*) p_edge->GetCounterclockwiseEdge(*newBoundary); + p_edge = (LegoOrientedEdge*) p_edge->GetCounterclockwiseEdge(*newBoundary); } if (p_boundary != newBoundary) { @@ -162,7 +162,7 @@ void LegoPathBoundary::SwitchBoundary( } else { do { - p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*p_boundary); + p_edge = (LegoOrientedEdge*) p_edge->GetCounterclockwiseEdge(*p_boundary); if (p_edge->GetMask0x03()) { break; @@ -170,8 +170,8 @@ void LegoPathBoundary::SwitchBoundary( } while (p_edge != e); if (p_edge == e) { - p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*p_boundary); - p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*p_boundary); + p_edge = (LegoOrientedEdge*) p_edge->GetCounterclockwiseEdge(*p_boundary); + p_edge = (LegoOrientedEdge*) p_edge->GetCounterclockwiseEdge(*p_boundary); } p_unk0xe4 = 1.0 - p_unk0xe4; @@ -185,17 +185,17 @@ MxU32 LegoPathBoundary::Intersect( Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, - LegoUnknown100db7f4*& p_edge + LegoOrientedEdge*& p_edge ) { - LegoUnknown100db7f4* e = NULL; + LegoOrientedEdge* e = NULL; float localc; MxU32 local10 = 0; float len = 0.0f; Mx3DPointFloat vec; for (MxS32 i = 0; i < m_numEdges; i++) { - LegoUnknown100db7f4* edge = (LegoUnknown100db7f4*) m_edges[i]; + LegoOrientedEdge* edge = (LegoOrientedEdge*) m_edges[i]; if (p_point2.Dot(m_edgeNormals[i], p_point2) + m_edgeNormals[i][3] <= -1e-07) { if (local10 == 0) { @@ -240,17 +240,17 @@ MxU32 LegoPathBoundary::Intersect( local50 = p_point2; local50 -= *local5c; - e->FUN_1002ddc0(*this, local70); + e->GetFaceNormal(*this, local70); float local58 = local50.Dot(local50, local70); - LegoUnknown100db7f4* local54 = NULL; + LegoOrientedEdge* local54 = NULL; if (local58 < 0.0f) { Mx3DPointFloat local84; - for (LegoUnknown100db7f4* local88 = (LegoUnknown100db7f4*) e->GetClockwiseEdge(*this); e != local88; - local88 = (LegoUnknown100db7f4*) local88->GetClockwiseEdge(*this)) { - local88->FUN_1002ddc0(*this, local84); + for (LegoOrientedEdge* local88 = (LegoOrientedEdge*) e->GetClockwiseEdge(*this); e != local88; + local88 = (LegoOrientedEdge*) local88->GetClockwiseEdge(*this)) { + local88->GetFaceNormal(*this, local84); if (local84.Dot(local84, local70) <= 0.9) { break; @@ -262,7 +262,7 @@ MxU32 LegoPathBoundary::Intersect( float local8c = locala4.Dot(locala4, local84); - if (local8c > local58 && local8c < local88->m_unk0x3c) { + if (local8c > local58 && local8c < local88->m_length) { local54 = local88; local58 = local8c; local70 = local84; @@ -271,13 +271,12 @@ MxU32 LegoPathBoundary::Intersect( } } else { - if (e->m_unk0x3c < local58) { + if (e->m_length < local58) { Mx3DPointFloat localbc; - for (LegoUnknown100db7f4* locala8 = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(*this); - e != locala8; - locala8 = (LegoUnknown100db7f4*) locala8->GetCounterclockwiseEdge(*this)) { - locala8->FUN_1002ddc0(*this, localbc); + for (LegoOrientedEdge* locala8 = (LegoOrientedEdge*) e->GetCounterclockwiseEdge(*this); e != locala8; + locala8 = (LegoOrientedEdge*) locala8->GetCounterclockwiseEdge(*this)) { + locala8->GetFaceNormal(*this, localbc); if (localbc.Dot(localbc, local70) <= 0.9) { break; @@ -305,7 +304,7 @@ MxU32 LegoPathBoundary::Intersect( if (local58 <= 0.0f) { if (!e->GetMask0x03()) { - p_edge = (LegoUnknown100db7f4*) e->GetClockwiseEdge(*this); + p_edge = (LegoOrientedEdge*) e->GetClockwiseEdge(*this); } else { p_edge = e; @@ -314,7 +313,7 @@ MxU32 LegoPathBoundary::Intersect( p_point3 = *local5c; return 2; } - else if (local58 > 0.0f && e->m_unk0x3c > local58) { + else if (local58 > 0.0f && e->m_length > local58) { p_point3 = local70; p_point3 *= local58; p_point3 += *local5c; @@ -325,7 +324,7 @@ MxU32 LegoPathBoundary::Intersect( p_point3 = *e->CCWVertex(*this); if (!e->GetMask0x03()) { - p_edge = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(*this); + p_edge = (LegoOrientedEdge*) e->GetCounterclockwiseEdge(*this); } else { p_edge = e; diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index e8c89711..0f6ee835 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -224,7 +224,7 @@ MxResult LegoPathController::PlaceActor( float time = Timer()->GetTime(); MxResult result = - p_actor->VTable0x88(pBoundary, time, *pSrcE, p_srcScale, (LegoUnknown100db7f4&) *pDestE, p_destScale); + p_actor->VTable0x88(pBoundary, time, *pSrcE, p_srcScale, (LegoOrientedEdge&) *pDestE, p_destScale); if (result != SUCCESS) { assert(0); @@ -284,15 +284,14 @@ MxResult LegoPathController::PlaceActor( } for (MxS32 j = 0; j < boundary->GetNumEdges(); j++) { - LegoUnknown100db7f4* edge = (LegoUnknown100db7f4*) boundary->GetEdges()[j]; + LegoOrientedEdge* edge = (LegoOrientedEdge*) boundary->GetEdges()[j]; if (edge->GetMask0x03()) { Mx3DPointFloat vec; - if (((LegoUnknown100db7f4*) edge->GetClockwiseEdge(*boundary))->FUN_1002ddc0(*boundary, vec) == SUCCESS && + if (((LegoOrientedEdge*) edge->GetClockwiseEdge(*boundary))->GetFaceNormal(*boundary, vec) == SUCCESS && vec.Dot(vec, p_direction) < 0.0f) { - edge = - (LegoUnknown100db7f4*) edge->GetCounterclockwiseEdge(*boundary)->GetCounterclockwiseEdge(*boundary); + edge = (LegoOrientedEdge*) edge->GetCounterclockwiseEdge(*boundary)->GetCounterclockwiseEdge(*boundary); } if (!edge->GetMask0x03()) { @@ -567,7 +566,7 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage) } edge.m_pointB = &m_unk0x10[s]; - if (edge.m_flags & LegoUnknown100db7f4::c_bit3) { + if (edge.m_flags & LegoOrientedEdge::c_hasFaceA) { if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) { return FAILURE; } @@ -584,7 +583,7 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage) edge.m_cwA = &m_edges[s]; } - if (edge.m_flags & LegoUnknown100db7f4::c_bit4) { + if (edge.m_flags & LegoOrientedEdge::c_hasFaceB) { if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) { return FAILURE; } @@ -601,11 +600,11 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage) edge.m_cwB = &m_edges[s]; } - if (ReadVector(p_storage, edge.m_unk0x28) != SUCCESS) { + if (ReadVector(p_storage, edge.m_dir) != SUCCESS) { return FAILURE; } - if (p_storage->Read(&edge.m_unk0x3c, sizeof(float)) != SUCCESS) { + if (p_storage->Read(&edge.m_length, sizeof(float)) != SUCCESS) { return FAILURE; } } @@ -629,7 +628,7 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) boundary.m_edgeNormals = new Mx4DPointFloat[numE]; - LegoUnknown100db7f4** edges = new LegoUnknown100db7f4*[numE]; + LegoOrientedEdge** edges = new LegoOrientedEdge*[numE]; boundary.SetEdges(edges, numE); for (j = 0; j < numE; j++) { @@ -818,7 +817,7 @@ MxResult LegoPathController::FUN_10048310( while (boundarySetItA != boundarySet.end()) { MxU32 shouldRemove = TRUE; - LegoUnknown100db7f4* e = (*boundarySetItA)->m_edge; + LegoOrientedEdge* e = (*boundarySetItA)->m_edge; LegoPathBoundary* b = (*boundarySetItA)->m_boundary; assert(e && b); @@ -935,7 +934,7 @@ MxS32 LegoPathController::FUN_1004a240( Vector3& p_v1, Vector3& p_v2, float p_f1, - LegoUnknown100db7f4*& p_edge, + LegoOrientedEdge*& p_edge, LegoPathBoundary*& p_boundary ) { @@ -956,7 +955,7 @@ MxS32 LegoPathController::FUN_1004a240( p_v1 -= *p_edge->CWVertex(*p_boundary); p_v1 *= p_f1; p_v1 += *p_edge->CWVertex(*p_boundary); - p_edge->FUN_1002ddc0(*p_boundary, vec); + p_edge->GetFaceNormal(*p_boundary, vec); p_v2.EqualsCross(*p_boundary->GetUnknown0x14(), vec); return 0; } diff --git a/LEGO1/lego/legoomni/src/race/legoracers.cpp b/LEGO1/lego/legoomni/src/race/legoracers.cpp index 172c662b..39c0c0e6 100644 --- a/LEGO1/lego/legoomni/src/race/legoracers.cpp +++ b/LEGO1/lego/legoomni/src/race/legoracers.cpp @@ -316,12 +316,12 @@ void LegoRaceCar::FUN_10012ff0(float p_param) if (a->GetDuration() <= deltaTime || deltaTime < 0.0) { if (m_userState == LEGORACECAR_KICK1) { - LegoUnknown100db7f4** edges = m_kick1B->GetEdges(); + LegoOrientedEdge** edges = m_kick1B->GetEdges(); m_destEdge = edges[2]; m_boundary = m_kick1B; } else { - LegoUnknown100db7f4** edges = m_kick1B->GetEdges(); + LegoOrientedEdge** edges = m_kick1B->GetEdges(); m_destEdge = edges[1]; m_boundary = m_kick2B; } diff --git a/LEGO1/lego/legoomni/src/race/legoracespecial.cpp b/LEGO1/lego/legoomni/src/race/legoracespecial.cpp index 06d79082..a0164d24 100644 --- a/LEGO1/lego/legoomni/src/race/legoracespecial.cpp +++ b/LEGO1/lego/legoomni/src/race/legoracespecial.cpp @@ -1,6 +1,6 @@ #include "legoracespecial.h" -#include "geom/legounkown100db7f4.h" +#include "geom/legoorientededge.h" #include "legonavcontroller.h" #include "legopathboundary.h" #include "legopathcontroller.h" @@ -65,7 +65,7 @@ void LegoCarRaceActor::FUN_10080590(float p_time) Mx3DPointFloat destEdgeUnknownVector; Mx3DPointFloat worldDirection = Mx3DPointFloat(m_roi->GetWorldDirection()); - m_destEdge->FUN_1002ddc0(*m_boundary, destEdgeUnknownVector); + m_destEdge->GetFaceNormal(*m_boundary, destEdgeUnknownVector); if (abs(destEdgeUnknownVector.Dot(destEdgeUnknownVector.GetData(), worldDirection.GetData())) > 0.5) { maxSpeed *= m_unk0x10; @@ -169,7 +169,7 @@ MxS32 LegoCarRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_edg LERP3(pointUnknown, *v1, *v2, m_unk0xe4); - m_destEdge->FUN_1002ddc0(*m_boundary, destEdgeUnknownVector); + m_destEdge->GetFaceNormal(*m_boundary, destEdgeUnknownVector); crossProduct.EqualsCross(*m_boundary->GetUnknown0x14(), destEdgeUnknownVector); crossProduct.Unitize(); @@ -212,7 +212,7 @@ MxS32 LegoCarRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_edg // FUNCTION: LEGO1 0x10080b40 // FUNCTION: BETA10 0x100cdb3c -void LegoCarRaceActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) +void LegoCarRaceActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEdge*& p_edge, float& p_unk0xe4) { LegoPathActor::SwitchBoundary(m_boundary, m_destEdge, m_unk0xe4); } @@ -241,7 +241,7 @@ void LegoCarRaceActor::Animate(float p_time) // FUNCTION: BETA10 0x100cdc54 MxResult LegoCarRaceActor::VTable0x9c() { - LegoUnknown100db7f4* d = m_destEdge; + LegoOrientedEdge* d = m_destEdge; if (VTable0x1c(m_boundary, m_destEdge)) { LegoPathBoundary* b = m_boundary; @@ -262,8 +262,8 @@ MxResult LegoCarRaceActor::VTable0x9c() Mx3DPointFloat point4; Mx3DPointFloat point5; - d->FUN_1002ddc0(*b, point2); - m_destEdge->FUN_1002ddc0(*m_boundary, point3); + d->GetFaceNormal(*b, point2); + m_destEdge->GetFaceNormal(*m_boundary, point3); point4.EqualsCross(point2, *m_boundary->GetUnknown0x14()); point5.EqualsCross(*m_boundary->GetUnknown0x14(), point3); @@ -364,7 +364,7 @@ MxS32 LegoJetskiRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_ LERP3(a, *v1, *v2, m_unk0xe4); - m_destEdge->FUN_1002ddc0(*m_boundary, bbb); + m_destEdge->GetFaceNormal(*m_boundary, bbb); c.EqualsCross(bbb, *m_boundary->GetUnknown0x14()); c.Unitize(); diff --git a/LEGO1/lego/sources/geom/legoedge.h b/LEGO1/lego/sources/geom/legoedge.h index 881f9325..9a14eef4 100644 --- a/LEGO1/lego/sources/geom/legoedge.h +++ b/LEGO1/lego/sources/geom/legoedge.h @@ -17,7 +17,7 @@ struct LegoEdge { Vector3* CWVertex(LegoWEEdge& p_face); Vector3* CCWVertex(LegoWEEdge& p_face); - LegoResult FUN_1002ddc0(LegoWEEdge& p_face, Vector3& p_point); + LegoResult GetFaceNormal(LegoWEEdge& p_face, Vector3& p_point); // FUNCTION: BETA10 0x10184170 LegoWEEdge* GetFaceA() { return m_faceA; } diff --git a/LEGO1/lego/sources/geom/legoorientededge.cpp b/LEGO1/lego/sources/geom/legoorientededge.cpp new file mode 100644 index 00000000..238723f5 --- /dev/null +++ b/LEGO1/lego/sources/geom/legoorientededge.cpp @@ -0,0 +1,12 @@ +#include "legoorientededge.h" + +DECOMP_SIZE_ASSERT(LegoOrientedEdge, 0x40) + +// FUNCTION: LEGO1 0x1009a630 +// FUNCTION: BETA10 0x10183050 +LegoOrientedEdge::LegoOrientedEdge() +{ + m_flags = 0; + m_dir.Clear(); + m_length = 0.0f; +} diff --git a/LEGO1/lego/sources/geom/legounkown100db7f4.h b/LEGO1/lego/sources/geom/legoorientededge.h similarity index 72% rename from LEGO1/lego/sources/geom/legounkown100db7f4.h rename to LEGO1/lego/sources/geom/legoorientededge.h index d54e3730..bb613563 100644 --- a/LEGO1/lego/sources/geom/legounkown100db7f4.h +++ b/LEGO1/lego/sources/geom/legoorientededge.h @@ -1,5 +1,5 @@ -#ifndef __LEGOUNKNOWN100DB7F4_H -#define __LEGOUNKNOWN100DB7F4_H +#ifndef __LEGOORIENTEDEDGE_H +#define __LEGOORIENTEDEDGE_H #include "legoedge.h" #include "legowegedge.h" @@ -9,31 +9,31 @@ // VTABLE: LEGO1 0x100db7f4 // SIZE 0x40 -struct LegoUnknown100db7f4 : public LegoEdge { +struct LegoOrientedEdge : public LegoEdge { public: enum { c_bit1 = 0x01, c_bit2 = 0x02, - c_bit3 = 0x04, - c_bit4 = 0x08 + c_hasFaceA = 0x04, + c_hasFaceB = 0x08 }; - LegoUnknown100db7f4(); + LegoOrientedEdge(); // FUNCTION: LEGO1 0x1002ddc0 // FUNCTION: BETA10 0x100372a0 - LegoResult FUN_1002ddc0(LegoWEEdge& p_f, Vector3& p_point) const + LegoResult GetFaceNormal(LegoWEEdge& p_face, Vector3& p_point) const { - if (p_f.IsEqual(m_faceA)) { - p_point[0] = -m_unk0x28[0]; - p_point[1] = -m_unk0x28[1]; - p_point[2] = -m_unk0x28[2]; + if (p_face.IsEqual(m_faceA)) { + p_point[0] = -m_dir[0]; + p_point[1] = -m_dir[1]; + p_point[2] = -m_dir[2]; } else { // clang-format off - assert(p_f.IsEqual( m_faceB )); + assert(p_face.IsEqual( m_faceB )); // clang-format on - p_point = m_unk0x28; + p_point = m_dir; } return SUCCESS; @@ -78,7 +78,7 @@ struct LegoUnknown100db7f4 : public LegoEdge { } // FUNCTION: BETA10 0x100bd540 - LegoFloat DistanceBetweenMidpoints(const LegoUnknown100db7f4& p_other) + LegoFloat DistanceBetweenMidpoints(const LegoOrientedEdge& p_other) { Mx3DPointFloat point1(*m_pointA); Mx3DPointFloat point2(*p_other.m_pointA); @@ -99,22 +99,22 @@ struct LegoUnknown100db7f4 : public LegoEdge { inline LegoU32 FUN_10048c40(const Vector3& p_position); // SYNTHETIC: LEGO1 0x1009a6c0 - // LegoUnknown100db7f4::`scalar deleting destructor' + // LegoOrientedEdge::`scalar deleting destructor' - LegoU16 m_flags; // 0x24 - Mx3DPointFloat m_unk0x28; // 0x28 - float m_unk0x3c; // 0x3c + LegoU16 m_flags; // 0x24 + Mx3DPointFloat m_dir; // 0x28 + float m_length; // 0x3c }; // FUNCTION: LEGO1 0x10048c40 // FUNCTION: BETA10 0x1001cc90 -inline LegoU32 LegoUnknown100db7f4::FUN_10048c40(const Vector3& p_position) +inline LegoU32 LegoOrientedEdge::FUN_10048c40(const Vector3& p_position) { LegoFloat localc, local10; LegoU32 result = FALSE; - if (m_unk0x28[0] > 0.001 || m_unk0x28[0] < -0.001) { - localc = (p_position[0] - (*m_pointA)[0]) / m_unk0x28[0]; + if (m_dir[0] > 0.001 || m_dir[0] < -0.001) { + localc = (p_position[0] - (*m_pointA)[0]) / m_dir[0]; if (localc < 0 || localc > 1) { return FALSE; @@ -128,8 +128,8 @@ inline LegoU32 LegoUnknown100db7f4::FUN_10048c40(const Vector3& p_position) } } - if (m_unk0x28[1] > 0.001 || m_unk0x28[1] < -0.001) { - local10 = (p_position[1] - (*m_pointA)[1]) / m_unk0x28[1]; + if (m_dir[1] > 0.001 || m_dir[1] < -0.001) { + local10 = (p_position[1] - (*m_pointA)[1]) / m_dir[1]; if (result) { if (localc > local10 + 0.001 || localc < local10 - 0.001) { @@ -147,8 +147,8 @@ inline LegoU32 LegoUnknown100db7f4::FUN_10048c40(const Vector3& p_position) } } - if (m_unk0x28[2] > 0.001 || m_unk0x28[2] < -0.001) { - local10 = (p_position[2] - (*m_pointA)[2]) / m_unk0x28[2]; + if (m_dir[2] > 0.001 || m_dir[2] < -0.001) { + local10 = (p_position[2] - (*m_pointA)[2]) / m_dir[2]; if (result) { if (localc > local10 + 0.001 || localc < local10 - 0.001) { @@ -168,4 +168,4 @@ inline LegoU32 LegoUnknown100db7f4::FUN_10048c40(const Vector3& p_position) return TRUE; } -#endif // __LEGOUNKNOWN100DB7F4_H +#endif // __LEGOORIENTEDEDGE_H diff --git a/LEGO1/lego/sources/geom/legounkown100db7f4.cpp b/LEGO1/lego/sources/geom/legounkown100db7f4.cpp deleted file mode 100644 index 25740067..00000000 --- a/LEGO1/lego/sources/geom/legounkown100db7f4.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "legounkown100db7f4.h" - -DECOMP_SIZE_ASSERT(LegoUnknown100db7f4, 0x40) - -// FUNCTION: LEGO1 0x1009a630 -// FUNCTION: BETA10 0x10183050 -LegoUnknown100db7f4::LegoUnknown100db7f4() -{ - m_flags = 0; - m_unk0x28.Clear(); - m_unk0x3c = 0.0f; -} diff --git a/LEGO1/lego/sources/geom/legoweedge.cpp b/LEGO1/lego/sources/geom/legoweedge.cpp index 862b247d..c9437456 100644 --- a/LEGO1/lego/sources/geom/legoweedge.cpp +++ b/LEGO1/lego/sources/geom/legoweedge.cpp @@ -1,6 +1,6 @@ #include "legoweedge.h" -#include "legounkown100db7f4.h" +#include "legoorientededge.h" DECOMP_SIZE_ASSERT(LegoWEEdge, 0x0c) @@ -23,8 +23,8 @@ LegoWEEdge::~LegoWEEdge() LegoS32 LegoWEEdge::VTable0x04() { for (LegoS32 i = 0; i < m_numEdges; i++) { - LegoUnknown100db7f4* e1 = m_edges[i]; - LegoUnknown100db7f4* e2 = (m_numEdges - i) == 1 ? m_edges[0] : m_edges[i + 1]; + LegoOrientedEdge* e1 = m_edges[i]; + LegoOrientedEdge* e2 = (m_numEdges - i) == 1 ? m_edges[0] : m_edges[i + 1]; if (e2->m_pointA == e1->m_pointA) { e1->m_faceA = this; diff --git a/LEGO1/lego/sources/geom/legoweedge.h b/LEGO1/lego/sources/geom/legoweedge.h index c2df2758..381e4753 100644 --- a/LEGO1/lego/sources/geom/legoweedge.h +++ b/LEGO1/lego/sources/geom/legoweedge.h @@ -4,7 +4,7 @@ #include "decomp.h" #include "misc/legotypes.h" -struct LegoUnknown100db7f4; +struct LegoOrientedEdge; // might be a struct with public members // VTABLE: LEGO1 0x100db7c0 @@ -20,12 +20,12 @@ class LegoWEEdge { LegoU8 GetNumEdges() { return m_numEdges; } // FUNCTION: BETA10 0x1001cc30 - LegoUnknown100db7f4** GetEdges() { return m_edges; } + LegoOrientedEdge** GetEdges() { return m_edges; } // FUNCTION: BETA10 0x100373f0 LegoU32 IsEqual(LegoWEEdge* p_other) { return this == p_other; } - void SetEdges(LegoUnknown100db7f4** p_edges, LegoU8 p_numEdges) + void SetEdges(LegoOrientedEdge** p_edges, LegoU8 p_numEdges) { m_edges = p_edges; m_numEdges = p_numEdges; @@ -35,8 +35,8 @@ class LegoWEEdge { // LegoWEEdge::`scalar deleting destructor' protected: - LegoU8 m_numEdges; // 0x04 - LegoUnknown100db7f4** m_edges; // 0x08 + LegoU8 m_numEdges; // 0x04 + LegoOrientedEdge** m_edges; // 0x08 }; #endif // __LEGOWEEDGE_H diff --git a/LEGO1/lego/sources/geom/legowegedge.cpp b/LEGO1/lego/sources/geom/legowegedge.cpp index 5c3a68d2..b0e27c08 100644 --- a/LEGO1/lego/sources/geom/legowegedge.cpp +++ b/LEGO1/lego/sources/geom/legowegedge.cpp @@ -1,6 +1,6 @@ #include "legowegedge.h" -#include "legounkown100db7f4.h" +#include "legoorientededge.h" #include @@ -81,7 +81,7 @@ LegoS32 LegoWEGEdge::VTable0x04() m_edgeNormals = new Mx4DPointFloat[m_numEdges]; assert(m_edgeNormals); - LegoUnknown100db7f4* edge; + LegoOrientedEdge* edge; LegoS32 i; for (i = 0; i < m_numEdges; i++) { @@ -118,27 +118,27 @@ LegoS32 LegoWEGEdge::VTable0x04() for (i = 0; i < m_numEdges; i++) { edge = m_edges[i]; - Vector3& local5c = edge->m_unk0x28; + Vector3& local5c = edge->m_dir; - if (edge->m_unk0x3c == 0) { + if (edge->m_length == 0) { local5c = *m_edges[i]->m_pointB; local5c -= *m_edges[i]->m_pointA; - edge->m_unk0x3c = local5c.LenSquared(); + edge->m_length = local5c.LenSquared(); - if (edge->m_unk0x3c <= 0.0f) { + if (edge->m_length <= 0.0f) { assert(0); if (result == 0) { result = -1; } } - edge->m_unk0x3c = sqrt((double) edge->m_unk0x3c); - local5c /= edge->m_unk0x3c; + edge->m_length = sqrt((double) edge->m_length); + local5c /= edge->m_length; } Mx3DPointFloat local58; Vector3 local64(&m_edgeNormals[i][0]); - edge->FUN_1002ddc0(*this, local58); + edge->GetFaceNormal(*this, local58); local64.EqualsCross(local58, m_unk0x14); m_edgeNormals[i][3] = -local64.Dot(*m_edges[i]->m_pointA, local64); @@ -147,7 +147,7 @@ LegoS32 LegoWEGEdge::VTable0x04() } if (edge->GetFaceA() != NULL && edge->GetFaceB() != NULL) { - edge->SetFlags(LegoUnknown100db7f4::c_bit1 | LegoUnknown100db7f4::c_bit2); + edge->SetFlags(LegoOrientedEdge::c_bit1 | LegoOrientedEdge::c_bit2); } } From 5ad885f9588514be716928f3812aeb057b7ccdf3 Mon Sep 17 00:00:00 2001 From: MS Date: Sun, 25 May 2025 11:37:16 -0400 Subject: [PATCH 3/8] TglImpl::DeviceImpl functions (#1519) --- LEGO1/tgl/d3drm/device.cpp | 113 +++++++++++++++++++++++++++++++------ LEGO1/tgl/d3drm/impl.h | 2 +- LEGO1/tgl/tgl.h | 2 +- 3 files changed, 98 insertions(+), 19 deletions(-) diff --git a/LEGO1/tgl/d3drm/device.cpp b/LEGO1/tgl/d3drm/device.cpp index 2d17a5c9..39502d1e 100644 --- a/LEGO1/tgl/d3drm/device.cpp +++ b/LEGO1/tgl/d3drm/device.cpp @@ -12,22 +12,49 @@ void* DeviceImpl::ImplementationDataPtr() return reinterpret_cast(&m_data); } +// FUNCTION: BETA10 0x1016dea0 +inline unsigned long DeviceGetWidth(IDirect3DRMDevice2* pDevice) +{ + return pDevice->GetWidth(); +} + // FUNCTION: LEGO1 0x100a2c00 +// FUNCTION: BETA10 0x1016de40 unsigned long DeviceImpl::GetWidth() { - return m_data->GetWidth(); + assert(m_data); + + return DeviceGetWidth(m_data); +} + +// FUNCTION: BETA10 0x1016df20 +inline unsigned long DeviceGetHeight(IDirect3DRMDevice2* pDevice) +{ + return pDevice->GetHeight(); } // FUNCTION: LEGO1 0x100a2c10 +// FUNCTION: BETA10 0x1016dec0 unsigned long DeviceImpl::GetHeight() { - return m_data->GetHeight(); + assert(m_data); + + return DeviceGetHeight(m_data); +} + +// FUNCTION: BETA10 0x1016dfa0 +inline Result DeviceSetColorModel(IDirect3DRMDevice2* pDevice, ColorModel) +{ + return Success; } // FUNCTION: LEGO1 0x100a2c20 -Result DeviceImpl::SetColorModel(ColorModel) +// FUNCTION: BETA10 0x1016df40 +Result DeviceImpl::SetColorModel(ColorModel p_model) { - return Success; + assert(m_data); + + return DeviceSetColorModel(m_data, p_model); } // FUNCTION: BETA10 0x1016e020 @@ -46,44 +73,96 @@ Result DeviceImpl::SetShadingModel(ShadingModel model) return DeviceSetShadingModel(m_data, model); } +// FUNCTION: BETA10 0x1016e140 +inline Result DeviceSetShadeCount(IDirect3DRMDevice2* pDevice, unsigned long shadeCount) +{ + return ResultVal(pDevice->SetShades(shadeCount)); +} + // FUNCTION: LEGO1 0x100a2ca0 +// FUNCTION: BETA10 0x1016e0e0 Result DeviceImpl::SetShadeCount(unsigned long shadeCount) { - return ResultVal(m_data->SetShades(shadeCount)); + assert(m_data); + + return DeviceSetShadeCount(m_data, shadeCount); +} + +// FUNCTION: BETA10 0x1016e1d0 +inline Result DeviceSetDither(IDirect3DRMDevice2* pDevice, int dither) +{ + return ResultVal(pDevice->SetDither(dither)); } // FUNCTION: LEGO1 0x100a2cc0 +// FUNCTION: BETA10 0x1016e170 Result DeviceImpl::SetDither(int dither) { - return ResultVal(m_data->SetDither(dither)); + assert(m_data); + + return DeviceSetDither(m_data, dither); +} + +// FUNCTION: BETA10 0x1016e260 +inline void DeviceHandleActivate(IDirect3DRMDevice2* pDevice, WORD wParam) +{ + IDirect3DRMWinDevice* winDevice; + + Result result = ResultVal(pDevice->QueryInterface(IID_IDirect3DRMWinDevice, (LPVOID*) &winDevice)); + if (Succeeded(result)) { + winDevice->HandleActivate(wParam); + int refCount = winDevice->Release(); + assert(refCount == 1); + } } // FUNCTION: LEGO1 0x100a2ce0 +// FUNCTION: BETA10 0x1016e200 void DeviceImpl::HandleActivate(WORD wParam) { - // Device argument is intentionally unused. + assert(m_data); + + DeviceHandleActivate(m_data, wParam); +} + +// FUNCTION: BETA10 0x1016e360 +inline void DeviceHandlePaint(IDirect3DRMDevice2* pDevice, void* p_data) +{ IDirect3DRMWinDevice* winDevice; - if (ResultVal(m_data->QueryInterface(IID_IDirect3DRMWinDevice, (LPVOID*) &winDevice))) { - winDevice->HandleActivate(wParam); - winDevice->Release(); + + Result result = ResultVal(pDevice->QueryInterface(IID_IDirect3DRMWinDevice, (LPVOID*) &winDevice)); + if (Succeeded(result)) { + HDC hdc = (HDC) p_data; + winDevice->HandlePaint(hdc); + int refCount = winDevice->Release(); + assert(refCount == 1); } } // FUNCTION: LEGO1 0x100a2d20 -void DeviceImpl::HandlePaint(HDC p_dc) +// FUNCTION: BETA10 0x1016e300 +void DeviceImpl::HandlePaint(void* p_data) { - IDirect3DRMWinDevice* winDevice; - if (SUCCEEDED(m_data->QueryInterface(IID_IDirect3DRMWinDevice, (LPVOID*) &winDevice))) { - winDevice->HandlePaint(p_dc); - winDevice->Release(); - } + assert(m_data); + + DeviceHandlePaint(m_data, p_data); +} + +// FUNCTION: BETA10 0x1016e460 +inline Result DeviceUpdate(IDirect3DRMDevice2* pDevice) +{ + return ResultVal(pDevice->Update()); } // FUNCTION: LEGO1 0x100a2d60 +// FUNCTION: BETA10 0x1016e400 Result DeviceImpl::Update() { - return ResultVal(m_data->Update()); + assert(m_data); + + return DeviceUpdate(m_data); } // GLOBAL: LEGO1 0x100dd1d0 +// GLOBAL: BETA10 0x101c30b0 // IID_IDirect3DRMWinDevice diff --git a/LEGO1/tgl/d3drm/impl.h b/LEGO1/tgl/d3drm/impl.h index d1e6ce2c..fe79e01b 100644 --- a/LEGO1/tgl/d3drm/impl.h +++ b/LEGO1/tgl/d3drm/impl.h @@ -183,7 +183,7 @@ class DeviceImpl : public Device { // vtable+0x20 Result Update() override; void HandleActivate(WORD) override; - void HandlePaint(HDC) override; + void HandlePaint(void*) override; typedef IDirect3DRMDevice2* DeviceDataType; diff --git a/LEGO1/tgl/tgl.h b/LEGO1/tgl/tgl.h index c519cf05..3d27881e 100644 --- a/LEGO1/tgl/tgl.h +++ b/LEGO1/tgl/tgl.h @@ -186,7 +186,7 @@ class Device : public Object { // vtable+0x20 virtual Result Update() = 0; virtual void HandleActivate(WORD) = 0; - virtual void HandlePaint(HDC) = 0; + virtual void HandlePaint(void*) = 0; // SYNTHETIC: BETA10 0x1016b740 // Tgl::Device::Device From f7744f555028f00cce713110bd29fd30a6b6a5ae Mon Sep 17 00:00:00 2001 From: jonschz <17198703+jonschz@users.noreply.github.com> Date: Mon, 26 May 2025 07:25:47 +0200 Subject: [PATCH 4/8] Fix ambiguous matches in BETA10 (#1520) * Fix ambiguous matches in BETA10 * Add more functions, fix one LINE annotation * Fix LEGO1 matches --------- Co-authored-by: jonschz --- .../lego/legoomni/include/legopathboundary.h | 6 ++--- LEGO1/mxdirectx/mxdirectxinfo.h | 26 +++++++++++-------- LEGO1/omni/include/mxatom.h | 8 ++++-- LEGO1/omni/include/mxparam.h | 2 +- LEGO1/omni/include/mxpresenterlist.h | 2 +- LEGO1/omni/include/mxstreamer.h | 2 +- LEGO1/omni/src/video/flic.cpp | 2 +- LEGO1/viewmanager/viewlodlist.h | 6 +++-- 8 files changed, 32 insertions(+), 22 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legopathboundary.h b/LEGO1/lego/legoomni/include/legopathboundary.h index 7a34b9b6..522122a4 100644 --- a/LEGO1/lego/legoomni/include/legopathboundary.h +++ b/LEGO1/lego/legoomni/include/legopathboundary.h @@ -182,7 +182,7 @@ class LegoPathBoundary : public LegoWEGEdge { // _Tree >::_Kfn,LegoPathActorSetCompare,allocator >::lower_bound // TEMPLATE: BETA10 0x10082b90 -// _Tree >::_Kfn,LegoAnimPresenterSetCompare,allocator >::const_iterator::operator++ +// ??Econst_iterator@?$_Tree@PAVLegoAnimPresenter@@PAV1@U_Kfn@?$set@PAVLegoAnimPresenter@@ULegoAnimPresenterSetCompare@@V?$allocator@PAVLegoAnimPresenter@@@@@@ULegoAnimPresenterSetCompare@@V?$allocator@PAVLegoAnimPresenter@@@@@@QAE?AV01@H@Z // TEMPLATE: BETA10 0x10082ee0 // set >::end @@ -191,13 +191,13 @@ class LegoPathBoundary : public LegoWEGEdge { // _Tree >::_Kfn,LegoAnimPresenterSetCompare,allocator >::const_iterator::operator* // TEMPLATE: BETA10 0x10021dc0 -// Set::Set +// ??0?$Set@PAVLegoPathActor@@ULegoPathActorSetCompare@@@@QAE@ABV0@@Z // TEMPLATE: BETA10 0x100202d0 // set >::begin // TEMPLATE: BETA10 0x10020030 -// _Tree >::_Kfn,LegoPathActorSetCompare,allocator >::const_iterator::operator++ +// ??Econst_iterator@?$_Tree@PAVLegoPathActor@@PAV1@U_Kfn@?$set@PAVLegoPathActor@@ULegoPathActorSetCompare@@V?$allocator@PAVLegoPathActor@@@@@@ULegoPathActorSetCompare@@V?$allocator@PAVLegoPathActor@@@@@@QAE?AV01@H@Z // TEMPLATE: BETA10 0x100203d0 // set >::end diff --git a/LEGO1/mxdirectx/mxdirectxinfo.h b/LEGO1/mxdirectx/mxdirectxinfo.h index ba6b1f00..3fbecfc8 100644 --- a/LEGO1/mxdirectx/mxdirectxinfo.h +++ b/LEGO1/mxdirectx/mxdirectxinfo.h @@ -168,12 +168,12 @@ struct MxDriver { // TEMPLATE: CONFIG 0x401b00 // TEMPLATE: LEGO1 0x1009c400 // TEMPLATE: BETA10 0x1011fad0 -// list >::insert +// ?insert@?$list@UDirect3DDeviceInfo@@V?$allocator@UDirect3DDeviceInfo@@@@@@QAE?AViterator@1@V21@ABUDirect3DDeviceInfo@@@Z // TEMPLATE: CONFIG 0x401b60 // TEMPLATE: LEGO1 0x1009c460 // TEMPLATE: BETA10 0x1011f9a0 -// list >::insert +// ?insert@?$list@UMxDisplayMode@@V?$allocator@UMxDisplayMode@@@@@@QAE?AViterator@1@V21@ABUMxDisplayMode@@@Z // SYNTHETIC: CONFIG 0x402be0 // SYNTHETIC: LEGO1 0x1009d450 @@ -248,34 +248,38 @@ class MxDeviceEnumerate { // list >::iterator::operator* // TEMPLATE: BETA10 0x1011c200 -// list >::iterator::operator++ +// ??Eiterator@?$list@UDirect3DDeviceInfo@@V?$allocator@UDirect3DDeviceInfo@@@@@@QAE?AV01@H@Z // TEMPLATE: BETA10 0x1011c290 -// list >::begin +// ?begin@?$list@UDirect3DDeviceInfo@@V?$allocator@UDirect3DDeviceInfo@@@@@@QAE?AViterator@1@XZ +// Note: could also be +// ?begin@?$list@UDirect3DDeviceInfo@@V?$allocator@UDirect3DDeviceInfo@@@@@@QBE?AVconst_iterator@1@XZ // TEMPLATE: BETA10 0x1011c300 -// list >::end +// ?end@?$list@UDirect3DDeviceInfo@@V?$allocator@UDirect3DDeviceInfo@@@@@@QAE?AViterator@1@XZ +// Note: could also be +// ?end@?$list@UDirect3DDeviceInfo@@V?$allocator@UDirect3DDeviceInfo@@@@@@QBE?AVconst_iterator@1@XZ // TEMPLATE: BETA10 0x1011c4d0 // list >::iterator::operator* // TEMPLATE: BETA10 0x1011c520 -// list >::iterator::operator++ +// ??Eiterator@?$list@UMxDriver@@V?$allocator@UMxDriver@@@@@@QAE?AV01@H@Z // TEMPLATE: BETA10 0x1011c560 -// list >::iterator::operator++ +// ??Eiterator@?$list@UMxDriver@@V?$allocator@UMxDriver@@@@@@QAEAAV01@XZ // TEMPLATE: BETA10 0x1011c590 // list >::_Acc::_Next // TEMPLATE: BETA10 0x1011c5b0 -// list >::begin +// ?begin@?$list@UMxDriver@@V?$allocator@UMxDriver@@@@@@QAE?AViterator@1@XZ // TEMPLATE: BETA10 0x1011c5f0 // list >::iterator::iterator // TEMPLATE: BETA10 0x1011c620 -// list >::end +// ?end@?$list@UMxDriver@@V?$allocator@UMxDriver@@@@@@QAE?AViterator@1@XZ // TEMPLATE: BETA10 0x1011c690 // ??9@YAHABViterator@?$list@UMxDriver@@V?$allocator@UMxDriver@@@@@@0@Z @@ -290,10 +294,10 @@ class MxDeviceEnumerate { // list >::size // TEMPLATE: BETA10 0x1011d3e0 -// list >::erase +// ?erase@?$list@UDirect3DDeviceInfo@@V?$allocator@UDirect3DDeviceInfo@@@@@@QAE?AViterator@1@V21@@Z // TEMPLATE: BETA10 0x1011d570 -// list >::erase +// ?erase@?$list@UMxDriver@@V?$allocator@UMxDriver@@@@@@QAE?AViterator@1@V21@@Z // TEMPLATE: BETA10 0x1011d6a0 // list >::_Freenode diff --git a/LEGO1/omni/include/mxatom.h b/LEGO1/omni/include/mxatom.h index 44d467e3..06da0e84 100644 --- a/LEGO1/omni/include/mxatom.h +++ b/LEGO1/omni/include/mxatom.h @@ -143,8 +143,10 @@ class MxAtomId { // clang-format off // TEMPLATE: LEGO1 0x100af7e0 +// ?erase@?$_Tree@PAVMxAtom@@PAV1@U_Kfn@?$set@PAVMxAtom@@UMxAtomCompare@@V?$allocator@PAVMxAtom@@@@@@UMxAtomCompare@@V?$allocator@PAVMxAtom@@@@@@QAE?AViterator@1@V21@@Z + // TEMPLATE: BETA10 0x10131210 -// _Tree >::_Kfn,MxAtomCompare,allocator >::erase +// ?erase@?$_Tree@PAVMxAtom@@PAV1@U_Kfn@?$set@PAVMxAtom@@UMxAtomCompare@@V?$allocator@PAVMxAtom@@@@@@UMxAtomCompare@@V?$allocator@PAVMxAtom@@@@@@QAE?AViterator@1@V21@0@Z // clang-format on // clang-format off @@ -178,7 +180,9 @@ class MxAtomId { // clang-format off // TEMPLATE: BETA10 0x10132170 -// _Tree >::_Kfn,MxAtomCompare,allocator >::begin +// ?begin@?$_Tree@PAVMxAtom@@PAV1@U_Kfn@?$set@PAVMxAtom@@UMxAtomCompare@@V?$allocator@PAVMxAtom@@@@@@UMxAtomCompare@@V?$allocator@PAVMxAtom@@@@@@QAE?AViterator@1@XZ +// Note: could also be +// ?begin@?$_Tree@PAVMxAtom@@PAV1@U_Kfn@?$set@PAVMxAtom@@UMxAtomCompare@@V?$allocator@PAVMxAtom@@@@@@UMxAtomCompare@@V?$allocator@PAVMxAtom@@@@@@QBE?AVconst_iterator@1@XZ // clang-format on // TEMPLATE: BETA10 0x101321d0 diff --git a/LEGO1/omni/include/mxparam.h b/LEGO1/omni/include/mxparam.h index 57df088e..75ab4eac 100644 --- a/LEGO1/omni/include/mxparam.h +++ b/LEGO1/omni/include/mxparam.h @@ -14,7 +14,7 @@ class MxParam { }; // SYNTHETIC: BETA10 0x10013710 -// MxParam::MxParam +// ??0MxParam@@QAE@XZ // SYNTHETIC: ISLE 0x401540 // SYNTHETIC: LEGO1 0x10010370 diff --git a/LEGO1/omni/include/mxpresenterlist.h b/LEGO1/omni/include/mxpresenterlist.h index f5f658ac..0e8bd316 100644 --- a/LEGO1/omni/include/mxpresenterlist.h +++ b/LEGO1/omni/include/mxpresenterlist.h @@ -107,6 +107,6 @@ class MxPresenterListCursor : public MxPtrListCursor { // MxListCursor::MxListCursor // TEMPLATE: BETA10 0x100d9420 -// MxListCursor::Prev +// ?Prev@?$MxListCursor@PAVMxPresenter@@@@QAEEAAPAVMxPresenter@@@Z #endif // MXPRESENTERLIST_H diff --git a/LEGO1/omni/include/mxstreamer.h b/LEGO1/omni/include/mxstreamer.h index 208f3ce1..1b5a7082 100644 --- a/LEGO1/omni/include/mxstreamer.h +++ b/LEGO1/omni/include/mxstreamer.h @@ -134,7 +134,7 @@ class MxStreamer : public MxCore { // list >::end // TEMPLATE: BETA10 0x101461b0 -// list >::iterator::operator++ +// ??Eiterator@?$list@PAVMxStreamController@@V?$allocator@PAVMxStreamController@@@@@@QAE?AV01@H@Z // SYNTHETIC: LEGO1 0x100b9120 // SYNTHETIC: BETA10 0x101466e0 diff --git a/LEGO1/omni/src/video/flic.cpp b/LEGO1/omni/src/video/flic.cpp index c040b83f..afdebebc 100644 --- a/LEGO1/omni/src/video/flic.cpp +++ b/LEGO1/omni/src/video/flic.cpp @@ -364,10 +364,10 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat // LINE: BETA10 0x1013e643 short xmax = xofs + width - 1; - // LINE: BETA10 0x1013e652 union { BYTE* byte; WORD* word; + // LINE: BETA10 0x1013e652 } data = {p_data}; // The first word in the data following the chunk header contains the number of lines in the chunk. diff --git a/LEGO1/viewmanager/viewlodlist.h b/LEGO1/viewmanager/viewlodlist.h index 60847caf..b7e0f9d3 100644 --- a/LEGO1/viewmanager/viewlodlist.h +++ b/LEGO1/viewmanager/viewlodlist.h @@ -127,8 +127,10 @@ class ViewLODListManager { // _Tree,map >::_Kfn,ROINameComparator,allocator >::~_Tree,map,map >::_Kfn,ROINameComparator,allocator >::erase +// ?erase@?$_Tree@PBDU?$pair@QBDPAVViewLODList@@@@U_Kfn@?$map@PBDPAVViewLODList@@UROINameComparator@@V?$allocator@PAVViewLODList@@@@@@UROINameComparator@@V?$allocator@PAVViewLODList@@@@@@QAE?AViterator@1@V21@0@Z // TEMPLATE: LEGO1 0x100a7db0 // TEMPLATE: BETA10 0x1017aca0 @@ -156,7 +158,7 @@ class ViewLODListManager { // map >::begin // TEMPLATE: BETA10 0x10179070 -// map >::end +// ?end@?$map@PBDPAVViewLODList@@UROINameComparator@@V?$allocator@PAVViewLODList@@@@@@QAE?AViterator@?$_Tree@PBDU?$pair@QBDPAVViewLODList@@@@U_Kfn@?$map@PBDPAVViewLODList@@UROINameComparator@@V?$allocator@PAVViewLODList@@@@@@UROINameComparator@@V?$allocator@ // TEMPLATE: BETA10 0x10179250 // pair::pair From 04b669cf960f0a02d7ff3f8b56a52d4bb75eb14d Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 26 May 2025 09:45:06 -0700 Subject: [PATCH 5/8] Fix type cast in `MxControlPresenter::FUN_10044270` (#1522) --- LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp index 4b412940..0b397836 100644 --- a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp @@ -77,7 +77,7 @@ void MxControlPresenter::EndAction() MxBool MxControlPresenter::FUN_10044270(MxS32 p_x, MxS32 p_y, MxPresenter* p_presenter) { assert(p_presenter); - MxStillPresenter* presenter = (MxStillPresenter*) p_presenter; + MxVideoPresenter* presenter = (MxVideoPresenter*) p_presenter; if (m_unk0x4c == 3) { MxStillPresenter* map = (MxStillPresenter*) m_list.front(); From b28fcae00580b3e5f0d6a8165b2f465aec763929 Mon Sep 17 00:00:00 2001 From: MS Date: Mon, 26 May 2025 12:46:22 -0400 Subject: [PATCH 6/8] Match `TextureImpl` functions (#1521) * TextureImpl functions * TglD3DRMIMAGE functions --- LEGO1/tgl/d3drm/impl.h | 9 +- LEGO1/tgl/d3drm/texture.cpp | 204 ++++++++++++++++++++++++++++-------- LEGO1/tgl/tgl.h | 4 +- 3 files changed, 169 insertions(+), 48 deletions(-) diff --git a/LEGO1/tgl/d3drm/impl.h b/LEGO1/tgl/d3drm/impl.h index fe79e01b..658ee1b2 100644 --- a/LEGO1/tgl/d3drm/impl.h +++ b/LEGO1/tgl/d3drm/impl.h @@ -612,7 +612,7 @@ class TglD3DRMIMAGE { int paletteSize, PaletteEntry* pEntries ); - ~TglD3DRMIMAGE() { Destroy(); } + ~TglD3DRMIMAGE(); Result CreateBuffer(int width, int height, int depth, void* pBuffer, int useBuffer); void Destroy(); @@ -621,6 +621,9 @@ class TglD3DRMIMAGE { D3DRMIMAGE m_image; int m_texelsAllocatedByClient; + + // SYNTHETIC: BETA10 0x1016abb0 + // TglImpl::TglD3DRMIMAGE::`scalar deleting destructor' }; // VTABLE: LEGO1 0x100dbb48 @@ -636,7 +639,7 @@ class TextureImpl : public Texture { void* ImplementationDataPtr() override; // vtable+0x08 - Result SetTexels(int width, int height, int bitsPerTexel, void* pTexels) override; + Result SetTexels(int width, int height, int bitsPerTexel, void* pTexels, int pTexelsArePersistent) override; void FillRowsOfTexture(int y, int height, void* pBuffer) override; // vtable+0x10 @@ -647,7 +650,7 @@ class TextureImpl : public Texture { int* pDepth, void** ppBuffer, int* ppPaletteSize, - PaletteEntry** ppPalette + unsigned char (*pEntries)[3] ) override; Result SetPalette(int entryCount, PaletteEntry* entries) override; diff --git a/LEGO1/tgl/d3drm/texture.cpp b/LEGO1/tgl/d3drm/texture.cpp index 5944d7ba..0a19c8c4 100644 --- a/LEGO1/tgl/d3drm/texture.cpp +++ b/LEGO1/tgl/d3drm/texture.cpp @@ -1,9 +1,12 @@ #include "impl.h" +#include + using namespace TglImpl; DECOMP_SIZE_ASSERT(TglD3DRMIMAGE, 0x40); +// FUNCTION: BETA10 0x1016f9f0 inline TglD3DRMIMAGE* TextureGetImage(IDirect3DRMTexture* pTexture) { return reinterpret_cast(pTexture->GetAppData()); @@ -13,36 +16,47 @@ inline TglD3DRMIMAGE* TextureGetImage(IDirect3DRMTexture* pTexture) void TextureDestroyCallback(IDirect3DRMObject* pObject, void* pArg); // FUNCTION: LEGO1 0x100a12a0 +// FUNCTION: BETA10 0x10169113 Result TextureImpl::SetImage(IDirect3DRMTexture* pSelf, TglD3DRMIMAGE* pImage) { void* appData; Result result; appData = pImage; + assert(reinterpret_cast(appData) == pImage); - // This is here because in the original code they asserted - // on the return value being NULL. - TextureGetImage(pSelf); + if (TextureGetImage(pSelf)) { + assert(0); + } result = ResultVal(pSelf->SetAppData((LPD3DRM_APPDATA) appData)); + assert(Succeeded(result)); + if (Succeeded(result) && pImage) { result = ResultVal(pSelf->AddDestroyCallback(TextureDestroyCallback, NULL)); + assert(Succeeded(result)); + if (!Succeeded(result)) { pSelf->SetAppData(0); } } + return result; } // FUNCTION: LEGO1 0x100a1300 +// FUNCTION: BETA10 0x10169278 void TextureDestroyCallback(IDirect3DRMObject* pObject, void* pArg) { TglD3DRMIMAGE* pImage = reinterpret_cast(pObject->GetAppData()); + assert(pImage); + delete pImage; pObject->SetAppData(0); } // FUNCTION: LEGO1 0x100a1330 +// FUNCTION: BETA10 0x101692e1 TglD3DRMIMAGE::TglD3DRMIMAGE( int width, int height, @@ -53,10 +67,10 @@ TglD3DRMIMAGE::TglD3DRMIMAGE( PaletteEntry* pEntries ) { - m_image.aspectx = 1; - m_image.aspecty = 1; m_image.width = 0; m_image.height = 0; + m_image.aspectx = 1; + m_image.aspecty = 1; m_image.depth = 0; m_image.rgb = 0; m_image.bytes_per_line = 0; @@ -69,23 +83,31 @@ TglD3DRMIMAGE::TglD3DRMIMAGE( m_image.palette_size = 0; m_image.palette = NULL; m_texelsAllocatedByClient = 0; + + Result result; if (pBuffer != NULL) { - CreateBuffer(width, height, depth, pBuffer, useBuffer); + result = CreateBuffer(width, height, depth, pBuffer, useBuffer); + assert(Succeeded(result)); } + if (pEntries != NULL) { - InitializePalette(paletteSize, pEntries); + result = InitializePalette(paletteSize, pEntries); + assert(Succeeded(result)); } } // FUNCTION: LEGO1 0x100a13b0 -void TglD3DRMIMAGE::Destroy() +// FUNCTION: BETA10 0x1016944b +TglD3DRMIMAGE::~TglD3DRMIMAGE() { if (m_texelsAllocatedByClient == 0) { delete[] ((char*) m_image.buffer1); } + delete m_image.palette; } +// FUNCTION: BETA10 0x101699a0 inline static int IsPowerOfTwo(int v) { int m = 0; @@ -99,16 +121,25 @@ inline static int IsPowerOfTwo(int v) } // FUNCTION: LEGO1 0x100a13e0 +// FUNCTION: BETA10 0x101694a4 Result TglD3DRMIMAGE::CreateBuffer(int width, int height, int depth, void* pBuffer, int useBuffer) { - if (!(IsPowerOfTwo(width) && IsPowerOfTwo(height) && width % 4 == 0)) { + int bytesPerScanline = width; + + assert(IsPowerOfTwo(width)); + assert(IsPowerOfTwo(height)); + assert((bytesPerScanline % 4) == 0); + + if (!(IsPowerOfTwo(width) && IsPowerOfTwo(height) && bytesPerScanline % 4 == 0)) { return Error; } + assert(!m_image.buffer1 || (m_image.buffer1 == pBuffer)); + m_image.width = width; m_image.height = height; m_image.depth = depth; - m_image.bytes_per_line = width; + m_image.bytes_per_line = bytesPerScanline; if (!m_texelsAllocatedByClient) { delete[] ((char*) m_image.buffer1); @@ -116,12 +147,13 @@ Result TglD3DRMIMAGE::CreateBuffer(int width, int height, int depth, void* pBuff } if (useBuffer) { - m_texelsAllocatedByClient = 1; m_image.buffer1 = (char*) pBuffer; + m_texelsAllocatedByClient = 1; } else { - m_image.buffer1 = new char[width * height]; - memcpy(m_image.buffer1, pBuffer, width * height); + int size = bytesPerScanline * height; + m_image.buffer1 = new char[size]; + memcpy(m_image.buffer1, pBuffer, size); m_texelsAllocatedByClient = 0; } @@ -129,14 +161,20 @@ Result TglD3DRMIMAGE::CreateBuffer(int width, int height, int depth, void* pBuff } // FUNCTION: LEGO1 0x100a1510 -Result TglD3DRMIMAGE::FillRowsOfTexture(int y, int height, char* pContent) +// FUNCTION: BETA10 0x1016969c +Result TglD3DRMIMAGE::FillRowsOfTexture(int destVOffset, int srcHeight, char* pTexels) { - // The purpose is clearly this but I can't get the assembly to line up. - memcpy((char*) m_image.buffer1 + (y * m_image.bytes_per_line), pContent, height * m_image.bytes_per_line); + assert(m_image.buffer1 && pTexels); + assert((destVOffset + srcHeight) <= m_image.height); + + int size = srcHeight * m_image.bytes_per_line; + char* pSrc = (char*) m_image.buffer1 + (destVOffset * m_image.bytes_per_line); + memcpy(pSrc, pTexels, size); return Success; } // FUNCTION: LEGO1 0x100a1550 +// FUNCTION: BETA10 0x10169758 Result TglD3DRMIMAGE::InitializePalette(int paletteSize, PaletteEntry* pEntries) { // This function is a 100% match if the PaletteEntry class is copied @@ -152,6 +190,7 @@ Result TglD3DRMIMAGE::InitializePalette(int paletteSize, PaletteEntry* pEntries) m_image.palette_size = paletteSize; } } + if (paletteSize > 0) { for (int i = 0; i < paletteSize; i++) { m_image.palette[i].red = pEntries[i].m_red; @@ -160,67 +199,146 @@ Result TglD3DRMIMAGE::InitializePalette(int paletteSize, PaletteEntry* pEntries) m_image.palette[i].flags = D3DRMPALETTE_READONLY; } } + return Success; } -// FUNCTION: LEGO1 0x100a3c10 -Result TextureImpl::SetTexels(int width, int height, int bitsPerTexel, void* pTexels) +// FUNCTION: BETA10 0x1016ee80 +inline Result TextureSetTexels( + IDirect3DRMTexture* pTexture, + int width, + int height, + int bitsPerTexel, + void* pTexels, + int pTexelsArePersistent +) { - TglD3DRMIMAGE* image = TextureGetImage(m_data); - Result result = image->CreateBuffer(width, height, bitsPerTexel, pTexels, TRUE); + TglD3DRMIMAGE* pImage = TextureGetImage(pTexture); + assert(pImage); + + Result result = pImage->CreateBuffer(width, height, bitsPerTexel, pTexels, pTexelsArePersistent); + assert(Succeeded(result)); + if (Succeeded(result)) { - result = ResultVal(m_data->Changed(TRUE, FALSE)); + result = ResultVal(pTexture->Changed(TRUE, FALSE)); + assert(Succeeded(result)); } + + return result; +} + +// FUNCTION: LEGO1 0x100a3c10 +// FUNCTION: BETA10 0x1016c390 +Result TextureImpl::SetTexels(int width, int height, int bitsPerTexel, void* pTexels, int pTexelsArePersistent) +{ + assert(m_data); + + return TextureSetTexels(m_data, width, height, bitsPerTexel, pTexels, pTexelsArePersistent); +} + +// FUNCTION: BETA10 0x1016f160 +inline Result TextureFillRowsOfTexture(IDirect3DRMTexture* pTexture, int y, int height, void* pBuffer) +{ + TglD3DRMIMAGE* pImage = TextureGetImage(pTexture); + assert(pImage); + + Result result = pImage->FillRowsOfTexture(y, height, (char*) pBuffer); + assert(Succeeded(result)); + return result; } // FUNCTION: LEGO1 0x100a3c60 +// FUNCTION: BETA10 0x1016c490 void TextureImpl::FillRowsOfTexture(int y, int height, void* pBuffer) { - TglD3DRMIMAGE* image = TextureGetImage(m_data); - image->FillRowsOfTexture(y, height, (char*) pBuffer); + assert(m_data); + + TextureFillRowsOfTexture(m_data, y, height, pBuffer); +} + +// FUNCTION: BETA10 0x1016f270 +inline Result TextureChanged(IDirect3DRMTexture* pTexture, int texelsChanged, int paletteChanged) +{ + Result result = ResultVal(pTexture->Changed(texelsChanged, paletteChanged)); + assert(Succeeded(result)); + return result; } // FUNCTION: LEGO1 0x100a3c90 +// FUNCTION: BETA10 0x1016c540 Result TextureImpl::Changed(int texelsChanged, int paletteChanged) { - return ResultVal(m_data->Changed(texelsChanged, paletteChanged)); + assert(m_data); + + return TextureChanged(m_data, texelsChanged, paletteChanged); +} + +// FUNCTION: BETA10 0x1016f4c0 +inline Result TextureGetBufferAndPalette( + IDirect3DRMTexture* pTexture, + int* width, + int* height, + int* depth, + void** pBuffer, + int* paletteSize, + unsigned char (*pEntries)[3] +) +{ + TglD3DRMIMAGE* pImage = TextureGetImage(pTexture); + assert(pImage); + + *width = pImage->m_image.width; + *height = pImage->m_image.height; + *depth = pImage->m_image.depth; + *pBuffer = pImage->m_image.buffer1; + *paletteSize = pImage->m_image.palette_size; + + for (int i = 0; i < *paletteSize; i++) { + pEntries[i][0] = pImage->m_image.palette[i].red; + pEntries[i][1] = pImage->m_image.palette[i].green; + pEntries[i][2] = pImage->m_image.palette[i].blue; + } + + return Success; } // FUNCTION: LEGO1 0x100a3cc0 +// FUNCTION: BETA10 0x1016c5d0 Result TextureImpl::GetBufferAndPalette( int* width, int* height, int* depth, void** pBuffer, int* paletteSize, - PaletteEntry** pEntries + unsigned char (*pEntries)[3] ) { - // Something really doesn't match here, not sure what's up. - TglD3DRMIMAGE* image = TextureGetImage(m_data); - *width = image->m_image.width; - *height = image->m_image.height; - *depth = image->m_image.depth; - *pBuffer = image->m_image.buffer1; - *paletteSize = image->m_image.palette_size; - for (int i = 0; i < image->m_image.palette_size; i++) { - pEntries[i]->m_red = image->m_image.palette[i].red; - pEntries[i]->m_green = image->m_image.palette[i].green; - pEntries[i]->m_blue = image->m_image.palette[i].blue; - } + assert(m_data); + + return TextureGetBufferAndPalette(m_data, width, height, depth, pBuffer, paletteSize, pEntries); +} + +// FUNCTION: BETA10 0x1016f730 +inline Result TextureSetPalette(IDirect3DRMTexture* pTexture, int entryCount, PaletteEntry* pEntries) +{ + TglD3DRMIMAGE* pImage = TextureGetImage(pTexture); + assert(pImage); + + pImage->InitializePalette(entryCount, pEntries); + Result result = ResultVal(pTexture->Changed(FALSE, TRUE)); + assert(Succeeded(result)); + return Success; } // FUNCTION: LEGO1 0x100a3d40 +// FUNCTION: BETA10 0x1016c6a0 Result TextureImpl::SetPalette(int entryCount, PaletteEntry* pEntries) { - // Not 100% confident this is supposed to directly be forwarding arguments, - // but it probably is given FillRowsOfTexture matches doing that. - TglD3DRMIMAGE* image = TextureGetImage(m_data); - image->InitializePalette(entryCount, pEntries); - m_data->Changed(FALSE, TRUE); - return Success; + assert(m_data); + + return TextureSetPalette(m_data, entryCount, pEntries); } // FUNCTION: LEGO1 0x100a3d70 diff --git a/LEGO1/tgl/tgl.h b/LEGO1/tgl/tgl.h index 3d27881e..cd3fccae 100644 --- a/LEGO1/tgl/tgl.h +++ b/LEGO1/tgl/tgl.h @@ -400,7 +400,7 @@ class MeshBuilder : public Object { class Texture : public Object { public: // vtable+0x08 - virtual Result SetTexels(int width, int height, int bitsPerTexel, void* pTexels) = 0; + virtual Result SetTexels(int width, int height, int bitsPerTexel, void* pTexels, int pTexelsArePersistent) = 0; virtual void FillRowsOfTexture(int y, int height, void* pBuffer) = 0; // vtable+0x10 @@ -411,7 +411,7 @@ class Texture : public Object { int* pDepth, void** ppBuffer, int* pPaletteSize, - PaletteEntry** ppPalette + unsigned char (*pEntries)[3] ) = 0; virtual Result SetPalette(int entryCount, PaletteEntry* pEntries) = 0; From 5fc3bfb9211ab81f5d164fd4fa635903d5cb7e47 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 26 May 2025 09:52:18 -0700 Subject: [PATCH 7/8] Change to unsigned int --- LEGO1/tgl/d3drm/device.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LEGO1/tgl/d3drm/device.cpp b/LEGO1/tgl/d3drm/device.cpp index 1cf9b853..d846a01d 100644 --- a/LEGO1/tgl/d3drm/device.cpp +++ b/LEGO1/tgl/d3drm/device.cpp @@ -17,7 +17,7 @@ void* DeviceImpl::ImplementationDataPtr() } // FUNCTION: BETA10 0x1016dea0 -inline unsigned long DeviceGetWidth(IDirect3DRMDevice2* pDevice) +inline unsigned int DeviceGetWidth(IDirect3DRMDevice2* pDevice) { return pDevice->GetWidth(); } @@ -32,7 +32,7 @@ unsigned int DeviceImpl::GetWidth() } // FUNCTION: BETA10 0x1016df20 -inline unsigned long DeviceGetHeight(IDirect3DRMDevice2* pDevice) +inline unsigned int DeviceGetHeight(IDirect3DRMDevice2* pDevice) { return pDevice->GetHeight(); } @@ -78,7 +78,7 @@ Result DeviceImpl::SetShadingModel(ShadingModel model) } // FUNCTION: BETA10 0x1016e140 -inline Result DeviceSetShadeCount(IDirect3DRMDevice2* pDevice, unsigned long shadeCount) +inline Result DeviceSetShadeCount(IDirect3DRMDevice2* pDevice, unsigned int shadeCount) { return ResultVal(pDevice->SetShades(shadeCount)); } From 3973f84a183f8705de8f13024232bb2e6425e969 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 26 May 2025 09:52:55 -0700 Subject: [PATCH 8/8] Fix PCH --- LEGO1/lego1_pch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LEGO1/lego1_pch.h b/LEGO1/lego1_pch.h index e9c429a6..624a4be3 100644 --- a/LEGO1/lego1_pch.h +++ b/LEGO1/lego1_pch.h @@ -161,7 +161,7 @@ #include "lego/sources/3dmanager/tglsurface.h" #include "lego/sources/anim/legoanim.h" #include "lego/sources/geom/legoedge.h" -#include "lego/sources/geom/legounkown100db7f4.h" +#include "lego/sources/geom/legoorientededge.h" #include "lego/sources/geom/legoweedge.h" #include "lego/sources/geom/legowegedge.h" #include "lego/sources/misc/legocontainer.h"