mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-07 02:40:30 -05:00
bump lus (#2661)
* 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:
parent
77cc91d0de
commit
94ad837c02
@ -1 +1 @@
|
||||
Subproject commit 274ec5e195f40c526f489242c3c2bf66f10eb9af
|
||||
Subproject commit 9ebed2afa8125c31264d510e4ce5cc35beaca8ef
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -3,34 +3,33 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 2:
|
||||
factory = std::make_shared<AudioSampleFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 2:
|
||||
factory = std::make_shared<AudioSampleFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load AudioSample with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load AudioSample with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::AudioSampleFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<AudioSample> audioSample = std::static_pointer_cast<AudioSample>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, audioSample);
|
||||
std::shared_ptr<AudioSample> audioSample = std::static_pointer_cast<AudioSample>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, audioSample);
|
||||
|
||||
audioSample->sample.codec = reader->ReadUByte();
|
||||
audioSample->sample.medium = reader->ReadUByte();
|
||||
|
@ -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
|
||||
|
@ -3,34 +3,33 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 2:
|
||||
factory = std::make_shared<AudioSequenceFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 2:
|
||||
factory = std::make_shared<AudioSequenceFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load AudioSequence with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load AudioSequence with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::AudioSequenceFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<AudioSequence> audioSequence = std::static_pointer_cast<AudioSequence>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, audioSequence);
|
||||
std::shared_ptr<Resource> resource) {
|
||||
std::shared_ptr<AudioSequence> audioSequence = std::static_pointer_cast<AudioSequence>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, audioSequence);
|
||||
|
||||
audioSequence->sequence.seqDataSize = reader->ReadInt32();
|
||||
audioSequence->sequenceData.reserve(audioSequence->sequence.seqDataSize);
|
||||
|
@ -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
|
||||
|
@ -4,34 +4,33 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 2:
|
||||
factory = std::make_shared<AudioSoundFontFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 2:
|
||||
factory = std::make_shared<AudioSoundFontFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load AudioSoundFont with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load AudioSoundFont with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<AudioSoundFont> audioSoundFont = std::static_pointer_cast<AudioSoundFont>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, audioSoundFont);
|
||||
std::shared_ptr<Resource> resource) {
|
||||
std::shared_ptr<AudioSoundFont> audioSoundFont = std::static_pointer_cast<AudioSoundFont>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, audioSoundFont);
|
||||
|
||||
audioSoundFont->soundFont.fntIndex = reader->ReadInt32();
|
||||
audioSoundFont->medium = reader->ReadInt8();
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -3,34 +3,33 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<CollisionHeaderFactoryV0>();
|
||||
break;
|
||||
}
|
||||
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);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Collision Header with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::CollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<CollisionHeader> collisionHeader = std::static_pointer_cast<CollisionHeader>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, collisionHeader);
|
||||
std::shared_ptr<CollisionHeader> collisionHeader = std::static_pointer_cast<CollisionHeader>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, collisionHeader);
|
||||
|
||||
collisionHeader->collisionHeaderData.minBounds.x = reader->ReadInt16();
|
||||
collisionHeader->collisionHeaderData.minBounds.y = reader->ReadInt16();
|
||||
|
@ -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 {
|
||||
|
@ -3,27 +3,26 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<CutsceneFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<CutsceneFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load Cutscene with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Cutscene with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
static inline uint32_t read_CMD_BBBB(std::shared_ptr<BinaryReader> reader) {
|
||||
@ -84,10 +83,10 @@ static inline uint32_t read_CMD_HH(std::shared_ptr<BinaryReader> reader) {
|
||||
void Ship::CutsceneFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<Cutscene> cutscene = std::static_pointer_cast<Cutscene>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, cutscene);
|
||||
std::shared_ptr<Cutscene> cutscene = std::static_pointer_cast<Cutscene>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, cutscene);
|
||||
|
||||
uint32_t numEntries = reader->ReadUInt32();
|
||||
uint32_t numEntries = reader->ReadUInt32();
|
||||
cutscene->commands.reserve(numEntries);
|
||||
|
||||
cutscene->numCommands = reader->ReadUInt32();
|
||||
|
@ -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
|
||||
|
@ -3,34 +3,32 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<PathFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<PathFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load Path with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Path with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::PathFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<Path> path = std::static_pointer_cast<Path>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, path);
|
||||
std::shared_ptr<Resource> resource) {
|
||||
std::shared_ptr<Path> path = std::static_pointer_cast<Path>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, path);
|
||||
|
||||
path->numPaths = reader->ReadUInt32();
|
||||
path->paths.reserve(path->numPaths);
|
||||
|
@ -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
|
||||
|
@ -3,36 +3,36 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<PlayerAnimationFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<PlayerAnimationFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load PlayerAnimation with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load PlayerAnimation with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::PlayerAnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<PlayerAnimation> playerAnimation = std::static_pointer_cast<PlayerAnimation>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, playerAnimation);
|
||||
std::shared_ptr<PlayerAnimation> playerAnimation = std::static_pointer_cast<PlayerAnimation>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, playerAnimation);
|
||||
|
||||
uint32_t numEntries = reader->ReadUInt32();
|
||||
uint32_t numEntries = reader->ReadUInt32();
|
||||
playerAnimation->limbRotData.reserve(numEntries);
|
||||
|
||||
for (uint32_t i = 0; i < numEntries; i++) {
|
||||
|
@ -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 {
|
||||
|
@ -30,14 +30,15 @@
|
||||
|
||||
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>();
|
||||
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetExitList] = std::make_shared<SetExitListFactory>();
|
||||
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetTimeSettings] = std::make_shared<SetTimeSettingsFactory>();
|
||||
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetSkyboxModifier] = std::make_shared<SetSkyboxModifierFactory>();
|
||||
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetSkyboxModifier] = std::make_shared<SetSkyboxModifierFactory>();
|
||||
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetEchoSettings] = std::make_shared<SetEchoSettingsFactory>();
|
||||
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetSoundSettings] = std::make_shared<SetSoundSettingsFactory>();
|
||||
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetSkyboxSettings] = std::make_shared<SetSkyboxSettingsFactory>();
|
||||
@ -60,43 +61,45 @@ 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>();
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
resource->ResourceVersion = version;
|
||||
auto resource = std::make_shared<Scene>(resourceMgr, initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SceneFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SceneFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load Scene with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Scene with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void SceneFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<Scene> scene = std::static_pointer_cast<Scene>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, scene);
|
||||
std::shared_ptr<Scene> scene = std::static_pointer_cast<Scene>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, scene);
|
||||
|
||||
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));
|
||||
}
|
||||
ParseSceneCommands(scene, reader);
|
||||
}
|
||||
|
||||
std::shared_ptr<SceneCommand> SceneFactoryV0::ParseSceneCommand(uint32_t version, std::shared_ptr<BinaryReader> 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(scene, reader, i));
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -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
|
||||
|
@ -4,27 +4,26 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SkeletonFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SkeletonFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load Skeleton with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Skeleton with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
@ -33,12 +32,12 @@ void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Skeleton> skeleton = std::static_pointer_cast<Skeleton>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, skeleton);
|
||||
|
||||
skeleton->type = (SkeletonType)reader->ReadInt8();
|
||||
skeleton->limbType = (LimbType)reader->ReadInt8();
|
||||
skeleton->type = (SkeletonType)reader->ReadInt8();
|
||||
skeleton->limbType = (LimbType)reader->ReadInt8();
|
||||
skeleton->limbCount = reader->ReadUInt32();
|
||||
skeleton->dListCount = reader->ReadUInt32();
|
||||
skeleton->limbTableType = (LimbType)reader->ReadInt8();
|
||||
skeleton->limbTableCount = reader->ReadUInt32();
|
||||
skeleton->limbTableType = (LimbType)reader->ReadInt8();
|
||||
skeleton->limbTableCount = reader->ReadUInt32();
|
||||
|
||||
skeleton->limbTable.reserve(skeleton->limbTableCount);
|
||||
for (uint32_t i = 0; i < skeleton->limbTableCount; i++) {
|
||||
@ -48,18 +47,18 @@ void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
}
|
||||
|
||||
if (skeleton->type == Ship::SkeletonType::Curve) {
|
||||
skeleton->skeletonData.skelCurveLimbList.limbCount = skeleton->limbCount;
|
||||
skeleton->curveLimbArray.reserve(skeleton->skeletonData.skelCurveLimbList.limbCount);
|
||||
skeleton->skeletonData.skelCurveLimbList.limbCount = skeleton->limbCount;
|
||||
skeleton->curveLimbArray.reserve(skeleton->skeletonData.skelCurveLimbList.limbCount);
|
||||
} else if (skeleton->type == Ship::SkeletonType::Flex) {
|
||||
skeleton->skeletonData.flexSkeletonHeader.dListCount = skeleton->dListCount;
|
||||
skeleton->skeletonData.flexSkeletonHeader.dListCount = skeleton->dListCount;
|
||||
}
|
||||
|
||||
if (skeleton->type == Ship::SkeletonType::Normal) {
|
||||
skeleton->skeletonData.skeletonHeader.limbCount = skeleton->limbCount;
|
||||
skeleton->standardLimbArray.reserve(skeleton->skeletonData.skeletonHeader.limbCount);
|
||||
skeleton->standardLimbArray.reserve(skeleton->skeletonData.skeletonHeader.limbCount);
|
||||
} else if (skeleton->type == Ship::SkeletonType::Flex) {
|
||||
skeleton->skeletonData.flexSkeletonHeader.sh.limbCount = skeleton->limbCount;
|
||||
skeleton->standardLimbArray.reserve(skeleton->skeletonData.flexSkeletonHeader.sh.limbCount);
|
||||
skeleton->standardLimbArray.reserve(skeleton->skeletonData.flexSkeletonHeader.sh.limbCount);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < skeleton->limbTable.size(); i++) {
|
||||
|
@ -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
|
||||
|
@ -4,34 +4,33 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SkeletonLimbFactoryV0>();
|
||||
break;
|
||||
}
|
||||
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);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Skeleton Limb with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SkeletonLimb> skeletonLimb = std::static_pointer_cast<SkeletonLimb>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, skeletonLimb);
|
||||
std::shared_ptr<SkeletonLimb> skeletonLimb = std::static_pointer_cast<SkeletonLimb>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, skeletonLimb);
|
||||
|
||||
skeletonLimb->limbType = (LimbType)reader->ReadInt8();
|
||||
skeletonLimb->skinSegmentType = (ZLimbSkinType)reader->ReadInt8();
|
||||
@ -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();
|
||||
|
||||
|
@ -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
|
||||
|
@ -3,50 +3,47 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<TextFactoryV0>();
|
||||
break;
|
||||
default:
|
||||
// VERSION NOT SUPPORTED
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<TextFactoryV0>();
|
||||
break;
|
||||
default:
|
||||
// VERSION NOT SUPPORTED
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load Text with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Text with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::TextFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<Text> text = std::static_pointer_cast<Text>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, text);
|
||||
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);
|
||||
uint32_t msgCount = reader->ReadUInt32();
|
||||
text->messages.reserve(msgCount);
|
||||
|
||||
for (uint32_t i = 0; i < msgCount; i++)
|
||||
{
|
||||
MessageEntry entry;
|
||||
entry.id = reader->ReadUInt16();
|
||||
entry.textboxType = reader->ReadUByte();
|
||||
entry.textboxYPos = reader->ReadUByte();
|
||||
entry.msg = reader->ReadString();
|
||||
for (uint32_t i = 0; i < msgCount; i++) {
|
||||
MessageEntry entry;
|
||||
entry.id = reader->ReadUInt16();
|
||||
entry.textboxType = reader->ReadUByte();
|
||||
entry.textboxYPos = reader->ReadUByte();
|
||||
entry.msg = reader->ReadString();
|
||||
|
||||
text->messages.push_back(entry);
|
||||
}
|
||||
text->messages.push_back(entry);
|
||||
}
|
||||
}
|
||||
} // namespace Ship
|
||||
|
@ -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
|
||||
|
@ -3,36 +3,35 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<EndMarkerFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<EndMarkerFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load EndMarker with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load EndMarker with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::EndMarkerFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<EndMarker> endMarker = std::static_pointer_cast<EndMarker>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, endMarker);
|
||||
std::shared_ptr<EndMarker> endMarker = std::static_pointer_cast<EndMarker>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, endMarker);
|
||||
|
||||
ReadCommandId(endMarker, reader);
|
||||
ReadCommandId(endMarker, reader);
|
||||
|
||||
// This has no data.
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -3,50 +3,49 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetActorListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetActorListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetActorList with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetActorList with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SetActorListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetActorList> setActorList = std::static_pointer_cast<SetActorList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setActorList);
|
||||
std::shared_ptr<Resource> resource) {
|
||||
std::shared_ptr<SetActorList> setActorList = std::static_pointer_cast<SetActorList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setActorList);
|
||||
|
||||
ReadCommandId(setActorList, reader);
|
||||
ReadCommandId(setActorList, reader);
|
||||
|
||||
setActorList->numActors = reader->ReadUInt32();
|
||||
setActorList->actorList.reserve(setActorList->numActors);
|
||||
for (uint32_t i = 0; i < setActorList->numActors; i++) {
|
||||
ActorEntry entry;
|
||||
ActorEntry entry;
|
||||
|
||||
entry.id = reader->ReadUInt16();
|
||||
entry.pos.x = reader->ReadInt16();
|
||||
entry.pos.y = reader->ReadInt16();
|
||||
entry.pos.z = reader->ReadInt16();
|
||||
entry.rot.x = reader->ReadInt16();
|
||||
entry.rot.y = reader->ReadInt16();
|
||||
entry.rot.z = reader->ReadInt16();
|
||||
entry.params = reader->ReadUInt16();
|
||||
entry.id = reader->ReadUInt16();
|
||||
entry.pos.x = reader->ReadInt16();
|
||||
entry.pos.y = reader->ReadInt16();
|
||||
entry.pos.z = reader->ReadInt16();
|
||||
entry.rot.x = reader->ReadInt16();
|
||||
entry.rot.y = reader->ReadInt16();
|
||||
entry.rot.z = reader->ReadInt16();
|
||||
entry.params = reader->ReadUInt16();
|
||||
|
||||
setActorList->actorList.push_back(entry);
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -4,46 +4,46 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetAlternateHeadersFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetAlternateHeadersFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetAlternateHeaders with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetAlternateHeaders with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SetAlternateHeadersFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetAlternateHeaders> setAlternateHeaders = std::static_pointer_cast<SetAlternateHeaders>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setAlternateHeaders);
|
||||
std::shared_ptr<SetAlternateHeaders> setAlternateHeaders = std::static_pointer_cast<SetAlternateHeaders>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setAlternateHeaders);
|
||||
|
||||
ReadCommandId(setAlternateHeaders, reader);
|
||||
ReadCommandId(setAlternateHeaders, reader);
|
||||
|
||||
setAlternateHeaders->numHeaders = reader->ReadUInt32();
|
||||
setAlternateHeaders->headers.reserve(setAlternateHeaders->numHeaders);
|
||||
for (uint32_t i = 0; i < setAlternateHeaders->numHeaders; i++) {
|
||||
auto headerName = reader->ReadString();
|
||||
if (!headerName.empty()) {
|
||||
setAlternateHeaders->headers.push_back(std::static_pointer_cast<Ship::Scene>(LoadResource(headerName.c_str(), true)));
|
||||
} else {
|
||||
setAlternateHeaders->headers.push_back(nullptr);
|
||||
}
|
||||
auto headerName = reader->ReadString();
|
||||
if (!headerName.empty()) {
|
||||
setAlternateHeaders->headers.push_back(std::static_pointer_cast<Ship::Scene>(LoadResource(headerName.c_str(), true)));
|
||||
} else {
|
||||
setAlternateHeaders->headers.push_back(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -3,36 +3,35 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetCameraSettingsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetCameraSettingsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetCameraSettings with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetCameraSettings with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SetCameraSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetCameraSettings> setCameraSettings = std::static_pointer_cast<SetCameraSettings>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setCameraSettings);
|
||||
std::shared_ptr<SetCameraSettings> setCameraSettings = std::static_pointer_cast<SetCameraSettings>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setCameraSettings);
|
||||
|
||||
ReadCommandId(setCameraSettings, reader);
|
||||
ReadCommandId(setCameraSettings, reader);
|
||||
|
||||
setCameraSettings->settings.cameraMovement = reader->ReadInt8();
|
||||
setCameraSettings->settings.worldMapArea = reader->ReadInt32();
|
||||
|
@ -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 {
|
||||
|
@ -4,39 +4,37 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetCollisionHeaderFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetCollisionHeaderFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetCollisionHeader with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetCollisionHeader with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SetCollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetCollisionHeader> setCollisionHeader = std::static_pointer_cast<SetCollisionHeader>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setCollisionHeader);
|
||||
std::shared_ptr<Resource> resource) {
|
||||
std::shared_ptr<SetCollisionHeader> setCollisionHeader = std::static_pointer_cast<SetCollisionHeader>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setCollisionHeader);
|
||||
|
||||
ReadCommandId(setCollisionHeader, reader);
|
||||
|
||||
setCollisionHeader->fileName = reader->ReadString();
|
||||
setCollisionHeader->collisionHeader = std::static_pointer_cast<CollisionHeader>(LoadResource(setCollisionHeader->fileName.c_str(), true));
|
||||
ReadCommandId(setCollisionHeader, reader);
|
||||
|
||||
setCollisionHeader->fileName = reader->ReadString();
|
||||
setCollisionHeader->collisionHeader = std::static_pointer_cast<CollisionHeader>(LoadResource(setCollisionHeader->fileName.c_str(), true));
|
||||
}
|
||||
|
||||
} // namespace Ship
|
||||
|
@ -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 {
|
||||
|
@ -3,36 +3,34 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetCsCameraFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetCsCameraFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetCsCamera with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetCsCamera with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SetCsCameraFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetCsCamera> setCsCamera = std::static_pointer_cast<SetCsCamera>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setCsCamera);
|
||||
std::shared_ptr<Resource> resource) {
|
||||
std::shared_ptr<SetCsCamera> setCsCamera = std::static_pointer_cast<SetCsCamera>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setCsCamera);
|
||||
|
||||
ReadCommandId(setCsCamera, reader);
|
||||
ReadCommandId(setCsCamera, reader);
|
||||
|
||||
reader->ReadInt8(); // camSize
|
||||
reader->ReadInt32(); // segOffset
|
||||
|
@ -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 {
|
||||
|
@ -4,39 +4,38 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetCutscenesFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetCutscenesFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetCutscenes with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetCutscenes with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SetCutscenesFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetCutscenes> setCutscenes = std::static_pointer_cast<SetCutscenes>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setCutscenes);
|
||||
std::shared_ptr<Resource> resource) {
|
||||
std::shared_ptr<SetCutscenes> setCutscenes = std::static_pointer_cast<SetCutscenes>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setCutscenes);
|
||||
|
||||
ReadCommandId(setCutscenes, reader);
|
||||
|
||||
setCutscenes->fileName = reader->ReadString();
|
||||
setCutscenes->cutscene = std::static_pointer_cast<Cutscene>(LoadResource(setCutscenes->fileName.c_str(), true));
|
||||
ReadCommandId(setCutscenes, reader);
|
||||
|
||||
setCutscenes->fileName = reader->ReadString();
|
||||
setCutscenes->cutscene = std::static_pointer_cast<Cutscene>(LoadResource(setCutscenes->fileName.c_str(), true));
|
||||
}
|
||||
|
||||
} // namespace Ship
|
||||
|
@ -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 {
|
||||
|
@ -3,36 +3,35 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetEchoSettingsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetEchoSettingsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetEchoSettings with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetEchoSettings with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SetEchoSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetEchoSettings> setEchoSettings = std::static_pointer_cast<SetEchoSettings>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setEchoSettings);
|
||||
std::shared_ptr<SetEchoSettings> setEchoSettings = std::static_pointer_cast<SetEchoSettings>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setEchoSettings);
|
||||
|
||||
ReadCommandId(setEchoSettings, reader);
|
||||
ReadCommandId(setEchoSettings, reader);
|
||||
|
||||
setEchoSettings->settings.echo = reader->ReadInt8();
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -3,44 +3,42 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetEntranceListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetEntranceListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetEntranceListList with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetEntranceListList with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SetEntranceListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetEntranceList> setEntranceList = std::static_pointer_cast<SetEntranceList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setEntranceList);
|
||||
std::shared_ptr<Resource> resource) {
|
||||
std::shared_ptr<SetEntranceList> setEntranceList = std::static_pointer_cast<SetEntranceList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setEntranceList);
|
||||
|
||||
ReadCommandId(setEntranceList, reader);
|
||||
ReadCommandId(setEntranceList, reader);
|
||||
|
||||
setEntranceList->numEntrances = reader->ReadUInt32();
|
||||
setEntranceList->entrances.reserve(setEntranceList->numEntrances);
|
||||
for (uint32_t i = 0; i < setEntranceList->numEntrances; i++) {
|
||||
EntranceEntry entranceEntry;
|
||||
EntranceEntry entranceEntry;
|
||||
|
||||
entranceEntry.spawn = reader->ReadInt8();
|
||||
entranceEntry.room = reader->ReadInt8();
|
||||
entranceEntry.spawn = reader->ReadInt8();
|
||||
entranceEntry.room = reader->ReadInt8();
|
||||
|
||||
setEntranceList->entrances.push_back(entranceEntry);
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -3,36 +3,34 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetExitListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetExitListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetExitList with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetExitList with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SetExitListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetExitList> setExitList = std::static_pointer_cast<SetExitList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setExitList);
|
||||
std::shared_ptr<Resource> resource) {
|
||||
std::shared_ptr<SetExitList> setExitList = std::static_pointer_cast<SetExitList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setExitList);
|
||||
|
||||
ReadCommandId(setExitList, reader);
|
||||
ReadCommandId(setExitList, reader);
|
||||
|
||||
setExitList->numExits = reader->ReadUInt32();
|
||||
setExitList->exits.reserve(setExitList->numExits);
|
||||
|
@ -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 {
|
||||
|
@ -3,45 +3,45 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetLightListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetLightListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetLightList with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetLightList with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SetLightListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetLightList> setLightList = std::static_pointer_cast<SetLightList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setLightList);
|
||||
std::shared_ptr<SetLightList> setLightList = std::static_pointer_cast<SetLightList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setLightList);
|
||||
|
||||
ReadCommandId(setLightList, reader);
|
||||
|
||||
setLightList->numLights = reader->ReadUInt32();
|
||||
ReadCommandId(setLightList, reader);
|
||||
|
||||
setLightList->numLights = reader->ReadUInt32();
|
||||
setLightList->lightList.reserve(setLightList->numLights);
|
||||
for (uint32_t i = 0; i < setLightList->numLights; i++) {
|
||||
LightInfo light;
|
||||
|
||||
light.type = reader->ReadUByte();
|
||||
|
||||
light.params.point.x = reader->ReadInt16();
|
||||
light.params.point.x = reader->ReadInt16();
|
||||
light.params.point.y = reader->ReadInt16();
|
||||
light.params.point.z = reader->ReadInt16();
|
||||
|
||||
@ -50,7 +50,7 @@ void Ship::SetLightListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader>
|
||||
light.params.point.color[2] = reader->ReadUByte(); // b
|
||||
|
||||
light.params.point.drawGlow = reader->ReadUByte();
|
||||
light.params.point.radius = reader->ReadInt16();
|
||||
light.params.point.radius = reader->ReadInt16();
|
||||
|
||||
setLightList->lightList.push_back(light);
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -3,42 +3,41 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetLightingSettingsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetLightingSettingsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetLightingSettings with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetLightingSettings with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SetLightingSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetLightingSettings> setLightingSettings = std::static_pointer_cast<SetLightingSettings>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setLightingSettings);
|
||||
std::shared_ptr<SetLightingSettings> setLightingSettings = std::static_pointer_cast<SetLightingSettings>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setLightingSettings);
|
||||
|
||||
ReadCommandId(setLightingSettings, reader);
|
||||
ReadCommandId(setLightingSettings, reader);
|
||||
|
||||
uint32_t count = reader->ReadInt32();
|
||||
uint32_t count = reader->ReadInt32();
|
||||
setLightingSettings->settings.reserve(count);
|
||||
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
EnvLightSettings lightSettings;
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
EnvLightSettings lightSettings;
|
||||
lightSettings.ambientColor[0] = reader->ReadInt8();
|
||||
lightSettings.ambientColor[1] = reader->ReadInt8();
|
||||
lightSettings.ambientColor[2] = reader->ReadInt8();
|
||||
@ -65,8 +64,8 @@ void Ship::SetLightingSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryR
|
||||
|
||||
lightSettings.fogNear = reader->ReadInt16();
|
||||
lightSettings.fogFar = reader->ReadUInt16();
|
||||
setLightingSettings->settings.push_back(lightSettings);
|
||||
}
|
||||
setLightingSettings->settings.push_back(lightSettings);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Ship
|
||||
|
@ -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 {
|
||||
|
@ -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();
|
||||
|
@ -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 {
|
||||
|
@ -3,36 +3,35 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetObjectListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetObjectListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetObjectList with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetObjectList with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SetObjectListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetObjectList> setObjectList = std::static_pointer_cast<SetObjectList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setObjectList);
|
||||
std::shared_ptr<SetObjectList> setObjectList = std::static_pointer_cast<SetObjectList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setObjectList);
|
||||
|
||||
ReadCommandId(setObjectList, reader);
|
||||
ReadCommandId(setObjectList, reader);
|
||||
|
||||
setObjectList->numObjects = reader->ReadUInt32();
|
||||
setObjectList->objects.reserve(setObjectList->numObjects);
|
||||
|
@ -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 {
|
||||
|
@ -4,36 +4,34 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetPathwaysFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetPathwaysFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetPathways with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetPathways with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SetPathwaysFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetPathways> setPathways = std::static_pointer_cast<SetPathways>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setPathways);
|
||||
std::shared_ptr<Resource> resource) {
|
||||
std::shared_ptr<SetPathways> setPathways = std::static_pointer_cast<SetPathways>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setPathways);
|
||||
|
||||
ReadCommandId(setPathways, reader);
|
||||
ReadCommandId(setPathways, reader);
|
||||
|
||||
setPathways->numPaths = reader->ReadUInt32();
|
||||
setPathways->paths.reserve(setPathways->numPaths);
|
||||
|
@ -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 {
|
||||
|
@ -3,36 +3,34 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetRoomBehaviorFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetRoomBehaviorFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetRoomBehavior with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetRoomBehavior with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SetRoomBehaviorFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetRoomBehavior> setRoomBehavior = std::static_pointer_cast<SetRoomBehavior>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setRoomBehavior);
|
||||
std::shared_ptr<Resource> resource) {
|
||||
std::shared_ptr<SetRoomBehavior> setRoomBehavior = std::static_pointer_cast<SetRoomBehavior>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setRoomBehavior);
|
||||
|
||||
ReadCommandId(setRoomBehavior, reader);
|
||||
ReadCommandId(setRoomBehavior, reader);
|
||||
|
||||
setRoomBehavior->roomBehavior.gameplayFlags = reader->ReadInt8();
|
||||
setRoomBehavior->roomBehavior.gameplayFlags2 = reader->ReadInt32();
|
||||
|
@ -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 {
|
||||
|
@ -3,47 +3,46 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetRoomListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetRoomListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetRoomList with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetRoomList with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SetRoomListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetRoomList> setRoomList = std::static_pointer_cast<SetRoomList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setRoomList);
|
||||
std::shared_ptr<Resource> resource) {
|
||||
std::shared_ptr<SetRoomList> setRoomList = std::static_pointer_cast<SetRoomList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setRoomList);
|
||||
|
||||
ReadCommandId(setRoomList, reader);
|
||||
ReadCommandId(setRoomList, reader);
|
||||
|
||||
setRoomList->numRooms = reader->ReadInt32();
|
||||
setRoomList->rooms.reserve(setRoomList->numRooms);
|
||||
for (uint32_t i = 0; i < setRoomList->numRooms; i++) {
|
||||
RomFile room;
|
||||
RomFile room;
|
||||
|
||||
setRoomList->fileNames.push_back(reader->ReadString());
|
||||
setRoomList->fileNames.push_back(reader->ReadString());
|
||||
|
||||
room.fileName = (char*)setRoomList->fileNames.back().c_str();
|
||||
room.vromStart = reader->ReadInt32();
|
||||
room.vromEnd = reader->ReadInt32();
|
||||
room.fileName = (char*)setRoomList->fileNames.back().c_str();
|
||||
room.vromStart = reader->ReadInt32();
|
||||
room.vromEnd = reader->ReadInt32();
|
||||
|
||||
setRoomList->rooms.push_back(room);
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -3,32 +3,30 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetSkyboxModifierFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetSkyboxModifierFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetSkyboxModifier with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetSkyboxModifier with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -3,39 +3,37 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetSkyboxSettingsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetSkyboxSettingsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetSkyboxSettings with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetSkyboxSettings with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void SetSkyboxSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetSkyboxSettings> setSkyboxSettings = std::static_pointer_cast<SetSkyboxSettings>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setSkyboxSettings);
|
||||
std::shared_ptr<Resource> resource) {
|
||||
std::shared_ptr<SetSkyboxSettings> setSkyboxSettings = std::static_pointer_cast<SetSkyboxSettings>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setSkyboxSettings);
|
||||
|
||||
ReadCommandId(setSkyboxSettings, reader);
|
||||
ReadCommandId(setSkyboxSettings, reader);
|
||||
|
||||
setSkyboxSettings->settings.unk = reader->ReadInt8();
|
||||
setSkyboxSettings->settings.skyboxId = reader->ReadInt8();
|
||||
setSkyboxSettings->settings.skyboxId = reader->ReadInt8();
|
||||
setSkyboxSettings->settings.weather = reader->ReadInt8();
|
||||
setSkyboxSettings->settings.indoors = reader->ReadInt8();
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -3,36 +3,34 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetSoundSettingsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetSoundSettingsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetSoundSettings with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetSoundSettings with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SetSoundSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetSoundSettings> setSoundSettings = std::static_pointer_cast<SetSoundSettings>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setSoundSettings);
|
||||
std::shared_ptr<Resource> resource) {
|
||||
std::shared_ptr<SetSoundSettings> setSoundSettings = std::static_pointer_cast<SetSoundSettings>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setSoundSettings);
|
||||
|
||||
ReadCommandId(setSoundSettings, reader);
|
||||
ReadCommandId(setSoundSettings, reader);
|
||||
|
||||
setSoundSettings->settings.reverb = reader->ReadInt8();
|
||||
setSoundSettings->settings.natureAmbienceId = reader->ReadInt8();
|
||||
|
@ -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 {
|
||||
|
@ -3,39 +3,37 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetSpecialObjectsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetSpecialObjectsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetSpecialObjects with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr){
|
||||
SPDLOG_ERROR("Failed to load SetSpecialObjects with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SetSpecialObjectsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetSpecialObjects> setSpecialObjects = std::static_pointer_cast<SetSpecialObjects>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setSpecialObjects);
|
||||
std::shared_ptr<Resource> resource) {
|
||||
std::shared_ptr<SetSpecialObjects> setSpecialObjects = std::static_pointer_cast<SetSpecialObjects>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setSpecialObjects);
|
||||
|
||||
ReadCommandId(setSpecialObjects, reader);
|
||||
|
||||
setSpecialObjects->specialObjects.elfMessage = reader->ReadInt8();
|
||||
setSpecialObjects->specialObjects.globalObject = reader->ReadInt16();
|
||||
ReadCommandId(setSpecialObjects, reader);
|
||||
|
||||
setSpecialObjects->specialObjects.elfMessage = reader->ReadInt8();
|
||||
setSpecialObjects->specialObjects.globalObject = reader->ReadInt16();
|
||||
}
|
||||
|
||||
} // namespace Ship
|
||||
|
@ -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 {
|
||||
|
@ -3,50 +3,51 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetStartPositionListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetStartPositionListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetStartPositionList with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetStartPositionList with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SetStartPositionListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetStartPositionList> setStartPositionList = std::static_pointer_cast<SetStartPositionList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setStartPositionList);
|
||||
std::shared_ptr<SetStartPositionList> setStartPositionList = std::static_pointer_cast<SetStartPositionList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setStartPositionList);
|
||||
|
||||
ReadCommandId(setStartPositionList, reader);
|
||||
ReadCommandId(setStartPositionList, reader);
|
||||
|
||||
setStartPositionList->numStartPositions = reader->ReadUInt32();
|
||||
setStartPositionList->startPositions.reserve(setStartPositionList->numStartPositions);
|
||||
for (uint32_t i = 0; i < setStartPositionList->numStartPositions; i++) {
|
||||
ActorEntry entry;
|
||||
ActorEntry entry;
|
||||
|
||||
entry.id = reader->ReadUInt16();
|
||||
entry.pos.x = reader->ReadInt16();
|
||||
entry.pos.y = reader->ReadInt16();
|
||||
entry.pos.z = reader->ReadInt16();
|
||||
entry.rot.x = reader->ReadInt16();
|
||||
entry.rot.y = reader->ReadInt16();
|
||||
entry.rot.z = reader->ReadInt16();
|
||||
entry.params = reader->ReadUInt16();
|
||||
entry.id = reader->ReadUInt16();
|
||||
entry.pos.x = reader->ReadInt16();
|
||||
entry.pos.y = reader->ReadInt16();
|
||||
entry.pos.z = reader->ReadInt16();
|
||||
entry.rot.x = reader->ReadInt16();
|
||||
entry.rot.y = reader->ReadInt16();
|
||||
entry.rot.z = reader->ReadInt16();
|
||||
entry.params = reader->ReadUInt16();
|
||||
|
||||
setStartPositionList->startPositions.push_back(entry);
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -3,40 +3,38 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetTimeSettingsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetTimeSettingsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetTimeSettings with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetTimeSettings with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SetTimeSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetTimeSettings> setTimeSettings = std::static_pointer_cast<SetTimeSettings>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setTimeSettings);
|
||||
std::shared_ptr<Resource> resource) {
|
||||
std::shared_ptr<SetTimeSettings> setTimeSettings = std::static_pointer_cast<SetTimeSettings>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setTimeSettings);
|
||||
|
||||
ReadCommandId(setTimeSettings, reader);
|
||||
|
||||
setTimeSettings->settings.hour = reader->ReadInt8();
|
||||
setTimeSettings->settings.minute = reader->ReadInt8();
|
||||
setTimeSettings->settings.timeIncrement = reader->ReadInt8();
|
||||
ReadCommandId(setTimeSettings, reader);
|
||||
|
||||
setTimeSettings->settings.hour = reader->ReadInt8();
|
||||
setTimeSettings->settings.minute = reader->ReadInt8();
|
||||
setTimeSettings->settings.timeIncrement = reader->ReadInt8();
|
||||
}
|
||||
|
||||
} // namespace Ship
|
||||
|
@ -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 {
|
||||
|
@ -3,41 +3,39 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetTransitionActorListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetTransitionActorListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetTransitionActorList with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetTransitionActorList with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SetTransitionActorListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetTransitionActorList> setTransitionActorList = std::static_pointer_cast<SetTransitionActorList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setTransitionActorList);
|
||||
std::shared_ptr<Resource> resource) {
|
||||
std::shared_ptr<SetTransitionActorList> setTransitionActorList = std::static_pointer_cast<SetTransitionActorList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setTransitionActorList);
|
||||
|
||||
ReadCommandId(setTransitionActorList, reader);
|
||||
ReadCommandId(setTransitionActorList, reader);
|
||||
|
||||
setTransitionActorList->numTransitionActors = reader->ReadUInt32();
|
||||
setTransitionActorList->transitionActorList.reserve(setTransitionActorList->numTransitionActors);
|
||||
for (uint32_t i = 0; i < setTransitionActorList->numTransitionActors; i++) {
|
||||
TransitionActorEntry entry;
|
||||
TransitionActorEntry entry;
|
||||
|
||||
entry.sides[0].room = reader->ReadUByte();
|
||||
entry.sides[0].effects = reader->ReadUByte();
|
||||
|
@ -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 {
|
||||
|
@ -3,38 +3,36 @@
|
||||
#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<ResourceVersionFactory> factory = nullptr;
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetWindSettingsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
switch (resource->InitData->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetWindSettingsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetWindSettings with version {}", version);
|
||||
return nullptr;
|
||||
}
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetWindSettings with version {}", resource->InitData->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void Ship::SetWindSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<Resource> resource)
|
||||
{
|
||||
std::shared_ptr<SetWindSettings> setWind = std::static_pointer_cast<SetWindSettings>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setWind);
|
||||
std::shared_ptr<Resource> resource) {
|
||||
std::shared_ptr<SetWindSettings> setWind = std::static_pointer_cast<SetWindSettings>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setWind);
|
||||
|
||||
ReadCommandId(setWind, reader);
|
||||
|
||||
setWind->settings.windWest = reader->ReadInt8();
|
||||
ReadCommandId(setWind, reader);
|
||||
|
||||
setWind->settings.windWest = reader->ReadInt8();
|
||||
setWind->settings.windVertical = reader->ReadInt8();
|
||||
setWind->settings.windSouth = reader->ReadInt8();
|
||||
setWind->settings.windSpeed = reader->ReadUByte();
|
||||
|
@ -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 {
|
||||
|
@ -65,6 +65,8 @@ namespace Ship {
|
||||
|
||||
class Animation : public Resource {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
void* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
|
@ -41,6 +41,8 @@ namespace Ship {
|
||||
|
||||
class AudioSample : public Resource {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
void* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
|
@ -19,6 +19,8 @@ typedef struct {
|
||||
|
||||
class AudioSequence : public Resource {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
void* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
|
@ -54,6 +54,8 @@ typedef struct {
|
||||
|
||||
class AudioSoundFont : public Resource {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
void* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
|
@ -5,6 +5,8 @@
|
||||
namespace Ship {
|
||||
class Background : public Resource {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
void* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
|
@ -69,6 +69,8 @@ typedef struct {
|
||||
|
||||
class CollisionHeader : public Resource {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
void* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
|
@ -46,6 +46,8 @@ enum class CutsceneCommands {
|
||||
|
||||
class Cutscene : public Resource {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
void* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
|
@ -15,6 +15,8 @@ typedef struct {
|
||||
|
||||
class Path : public Resource {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
void* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
|
@ -11,6 +11,8 @@ namespace Ship {
|
||||
|
||||
class PlayerAnimation : public Resource {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
void* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
|
@ -11,6 +11,8 @@ namespace Ship {
|
||||
|
||||
class Scene : public Resource {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
void* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
|
@ -50,6 +50,8 @@ union SkeletonData {
|
||||
|
||||
class Skeleton : public Resource {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
void* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
|
@ -99,6 +99,8 @@ union SkeletonLimbData {
|
||||
|
||||
class SkeletonLimb : public Resource {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
void* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
|
@ -18,6 +18,8 @@ public:
|
||||
|
||||
class Text : public Resource {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
void* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
|
@ -14,6 +14,8 @@ typedef struct {
|
||||
|
||||
class EndMarker : public SceneCommand {
|
||||
public:
|
||||
using SceneCommand::SceneCommand;
|
||||
|
||||
void* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
|
@ -49,6 +49,7 @@ enum class SceneCommandID : uint8_t {
|
||||
|
||||
class SceneCommand : public Resource {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
SceneCommandID cmdId;
|
||||
};
|
||||
|
||||
|
@ -19,6 +19,8 @@ typedef struct {
|
||||
|
||||
class SetActorList : public SceneCommand {
|
||||
public:
|
||||
using SceneCommand::SceneCommand;
|
||||
|
||||
void* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
|
@ -15,6 +15,8 @@ namespace Ship {
|
||||
|
||||
class SetAlternateHeaders : public SceneCommand {
|
||||
public:
|
||||
using SceneCommand::SceneCommand;
|
||||
|
||||
void* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
|
@ -15,6 +15,8 @@ typedef struct {
|
||||
|
||||
class SetCameraSettings : public SceneCommand {
|
||||
public:
|
||||
using SceneCommand::SceneCommand;
|
||||
|
||||
void* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
namespace Ship {
|
||||
class SetCollisionHeader : public SceneCommand {
|
||||
public:
|
||||
using SceneCommand::SceneCommand;
|
||||
|
||||
void* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
|
@ -14,6 +14,8 @@ typedef struct {
|
||||
|
||||
class SetCsCamera : public SceneCommand {
|
||||
public:
|
||||
using SceneCommand::SceneCommand;
|
||||
|
||||
void* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
namespace Ship {
|
||||
class SetCutscenes : public SceneCommand {
|
||||
public:
|
||||
using SceneCommand::SceneCommand;
|
||||
|
||||
void* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
|
@ -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
Loading…
Reference in New Issue
Block a user