TODO: use map structure instead byte peeking pattern: "build/animationsequence/%08d.bin"
| 712 | // TODO: use map structure instead byte peeking |
| 713 | // pattern: "build/animationsequence/%08d.bin" |
| 714 | void CFileManager::ProcessAnimSequeceData() // "AnimationSequence.uop" |
| 715 | { |
| 716 | TRACE(Data, "processing AnimationSequence data"); |
| 717 | for (const auto /*&[hash, block]*/ &kvp : m_AnimationSequence.m_MapByHash) |
| 718 | { |
| 719 | //const auto hash = kvp.first; |
| 720 | const auto block = kvp.second; |
| 721 | auto data = m_AnimationSequence.GetData(block); |
| 722 | SetData(reinterpret_cast<uint8_t *>(&data[0]), data.size()); |
| 723 | const auto entry = (UopAnimationSequence *)Ptr; |
| 724 | Move(sizeof(UopAnimationSequence)); |
| 725 | assert(entry->Unk1 == 0 && entry->Unk2 == 0); |
| 726 | assert(entry->Unk3 == 0 && entry->Unk4 == 0); |
| 727 | assert(entry->Unk5 == 0 && entry->Unk6 == 0); |
| 728 | |
| 729 | // FIXME |
| 730 | // amount of replaced indices, values seen in files so far: 29, 31, 32, 48, 68 |
| 731 | // human and gargoyle are complicated, skip for now |
| 732 | // offset 52 |
| 733 | if (entry->Replaces == 0x30 /*48*/ || entry->Replaces == 0x44 /*68*/) |
| 734 | { |
| 735 | // 0x30 0xc070396e5a7ec7f4 0x029A (666) // GENDER_MALE RT_GARGOYLE |
| 736 | // 0x30 0xc6c811fa536c8b62 0x04E5 (1253) // ? |
| 737 | // 0x44 0x6c1031f63255845a 0x0190 (400) // GENDER_MALE RT_HUMAN |
| 738 | continue; |
| 739 | } |
| 740 | assert(entry->Graphic < MAX_ANIMATIONS_DATA_INDEX_COUNT); |
| 741 | auto anim = &g_Index.m_Anim[entry->Graphic]; |
| 742 | const bool canPatch = (anim->Flags & AF_USE_UOP_ANIMATION) != 0; |
| 743 | for (uint32_t replaceIdx = 0; replaceIdx < entry->Replaces; ++replaceIdx) |
| 744 | { |
| 745 | const auto seq = (UopAnimationSequenceReplacement *)Ptr; |
| 746 | assert(seq->Group < MAX_ANIMATION_GROUPS_COUNT); |
| 747 | if (seq->FrameCount == 0) |
| 748 | { |
| 749 | if (canPatch) |
| 750 | { |
| 751 | assert(seq->NewGroup != seq->Group); |
| 752 | assert(seq->NewGroup < MAX_ANIMATION_GROUPS_COUNT); |
| 753 | anim->Groups[seq->Group] = anim->Groups[seq->NewGroup]; |
| 754 | // update replaced file blocks with replacement entries |
| 755 | auto file = uo_animation_group_get(GroupId(entry->Graphic, seq->NewGroup)); |
| 756 | g_Index.m_AnimationGroupFile.emplace(GroupId(entry->Graphic, seq->Group), file); |
| 757 | } |
| 758 | } |
| 759 | else |
| 760 | { |
| 761 | auto &group = anim->Groups[seq->Group]; |
| 762 | for (int k = replaceIdx; k < 5; ++k) |
| 763 | { |
| 764 | group.Direction[k].FrameCount = seq->FrameCount; |
| 765 | } |
| 766 | } |
| 767 | Move(sizeof(UopAnimationSequenceReplacement)); |
| 768 | } |
| 769 | switch (entry->Graphic) |
| 770 | { |
| 771 | case 0x042D: |