mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-11 07:18:11 -05:00
iw3 basis
This commit is contained in:
45
src/Unlinker/Game/IW3/ZoneDefWriterIW3.cpp
Normal file
45
src/Unlinker/Game/IW3/ZoneDefWriterIW3.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
#include "ZoneDefWriterIW3.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "Game/IW3/GameIW3.h"
|
||||
#include "Game/IW3/GameAssetPoolIW3.h"
|
||||
|
||||
using namespace IW3;
|
||||
|
||||
bool ZoneDefWriter::CanHandleZone(Zone* zone) const
|
||||
{
|
||||
return zone->m_game == &g_GameIW3;
|
||||
}
|
||||
|
||||
void ZoneDefWriter::WriteMetaData(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const
|
||||
{
|
||||
}
|
||||
|
||||
void ZoneDefWriter::WriteContent(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const
|
||||
{
|
||||
const auto* pools = dynamic_cast<GameAssetPoolIW3*>(zone->m_pools.get());
|
||||
|
||||
assert(pools);
|
||||
if (!pools)
|
||||
return;
|
||||
|
||||
// Localized strings are all collected in one string file. So only add this to the zone file.
|
||||
if (!pools->m_localize->m_asset_lookup.empty())
|
||||
{
|
||||
stream.WriteEntry(pools->GetAssetTypeName(ASSET_TYPE_LOCALIZE_ENTRY), zone->m_name);
|
||||
}
|
||||
|
||||
for (const auto& asset : *pools)
|
||||
{
|
||||
switch (asset->m_type)
|
||||
{
|
||||
case ASSET_TYPE_LOCALIZE_ENTRY:
|
||||
break;
|
||||
|
||||
default:
|
||||
stream.WriteEntry(pools->GetAssetTypeName(asset->m_type), asset->m_name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
16
src/Unlinker/Game/IW3/ZoneDefWriterIW3.h
Normal file
16
src/Unlinker/Game/IW3/ZoneDefWriterIW3.h
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "ContentLister/ZoneDefWriter.h"
|
||||
|
||||
namespace IW3
|
||||
{
|
||||
class ZoneDefWriter final : public AbstractZoneDefWriter
|
||||
{
|
||||
protected:
|
||||
void WriteMetaData(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const override;
|
||||
void WriteContent(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const override;
|
||||
|
||||
public:
|
||||
bool CanHandleZone(Zone* zone) const override;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user