Skip to content

Commit

Permalink
Merge pull request #257 from Laupetin/feature/t6-default-assets
Browse files Browse the repository at this point in the history
chore: add asset loaders for all asset types of t6
  • Loading branch information
Laupetin committed Sep 8, 2024
2 parents f891241 + 931e128 commit 87fb3e3
Show file tree
Hide file tree
Showing 73 changed files with 829 additions and 102 deletions.
13 changes: 13 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderAddonMapEnts.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "AssetLoaderAddonMapEnts.h"

#include "Game/T6/T6.h"
#include "ObjLoading.h"

using namespace T6;

void* AssetLoaderAddonMapEnts::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory)
{
auto* asset = memory->Alloc<AssetAddonMapEnts::Type>();
asset->name = memory->Dup(assetName.c_str());
return asset;
}
14 changes: 14 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderAddonMapEnts.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include "AssetLoading/BasicAssetLoader.h"
#include "Game/T6/T6.h"
#include "SearchPath/ISearchPath.h"

namespace T6
{
class AssetLoaderAddonMapEnts final : public BasicAssetLoader<AssetAddonMapEnts>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;
};
} // namespace T6
23 changes: 23 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderClipMap.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "AssetLoaderClipMap.h"

#include "Game/T6/T6.h"
#include "ObjLoading.h"

using namespace T6;

void* AssetLoaderClipMapBase::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory)
{
auto* asset = memory->Alloc<clipMap_t>();
asset->name = memory->Dup(assetName.c_str());
return asset;
}

asset_type_t AssetLoaderClipMap::GetHandlingAssetType() const
{
return ASSET_TYPE_CLIPMAP;
}

asset_type_t AssetLoaderClipMapPvs::GetHandlingAssetType() const
{
return ASSET_TYPE_CLIPMAP_PVS;
}
26 changes: 26 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderClipMap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#pragma once

#include "AssetLoading/BasicAssetLoader.h"
#include "Game/T6/T6.h"
#include "SearchPath/ISearchPath.h"

namespace T6
{
class AssetLoaderClipMapBase : public BasicAssetLoaderWithoutType<clipMap_t>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;
};

class AssetLoaderClipMap final : public AssetLoaderClipMapBase
{
public:
[[nodiscard]] asset_type_t GetHandlingAssetType() const override;
};

class AssetLoaderClipMapPvs final : public AssetLoaderClipMapBase
{
public:
[[nodiscard]] asset_type_t GetHandlingAssetType() const override;
};
} // namespace T6
13 changes: 13 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderComWorld.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "AssetLoaderComWorld.h"

#include "Game/T6/T6.h"
#include "ObjLoading.h"

using namespace T6;

void* AssetLoaderComWorld::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory)
{
auto* asset = memory->Alloc<AssetComWorld::Type>();
asset->name = memory->Dup(assetName.c_str());
return asset;
}
14 changes: 14 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderComWorld.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include "AssetLoading/BasicAssetLoader.h"
#include "Game/T6/T6.h"
#include "SearchPath/ISearchPath.h"

namespace T6
{
class AssetLoaderComWorld final : public BasicAssetLoader<AssetComWorld>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;
};
} // namespace T6
13 changes: 13 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderDDL.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "AssetLoaderDDL.h"

#include "Game/T6/T6.h"
#include "ObjLoading.h"

using namespace T6;

void* AssetLoaderDDL::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory)
{
auto* asset = memory->Alloc<AssetDDL::Type>();
asset->name = memory->Dup(assetName.c_str());
return asset;
}
14 changes: 14 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderDDL.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include "AssetLoading/BasicAssetLoader.h"
#include "Game/T6/T6.h"
#include "SearchPath/ISearchPath.h"

namespace T6
{
class AssetLoaderDDL final : public BasicAssetLoader<AssetDDL>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;
};
} // namespace T6
13 changes: 13 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderDestructibleDef.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "AssetLoaderDestructibleDef.h"

#include "Game/T6/T6.h"
#include "ObjLoading.h"

using namespace T6;

void* AssetLoaderDestructibleDef::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory)
{
auto* asset = memory->Alloc<AssetDestructibleDef::Type>();
asset->name = memory->Dup(assetName.c_str());
return asset;
}
14 changes: 14 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderDestructibleDef.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include "AssetLoading/BasicAssetLoader.h"
#include "Game/T6/T6.h"
#include "SearchPath/ISearchPath.h"

namespace T6
{
class AssetLoaderDestructibleDef final : public BasicAssetLoader<AssetDestructibleDef>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;
};
} // namespace T6
13 changes: 13 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderEmblemSet.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "AssetLoaderEmblemSet.h"

#include "Game/T6/T6.h"
#include "ObjLoading.h"

using namespace T6;

void* AssetLoaderEmblemSet::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory)
{
// Asset does not have a name
// So this cannot be an asset reference
return nullptr;
}
14 changes: 14 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderEmblemSet.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include "AssetLoading/BasicAssetLoader.h"
#include "Game/T6/T6.h"
#include "SearchPath/ISearchPath.h"

namespace T6
{
class AssetLoaderEmblemSet final : public BasicAssetLoader<AssetEmblemSet>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;
};
} // namespace T6
13 changes: 13 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderFont.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "AssetLoaderFont.h"

#include "Game/T6/T6.h"
#include "ObjLoading.h"

using namespace T6;

void* AssetLoaderFont::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory)
{
auto* asset = memory->Alloc<AssetFont::Type>();
asset->fontName = memory->Dup(assetName.c_str());
return asset;
}
14 changes: 14 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderFont.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include "AssetLoading/BasicAssetLoader.h"
#include "Game/T6/T6.h"
#include "SearchPath/ISearchPath.h"

namespace T6
{
class AssetLoaderFont final : public BasicAssetLoader<AssetFont>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;
};
} // namespace T6
7 changes: 3 additions & 4 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderFontIcon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ using namespace T6;

void* AssetLoaderFontIcon::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory)
{
auto* fontIcon = memory->Create<FontIcon>();
memset(fontIcon, 0, sizeof(FontIcon));
fontIcon->name = memory->Dup(assetName.c_str());
return fontIcon;
auto* asset = memory->Alloc<AssetFontIcon::Type>();
asset->name = memory->Dup(assetName.c_str());
return asset;
}

bool AssetLoaderFontIcon::CanLoadFromRaw() const
Expand Down
13 changes: 13 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderFootstepFxTable.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "AssetLoaderFootstepFxTable.h"

#include "Game/T6/T6.h"
#include "ObjLoading.h"

using namespace T6;

void* AssetLoaderFootstepFxTable::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory)
{
auto* asset = memory->Alloc<AssetFootstepFxTable::Type>();
asset->name = memory->Dup(assetName.c_str());
return asset;
}
14 changes: 14 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderFootstepFxTable.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include "AssetLoading/BasicAssetLoader.h"
#include "Game/T6/T6.h"
#include "SearchPath/ISearchPath.h"

namespace T6
{
class AssetLoaderFootstepFxTable final : public BasicAssetLoader<AssetFootstepFxTable>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;
};
} // namespace T6
13 changes: 13 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderFootstepTable.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "AssetLoaderFootstepTable.h"

#include "Game/T6/T6.h"
#include "ObjLoading.h"

using namespace T6;

void* AssetLoaderFootstepTable::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory)
{
auto* asset = memory->Alloc<AssetFootstepTable::Type>();
asset->name = memory->Dup(assetName.c_str());
return asset;
}
14 changes: 14 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderFootstepTable.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include "AssetLoading/BasicAssetLoader.h"
#include "Game/T6/T6.h"
#include "SearchPath/ISearchPath.h"

namespace T6
{
class AssetLoaderFootstepTable final : public BasicAssetLoader<AssetFootstepTable>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;
};
} // namespace T6
13 changes: 13 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderFx.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "AssetLoaderFx.h"

#include "Game/T6/T6.h"
#include "ObjLoading.h"

using namespace T6;

void* AssetLoaderFx::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory)
{
auto* asset = memory->Alloc<AssetFx::Type>();
asset->name = memory->Dup(assetName.c_str());
return asset;
}
14 changes: 14 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderFx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include "AssetLoading/BasicAssetLoader.h"
#include "Game/T6/T6.h"
#include "SearchPath/ISearchPath.h"

namespace T6
{
class AssetLoaderFx final : public BasicAssetLoader<AssetFx>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;
};
} // namespace T6
13 changes: 13 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderGameWorldMp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "AssetLoaderGameWorldMp.h"

#include "Game/T6/T6.h"
#include "ObjLoading.h"

using namespace T6;

void* AssetLoaderGameWorldMp::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory)
{
auto* asset = memory->Alloc<AssetGameWorldMp::Type>();
asset->name = memory->Dup(assetName.c_str());
return asset;
}
14 changes: 14 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderGameWorldMp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include "AssetLoading/BasicAssetLoader.h"
#include "Game/T6/T6.h"
#include "SearchPath/ISearchPath.h"

namespace T6
{
class AssetLoaderGameWorldMp final : public BasicAssetLoader<AssetGameWorldMp>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;
};
} // namespace T6
13 changes: 13 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderGameWorldSp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "AssetLoaderGameWorldSp.h"

#include "Game/T6/T6.h"
#include "ObjLoading.h"

using namespace T6;

void* AssetLoaderGameWorldSp::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory)
{
auto* asset = memory->Alloc<AssetGameWorldSp::Type>();
asset->name = memory->Dup(assetName.c_str());
return asset;
}
14 changes: 14 additions & 0 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderGameWorldSp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include "AssetLoading/BasicAssetLoader.h"
#include "Game/T6/T6.h"
#include "SearchPath/ISearchPath.h"

namespace T6
{
class AssetLoaderGameWorldSp final : public BasicAssetLoader<AssetGameWorldSp>
{
public:
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;
};
} // namespace T6
7 changes: 3 additions & 4 deletions src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderGfxImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ using namespace T6;

void* AssetLoaderGfxImage::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory)
{
auto* image = memory->Create<GfxImage>();
memset(image, 0, sizeof(GfxImage));
image->name = memory->Dup(assetName.c_str());
return image;
auto* asset = memory->Alloc<AssetImage::Type>();
asset->name = memory->Dup(assetName.c_str());
return asset;
}

bool AssetLoaderGfxImage::CanLoadFromRaw() const
Expand Down
Loading

0 comments on commit 87fb3e3

Please sign in to comment.