From a4a4264fc0b24ce966b54c4e76497d3992d9840e Mon Sep 17 00:00:00 2001 From: louist103 <35883445+louist103@users.noreply.github.com> Date: Thu, 1 Feb 2024 09:55:12 -0500 Subject: [PATCH] Implement CKeyframe importer and exporter (#121) --- OTRExporter | 2 +- ZAPDTR | 2 +- libultraship | 2 +- mm/2s2h/BenPort.cpp | 14 ++ mm/2s2h/BenPort.h | 3 + mm/2s2h/resource/importer/KeyFrameFactory.cpp | 147 ++++++++++++++++++ mm/2s2h/resource/importer/KeyFrameFactory.h | 29 ++++ mm/2s2h/resource/type/KeyFrame.cpp | 33 ++++ mm/2s2h/resource/type/KeyFrame.h | 87 +++++++++++ mm/assets/xml/objects/gameplay_keep.xml | 21 ++- mm/assets/xml/objects/object_fall2.xml | 7 +- mm/assets/xml/objects/object_moonend.xml | 12 +- mm/assets/xml/objects/object_syoten.xml | 8 +- mm/src/code/c_keyframe.c | 67 ++++++-- .../actors/ovl_Demo_Moonend/z_demo_moonend.c | 8 +- .../actors/ovl_Demo_Syoten/z_demo_syoten.c | 4 +- .../actors/ovl_Eff_Change/z_eff_change.c | 5 +- .../overlays/actors/ovl_En_Fall2/z_en_fall2.c | 5 +- .../overlays/actors/ovl_En_Test/z_en_test.c | 6 +- .../overlays/actors/ovl_En_Test7/z_en_test7.c | 4 +- 20 files changed, 411 insertions(+), 55 deletions(-) create mode 100644 mm/2s2h/resource/importer/KeyFrameFactory.cpp create mode 100644 mm/2s2h/resource/importer/KeyFrameFactory.h create mode 100644 mm/2s2h/resource/type/KeyFrame.cpp create mode 100644 mm/2s2h/resource/type/KeyFrame.h diff --git a/OTRExporter b/OTRExporter index 3c57213d5..5c2ecd562 160000 --- a/OTRExporter +++ b/OTRExporter @@ -1 +1 @@ -Subproject commit 3c57213d5bf677e45aa15a9ba3662d1fccbccb01 +Subproject commit 5c2ecd562dad2f68e2ab6a2819c4cfb104ae0c7a diff --git a/ZAPDTR b/ZAPDTR index 1ac9c36e8..01ed7e87f 160000 --- a/ZAPDTR +++ b/ZAPDTR @@ -1 +1 @@ -Subproject commit 1ac9c36e84faa2baaf2b4c2ec4b5085290e923ee +Subproject commit 01ed7e87f2b4b8145d8b0af8c8d8912b86f4b908 diff --git a/libultraship b/libultraship index fb324454d..0091d738c 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit fb324454d98d9bb3331255225186aec903ace406 +Subproject commit 0091d738c5f2c183c02a30419b98c5b0a1be3109 diff --git a/mm/2s2h/BenPort.cpp b/mm/2s2h/BenPort.cpp index be1503f5b..b951c89ee 100644 --- a/mm/2s2h/BenPort.cpp +++ b/mm/2s2h/BenPort.cpp @@ -85,6 +85,7 @@ CrowdControl* CrowdControl::Instance; #include "2s2h/resource/importer/TextMMFactory.h" #include "2s2h/resource/importer/BackgroundFactory.h" #include "2s2h/resource/importer/TextureAnimationFactory.h" +#include "2s2h/resource/importer/KeyFrameFactory.h" OTRGlobals* OTRGlobals::Instance; GameInteractor* GameInteractor::Instance; @@ -159,6 +160,10 @@ OTRGlobals::OTRGlobals() { LUS::ResourceType::SOH_Background, "Background", std::make_shared()); context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory( LUS::ResourceType::TSH_TexAnim, "TextureAnimation", std::make_shared()); + context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory( + LUS::ResourceType::TSH_CKeyFrameAnim, "KeyFrameAnim", std::make_shared()); + context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory( + LUS::ResourceType::TSH_CKeyFrameSkel, "KeyFrameSkel", std::make_shared()); context->GetControlDeck()->SetSinglePlayerMappingMode(true); @@ -998,6 +1003,15 @@ extern "C" Vtx* ResourceMgr_LoadVtxByName(char* path) { return (Vtx*)ResourceGetDataByName(path); } +extern "C" KeyFrameSkeleton* ResourceMgr_LoadKeyFrameSkelByName(const char* path) { + return (KeyFrameSkeleton*)ResourceGetDataByName(path); +} + +extern "C" KeyFrameAnimation* ResourceMgr_LoadKeyFrameAnimByName(const char* path) { + return (KeyFrameAnimation*)ResourceGetDataByName(path); +} + + //extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path) { // SequenceData* sequence = (SequenceData*)ResourceGetDataByName(path); // return *sequence; diff --git a/mm/2s2h/BenPort.h b/mm/2s2h/BenPort.h index f580dae25..b0ec50e64 100644 --- a/mm/2s2h/BenPort.h +++ b/mm/2s2h/BenPort.h @@ -93,6 +93,9 @@ char* ResourceMgr_LoadVtxArrayByName(const char* path); size_t ResourceMgr_GetVtxArraySizeByName(const char* path); Vtx* ResourceMgr_LoadVtxByName(char* path); +KeyFrameSkeleton* ResourceMgr_LoadKeyFrameSkelByName(const char* path); +KeyFrameAnimation* ResourceMgr_LoadKeyFrameAnimByName(const char* path); + void Ctx_ReadSaveFile(uintptr_t addr, void* dramAddr, size_t size); void Ctx_WriteSaveFile(uintptr_t addr, void* dramAddr, size_t size); diff --git a/mm/2s2h/resource/importer/KeyFrameFactory.cpp b/mm/2s2h/resource/importer/KeyFrameFactory.cpp new file mode 100644 index 000000000..36166c91e --- /dev/null +++ b/mm/2s2h/resource/importer/KeyFrameFactory.cpp @@ -0,0 +1,147 @@ +#include "2s2h/resource/importer/KeyFrameFactory.h" +#include "2s2h/resource/type/KeyFrame.h" +#include +#include "spdlog/spdlog.h" +#include "../ZAPDTR/ZAPD/ZCKeyFrame.h" + +namespace LUS { + + + +std::shared_ptr KeyFrameSkelFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto resource = std::make_shared(initData); + std::shared_ptr factory = nullptr; + + switch (resource->GetInitData()->ResourceVersion) { + case 0: + factory = std::make_shared(); + break; + } + + if (factory == nullptr) { + SPDLOG_ERROR("Failed to load Key Frame skel with version {}", resource->GetInitData()->ResourceVersion); + } + + factory->ParseFileBinary(reader, resource); + + return resource; +} + +void KeyFrameSkelFactoryV0::ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) { + std::shared_ptr skel = std::static_pointer_cast(resource); + ZKeyframeSkelType skelType; + + ResourceVersionFactory::ParseFileBinary(reader, skel); + skel->skelData.limbCount = reader->ReadUByte(); + skel->skelData.dListCount = reader->ReadUByte(); + skelType = (ZKeyframeSkelType)reader->ReadUByte(); + uint8_t numLimbs = reader->ReadUByte(); + + if (skelType == ZKeyframeSkelType::Normal) { + KeyFrameStandardLimb* limbs = new KeyFrameStandardLimb[numLimbs]; + + for (uint32_t i = 0; i < numLimbs; i++) { + std::string dlStr = reader->ReadString(); + auto dl = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(dlStr.c_str()); + limbs[i].dList = nullptr; + if (dl != nullptr) { + limbs[i].dList = dl->GetRawPointer(); + } + limbs[i].numChildren = reader->ReadUByte(); + limbs[i].flags = reader->ReadUByte(); + limbs[i].translation.x = reader->ReadInt16(); + limbs[i].translation.y = reader->ReadInt16(); + limbs[i].translation.z = reader->ReadInt16(); + } + skel->skelData.limbsStandard = limbs; + } else { + KeyFrameFlexLimb* limbs = new KeyFrameFlexLimb[numLimbs]; + + for (uint32_t i = 0; i < numLimbs; i++) { + std::string dlStr = reader->ReadString(); + auto dl = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(dlStr.c_str()); + limbs[i].dList = nullptr; + if (dl != nullptr) { + limbs[i].dList = dl->GetRawPointer(); + } + limbs[i].numChildren = reader->ReadUByte(); + limbs[i].flags = reader->ReadUByte(); + limbs[i].callbackIndex = reader->ReadUByte(); + } + skel->skelData.limbsFlex = limbs; + } +} + +std::shared_ptr KeyFrameAnimFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto resource = std::make_shared(initData); + std::shared_ptr factory = nullptr; + + switch (resource->GetInitData()->ResourceVersion) { + case 0: + factory = std::make_shared(); + break; + } + + if (factory == nullptr) { + SPDLOG_ERROR("Failed to load Key Frame skel with version {}", resource->GetInitData()->ResourceVersion); + } + + factory->ParseFileBinary(reader, resource); + + return resource; +} + +void KeyFrameAnimFactoryV0::ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) { + std::shared_ptr anim = std::static_pointer_cast(resource); + ZKeyframeSkelType skelType; + + ResourceVersionFactory::ParseFileBinary(reader, anim); + + skelType = (ZKeyframeSkelType)reader->ReadUByte(); + + uint32_t numBitFlags = reader->ReadUInt32(); + + if (skelType == ZKeyframeSkelType::Normal) { + anim->animData.bitFlags = new u8[numBitFlags]; + for (uint32_t i = 0; i < numBitFlags; i++) { + anim->animData.bitFlags[i] = reader->ReadUByte(); + } + } else { + anim->animData.bitFlagsFlex = new u16[numBitFlags]; + for (uint32_t i = 0; i < numBitFlags; i++) { + anim->animData.bitFlagsFlex[i] = reader->ReadUInt16(); + } + } + + uint32_t numKf = reader->ReadUInt32(); + anim->animData.keyFrames = new KeyFrame[numKf]; + + for (uint32_t i = 0; i < numKf; i++) { + anim->animData.keyFrames[i].frame = reader->ReadInt16(); + anim->animData.keyFrames[i].value = reader->ReadInt16(); + anim->animData.keyFrames[i].velocity = reader->ReadInt16(); + } + + uint32_t numKfNums = reader->ReadUInt32(); + anim->animData.kfNums = new s16[numKfNums]; + + for (uint32_t i = 0; i < numKfNums; i++) { + anim->animData.kfNums[i] = reader->ReadInt16(); + } + + uint32_t numPresetValues = reader->ReadUInt32(); + anim->animData.presetValues = new s16[numPresetValues]; + + for (uint32_t i = 0; i < numPresetValues; i++) { + anim->animData.presetValues[i] = reader->ReadInt16(); + } + + anim->animData.unk_10[0] = reader->ReadUByte(); + anim->animData.unk_10[0] = reader->ReadUByte(); + + anim->animData.duration = reader->ReadUInt16(); +} + +} // namespace LUS \ No newline at end of file diff --git a/mm/2s2h/resource/importer/KeyFrameFactory.h b/mm/2s2h/resource/importer/KeyFrameFactory.h new file mode 100644 index 000000000..476635f2a --- /dev/null +++ b/mm/2s2h/resource/importer/KeyFrameFactory.h @@ -0,0 +1,29 @@ +#pragma once + +#include "Resource.h" +#include "ResourceFactory.h" + +namespace LUS { +class KeyFrameSkelFactory : public ResourceFactory { + public: + std::shared_ptr ReadResource(std::shared_ptr initData, + std::shared_ptr reader) override; +}; + +class KeyFrameSkelFactoryV0 : public ResourceVersionFactory { + public: + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; +}; + +class KeyFrameAnimFactory : public ResourceFactory { + public: + std::shared_ptr ReadResource(std::shared_ptr initData, + std::shared_ptr reader) override; +}; + +class KeyFrameAnimFactoryV0 : public ResourceVersionFactory { + public: + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; +}; + +}; \ No newline at end of file diff --git a/mm/2s2h/resource/type/KeyFrame.cpp b/mm/2s2h/resource/type/KeyFrame.cpp new file mode 100644 index 000000000..6fc9bd567 --- /dev/null +++ b/mm/2s2h/resource/type/KeyFrame.cpp @@ -0,0 +1,33 @@ +#include "KeyFrame.h" + +namespace LUS { + +LUS::KeyFrameSkel::~KeyFrameSkel() { + delete[] skelData.limbsFlex; +} + +KeyFrameSkeletonData* KeyFrameSkel::GetPointer() { + return &skelData; +} + +size_t KeyFrameSkel::GetPointerSize() { + return sizeof(skelData); +} + + +LUS::KeyFrameAnim::~KeyFrameAnim() { + delete[] animData.bitFlags; + delete[] animData.keyFrames; + delete[] animData.kfNums; + delete[] animData.presetValues; +} + +KeyFrameAnimationData* LUS::KeyFrameAnim::GetPointer() { + return &animData; +} + +size_t KeyFrameAnim::GetPointerSize() { + return sizeof(animData); +} + +} \ No newline at end of file diff --git a/mm/2s2h/resource/type/KeyFrame.h b/mm/2s2h/resource/type/KeyFrame.h new file mode 100644 index 000000000..7e5d534f5 --- /dev/null +++ b/mm/2s2h/resource/type/KeyFrame.h @@ -0,0 +1,87 @@ +#pragma once + +#include "Resource.h" +#include + +namespace LUS { + +typedef struct Vec3s { + s16 x; + s16 y; + s16 z; +} Vec3s; + +// Keyframe limb? +typedef struct { + /* 0x00 */ void* dList; + /* 0x04 */ u8 numChildren; + /* 0x05 */ u8 flags; + /* 0x06 */ Vec3s translation; // FlexLimbs have translation data in their animations instead +} KeyFrameStandardLimb; // size = 0xC + +// Other limb type? +typedef struct { + /* 0x00 */ void* dList; + /* 0x04 */ u8 numChildren; + /* 0x05 */ u8 flags; + /* 0x06 */ u8 callbackIndex; // transform callback index +} KeyFrameFlexLimb; // size = 0x8 + +typedef struct { + /* 0x00 */ u8 limbCount; + /* 0x01 */ u8 dListCount; // non-zero in object files, number of non-null-dlist limbs? used to know how many + // matrices to alloc for drawing + /* 0x04 */ union { + KeyFrameStandardLimb* limbsStandard; + KeyFrameFlexLimb* limbsFlex; + }; +} KeyFrameSkeletonData; // Size = 0x8 + +typedef struct { + /* 0x00 */ s16 frame; + /* 0x02 */ s16 value; + /* 0x04 */ s16 velocity; +} KeyFrame; // Size = 0x6 + +typedef struct { + union { + /* 0x00 */ u8* bitFlags; // bitflags indicating whether to do keyframe interpolation or pull from preset values + /* 0x00 */ u16* + bitFlagsFlex; // bitflags indicating whether to do keyframe interpolation or pull from preset values + }; + /* 0x04 */ KeyFrame* keyFrames; // keyframes array + /* 0x08 */ s16* kfNums; // number of keyframes for each limb + /* 0x0C */ s16* presetValues; // preset rotation (standard) or scale/rotation/translation (flex) values + /* 0x0C */ char unk_10[0x2]; + /* 0x12 */ s16 duration; +} KeyFrameAnimationData; // Size = 0x14 + +class KeyFrameSkel : public Resource { + public: + using Resource::Resource; + + KeyFrameSkel() : Resource(std::shared_ptr()) { + } + ~KeyFrameSkel(); + + KeyFrameSkeletonData* GetPointer(); + size_t GetPointerSize(); + + KeyFrameSkeletonData skelData; +}; + +class KeyFrameAnim : public Resource { + public: + using Resource::Resource; + + KeyFrameAnim() : Resource(std::shared_ptr()) { + } + ~KeyFrameAnim(); + + KeyFrameAnimationData* GetPointer(); + size_t GetPointerSize(); + + KeyFrameAnimationData animData; +}; + +} // namespace LUS \ No newline at end of file diff --git a/mm/assets/xml/objects/gameplay_keep.xml b/mm/assets/xml/objects/gameplay_keep.xml index 321933839..5f4c43b58 100644 --- a/mm/assets/xml/objects/gameplay_keep.xml +++ b/mm/assets/xml/objects/gameplay_keep.xml @@ -970,15 +970,13 @@ - - + - - + @@ -1334,8 +1332,7 @@ - - + @@ -1345,8 +1342,9 @@ - - + + + @@ -1451,8 +1449,7 @@ - - + @@ -1484,8 +1481,8 @@ - - + + diff --git a/mm/assets/xml/objects/object_fall2.xml b/mm/assets/xml/objects/object_fall2.xml index 12299ab74..c6e4483a8 100644 --- a/mm/assets/xml/objects/object_fall2.xml +++ b/mm/assets/xml/objects/object_fall2.xml @@ -11,8 +11,10 @@ - - + + + + @@ -29,6 +31,5 @@ - diff --git a/mm/assets/xml/objects/object_moonend.xml b/mm/assets/xml/objects/object_moonend.xml index c23659dce..de643308b 100644 --- a/mm/assets/xml/objects/object_moonend.xml +++ b/mm/assets/xml/objects/object_moonend.xml @@ -1,8 +1,8 @@  - - - + + @@ -22,8 +22,10 @@ - - + + + diff --git a/mm/assets/xml/objects/object_syoten.xml b/mm/assets/xml/objects/object_syoten.xml index 95563b989..eefe0d7b6 100644 --- a/mm/assets/xml/objects/object_syoten.xml +++ b/mm/assets/xml/objects/object_syoten.xml @@ -1,8 +1,6 @@  - - - + @@ -15,9 +13,7 @@ - - - + diff --git a/mm/src/code/c_keyframe.c b/mm/src/code/c_keyframe.c index f84a7d6e2..d37b28a9b 100644 --- a/mm/src/code/c_keyframe.c +++ b/mm/src/code/c_keyframe.c @@ -1,4 +1,5 @@ #include "global.h" +#include "BenPort.h" #define FMOD(x, mod) ((x) - ((s32)((x) * (1.0f / (mod))) * (f32)(mod))) @@ -124,8 +125,18 @@ void Keyframe_InitFlex(KFSkelAnimeFlex* kfSkelAnime, KeyFrameSkeleton* skeleton, Vec3s* jointTable, Vec3s* morphTable, UnkKeyframeCallback* callbacks) { Keyframe_ResetFlex(kfSkelAnime); FrameCtrl_Init(&kfSkelAnime->frameCtrl); - kfSkelAnime->skeleton = (KeyFrameSkeleton*)Lib_SegmentedToVirtual(skeleton); - kfSkelAnime->animation = (KeyFrameAnimation*)Lib_SegmentedToVirtual(animation); + KeyFrameSkeleton* skel = skeleton; + KeyFrameAnimation* anim = animation; + + if (ResourceMgr_OTRSigCheck(skel)) { + skel = (KeyFrameSkeleton*)ResourceMgr_LoadKeyFrameSkelByName(skeleton); + } + if (ResourceMgr_OTRSigCheck(anim)) { + anim = (KeyFrameSkeleton*)ResourceMgr_LoadKeyFrameSkelByName(animation); + } + + kfSkelAnime->skeleton = skel; + kfSkelAnime->animation = anim; kfSkelAnime->jointTable = jointTable; kfSkelAnime->morphTable = morphTable; kfSkelAnime->callbacks = callbacks; @@ -178,17 +189,29 @@ void Keyframe_FlexChangeAnim(KFSkelAnimeFlex* kfSkelAnime, KeyFrameSkeleton* ske f32 startTime, f32 endTime, f32 t, f32 speed, f32 morphFrames, s32 animMode) { kfSkelAnime->morphFrames = morphFrames; - if (kfSkelAnime->skeleton != skeleton) { - kfSkelAnime->skeleton = (KeyFrameSkeleton*)Lib_SegmentedToVirtual(skeleton); + if (ResourceMgr_OTRSigCheck(skeleton)) { + skeleton = ResourceMgr_LoadKeyFrameSkelByName(skeleton); } - kfSkelAnime->animation = (KeyFrameAnimation*)Lib_SegmentedToVirtual(animation); + + if (kfSkelAnime->skeleton != skeleton) { + kfSkelAnime->skeleton = skeleton; + } + + if (ResourceMgr_OTRSigCheck(animation)) { + animation = ResourceMgr_LoadKeyFrameAnimByName(animation); + } + kfSkelAnime->animation = animation; FrameCtrl_SetProperties(&kfSkelAnime->frameCtrl, startTime, endTime, kfSkelAnime->animation->duration, t, speed, animMode); } void Keyframe_FlexChangeAnimQuick(KFSkelAnimeFlex* kfSkelAnime, KeyFrameAnimation* animation) { - kfSkelAnime->animation = (KeyFrameAnimation*)Lib_SegmentedToVirtual(animation); + if (ResourceMgr_OTRSigCheck(animation)) { + animation = ResourceMgr_LoadKeyFrameAnimByName(animation); + } + + kfSkelAnime->animation = animation; kfSkelAnime->frameCtrl.duration = kfSkelAnime->animation->duration; } @@ -538,8 +561,17 @@ void Keyframe_InitStandard(KFSkelAnime* kfSkelAnime, KeyFrameSkeleton* skeleton, Vec3s* jointTable, Vec3s* morphTable) { Keyframe_ResetStandard(kfSkelAnime); FrameCtrl_Init(&kfSkelAnime->frameCtrl); - kfSkelAnime->skeleton = (KeyFrameSkeleton*)Lib_SegmentedToVirtual(skeleton); - kfSkelAnime->animation = (KeyFrameAnimation*)Lib_SegmentedToVirtual(animation); + + if (ResourceMgr_OTRSigCheck(animation)) { + animation = ResourceMgr_LoadKeyFrameAnimByName(animation); + } + + if (ResourceMgr_OTRSigCheck(skeleton)) { + skeleton = ResourceMgr_LoadKeyFrameSkelByName(skeleton); + } + + kfSkelAnime->skeleton = skeleton; + kfSkelAnime->animation = animation; kfSkelAnime->jointTable = jointTable; kfSkelAnime->morphTable = morphTable; } @@ -595,8 +627,17 @@ void Keyframe_StandardChangeAnim(KFSkelAnime* kfSkelAnime, KeyFrameSkeleton* ske f32 startTime, f32 endTime, f32 t, f32 speed, f32 morphFrames, s32 animMode, Vec3s* rotOffsetsTable) { kfSkelAnime->morphFrames = morphFrames; - kfSkelAnime->skeleton = (KeyFrameSkeleton*)Lib_SegmentedToVirtual(skeleton); - kfSkelAnime->animation = (KeyFrameAnimation*)Lib_SegmentedToVirtual(animation); + + if (ResourceMgr_OTRSigCheck(animation)) { + animation = ResourceMgr_LoadKeyFrameAnimByName(animation); + } + + if (ResourceMgr_OTRSigCheck(skeleton)) { + skeleton = ResourceMgr_LoadKeyFrameSkelByName(skeleton); + } + + kfSkelAnime->skeleton = skeleton; + kfSkelAnime->animation = animation; FrameCtrl_SetProperties(&kfSkelAnime->frameCtrl, startTime, endTime, kfSkelAnime->animation->duration, t, speed, animMode); @@ -604,7 +645,11 @@ void Keyframe_StandardChangeAnim(KFSkelAnime* kfSkelAnime, KeyFrameSkeleton* ske } void Keyframe_StandardChangeAnimQuick(KFSkelAnime* kfSkelAnime, KeyFrameAnimation* animation) { - kfSkelAnime->animation = Lib_SegmentedToVirtual(animation); + if (ResourceMgr_OTRSigCheck(animation)) { + animation = ResourceMgr_LoadKeyFrameAnimByName(animation); + } + + kfSkelAnime->animation = animation; kfSkelAnime->frameCtrl.duration = kfSkelAnime->animation->duration; } diff --git a/mm/src/overlays/actors/ovl_Demo_Moonend/z_demo_moonend.c b/mm/src/overlays/actors/ovl_Demo_Moonend/z_demo_moonend.c index d00597419..79e779366 100644 --- a/mm/src/overlays/actors/ovl_Demo_Moonend/z_demo_moonend.c +++ b/mm/src/overlays/actors/ovl_Demo_Moonend/z_demo_moonend.c @@ -46,10 +46,10 @@ void DemoMoonend_Init(Actor* thisx, PlayState* play) { this->actionFunc = func_80C17B60; } else { Actor_SetScale(&this->actor, 0.095f); - Keyframe_InitFlex(&this->skeletonInfo, (void*)object_moonend_Blob_00B5A0, (void*)object_moonend_Blob_001214, + Keyframe_InitFlex(&this->skeletonInfo, gMoonendKFSkel_B5A0, gMoonendKFAnim_1214, this->jointTable, this->morphTable, NULL); - Keyframe_FlexPlayOnce(&this->skeletonInfo, (void*)object_moonend_Blob_001214); + Keyframe_FlexPlayOnce(&this->skeletonInfo, gMoonendKFAnim_1214); this->cueType = CS_CMD_ACTOR_CUE_560; this->actionFunc = func_80C17C48; this->actor.home.rot.z = 0; @@ -111,13 +111,13 @@ void func_80C17C48(DemoMoonend* this, PlayState* play) { switch (this->cueId) { case 1: this->actor.draw = DemoMoonend_Draw; - Keyframe_FlexPlayOnce(&this->skeletonInfo, (void*)object_moonend_Blob_001214); + Keyframe_FlexPlayOnce(&this->skeletonInfo, gMoonendKFAnim_1214); this->skeletonInfo.frameCtrl.speed = 0.0f; break; case 2: this->actor.draw = DemoMoonend_Draw; - Keyframe_FlexPlayOnce(&this->skeletonInfo, (void*)object_moonend_Blob_001214); + Keyframe_FlexPlayOnce(&this->skeletonInfo, gMoonendKFAnim_1214); this->skeletonInfo.frameCtrl.speed = 2.0f / 3.0f; Actor_PlaySfx(&this->actor, NA_SE_EV_MOON_EXPLOSION); this->actor.home.rot.z = 1; diff --git a/mm/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c b/mm/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c index 176be28f6..021a8174e 100644 --- a/mm/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c +++ b/mm/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c @@ -73,10 +73,10 @@ void DemoSyoten_Init(Actor* thisx, PlayState* play) { switch (DEMOSYOTEN_GET_F(&this->actor)) { case DEMOSYOTEN_F_0: - Keyframe_InitFlex(&this->unk_144, (void*)object_syoten_Blob_001328, (void*)object_syoten_Blob_00023C, + Keyframe_InitFlex(&this->unk_144, gSyotenKFSkel_1328, gSyotenKFAnim_023C, this->unk_174, this->unk_2A6, NULL); - Keyframe_FlexPlayLoop(&this->unk_144, (void*)object_syoten_Blob_00023C); + Keyframe_FlexPlayLoop(&this->unk_144, gSyotenKFAnim_023C); this->actor.draw = NULL; this->actionFunc = func_80C16A74; this->actor.child = diff --git a/mm/src/overlays/actors/ovl_Eff_Change/z_eff_change.c b/mm/src/overlays/actors/ovl_Eff_Change/z_eff_change.c index 9928a18ac..496dddea7 100644 --- a/mm/src/overlays/actors/ovl_Eff_Change/z_eff_change.c +++ b/mm/src/overlays/actors/ovl_Eff_Change/z_eff_change.c @@ -5,6 +5,7 @@ */ #include "z_eff_change.h" +#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_10) @@ -50,9 +51,9 @@ void EffChange_Init(Actor* thisx, PlayState* play) { EffChange_SetColors(this, EFFCHANGE_GET_COLORS(thisx)); Actor_SetScale(&this->actor, 0.075f); this->primColors[3] = 0; - Keyframe_InitFlex(&this->skeletonInfo, gameplay_keep_Blob_02900C, gameplay_keep_Blob_0281DC, this->jointTable, + Keyframe_InitFlex(&this->skeletonInfo, gGameplayKeepKFSkel_2900C, gGameplayKeepKFAnim_281DC, this->jointTable, this->morphTable, NULL); - Keyframe_FlexPlayOnce(&this->skeletonInfo, gameplay_keep_Blob_0281DC); + Keyframe_FlexPlayOnce(&this->skeletonInfo, gGameplayKeepKFAnim_281DC); this->step = 0; this->actor.shape.rot.y = 0; this->skeletonInfo.frameCtrl.speed = (2.0f / 3.0f); diff --git a/mm/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c b/mm/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c index 59390b3ad..db2f5df8e 100644 --- a/mm/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c +++ b/mm/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c @@ -5,6 +5,7 @@ */ #include "z_en_fall2.h" +#include "objects/object_fall2/object_fall2.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20) @@ -35,10 +36,10 @@ void EnFall2_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 1.0f); this->actionFunc = EnFall2_DoNothing; - Keyframe_InitFlex(&this->skeletonInfo, (void*)object_fall2_Blob_008898, (void*)object_fall2_Blob_005EF4, + Keyframe_InitFlex(&this->skeletonInfo, gFall2KFSkel_8898, gFall2FKAnim_5EF4, this->unk174, this->unk228, NULL); - Keyframe_FlexPlayLoop(&this->skeletonInfo, (void*)object_fall2_Blob_005EF4); + Keyframe_FlexPlayLoop(&this->skeletonInfo, (void*)gFall2FKAnim_5EF4); this->unk2DC = Lib_SegmentedToVirtual((void*)object_fall2_Matanimheader_008840); Actor_SetScale(&this->actor, 0.02f); this->actionFunc = EnFall2_HandleCutscene; diff --git a/mm/src/overlays/actors/ovl_En_Test/z_en_test.c b/mm/src/overlays/actors/ovl_En_Test/z_en_test.c index d49dbb4a5..cda1901c1 100644 --- a/mm/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/mm/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -186,17 +186,17 @@ void EnTest_Init(Actor* thisx, PlayState* play2) { this->surfaceMaterial = SurfaceType_GetMaterial(&play->colCtx, thisx->floorPoly, bgId); } - Keyframe_InitFlex(&this->skeletonInfo, (void*)gameplay_keep_Blob_06EB70, (void*)gameplay_keep_Blob_06BB0C, + Keyframe_InitFlex(&this->skeletonInfo, gGameplayKeepKFSkel_6EB70, gGameplayKeepKFAnim_6BB0C, this->unk_178, this->unk_1C0, NULL); - Keyframe_FlexPlayOnce(&this->skeletonInfo, (void*)gameplay_keep_Blob_06BB0C); + Keyframe_FlexPlayOnce(&this->skeletonInfo, gGameplayKeepKFAnim_6BB0C); this->skeletonInfo.frameCtrl.curTime = 9.0f; func_80862B70(this->unk_20C); } void EnTest_Destroy(Actor* thisx, PlayState* play) { EnTest* this = THIS; - + Keyframe_DestroyFlex(&this->skeletonInfo); } diff --git a/mm/src/overlays/actors/ovl_En_Test7/z_en_test7.c b/mm/src/overlays/actors/ovl_En_Test7/z_en_test7.c index 917bf6579..da43f0c83 100644 --- a/mm/src/overlays/actors/ovl_En_Test7/z_en_test7.c +++ b/mm/src/overlays/actors/ovl_En_Test7/z_en_test7.c @@ -397,9 +397,9 @@ void EnTest7_Init(Actor* thisx, PlayState* play2) { this->unk_1E90 = player->actor.scale.x; this->unk_1E94 = player->actor.scale.z; - Keyframe_InitFlex(&this->unk_18CC, &gameplay_keep_Blob_085640, &gameplay_keep_Blob_083534, this->unk_18FC, + Keyframe_InitFlex(&this->unk_18CC, gGameplayKeepKFSkel_85640, gGameplayKeepKFAnim_83534, this->unk_18FC, this->unk_1BA8, NULL); - Keyframe_FlexPlayOnce(&this->unk_18CC, &gameplay_keep_Blob_083534); + Keyframe_FlexPlayOnce(&this->unk_18CC, gGameplayKeepKFAnim_83534); func_80AF0838(this->unk_15C); func_80AF1730(&this->unk_148);