From adb26e2707102850f540393a8f0e827a0dbf864b Mon Sep 17 00:00:00 2001 From: LJW-Dev <48092720+LJW-Dev@users.noreply.github.com> Date: Sun, 19 Apr 2026 11:30:47 +0800 Subject: [PATCH] fix: slight update to lightgrid after new info found --- .../Game/T6/BSP/Linker/GfxWorldLinker.cpp | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.cpp b/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.cpp index 259a61b7..b948f684 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.cpp +++ b/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.cpp @@ -416,17 +416,18 @@ namespace BSP void GfxWorldLinker::loadLightGrid(GfxWorld* gfxWorld) { - // the values in this code were chosen based on what looked correct when reverse engineering. - - // mins and maxs define the range that the lightgrid will work in. - // unknown how these values are calculated, but the below values are larger - // than official map values - gfxWorld->lightGrid.mins[0] = 0; - gfxWorld->lightGrid.mins[1] = 0; - gfxWorld->lightGrid.mins[2] = 0; - gfxWorld->lightGrid.maxs[0] = 200; - gfxWorld->lightGrid.maxs[1] = 200; - gfxWorld->lightGrid.maxs[2] = 50; + // gfxWorld->lightGrid.mins[0] = static_cast((static_cast(gfxWorld->lightGrid.mins[0]) + 0x20000) >> 5); + // gfxWorld->lightGrid.mins[1] = static_cast((static_cast(gfxWorld->lightGrid.mins[1]) + 0x20000) >> 5); + // gfxWorld->lightGrid.mins[2] = static_cast((static_cast(gfxWorld->lightGrid.mins[2]) + 0x20000) >> 6); + // gfxWorld->lightGrid.maxs[0] = static_cast((static_cast(gfxWorld->lightGrid.maxs[0]) + 0x20000) >> 5); + // gfxWorld->lightGrid.maxs[1] = static_cast((static_cast(gfxWorld->lightGrid.maxs[1]) + 0x20000) >> 5); + // gfxWorld->lightGrid.maxs[2] = static_cast((static_cast(gfxWorld->lightGrid.maxs[2]) + 0x20000) >> 6); + gfxWorld->lightGrid.mins[0] = 100; + gfxWorld->lightGrid.mins[1] = 100; + gfxWorld->lightGrid.mins[2] = 100; + gfxWorld->lightGrid.maxs[0] = 65435; + gfxWorld->lightGrid.maxs[1] = 65435; + gfxWorld->lightGrid.maxs[2] = 65435; gfxWorld->lightGrid.rowAxis = 0; // default value gfxWorld->lightGrid.colAxis = 1; // default value @@ -446,7 +447,7 @@ namespace BSP row->zCount = 0xFF; // 0xFF as this is large enough for all checks done by the game, but small enough not to mess with other checks row->firstEntry = 0; for (int i = 0; i < 0x10; i++) // set the lookup table to all 0 - row->lookupTable[i] = 0; + row->lookupTable[i] = -1; gfxWorld->lightGrid.rawRowData = reinterpret_cast(row); // entries are looked up based on the lightgrid sample pos (given ingame) and the lightgrid lookup table