blob: 1c55d3253c5f588edee944f3b5ffb4e8cfbee647 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include "2s2h/resource/importer/PlayerAnimationFactory.h"
#include "2s2h/resource/type/PlayerAnimation.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
|