* bump lus

* start fixing build errors

* update resources to support lus changes

Co-authored-by: Kenix <kenixwhisperwind@gmail.com>

---------

Co-authored-by: briaguya <briaguya>
Co-authored-by: Kenix <kenixwhisperwind@gmail.com>
This commit is contained in:
briaguya 2023-04-02 14:18:45 -04:00 committed by GitHub
parent 77cc91d0de
commit 94ad837c02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
117 changed files with 1004 additions and 885 deletions

@ -1 +1 @@
Subproject commit 274ec5e195f40c526f489242c3c2bf66f10eb9af
Subproject commit 9ebed2afa8125c31264d510e4ce5cc35beaca8ef

View File

@ -323,10 +323,6 @@ uint32_t OTRGlobals::GetInterpolationFPS() {
return std::min<uint32_t>(Ship::Window::GetInstance()->GetCurrentRefreshRate(), CVarGetInteger("gInterpolationFPS", 20));
}
std::shared_ptr<std::vector<std::string>> OTRGlobals::ListFiles(std::string path) {
return context->GetResourceManager()->ListFiles(path);
}
struct ExtensionEntry {
std::string path;
std::string ext;
@ -686,7 +682,7 @@ extern "C" uint32_t GetGIID(uint32_t itemID) {
}
extern "C" void OTRExtScanner() {
auto lst = *OTRGlobals::Instance->context->GetResourceManager()->ListFiles("*.*").get();
auto lst = *OTRGlobals::Instance->context->GetResourceManager()->GetArchive()->ListFiles("*.*").get();
for (auto& rPath : lst) {
std::vector<std::string> raw = StringHelper::Split(rPath, ".");
@ -1007,7 +1003,7 @@ extern "C" void ResourceMgr_DirtyDirectory(const char* resName) {
// OTRTODO: There is probably a more elegant way to go about this...
extern "C" char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize) {
auto lst = OTRGlobals::Instance->context->GetResourceManager()->ListFiles(searchMask);
auto lst = OTRGlobals::Instance->context->GetResourceManager()->GetArchive()->ListFiles(searchMask);
char** result = (char**)malloc(lst->size() * sizeof(char*));
for (size_t i = 0; i < lst->size(); i++) {
@ -1105,9 +1101,9 @@ extern "C" uint16_t ResourceMgr_LoadTexHeightByName(char* texPath);
extern "C" char* ResourceMgr_LoadTexOrDListByName(const char* filePath) {
auto res = GetResourceByNameHandlingMQ(filePath);
if (res->Type == Ship::ResourceType::DisplayList)
if (res->InitData->Type == Ship::ResourceType::DisplayList)
return (char*)&((std::static_pointer_cast<Ship::DisplayList>(res))->Instructions[0]);
else if (res->Type == Ship::ResourceType::Array)
else if (res->InitData->Type == Ship::ResourceType::Array)
return (char*)(std::static_pointer_cast<Ship::Array>(res))->Vertices.data();
else {
return (char*)GetResourceDataByNameHandlingMQ(filePath);

View File

@ -3,18 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> AnimationFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<Animation>();
std::shared_ptr<Resource> AnimationFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<Animation>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version) {
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<AnimationFactoryV0>();
break;
}
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load Animation with version {}", version);
SPDLOG_ERROR("Failed to load Animation with version {}", resource->InitData->ResourceVersion);
return nullptr;
}

View File

@ -6,7 +6,9 @@
namespace Ship {
class AnimationFactory : public ResourceFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class AnimationFactoryV0 : public ResourceVersionFactory {

View File

@ -3,21 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> AudioSampleFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<AudioSample>();
std::shared_ptr<Resource> AudioSampleFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<AudioSample>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 2:
factory = std::make_shared<AudioSampleFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load AudioSample with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load AudioSample with version {}", resource->InitData->ResourceVersion);
return nullptr;
}

View File

@ -7,7 +7,9 @@ namespace Ship {
class AudioSampleFactory : public ResourceFactory
{
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class AudioSampleFactoryV0 : public ResourceVersionFactory

View File

@ -3,13 +3,13 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> AudioSequenceFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<AudioSequence>();
std::shared_ptr<Resource> AudioSequenceFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<AudioSequence>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 2:
factory = std::make_shared<AudioSequenceFactoryV0>();
break;
@ -17,7 +17,7 @@ std::shared_ptr<Resource> AudioSequenceFactory::ReadResource(uint32_t version, s
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load AudioSequence with version {}", version);
SPDLOG_ERROR("Failed to load AudioSequence with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -27,8 +27,7 @@ std::shared_ptr<Resource> AudioSequenceFactory::ReadResource(uint32_t version, s
}
void Ship::AudioSequenceFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<Resource> resource) {
std::shared_ptr<AudioSequence> audioSequence = std::static_pointer_cast<AudioSequence>(resource);
ResourceVersionFactory::ParseFileBinary(reader, audioSequence);

View File

@ -7,7 +7,9 @@ namespace Ship {
class AudioSequenceFactory : public ResourceFactory
{
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class AudioSequenceFactoryV0 : public ResourceVersionFactory

View File

@ -4,13 +4,13 @@
#include "libultraship/bridge.h"
namespace Ship {
std::shared_ptr<Resource> AudioSoundFontFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<AudioSoundFont>();
std::shared_ptr<Resource> AudioSoundFontFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<AudioSoundFont>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 2:
factory = std::make_shared<AudioSoundFontFactoryV0>();
break;
@ -18,7 +18,7 @@ std::shared_ptr<Resource> AudioSoundFontFactory::ReadResource(uint32_t version,
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load AudioSoundFont with version {}", version);
SPDLOG_ERROR("Failed to load AudioSoundFont with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -28,8 +28,7 @@ std::shared_ptr<Resource> AudioSoundFontFactory::ReadResource(uint32_t version,
}
void Ship::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<Resource> resource) {
std::shared_ptr<AudioSoundFont> audioSoundFont = std::static_pointer_cast<AudioSoundFont>(resource);
ResourceVersionFactory::ParseFileBinary(reader, audioSoundFont);

View File

@ -7,7 +7,9 @@ namespace Ship {
class AudioSoundFontFactory : public ResourceFactory
{
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class AudioSoundFontFactoryV0 : public ResourceVersionFactory

View File

@ -3,18 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> BackgroundFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<Background>();
std::shared_ptr<Resource> BackgroundFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<Background>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version) {
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<BackgroundFactoryV0>();
break;
}
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load Background with version {}", version);
SPDLOG_ERROR("Failed to load Background with version {}", resource->InitData->ResourceVersion);
return nullptr;
}

View File

@ -6,7 +6,9 @@
namespace Ship {
class BackgroundFactory : public ResourceFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class BackgroundFactoryV0 : public ResourceVersionFactory {

View File

@ -3,21 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> CollisionHeaderFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<CollisionHeader>();
std::shared_ptr<Resource> CollisionHeaderFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<CollisionHeader>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<CollisionHeaderFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load Collision Header with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load Collision Header with version {}", resource->InitData->ResourceVersion);
return nullptr;
}

View File

@ -6,7 +6,9 @@
namespace Ship {
class CollisionHeaderFactory : public ResourceFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class CollisionHeaderFactoryV0 : public ResourceVersionFactory {

View File

@ -3,21 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> CutsceneFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<Cutscene>();
std::shared_ptr<Resource> CutsceneFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<Cutscene>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<CutsceneFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load Cutscene with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load Cutscene with version {}", resource->InitData->ResourceVersion);
return nullptr;
}

View File

@ -7,7 +7,9 @@ namespace Ship {
class CutsceneFactory : public ResourceFactory
{
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class CutsceneFactoryV0 : public ResourceVersionFactory

View File

@ -3,21 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> PathFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<Path>();
std::shared_ptr<Resource> PathFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<Path>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<PathFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load Path with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load Path with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -27,8 +26,7 @@ std::shared_ptr<Resource> PathFactory::ReadResource(uint32_t version, std::share
}
void Ship::PathFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<Resource> resource) {
std::shared_ptr<Path> path = std::static_pointer_cast<Path>(resource);
ResourceVersionFactory::ParseFileBinary(reader, path);

View File

@ -7,7 +7,9 @@ namespace Ship {
class PathFactory : public ResourceFactory
{
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class PathFactoryV0 : public ResourceVersionFactory

View File

@ -3,13 +3,13 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> PlayerAnimationFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<PlayerAnimation>();
std::shared_ptr<Resource> PlayerAnimationFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<PlayerAnimation>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<PlayerAnimationFactoryV0>();
break;
@ -17,7 +17,7 @@ std::shared_ptr<Resource> PlayerAnimationFactory::ReadResource(uint32_t version,
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load PlayerAnimation with version {}", version);
SPDLOG_ERROR("Failed to load PlayerAnimation with version {}", resource->InitData->ResourceVersion);
return nullptr;
}

View File

@ -6,7 +6,9 @@
namespace Ship {
class PlayerAnimationFactory : public ResourceFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class PlayerAnimationFactoryV0 : public ResourceVersionFactory {

View File

@ -30,8 +30,9 @@
namespace Ship {
std::shared_ptr<Resource> SceneFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
std::shared_ptr<Resource> SceneFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
if (SceneFactory::sceneCommandFactories.empty()) {
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetLightingSettings] = std::make_shared<SetLightingSettingsFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetWind] = std::make_shared<SetWindSettingsFactory>();
@ -60,20 +61,17 @@ std::shared_ptr<Resource> SceneFactory::ReadResource(uint32_t version, std::shar
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetMesh] = std::make_shared<SetMeshFactory>();
}
auto resource = std::make_shared<Scene>();
auto resource = std::make_shared<Scene>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
resource->ResourceVersion = version;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SceneFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load Scene with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load Scene with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -88,15 +86,20 @@ void SceneFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Scene> scene = std::static_pointer_cast<Scene>(resource);
ResourceVersionFactory::ParseFileBinary(reader, scene);
ParseSceneCommands(scene, reader);
}
void SceneFactoryV0::ParseSceneCommands(std::shared_ptr<Scene> scene, std::shared_ptr<BinaryReader> reader) {
uint32_t commandCount = reader->ReadUInt32();
scene->commands.reserve(commandCount);
for (uint32_t i = 0; i < commandCount; i++) {
scene->commands.push_back(ParseSceneCommand(resource->ResourceVersion, reader));
scene->commands.push_back(ParseSceneCommand(scene, reader, i));
}
}
std::shared_ptr<SceneCommand> SceneFactoryV0::ParseSceneCommand(uint32_t version, std::shared_ptr<BinaryReader> reader) {
std::shared_ptr<SceneCommand> SceneFactoryV0::ParseSceneCommand(std::shared_ptr<Scene> scene,
std::shared_ptr<BinaryReader> reader, uint32_t index) {
SceneCommandID cmdID = (SceneCommandID)reader->ReadInt32();
reader->Seek(-sizeof(int32_t), SeekOffsetType::Current);
@ -105,11 +108,17 @@ std::shared_ptr<SceneCommand> SceneFactoryV0::ParseSceneCommand(uint32_t version
std::shared_ptr<SceneCommandFactory> commandFactory = SceneFactory::sceneCommandFactories[cmdID];
if (commandFactory != nullptr) {
result = std::static_pointer_cast<SceneCommand>(commandFactory->ReadResource(version, reader));
auto initData = std::make_shared<ResourceInitData>();
initData->Id = scene->InitData->Id;
initData->Type = ResourceType::SOH_SceneCommand;
initData->Path = scene->InitData->Path + "/SceneCommand" + std::to_string(index);
initData->ResourceVersion = scene->InitData->ResourceVersion;
result = std::static_pointer_cast<SceneCommand>(commandFactory->ReadResource(scene->ResourceManager, initData, reader));
// Cache the resource?
}
if (result == nullptr) {
SPDLOG_ERROR("Failed to load scene command of type {}", (uint32_t)cmdID);
SPDLOG_ERROR("Failed to load scene command of type {} in scene {}", (uint32_t)cmdID, scene->InitData->Path);
}
return result;

View File

@ -9,7 +9,9 @@
namespace Ship {
class SceneFactory : public ResourceFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
// Doing something very similar to what we do on the ResourceLoader.
// Eventually, scene commands should be moved up to the ResourceLoader as well.
@ -21,6 +23,8 @@ class SceneFactory : public ResourceFactory {
class SceneFactoryV0 : public ResourceVersionFactory {
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
std::shared_ptr<SceneCommand> ParseSceneCommand(uint32_t version, std::shared_ptr<BinaryReader> reader);
void ParseSceneCommands(std::shared_ptr<Scene> scene, std::shared_ptr<BinaryReader> reader);
protected:
std::shared_ptr<SceneCommand> ParseSceneCommand(std::shared_ptr<Scene> scene, std::shared_ptr<BinaryReader> reader, uint32_t index);
};
}; // namespace Ship

View File

@ -4,21 +4,20 @@
#include <libultraship/bridge.h>
namespace Ship {
std::shared_ptr<Resource> SkeletonFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<Skeleton>();
std::shared_ptr<Resource> SkeletonFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<Skeleton>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SkeletonFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load Skeleton with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load Skeleton with version {}", resource->InitData->ResourceVersion);
return nullptr;
}

View File

@ -7,7 +7,9 @@ namespace Ship {
class SkeletonFactory : public ResourceFactory
{
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SkeletonFactoryV0 : public ResourceVersionFactory

View File

@ -4,21 +4,20 @@
#include "libultraship/bridge.h"
namespace Ship {
std::shared_ptr<Resource> SkeletonLimbFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SkeletonLimb>();
std::shared_ptr<Resource> SkeletonLimbFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SkeletonLimb>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SkeletonLimbFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load Skeleton Limb with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load Skeleton Limb with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -177,8 +176,7 @@ void Ship::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader>
skeletonLimb->skinAnimLimbData.limbModifications = skeletonLimb->skinLimbModifArray.data();
skeletonLimb->skinAnimLimbData.dlist = (Gfx*)GetResourceDataByName(skeletonLimb->skinDList2.c_str(), true);
for (size_t i = 0; i < skeletonLimb->skinLimbModifArray.size(); i++)
{
for (size_t i = 0; i < skeletonLimb->skinLimbModifArray.size(); i++) {
skeletonLimb->skinAnimLimbData.limbModifications[i].vtxCount = skeletonLimb->skinLimbModifVertexArrays[i].size();
skeletonLimb->skinAnimLimbData.limbModifications[i].skinVertices = skeletonLimb->skinLimbModifVertexArrays[i].data();

View File

@ -7,7 +7,9 @@ namespace Ship {
class SkeletonLimbFactory : public ResourceFactory
{
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SkeletonLimbFactoryV0 : public ResourceVersionFactory

View File

@ -3,13 +3,13 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> TextFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<Text>();
std::shared_ptr<Resource> TextFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<Text>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<TextFactoryV0>();
break;
@ -18,9 +18,8 @@ std::shared_ptr<Resource> TextFactory::ReadResource(uint32_t version, std::share
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load Text with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load Text with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -30,16 +29,14 @@ std::shared_ptr<Resource> TextFactory::ReadResource(uint32_t version, std::share
}
void Ship::TextFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<Resource> resource) {
std::shared_ptr<Text> text = std::static_pointer_cast<Text>(resource);
ResourceVersionFactory::ParseFileBinary(reader, text);
uint32_t msgCount = reader->ReadUInt32();
text->messages.reserve(msgCount);
for (uint32_t i = 0; i < msgCount; i++)
{
for (uint32_t i = 0; i < msgCount; i++) {
MessageEntry entry;
entry.id = reader->ReadUInt16();
entry.textboxType = reader->ReadUByte();

View File

@ -7,7 +7,9 @@ namespace Ship {
class TextFactory : public ResourceFactory
{
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class TextFactoryV0 : public ResourceVersionFactory

View File

@ -3,21 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> EndMarkerFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<EndMarker>();
std::shared_ptr<Resource> EndMarkerFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<EndMarker>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<EndMarkerFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load EndMarker with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load EndMarker with version {}", resource->InitData->ResourceVersion);
return nullptr;
}

View File

@ -5,7 +5,9 @@
namespace Ship {
class EndMarkerFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class EndMarkerFactoryV0 : public SceneCommandVersionFactory {

View File

@ -3,13 +3,13 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> SetActorListFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetActorList>();
std::shared_ptr<Resource> SetActorListFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetActorList>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetActorListFactoryV0>();
break;
@ -17,7 +17,7 @@ std::shared_ptr<Resource> SetActorListFactory::ReadResource(uint32_t version, st
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetActorList with version {}", version);
SPDLOG_ERROR("Failed to load SetActorList with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -27,8 +27,7 @@ std::shared_ptr<Resource> SetActorListFactory::ReadResource(uint32_t version, st
}
void Ship::SetActorListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetActorList> setActorList = std::static_pointer_cast<SetActorList>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setActorList);

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetActorListFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetActorListFactoryV0 : public SceneCommandVersionFactory {

View File

@ -4,13 +4,13 @@
#include "libultraship/bridge.h"
namespace Ship {
std::shared_ptr<Resource> SetAlternateHeadersFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetAlternateHeaders>();
std::shared_ptr<Resource> SetAlternateHeadersFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetAlternateHeaders>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetAlternateHeadersFactoryV0>();
break;
@ -18,7 +18,7 @@ std::shared_ptr<Resource> SetAlternateHeadersFactory::ReadResource(uint32_t vers
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetAlternateHeaders with version {}", version);
SPDLOG_ERROR("Failed to load SetAlternateHeaders with version {}", resource->InitData->ResourceVersion);
return nullptr;
}

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetAlternateHeadersFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetAlternateHeadersFactoryV0 : public SceneCommandVersionFactory {

View File

@ -3,21 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> SetCameraSettingsFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetCameraSettings>();
std::shared_ptr<Resource> SetCameraSettingsFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetCameraSettings>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetCameraSettingsFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetCameraSettings with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load SetCameraSettings with version {}", resource->InitData->ResourceVersion);
return nullptr;
}

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetCameraSettingsFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetCameraSettingsFactoryV0 : public SceneCommandVersionFactory {

View File

@ -4,21 +4,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> SetCollisionHeaderFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetCollisionHeader>();
std::shared_ptr<Resource> SetCollisionHeaderFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetCollisionHeader>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetCollisionHeaderFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetCollisionHeader with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load SetCollisionHeader with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -28,8 +27,7 @@ std::shared_ptr<Resource> SetCollisionHeaderFactory::ReadResource(uint32_t versi
}
void Ship::SetCollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetCollisionHeader> setCollisionHeader = std::static_pointer_cast<SetCollisionHeader>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setCollisionHeader);

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetCollisionHeaderFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetCollisionHeaderFactoryV0 : public SceneCommandVersionFactory {

View File

@ -3,21 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> SetCsCameraFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetCsCamera>();
std::shared_ptr<Resource> SetCsCameraFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetCsCamera>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetCsCameraFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetCsCamera with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load SetCsCamera with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -27,8 +26,7 @@ std::shared_ptr<Resource> SetCsCameraFactory::ReadResource(uint32_t version, std
}
void Ship::SetCsCameraFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetCsCamera> setCsCamera = std::static_pointer_cast<SetCsCamera>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setCsCamera);

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetCsCameraFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetCsCameraFactoryV0 : public SceneCommandVersionFactory {

View File

@ -4,13 +4,13 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> SetCutscenesFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetCutscenes>();
std::shared_ptr<Resource> SetCutscenesFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetCutscenes>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetCutscenesFactoryV0>();
break;
@ -18,7 +18,7 @@ std::shared_ptr<Resource> SetCutscenesFactory::ReadResource(uint32_t version, st
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetCutscenes with version {}", version);
SPDLOG_ERROR("Failed to load SetCutscenes with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -28,8 +28,7 @@ std::shared_ptr<Resource> SetCutscenesFactory::ReadResource(uint32_t version, st
}
void Ship::SetCutscenesFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetCutscenes> setCutscenes = std::static_pointer_cast<SetCutscenes>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setCutscenes);

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetCutscenesFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetCutscenesFactoryV0 : public SceneCommandVersionFactory {

View File

@ -3,21 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> SetEchoSettingsFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetEchoSettings>();
std::shared_ptr<Resource> SetEchoSettingsFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetEchoSettings>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetEchoSettingsFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetEchoSettings with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load SetEchoSettings with version {}", resource->InitData->ResourceVersion);
return nullptr;
}

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetEchoSettingsFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetEchoSettingsFactoryV0 : public SceneCommandVersionFactory {

View File

@ -3,21 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> SetEntranceListFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetEntranceList>();
std::shared_ptr<Resource> SetEntranceListFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetEntranceList>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetEntranceListFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetEntranceListList with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load SetEntranceListList with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -27,8 +26,7 @@ std::shared_ptr<Resource> SetEntranceListFactory::ReadResource(uint32_t version,
}
void Ship::SetEntranceListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetEntranceList> setEntranceList = std::static_pointer_cast<SetEntranceList>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setEntranceList);

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetEntranceListFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetEntranceListFactoryV0 : public SceneCommandVersionFactory {

View File

@ -3,21 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> SetExitListFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetExitList>();
std::shared_ptr<Resource> SetExitListFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetExitList>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetExitListFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetExitList with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load SetExitList with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -27,8 +26,7 @@ std::shared_ptr<Resource> SetExitListFactory::ReadResource(uint32_t version, std
}
void Ship::SetExitListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetExitList> setExitList = std::static_pointer_cast<SetExitList>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setExitList);

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetExitListFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetExitListFactoryV0 : public SceneCommandVersionFactory {

View File

@ -3,13 +3,13 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> SetLightListFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetLightList>();
std::shared_ptr<Resource> SetLightListFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetLightList>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetLightListFactoryV0>();
break;
@ -17,7 +17,7 @@ std::shared_ptr<Resource> SetLightListFactory::ReadResource(uint32_t version, st
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetLightList with version {}", version);
SPDLOG_ERROR("Failed to load SetLightList with version {}", resource->InitData->ResourceVersion);
return nullptr;
}

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetLightListFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetLightListFactoryV0 : public SceneCommandVersionFactory {

View File

@ -3,21 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> SetLightingSettingsFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetLightingSettings>();
std::shared_ptr<Resource> SetLightingSettingsFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetLightingSettings>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetLightingSettingsFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetLightingSettings with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load SetLightingSettings with version {}", resource->InitData->ResourceVersion);
return nullptr;
}

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetLightingSettingsFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetLightingSettingsFactoryV0 : public SceneCommandVersionFactory {

View File

@ -4,13 +4,13 @@
#include "libultraship/bridge.h"
namespace Ship {
std::shared_ptr<Resource> SetMeshFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetMesh>();
std::shared_ptr<Resource> SetMeshFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetMesh>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetMeshFactoryV0>();
break;
@ -18,7 +18,7 @@ std::shared_ptr<Resource> SetMeshFactory::ReadResource(uint32_t version, std::sh
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetMesh with version {}", version);
SPDLOG_ERROR("Failed to load SetMesh with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -86,9 +86,9 @@ void Ship::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reade
BgImage image;
image.unk_00 = reader->ReadUInt16();
image.id = reader->ReadUByte();
std::string sourceFile = reader->ReadString();
void* sourceData = GetResourceDataByName(sourceFile.c_str(), true);
image.source = sourceData;
std::string imagePath = "__OTR__" + reader->ReadString();
setMesh->imagePaths.push_back(imagePath);
image.source = (void*)setMesh->imagePaths.back().c_str();
image.unk_0C = reader->ReadUInt32();
image.tlut = reader->ReadUInt32();
image.width = reader->ReadUInt16();

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetMeshFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetMeshFactoryV0 : public SceneCommandVersionFactory {

View File

@ -3,21 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> SetObjectListFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetObjectList>();
std::shared_ptr<Resource> SetObjectListFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetObjectList>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetObjectListFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetObjectList with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load SetObjectList with version {}", resource->InitData->ResourceVersion);
return nullptr;
}

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetObjectListFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetObjectListFactoryV0 : public SceneCommandVersionFactory {

View File

@ -4,21 +4,20 @@
#include <libultraship/bridge.h>
namespace Ship {
std::shared_ptr<Resource> SetPathwaysFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetPathways>();
std::shared_ptr<Resource> SetPathwaysFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetPathways>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetPathwaysFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetPathways with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load SetPathways with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -28,8 +27,7 @@ std::shared_ptr<Resource> SetPathwaysFactory::ReadResource(uint32_t version, std
}
void Ship::SetPathwaysFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetPathways> setPathways = std::static_pointer_cast<SetPathways>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setPathways);

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetPathwaysFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetPathwaysFactoryV0 : public SceneCommandVersionFactory {

View File

@ -3,21 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> SetRoomBehaviorFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetRoomBehavior>();
std::shared_ptr<Resource> SetRoomBehaviorFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetRoomBehavior>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetRoomBehaviorFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetRoomBehavior with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load SetRoomBehavior with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -27,8 +26,7 @@ std::shared_ptr<Resource> SetRoomBehaviorFactory::ReadResource(uint32_t version,
}
void Ship::SetRoomBehaviorFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetRoomBehavior> setRoomBehavior = std::static_pointer_cast<SetRoomBehavior>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setRoomBehavior);

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetRoomBehaviorFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetRoomBehaviorFactoryV0 : public SceneCommandVersionFactory {

View File

@ -3,13 +3,13 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> SetRoomListFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetRoomList>();
std::shared_ptr<Resource> SetRoomListFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetRoomList>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetRoomListFactoryV0>();
break;
@ -17,7 +17,7 @@ std::shared_ptr<Resource> SetRoomListFactory::ReadResource(uint32_t version, std
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetRoomList with version {}", version);
SPDLOG_ERROR("Failed to load SetRoomList with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -27,8 +27,7 @@ std::shared_ptr<Resource> SetRoomListFactory::ReadResource(uint32_t version, std
}
void Ship::SetRoomListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetRoomList> setRoomList = std::static_pointer_cast<SetRoomList>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setRoomList);

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetRoomListFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetRoomListFactoryV0 : public SceneCommandVersionFactory {

View File

@ -3,21 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> SetSkyboxModifierFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetSkyboxModifier>();
std::shared_ptr<Resource> SetSkyboxModifierFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetSkyboxModifier>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetSkyboxModifierFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetSkyboxModifier with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load SetSkyboxModifier with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -27,8 +26,7 @@ std::shared_ptr<Resource> SetSkyboxModifierFactory::ReadResource(uint32_t versio
}
void Ship::SetSkyboxModifierFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetSkyboxModifier> setSkyboxModifier = std::static_pointer_cast<SetSkyboxModifier>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setSkyboxModifier);

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetSkyboxModifierFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetSkyboxModifierFactoryV0 : public SceneCommandVersionFactory {

View File

@ -3,21 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> SetSkyboxSettingsFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetSkyboxSettings>();
std::shared_ptr<Resource> SetSkyboxSettingsFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetSkyboxSettings>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetSkyboxSettingsFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetSkyboxSettings with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load SetSkyboxSettings with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -27,8 +26,7 @@ std::shared_ptr<Resource> SetSkyboxSettingsFactory::ReadResource(uint32_t versio
}
void SetSkyboxSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetSkyboxSettings> setSkyboxSettings = std::static_pointer_cast<SetSkyboxSettings>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setSkyboxSettings);

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetSkyboxSettingsFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetSkyboxSettingsFactoryV0 : public SceneCommandVersionFactory {

View File

@ -3,21 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> SetSoundSettingsFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetSoundSettings>();
std::shared_ptr<Resource> SetSoundSettingsFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetSoundSettings>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetSoundSettingsFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetSoundSettings with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load SetSoundSettings with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -27,8 +26,7 @@ std::shared_ptr<Resource> SetSoundSettingsFactory::ReadResource(uint32_t version
}
void Ship::SetSoundSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetSoundSettings> setSoundSettings = std::static_pointer_cast<SetSoundSettings>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setSoundSettings);

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetSoundSettingsFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetSoundSettingsFactoryV0 : public SceneCommandVersionFactory {

View File

@ -3,21 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> SetSpecialObjectsFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetSpecialObjects>();
std::shared_ptr<Resource> SetSpecialObjectsFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetSpecialObjects>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetSpecialObjectsFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetSpecialObjects with version {}", version);
if (factory == nullptr){
SPDLOG_ERROR("Failed to load SetSpecialObjects with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -27,8 +26,7 @@ std::shared_ptr<Resource> SetSpecialObjectsFactory::ReadResource(uint32_t versio
}
void Ship::SetSpecialObjectsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetSpecialObjects> setSpecialObjects = std::static_pointer_cast<SetSpecialObjects>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setSpecialObjects);

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetSpecialObjectsFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetSpecialObjectsFactoryV0 : public SceneCommandVersionFactory {

View File

@ -3,12 +3,13 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> SetStartPositionListFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetStartPositionList>();
std::shared_ptr<Resource> SetStartPositionListFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetStartPositionList>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
switch (resource->InitData->ResourceVersion)
{
case 0:
factory = std::make_shared<SetStartPositionListFactoryV0>();
@ -17,7 +18,7 @@ std::shared_ptr<Resource> SetStartPositionListFactory::ReadResource(uint32_t ver
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetStartPositionList with version {}", version);
SPDLOG_ERROR("Failed to load SetStartPositionList with version {}", resource->InitData->ResourceVersion);
return nullptr;
}

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetStartPositionListFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetStartPositionListFactoryV0 : public SceneCommandVersionFactory {

View File

@ -3,21 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> SetTimeSettingsFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetTimeSettings>();
std::shared_ptr<Resource> SetTimeSettingsFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetTimeSettings>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetTimeSettingsFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetTimeSettings with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load SetTimeSettings with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -27,8 +26,7 @@ std::shared_ptr<Resource> SetTimeSettingsFactory::ReadResource(uint32_t version,
}
void Ship::SetTimeSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetTimeSettings> setTimeSettings = std::static_pointer_cast<SetTimeSettings>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setTimeSettings);

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetTimeSettingsFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetTimeSettingsFactoryV0 : public SceneCommandVersionFactory {

View File

@ -3,21 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> SetTransitionActorListFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetTransitionActorList>();
std::shared_ptr<Resource> SetTransitionActorListFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetTransitionActorList>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetTransitionActorListFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetTransitionActorList with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load SetTransitionActorList with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -27,8 +26,7 @@ std::shared_ptr<Resource> SetTransitionActorListFactory::ReadResource(uint32_t v
}
void Ship::SetTransitionActorListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetTransitionActorList> setTransitionActorList = std::static_pointer_cast<SetTransitionActorList>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setTransitionActorList);

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetTransitionActorListFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetTransitionActorListFactoryV0 : public SceneCommandVersionFactory {

View File

@ -3,21 +3,20 @@
#include "spdlog/spdlog.h"
namespace Ship {
std::shared_ptr<Resource> SetWindSettingsFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
{
auto resource = std::make_shared<SetWindSettings>();
std::shared_ptr<Resource> SetWindSettingsFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
auto resource = std::make_shared<SetWindSettings>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch (version)
{
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SetWindSettingsFactoryV0>();
break;
}
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load SetWindSettings with version {}", version);
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load SetWindSettings with version {}", resource->InitData->ResourceVersion);
return nullptr;
}
@ -27,8 +26,7 @@ std::shared_ptr<Resource> SetWindSettingsFactory::ReadResource(uint32_t version,
}
void Ship::SetWindSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetWindSettings> setWind = std::static_pointer_cast<SetWindSettings>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setWind);

View File

@ -5,7 +5,9 @@
namespace Ship {
class SetWindSettingsFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader);
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) override;
};
class SetWindSettingsFactoryV0 : public SceneCommandVersionFactory {

View File

@ -65,6 +65,8 @@ namespace Ship {
class Animation : public Resource {
public:
using Resource::Resource;
void* GetPointer();
size_t GetPointerSize();

View File

@ -41,6 +41,8 @@ namespace Ship {
class AudioSample : public Resource {
public:
using Resource::Resource;
void* GetPointer();
size_t GetPointerSize();

View File

@ -19,6 +19,8 @@ typedef struct {
class AudioSequence : public Resource {
public:
using Resource::Resource;
void* GetPointer();
size_t GetPointerSize();

View File

@ -54,6 +54,8 @@ typedef struct {
class AudioSoundFont : public Resource {
public:
using Resource::Resource;
void* GetPointer();
size_t GetPointerSize();

View File

@ -5,6 +5,8 @@
namespace Ship {
class Background : public Resource {
public:
using Resource::Resource;
void* GetPointer();
size_t GetPointerSize();

View File

@ -69,6 +69,8 @@ typedef struct {
class CollisionHeader : public Resource {
public:
using Resource::Resource;
void* GetPointer();
size_t GetPointerSize();

View File

@ -46,6 +46,8 @@ enum class CutsceneCommands {
class Cutscene : public Resource {
public:
using Resource::Resource;
void* GetPointer();
size_t GetPointerSize();

View File

@ -15,6 +15,8 @@ typedef struct {
class Path : public Resource {
public:
using Resource::Resource;
void* GetPointer();
size_t GetPointerSize();

View File

@ -11,6 +11,8 @@ namespace Ship {
class PlayerAnimation : public Resource {
public:
using Resource::Resource;
void* GetPointer();
size_t GetPointerSize();

View File

@ -11,6 +11,8 @@ namespace Ship {
class Scene : public Resource {
public:
using Resource::Resource;
void* GetPointer();
size_t GetPointerSize();

View File

@ -50,6 +50,8 @@ union SkeletonData {
class Skeleton : public Resource {
public:
using Resource::Resource;
void* GetPointer();
size_t GetPointerSize();

View File

@ -99,6 +99,8 @@ union SkeletonLimbData {
class SkeletonLimb : public Resource {
public:
using Resource::Resource;
void* GetPointer();
size_t GetPointerSize();

View File

@ -18,6 +18,8 @@ public:
class Text : public Resource {
public:
using Resource::Resource;
void* GetPointer();
size_t GetPointerSize();

View File

@ -14,6 +14,8 @@ typedef struct {
class EndMarker : public SceneCommand {
public:
using SceneCommand::SceneCommand;
void* GetPointer();
size_t GetPointerSize();

View File

@ -49,6 +49,7 @@ enum class SceneCommandID : uint8_t {
class SceneCommand : public Resource {
public:
using Resource::Resource;
SceneCommandID cmdId;
};

View File

@ -19,6 +19,8 @@ typedef struct {
class SetActorList : public SceneCommand {
public:
using SceneCommand::SceneCommand;
void* GetPointer();
size_t GetPointerSize();

View File

@ -15,6 +15,8 @@ namespace Ship {
class SetAlternateHeaders : public SceneCommand {
public:
using SceneCommand::SceneCommand;
void* GetPointer();
size_t GetPointerSize();

View File

@ -15,6 +15,8 @@ typedef struct {
class SetCameraSettings : public SceneCommand {
public:
using SceneCommand::SceneCommand;
void* GetPointer();
size_t GetPointerSize();

View File

@ -12,6 +12,8 @@
namespace Ship {
class SetCollisionHeader : public SceneCommand {
public:
using SceneCommand::SceneCommand;
void* GetPointer();
size_t GetPointerSize();

View File

@ -14,6 +14,8 @@ typedef struct {
class SetCsCamera : public SceneCommand {
public:
using SceneCommand::SceneCommand;
void* GetPointer();
size_t GetPointerSize();

View File

@ -12,6 +12,8 @@
namespace Ship {
class SetCutscenes : public SceneCommand {
public:
using SceneCommand::SceneCommand;
void* GetPointer();
size_t GetPointerSize();

View File

@ -14,6 +14,8 @@ typedef struct {
class SetEchoSettings : public SceneCommand {
public:
using SceneCommand::SceneCommand;
void* GetPointer();
size_t GetPointerSize();

Some files were not shown because too many files have changed in this diff Show More