blob: fcf7763ddacbd013b8fffd16aa6dd8d74b8f9eba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include "HitboxFactory.h"
#include "../type/Hitbox.h"
#include "spdlog/spdlog.h"
namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryHitboxV0::ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr;
}
auto hitbox = std::make_shared<Hitbox>(file->InitData);
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
auto count = reader->ReadUInt32();
for (uint32_t i = 0; i < count; i++) {
hitbox->mHitbox.push_back(reader->ReadFloat());
}
return hitbox;
}
} // namespace LUS
|