mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-09-13 05:24:58 -04:00
26 lines
890 B
C++
26 lines
890 B
C++
#include "soh/resource/importer/PlayerAnimationFactory.h"
|
|
#include "soh/resource/type/PlayerAnimation.h"
|
|
#include "spdlog/spdlog.h"
|
|
|
|
namespace SOH {
|
|
std::shared_ptr<Ship::IResource>
|
|
ResourceFactoryBinaryPlayerAnimationV0::ReadResource(std::shared_ptr<Ship::File> file,
|
|
std::shared_ptr<Ship::ResourceInitData> initData) {
|
|
if (!FileHasValidFormatAndReader(file, initData)) {
|
|
return nullptr;
|
|
}
|
|
|
|
auto playerAnimation = std::make_shared<PlayerAnimation>(initData);
|
|
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
|
|
|
|
uint32_t numEntries = reader->ReadUInt32();
|
|
playerAnimation->limbRotData.reserve(numEntries);
|
|
|
|
for (uint32_t i = 0; i < numEntries; i++) {
|
|
playerAnimation->limbRotData.push_back(reader->ReadInt16());
|
|
}
|
|
|
|
return playerAnimation;
|
|
};
|
|
} // namespace SOH
|