Skip to content

Commit

Permalink
Merge pull request #20 from Laupetin/feature/ipak-building
Browse files Browse the repository at this point in the history
Add IPak projects and building
  • Loading branch information
Laupetin authored Oct 15, 2023
2 parents 74fd8f4 + 4811d41 commit 1384c91
Show file tree
Hide file tree
Showing 39 changed files with 1,233 additions and 379 deletions.
10 changes: 10 additions & 0 deletions src/Common/Game/T6/CommonT6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ int Common::Com_HashString(const char* str, const int len)
return result;
}

uint32_t Common::R_HashString(const char* str, uint32_t hash)
{
for (const auto* pos = str; *pos; pos++)
{
hash = 33 * hash ^ (*pos | 0x20);
}

return hash;
}

PackedTexCoords Common::Vec2PackTexCoords(const vec2_t* in)
{
return PackedTexCoords{ Pack32::Vec2PackTexCoords(in->v) };
Expand Down
1 change: 1 addition & 0 deletions src/Common/Game/T6/CommonT6.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace T6
static int Com_HashKey(const char* str, int maxLen);
static int Com_HashString(const char* str);
static int Com_HashString(const char* str, int len);
static uint32_t R_HashString(const char* str, uint32_t hash);

static PackedTexCoords Vec2PackTexCoords(const vec2_t* in);
static PackedUnitVec Vec3PackUnitVec(const vec3_t* in);
Expand Down
4 changes: 2 additions & 2 deletions src/Common/Game/T6/T6_Assets.h
Original file line number Diff line number Diff line change
Expand Up @@ -765,10 +765,10 @@ namespace T6
int platform[2];
};


struct GfxStreamedPartInfo
{
unsigned int levelCountAndSize;
uint32_t levelCount : 4;
uint32_t levelSize : 28;
unsigned int hash;
uint16_t width;
uint16_t height;
Expand Down
8 changes: 4 additions & 4 deletions src/Linker/Game/IW3/ZoneCreatorIW3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void ZoneCreator::AddAssetTypeName(asset_type_t assetType, std::string name)
m_asset_types_by_name.emplace(std::make_pair(std::move(name), assetType));
}

std::vector<Gdt*> ZoneCreator::CreateGdtList(ZoneCreationContext& context)
std::vector<Gdt*> ZoneCreator::CreateGdtList(const ZoneCreationContext& context)
{
std::vector<Gdt*> gdtList;
gdtList.reserve(context.m_gdt_files.size());
Expand All @@ -32,9 +32,9 @@ std::vector<Gdt*> ZoneCreator::CreateGdtList(ZoneCreationContext& context)
return gdtList;
}

bool ZoneCreator::CreateIgnoredAssetMap(ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const
bool ZoneCreator::CreateIgnoredAssetMap(const ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const
{
for (const auto& ignoreEntry : context.m_ignored_assets)
for (const auto& ignoreEntry : context.m_ignored_assets.m_entries)
{
const auto foundAssetTypeEntry = m_asset_types_by_name.find(ignoreEntry.m_type);
if (foundAssetTypeEntry == m_asset_types_by_name.end())
Expand Down Expand Up @@ -72,7 +72,7 @@ std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext&
if (!assetEntry.m_is_reference)
continue;

context.m_ignored_assets.emplace_back(assetEntry.m_asset_type, assetEntry.m_asset_name);
context.m_ignored_assets.m_entries.emplace_back(assetEntry.m_asset_type, assetEntry.m_asset_name, assetEntry.m_is_reference);
}

const auto assetLoadingContext = std::make_unique<AssetLoadingContext>(zone.get(), context.m_asset_search_path, CreateGdtList(context));
Expand Down
4 changes: 2 additions & 2 deletions src/Linker/Game/IW3/ZoneCreatorIW3.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ namespace IW3
std::unordered_map<std::string, asset_type_t> m_asset_types_by_name;

void AddAssetTypeName(asset_type_t assetType, std::string name);
static std::vector<Gdt*> CreateGdtList(ZoneCreationContext& context);
bool CreateIgnoredAssetMap(ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const;
static std::vector<Gdt*> CreateGdtList(const ZoneCreationContext& context);
bool CreateIgnoredAssetMap(const ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const;
void CreateZoneAssetPools(Zone* zone) const;

public:
Expand Down
8 changes: 4 additions & 4 deletions src/Linker/Game/IW4/ZoneCreatorIW4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void ZoneCreator::AddAssetTypeName(asset_type_t assetType, std::string name)
m_asset_types_by_name.emplace(std::make_pair(std::move(name), assetType));
}

std::vector<Gdt*> ZoneCreator::CreateGdtList(ZoneCreationContext& context)
std::vector<Gdt*> ZoneCreator::CreateGdtList(const ZoneCreationContext& context)
{
std::vector<Gdt*> gdtList;
gdtList.reserve(context.m_gdt_files.size());
Expand All @@ -31,9 +31,9 @@ std::vector<Gdt*> ZoneCreator::CreateGdtList(ZoneCreationContext& context)
return gdtList;
}

bool ZoneCreator::CreateIgnoredAssetMap(ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const
bool ZoneCreator::CreateIgnoredAssetMap(const ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const
{
for (const auto& ignoreEntry : context.m_ignored_assets)
for (const auto& ignoreEntry : context.m_ignored_assets.m_entries)
{
const auto foundAssetTypeEntry = m_asset_types_by_name.find(ignoreEntry.m_type);
if (foundAssetTypeEntry == m_asset_types_by_name.end())
Expand Down Expand Up @@ -71,7 +71,7 @@ std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext&
if (!assetEntry.m_is_reference)
continue;

context.m_ignored_assets.emplace_back(assetEntry.m_asset_type, assetEntry.m_asset_name);
context.m_ignored_assets.m_entries.emplace_back(assetEntry.m_asset_type, assetEntry.m_asset_name, assetEntry.m_is_reference);
}

const auto assetLoadingContext = std::make_unique<AssetLoadingContext>(zone.get(), context.m_asset_search_path, CreateGdtList(context));
Expand Down
4 changes: 2 additions & 2 deletions src/Linker/Game/IW4/ZoneCreatorIW4.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ namespace IW4
std::unordered_map<std::string, asset_type_t> m_asset_types_by_name;

void AddAssetTypeName(asset_type_t assetType, std::string name);
static std::vector<Gdt*> CreateGdtList(ZoneCreationContext& context);
bool CreateIgnoredAssetMap(ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const;
static std::vector<Gdt*> CreateGdtList(const ZoneCreationContext& context);
bool CreateIgnoredAssetMap(const ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const;
void CreateZoneAssetPools(Zone* zone) const;

public:
Expand Down
8 changes: 4 additions & 4 deletions src/Linker/Game/IW5/ZoneCreatorIW5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void ZoneCreator::AddAssetTypeName(asset_type_t assetType, std::string name)
m_asset_types_by_name.emplace(std::make_pair(std::move(name), assetType));
}

std::vector<Gdt*> ZoneCreator::CreateGdtList(ZoneCreationContext& context)
std::vector<Gdt*> ZoneCreator::CreateGdtList(const ZoneCreationContext& context)
{
std::vector<Gdt*> gdtList;
gdtList.reserve(context.m_gdt_files.size());
Expand All @@ -31,9 +31,9 @@ std::vector<Gdt*> ZoneCreator::CreateGdtList(ZoneCreationContext& context)
return gdtList;
}

bool ZoneCreator::CreateIgnoredAssetMap(ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const
bool ZoneCreator::CreateIgnoredAssetMap(const ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const
{
for (const auto& ignoreEntry : context.m_ignored_assets)
for (const auto& ignoreEntry : context.m_ignored_assets.m_entries)
{
const auto foundAssetTypeEntry = m_asset_types_by_name.find(ignoreEntry.m_type);
if (foundAssetTypeEntry == m_asset_types_by_name.end())
Expand Down Expand Up @@ -71,7 +71,7 @@ std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext&
if (!assetEntry.m_is_reference)
continue;

context.m_ignored_assets.emplace_back(assetEntry.m_asset_type, assetEntry.m_asset_name);
context.m_ignored_assets.m_entries.emplace_back(assetEntry.m_asset_type, assetEntry.m_asset_name, assetEntry.m_is_reference);
}

const auto assetLoadingContext = std::make_unique<AssetLoadingContext>(zone.get(), context.m_asset_search_path, CreateGdtList(context));
Expand Down
4 changes: 2 additions & 2 deletions src/Linker/Game/IW5/ZoneCreatorIW5.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ namespace IW5
std::unordered_map<std::string, asset_type_t> m_asset_types_by_name;

void AddAssetTypeName(asset_type_t assetType, std::string name);
static std::vector<Gdt*> CreateGdtList(ZoneCreationContext& context);
bool CreateIgnoredAssetMap(ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const;
static std::vector<Gdt*> CreateGdtList(const ZoneCreationContext& context);
bool CreateIgnoredAssetMap(const ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const;
void CreateZoneAssetPools(Zone* zone) const;

public:
Expand Down
6 changes: 3 additions & 3 deletions src/Linker/Game/T5/ZoneCreatorT5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ std::vector<Gdt*> ZoneCreator::CreateGdtList(ZoneCreationContext& context)
return gdtList;
}

bool ZoneCreator::CreateIgnoredAssetMap(ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const
bool ZoneCreator::CreateIgnoredAssetMap(const ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const
{
for (const auto& ignoreEntry : context.m_ignored_assets)
for (const auto& ignoreEntry : context.m_ignored_assets.m_entries)
{
const auto foundAssetTypeEntry = m_asset_types_by_name.find(ignoreEntry.m_type);
if (foundAssetTypeEntry == m_asset_types_by_name.end())
Expand Down Expand Up @@ -72,7 +72,7 @@ std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext&
if (!assetEntry.m_is_reference)
continue;

context.m_ignored_assets.emplace_back(assetEntry.m_asset_type, assetEntry.m_asset_name);
context.m_ignored_assets.m_entries.emplace_back(assetEntry.m_asset_type, assetEntry.m_asset_name, assetEntry.m_is_reference);
}

const auto assetLoadingContext = std::make_unique<AssetLoadingContext>(zone.get(), context.m_asset_search_path, CreateGdtList(context));
Expand Down
2 changes: 1 addition & 1 deletion src/Linker/Game/T5/ZoneCreatorT5.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace T5

void AddAssetTypeName(asset_type_t assetType, std::string name);
static std::vector<Gdt*> CreateGdtList(ZoneCreationContext& context);
bool CreateIgnoredAssetMap(ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const;
bool CreateIgnoredAssetMap(const ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const;
void CreateZoneAssetPools(Zone* zone) const;

public:
Expand Down
10 changes: 5 additions & 5 deletions src/Linker/Game/T6/ZoneCreatorT6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void ZoneCreator::AddAssetTypeName(asset_type_t assetType, std::string name)
m_asset_types_by_name.emplace(std::make_pair(std::move(name), assetType));
}

std::vector<Gdt*> ZoneCreator::CreateGdtList(ZoneCreationContext& context)
std::vector<Gdt*> ZoneCreator::CreateGdtList(const ZoneCreationContext& context)
{
std::vector<Gdt*> gdtList;
gdtList.reserve(context.m_gdt_files.size());
Expand All @@ -33,9 +33,9 @@ std::vector<Gdt*> ZoneCreator::CreateGdtList(ZoneCreationContext& context)
return gdtList;
}

bool ZoneCreator::CreateIgnoredAssetMap(ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const
bool ZoneCreator::CreateIgnoredAssetMap(const ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const
{
for (const auto& ignoreEntry : context.m_ignored_assets)
for (const auto& ignoreEntry : context.m_ignored_assets.m_entries)
{
const auto foundAssetTypeEntry = m_asset_types_by_name.find(ignoreEntry.m_type);
if (foundAssetTypeEntry == m_asset_types_by_name.end())
Expand All @@ -58,7 +58,7 @@ void ZoneCreator::CreateZoneAssetPools(Zone* zone) const
zone->m_pools->InitPoolDynamic(assetType);
}

void ZoneCreator::HandleMetadata(Zone* zone, ZoneCreationContext& context) const
void ZoneCreator::HandleMetadata(Zone* zone, const ZoneCreationContext& context) const
{
std::vector<KeyValuePair> kvpList;

Expand Down Expand Up @@ -126,7 +126,7 @@ std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext&
if (!assetEntry.m_is_reference)
continue;

context.m_ignored_assets.emplace_back(assetEntry.m_asset_type, assetEntry.m_asset_name);
context.m_ignored_assets.m_entries.emplace_back(assetEntry.m_asset_type, assetEntry.m_asset_name, assetEntry.m_is_reference);
}

const auto assetLoadingContext = std::make_unique<AssetLoadingContext>(zone.get(), context.m_asset_search_path, CreateGdtList(context));
Expand Down
6 changes: 3 additions & 3 deletions src/Linker/Game/T6/ZoneCreatorT6.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ namespace T6
std::unordered_map<std::string, asset_type_t> m_asset_types_by_name;

void AddAssetTypeName(asset_type_t assetType, std::string name);
static std::vector<Gdt*> CreateGdtList(ZoneCreationContext& context);
bool CreateIgnoredAssetMap(ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const;
static std::vector<Gdt*> CreateGdtList(const ZoneCreationContext& context);
bool CreateIgnoredAssetMap(const ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const;
void CreateZoneAssetPools(Zone* zone) const;
void HandleMetadata(Zone* zone, ZoneCreationContext& context) const;
void HandleMetadata(Zone* zone, const ZoneCreationContext& context) const;

public:
ZoneCreator();
Expand Down
Loading

0 comments on commit 1384c91

Please sign in to comment.