socket connection direction wip

This commit is contained in:
Asuro
2025-05-16 01:50:19 +02:00
parent 79fe91981b
commit 5cdc7d720e
4 changed files with 31 additions and 10 deletions

View File

@@ -429,6 +429,13 @@ namespace Tools
for (int32_t sIdx = 0; sIdx < mdl.SocketCount; ++sIdx)
{
Tools::ModelDropdown(card.Sockets[sIdx].Model, mdl.Sockets[sIdx].Name);
int val = card.Sockets[sIdx].ConnectionDirection;
ImGui::PushID(sIdx);
if (ImGui::Combo("Connection Direction", &val, "North\0East\0South\0West\0"))
{
card.Sockets[sIdx].ConnectionDirection = val;
}
ImGui::PopID();
}
ImGui::TreePop();
}

View File

@@ -85,6 +85,7 @@ enum PuzzleElementType(u8)
type CardSocket
{
ModelHandle Model
u8 ConnectionDirection
}
type StaticPuzzleCard

View File

@@ -1281,6 +1281,7 @@ namespace Gen
for (uint32_t i = 0; i < count; ++i)
{
isOk = Save(&obj[i].Model, 1, serializer) && isOk;
isOk = Save(&obj[i].ConnectionDirection, 1, serializer) && isOk;
}
return isOk;
}
@@ -1298,6 +1299,7 @@ namespace Gen
for (uint32_t i = 0; i < count; ++i)
{
isOk = Load(&obj[i].Model, 1, serializer) && isOk;
isOk = Load(&obj[i].ConnectionDirection, 1, serializer) && isOk;
}
// if we're not ok here, something went really wrong
assert(isOk);
@@ -1329,6 +1331,10 @@ namespace Gen
{
WriteDestinations[i] = offsetof(CardSocket, Model);
}
if (bx::strCmp(memberName, "ConnectionDirection") == 0 && bx::strCmp(memberTypeName, "uint8_t") == 0)
{
WriteDestinations[i] = offsetof(CardSocket, ConnectionDirection);
}
}
// Start reading in file order, skipping things that we don't know by name and type
@@ -1355,6 +1361,12 @@ namespace Gen
isOk = Load(fieldPtr, 1, serializer) && isOk;
continue;
}
if (bx::strCmp(memberName, "ConnectionDirection") == 0)
{
auto* fieldPtr = reinterpret_cast<uint8_t*>(objBasePtr + WriteDestinations[j]);
isOk = Load(fieldPtr, 1, serializer) && isOk;
continue;
}
assert(false);
}
}

View File

@@ -145,6 +145,7 @@ namespace Gen
{
static constexpr uint16_t TypeIdx = 22;
ModelHandle Model = {};
uint8_t ConnectionDirection = {};
};
struct StaticPuzzleCard
{
@@ -331,19 +332,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(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(CardSocket), 2168907571, "CardSocket", 2, {19, 4}, {0, 0}, {{68, 5}, {73, 19}}},
TypeDef{sizeof(StaticPuzzleCard), 537913399, "StaticPuzzleCard", 9, {31, 19, 19, 19, 19, 19, 22, 20, 20}, {4, 0, 0, 0, 0, 0, 16, 0, 0}, {{92, 8}, {100, 15}, {115, 16}, {131, 15}, {146, 16}, {162, 15}, {177, 7}, {184, 18}, {202, 18}}},
TypeDef{sizeof(StaticPuzzleCardHandle), 1742502768, "StaticPuzzleCardHandle", 1, {5}, {0}, {{220, 3}}},
TypeDef{sizeof(PuzzleVisualSettings), 2302077481, "PuzzleVisualSettings", 4, {14, 14, 13, 14}, {0, 0, 0, 0}, {{223, 13}, {236, 12}, {248, 4}, {252, 16}}},
TypeDef{sizeof(StaticPuzzleData), 2637647137, "StaticPuzzleData", 2, {23, 25}, {64, 0}, {{268, 5}, {273, 7}}},
TypeDef{sizeof(PuzzleCardStack), 53538532, "PuzzleCardStack", 3, {24, 4, 4}, {0, 0, 0}, {{280, 7}, {287, 17}, {304, 9}}},
TypeDef{sizeof(PlacedPuzzleCard), 3555575973, "PlacedPuzzleCard", 4, {24, 21, 4, 8}, {0, 0, 0, 0}, {{313, 7}, {320, 8}, {328, 8}, {336, 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}, {{344, 2}, {346, 10}, {356, 10}, {366, 11}, {377, 18}, {395, 14}, {409, 11}, {420, 15}, {435, 17}, {452, 13}}},
TypeDef{sizeof(SavedEntityRenderData), 3172756855, "SavedEntityRenderData", 7, {14, 14, 17, 32, 20, 19, 8}, {0, 0, 0, 0, 0, 0, 0}, {{465, 9}, {474, 14}, {488, 2}, {490, 8}, {498, 7}, {505, 5}, {510, 7}}},
TypeDef{sizeof(PuzzleElementType::Enum), 2983807453, "PuzzleElementType", 0, {}, {}, {}},
TypeDef{sizeof(EMaterial::Enum), 2024002654, "EMaterial", 0, {}, {}, {}},
};
char MemberNameBuffer[64*64*64]{"xyxyzxyzwMMMMIPositionRotationScaleIdxModelIdxAssetTextureIdxAssetXYModelElementsBaseModelHandleNorthCoverHandleEastCoverHandleSouthCoverHandleWestCoverHandleSocketsModelTextureHandleBoardTextureHandleIdxTileBaseColorTileDotColorTestDisabledCardTintCardsVisualsRefCardMaxAvailableCountUsedCountRefCardPositionRotationIsLockedIDPuzzleNameWidthTilesHeightTilesAvailableCardCountAvailableCardsPlacedCardsBackgroundTilesGoalPositionCountGoalPositionsBaseColorHighlightColorTFMaterialTextureModelVisible"};
char MemberNameBuffer[64*64*64]{"xyxyzxyzwMMMMIPositionRotationScaleIdxModelIdxAssetTextureIdxAssetXYModelConnectionDirectionElementsBaseModelHandleNorthCoverHandleEastCoverHandleSouthCoverHandleWestCoverHandleSocketsModelTextureHandleBoardTextureHandleIdxTileBaseColorTileDotColorTestDisabledCardTintCardsVisualsRefCardMaxAvailableCountUsedCountRefCardPositionRotationIsLockedIDPuzzleNameWidthTilesHeightTilesAvailableCardCountAvailableCardsPlacedCardsBackgroundTilesGoalPositionCountGoalPositionsBaseColorHighlightColorTFMaterialTextureModelVisible"};
};
constexpr MetadataTable Metadata;