From 0d91ec1ebb5f21eda8866e1504937d5aab63a128 Mon Sep 17 00:00:00 2001 From: Asuro Date: Sun, 11 May 2025 22:32:50 +0200 Subject: [PATCH] working sockets --- assets/blender/Channels.blend | 4 +- src/game/Gen.cpp | 8 +++ src/game/Gen.h | 1 + src/game/Level.cpp | 32 +++++++++- src/game/Level.h | 14 ++++- src/game/Mesh.cpp | 34 ++++++++++ src/game/Puzzle.h | 5 +- src/game/Tools.cpp | 17 ++--- src/game/data/puzzles/0.pzl | 4 +- src/game/data/static/puzzle.dat | Bin 10572 -> 17316 bytes src/game/mini.def | 6 ++ src/game/rendering/Rendering.h | 11 ++++ src/gen/Generated.cpp | 98 +++++++++++++++++++++++++++++ src/gen/Generated.h | 49 +++++++++------ src/models/channel_cover_big.glb | 4 +- src/models/channel_cover_small.glb | 4 +- src/models/w straight.glb | 4 +- 17 files changed, 252 insertions(+), 43 deletions(-) diff --git a/assets/blender/Channels.blend b/assets/blender/Channels.blend index 1ce6a47..11e8950 100644 --- a/assets/blender/Channels.blend +++ b/assets/blender/Channels.blend @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fed342e10d8a28c6fb61c17dac4060472f067d9c329a5305155dbcf081b76005 -size 1118912 +oid sha256:242cf9d56730743a30f5b077a79d23a36a9c555ba2b1d28b3aee829fdd80e26c +size 1120493 diff --git a/src/game/Gen.cpp b/src/game/Gen.cpp index 97c32c2..0c53bc0 100644 --- a/src/game/Gen.cpp +++ b/src/game/Gen.cpp @@ -320,6 +320,14 @@ namespace Gen return mat; } + Mat4 RotationFromQuaternion(const Vec4& quaternion) + { + Mat4 mat; + bx::Quaternion quat{quaternion.x, quaternion.y, quaternion.z, quaternion.w}; + bx::mtxFromQuaternion(mat.M, quat); + return mat; + } + float Magnitude(const Vec4& vec) { return bx::sqrt(vec.x * vec.x + vec.y * vec.y + vec.z * vec.z + vec.w * vec.w); diff --git a/src/game/Gen.h b/src/game/Gen.h index 5d2b46c..adc3172 100644 --- a/src/game/Gen.h +++ b/src/game/Gen.h @@ -75,6 +75,7 @@ namespace Gen Vec3 EulerFromRotation(const Mat4& rotation); Mat4 RotationFromEuler(const Vec3& euler); + Mat4 RotationFromQuaternion(const Vec4& quaternion); float DotProduct(Vec3 a, Vec3 b); Vec3 CrossProduct(Vec3 a, Vec3 b); diff --git a/src/game/Level.cpp b/src/game/Level.cpp index a04ce6f..50586d2 100644 --- a/src/game/Level.cpp +++ b/src/game/Level.cpp @@ -113,6 +113,7 @@ namespace Game needReset |= Cubes.Setup(storagePtr, needReset); needReset |= Tests.Setup(storagePtr, needReset); needReset |= PuzzleTiles.Setup(storagePtr, needReset); + needReset |= PuzzleTileCovers.Setup(storagePtr, needReset); needReset |= UIQuads.Setup(storagePtr, needReset); needReset |= LevelEntities.Setup(storagePtr, needReset); @@ -179,6 +180,7 @@ namespace Game UIQuads.Count = 0; PuzzleTiles.Count = 0; + PuzzleTileCovers.Count = 0; for (int32_t i = 0; i < BX_COUNTOF(Puzzles); ++i) { if (Puzzles[i].Data.ID != UINT16_MAX) @@ -324,6 +326,7 @@ namespace Game Cubes.Render(models, materials, textures); Tests.Render(models, materials, textures); PuzzleTiles.Render(models, materials, textures); + PuzzleTileCovers.Render(models, materials, textures); if (player.InteractionM == InteractionMode::ReadTablet) { UIQuads.Render(models, materials, textures); @@ -358,6 +361,14 @@ namespace Game auto& tile = level.PuzzleTiles.Get(TileHandles[i]); tile.EData.MaterialHandle = EMaterial::Default; + for (int32_t j = 0; j < Puzzle::Config::MaxCoversInTile; ++j) + { + int32_t idx = i * Puzzle::Config::MaxCoversInTile + j; + CoverHandles[idx] = level.PuzzleTileCovers.New(); + auto& cover = level.PuzzleTileCovers.Get(CoverHandles[idx]); + cover.EData.Visible = false; + } + UIPlacedCards[i] = level.UIQuads.New(); auto& quad = level.UIQuads.Get(UIPlacedCards[i]); quad.EData.ModelH = GameRendering::Get().GetModelHandleFromPath("models/plane.glb"); @@ -518,11 +529,12 @@ namespace Game auto& quad = level.UIQuads.Get(UIPlacedCards[cardIdx]); bool isValid = Puzzle::IsValid(card.RefCard); + auto& staticCard = isValid ? staticCards[card.RefCard.Idx] : staticCards[0]; // World Tile tile.EData.Visible = IsActive; - tile.EData.ModelH = - isValid ? staticCards[card.RefCard.Idx].BaseModelHandle : staticCards[0].BaseModelHandle; + tile.EData.ModelH = staticCard.BaseModelHandle; + tile.EData.DotColor = visuals.TileDotColor; tile.EData.BaseColor = visuals.TileBaseColor; @@ -538,6 +550,22 @@ namespace Game tile.EData.Transform.Position = cardPos; bx::mtxRotateY(tile.EData.Transform.Rotation.M, card.Rotation * bx::kPi * 0.5f); + // Covers + if (IsValid(staticCard.BaseModelHandle)) + { + auto& model = GameRendering::Get().Models[staticCard.BaseModelHandle.ModelIdx]; + for (int32_t i = 0; i < model.SocketCount; ++i) + { + auto& cover = + level.PuzzleTileCovers.Get(CoverHandles[cardIdx * Puzzle::Config::MaxCoversInTile + i]); + cover.EData.Visible = true; + cover.EData.ModelH = staticCard.Sockets[i].Model; + cover.EData.Transform = tile.EData.Transform; + Gen::TranslateLocal(cover.EData.Transform, model.Sockets[i].Pos); + Gen::RotateLocal(cover.EData.Transform, Gen::EulerFromRotation(model.Sockets[i].Rot)); + } + } + // UI Quad quad.EData.Visible = isValid && IsActive; quad.EData.TextureHandle = diff --git a/src/game/Level.h b/src/game/Level.h index 6ce4a95..6405550 100644 --- a/src/game/Level.h +++ b/src/game/Level.h @@ -57,6 +57,12 @@ namespace Game EntityRenderData EData; }; + ENTITY_HANDLE(PuzzleTileCoverHandle); + struct PuzzleTileCover + { + EntityRenderData EData; + }; + ENTITY_HANDLE(UIQuadEntityHandle); struct UIQuadEntity { @@ -148,6 +154,7 @@ namespace Game Gen::PuzzleData Data; Gen::Vec3 WorldPosition; PuzzleTileEntityHandle TileHandles[Puzzle::Config::MaxCardsInPuzzle]; + PuzzleTileCoverHandle CoverHandles[Puzzle::Config::MaxCardsInPuzzle * Puzzle::Config::MaxCoversInTile]; UIQuadEntityHandle UIPlacedCards[Puzzle::Config::MaxCardsInPuzzle]; UIQuadEntityHandle UIAvailableCards[Puzzle::Config::MaxAvailableStacks * UIAvailableCardMaxStackPreview]; Gen::PuzPos DraggedCard{-1, -1}; @@ -164,8 +171,9 @@ namespace Game public: EntityManager Cubes; EntityManager Tests; - EntityManager PuzzleTiles; - EntityManager UIQuads; + EntityManager PuzzleTiles; + EntityManager PuzzleTileCovers; + EntityManager UIQuads; EntityManager LevelEntities; CubeHandle PlayerOutsideViewCube; @@ -173,7 +181,7 @@ namespace Game public: Gen::StaticPuzzleData PuzzleData; - WorldPuzzle Puzzles[3]; + WorldPuzzle Puzzles[Puzzle::Config::MaxVisiblePuzzles]; public: void Setup(GameData& data); diff --git a/src/game/Mesh.cpp b/src/game/Mesh.cpp index 3d21a72..0037ec4 100644 --- a/src/game/Mesh.cpp +++ b/src/game/Mesh.cpp @@ -1,3 +1,4 @@ +#include "Gen.h" #include "Global.h" #include "Log.h" #include "Mesh.h" @@ -92,6 +93,39 @@ namespace Game } mesh.VertexBuffer = bgfx::createVertexBuffer(vbMem, mesh.VertLayout); } + + for (auto& node : model.nodes) + { + if (bx::strFindI(node.name.c_str(), "_slot_").getLength() > 0) + { + if (mesh.SocketCount >= mesh.MaxSocketCount) + { + LOG_WARN("Too many sockets on mesh!"); + break; + } + auto& socket = mesh.Sockets[mesh.SocketCount]; + if (node.translation.size() >= 3) + { + socket.Pos.x = node.translation[0]; + socket.Pos.y = node.translation[1]; + socket.Pos.z = node.translation[2]; + } + if (node.rotation.size() >= 4) + { + socket.Rot = Gen::RotationFromQuaternion({static_cast(node.rotation[0]), + static_cast(node.rotation[1]), + static_cast(node.rotation[2]), + static_cast(node.rotation[3])}); + } + if (node.matrix.size() >= 0) + { + LOG_WARN("TODO: support matrix!"); + } + bx::strCopy(&socket.Name[0], socket.MaxSocketNameLength, node.name.c_str()); + ++mesh.SocketCount; + } + } + return true; } diff --git a/src/game/Puzzle.h b/src/game/Puzzle.h index a1f22dc..08bc632 100644 --- a/src/game/Puzzle.h +++ b/src/game/Puzzle.h @@ -12,16 +12,19 @@ namespace Puzzle struct Config { + static constexpr uint32_t MaxVisiblePuzzles = 3; static constexpr uint32_t CardSize = 2; static constexpr uint32_t NodesPerCard = CardSize * CardSize; - static constexpr uint32_t MaxElementsPerTile = 4; static constexpr uint32_t MaxPuzzleSizeCards = 16; static constexpr uint32_t MaxCardsInPuzzle = MaxPuzzleSizeCards * MaxPuzzleSizeCards; static constexpr uint32_t MaxPuzzleSizeTiles = 16 * CardSize; static constexpr uint32_t MaxTilesInPuzzle = MaxPuzzleSizeTiles * MaxPuzzleSizeTiles; + static constexpr uint32_t MaxTilesTotal = MaxTilesInPuzzle * MaxVisiblePuzzles; static constexpr uint32_t MaxAvailableStacks = 16; static constexpr uint32_t MaxGoalPositions = 16; static constexpr float CardScaleWorld = 10.0f; + static constexpr uint32_t MaxCoversInTile = 8; + static constexpr uint32_t MaxCoversTotal = MaxCoversInTile * MaxTilesTotal; }; void Setup(); diff --git a/src/game/Tools.cpp b/src/game/Tools.cpp index 025fa79..7a50a4b 100644 --- a/src/game/Tools.cpp +++ b/src/game/Tools.cpp @@ -421,14 +421,17 @@ namespace Tools Tools::ModelDropdown(card.BaseModelHandle); Tools::TextureDropdown(card.BoardTextureHandle); - if (ImGui::TreeNodeEx("Covers")) + if (IsValid(card.BaseModelHandle)) { - Tools::ModelDropdown(card.NorthCoverHandle, "North Cover"); - Tools::ModelDropdown(card.EastCoverHandle, "East Cover"); - Tools::ModelDropdown(card.SouthCoverHandle, "South Cover"); - Tools::ModelDropdown(card.WestCoverHandle, "West Cover"); - - ImGui::TreePop(); + auto& mdl = rendering.Models[card.BaseModelHandle.ModelIdx]; + if (mdl.SocketCount > 0 && ImGui::TreeNodeEx("Slots")) + { + for (int32_t sIdx = 0; sIdx < mdl.SocketCount; ++sIdx) + { + Tools::ModelDropdown(card.Sockets[sIdx].Model, mdl.Sockets[sIdx].Name); + } + ImGui::TreePop(); + } } ImGui::Text("Card"); diff --git a/src/game/data/puzzles/0.pzl b/src/game/data/puzzles/0.pzl index 7716ca9..c507e28 100644 --- a/src/game/data/puzzles/0.pzl +++ b/src/game/data/puzzles/0.pzl @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8cad609d7071e132eccb3417b1cb5c566db7dbd7290fe2432c712ca084d4882d -size 10300 +oid sha256:87b57c10d2d0024161336d00112e281236bece2bed26194e3dce33e89be7eaa7 +size 10312 diff --git a/src/game/data/static/puzzle.dat b/src/game/data/static/puzzle.dat index ca59d71361b3bc1bcbe301273c036f6a7a4eb5c4..bcea19f15e1bab7527a49c9fd42d654a3573c02c 100644 GIT binary patch literal 17316 zcmWFz2#sQ7U}RumxLvHn$iTqMa7UJb;S(bRgN;5!EVv}GBr`dnw5lp6)g`eck%2_O z#K6eFM4}$*DtDl+aU`4elYy1t9|Jqd`i75&Jq!#C!cKf8$Z5$ru_%R9A96AvQ6sGbE$zW@@OUQAC04u(Jmeue}F0fqtweujDm0fv4CeujAr>MuT$-2@oLW+nnU`Knij!Cv*csRvI7V>3Jj1}taFcb<+3H#b7kl50+CZfaghNM%7PEi4-~b6AG}2Ll7c?3yEj zzWFJsIUb35DLLe&A|?h-2CiWpQiMFG#=ya#$G}QR*)Wy|rKLSy2hM}qNWuBZ*{LPu zd6tm@xxGT38ADr_%ZN@#ptu92rG>{M6GKufN=l1T$u5~j%Ozt5E(Y5Xot{8##M_w_ zQ^Qh|O+aajT+G724Ta>IFx2(2GB7f*F)%W)GcYo6fX82kx{pY8KMw-~gVi=0nXuGk zV^Z}Zt7jhJDT#prG{VNr0IKUj{Tbx287XYg_#&viSZZiCQoKCsPa1^)sKsob-aFf| zxHz?h?A8(k10w^dgrkuohlH`p49r8qowRc#C@pa^FfgPU8_~{^QIkhR2!PTOXttwt zG%byY_@<>ND=I50t12q1%6)x(eLVy6i!)0y^Yeo8K~uf?dBMqvIjNp072uIf&y)&q zO$Z%6fN>)t!LraH^J1sO;#9Bzq{8&eFDl7!&M!+Xg794vi%XEW!TF^q(&4FS(x4Hq zVz7BoYazxs&d4t!)D+M_T1aMI z35YI+%o!C2rKW+nzKIo%Wr>+NAa&09rFkWx#i=P^22=rh@OT#cfQIB!JY68u27ZaT zso|L^B^e;gi#<{^(=$rIOoXwCMGzBFM2Z7)5|bfLD|Sju&Q34NFU?B<>vYdg%z;@8 zb_%ipIIzJ!^vF!l$N^ag=7qTVCYGcYWhUl8g9sdeVVT95NsysvW`-TlH>ds|1b~@= znSqz#!E7rgT#jL4SaK=%B!pyS@Ke)X1|e~&Cr_M}VNa9~xXVDEep=`P<$GF~OP-md zuE8B{qhT`|Hn>9ox6Ej|84VlUA%I(EG~JAb4ek)YEi;;KM#Bbo2;i0(O*f-qgF6Ip z%Z#R*(XhcC0=Q*H)6Hnu;0^)YGNb8cG;DB(0B)JlbTb+@xI+N9%xJn94IA7cfLmrX z-He6}?hwE&Gn#Hj!v=Q<;FcLpH=|*LI|OjcjHa8>u)!SyxMfDu4eqdES$W(pCeH(m bLE#kF9cVu_=Z_r-gZRi;ARyHahC$*0%@A*T delta 517 zcmZ3|&UhwBDL5cBijjelfq`Mk)aZo_3_J`Iq!}2VF)}dN@I%BlDmgK-zGYx#_%xZ3 z^*0v-gAD@%!|vTv4o=Qva^UA+U}j)}L)OU;d5R|+F!M~VVJwk#Vc=l!Vc=(oW)NV= zX5eS2Vh~{HV&G?($sokAdh$i)hZ6%>CU0W#VrOGuV_;`so2)ZSp?_lgSE7dLs^JINJaK DT@{1- diff --git a/src/game/mini.def b/src/game/mini.def index ae49806..99970f6 100644 --- a/src/game/mini.def +++ b/src/game/mini.def @@ -82,6 +82,11 @@ enum PuzzleElementType(u8) Bridge GameName("Bridge") ShortName("#") } +type CardSocket +{ + ModelHandle Model +} + type StaticPuzzleCard { PuzzleElementType Elements Arr(4) @@ -90,6 +95,7 @@ type StaticPuzzleCard ModelHandle EastCoverHandle ModelHandle SouthCoverHandle ModelHandle WestCoverHandle + CardSocket Sockets Arr(16) TextureHandle ModelTextureHandle TextureHandle BoardTextureHandle } diff --git a/src/game/rendering/Rendering.h b/src/game/rendering/Rendering.h index 4519d72..2f8432e 100644 --- a/src/game/rendering/Rendering.h +++ b/src/game/rendering/Rendering.h @@ -32,12 +32,23 @@ namespace Game Gen::TextureHandle TexHandle; }; + struct ModelSocket + { + static constexpr uint16_t MaxSocketNameLength = 64; + Gen::Vec3 Pos; + Gen::Mat4 Rot; + char Name[MaxSocketNameLength]{}; + }; + struct Model { + static constexpr uint16_t MaxSocketCount = 16; bgfx::VertexBufferHandle VertexBuffer = {bgfx::kInvalidHandle}; bgfx::IndexBufferHandle IndexBuffer = {bgfx::kInvalidHandle}; bgfx::VertexLayout VertLayout; Gen::ModelHandle Handle; + uint16_t SocketCount = 0; + ModelSocket Sockets[MaxSocketCount]; }; struct Material diff --git a/src/gen/Generated.cpp b/src/gen/Generated.cpp index 8feb2ec..59feb16 100644 --- a/src/gen/Generated.cpp +++ b/src/gen/Generated.cpp @@ -1275,6 +1275,92 @@ namespace Gen assert(isOk); return isOk; } + bool Save(const CardSocket* obj, uint32_t count, Serializer& serializer) + { + bool isOk = true; + for (uint32_t i = 0; i < count; ++i) + { + isOk = Save(&obj[i].Model, 1, serializer) && isOk; + } + return isOk; + } + bool Load(CardSocket* obj, uint32_t count, Deserializer& serializer) + { + const char* typeName = Meta::Metadata.TypeDefinitions[CardSocket::TypeIdx].Name; + + // Quick match + int32_t matchedHashIdx = + serializer.TypeBuf.FindHash(Meta::Metadata.TypeDefinitions[CardSocket::TypeIdx].Hash); + if (matchedHashIdx >= 0) + { + assert(bx::strCmp(serializer.TypeBuf.Defs[matchedHashIdx].Name, typeName) == 0); + bool isOk = true; + for (uint32_t i = 0; i < count; ++i) + { + isOk = Load(&obj[i].Model, 1, serializer) && isOk; + } + // if we're not ok here, something went really wrong + assert(isOk); + return isOk; + } + + // Failed to resolve hash, the type definition chaned since the file was saved! try to match by name. + int32_t nameMatchIdx = serializer.TypeBuf.FindDefByName(typeName); + if (nameMatchIdx < 0) + { + // Name match failed, caller has to handle this and potentially skip some bytes + return false; + } + + // Successfully matched name, but we need to follow the definition of the file now! + const Meta::TypeDef& matchedDef = serializer.TypeBuf.Defs[nameMatchIdx]; + + // Figure out new member mapping + uint64_t WriteDestinations[64]; + for (int32_t i = 0; i < BX_COUNTOF(WriteDestinations); ++i) + { + WriteDestinations[i] = UINT64_MAX; + } + for (uint32_t i = 0; i < matchedDef.ChildCount; ++i) + { + const bx::StringView memberName = {&serializer.MemberNameBuf[matchedDef.MemberNameIndices[i].Offset], matchedDef.MemberNameIndices[i].Size}; + const char* memberTypeName = serializer.TypeBuf.Defs[matchedDef.ChildIndices[i]].Name; + if (bx::strCmp(memberName, "Model") == 0 && bx::strCmp(memberTypeName, "ModelHandle") == 0) + { + WriteDestinations[i] = offsetof(CardSocket, Model); + } + } + + // Start reading in file order, skipping things that we don't know by name and type + bool isOk = true; + for (uint32_t i = 0; i < count; ++i) + { + uint8_t* objBasePtr = reinterpret_cast(&obj[i]); + + for (uint32_t j = 0; j < matchedDef.ChildCount; ++j) + { + const Meta::TypeDef& childDef = serializer.TypeBuf.Defs[matchedDef.ChildIndices[j]]; + const bx::StringView memberName = {&serializer.MemberNameBuf[matchedDef.MemberNameIndices[j].Offset], matchedDef.MemberNameIndices[j].Size}; + if (WriteDestinations[j] == UINT64_MAX) + { + // Unknown member name or type changed + uint16_t count = bx::max(1, matchedDef.ChildArraySizes[matchedDef.ChildIndices[j]]); + serializer.Skip(childDef.Size * count); + continue; + } + + if (bx::strCmp(memberName, "Model") == 0) + { + auto* fieldPtr = reinterpret_cast(objBasePtr + WriteDestinations[j]); + isOk = Load(fieldPtr, 1, serializer) && isOk; + continue; + } + assert(false); + } + } + assert(isOk); + return isOk; + } bool Save(const StaticPuzzleCard* obj, uint32_t count, Serializer& serializer) { bool isOk = true; @@ -1286,6 +1372,7 @@ namespace Gen isOk = Save(&obj[i].EastCoverHandle, 1, serializer) && isOk; isOk = Save(&obj[i].SouthCoverHandle, 1, serializer) && isOk; isOk = Save(&obj[i].WestCoverHandle, 1, serializer) && isOk; + isOk = Save(obj[i].Sockets, 16, serializer) && isOk; isOk = Save(&obj[i].ModelTextureHandle, 1, serializer) && isOk; isOk = Save(&obj[i].BoardTextureHandle, 1, serializer) && isOk; } @@ -1310,6 +1397,7 @@ namespace Gen isOk = Load(&obj[i].EastCoverHandle, 1, serializer) && isOk; isOk = Load(&obj[i].SouthCoverHandle, 1, serializer) && isOk; isOk = Load(&obj[i].WestCoverHandle, 1, serializer) && isOk; + isOk = Load(obj[i].Sockets, 16, serializer) && isOk; isOk = Load(&obj[i].ModelTextureHandle, 1, serializer) && isOk; isOk = Load(&obj[i].BoardTextureHandle, 1, serializer) && isOk; } @@ -1363,6 +1451,10 @@ namespace Gen { WriteDestinations[i] = offsetof(StaticPuzzleCard, WestCoverHandle); } + if (bx::strCmp(memberName, "Sockets") == 0 && bx::strCmp(memberTypeName, "CardSocket") == 0) + { + WriteDestinations[i] = offsetof(StaticPuzzleCard, Sockets); + } if (bx::strCmp(memberName, "ModelTextureHandle") == 0 && bx::strCmp(memberTypeName, "TextureHandle") == 0) { WriteDestinations[i] = offsetof(StaticPuzzleCard, ModelTextureHandle); @@ -1427,6 +1519,12 @@ namespace Gen isOk = Load(fieldPtr, 1, serializer) && isOk; continue; } + if (bx::strCmp(memberName, "Sockets") == 0) + { + auto* fieldPtr = reinterpret_cast(objBasePtr + WriteDestinations[j]); + isOk = Load(fieldPtr, 16, serializer) && isOk; + continue; + } if (bx::strCmp(memberName, "ModelTextureHandle") == 0) { auto* fieldPtr = reinterpret_cast(objBasePtr + WriteDestinations[j]); diff --git a/src/gen/Generated.h b/src/gen/Generated.h index dc099ed..c972c94 100644 --- a/src/gen/Generated.h +++ b/src/gen/Generated.h @@ -7,7 +7,7 @@ namespace Gen struct Deserializer; struct PuzzleElementType { - static constexpr uint16_t TypeIdx = 30; + static constexpr uint16_t TypeIdx = 31; static constexpr int32_t EntryCount = 8; enum Enum : uint8_t { @@ -56,7 +56,7 @@ namespace Gen }; struct EMaterial { - static constexpr uint16_t TypeIdx = 31; + static constexpr uint16_t TypeIdx = 32; static constexpr int32_t EntryCount = 2; enum Enum : int32_t { @@ -141,26 +141,32 @@ namespace Gen int8_t X = {}; int8_t Y = {}; }; - struct StaticPuzzleCard + struct CardSocket { static constexpr uint16_t TypeIdx = 22; + ModelHandle Model = {}; + }; + struct StaticPuzzleCard + { + static constexpr uint16_t TypeIdx = 23; PuzzleElementType::Enum Elements[4] = {}; ModelHandle BaseModelHandle = {}; ModelHandle NorthCoverHandle = {}; ModelHandle EastCoverHandle = {}; ModelHandle SouthCoverHandle = {}; ModelHandle WestCoverHandle = {}; + CardSocket Sockets[16] = {}; TextureHandle ModelTextureHandle = {}; TextureHandle BoardTextureHandle = {}; }; struct StaticPuzzleCardHandle { - static constexpr uint16_t TypeIdx = 23; + static constexpr uint16_t TypeIdx = 24; uint16_t Idx = UINT16_MAX; }; struct PuzzleVisualSettings { - static constexpr uint16_t TypeIdx = 24; + static constexpr uint16_t TypeIdx = 25; Vec4 TileBaseColor = {}; Vec4 TileDotColor = {}; Vec3 Test = {}; @@ -168,20 +174,20 @@ namespace Gen }; struct StaticPuzzleData { - static constexpr uint16_t TypeIdx = 25; + static constexpr uint16_t TypeIdx = 26; StaticPuzzleCard Cards[64] = {}; PuzzleVisualSettings Visuals = {}; }; struct PuzzleCardStack { - static constexpr uint16_t TypeIdx = 26; + static constexpr uint16_t TypeIdx = 27; StaticPuzzleCardHandle RefCard = {}; uint8_t MaxAvailableCount = {}; uint8_t UsedCount = {}; }; struct PlacedPuzzleCard { - static constexpr uint16_t TypeIdx = 27; + static constexpr uint16_t TypeIdx = 28; StaticPuzzleCardHandle RefCard = {}; PuzPos Position = {}; uint8_t Rotation = {}; @@ -189,7 +195,7 @@ namespace Gen }; struct PuzzleData { - static constexpr uint16_t TypeIdx = 28; + static constexpr uint16_t TypeIdx = 29; uint16_t ID = {}; char PuzzleName[64] = {}; uint8_t WidthTiles = {}; @@ -203,7 +209,7 @@ namespace Gen }; struct SavedEntityRenderData { - static constexpr uint16_t TypeIdx = 29; + static constexpr uint16_t TypeIdx = 30; Vec4 BaseColor = {}; Vec4 HighlightColor = {}; Transform TF = {}; @@ -260,6 +266,8 @@ namespace Gen bool Load(TextureHandle* obj, uint32_t count, Deserializer& serializer); bool Save(const PuzPos* obj, uint32_t count, Serializer& serializer); bool Load(PuzPos* obj, uint32_t count, Deserializer& serializer); + bool Save(const CardSocket* obj, uint32_t count, Serializer& serializer); + bool Load(CardSocket* obj, uint32_t count, Deserializer& serializer); bool Save(const StaticPuzzleCard* obj, uint32_t count, Serializer& serializer); bool Load(StaticPuzzleCard* obj, uint32_t count, Deserializer& serializer); bool Save(const StaticPuzzleCardHandle* obj, uint32_t count, Serializer& serializer); @@ -299,7 +307,7 @@ namespace Gen struct MetadataTable { - TypeDef TypeDefinitions[32] + TypeDef TypeDefinitions[33] { TypeDef{sizeof(int8_t), 0, "i8", 0, {}, {}, {}}, TypeDef{sizeof(int16_t), 1, "i16", 0, {}, {}, {}}, @@ -323,18 +331,19 @@ namespace Gen TypeDef{sizeof(ModelHandle), 298089627, "ModelHandle", 2, {5, 18}, {0, 0}, {{38, 8}, {46, 5}}}, TypeDef{sizeof(TextureHandle), 1633273761, "TextureHandle", 2, {5, 18}, {0, 0}, {{51, 10}, {61, 5}}}, TypeDef{sizeof(PuzPos), 1834398141, "PuzPos", 2, {0, 0}, {0, 0}, {{66, 1}, {67, 1}}}, - TypeDef{sizeof(StaticPuzzleCard), 3247750075, "StaticPuzzleCard", 8, {30, 19, 19, 19, 19, 19, 20, 20}, {4, 0, 0, 0, 0, 0, 0, 0}, {{68, 8}, {76, 15}, {91, 16}, {107, 15}, {122, 16}, {138, 15}, {153, 18}, {171, 18}}}, - TypeDef{sizeof(StaticPuzzleCardHandle), 1742502768, "StaticPuzzleCardHandle", 1, {5}, {0}, {{189, 3}}}, - TypeDef{sizeof(PuzzleVisualSettings), 2302077481, "PuzzleVisualSettings", 4, {14, 14, 13, 14}, {0, 0, 0, 0}, {{192, 13}, {205, 12}, {217, 4}, {221, 16}}}, - TypeDef{sizeof(StaticPuzzleData), 2707133860, "StaticPuzzleData", 2, {22, 24}, {64, 0}, {{237, 5}, {242, 7}}}, - TypeDef{sizeof(PuzzleCardStack), 53538532, "PuzzleCardStack", 3, {23, 4, 4}, {0, 0, 0}, {{249, 7}, {256, 17}, {273, 9}}}, - TypeDef{sizeof(PlacedPuzzleCard), 3555575973, "PlacedPuzzleCard", 4, {23, 21, 4, 8}, {0, 0, 0, 0}, {{282, 7}, {289, 8}, {297, 8}, {305, 8}}}, - TypeDef{sizeof(PuzzleData), 3349686056, "PuzzleData", 10, {5, 11, 4, 4, 6, 26, 27, 30, 6, 21}, {0, 64, 0, 0, 0, 16, 256, 1024, 0, 16}, {{313, 2}, {315, 10}, {325, 10}, {335, 11}, {346, 18}, {364, 14}, {378, 11}, {389, 15}, {404, 17}, {421, 13}}}, - TypeDef{sizeof(SavedEntityRenderData), 3172756855, "SavedEntityRenderData", 7, {14, 14, 17, 31, 20, 19, 8}, {0, 0, 0, 0, 0, 0, 0}, {{434, 9}, {443, 14}, {457, 2}, {459, 8}, {467, 7}, {474, 5}, {479, 7}}}, + TypeDef{sizeof(CardSocket), 3485485756, "CardSocket", 1, {19}, {0}, {{68, 5}}}, + TypeDef{sizeof(StaticPuzzleCard), 1947091475, "StaticPuzzleCard", 9, {31, 19, 19, 19, 19, 19, 22, 20, 20}, {4, 0, 0, 0, 0, 0, 16, 0, 0}, {{73, 8}, {81, 15}, {96, 16}, {112, 15}, {127, 16}, {143, 15}, {158, 7}, {165, 18}, {183, 18}}}, + TypeDef{sizeof(StaticPuzzleCardHandle), 1742502768, "StaticPuzzleCardHandle", 1, {5}, {0}, {{201, 3}}}, + TypeDef{sizeof(PuzzleVisualSettings), 2302077481, "PuzzleVisualSettings", 4, {14, 14, 13, 14}, {0, 0, 0, 0}, {{204, 13}, {217, 12}, {229, 4}, {233, 16}}}, + TypeDef{sizeof(StaticPuzzleData), 19690459, "StaticPuzzleData", 2, {23, 25}, {64, 0}, {{249, 5}, {254, 7}}}, + TypeDef{sizeof(PuzzleCardStack), 53538532, "PuzzleCardStack", 3, {24, 4, 4}, {0, 0, 0}, {{261, 7}, {268, 17}, {285, 9}}}, + TypeDef{sizeof(PlacedPuzzleCard), 3555575973, "PlacedPuzzleCard", 4, {24, 21, 4, 8}, {0, 0, 0, 0}, {{294, 7}, {301, 8}, {309, 8}, {317, 8}}}, + TypeDef{sizeof(PuzzleData), 3349686056, "PuzzleData", 10, {5, 11, 4, 4, 6, 27, 28, 31, 6, 21}, {0, 64, 0, 0, 0, 16, 256, 1024, 0, 16}, {{325, 2}, {327, 10}, {337, 10}, {347, 11}, {358, 18}, {376, 14}, {390, 11}, {401, 15}, {416, 17}, {433, 13}}}, + TypeDef{sizeof(SavedEntityRenderData), 3172756855, "SavedEntityRenderData", 7, {14, 14, 17, 32, 20, 19, 8}, {0, 0, 0, 0, 0, 0, 0}, {{446, 9}, {455, 14}, {469, 2}, {471, 8}, {479, 7}, {486, 5}, {491, 7}}}, TypeDef{sizeof(PuzzleElementType::Enum), 2983807453, "PuzzleElementType", 0, {}, {}, {}}, TypeDef{sizeof(EMaterial::Enum), 2024002654, "EMaterial", 0, {}, {}, {}}, }; - char MemberNameBuffer[64*64*64]{"xyxyzxyzwMMMMIPositionRotationScaleIdxModelIdxAssetTextureIdxAssetXYElementsBaseModelHandleNorthCoverHandleEastCoverHandleSouthCoverHandleWestCoverHandleModelTextureHandleBoardTextureHandleIdxTileBaseColorTileDotColorTestDisabledCardTintCardsVisualsRefCardMaxAvailableCountUsedCountRefCardPositionRotationIsLockedIDPuzzleNameWidthTilesHeightTilesAvailableCardCountAvailableCardsPlacedCardsBackgroundTilesGoalPositionCountGoalPositionsBaseColorHighlightColorTFMaterialTextureModelVisible"}; + char MemberNameBuffer[64*64*64]{"xyxyzxyzwMMMMIPositionRotationScaleIdxModelIdxAssetTextureIdxAssetXYModelElementsBaseModelHandleNorthCoverHandleEastCoverHandleSouthCoverHandleWestCoverHandleSocketsModelTextureHandleBoardTextureHandleIdxTileBaseColorTileDotColorTestDisabledCardTintCardsVisualsRefCardMaxAvailableCountUsedCountRefCardPositionRotationIsLockedIDPuzzleNameWidthTilesHeightTilesAvailableCardCountAvailableCardsPlacedCardsBackgroundTilesGoalPositionCountGoalPositionsBaseColorHighlightColorTFMaterialTextureModelVisible"}; }; constexpr MetadataTable Metadata; diff --git a/src/models/channel_cover_big.glb b/src/models/channel_cover_big.glb index d4fb23e..cf6854e 100644 --- a/src/models/channel_cover_big.glb +++ b/src/models/channel_cover_big.glb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4a8bf7ebd85b1e3955c750d591066b30dce23d86e63d9c89313a5c91c3817003 -size 1468 +oid sha256:737a392f342a7689d0293d0a0859d9ae1731bcd8b70ae2fca87ff14cd0da39ad +size 1512 diff --git a/src/models/channel_cover_small.glb b/src/models/channel_cover_small.glb index 536841b..2b088d0 100644 --- a/src/models/channel_cover_small.glb +++ b/src/models/channel_cover_small.glb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:50d19f3d9b6102d6f45f4ef863d1592804895533b6480ade55837f1cb857a379 -size 1480 +oid sha256:9267fcdc99816513138c110101aec12171b227d62bb5c86be53f0131de5d85db +size 1520 diff --git a/src/models/w straight.glb b/src/models/w straight.glb index d50c85d..11c12bb 100644 --- a/src/models/w straight.glb +++ b/src/models/w straight.glb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8430e7b50d8a59abbdeb3003ce7fb29e41e489fb87d718eac8289d983964ac02 -size 7400 +oid sha256:92b791bcf83682b3ededa9807aa19274ea9baf391c5693cf3f361f5438597d1b +size 7776