Shipwright/libultraship/libultraship/Animation.cpp
Random 09432ee7f4
Linux/GCC Support (#28)
* Initial Linux/GCC support commit

* Add instructins for linux in the README

* apply suggestions by @Erotemic and @Emill

* Fix python 3.10 symlink line

* Fix func_80041E80 type mismatch (#3)

Type mismatch functions.h:664

* Makefile: clean OTRExporter/libultraship/ZAPDTR with distclean and fix CXX_FILES

* Makefile: find C/CXX_FILES automatically

* Makefile: remove ugly conditions in find commands

* cleanup _MSC_VER usage

* fix Windows build

* cleanup extraction scripts

* fix Windows build

* Fix Windows path separator issue

* fix rumble support for linux

* use glew-cmake in dockerfile

* add pulseaudio backend

* fix ZAPDTR linkage

* Check for "soh.elf" in directory (#6)

hide second button if `soh.exe` or `soh.elf` is present

* Fix hardcoded segment addresses (#5)

* fix condition

* hack lus -> soh dep for ZAPDTR

Co-authored-by: sholdee <102821812+sholdee@users.noreply.github.com>
Co-authored-by: qurious-pixel <62252937+qurious-pixel@users.noreply.github.com>
Co-authored-by: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com>
2022-05-11 13:18:24 -04:00

73 lines
2.0 KiB
C++

#include "Animation.h"
void Ship::AnimationV0::ParseFileBinary(BinaryReader* reader, Resource* res)
{
Animation* anim = (Animation*)res;
ResourceFile::ParseFileBinary(reader, res);
AnimationType animType = (AnimationType)reader->ReadUInt32();
anim->type = animType;
if (animType == AnimationType::Normal)
{
anim->frameCount = reader->ReadInt16();
uint32_t rotValuesCnt = reader->ReadUInt32();
anim->rotationValues.reserve(rotValuesCnt);
for (uint32_t i = 0; i < rotValuesCnt; i++)
anim->rotationValues.push_back(reader->ReadUInt16());
uint32_t rotIndCnt = reader->ReadUInt32();
anim->rotationIndices.reserve(rotIndCnt);
for (size_t i = 0; i < rotIndCnt; i++)
{
uint16_t x = reader->ReadUInt16();
uint16_t y = reader->ReadUInt16();
uint16_t z = reader->ReadUInt16();
anim->rotationIndices.push_back(RotationIndex(x, y, z));
}
anim->limit = reader->ReadInt16();
}
else if (animType == AnimationType::Curve)
{
anim->frameCount = reader->ReadInt16();
uint32_t refArrCnt = reader->ReadUInt32();
anim->refIndexArr.reserve(refArrCnt);
for (uint32_t i = 0; i < refArrCnt; i++)
anim->refIndexArr.push_back(reader->ReadUByte());
uint32_t transformDataCnt = reader->ReadUInt32();
anim->transformDataArr.reserve(transformDataCnt);
for (uint32_t i = 0; i < transformDataCnt; i++)
{
TransformData data;
data.unk_00 = reader->ReadUInt16();
data.unk_02 = reader->ReadInt16();
data.unk_04 = reader->ReadInt16();
data.unk_06 = reader->ReadInt16();
data.unk_08 = reader->ReadSingle();
anim->transformDataArr.push_back(data);
}
uint32_t copyValuesCnt = reader->ReadUInt32();
anim->copyValuesArr.reserve(copyValuesCnt);
for (uint32_t i = 0; i < copyValuesCnt; i++)
{
anim->copyValuesArr.push_back(reader->ReadInt16());
}
}
else if (animType == AnimationType::Link)
{
anim->frameCount = reader->ReadInt16();
anim->segPtr = reader->ReadUInt32();
}
else if (animType == AnimationType::Legacy)
{
SPDLOG_DEBUG("BEYTAH ANIMATION?!");
}
}