mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-01 17:27:19 -04:00
implement multibyte area flags in UI
This commit is contained in:
@@ -3140,6 +3140,7 @@ inline MultiByteAreaFlag ForestTempleMultiByteFlags[] =
|
||||
|
||||
inline const std::map<uint8_t, const char*> _SPRIceBlockPuzzleLocations =
|
||||
{
|
||||
{ 0x00, "N/A" },
|
||||
{ 0x0C, "(-2, 2)" },
|
||||
{ 0x0B, "(-1, 2)" },
|
||||
{ 0x0A, "( 0, 2)" },
|
||||
@@ -3225,13 +3226,14 @@ inline MultiByteAreaFlag SPRMultiByteFlags[] = {
|
||||
_SPRIceBlockPuzzleLocations
|
||||
},
|
||||
{
|
||||
"Ice Block 2 Location",
|
||||
"Ice Block 3 Location",
|
||||
{ 0x0807, 0x09C0 },
|
||||
_SPRIceBlockPuzzleLocations
|
||||
}
|
||||
};
|
||||
|
||||
inline const std::map<uint8_t, const char*> _CoOBlockPuzzle1Locations = {
|
||||
{ 0x00, "N/A" },
|
||||
{ 0x0B, "(-1, 2)" },
|
||||
{ 0x0C, "( 0, 2)" },
|
||||
{ 0x01, "( 1, 2)" },
|
||||
@@ -3254,6 +3256,7 @@ inline const std::map<uint8_t, const char*> _CoOBlockPuzzle1Locations = {
|
||||
};
|
||||
|
||||
inline const std::map<uint8_t, const char*> _CoOBlockPuzzle2Locations = {
|
||||
{ 0x00, "N/A" },
|
||||
{ 0x01, "(-1, 2)" },
|
||||
{ 0x02, "( 0, 2)" },
|
||||
{ 0x03, "( 1, 2)" },
|
||||
@@ -3275,6 +3278,7 @@ inline const std::map<uint8_t, const char*> _CoOBlockPuzzle2Locations = {
|
||||
};
|
||||
|
||||
inline const std::map<uint8_t, const char*> _CoOBlockPuzzle3Locations = {
|
||||
{ 0x00, "N/A" },
|
||||
{ 0x01, "(-2, 2)" },
|
||||
{ 0x02, "(-1, 2)" },
|
||||
{ 0x03, "( 0, 2)" },
|
||||
|
||||
@@ -1499,11 +1499,12 @@ namespace dusk {
|
||||
const auto byteIndex = getByteIndexFromFlag(flag);
|
||||
|
||||
const uint16_t startingMask = std::bit_floor(bitInds);
|
||||
uint16_t valueMask = 1 << getValueSize(flag);
|
||||
uint16_t valueMask = 1 << (getValueSize(flag) - 1);
|
||||
|
||||
for (uint16_t mask = startingMask; (bitInds & mask) != 0; mask >>= 1) {
|
||||
SetFlag(makeEventFlag(byteIndex, bitInds & mask), (val & valueMask) != 0);
|
||||
valueMask >>= 1;
|
||||
for (uint16_t bitIndexMask = startingMask; (bitInds & bitIndexMask) != 0;
|
||||
bitIndexMask >>= 1, valueMask >>= 1)
|
||||
{
|
||||
SetFlag(makeEventFlag(byteIndex, bitInds & bitIndexMask), (val & valueMask) != 0);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1611,6 +1612,27 @@ namespace dusk {
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
for (const auto& multiByteFlag : areaFlags.multibyteFlags) {
|
||||
auto flagValue = LoadSpreadMultiByte(multiByteFlag.flags[0], multiByteFlag.flags[1]);
|
||||
|
||||
const char* currentVal = "UNKNOWN";
|
||||
|
||||
auto enumValIter = multiByteFlag.enumValues.find(flagValue);
|
||||
if (enumValIter != multiByteFlag.enumValues.end()) {
|
||||
currentVal = enumValIter->second;
|
||||
}
|
||||
|
||||
if (ImGui::BeginCombo(multiByteFlag.name, currentVal)) {
|
||||
for (const auto& [val, name] : multiByteFlag.enumValues) {
|
||||
if (ImGui::Selectable(name)) {
|
||||
SetSpreadMultiByte(multiByteFlag.flags[0], multiByteFlag.flags[1], val);
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
}
|
||||
|
||||
genCommonAreaFlags(membit);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user