mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Fix equipment textures: correct DBC field indices and stop texture cycling
Binary ItemDisplayInfo.dbc has 23 fields with texture components at 14-21, not 15-22. The previous "fix" shifted all fields by +1 which read wrong columns and broke both player and NPC equipment rendering. Also fix local player texture cycling: rebuildOnlineInventory() was called on every item query response (including for other players), unconditionally setting onlineEquipDirty_ which triggered redundant texture recompositing. Now tracks previous equipment displayInfoIds and only sets dirty when they actually change. Unified all 3 equipment texture code paths (local player, other players, NPCs) to use the DBC layout system with correct field 14 base index.
This commit is contained in:
parent
e0e927cac1
commit
8282583b9a
8 changed files with 57 additions and 35 deletions
|
|
@ -6,9 +6,9 @@
|
|||
"ItemDisplayInfo": {
|
||||
"ID": 0, "LeftModel": 1, "LeftModelTexture": 3,
|
||||
"InventoryIcon": 5, "GeosetGroup1": 7, "GeosetGroup3": 9,
|
||||
"TextureArmUpper": 15, "TextureArmLower": 16, "TextureHand": 17,
|
||||
"TextureTorsoUpper": 18, "TextureTorsoLower": 19,
|
||||
"TextureLegUpper": 20, "TextureLegLower": 21, "TextureFoot": 22
|
||||
"TextureArmUpper": 14, "TextureArmLower": 15, "TextureHand": 16,
|
||||
"TextureTorsoUpper": 17, "TextureTorsoLower": 18,
|
||||
"TextureLegUpper": 19, "TextureLegLower": 20, "TextureFoot": 21
|
||||
},
|
||||
"CharSections": {
|
||||
"RaceID": 1, "SexID": 2, "BaseSection": 3,
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@
|
|||
"ItemDisplayInfo": {
|
||||
"ID": 0, "LeftModel": 1, "LeftModelTexture": 3,
|
||||
"InventoryIcon": 5, "GeosetGroup1": 7, "GeosetGroup3": 9,
|
||||
"TextureArmUpper": 15, "TextureArmLower": 16, "TextureHand": 17,
|
||||
"TextureTorsoUpper": 18, "TextureTorsoLower": 19,
|
||||
"TextureLegUpper": 20, "TextureLegLower": 21, "TextureFoot": 22
|
||||
"TextureArmUpper": 14, "TextureArmLower": 15, "TextureHand": 16,
|
||||
"TextureTorsoUpper": 17, "TextureTorsoLower": 18,
|
||||
"TextureLegUpper": 19, "TextureLegLower": 20, "TextureFoot": 21
|
||||
},
|
||||
"CharSections": {
|
||||
"RaceID": 1, "SexID": 2, "BaseSection": 3,
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@
|
|||
"ItemDisplayInfo": {
|
||||
"ID": 0, "LeftModel": 1, "LeftModelTexture": 3,
|
||||
"InventoryIcon": 5, "GeosetGroup1": 7, "GeosetGroup3": 9,
|
||||
"TextureArmUpper": 15, "TextureArmLower": 16, "TextureHand": 17,
|
||||
"TextureTorsoUpper": 18, "TextureTorsoLower": 19,
|
||||
"TextureLegUpper": 20, "TextureLegLower": 21, "TextureFoot": 22
|
||||
"TextureArmUpper": 14, "TextureArmLower": 15, "TextureHand": 16,
|
||||
"TextureTorsoUpper": 17, "TextureTorsoLower": 18,
|
||||
"TextureLegUpper": 19, "TextureLegLower": 20, "TextureFoot": 21
|
||||
},
|
||||
"CharSections": {
|
||||
"RaceID": 1, "SexID": 2, "BaseSection": 3,
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@
|
|||
"ItemDisplayInfo": {
|
||||
"ID": 0, "LeftModel": 1, "LeftModelTexture": 3,
|
||||
"InventoryIcon": 5, "GeosetGroup1": 7, "GeosetGroup3": 9,
|
||||
"TextureArmUpper": 15, "TextureArmLower": 16, "TextureHand": 17,
|
||||
"TextureTorsoUpper": 18, "TextureTorsoLower": 19,
|
||||
"TextureLegUpper": 20, "TextureLegLower": 21, "TextureFoot": 22
|
||||
"TextureArmUpper": 14, "TextureArmLower": 15, "TextureHand": 16,
|
||||
"TextureTorsoUpper": 17, "TextureTorsoLower": 18,
|
||||
"TextureLegUpper": 19, "TextureLegLower": 20, "TextureFoot": 21
|
||||
},
|
||||
"CharSections": {
|
||||
"RaceID": 1, "SexID": 2, "BaseSection": 3,
|
||||
|
|
|
|||
|
|
@ -1134,6 +1134,7 @@ private:
|
|||
int packSlotBase_ = -1;
|
||||
std::map<uint16_t, uint32_t> lastPlayerFields_;
|
||||
bool onlineEquipDirty_ = false;
|
||||
std::array<uint32_t, 19> lastEquipDisplayIds_{};
|
||||
|
||||
// Visible equipment for other players: detect the update-field layout (base + stride)
|
||||
// using the local player's own equipped items, then decode other players by index.
|
||||
|
|
|
|||
|
|
@ -3130,16 +3130,16 @@ void Application::spawnOnlineCreature(uint64_t guid, uint32_t displayId, float x
|
|||
const auto* idiL = pipeline::getActiveDBCLayout()
|
||||
? pipeline::getActiveDBCLayout()->getLayout("ItemDisplayInfo") : nullptr;
|
||||
// Texture component region fields (8 regions: ArmUpper..Foot)
|
||||
// Fields 15-22 in WotLK ItemDisplayInfo.dbc (field 14 = HelmetGeosetVis[1])
|
||||
// Binary DBC (23 fields) has textures at 14+
|
||||
const uint32_t texRegionFields[8] = {
|
||||
idiL ? (*idiL)["TextureArmUpper"] : 15u,
|
||||
idiL ? (*idiL)["TextureArmLower"] : 16u,
|
||||
idiL ? (*idiL)["TextureHand"] : 17u,
|
||||
idiL ? (*idiL)["TextureTorsoUpper"]: 18u,
|
||||
idiL ? (*idiL)["TextureTorsoLower"]: 19u,
|
||||
idiL ? (*idiL)["TextureLegUpper"] : 20u,
|
||||
idiL ? (*idiL)["TextureLegLower"] : 21u,
|
||||
idiL ? (*idiL)["TextureFoot"] : 22u,
|
||||
idiL ? (*idiL)["TextureArmUpper"] : 14u,
|
||||
idiL ? (*idiL)["TextureArmLower"] : 15u,
|
||||
idiL ? (*idiL)["TextureHand"] : 16u,
|
||||
idiL ? (*idiL)["TextureTorsoUpper"]: 17u,
|
||||
idiL ? (*idiL)["TextureTorsoLower"]: 18u,
|
||||
idiL ? (*idiL)["TextureLegUpper"] : 19u,
|
||||
idiL ? (*idiL)["TextureLegLower"] : 20u,
|
||||
idiL ? (*idiL)["TextureFoot"] : 21u,
|
||||
};
|
||||
const bool npcIsFemale = (extra.sexId == 1);
|
||||
|
||||
|
|
@ -3970,16 +3970,16 @@ void Application::setOnlinePlayerEquipment(uint64_t guid,
|
|||
};
|
||||
|
||||
// Texture component region fields from DBC layout
|
||||
// Fields 15-22 in WotLK ItemDisplayInfo.dbc (field 14 = HelmetGeosetVis[1])
|
||||
// Binary DBC (23 fields) has textures at 14+
|
||||
const uint32_t texRegionFields[8] = {
|
||||
idiL ? (*idiL)["TextureArmUpper"] : 15u,
|
||||
idiL ? (*idiL)["TextureArmLower"] : 16u,
|
||||
idiL ? (*idiL)["TextureHand"] : 17u,
|
||||
idiL ? (*idiL)["TextureTorsoUpper"]: 18u,
|
||||
idiL ? (*idiL)["TextureTorsoLower"]: 19u,
|
||||
idiL ? (*idiL)["TextureLegUpper"] : 20u,
|
||||
idiL ? (*idiL)["TextureLegLower"] : 21u,
|
||||
idiL ? (*idiL)["TextureFoot"] : 22u,
|
||||
idiL ? (*idiL)["TextureArmUpper"] : 14u,
|
||||
idiL ? (*idiL)["TextureArmLower"] : 15u,
|
||||
idiL ? (*idiL)["TextureHand"] : 16u,
|
||||
idiL ? (*idiL)["TextureTorsoUpper"]: 17u,
|
||||
idiL ? (*idiL)["TextureTorsoLower"]: 18u,
|
||||
idiL ? (*idiL)["TextureLegUpper"] : 19u,
|
||||
idiL ? (*idiL)["TextureLegLower"] : 20u,
|
||||
idiL ? (*idiL)["TextureFoot"] : 21u,
|
||||
};
|
||||
|
||||
std::vector<std::pair<int, std::string>> regionLayers;
|
||||
|
|
|
|||
|
|
@ -5686,7 +5686,16 @@ void GameHandler::rebuildOnlineInventory() {
|
|||
}
|
||||
}
|
||||
|
||||
onlineEquipDirty_ = true;
|
||||
// Only mark equipment dirty if equipped item displayInfoIds actually changed
|
||||
std::array<uint32_t, 19> currentEquipDisplayIds{};
|
||||
for (int i = 0; i < 19; i++) {
|
||||
const auto& slot = inventory.getEquipSlot(static_cast<EquipSlot>(i));
|
||||
if (!slot.empty()) currentEquipDisplayIds[i] = slot.item.displayInfoId;
|
||||
}
|
||||
if (currentEquipDisplayIds != lastEquipDisplayIds_) {
|
||||
lastEquipDisplayIds_ = currentEquipDisplayIds;
|
||||
onlineEquipDirty_ = true;
|
||||
}
|
||||
|
||||
LOG_DEBUG("Rebuilt online inventory: equip=", [&](){
|
||||
int c = 0; for (auto g : equipSlotGuids_) if (g) c++; return c;
|
||||
|
|
|
|||
|
|
@ -2639,6 +2639,20 @@ void GameScreen::updateCharacterTextures(game::Inventory& inventory) {
|
|||
// Load ItemDisplayInfo.dbc
|
||||
auto displayInfoDbc = assetManager->loadDBC("ItemDisplayInfo.dbc");
|
||||
if (!displayInfoDbc) return;
|
||||
const auto* idiL = pipeline::getActiveDBCLayout()
|
||||
? pipeline::getActiveDBCLayout()->getLayout("ItemDisplayInfo") : nullptr;
|
||||
// Texture component region fields (8 regions: ArmUpper..Foot)
|
||||
// Binary DBC (23 fields) has textures at 14+
|
||||
const uint32_t texRegionFields[8] = {
|
||||
idiL ? (*idiL)["TextureArmUpper"] : 14u,
|
||||
idiL ? (*idiL)["TextureArmLower"] : 15u,
|
||||
idiL ? (*idiL)["TextureHand"] : 16u,
|
||||
idiL ? (*idiL)["TextureTorsoUpper"]: 17u,
|
||||
idiL ? (*idiL)["TextureTorsoLower"]: 18u,
|
||||
idiL ? (*idiL)["TextureLegUpper"] : 19u,
|
||||
idiL ? (*idiL)["TextureLegLower"] : 20u,
|
||||
idiL ? (*idiL)["TextureFoot"] : 21u,
|
||||
};
|
||||
|
||||
// Collect equipment texture regions from all equipped items
|
||||
std::vector<std::pair<int, std::string>> regionLayers;
|
||||
|
|
@ -2650,11 +2664,9 @@ void GameScreen::updateCharacterTextures(game::Inventory& inventory) {
|
|||
int32_t recIdx = displayInfoDbc->findRecordById(slot.item.displayInfoId);
|
||||
if (recIdx < 0) continue;
|
||||
|
||||
// DBC fields 14-21 = texture_1 through texture_8 (regions 0-7)
|
||||
// Binary DBC (23 fields) has textures at 14+; some CSVs (25 fields) have them at 15+.
|
||||
for (int region = 0; region < 8; region++) {
|
||||
uint32_t fieldIdx = 14 + region;
|
||||
std::string texName = displayInfoDbc->getString(static_cast<uint32_t>(recIdx), fieldIdx);
|
||||
std::string texName = displayInfoDbc->getString(
|
||||
static_cast<uint32_t>(recIdx), texRegionFields[region]);
|
||||
if (texName.empty()) continue;
|
||||
|
||||
// Actual MPQ files have a gender suffix: _M (male), _F (female), _U (unisex)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue