mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-05 04:33:51 +00:00
fix(dbc): runtime detection for ItemDisplayInfo texture field indices
Revert static JSON layout changes (15-22 back to 14-21) since WotLK loads the Classic 23-field DBC. Add getItemDisplayInfoTextureFields() helper that detects field count at runtime and adjusts the texture base index accordingly (14 for 23-field, 15 for 25-field).
This commit is contained in:
parent
3111fa50e8
commit
1379e74c40
6 changed files with 51 additions and 70 deletions
|
|
@ -119,14 +119,14 @@
|
|||
"InventoryIcon": 5,
|
||||
"LeftModel": 1,
|
||||
"LeftModelTexture": 3,
|
||||
"TextureArmLower": 16,
|
||||
"TextureArmUpper": 15,
|
||||
"TextureFoot": 22,
|
||||
"TextureHand": 17,
|
||||
"TextureLegLower": 21,
|
||||
"TextureLegUpper": 20,
|
||||
"TextureTorsoLower": 19,
|
||||
"TextureTorsoUpper": 18
|
||||
"TextureArmLower": 15,
|
||||
"TextureArmUpper": 14,
|
||||
"TextureFoot": 21,
|
||||
"TextureHand": 16,
|
||||
"TextureLegLower": 20,
|
||||
"TextureLegUpper": 19,
|
||||
"TextureTorsoLower": 18,
|
||||
"TextureTorsoUpper": 17
|
||||
},
|
||||
"ItemSet": {
|
||||
"ID": 0,
|
||||
|
|
|
|||
|
|
@ -131,14 +131,14 @@
|
|||
"InventoryIcon": 5,
|
||||
"LeftModel": 1,
|
||||
"LeftModelTexture": 3,
|
||||
"TextureArmLower": 16,
|
||||
"TextureArmUpper": 15,
|
||||
"TextureFoot": 22,
|
||||
"TextureHand": 17,
|
||||
"TextureLegLower": 21,
|
||||
"TextureLegUpper": 20,
|
||||
"TextureTorsoLower": 19,
|
||||
"TextureTorsoUpper": 18
|
||||
"TextureArmLower": 15,
|
||||
"TextureArmUpper": 14,
|
||||
"TextureFoot": 21,
|
||||
"TextureHand": 16,
|
||||
"TextureLegLower": 20,
|
||||
"TextureLegUpper": 19,
|
||||
"TextureTorsoLower": 18,
|
||||
"TextureTorsoUpper": 17
|
||||
},
|
||||
"ItemSet": {
|
||||
"ID": 0,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
#include "pipeline/dbc_layout.hpp"
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
|
|
@ -149,5 +151,28 @@ private:
|
|||
bool loadCSV(const std::vector<uint8_t>& csvData);
|
||||
};
|
||||
|
||||
/**
|
||||
* Build the 8-element texture region field index array for ItemDisplayInfo.dbc.
|
||||
* Classic/Turtle 23-field DBCs have textures at 14-21;
|
||||
* TBC/WotLK 25-field DBCs have textures at 15-22.
|
||||
* Detects automatically from the loaded DBC's field count.
|
||||
*/
|
||||
inline void getItemDisplayInfoTextureFields(const DBCFile& dbc,
|
||||
const DBCFieldMap* layout,
|
||||
uint32_t (&out)[8])
|
||||
{
|
||||
// 25-field DBCs (TBC/WotLK) shift textures +1 vs 23-field (Classic/Turtle)
|
||||
uint32_t base = (dbc.getFieldCount() >= 25) ? 15u : 14u;
|
||||
if (layout) {
|
||||
uint32_t idx = layout->field("TextureArmUpper");
|
||||
if (idx != 0xFFFFFFFF) {
|
||||
base = idx;
|
||||
// Correct JSON layouts written for 23-field when DBC is actually 25-field
|
||||
if (base == 14 && dbc.getFieldCount() >= 25) base = 15;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 8; i++) out[i] = base + static_cast<uint32_t>(i);
|
||||
}
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
|
|
|
|||
|
|
@ -1076,16 +1076,8 @@ void EntitySpawner::spawnOnlineCreature(uint64_t guid, uint32_t displayId, float
|
|||
};
|
||||
const auto* idiL = pipeline::getActiveDBCLayout()
|
||||
? pipeline::getActiveDBCLayout()->getLayout("ItemDisplayInfo") : nullptr;
|
||||
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,
|
||||
};
|
||||
uint32_t texRegionFields[8];
|
||||
pipeline::getItemDisplayInfoTextureFields(*idiDbc, idiL, texRegionFields);
|
||||
const bool npcIsFemale = (extraCopy.sexId == 1);
|
||||
const bool npcHasArmArmor = (extraCopy.equipDisplayId[7] != 0 || extraCopy.equipDisplayId[8] != 0);
|
||||
|
||||
|
|
@ -2949,18 +2941,8 @@ void EntitySpawner::setOnlinePlayerEquipment(uint64_t guid,
|
|||
"FootTexture",
|
||||
};
|
||||
|
||||
// Texture component region fields from DBC layout
|
||||
// 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,
|
||||
};
|
||||
uint32_t texRegionFields[8];
|
||||
pipeline::getItemDisplayInfoTextureFields(*displayInfoDbc, idiL, texRegionFields);
|
||||
|
||||
std::vector<std::pair<int, std::string>> regionLayers;
|
||||
const bool isFemale = (st.genderId == 1);
|
||||
|
|
@ -4038,16 +4020,8 @@ std::vector<std::string> EntitySpawner::resolveEquipmentTexturePaths(uint64_t gu
|
|||
"TorsoUpperTexture", "TorsoLowerTexture",
|
||||
"LegUpperTexture", "LegLowerTexture", "FootTexture",
|
||||
};
|
||||
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,
|
||||
};
|
||||
uint32_t texRegionFields[8];
|
||||
pipeline::getItemDisplayInfoTextureFields(*displayInfoDbc, idiL, texRegionFields);
|
||||
const bool isFemale = (st.genderId == 1);
|
||||
|
||||
for (int s = 0; s < 19; s++) {
|
||||
|
|
|
|||
|
|
@ -739,16 +739,8 @@ bool CharacterPreview::applyEquipment(const std::vector<game::EquipmentItem>& eq
|
|||
// Texture component region fields — use DBC layout when available, fall back to binary offsets.
|
||||
const auto* idiL = pipeline::getActiveDBCLayout()
|
||||
? pipeline::getActiveDBCLayout()->getLayout("ItemDisplayInfo") : nullptr;
|
||||
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,
|
||||
};
|
||||
uint32_t texRegionFields[8];
|
||||
pipeline::getItemDisplayInfoTextureFields(*displayInfoDbc, idiL, texRegionFields);
|
||||
|
||||
std::vector<std::pair<int, std::string>> regionLayers;
|
||||
regionLayers.reserve(32);
|
||||
|
|
|
|||
|
|
@ -3910,18 +3910,8 @@ void GameScreen::updateCharacterTextures(game::Inventory& inventory) {
|
|||
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,
|
||||
};
|
||||
uint32_t texRegionFields[8];
|
||||
pipeline::getItemDisplayInfoTextureFields(*displayInfoDbc, idiL, texRegionFields);
|
||||
|
||||
// Collect equipment texture regions from all equipped items
|
||||
std::vector<std::pair<int, std::string>> regionLayers;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue