Fix cycle animated textures (#57)

This commit is contained in:
Garrett Cox 2024-01-15 21:09:26 +00:00
parent b84550e1df
commit 5133d29c01
4 changed files with 8 additions and 4 deletions

@ -1 +1 @@
Subproject commit 1bf5103559090d4e2ad5be88f9177aac0ca91d71 Subproject commit 3502a0b7c526651836e23068aa9c7e8f2ff82dfd

2
ZAPDTR

@ -1 +1 @@
Subproject commit d77bf8826e6a2dfa2554e7b53aa1cc5a460d5e63 Subproject commit aaf3714f239b80e86ad508b1a715506589624ef2

View File

@ -36,7 +36,7 @@ void LUS::TextureAnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReade
for (size_t i = 0; i < numEntries; i++) { for (size_t i = 0; i < numEntries; i++) {
AnimatedMaterial anim; AnimatedMaterial anim;
anim.segment = reader->ReadInt8(); anim.segment = reader->ReadInt8();
anim.type = reader->ReadInt8(); anim.type = reader->ReadInt16();
switch ((TextureAnimationParamsType)anim.type) { switch ((TextureAnimationParamsType)anim.type) {
case TextureAnimationParamsType::SingleScroll: { case TextureAnimationParamsType::SingleScroll: {
@ -103,8 +103,11 @@ void LUS::TextureAnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReade
e->textureList = new void*[e->keyFrameLength]; e->textureList = new void*[e->keyFrameLength];
e->textureIndexList = new uint8_t[e->keyFrameLength]; e->textureIndexList = new uint8_t[e->keyFrameLength];
tAnim->textureCycleTextures.reserve(e->keyFrameLength);
for (size_t i = 0; i < e->keyFrameLength; i++) { 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++) { for (size_t i = 0; i < e->keyFrameLength; i++) {
e->textureIndexList[i] = reader->ReadUByte(); e->textureIndexList[i] = reader->ReadUByte();

View File

@ -100,5 +100,6 @@ class TextureAnimation : public Resource<AnimatedMaterial> {
size_t GetPointerSize(); size_t GetPointerSize();
std::vector<AnimatedMaterial> anims; std::vector<AnimatedMaterial> anims;
std::vector<std::string> textureCycleTextures;
}; };
} // namespace LUS } // namespace LUS