mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-24 16:10:14 +00:00
Fix M2 texture loading, /unstuckgy, and WMO floor detection
- Add mutex to AssetManager::loadTexture/loadDBC/fileExists to prevent StormLib thread-safety races that silently fail texture reads; stop caching texture load failures so transient errors are retried. - Replace /unstuckgy DBC lookup (which used wrong coordinate transform) with hardcoded safe locations per map. - Widen WMO floor raycast from single grid cell to ±1 unit range query to catch bridge/walkway triangles at cell boundaries. - Tighten swept collision hit threshold (0.5 → 0.15) and grid query margin (2.5 → 1.5) to prevent false-positive wall pushes. - Tighten post-wall-push Z snap lower bound (-1.0 → -0.3) to prevent gradual floor sinking.
This commit is contained in:
parent
387cc5ddf4
commit
046d4615ea
5 changed files with 43 additions and 48 deletions
|
|
@ -54,8 +54,12 @@ BLPImage AssetManager::loadTexture(const std::string& path) {
|
|||
|
||||
LOG_DEBUG("Loading texture: ", normalizedPath);
|
||||
|
||||
// Read BLP file from MPQ
|
||||
std::vector<uint8_t> blpData = mpqManager.readFile(normalizedPath);
|
||||
// Read BLP file from MPQ (must hold readMutex — StormLib is not thread-safe)
|
||||
std::vector<uint8_t> blpData;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(readMutex);
|
||||
blpData = mpqManager.readFile(normalizedPath);
|
||||
}
|
||||
if (blpData.empty()) {
|
||||
LOG_WARNING("Texture not found: ", normalizedPath);
|
||||
return BLPImage();
|
||||
|
|
@ -90,8 +94,12 @@ std::shared_ptr<DBCFile> AssetManager::loadDBC(const std::string& name) {
|
|||
// Construct DBC path (DBFilesClient directory)
|
||||
std::string dbcPath = "DBFilesClient\\" + name;
|
||||
|
||||
// Read DBC file from MPQ
|
||||
std::vector<uint8_t> dbcData = mpqManager.readFile(dbcPath);
|
||||
// Read DBC file from MPQ (must hold readMutex — StormLib is not thread-safe)
|
||||
std::vector<uint8_t> dbcData;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(readMutex);
|
||||
dbcData = mpqManager.readFile(dbcPath);
|
||||
}
|
||||
if (dbcData.empty()) {
|
||||
LOG_WARNING("DBC not found: ", dbcPath);
|
||||
return nullptr;
|
||||
|
|
@ -124,6 +132,7 @@ bool AssetManager::fileExists(const std::string& path) const {
|
|||
return false;
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lock(readMutex);
|
||||
return mpqManager.fileExists(normalizePath(path));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue