2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-06-06 08:42:35 +00:00

fix: slight update to lightgrid after new info found

This commit is contained in:
LJW-Dev
2026-04-19 11:30:47 +08:00
committed by Jan Laupetin
parent 1d109d5e35
commit adb26e2707
@@ -416,17 +416,18 @@ namespace BSP
void GfxWorldLinker::loadLightGrid(GfxWorld* gfxWorld) void GfxWorldLinker::loadLightGrid(GfxWorld* gfxWorld)
{ {
// the values in this code were chosen based on what looked correct when reverse engineering. // gfxWorld->lightGrid.mins[0] = static_cast<uint16_t>((static_cast<int>(gfxWorld->lightGrid.mins[0]) + 0x20000) >> 5);
// gfxWorld->lightGrid.mins[1] = static_cast<uint16_t>((static_cast<int>(gfxWorld->lightGrid.mins[1]) + 0x20000) >> 5);
// mins and maxs define the range that the lightgrid will work in. // gfxWorld->lightGrid.mins[2] = static_cast<uint16_t>((static_cast<int>(gfxWorld->lightGrid.mins[2]) + 0x20000) >> 6);
// unknown how these values are calculated, but the below values are larger // gfxWorld->lightGrid.maxs[0] = static_cast<uint16_t>((static_cast<int>(gfxWorld->lightGrid.maxs[0]) + 0x20000) >> 5);
// than official map values // gfxWorld->lightGrid.maxs[1] = static_cast<uint16_t>((static_cast<int>(gfxWorld->lightGrid.maxs[1]) + 0x20000) >> 5);
gfxWorld->lightGrid.mins[0] = 0; // gfxWorld->lightGrid.maxs[2] = static_cast<uint16_t>((static_cast<int>(gfxWorld->lightGrid.maxs[2]) + 0x20000) >> 6);
gfxWorld->lightGrid.mins[1] = 0; gfxWorld->lightGrid.mins[0] = 100;
gfxWorld->lightGrid.mins[2] = 0; gfxWorld->lightGrid.mins[1] = 100;
gfxWorld->lightGrid.maxs[0] = 200; gfxWorld->lightGrid.mins[2] = 100;
gfxWorld->lightGrid.maxs[1] = 200; gfxWorld->lightGrid.maxs[0] = 65435;
gfxWorld->lightGrid.maxs[2] = 50; gfxWorld->lightGrid.maxs[1] = 65435;
gfxWorld->lightGrid.maxs[2] = 65435;
gfxWorld->lightGrid.rowAxis = 0; // default value gfxWorld->lightGrid.rowAxis = 0; // default value
gfxWorld->lightGrid.colAxis = 1; // 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->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; row->firstEntry = 0;
for (int i = 0; i < 0x10; i++) // set the lookup table to all 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<aligned_byte_pointer*>(row); gfxWorld->lightGrid.rawRowData = reinterpret_cast<aligned_byte_pointer*>(row);
// entries are looked up based on the lightgrid sample pos (given ingame) and the lightgrid lookup table // entries are looked up based on the lightgrid sample pos (given ingame) and the lightgrid lookup table