Fix humanoid NPC textures using baked NPC textures from DBC

Load CreatureDisplayInfoExtra.dbc to get baked texture names for humanoid
NPCs. Apply textures from Textures\BakedNpcTextures\ to type-1 texture
slots. Also spawn player model in online mode and set active character
GUID for both single-player and online modes.
This commit is contained in:
Kelsi 2026-02-05 22:47:21 -08:00
parent 9b62acd72d
commit 7fd5708f1f
2 changed files with 176 additions and 10 deletions

View file

@ -125,7 +125,23 @@ private:
uint32_t cloakTextureSlotIndex_ = 0;
// Online creature model spawning
std::unordered_map<uint32_t, uint32_t> displayToModelId_; // displayId → modelId (from CreatureDisplayInfo.dbc)
struct CreatureDisplayData {
uint32_t modelId = 0;
std::string skin1, skin2, skin3; // Texture names from CreatureDisplayInfo.dbc
uint32_t extraDisplayId = 0; // Link to CreatureDisplayInfoExtra.dbc
};
struct HumanoidDisplayExtra {
uint8_t raceId = 0;
uint8_t sexId = 0;
uint8_t skinId = 0;
uint8_t faceId = 0;
uint8_t hairStyleId = 0;
uint8_t hairColorId = 0;
uint8_t facialHairId = 0;
std::string bakeName; // Pre-baked texture path if available
};
std::unordered_map<uint32_t, CreatureDisplayData> displayDataMap_; // displayId → display data
std::unordered_map<uint32_t, HumanoidDisplayExtra> humanoidExtraMap_; // extraDisplayId → humanoid data
std::unordered_map<uint32_t, std::string> modelIdToPath_; // modelId → M2 path (from CreatureModelData.dbc)
std::unordered_map<uint64_t, uint32_t> creatureInstances_; // guid → render instanceId
std::unordered_map<uint64_t, uint32_t> creatureModelIds_; // guid → loaded modelId