From 5133d29c01029d459d98a4f0802aac2c755ae20a Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Mon, 15 Jan 2024 21:09:26 +0000 Subject: [PATCH] Fix cycle animated textures (#57) --- OTRExporter | 2 +- ZAPDTR | 2 +- mm/2s2h/resource/importer/TextureAnimationFactory.cpp | 7 +++++-- mm/2s2h/resource/type/TextureAnimation.h | 1 + 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/OTRExporter b/OTRExporter index 1bf510355..3502a0b7c 160000 --- a/OTRExporter +++ b/OTRExporter @@ -1 +1 @@ -Subproject commit 1bf5103559090d4e2ad5be88f9177aac0ca91d71 +Subproject commit 3502a0b7c526651836e23068aa9c7e8f2ff82dfd diff --git a/ZAPDTR b/ZAPDTR index d77bf8826..aaf3714f2 160000 --- a/ZAPDTR +++ b/ZAPDTR @@ -1 +1 @@ -Subproject commit d77bf8826e6a2dfa2554e7b53aa1cc5a460d5e63 +Subproject commit aaf3714f239b80e86ad508b1a715506589624ef2 diff --git a/mm/2s2h/resource/importer/TextureAnimationFactory.cpp b/mm/2s2h/resource/importer/TextureAnimationFactory.cpp index cc33beecf..7da2b7f60 100644 --- a/mm/2s2h/resource/importer/TextureAnimationFactory.cpp +++ b/mm/2s2h/resource/importer/TextureAnimationFactory.cpp @@ -36,7 +36,7 @@ void LUS::TextureAnimationFactoryV0::ParseFileBinary(std::shared_ptrReadInt8(); - anim.type = reader->ReadInt8(); + anim.type = reader->ReadInt16(); switch ((TextureAnimationParamsType)anim.type) { case TextureAnimationParamsType::SingleScroll: { @@ -103,8 +103,11 @@ void LUS::TextureAnimationFactoryV0::ParseFileBinary(std::shared_ptrtextureList = new void*[e->keyFrameLength]; e->textureIndexList = new uint8_t[e->keyFrameLength]; + tAnim->textureCycleTextures.reserve(e->keyFrameLength); + for (size_t i = 0; i < e->keyFrameLength; i++) { - e->textureList[i] = ResourceGetDataByName(reader->ReadString().c_str()); + tAnim->textureCycleTextures.emplace_back("__OTR__" + reader->ReadString()); + e->textureList[i] = (Gfx*)tAnim->textureCycleTextures[i].c_str(); } for (size_t i = 0; i < e->keyFrameLength; i++) { e->textureIndexList[i] = reader->ReadUByte(); diff --git a/mm/2s2h/resource/type/TextureAnimation.h b/mm/2s2h/resource/type/TextureAnimation.h index 5538547c6..843599c48 100644 --- a/mm/2s2h/resource/type/TextureAnimation.h +++ b/mm/2s2h/resource/type/TextureAnimation.h @@ -100,5 +100,6 @@ class TextureAnimation : public Resource { size_t GetPointerSize(); std::vector anims; + std::vector textureCycleTextures; }; } // namespace LUS \ No newline at end of file