diff options
| author | coco875 <59367621+coco875@users.noreply.github.com> | 2024-08-14 06:29:32 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-13 22:29:32 -0600 |
| commit | 33154e1d32a6663bb87ca786a7b9abbf949351be (patch) | |
| tree | 433f2576ceedab6f6c516cefdc9619d07f838e7c /src/port | |
| parent | 177504c4954d54d24a0716cdf142f33eb6d2aedf (diff) | |
add dks_jungle_parkway (#50)
* add dks_jungle_parkway
* correct value
---------
Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>
Diffstat (limited to 'src/port')
| -rw-r--r-- | src/port/Engine.cpp | 1 | ||||
| -rw-r--r-- | src/port/resource/importers/UnkActorSpawnDataFactory.cpp | 32 | ||||
| -rw-r--r-- | src/port/resource/importers/UnkActorSpawnDataFactory.h | 12 | ||||
| -rw-r--r-- | src/port/resource/type/ResourceType.h | 1 | ||||
| -rw-r--r-- | src/port/resource/type/UnkSpawnData.cpp | 15 | ||||
| -rw-r--r-- | src/port/resource/type/UnkSpawnData.h | 28 |
6 files changed, 89 insertions, 0 deletions
diff --git a/src/port/Engine.cpp b/src/port/Engine.cpp index b16d34410..8df0b81a7 100644 --- a/src/port/Engine.cpp +++ b/src/port/Engine.cpp @@ -74,6 +74,7 @@ GameEngine::GameEngine() { loader->RegisterResourceFactory(std::make_shared<MK64::ResourceFactoryBinaryTrackSectionsV0>(), RESOURCE_FORMAT_BINARY, "TrackSections", static_cast<uint32_t>(MK64::ResourceType::TrackSection), 0); loader->RegisterResourceFactory(std::make_shared<MK64::ResourceFactoryBinaryTrackWaypointsV0>(), RESOURCE_FORMAT_BINARY, "Waypoints", static_cast<uint32_t>(MK64::ResourceType::Waypoints), 0); loader->RegisterResourceFactory(std::make_shared<MK64::ResourceFactoryBinaryActorSpawnDataV0>(), RESOURCE_FORMAT_BINARY, "SpawnData", static_cast<uint32_t>(MK64::ResourceType::SpawnData), 0); + loader->RegisterResourceFactory(std::make_shared<MK64::ResourceFactoryBinaryActorSpawnDataV0>(), RESOURCE_FORMAT_BINARY, "UnkSpawnData", static_cast<uint32_t>(MK64::ResourceType::UnkSpawnData), 0); } diff --git a/src/port/resource/importers/UnkActorSpawnDataFactory.cpp b/src/port/resource/importers/UnkActorSpawnDataFactory.cpp new file mode 100644 index 000000000..897fe59ec --- /dev/null +++ b/src/port/resource/importers/UnkActorSpawnDataFactory.cpp @@ -0,0 +1,32 @@ +#include "UnkActorSpawnDataFactory.h" +#include "../type/UnkSpawnData.h" +#include "spdlog/spdlog.h" +#include "libultraship/libultra/gbi.h" +#include <common_structs.h> + +namespace MK64 { + std::shared_ptr<Ship::IResource> ResourceFactoryBinaryUnkActorSpawnDataV0::ReadResource(std::shared_ptr<Ship::File> file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; + } + + auto section = std::make_shared<UnkActorSpawn>(file->InitData); + auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader); + + uint32_t count = reader->ReadUInt32(); + section->UnkActorSpawnDataList.reserve(count); + + for (uint32_t i = 0; i < count; i++) { + UnkActorSpawnData data; + data.pos[0] = reader->ReadInt16(); + data.pos[1] = reader->ReadInt16(); + data.pos[2] = reader->ReadInt16(); + data.someId = reader->ReadInt16(); + data.unk8 = reader->ReadInt16(); + + section->UnkActorSpawnDataList.push_back(data); + } + + return section; + } +}
\ No newline at end of file diff --git a/src/port/resource/importers/UnkActorSpawnDataFactory.h b/src/port/resource/importers/UnkActorSpawnDataFactory.h new file mode 100644 index 000000000..373322546 --- /dev/null +++ b/src/port/resource/importers/UnkActorSpawnDataFactory.h @@ -0,0 +1,12 @@ +#pragma once + +#include "Resource.h" +#include "ResourceFactoryBinary.h" + +namespace MK64 { +class ResourceFactoryBinaryUnkActorSpawnDataV0 : public Ship::ResourceFactoryBinary { + public: + std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; +}; + +} // namespace LUS diff --git a/src/port/resource/type/ResourceType.h b/src/port/resource/type/ResourceType.h index ab094a261..248515f3d 100644 --- a/src/port/resource/type/ResourceType.h +++ b/src/port/resource/type/ResourceType.h @@ -28,6 +28,7 @@ namespace MK64 { Waypoints = 0x57505453, // WPTS Metadata = 0x4D444154, // MDAT SpawnData = 0x53444154, // SDAT + UnkSpawnData = 0x55534454, // USDT KartAI = 0x44424856, // DBHV }; }
\ No newline at end of file diff --git a/src/port/resource/type/UnkSpawnData.cpp b/src/port/resource/type/UnkSpawnData.cpp new file mode 100644 index 000000000..f8255fe38 --- /dev/null +++ b/src/port/resource/type/UnkSpawnData.cpp @@ -0,0 +1,15 @@ +#include "UnkSpawnData.h" +#include "libultraship/libultra/gbi.h" + +namespace MK64 { +UnkActorSpawn::UnkActorSpawn() : Resource(std::shared_ptr<Ship::ResourceInitData>()) { +} + +UnkActorSpawnData* UnkActorSpawn::GetPointer() { + return UnkActorSpawnDataList.data(); +} + +size_t UnkActorSpawn::GetPointerSize() { + return UnkActorSpawnDataList.size() * sizeof(UnkActorSpawnData); +} +} // namespace LUS diff --git a/src/port/resource/type/UnkSpawnData.h b/src/port/resource/type/UnkSpawnData.h new file mode 100644 index 000000000..1839b9684 --- /dev/null +++ b/src/port/resource/type/UnkSpawnData.h @@ -0,0 +1,28 @@ +#pragma once + +#include "resource/Resource.h" +#include <vector> +#include <libultra/gbi.h> +#include <common_structs.h> + +struct UnkActorSpawnData { + /* 0x00 */ Vec3s pos; + // Techinically only the bottom byte of someId is the "id". The top byte is used for flags. + /* 0x06 */ s16 someId; + // Stores the tree's original Y position. + /* 0x08 */ s16 unk8; +}; + +namespace MK64 { +class UnkActorSpawn : public Ship::Resource<UnkActorSpawnData> { + public: + using Resource::Resource; + + UnkActorSpawn(); + + UnkActorSpawnData* GetPointer() override; + size_t GetPointerSize() override; + + std::vector<UnkActorSpawnData> UnkActorSpawnDataList; +}; +} // namespace LUS |
