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));
|
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 {
|
struct ExtensionEntry {
|
||||||
std::string path;
|
std::string path;
|
||||||
std::string ext;
|
std::string ext;
|
||||||
|
@ -686,7 +682,7 @@ extern "C" uint32_t GetGIID(uint32_t itemID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void OTRExtScanner() {
|
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) {
|
for (auto& rPath : lst) {
|
||||||
std::vector<std::string> raw = StringHelper::Split(rPath, ".");
|
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...
|
// OTRTODO: There is probably a more elegant way to go about this...
|
||||||
extern "C" char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize) {
|
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*));
|
char** result = (char**)malloc(lst->size() * sizeof(char*));
|
||||||
|
|
||||||
for (size_t i = 0; i < lst->size(); i++) {
|
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) {
|
extern "C" char* ResourceMgr_LoadTexOrDListByName(const char* filePath) {
|
||||||
auto res = GetResourceByNameHandlingMQ(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]);
|
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();
|
return (char*)(std::static_pointer_cast<Ship::Array>(res))->Vertices.data();
|
||||||
else {
|
else {
|
||||||
return (char*)GetResourceDataByNameHandlingMQ(filePath);
|
return (char*)GetResourceDataByNameHandlingMQ(filePath);
|
||||||
|
|
|
@ -3,18 +3,20 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> AnimationFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader) {
|
std::shared_ptr<Resource> AnimationFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
auto resource = std::make_shared<Animation>();
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
|
auto resource = std::make_shared<Animation>(resourceMgr, initData);
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version) {
|
switch (resource->InitData->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<AnimationFactoryV0>();
|
factory = std::make_shared<AnimationFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
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;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class AnimationFactory : public ResourceFactory {
|
class AnimationFactory : public ResourceFactory {
|
||||||
public:
|
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 {
|
class AnimationFactoryV0 : public ResourceVersionFactory {
|
||||||
|
|
|
@ -3,34 +3,33 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> AudioSampleFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> AudioSampleFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<AudioSample>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<AudioSample>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 2:
|
||||||
case 2:
|
factory = std::make_shared<AudioSampleFactoryV0>();
|
||||||
factory = std::make_shared<AudioSampleFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load AudioSample with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load AudioSample with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::AudioSampleFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::AudioSampleFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<AudioSample> audioSample = std::static_pointer_cast<AudioSample>(resource);
|
std::shared_ptr<AudioSample> audioSample = std::static_pointer_cast<AudioSample>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, audioSample);
|
ResourceVersionFactory::ParseFileBinary(reader, audioSample);
|
||||||
|
|
||||||
audioSample->sample.codec = reader->ReadUByte();
|
audioSample->sample.codec = reader->ReadUByte();
|
||||||
audioSample->sample.medium = reader->ReadUByte();
|
audioSample->sample.medium = reader->ReadUByte();
|
||||||
|
|
|
@ -7,7 +7,9 @@ namespace Ship {
|
||||||
class AudioSampleFactory : public ResourceFactory
|
class AudioSampleFactory : public ResourceFactory
|
||||||
{
|
{
|
||||||
public:
|
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
|
class AudioSampleFactoryV0 : public ResourceVersionFactory
|
||||||
|
|
|
@ -3,34 +3,33 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> AudioSequenceFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> AudioSequenceFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<AudioSequence>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<AudioSequence>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 2:
|
||||||
case 2:
|
factory = std::make_shared<AudioSequenceFactoryV0>();
|
||||||
factory = std::make_shared<AudioSequenceFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr)
|
||||||
{
|
{
|
||||||
SPDLOG_ERROR("Failed to load AudioSequence with version {}", version);
|
SPDLOG_ERROR("Failed to load AudioSequence with version {}", resource->InitData->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::AudioSequenceFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::AudioSequenceFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource) {
|
||||||
{
|
std::shared_ptr<AudioSequence> audioSequence = std::static_pointer_cast<AudioSequence>(resource);
|
||||||
std::shared_ptr<AudioSequence> audioSequence = std::static_pointer_cast<AudioSequence>(resource);
|
ResourceVersionFactory::ParseFileBinary(reader, audioSequence);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, audioSequence);
|
|
||||||
|
|
||||||
audioSequence->sequence.seqDataSize = reader->ReadInt32();
|
audioSequence->sequence.seqDataSize = reader->ReadInt32();
|
||||||
audioSequence->sequenceData.reserve(audioSequence->sequence.seqDataSize);
|
audioSequence->sequenceData.reserve(audioSequence->sequence.seqDataSize);
|
||||||
|
|
|
@ -7,7 +7,9 @@ namespace Ship {
|
||||||
class AudioSequenceFactory : public ResourceFactory
|
class AudioSequenceFactory : public ResourceFactory
|
||||||
{
|
{
|
||||||
public:
|
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
|
class AudioSequenceFactoryV0 : public ResourceVersionFactory
|
||||||
|
|
|
@ -4,34 +4,33 @@
|
||||||
#include "libultraship/bridge.h"
|
#include "libultraship/bridge.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> AudioSoundFontFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> AudioSoundFontFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<AudioSoundFont>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<AudioSoundFont>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 2:
|
||||||
case 2:
|
factory = std::make_shared<AudioSoundFontFactoryV0>();
|
||||||
factory = std::make_shared<AudioSoundFontFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr)
|
||||||
{
|
{
|
||||||
SPDLOG_ERROR("Failed to load AudioSoundFont with version {}", version);
|
SPDLOG_ERROR("Failed to load AudioSoundFont with version {}", resource->InitData->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource) {
|
||||||
{
|
std::shared_ptr<AudioSoundFont> audioSoundFont = std::static_pointer_cast<AudioSoundFont>(resource);
|
||||||
std::shared_ptr<AudioSoundFont> audioSoundFont = std::static_pointer_cast<AudioSoundFont>(resource);
|
ResourceVersionFactory::ParseFileBinary(reader, audioSoundFont);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, audioSoundFont);
|
|
||||||
|
|
||||||
audioSoundFont->soundFont.fntIndex = reader->ReadInt32();
|
audioSoundFont->soundFont.fntIndex = reader->ReadInt32();
|
||||||
audioSoundFont->medium = reader->ReadInt8();
|
audioSoundFont->medium = reader->ReadInt8();
|
||||||
|
|
|
@ -7,7 +7,9 @@ namespace Ship {
|
||||||
class AudioSoundFontFactory : public ResourceFactory
|
class AudioSoundFontFactory : public ResourceFactory
|
||||||
{
|
{
|
||||||
public:
|
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
|
class AudioSoundFontFactoryV0 : public ResourceVersionFactory
|
||||||
|
|
|
@ -3,18 +3,20 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> BackgroundFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader) {
|
std::shared_ptr<Resource> BackgroundFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
auto resource = std::make_shared<Background>();
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
|
auto resource = std::make_shared<Background>(resourceMgr, initData);
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version) {
|
switch (resource->InitData->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<BackgroundFactoryV0>();
|
factory = std::make_shared<BackgroundFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
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;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class BackgroundFactory : public ResourceFactory {
|
class BackgroundFactory : public ResourceFactory {
|
||||||
public:
|
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 {
|
class BackgroundFactoryV0 : public ResourceVersionFactory {
|
||||||
|
|
|
@ -3,34 +3,33 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> CollisionHeaderFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> CollisionHeaderFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<CollisionHeader>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<CollisionHeader>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<CollisionHeaderFactoryV0>();
|
||||||
factory = std::make_shared<CollisionHeaderFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load Collision Header with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load Collision Header with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::CollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::CollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<CollisionHeader> collisionHeader = std::static_pointer_cast<CollisionHeader>(resource);
|
std::shared_ptr<CollisionHeader> collisionHeader = std::static_pointer_cast<CollisionHeader>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, collisionHeader);
|
ResourceVersionFactory::ParseFileBinary(reader, collisionHeader);
|
||||||
|
|
||||||
collisionHeader->collisionHeaderData.minBounds.x = reader->ReadInt16();
|
collisionHeader->collisionHeaderData.minBounds.x = reader->ReadInt16();
|
||||||
collisionHeader->collisionHeaderData.minBounds.y = reader->ReadInt16();
|
collisionHeader->collisionHeaderData.minBounds.y = reader->ReadInt16();
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class CollisionHeaderFactory : public ResourceFactory {
|
class CollisionHeaderFactory : public ResourceFactory {
|
||||||
public:
|
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 {
|
class CollisionHeaderFactoryV0 : public ResourceVersionFactory {
|
||||||
|
|
|
@ -3,27 +3,26 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> CutsceneFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> CutsceneFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<Cutscene>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<Cutscene>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<CutsceneFactoryV0>();
|
||||||
factory = std::make_shared<CutsceneFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load Cutscene with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load Cutscene with version {}", version);
|
return nullptr;
|
||||||
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) {
|
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,
|
void Ship::CutsceneFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<Cutscene> cutscene = std::static_pointer_cast<Cutscene>(resource);
|
std::shared_ptr<Cutscene> cutscene = std::static_pointer_cast<Cutscene>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, cutscene);
|
ResourceVersionFactory::ParseFileBinary(reader, cutscene);
|
||||||
|
|
||||||
uint32_t numEntries = reader->ReadUInt32();
|
uint32_t numEntries = reader->ReadUInt32();
|
||||||
cutscene->commands.reserve(numEntries);
|
cutscene->commands.reserve(numEntries);
|
||||||
|
|
||||||
cutscene->numCommands = reader->ReadUInt32();
|
cutscene->numCommands = reader->ReadUInt32();
|
||||||
|
|
|
@ -7,7 +7,9 @@ namespace Ship {
|
||||||
class CutsceneFactory : public ResourceFactory
|
class CutsceneFactory : public ResourceFactory
|
||||||
{
|
{
|
||||||
public:
|
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
|
class CutsceneFactoryV0 : public ResourceVersionFactory
|
||||||
|
|
|
@ -3,34 +3,32 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> PathFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> PathFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<Path>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<Path>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<PathFactoryV0>();
|
||||||
factory = std::make_shared<PathFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load Path with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load Path with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::PathFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::PathFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource) {
|
||||||
{
|
std::shared_ptr<Path> path = std::static_pointer_cast<Path>(resource);
|
||||||
std::shared_ptr<Path> path = std::static_pointer_cast<Path>(resource);
|
ResourceVersionFactory::ParseFileBinary(reader, path);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, path);
|
|
||||||
|
|
||||||
path->numPaths = reader->ReadUInt32();
|
path->numPaths = reader->ReadUInt32();
|
||||||
path->paths.reserve(path->numPaths);
|
path->paths.reserve(path->numPaths);
|
||||||
|
|
|
@ -7,7 +7,9 @@ namespace Ship {
|
||||||
class PathFactory : public ResourceFactory
|
class PathFactory : public ResourceFactory
|
||||||
{
|
{
|
||||||
public:
|
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
|
class PathFactoryV0 : public ResourceVersionFactory
|
||||||
|
|
|
@ -3,36 +3,36 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> PlayerAnimationFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> PlayerAnimationFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<PlayerAnimation>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<PlayerAnimation>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<PlayerAnimationFactoryV0>();
|
||||||
factory = std::make_shared<PlayerAnimationFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr)
|
||||||
{
|
{
|
||||||
SPDLOG_ERROR("Failed to load PlayerAnimation with version {}", version);
|
SPDLOG_ERROR("Failed to load PlayerAnimation with version {}", resource->InitData->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::PlayerAnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::PlayerAnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<PlayerAnimation> playerAnimation = std::static_pointer_cast<PlayerAnimation>(resource);
|
std::shared_ptr<PlayerAnimation> playerAnimation = std::static_pointer_cast<PlayerAnimation>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, playerAnimation);
|
ResourceVersionFactory::ParseFileBinary(reader, playerAnimation);
|
||||||
|
|
||||||
uint32_t numEntries = reader->ReadUInt32();
|
uint32_t numEntries = reader->ReadUInt32();
|
||||||
playerAnimation->limbRotData.reserve(numEntries);
|
playerAnimation->limbRotData.reserve(numEntries);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < numEntries; i++) {
|
for (uint32_t i = 0; i < numEntries; i++) {
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class PlayerAnimationFactory : public ResourceFactory {
|
class PlayerAnimationFactory : public ResourceFactory {
|
||||||
public:
|
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 {
|
class PlayerAnimationFactoryV0 : public ResourceVersionFactory {
|
||||||
|
|
|
@ -30,14 +30,15 @@
|
||||||
|
|
||||||
namespace Ship {
|
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()) {
|
if (SceneFactory::sceneCommandFactories.empty()) {
|
||||||
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetLightingSettings] = std::make_shared<SetLightingSettingsFactory>();
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetLightingSettings] = std::make_shared<SetLightingSettingsFactory>();
|
||||||
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetWind] = std::make_shared<SetWindSettingsFactory>();
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetWind] = std::make_shared<SetWindSettingsFactory>();
|
||||||
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetExitList] = std::make_shared<SetExitListFactory>();
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetExitList] = std::make_shared<SetExitListFactory>();
|
||||||
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetTimeSettings] = std::make_shared<SetTimeSettingsFactory>();
|
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::SetEchoSettings] = std::make_shared<SetEchoSettingsFactory>();
|
||||||
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetSoundSettings] = std::make_shared<SetSoundSettingsFactory>();
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetSoundSettings] = std::make_shared<SetSoundSettingsFactory>();
|
||||||
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetSkyboxSettings] = std::make_shared<SetSkyboxSettingsFactory>();
|
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>();
|
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetMesh] = std::make_shared<SetMeshFactory>();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto resource = std::make_shared<Scene>();
|
auto resource = std::make_shared<Scene>(resourceMgr, initData);
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
resource->ResourceVersion = version;
|
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SceneFactoryV0>();
|
||||||
factory = std::make_shared<SceneFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load Scene with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load Scene with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void SceneFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<Scene> scene = std::static_pointer_cast<Scene>(resource);
|
std::shared_ptr<Scene> scene = std::static_pointer_cast<Scene>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, scene);
|
ResourceVersionFactory::ParseFileBinary(reader, scene);
|
||||||
|
|
||||||
uint32_t commandCount = reader->ReadUInt32();
|
ParseSceneCommands(scene, reader);
|
||||||
scene->commands.reserve(commandCount);
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < commandCount; i++) {
|
|
||||||
scene->commands.push_back(ParseSceneCommand(resource->ResourceVersion, 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();
|
SceneCommandID cmdID = (SceneCommandID)reader->ReadInt32();
|
||||||
|
|
||||||
reader->Seek(-sizeof(int32_t), SeekOffsetType::Current);
|
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];
|
std::shared_ptr<SceneCommandFactory> commandFactory = SceneFactory::sceneCommandFactories[cmdID];
|
||||||
|
|
||||||
if (commandFactory != nullptr) {
|
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) {
|
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;
|
return result;
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SceneFactory : public ResourceFactory {
|
class SceneFactory : public ResourceFactory {
|
||||||
public:
|
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.
|
// Doing something very similar to what we do on the ResourceLoader.
|
||||||
// Eventually, scene commands should be moved up to the ResourceLoader as well.
|
// Eventually, scene commands should be moved up to the ResourceLoader as well.
|
||||||
|
@ -21,6 +23,8 @@ class SceneFactory : public ResourceFactory {
|
||||||
class SceneFactoryV0 : public ResourceVersionFactory {
|
class SceneFactoryV0 : public ResourceVersionFactory {
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
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
|
}; // namespace Ship
|
||||||
|
|
|
@ -4,27 +4,26 @@
|
||||||
#include <libultraship/bridge.h>
|
#include <libultraship/bridge.h>
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SkeletonFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SkeletonFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<Skeleton>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<Skeleton>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SkeletonFactoryV0>();
|
||||||
factory = std::make_shared<SkeletonFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load Skeleton with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load Skeleton with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
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);
|
std::shared_ptr<Skeleton> skeleton = std::static_pointer_cast<Skeleton>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, skeleton);
|
ResourceVersionFactory::ParseFileBinary(reader, skeleton);
|
||||||
|
|
||||||
skeleton->type = (SkeletonType)reader->ReadInt8();
|
skeleton->type = (SkeletonType)reader->ReadInt8();
|
||||||
skeleton->limbType = (LimbType)reader->ReadInt8();
|
skeleton->limbType = (LimbType)reader->ReadInt8();
|
||||||
skeleton->limbCount = reader->ReadUInt32();
|
skeleton->limbCount = reader->ReadUInt32();
|
||||||
skeleton->dListCount = reader->ReadUInt32();
|
skeleton->dListCount = reader->ReadUInt32();
|
||||||
skeleton->limbTableType = (LimbType)reader->ReadInt8();
|
skeleton->limbTableType = (LimbType)reader->ReadInt8();
|
||||||
skeleton->limbTableCount = reader->ReadUInt32();
|
skeleton->limbTableCount = reader->ReadUInt32();
|
||||||
|
|
||||||
skeleton->limbTable.reserve(skeleton->limbTableCount);
|
skeleton->limbTable.reserve(skeleton->limbTableCount);
|
||||||
for (uint32_t i = 0; i < skeleton->limbTableCount; i++) {
|
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) {
|
if (skeleton->type == Ship::SkeletonType::Curve) {
|
||||||
skeleton->skeletonData.skelCurveLimbList.limbCount = skeleton->limbCount;
|
skeleton->skeletonData.skelCurveLimbList.limbCount = skeleton->limbCount;
|
||||||
skeleton->curveLimbArray.reserve(skeleton->skeletonData.skelCurveLimbList.limbCount);
|
skeleton->curveLimbArray.reserve(skeleton->skeletonData.skelCurveLimbList.limbCount);
|
||||||
} else if (skeleton->type == Ship::SkeletonType::Flex) {
|
} 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) {
|
if (skeleton->type == Ship::SkeletonType::Normal) {
|
||||||
skeleton->skeletonData.skeletonHeader.limbCount = skeleton->limbCount;
|
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) {
|
} else if (skeleton->type == Ship::SkeletonType::Flex) {
|
||||||
skeleton->skeletonData.flexSkeletonHeader.sh.limbCount = skeleton->limbCount;
|
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++) {
|
for (size_t i = 0; i < skeleton->limbTable.size(); i++) {
|
||||||
|
|
|
@ -7,7 +7,9 @@ namespace Ship {
|
||||||
class SkeletonFactory : public ResourceFactory
|
class SkeletonFactory : public ResourceFactory
|
||||||
{
|
{
|
||||||
public:
|
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
|
class SkeletonFactoryV0 : public ResourceVersionFactory
|
||||||
|
|
|
@ -4,34 +4,33 @@
|
||||||
#include "libultraship/bridge.h"
|
#include "libultraship/bridge.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SkeletonLimbFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SkeletonLimbFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SkeletonLimb>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SkeletonLimb>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SkeletonLimbFactoryV0>();
|
||||||
factory = std::make_shared<SkeletonLimbFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load Skeleton Limb with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load Skeleton Limb with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<SkeletonLimb> skeletonLimb = std::static_pointer_cast<SkeletonLimb>(resource);
|
std::shared_ptr<SkeletonLimb> skeletonLimb = std::static_pointer_cast<SkeletonLimb>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, skeletonLimb);
|
ResourceVersionFactory::ParseFileBinary(reader, skeletonLimb);
|
||||||
|
|
||||||
skeletonLimb->limbType = (LimbType)reader->ReadInt8();
|
skeletonLimb->limbType = (LimbType)reader->ReadInt8();
|
||||||
skeletonLimb->skinSegmentType = (ZLimbSkinType)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.limbModifications = skeletonLimb->skinLimbModifArray.data();
|
||||||
skeletonLimb->skinAnimLimbData.dlist = (Gfx*)GetResourceDataByName(skeletonLimb->skinDList2.c_str(), true);
|
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].vtxCount = skeletonLimb->skinLimbModifVertexArrays[i].size();
|
||||||
skeletonLimb->skinAnimLimbData.limbModifications[i].skinVertices = skeletonLimb->skinLimbModifVertexArrays[i].data();
|
skeletonLimb->skinAnimLimbData.limbModifications[i].skinVertices = skeletonLimb->skinLimbModifVertexArrays[i].data();
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,9 @@ namespace Ship {
|
||||||
class SkeletonLimbFactory : public ResourceFactory
|
class SkeletonLimbFactory : public ResourceFactory
|
||||||
{
|
{
|
||||||
public:
|
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
|
class SkeletonLimbFactoryV0 : public ResourceVersionFactory
|
||||||
|
|
|
@ -3,50 +3,47 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> TextFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> TextFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<Text>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<Text>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<TextFactoryV0>();
|
||||||
factory = std::make_shared<TextFactoryV0>();
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
// VERSION NOT SUPPORTED
|
||||||
// VERSION NOT SUPPORTED
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load Text with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load Text with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::TextFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::TextFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource) {
|
||||||
{
|
std::shared_ptr<Text> text = std::static_pointer_cast<Text>(resource);
|
||||||
std::shared_ptr<Text> text = std::static_pointer_cast<Text>(resource);
|
ResourceVersionFactory::ParseFileBinary(reader, text);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, text);
|
|
||||||
|
|
||||||
uint32_t msgCount = reader->ReadUInt32();
|
uint32_t msgCount = reader->ReadUInt32();
|
||||||
text->messages.reserve(msgCount);
|
text->messages.reserve(msgCount);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < msgCount; i++)
|
for (uint32_t i = 0; i < msgCount; i++) {
|
||||||
{
|
MessageEntry entry;
|
||||||
MessageEntry entry;
|
entry.id = reader->ReadUInt16();
|
||||||
entry.id = reader->ReadUInt16();
|
entry.textboxType = reader->ReadUByte();
|
||||||
entry.textboxType = reader->ReadUByte();
|
entry.textboxYPos = reader->ReadUByte();
|
||||||
entry.textboxYPos = reader->ReadUByte();
|
entry.msg = reader->ReadString();
|
||||||
entry.msg = reader->ReadString();
|
|
||||||
|
|
||||||
text->messages.push_back(entry);
|
text->messages.push_back(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace Ship
|
} // namespace Ship
|
||||||
|
|
|
@ -7,7 +7,9 @@ namespace Ship {
|
||||||
class TextFactory : public ResourceFactory
|
class TextFactory : public ResourceFactory
|
||||||
{
|
{
|
||||||
public:
|
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
|
class TextFactoryV0 : public ResourceVersionFactory
|
||||||
|
|
|
@ -3,36 +3,35 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> EndMarkerFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> EndMarkerFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<EndMarker>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<EndMarker>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<EndMarkerFactoryV0>();
|
||||||
factory = std::make_shared<EndMarkerFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load EndMarker with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load EndMarker with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::EndMarkerFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::EndMarkerFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<EndMarker> endMarker = std::static_pointer_cast<EndMarker>(resource);
|
std::shared_ptr<EndMarker> endMarker = std::static_pointer_cast<EndMarker>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, endMarker);
|
ResourceVersionFactory::ParseFileBinary(reader, endMarker);
|
||||||
|
|
||||||
ReadCommandId(endMarker, reader);
|
ReadCommandId(endMarker, reader);
|
||||||
|
|
||||||
// This has no data.
|
// This has no data.
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class EndMarkerFactory : public SceneCommandFactory {
|
class EndMarkerFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class EndMarkerFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -3,50 +3,49 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetActorListFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetActorListFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetActorList>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetActorList>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetActorListFactoryV0>();
|
||||||
factory = std::make_shared<SetActorListFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr)
|
||||||
{
|
{
|
||||||
SPDLOG_ERROR("Failed to load SetActorList with version {}", version);
|
SPDLOG_ERROR("Failed to load SetActorList with version {}", resource->InitData->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetActorListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SetActorListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource) {
|
||||||
{
|
std::shared_ptr<SetActorList> setActorList = std::static_pointer_cast<SetActorList>(resource);
|
||||||
std::shared_ptr<SetActorList> setActorList = std::static_pointer_cast<SetActorList>(resource);
|
ResourceVersionFactory::ParseFileBinary(reader, setActorList);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setActorList);
|
|
||||||
|
|
||||||
ReadCommandId(setActorList, reader);
|
ReadCommandId(setActorList, reader);
|
||||||
|
|
||||||
setActorList->numActors = reader->ReadUInt32();
|
setActorList->numActors = reader->ReadUInt32();
|
||||||
setActorList->actorList.reserve(setActorList->numActors);
|
setActorList->actorList.reserve(setActorList->numActors);
|
||||||
for (uint32_t i = 0; i < setActorList->numActors; i++) {
|
for (uint32_t i = 0; i < setActorList->numActors; i++) {
|
||||||
ActorEntry entry;
|
ActorEntry entry;
|
||||||
|
|
||||||
entry.id = reader->ReadUInt16();
|
entry.id = reader->ReadUInt16();
|
||||||
entry.pos.x = reader->ReadInt16();
|
entry.pos.x = reader->ReadInt16();
|
||||||
entry.pos.y = reader->ReadInt16();
|
entry.pos.y = reader->ReadInt16();
|
||||||
entry.pos.z = reader->ReadInt16();
|
entry.pos.z = reader->ReadInt16();
|
||||||
entry.rot.x = reader->ReadInt16();
|
entry.rot.x = reader->ReadInt16();
|
||||||
entry.rot.y = reader->ReadInt16();
|
entry.rot.y = reader->ReadInt16();
|
||||||
entry.rot.z = reader->ReadInt16();
|
entry.rot.z = reader->ReadInt16();
|
||||||
entry.params = reader->ReadUInt16();
|
entry.params = reader->ReadUInt16();
|
||||||
|
|
||||||
setActorList->actorList.push_back(entry);
|
setActorList->actorList.push_back(entry);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetActorListFactory : public SceneCommandFactory {
|
class SetActorListFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetActorListFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -4,46 +4,46 @@
|
||||||
#include "libultraship/bridge.h"
|
#include "libultraship/bridge.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetAlternateHeadersFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetAlternateHeadersFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetAlternateHeaders>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetAlternateHeaders>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetAlternateHeadersFactoryV0>();
|
||||||
factory = std::make_shared<SetAlternateHeadersFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr)
|
||||||
{
|
{
|
||||||
SPDLOG_ERROR("Failed to load SetAlternateHeaders with version {}", version);
|
SPDLOG_ERROR("Failed to load SetAlternateHeaders with version {}", resource->InitData->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetAlternateHeadersFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SetAlternateHeadersFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<SetAlternateHeaders> setAlternateHeaders = std::static_pointer_cast<SetAlternateHeaders>(resource);
|
std::shared_ptr<SetAlternateHeaders> setAlternateHeaders = std::static_pointer_cast<SetAlternateHeaders>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setAlternateHeaders);
|
ResourceVersionFactory::ParseFileBinary(reader, setAlternateHeaders);
|
||||||
|
|
||||||
ReadCommandId(setAlternateHeaders, reader);
|
ReadCommandId(setAlternateHeaders, reader);
|
||||||
|
|
||||||
setAlternateHeaders->numHeaders = reader->ReadUInt32();
|
setAlternateHeaders->numHeaders = reader->ReadUInt32();
|
||||||
setAlternateHeaders->headers.reserve(setAlternateHeaders->numHeaders);
|
setAlternateHeaders->headers.reserve(setAlternateHeaders->numHeaders);
|
||||||
for (uint32_t i = 0; i < setAlternateHeaders->numHeaders; i++) {
|
for (uint32_t i = 0; i < setAlternateHeaders->numHeaders; i++) {
|
||||||
auto headerName = reader->ReadString();
|
auto headerName = reader->ReadString();
|
||||||
if (!headerName.empty()) {
|
if (!headerName.empty()) {
|
||||||
setAlternateHeaders->headers.push_back(std::static_pointer_cast<Ship::Scene>(LoadResource(headerName.c_str(), true)));
|
setAlternateHeaders->headers.push_back(std::static_pointer_cast<Ship::Scene>(LoadResource(headerName.c_str(), true)));
|
||||||
} else {
|
} else {
|
||||||
setAlternateHeaders->headers.push_back(nullptr);
|
setAlternateHeaders->headers.push_back(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetAlternateHeadersFactory : public SceneCommandFactory {
|
class SetAlternateHeadersFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetAlternateHeadersFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -3,36 +3,35 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetCameraSettingsFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetCameraSettingsFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetCameraSettings>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetCameraSettings>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetCameraSettingsFactoryV0>();
|
||||||
factory = std::make_shared<SetCameraSettingsFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load SetCameraSettings with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load SetCameraSettings with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetCameraSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SetCameraSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<SetCameraSettings> setCameraSettings = std::static_pointer_cast<SetCameraSettings>(resource);
|
std::shared_ptr<SetCameraSettings> setCameraSettings = std::static_pointer_cast<SetCameraSettings>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setCameraSettings);
|
ResourceVersionFactory::ParseFileBinary(reader, setCameraSettings);
|
||||||
|
|
||||||
ReadCommandId(setCameraSettings, reader);
|
ReadCommandId(setCameraSettings, reader);
|
||||||
|
|
||||||
setCameraSettings->settings.cameraMovement = reader->ReadInt8();
|
setCameraSettings->settings.cameraMovement = reader->ReadInt8();
|
||||||
setCameraSettings->settings.worldMapArea = reader->ReadInt32();
|
setCameraSettings->settings.worldMapArea = reader->ReadInt32();
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetCameraSettingsFactory : public SceneCommandFactory {
|
class SetCameraSettingsFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetCameraSettingsFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -4,39 +4,37 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetCollisionHeaderFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetCollisionHeaderFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetCollisionHeader>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetCollisionHeader>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetCollisionHeaderFactoryV0>();
|
||||||
factory = std::make_shared<SetCollisionHeaderFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load SetCollisionHeader with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load SetCollisionHeader with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetCollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SetCollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource) {
|
||||||
{
|
std::shared_ptr<SetCollisionHeader> setCollisionHeader = std::static_pointer_cast<SetCollisionHeader>(resource);
|
||||||
std::shared_ptr<SetCollisionHeader> setCollisionHeader = std::static_pointer_cast<SetCollisionHeader>(resource);
|
ResourceVersionFactory::ParseFileBinary(reader, setCollisionHeader);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setCollisionHeader);
|
|
||||||
|
|
||||||
ReadCommandId(setCollisionHeader, reader);
|
ReadCommandId(setCollisionHeader, reader);
|
||||||
|
|
||||||
setCollisionHeader->fileName = reader->ReadString();
|
setCollisionHeader->fileName = reader->ReadString();
|
||||||
setCollisionHeader->collisionHeader = std::static_pointer_cast<CollisionHeader>(LoadResource(setCollisionHeader->fileName.c_str(), true));
|
setCollisionHeader->collisionHeader = std::static_pointer_cast<CollisionHeader>(LoadResource(setCollisionHeader->fileName.c_str(), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Ship
|
} // namespace Ship
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetCollisionHeaderFactory : public SceneCommandFactory {
|
class SetCollisionHeaderFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetCollisionHeaderFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -3,36 +3,34 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetCsCameraFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetCsCameraFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetCsCamera>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetCsCamera>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetCsCameraFactoryV0>();
|
||||||
factory = std::make_shared<SetCsCameraFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load SetCsCamera with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load SetCsCamera with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetCsCameraFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SetCsCameraFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource) {
|
||||||
{
|
std::shared_ptr<SetCsCamera> setCsCamera = std::static_pointer_cast<SetCsCamera>(resource);
|
||||||
std::shared_ptr<SetCsCamera> setCsCamera = std::static_pointer_cast<SetCsCamera>(resource);
|
ResourceVersionFactory::ParseFileBinary(reader, setCsCamera);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setCsCamera);
|
|
||||||
|
|
||||||
ReadCommandId(setCsCamera, reader);
|
ReadCommandId(setCsCamera, reader);
|
||||||
|
|
||||||
reader->ReadInt8(); // camSize
|
reader->ReadInt8(); // camSize
|
||||||
reader->ReadInt32(); // segOffset
|
reader->ReadInt32(); // segOffset
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetCsCameraFactory : public SceneCommandFactory {
|
class SetCsCameraFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetCsCameraFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -4,39 +4,38 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetCutscenesFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetCutscenesFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetCutscenes>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetCutscenes>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetCutscenesFactoryV0>();
|
||||||
factory = std::make_shared<SetCutscenesFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr)
|
||||||
{
|
{
|
||||||
SPDLOG_ERROR("Failed to load SetCutscenes with version {}", version);
|
SPDLOG_ERROR("Failed to load SetCutscenes with version {}", resource->InitData->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetCutscenesFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SetCutscenesFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource) {
|
||||||
{
|
std::shared_ptr<SetCutscenes> setCutscenes = std::static_pointer_cast<SetCutscenes>(resource);
|
||||||
std::shared_ptr<SetCutscenes> setCutscenes = std::static_pointer_cast<SetCutscenes>(resource);
|
ResourceVersionFactory::ParseFileBinary(reader, setCutscenes);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setCutscenes);
|
|
||||||
|
|
||||||
ReadCommandId(setCutscenes, reader);
|
ReadCommandId(setCutscenes, reader);
|
||||||
|
|
||||||
setCutscenes->fileName = reader->ReadString();
|
setCutscenes->fileName = reader->ReadString();
|
||||||
setCutscenes->cutscene = std::static_pointer_cast<Cutscene>(LoadResource(setCutscenes->fileName.c_str(), true));
|
setCutscenes->cutscene = std::static_pointer_cast<Cutscene>(LoadResource(setCutscenes->fileName.c_str(), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Ship
|
} // namespace Ship
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetCutscenesFactory : public SceneCommandFactory {
|
class SetCutscenesFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetCutscenesFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -3,36 +3,35 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetEchoSettingsFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetEchoSettingsFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetEchoSettings>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetEchoSettings>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetEchoSettingsFactoryV0>();
|
||||||
factory = std::make_shared<SetEchoSettingsFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load SetEchoSettings with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load SetEchoSettings with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetEchoSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SetEchoSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<SetEchoSettings> setEchoSettings = std::static_pointer_cast<SetEchoSettings>(resource);
|
std::shared_ptr<SetEchoSettings> setEchoSettings = std::static_pointer_cast<SetEchoSettings>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setEchoSettings);
|
ResourceVersionFactory::ParseFileBinary(reader, setEchoSettings);
|
||||||
|
|
||||||
ReadCommandId(setEchoSettings, reader);
|
ReadCommandId(setEchoSettings, reader);
|
||||||
|
|
||||||
setEchoSettings->settings.echo = reader->ReadInt8();
|
setEchoSettings->settings.echo = reader->ReadInt8();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetEchoSettingsFactory : public SceneCommandFactory {
|
class SetEchoSettingsFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetEchoSettingsFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -3,44 +3,42 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetEntranceListFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetEntranceListFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetEntranceList>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetEntranceList>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetEntranceListFactoryV0>();
|
||||||
factory = std::make_shared<SetEntranceListFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load SetEntranceListList with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load SetEntranceListList with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetEntranceListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SetEntranceListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource) {
|
||||||
{
|
std::shared_ptr<SetEntranceList> setEntranceList = std::static_pointer_cast<SetEntranceList>(resource);
|
||||||
std::shared_ptr<SetEntranceList> setEntranceList = std::static_pointer_cast<SetEntranceList>(resource);
|
ResourceVersionFactory::ParseFileBinary(reader, setEntranceList);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setEntranceList);
|
|
||||||
|
|
||||||
ReadCommandId(setEntranceList, reader);
|
ReadCommandId(setEntranceList, reader);
|
||||||
|
|
||||||
setEntranceList->numEntrances = reader->ReadUInt32();
|
setEntranceList->numEntrances = reader->ReadUInt32();
|
||||||
setEntranceList->entrances.reserve(setEntranceList->numEntrances);
|
setEntranceList->entrances.reserve(setEntranceList->numEntrances);
|
||||||
for (uint32_t i = 0; i < setEntranceList->numEntrances; i++) {
|
for (uint32_t i = 0; i < setEntranceList->numEntrances; i++) {
|
||||||
EntranceEntry entranceEntry;
|
EntranceEntry entranceEntry;
|
||||||
|
|
||||||
entranceEntry.spawn = reader->ReadInt8();
|
entranceEntry.spawn = reader->ReadInt8();
|
||||||
entranceEntry.room = reader->ReadInt8();
|
entranceEntry.room = reader->ReadInt8();
|
||||||
|
|
||||||
setEntranceList->entrances.push_back(entranceEntry);
|
setEntranceList->entrances.push_back(entranceEntry);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetEntranceListFactory : public SceneCommandFactory {
|
class SetEntranceListFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetEntranceListFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -3,36 +3,34 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetExitListFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetExitListFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetExitList>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetExitList>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetExitListFactoryV0>();
|
||||||
factory = std::make_shared<SetExitListFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load SetExitList with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load SetExitList with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetExitListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SetExitListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource) {
|
||||||
{
|
std::shared_ptr<SetExitList> setExitList = std::static_pointer_cast<SetExitList>(resource);
|
||||||
std::shared_ptr<SetExitList> setExitList = std::static_pointer_cast<SetExitList>(resource);
|
ResourceVersionFactory::ParseFileBinary(reader, setExitList);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setExitList);
|
|
||||||
|
|
||||||
ReadCommandId(setExitList, reader);
|
ReadCommandId(setExitList, reader);
|
||||||
|
|
||||||
setExitList->numExits = reader->ReadUInt32();
|
setExitList->numExits = reader->ReadUInt32();
|
||||||
setExitList->exits.reserve(setExitList->numExits);
|
setExitList->exits.reserve(setExitList->numExits);
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetExitListFactory : public SceneCommandFactory {
|
class SetExitListFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetExitListFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -3,45 +3,45 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetLightListFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetLightListFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetLightList>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetLightList>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetLightListFactoryV0>();
|
||||||
factory = std::make_shared<SetLightListFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr)
|
||||||
{
|
{
|
||||||
SPDLOG_ERROR("Failed to load SetLightList with version {}", version);
|
SPDLOG_ERROR("Failed to load SetLightList with version {}", resource->InitData->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetLightListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SetLightListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<SetLightList> setLightList = std::static_pointer_cast<SetLightList>(resource);
|
std::shared_ptr<SetLightList> setLightList = std::static_pointer_cast<SetLightList>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setLightList);
|
ResourceVersionFactory::ParseFileBinary(reader, setLightList);
|
||||||
|
|
||||||
ReadCommandId(setLightList, reader);
|
ReadCommandId(setLightList, reader);
|
||||||
|
|
||||||
setLightList->numLights = reader->ReadUInt32();
|
setLightList->numLights = reader->ReadUInt32();
|
||||||
setLightList->lightList.reserve(setLightList->numLights);
|
setLightList->lightList.reserve(setLightList->numLights);
|
||||||
for (uint32_t i = 0; i < setLightList->numLights; i++) {
|
for (uint32_t i = 0; i < setLightList->numLights; i++) {
|
||||||
LightInfo light;
|
LightInfo light;
|
||||||
|
|
||||||
light.type = reader->ReadUByte();
|
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.y = reader->ReadInt16();
|
||||||
light.params.point.z = 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.color[2] = reader->ReadUByte(); // b
|
||||||
|
|
||||||
light.params.point.drawGlow = reader->ReadUByte();
|
light.params.point.drawGlow = reader->ReadUByte();
|
||||||
light.params.point.radius = reader->ReadInt16();
|
light.params.point.radius = reader->ReadInt16();
|
||||||
|
|
||||||
setLightList->lightList.push_back(light);
|
setLightList->lightList.push_back(light);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetLightListFactory : public SceneCommandFactory {
|
class SetLightListFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetLightListFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -3,42 +3,41 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetLightingSettingsFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetLightingSettingsFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetLightingSettings>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetLightingSettings>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetLightingSettingsFactoryV0>();
|
||||||
factory = std::make_shared<SetLightingSettingsFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load SetLightingSettings with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load SetLightingSettings with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetLightingSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SetLightingSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<SetLightingSettings> setLightingSettings = std::static_pointer_cast<SetLightingSettings>(resource);
|
std::shared_ptr<SetLightingSettings> setLightingSettings = std::static_pointer_cast<SetLightingSettings>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setLightingSettings);
|
ResourceVersionFactory::ParseFileBinary(reader, setLightingSettings);
|
||||||
|
|
||||||
ReadCommandId(setLightingSettings, reader);
|
ReadCommandId(setLightingSettings, reader);
|
||||||
|
|
||||||
uint32_t count = reader->ReadInt32();
|
uint32_t count = reader->ReadInt32();
|
||||||
setLightingSettings->settings.reserve(count);
|
setLightingSettings->settings.reserve(count);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < count; i++) {
|
for (uint32_t i = 0; i < count; i++) {
|
||||||
EnvLightSettings lightSettings;
|
EnvLightSettings lightSettings;
|
||||||
lightSettings.ambientColor[0] = reader->ReadInt8();
|
lightSettings.ambientColor[0] = reader->ReadInt8();
|
||||||
lightSettings.ambientColor[1] = reader->ReadInt8();
|
lightSettings.ambientColor[1] = reader->ReadInt8();
|
||||||
lightSettings.ambientColor[2] = reader->ReadInt8();
|
lightSettings.ambientColor[2] = reader->ReadInt8();
|
||||||
|
@ -65,8 +64,8 @@ void Ship::SetLightingSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryR
|
||||||
|
|
||||||
lightSettings.fogNear = reader->ReadInt16();
|
lightSettings.fogNear = reader->ReadInt16();
|
||||||
lightSettings.fogFar = reader->ReadUInt16();
|
lightSettings.fogFar = reader->ReadUInt16();
|
||||||
setLightingSettings->settings.push_back(lightSettings);
|
setLightingSettings->settings.push_back(lightSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Ship
|
} // namespace Ship
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetLightingSettingsFactory : public SceneCommandFactory {
|
class SetLightingSettingsFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetLightingSettingsFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
#include "libultraship/bridge.h"
|
#include "libultraship/bridge.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetMeshFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetMeshFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetMesh>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
|
auto resource = std::make_shared<SetMesh>(resourceMgr, initData);
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<SetMeshFactoryV0>();
|
factory = std::make_shared<SetMeshFactoryV0>();
|
||||||
break;
|
break;
|
||||||
|
@ -18,7 +18,7 @@ std::shared_ptr<Resource> SetMeshFactory::ReadResource(uint32_t version, std::sh
|
||||||
|
|
||||||
if (factory == nullptr)
|
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;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,9 +86,9 @@ void Ship::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reade
|
||||||
BgImage image;
|
BgImage image;
|
||||||
image.unk_00 = reader->ReadUInt16();
|
image.unk_00 = reader->ReadUInt16();
|
||||||
image.id = reader->ReadUByte();
|
image.id = reader->ReadUByte();
|
||||||
std::string sourceFile = reader->ReadString();
|
std::string imagePath = "__OTR__" + reader->ReadString();
|
||||||
void* sourceData = GetResourceDataByName(sourceFile.c_str(), true);
|
setMesh->imagePaths.push_back(imagePath);
|
||||||
image.source = sourceData;
|
image.source = (void*)setMesh->imagePaths.back().c_str();
|
||||||
image.unk_0C = reader->ReadUInt32();
|
image.unk_0C = reader->ReadUInt32();
|
||||||
image.tlut = reader->ReadUInt32();
|
image.tlut = reader->ReadUInt32();
|
||||||
image.width = reader->ReadUInt16();
|
image.width = reader->ReadUInt16();
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetMeshFactory : public SceneCommandFactory {
|
class SetMeshFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetMeshFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -3,36 +3,35 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetObjectListFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetObjectListFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetObjectList>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetObjectList>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetObjectListFactoryV0>();
|
||||||
factory = std::make_shared<SetObjectListFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load SetObjectList with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load SetObjectList with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetObjectListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SetObjectListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<SetObjectList> setObjectList = std::static_pointer_cast<SetObjectList>(resource);
|
std::shared_ptr<SetObjectList> setObjectList = std::static_pointer_cast<SetObjectList>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setObjectList);
|
ResourceVersionFactory::ParseFileBinary(reader, setObjectList);
|
||||||
|
|
||||||
ReadCommandId(setObjectList, reader);
|
ReadCommandId(setObjectList, reader);
|
||||||
|
|
||||||
setObjectList->numObjects = reader->ReadUInt32();
|
setObjectList->numObjects = reader->ReadUInt32();
|
||||||
setObjectList->objects.reserve(setObjectList->numObjects);
|
setObjectList->objects.reserve(setObjectList->numObjects);
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetObjectListFactory : public SceneCommandFactory {
|
class SetObjectListFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetObjectListFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -4,36 +4,34 @@
|
||||||
#include <libultraship/bridge.h>
|
#include <libultraship/bridge.h>
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetPathwaysFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetPathwaysFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetPathways>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetPathways>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetPathwaysFactoryV0>();
|
||||||
factory = std::make_shared<SetPathwaysFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load SetPathways with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load SetPathways with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetPathwaysFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SetPathwaysFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource) {
|
||||||
{
|
std::shared_ptr<SetPathways> setPathways = std::static_pointer_cast<SetPathways>(resource);
|
||||||
std::shared_ptr<SetPathways> setPathways = std::static_pointer_cast<SetPathways>(resource);
|
ResourceVersionFactory::ParseFileBinary(reader, setPathways);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setPathways);
|
|
||||||
|
|
||||||
ReadCommandId(setPathways, reader);
|
ReadCommandId(setPathways, reader);
|
||||||
|
|
||||||
setPathways->numPaths = reader->ReadUInt32();
|
setPathways->numPaths = reader->ReadUInt32();
|
||||||
setPathways->paths.reserve(setPathways->numPaths);
|
setPathways->paths.reserve(setPathways->numPaths);
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetPathwaysFactory : public SceneCommandFactory {
|
class SetPathwaysFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetPathwaysFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -3,36 +3,34 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetRoomBehaviorFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetRoomBehaviorFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetRoomBehavior>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetRoomBehavior>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetRoomBehaviorFactoryV0>();
|
||||||
factory = std::make_shared<SetRoomBehaviorFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load SetRoomBehavior with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load SetRoomBehavior with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetRoomBehaviorFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SetRoomBehaviorFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource) {
|
||||||
{
|
std::shared_ptr<SetRoomBehavior> setRoomBehavior = std::static_pointer_cast<SetRoomBehavior>(resource);
|
||||||
std::shared_ptr<SetRoomBehavior> setRoomBehavior = std::static_pointer_cast<SetRoomBehavior>(resource);
|
ResourceVersionFactory::ParseFileBinary(reader, setRoomBehavior);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setRoomBehavior);
|
|
||||||
|
|
||||||
ReadCommandId(setRoomBehavior, reader);
|
ReadCommandId(setRoomBehavior, reader);
|
||||||
|
|
||||||
setRoomBehavior->roomBehavior.gameplayFlags = reader->ReadInt8();
|
setRoomBehavior->roomBehavior.gameplayFlags = reader->ReadInt8();
|
||||||
setRoomBehavior->roomBehavior.gameplayFlags2 = reader->ReadInt32();
|
setRoomBehavior->roomBehavior.gameplayFlags2 = reader->ReadInt32();
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetRoomBehaviorFactory : public SceneCommandFactory {
|
class SetRoomBehaviorFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetRoomBehaviorFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -3,47 +3,46 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetRoomListFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetRoomListFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetRoomList>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetRoomList>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetRoomListFactoryV0>();
|
||||||
factory = std::make_shared<SetRoomListFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr)
|
||||||
{
|
{
|
||||||
SPDLOG_ERROR("Failed to load SetRoomList with version {}", version);
|
SPDLOG_ERROR("Failed to load SetRoomList with version {}", resource->InitData->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetRoomListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SetRoomListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource) {
|
||||||
{
|
std::shared_ptr<SetRoomList> setRoomList = std::static_pointer_cast<SetRoomList>(resource);
|
||||||
std::shared_ptr<SetRoomList> setRoomList = std::static_pointer_cast<SetRoomList>(resource);
|
ResourceVersionFactory::ParseFileBinary(reader, setRoomList);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setRoomList);
|
|
||||||
|
|
||||||
ReadCommandId(setRoomList, reader);
|
ReadCommandId(setRoomList, reader);
|
||||||
|
|
||||||
setRoomList->numRooms = reader->ReadInt32();
|
setRoomList->numRooms = reader->ReadInt32();
|
||||||
setRoomList->rooms.reserve(setRoomList->numRooms);
|
setRoomList->rooms.reserve(setRoomList->numRooms);
|
||||||
for (uint32_t i = 0; i < setRoomList->numRooms; i++) {
|
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.fileName = (char*)setRoomList->fileNames.back().c_str();
|
||||||
room.vromStart = reader->ReadInt32();
|
room.vromStart = reader->ReadInt32();
|
||||||
room.vromEnd = reader->ReadInt32();
|
room.vromEnd = reader->ReadInt32();
|
||||||
|
|
||||||
setRoomList->rooms.push_back(room);
|
setRoomList->rooms.push_back(room);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetRoomListFactory : public SceneCommandFactory {
|
class SetRoomListFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetRoomListFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -3,32 +3,30 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetSkyboxModifierFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetSkyboxModifierFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetSkyboxModifier>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetSkyboxModifier>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetSkyboxModifierFactoryV0>();
|
||||||
factory = std::make_shared<SetSkyboxModifierFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load SetSkyboxModifier with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load SetSkyboxModifier with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetSkyboxModifierFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
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);
|
std::shared_ptr<SetSkyboxModifier> setSkyboxModifier = std::static_pointer_cast<SetSkyboxModifier>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setSkyboxModifier);
|
ResourceVersionFactory::ParseFileBinary(reader, setSkyboxModifier);
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetSkyboxModifierFactory : public SceneCommandFactory {
|
class SetSkyboxModifierFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetSkyboxModifierFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -3,39 +3,37 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetSkyboxSettingsFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetSkyboxSettingsFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetSkyboxSettings>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetSkyboxSettings>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetSkyboxSettingsFactoryV0>();
|
||||||
factory = std::make_shared<SetSkyboxSettingsFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load SetSkyboxSettings with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load SetSkyboxSettings with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSkyboxSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void SetSkyboxSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource) {
|
||||||
{
|
std::shared_ptr<SetSkyboxSettings> setSkyboxSettings = std::static_pointer_cast<SetSkyboxSettings>(resource);
|
||||||
std::shared_ptr<SetSkyboxSettings> setSkyboxSettings = std::static_pointer_cast<SetSkyboxSettings>(resource);
|
ResourceVersionFactory::ParseFileBinary(reader, setSkyboxSettings);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setSkyboxSettings);
|
|
||||||
|
|
||||||
ReadCommandId(setSkyboxSettings, reader);
|
ReadCommandId(setSkyboxSettings, reader);
|
||||||
|
|
||||||
setSkyboxSettings->settings.unk = reader->ReadInt8();
|
setSkyboxSettings->settings.unk = reader->ReadInt8();
|
||||||
setSkyboxSettings->settings.skyboxId = reader->ReadInt8();
|
setSkyboxSettings->settings.skyboxId = reader->ReadInt8();
|
||||||
setSkyboxSettings->settings.weather = reader->ReadInt8();
|
setSkyboxSettings->settings.weather = reader->ReadInt8();
|
||||||
setSkyboxSettings->settings.indoors = reader->ReadInt8();
|
setSkyboxSettings->settings.indoors = reader->ReadInt8();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetSkyboxSettingsFactory : public SceneCommandFactory {
|
class SetSkyboxSettingsFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetSkyboxSettingsFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -3,36 +3,34 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetSoundSettingsFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetSoundSettingsFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetSoundSettings>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetSoundSettings>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetSoundSettingsFactoryV0>();
|
||||||
factory = std::make_shared<SetSoundSettingsFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load SetSoundSettings with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load SetSoundSettings with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetSoundSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SetSoundSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource) {
|
||||||
{
|
std::shared_ptr<SetSoundSettings> setSoundSettings = std::static_pointer_cast<SetSoundSettings>(resource);
|
||||||
std::shared_ptr<SetSoundSettings> setSoundSettings = std::static_pointer_cast<SetSoundSettings>(resource);
|
ResourceVersionFactory::ParseFileBinary(reader, setSoundSettings);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setSoundSettings);
|
|
||||||
|
|
||||||
ReadCommandId(setSoundSettings, reader);
|
ReadCommandId(setSoundSettings, reader);
|
||||||
|
|
||||||
setSoundSettings->settings.reverb = reader->ReadInt8();
|
setSoundSettings->settings.reverb = reader->ReadInt8();
|
||||||
setSoundSettings->settings.natureAmbienceId = reader->ReadInt8();
|
setSoundSettings->settings.natureAmbienceId = reader->ReadInt8();
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetSoundSettingsFactory : public SceneCommandFactory {
|
class SetSoundSettingsFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetSoundSettingsFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -3,39 +3,37 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetSpecialObjectsFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetSpecialObjectsFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetSpecialObjects>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetSpecialObjects>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetSpecialObjectsFactoryV0>();
|
||||||
factory = std::make_shared<SetSpecialObjectsFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr){
|
||||||
{
|
SPDLOG_ERROR("Failed to load SetSpecialObjects with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load SetSpecialObjects with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetSpecialObjectsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SetSpecialObjectsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource) {
|
||||||
{
|
std::shared_ptr<SetSpecialObjects> setSpecialObjects = std::static_pointer_cast<SetSpecialObjects>(resource);
|
||||||
std::shared_ptr<SetSpecialObjects> setSpecialObjects = std::static_pointer_cast<SetSpecialObjects>(resource);
|
ResourceVersionFactory::ParseFileBinary(reader, setSpecialObjects);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setSpecialObjects);
|
|
||||||
|
|
||||||
ReadCommandId(setSpecialObjects, reader);
|
ReadCommandId(setSpecialObjects, reader);
|
||||||
|
|
||||||
setSpecialObjects->specialObjects.elfMessage = reader->ReadInt8();
|
setSpecialObjects->specialObjects.elfMessage = reader->ReadInt8();
|
||||||
setSpecialObjects->specialObjects.globalObject = reader->ReadInt16();
|
setSpecialObjects->specialObjects.globalObject = reader->ReadInt16();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Ship
|
} // namespace Ship
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetSpecialObjectsFactory : public SceneCommandFactory {
|
class SetSpecialObjectsFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetSpecialObjectsFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -3,50 +3,51 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetStartPositionListFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetStartPositionListFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetStartPositionList>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetStartPositionList>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<SetStartPositionListFactoryV0>();
|
factory = std::make_shared<SetStartPositionListFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr)
|
||||||
{
|
{
|
||||||
SPDLOG_ERROR("Failed to load SetStartPositionList with version {}", version);
|
SPDLOG_ERROR("Failed to load SetStartPositionList with version {}", resource->InitData->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetStartPositionListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SetStartPositionListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<SetStartPositionList> setStartPositionList = std::static_pointer_cast<SetStartPositionList>(resource);
|
std::shared_ptr<SetStartPositionList> setStartPositionList = std::static_pointer_cast<SetStartPositionList>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setStartPositionList);
|
ResourceVersionFactory::ParseFileBinary(reader, setStartPositionList);
|
||||||
|
|
||||||
ReadCommandId(setStartPositionList, reader);
|
ReadCommandId(setStartPositionList, reader);
|
||||||
|
|
||||||
setStartPositionList->numStartPositions = reader->ReadUInt32();
|
setStartPositionList->numStartPositions = reader->ReadUInt32();
|
||||||
setStartPositionList->startPositions.reserve(setStartPositionList->numStartPositions);
|
setStartPositionList->startPositions.reserve(setStartPositionList->numStartPositions);
|
||||||
for (uint32_t i = 0; i < setStartPositionList->numStartPositions; i++) {
|
for (uint32_t i = 0; i < setStartPositionList->numStartPositions; i++) {
|
||||||
ActorEntry entry;
|
ActorEntry entry;
|
||||||
|
|
||||||
entry.id = reader->ReadUInt16();
|
entry.id = reader->ReadUInt16();
|
||||||
entry.pos.x = reader->ReadInt16();
|
entry.pos.x = reader->ReadInt16();
|
||||||
entry.pos.y = reader->ReadInt16();
|
entry.pos.y = reader->ReadInt16();
|
||||||
entry.pos.z = reader->ReadInt16();
|
entry.pos.z = reader->ReadInt16();
|
||||||
entry.rot.x = reader->ReadInt16();
|
entry.rot.x = reader->ReadInt16();
|
||||||
entry.rot.y = reader->ReadInt16();
|
entry.rot.y = reader->ReadInt16();
|
||||||
entry.rot.z = reader->ReadInt16();
|
entry.rot.z = reader->ReadInt16();
|
||||||
entry.params = reader->ReadUInt16();
|
entry.params = reader->ReadUInt16();
|
||||||
|
|
||||||
setStartPositionList->startPositions.push_back(entry);
|
setStartPositionList->startPositions.push_back(entry);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetStartPositionListFactory : public SceneCommandFactory {
|
class SetStartPositionListFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetStartPositionListFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -3,40 +3,38 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetTimeSettingsFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetTimeSettingsFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetTimeSettings>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetTimeSettings>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetTimeSettingsFactoryV0>();
|
||||||
factory = std::make_shared<SetTimeSettingsFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load SetTimeSettings with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load SetTimeSettings with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetTimeSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SetTimeSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource) {
|
||||||
{
|
std::shared_ptr<SetTimeSettings> setTimeSettings = std::static_pointer_cast<SetTimeSettings>(resource);
|
||||||
std::shared_ptr<SetTimeSettings> setTimeSettings = std::static_pointer_cast<SetTimeSettings>(resource);
|
ResourceVersionFactory::ParseFileBinary(reader, setTimeSettings);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setTimeSettings);
|
|
||||||
|
|
||||||
ReadCommandId(setTimeSettings, reader);
|
ReadCommandId(setTimeSettings, reader);
|
||||||
|
|
||||||
setTimeSettings->settings.hour = reader->ReadInt8();
|
setTimeSettings->settings.hour = reader->ReadInt8();
|
||||||
setTimeSettings->settings.minute = reader->ReadInt8();
|
setTimeSettings->settings.minute = reader->ReadInt8();
|
||||||
setTimeSettings->settings.timeIncrement = reader->ReadInt8();
|
setTimeSettings->settings.timeIncrement = reader->ReadInt8();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Ship
|
} // namespace Ship
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetTimeSettingsFactory : public SceneCommandFactory {
|
class SetTimeSettingsFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetTimeSettingsFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -3,41 +3,39 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetTransitionActorListFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetTransitionActorListFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetTransitionActorList>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetTransitionActorList>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetTransitionActorListFactoryV0>();
|
||||||
factory = std::make_shared<SetTransitionActorListFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load SetTransitionActorList with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load SetTransitionActorList with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetTransitionActorListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SetTransitionActorListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource) {
|
||||||
{
|
std::shared_ptr<SetTransitionActorList> setTransitionActorList = std::static_pointer_cast<SetTransitionActorList>(resource);
|
||||||
std::shared_ptr<SetTransitionActorList> setTransitionActorList = std::static_pointer_cast<SetTransitionActorList>(resource);
|
ResourceVersionFactory::ParseFileBinary(reader, setTransitionActorList);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setTransitionActorList);
|
|
||||||
|
|
||||||
ReadCommandId(setTransitionActorList, reader);
|
ReadCommandId(setTransitionActorList, reader);
|
||||||
|
|
||||||
setTransitionActorList->numTransitionActors = reader->ReadUInt32();
|
setTransitionActorList->numTransitionActors = reader->ReadUInt32();
|
||||||
setTransitionActorList->transitionActorList.reserve(setTransitionActorList->numTransitionActors);
|
setTransitionActorList->transitionActorList.reserve(setTransitionActorList->numTransitionActors);
|
||||||
for (uint32_t i = 0; i < setTransitionActorList->numTransitionActors; i++) {
|
for (uint32_t i = 0; i < setTransitionActorList->numTransitionActors; i++) {
|
||||||
TransitionActorEntry entry;
|
TransitionActorEntry entry;
|
||||||
|
|
||||||
entry.sides[0].room = reader->ReadUByte();
|
entry.sides[0].room = reader->ReadUByte();
|
||||||
entry.sides[0].effects = reader->ReadUByte();
|
entry.sides[0].effects = reader->ReadUByte();
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetTransitionActorListFactory : public SceneCommandFactory {
|
class SetTransitionActorListFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetTransitionActorListFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -3,38 +3,36 @@
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
std::shared_ptr<Resource> SetWindSettingsFactory::ReadResource(uint32_t version, std::shared_ptr<BinaryReader> reader)
|
std::shared_ptr<Resource> SetWindSettingsFactory::ReadResource(std::shared_ptr<ResourceMgr> resourceMgr,
|
||||||
{
|
std::shared_ptr<ResourceInitData> initData,
|
||||||
auto resource = std::make_shared<SetWindSettings>();
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
auto resource = std::make_shared<SetWindSettings>(resourceMgr, initData);
|
||||||
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (version)
|
switch (resource->InitData->ResourceVersion) {
|
||||||
{
|
case 0:
|
||||||
case 0:
|
factory = std::make_shared<SetWindSettingsFactoryV0>();
|
||||||
factory = std::make_shared<SetWindSettingsFactoryV0>();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr) {
|
||||||
{
|
SPDLOG_ERROR("Failed to load SetWindSettings with version {}", resource->InitData->ResourceVersion);
|
||||||
SPDLOG_ERROR("Failed to load SetWindSettings with version {}", version);
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
factory->ParseFileBinary(reader, resource);
|
factory->ParseFileBinary(reader, resource);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::SetWindSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void Ship::SetWindSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<Resource> resource) {
|
||||||
{
|
std::shared_ptr<SetWindSettings> setWind = std::static_pointer_cast<SetWindSettings>(resource);
|
||||||
std::shared_ptr<SetWindSettings> setWind = std::static_pointer_cast<SetWindSettings>(resource);
|
ResourceVersionFactory::ParseFileBinary(reader, setWind);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setWind);
|
|
||||||
|
|
||||||
ReadCommandId(setWind, reader);
|
ReadCommandId(setWind, reader);
|
||||||
|
|
||||||
setWind->settings.windWest = reader->ReadInt8();
|
setWind->settings.windWest = reader->ReadInt8();
|
||||||
setWind->settings.windVertical = reader->ReadInt8();
|
setWind->settings.windVertical = reader->ReadInt8();
|
||||||
setWind->settings.windSouth = reader->ReadInt8();
|
setWind->settings.windSouth = reader->ReadInt8();
|
||||||
setWind->settings.windSpeed = reader->ReadUByte();
|
setWind->settings.windSpeed = reader->ReadUByte();
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetWindSettingsFactory : public SceneCommandFactory {
|
class SetWindSettingsFactory : public SceneCommandFactory {
|
||||||
public:
|
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 {
|
class SetWindSettingsFactoryV0 : public SceneCommandVersionFactory {
|
||||||
|
|
|
@ -65,6 +65,8 @@ namespace Ship {
|
||||||
|
|
||||||
class Animation : public Resource {
|
class Animation : public Resource {
|
||||||
public:
|
public:
|
||||||
|
using Resource::Resource;
|
||||||
|
|
||||||
void* GetPointer();
|
void* GetPointer();
|
||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,8 @@ namespace Ship {
|
||||||
|
|
||||||
class AudioSample : public Resource {
|
class AudioSample : public Resource {
|
||||||
public:
|
public:
|
||||||
|
using Resource::Resource;
|
||||||
|
|
||||||
void* GetPointer();
|
void* GetPointer();
|
||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@ typedef struct {
|
||||||
|
|
||||||
class AudioSequence : public Resource {
|
class AudioSequence : public Resource {
|
||||||
public:
|
public:
|
||||||
|
using Resource::Resource;
|
||||||
|
|
||||||
void* GetPointer();
|
void* GetPointer();
|
||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,8 @@ typedef struct {
|
||||||
|
|
||||||
class AudioSoundFont : public Resource {
|
class AudioSoundFont : public Resource {
|
||||||
public:
|
public:
|
||||||
|
using Resource::Resource;
|
||||||
|
|
||||||
void* GetPointer();
|
void* GetPointer();
|
||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class Background : public Resource {
|
class Background : public Resource {
|
||||||
public:
|
public:
|
||||||
|
using Resource::Resource;
|
||||||
|
|
||||||
void* GetPointer();
|
void* GetPointer();
|
||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,8 @@ typedef struct {
|
||||||
|
|
||||||
class CollisionHeader : public Resource {
|
class CollisionHeader : public Resource {
|
||||||
public:
|
public:
|
||||||
|
using Resource::Resource;
|
||||||
|
|
||||||
void* GetPointer();
|
void* GetPointer();
|
||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,8 @@ enum class CutsceneCommands {
|
||||||
|
|
||||||
class Cutscene : public Resource {
|
class Cutscene : public Resource {
|
||||||
public:
|
public:
|
||||||
|
using Resource::Resource;
|
||||||
|
|
||||||
void* GetPointer();
|
void* GetPointer();
|
||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@ typedef struct {
|
||||||
|
|
||||||
class Path : public Resource {
|
class Path : public Resource {
|
||||||
public:
|
public:
|
||||||
|
using Resource::Resource;
|
||||||
|
|
||||||
void* GetPointer();
|
void* GetPointer();
|
||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@ namespace Ship {
|
||||||
|
|
||||||
class PlayerAnimation : public Resource {
|
class PlayerAnimation : public Resource {
|
||||||
public:
|
public:
|
||||||
|
using Resource::Resource;
|
||||||
|
|
||||||
void* GetPointer();
|
void* GetPointer();
|
||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@ namespace Ship {
|
||||||
|
|
||||||
class Scene : public Resource {
|
class Scene : public Resource {
|
||||||
public:
|
public:
|
||||||
|
using Resource::Resource;
|
||||||
|
|
||||||
void* GetPointer();
|
void* GetPointer();
|
||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,8 @@ union SkeletonData {
|
||||||
|
|
||||||
class Skeleton : public Resource {
|
class Skeleton : public Resource {
|
||||||
public:
|
public:
|
||||||
|
using Resource::Resource;
|
||||||
|
|
||||||
void* GetPointer();
|
void* GetPointer();
|
||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,8 @@ union SkeletonLimbData {
|
||||||
|
|
||||||
class SkeletonLimb : public Resource {
|
class SkeletonLimb : public Resource {
|
||||||
public:
|
public:
|
||||||
|
using Resource::Resource;
|
||||||
|
|
||||||
void* GetPointer();
|
void* GetPointer();
|
||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@ public:
|
||||||
|
|
||||||
class Text : public Resource {
|
class Text : public Resource {
|
||||||
public:
|
public:
|
||||||
|
using Resource::Resource;
|
||||||
|
|
||||||
void* GetPointer();
|
void* GetPointer();
|
||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@ typedef struct {
|
||||||
|
|
||||||
class EndMarker : public SceneCommand {
|
class EndMarker : public SceneCommand {
|
||||||
public:
|
public:
|
||||||
|
using SceneCommand::SceneCommand;
|
||||||
|
|
||||||
void* GetPointer();
|
void* GetPointer();
|
||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ enum class SceneCommandID : uint8_t {
|
||||||
|
|
||||||
class SceneCommand : public Resource {
|
class SceneCommand : public Resource {
|
||||||
public:
|
public:
|
||||||
|
using Resource::Resource;
|
||||||
SceneCommandID cmdId;
|
SceneCommandID cmdId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@ typedef struct {
|
||||||
|
|
||||||
class SetActorList : public SceneCommand {
|
class SetActorList : public SceneCommand {
|
||||||
public:
|
public:
|
||||||
|
using SceneCommand::SceneCommand;
|
||||||
|
|
||||||
void* GetPointer();
|
void* GetPointer();
|
||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@ namespace Ship {
|
||||||
|
|
||||||
class SetAlternateHeaders : public SceneCommand {
|
class SetAlternateHeaders : public SceneCommand {
|
||||||
public:
|
public:
|
||||||
|
using SceneCommand::SceneCommand;
|
||||||
|
|
||||||
void* GetPointer();
|
void* GetPointer();
|
||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@ typedef struct {
|
||||||
|
|
||||||
class SetCameraSettings : public SceneCommand {
|
class SetCameraSettings : public SceneCommand {
|
||||||
public:
|
public:
|
||||||
|
using SceneCommand::SceneCommand;
|
||||||
|
|
||||||
void* GetPointer();
|
void* GetPointer();
|
||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetCollisionHeader : public SceneCommand {
|
class SetCollisionHeader : public SceneCommand {
|
||||||
public:
|
public:
|
||||||
|
using SceneCommand::SceneCommand;
|
||||||
|
|
||||||
void* GetPointer();
|
void* GetPointer();
|
||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@ typedef struct {
|
||||||
|
|
||||||
class SetCsCamera : public SceneCommand {
|
class SetCsCamera : public SceneCommand {
|
||||||
public:
|
public:
|
||||||
|
using SceneCommand::SceneCommand;
|
||||||
|
|
||||||
void* GetPointer();
|
void* GetPointer();
|
||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
class SetCutscenes : public SceneCommand {
|
class SetCutscenes : public SceneCommand {
|
||||||
public:
|
public:
|
||||||
|
using SceneCommand::SceneCommand;
|
||||||
|
|
||||||
void* GetPointer();
|
void* GetPointer();
|
||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@ typedef struct {
|
||||||
|
|
||||||
class SetEchoSettings : public SceneCommand {
|
class SetEchoSettings : public SceneCommand {
|
||||||
public:
|
public:
|
||||||
|
using SceneCommand::SceneCommand;
|
||||||
|
|
||||||
void* GetPointer();
|
void* GetPointer();
|
||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue