diff options
| author | Anghelo Carvajal <angheloalf95@gmail.com> | 2021-05-26 22:32:39 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-26 22:32:39 -0400 |
| commit | cd3e9527b185190c5f7826766bf2b4760bd12d5f (patch) | |
| tree | bb01e372abc6a72511130adcee1d5e27127a5f49 /ZAPD/ZSkeleton.cpp | |
| parent | 4410b554e835ab7844c8eb78fd54fa3842d50f16 (diff) | |
A few Limbs, Skel and CurveAnimation fixes (#144)
* Detect if a limb is pointing to the middle of a dlist
* Fix limbs names being ignored in some cases
* Check if pointing past the object's size
* Remove unnecesary pointers
* Don't try to extract the skel offset declared in a CurveAnimation
* Final cleanup
* Use GetDeclarationRanged
* Always set the rangeEnd to the filesize by default
* Revert "Always set the rangeEnd to the filesize by default"
This reverts commit f5c135c39a1df3f545c97c0a0becf7808115e06f.
Diffstat (limited to 'ZAPD/ZSkeleton.cpp')
| -rw-r--r-- | ZAPD/ZSkeleton.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/ZAPD/ZSkeleton.cpp b/ZAPD/ZSkeleton.cpp index cb2d2a9..dd5f8bd 100644 --- a/ZAPD/ZSkeleton.cpp +++ b/ZAPD/ZSkeleton.cpp @@ -116,10 +116,14 @@ void ZSkeleton::ExtractFromXML(tinyxml2::XMLElement* reader, const std::vector<u { uint32_t ptr2 = Seg2Filespace(BitConverter::ToUInt32BE(rawData, ptr), parent->baseAddress); - // ZLimb* limb = new ZLimb(reader, rawData, ptr2, parent); + std::string limbName = StringHelper::Sprintf("%sLimb_%06X", defaultPrefix.c_str(), ptr2); + Declaration* decl = parent->GetDeclaration(ptr2); + if (decl != nullptr) + limbName = decl->varName; + ZLimb* limb = new ZLimb(parent); limb->SetLimbType(limbType); - limb->SetName(StringHelper::Sprintf("%sLimb_%06X", defaultPrefix.c_str(), ptr2)); + limb->SetName(limbName); limb->ExtractFromXML(nullptr, rawData, ptr2); limbs.push_back(limb); @@ -194,11 +198,11 @@ std::string ZSkeleton::GetSourceOutputCode(const std::string& prefix) { case ZSkeletonType::Normal: case ZSkeletonType::Curve: - headerStr = StringHelper::Sprintf("%sLimbs, %i", defaultPrefix.c_str(), limbCount); + headerStr = StringHelper::Sprintf("\n\t%sLimbs, %i\n", defaultPrefix.c_str(), limbCount); break; case ZSkeletonType::Flex: - headerStr = - StringHelper::Sprintf("%sLimbs, %i, %i", defaultPrefix.c_str(), limbCount, dListCount); + headerStr = StringHelper::Sprintf("\n\t{ %sLimbs, %i }, %i\n", defaultPrefix.c_str(), + limbCount, dListCount); break; } |
