BGSHeadPart * TESNPC::GetHeadPartOverlayByType(UInt32 type) { UInt32 numOverlays = GetNumActorBaseOverlays(this); BGSHeadPart ** overlays = GetActorBaseOverlays(this); if(overlays) { for(UInt32 i = 0; i < numOverlays; i++) { if(overlays[i]->type == type) { return overlays[i]; } } } return NULL; }
std::pair<BGSTextureSet*, BGSHeadPart*> GetTextureSetForPartByName(TESNPC * npc, BSFixedString partName) { UInt32 numHeadParts = 0; BGSHeadPart ** headParts = NULL; if (CALL_MEMBER_FN(npc, HasOverlays)()) { numHeadParts = GetNumActorBaseOverlays(npc); headParts = GetActorBaseOverlays(npc); } else { numHeadParts = npc->numHeadParts; headParts = npc->headparts; } for (UInt32 i = 0; i < numHeadParts; i++) // Acquire all parts { BGSHeadPart * headPart = headParts[i]; if (headPart && headPart->partName == partName) { BGSTextureSet * textureSet = nullptr; textureSet = GetTextureSetForPart(npc, headPart); return std::make_pair(textureSet, headPart); } } return std::make_pair<BGSTextureSet*, BGSHeadPart*>(NULL, NULL); }