diff options
| author | briaguya <70942617+briaguya0@users.noreply.github.com> | 2026-07-24 18:09:55 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-24 18:09:55 -0400 |
| commit | 4cae44160693e1beb562e39dc301bd42278be1f9 (patch) | |
| tree | 5d247f7821a6040221b4bf34d2cae2b87c42d23a /src/factories/oot/OoTCollisionFactory.h | |
| parent | cd33252589a61d044138f449041a87adee2a8291 (diff) | |
oot support (#219)
Diffstat (limited to 'src/factories/oot/OoTCollisionFactory.h')
| -rw-r--r-- | src/factories/oot/OoTCollisionFactory.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/src/factories/oot/OoTCollisionFactory.h b/src/factories/oot/OoTCollisionFactory.h new file mode 100644 index 0000000..f842a38 --- /dev/null +++ b/src/factories/oot/OoTCollisionFactory.h @@ -0,0 +1,76 @@ +#pragma once + +#include "factories/BaseFactory.h" +#include <vector> +#include <string> +#include <optional> + +namespace OoT { + +struct CollisionVertex { + int16_t x, y, z; +}; + +struct CollisionPoly { + uint16_t type; + uint16_t vtxA; + uint16_t vtxB; + uint16_t vtxC; + uint16_t normX; + uint16_t normY; + uint16_t normZ; + uint16_t dist; +}; + +struct SurfaceType { + uint32_t data0; + uint32_t data1; +}; + +struct CamDataEntry { + uint16_t cameraSType; + int16_t numData; + uint32_t cameraPosIndex; +}; + +struct CamPosData { + int16_t x, y, z; +}; + +struct WaterBox { + int16_t xMin; + int16_t ySurface; + int16_t zMin; + int16_t xLength; + int16_t zLength; + uint32_t properties; +}; + +class OoTCollisionData : public IParsedData { +public: + int16_t absMinX, absMinY, absMinZ; + int16_t absMaxX, absMaxY, absMaxZ; + std::vector<CollisionVertex> vertices; + std::vector<CollisionPoly> polygons; + std::vector<SurfaceType> surfaceTypes; + std::vector<CamDataEntry> camDataEntries; + std::vector<CamPosData> camPositions; + std::vector<WaterBox> waterBoxes; +}; + +class OoTCollisionBinaryExporter : public BaseExporter { + ExportResult Export(std::ostream& write, std::shared_ptr<IParsedData> data, std::string& entryName, + YAML::Node& node, std::string* replacement) override; +}; + +class OoTCollisionFactory : public BaseFactory { +public: + std::optional<std::shared_ptr<IParsedData>> parse(std::vector<uint8_t>& buffer, YAML::Node& data) override; + std::unordered_map<ExportType, std::shared_ptr<BaseExporter>> GetExporters() override { + return { + REGISTER(Binary, OoTCollisionBinaryExporter) + }; + } +}; + +} // namespace OoT |
