Files

25 lines
784 B
C++
Raw Permalink Normal View History

2024-01-05 10:15:41 -06:00
#include "2s2h/resource/importer/PlayerAnimationFactory.h"
#include "2s2h/resource/type/PlayerAnimation.h"
#include "spdlog/spdlog.h"
2024-03-26 21:26:31 -04:00
namespace SOH {
std::shared_ptr<Ship::IResource>
ResourceFactoryBinaryPlayerAnimationV0::ReadResource(std::shared_ptr<Ship::File> file) {
2024-03-26 21:26:31 -04:00
if (!FileHasValidFormatAndReader(file)) {
return nullptr;
2024-01-05 10:15:41 -06:00
}
2024-03-26 21:26:31 -04:00
auto playerAnimation = std::make_shared<PlayerAnimation>(file->InitData);
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
2024-01-05 10:15:41 -06:00
uint32_t numEntries = reader->ReadUInt32();
playerAnimation->limbRotData.reserve(numEntries);
for (uint32_t i = 0; i < numEntries; i++) {
playerAnimation->limbRotData.push_back(reader->ReadInt16());
}
2024-03-26 21:26:31 -04:00
return playerAnimation;
2024-01-05 10:15:41 -06:00
}
2024-03-26 21:26:31 -04:00
} // namespace SOH