Skip to content

Commit 1c73d2e

Browse files
committed
Added Unit Customizations (This includes ECS Components, Singleton, Util, ClientDBs)
Simplified ECS Namespaces Updated UI Handle Input to respect ImGui's request to use the mouse Implemented support for MapChunk version 7 Added support for preallocating Chunks in TerrainRenderer Added support for discovering textures that use .png, .jpg and .jpeg Added Resources folder to "Source", this now contains Fonts, Scripts and ClientDB Updated Submodule Engine
1 parent b6ff55b commit 1c73d2e

File tree

102 files changed

+3404
-1361
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+3404
-1361
lines changed

Source/Game-Lib/Game-Lib/Application/Application.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,23 @@
1010
#include "Game-Lib/ECS/Singletons/NetworkState.h"
1111
#include "Game-Lib/ECS/Singletons/RenderState.h"
1212
#include "Game-Lib/ECS/Util/EventUtil.h"
13-
#include "Game-Lib/ECS/Util/Database/MapUtil.h"
1413
#include "Game-Lib/ECS/Util/Database/CameraUtil.h"
1514
#include "Game-Lib/ECS/Util/Database/CursorUtil.h"
1615
#include "Game-Lib/ECS/Util/Database/IconUtil.h"
1716
#include "Game-Lib/ECS/Util/Database/ItemUtil.h"
1817
#include "Game-Lib/ECS/Util/Database/LightUtil.h"
18+
#include "Game-Lib/ECS/Util/Database/MapUtil.h"
19+
#include "Game-Lib/ECS/Util/Database/TextureUtil.h"
20+
#include "Game-Lib/ECS/Util/Database/UnitCustomizationUtil.h"
1921
#include "Game-Lib/Editor/EditorHandler.h"
2022
#include "Game-Lib/Gameplay/Database/Shared.h"
2123
#include "Game-Lib/Gameplay/GameConsole/GameConsole.h"
2224
#include "Game-Lib/Rendering/GameRenderer.h"
2325
#include "Game-Lib/Scripting/LuaManager.h"
26+
#include "Game-Lib/Scripting/Systems/LuaSystemBase.h"
2427
#include "Game-Lib/Util/ClientDBUtil.h"
2528
#include "Game-Lib/Util/ServiceLocator.h"
2629
#include "Game-Lib/Util/TextureUtil.h"
27-
#include "Game-Lib/Scripting/LuaManager.h"
28-
#include "Game-Lib/Scripting/Systems/LuaSystemBase.h"
2930

3031
#include <Base/Types.h>
3132
#include <Base/CVarSystem/CVarSystem.h>
@@ -462,18 +463,20 @@ bool Application::Render(f32 deltaTime, f32& timeSpentWaiting)
462463

463464
void Application::RefreshDatabases()
464465
{
465-
ECS::Util::Database::Camera::Refresh();
466-
ECS::Util::Database::Cursor::Refresh();
467-
ECS::Util::Database::Icon::Refresh();
468-
ECS::Util::Database::Map::Refresh();
469-
ECS::Util::Database::Light::Refresh();
470-
ECS::Util::Database::Item::Refresh();
466+
ECSUtil::Icon::Refresh();
467+
ECSUtil::Camera::Refresh();
468+
ECSUtil::Cursor::Refresh();
469+
ECSUtil::Map::Refresh();
470+
ECSUtil::Light::Refresh();
471+
ECSUtil::Texture::Refresh();
472+
ECSUtil::Item::Refresh();
473+
ECSUtil::UnitCustomization::Refresh();
471474
}
472475

473476
void Application::SaveCDB()
474477
{
475478
entt::registry::context& ctx = _registries.dbRegistry->ctx();
476-
auto& clientDBSingleton = ctx.get<ECS::Singletons::Database::ClientDBSingleton>();
479+
auto& clientDBSingleton = ctx.get<ECS::Singletons::ClientDBSingleton>();
477480

478481
std::filesystem::path absolutePath = std::filesystem::absolute("Data/ClientDB").make_preferred();
479482

Source/Game-Lib/Game-Lib/ECS/Components/Tags.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ namespace ECS::Components
55
{
66
struct SkyboxModelTag {};
77
struct AnimatingTag {};
8+
struct UnitRebuildSkinTexture {};
9+
struct UnitRebuildGeosets {};
810
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#pragma once
2+
#include <Base/Types.h>
3+
4+
#include <Renderer/Descriptors/TextureDesc.h>
5+
6+
#include <Gameplay/GameDefine.h>
7+
8+
namespace ECS::Components
9+
{
10+
struct UnitComponentSectionsInUse
11+
{
12+
public:
13+
u16 fullBody : 1 = 0;
14+
u16 headUpper : 1 = 0;
15+
u16 headLower : 1 = 0;
16+
u16 torsoUpper : 1 = 0;
17+
u16 torsoLower : 1 = 0;
18+
u16 armUpper : 1 = 0;
19+
u16 armLower : 1 = 0;
20+
u16 hand : 1 = 0;
21+
u16 legUpper : 1 = 0;
22+
u16 legLower : 1 = 0;
23+
u16 foot : 1 = 0;
24+
};
25+
26+
struct UnitCustomizationFlags
27+
{
28+
public:
29+
u8 useCustomSkin : 1 = 0;
30+
u8 forceRefresh : 1 = 0;
31+
u8 hairChanged : 1 = 0;
32+
u8 hasGloveModel : 1 = 0;
33+
u8 hasBeltModel : 1 = 0;
34+
u8 hasChestDress : 1 = 0;
35+
u8 hasPantsDress : 1 = 0;
36+
};
37+
38+
struct UnitCustomization
39+
{
40+
public:
41+
u8 skinID = 0;
42+
u8 faceID = 0;
43+
u8 facialHairID = 255;
44+
u8 hairStyleID = 0;
45+
u8 hairColorID = 0;
46+
u8 earringsID = 255;
47+
u8 piercingsID = 255;
48+
u8 tattoosID = 255;
49+
u8 featuresID = 255;
50+
u8 tusksID = 255;
51+
u8 hornStyleID = 255;
52+
u8 hornColorID = 255;
53+
54+
UnitCustomizationFlags flags;
55+
UnitComponentSectionsInUse componentSectionsInUse;
56+
57+
Renderer::TextureID skinTextureID = Renderer::TextureID::Invalid();
58+
};
59+
}

Source/Game-Lib/Game-Lib/ECS/Singletons/Database/CameraSaveSingleton.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace ECS
1515
{
16-
namespace Singletons::Database
16+
namespace Singletons
1717
{
1818
struct CameraSaveSingleton
1919
{

Source/Game-Lib/Game-Lib/ECS/Singletons/Database/ClientDBSingleton.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ enum class ClientDBHash : u32
3333
CreatureDisplayInfoExtra = GetHash("CreatureDisplayInfoExtra"_h),
3434
CreatureModelData = GetHash("CreatureModelData"_h),
3535
Item = GetHash("Item"_h),
36+
ItemStatTypes = GetHash("ItemStatTypes"_h),
3637
ItemStatTemplate = GetHash("ItemStatTemplate"_h),
3738
ItemArmorTemplate = GetHash("ItemArmorTemplate"_h),
3839
ItemWeaponTemplate = GetHash("ItemWeaponTemplate"_h),
@@ -41,6 +42,12 @@ enum class ClientDBHash : u32
4142
ItemDisplayInfo = GetHash("ItemDisplayInfo"_h),
4243
ItemDisplayMaterialResources = GetHash("ItemDisplayInfoMaterialRes"_h),
4344
ItemDisplayModelMaterialResources = GetHash("ItemDisplayInfoModelMatRes"_h),
45+
UnitRace = GetHash("UnitRace"_h),
46+
UnitTextureSection = GetHash("UnitTextureSection"_h),
47+
UnitCustomizationOption = GetHash("UnitCustomizationOption"_h),
48+
UnitCustomizationGeoset = GetHash("UnitCustomizationGeoset"_h),
49+
UnitCustomizationMaterial = GetHash("UnitCustomizationMaterial"_h),
50+
UnitRaceCustomizationChoice = GetHash("UnitRaceCustomizationChoice"_h),
4451
Spell = GetHash("Spell"_h),
4552
Light = GetHash("Light"_h),
4653
LightData = GetHash("LightData"_h),
@@ -51,7 +58,7 @@ enum class ClientDBHash : u32
5158

5259
namespace ECS
5360
{
54-
namespace Singletons::Database
61+
namespace Singletons
5562
{
5663
struct ClientDBSingleton
5764
{

Source/Game-Lib/Game-Lib/ECS/Singletons/Database/ItemSingleton.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace ECS
1212
{
13-
namespace Singletons::Database
13+
namespace Singletons
1414
{
1515
struct ItemSingleton
1616
{
@@ -40,6 +40,12 @@ namespace ECS
4040
std::array<u32, NumArraySlots> sideToModelHash = { };
4141
};
4242

43+
struct ItemDisplayInfoComponentSectionData
44+
{
45+
public:
46+
robin_hood::unordered_map<u8, u32> componentSectionToTextureHash;
47+
};
48+
4349
public:
4450
ItemSingleton() {}
4551

@@ -54,6 +60,9 @@ namespace ECS
5460

5561
robin_hood::unordered_map<u32, HelmModelMapping> helmModelResourcesIDToModelMapping;
5662
robin_hood::unordered_map<u32, ShoulderModelMapping> shoulderModelResourcesIDToModelMapping;
63+
64+
robin_hood::unordered_map<u64, u32> itemDisplayInfoMaterialResourcesKeyToID;
65+
robin_hood::unordered_map<u32, ItemDisplayInfoComponentSectionData> itemDisplayInfoToComponentSectionData;
5766
};
5867
}
5968
}

Source/Game-Lib/Game-Lib/ECS/Singletons/Database/MapSingleton.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace ECS
1515
{
16-
namespace Singletons::Database
16+
namespace Singletons
1717
{
1818
struct MapSingleton
1919
{
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#pragma once
2+
#include <Base/Types.h>
3+
4+
#include <robinhood/robinhood.h>
5+
6+
namespace ECS
7+
{
8+
namespace Singletons
9+
{
10+
struct TextureSingleton
11+
{
12+
public:
13+
TextureSingleton() {}
14+
15+
robin_hood::unordered_map<u32, std::string> textureHashToPath;
16+
robin_hood::unordered_map<u32, std::vector<u32>> materialResourcesIDToTextureHashes;
17+
};
18+
}
19+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#pragma once
2+
#include "Game-Lib/Gameplay/Database/Unit.h"
3+
4+
#include <Base/Types.h>
5+
6+
#include <Renderer/Descriptors/TextureDesc.h>
7+
8+
#include <robinhood/robinhood.h>
9+
10+
namespace ECS
11+
{
12+
namespace Singletons
13+
{
14+
struct UnitCustomizationSingleton
15+
{
16+
public:
17+
UnitCustomizationSingleton() {}
18+
19+
robin_hood::unordered_map<u32, Database::Unit::UnitModelInfo> modelIDToUnitModelInfo;
20+
robin_hood::unordered_map<u32, GameDefine::UnitRace> displayIDToUnitRace;
21+
22+
robin_hood::unordered_map<::Database::Unit::UnitTextureSection::Type, u32> unitTextureSectionTypeToID;
23+
robin_hood::unordered_map<u32, std::vector<u32>> unitBaseCustomizationKeyToChoiceIDList;
24+
25+
robin_hood::unordered_map<u32, u32> unitCustomizationKeyToTextureHash;
26+
robin_hood::unordered_map<u32, Renderer::TextureID> unitCustomizationKeyToTextureID;
27+
robin_hood::unordered_map<u32, Renderer::TextureID> customizationMaterialIDToTextureID;
28+
robin_hood::unordered_map<u32, Renderer::TextureID> itemTextureHashToTextureID;
29+
30+
robin_hood::unordered_map<u32, u16> geosetIDToGeosetKey;
31+
32+
robin_hood::unordered_map<u32, u32> choiceIDToOptionData;
33+
robin_hood::unordered_map<u32, u32> choiceIDToGeosetID;
34+
robin_hood::unordered_map<u32, u32> choiceIDToTextureSectionID1;
35+
robin_hood::unordered_map<u32, u32> choiceIDToTextureSectionID2;
36+
robin_hood::unordered_map<u32, u32> choiceIDToTextureSectionID3;
37+
robin_hood::unordered_map<u32, u32> choiceIDToTextureHash1;
38+
robin_hood::unordered_map<u32, u32> choiceIDToTextureHash2;
39+
robin_hood::unordered_map<u32, u32> choiceIDToTextureHash3;
40+
};
41+
}
42+
}

Source/Game-Lib/Game-Lib/ECS/Singletons/TextureSingleton.h

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)