mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-12-02 09:17:47 +00:00
V1 release of custom map code
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
constexpr auto METADATA_CUSTOM_MAP = "custom_map";
|
||||
|
||||
constexpr auto METADATA_GAME = "game";
|
||||
constexpr auto METADATA_GDT = "gdt";
|
||||
constexpr auto METADATA_NAME = "name";
|
||||
@@ -133,6 +135,10 @@ void SequenceZoneDefinitionMetaData::ProcessMatch(ZoneDefinitionParserState* sta
|
||||
{
|
||||
ProcessMetaDataGame(state, valueToken, value);
|
||||
}
|
||||
else if (key == METADATA_CUSTOM_MAP)
|
||||
{
|
||||
state->SetCustomMap();
|
||||
}
|
||||
else if (key == METADATA_GDT)
|
||||
{
|
||||
state->m_definition->m_gdts.emplace_back(value);
|
||||
|
||||
@@ -19,6 +19,27 @@ void ZoneDefinitionParserState::SetGame(const GameId game)
|
||||
m_asset_name_resolver = IAssetNameResolver::GetResolverForGame(game);
|
||||
}
|
||||
|
||||
void ZoneDefinitionParserState::SetCustomMap()
|
||||
{
|
||||
if (m_definition->is_custom_map == false)
|
||||
{
|
||||
m_definition->is_custom_map = true;
|
||||
if (m_definition->m_game != GameId::T6)
|
||||
{
|
||||
printf("ERROR: Custom map linking is only supported on BO2 (T6).\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Processing zone as a custom map zone.\n");
|
||||
const auto gfxWorldAssetType = m_asset_name_resolver->GetAssetTypeByName("gfxworld");
|
||||
_ASSERT(gfxWorldAssetType);
|
||||
|
||||
m_definition->m_assets.emplace_back(*gfxWorldAssetType, "gfxworld", false);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
void AddCurrentObjContainerToDefinitionIfNecessary(ZoneDefinition& zoneDefinition, std::optional<ZoneDefinitionObjContainer>& maybeObjContainer)
|
||||
|
||||
@@ -17,6 +17,8 @@ public:
|
||||
|
||||
void SetGame(GameId game);
|
||||
|
||||
void SetCustomMap();
|
||||
|
||||
void StartIPak(std::string ipakName);
|
||||
void StartIwd(std::string iwdName);
|
||||
|
||||
|
||||
@@ -69,4 +69,6 @@ public:
|
||||
std::vector<std::string> m_gdts;
|
||||
std::vector<ZoneDefinitionAsset> m_assets;
|
||||
std::vector<ZoneDefinitionObjContainer> m_obj_containers;
|
||||
|
||||
bool is_custom_map = false;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user