| 2362 | } |
| 2363 | |
| 2364 | void CFileManager::CreateBlockTable(int map, int width, int height) |
| 2365 | { |
| 2366 | MAP_INDEX_LIST &list = m_BlockData[map]; |
| 2367 | const int maxBlockCount = width * height; |
| 2368 | if (maxBlockCount < 1) |
| 2369 | { |
| 2370 | return; |
| 2371 | } |
| 2372 | |
| 2373 | list.resize(maxBlockCount); |
| 2374 | |
| 2375 | size_t mapAddress = (size_t)g_FileManager.m_MapMul[map].Start; |
| 2376 | size_t endMapAddress = mapAddress + g_FileManager.m_MapMul[map].Size; |
| 2377 | |
| 2378 | CUopMappedFile &uopFile = g_FileManager.m_MapUOP[map]; |
| 2379 | const bool isUop = (uopFile.Start != nullptr); |
| 2380 | if (isUop) |
| 2381 | { |
| 2382 | mapAddress = (size_t)uopFile.Start; |
| 2383 | endMapAddress = mapAddress + uopFile.Size; |
| 2384 | } |
| 2385 | |
| 2386 | size_t staticIdxAddress = (size_t)g_FileManager.m_StaticIdx[map].Start; |
| 2387 | size_t endStaticIdxAddress = staticIdxAddress + g_FileManager.m_StaticIdx[map].Size; |
| 2388 | size_t staticAddress = (size_t)g_FileManager.m_StaticMul[map].Start; |
| 2389 | size_t endStaticAddress = staticAddress + g_FileManager.m_StaticMul[map].Size; |
| 2390 | if ((mapAddress == 0u) || (staticIdxAddress == 0u) || (staticAddress == 0u)) |
| 2391 | { |
| 2392 | return; |
| 2393 | } |
| 2394 | |
| 2395 | int fileNumber = -1; |
| 2396 | size_t uopOffset = 0; |
| 2397 | for (int blockIdx = 0; blockIdx < maxBlockCount; blockIdx++) |
| 2398 | { |
| 2399 | CIndexMap &index = list[blockIdx]; |
| 2400 | size_t realMapAddress = 0; |
| 2401 | size_t realStaticAddress = 0; |
| 2402 | int realStaticCount = 0; |
| 2403 | int blockNumber = (int)blockIdx; |
| 2404 | if (isUop) |
| 2405 | { |
| 2406 | blockNumber &= 4095; |
| 2407 | int shifted = (int)blockIdx >> 12; |
| 2408 | if (fileNumber != shifted) |
| 2409 | { |
| 2410 | fileNumber = shifted; |
| 2411 | char mapFilePath[200]; |
| 2412 | snprintf( |
| 2413 | mapFilePath, |
| 2414 | sizeof(mapFilePath), |
| 2415 | "build/map%dlegacymul/%08d.dat", |
| 2416 | map, |
| 2417 | shifted); |
| 2418 | auto file = uopFile.GetAsset(mapFilePath); |
| 2419 | if (file != nullptr) |
| 2420 | { |
| 2421 | uopOffset = size_t(file->Offset + file->MetadataSize); |