diff --git a/max.cpp b/max.cpp index f20c47b..57fa3ba 100644 --- a/max.cpp +++ b/max.cpp @@ -642,6 +642,8 @@ Pause *Max::pause() { uint32_t *Max::timer() { return (uint32_t *)(slot() + 0x400 + 0x1d4); } +uint32_t *Max::steps() { return (uint32_t *)(slot() + 0x418 + 0x108); } + uint8_t *Max::mural_selection() { return (uint8_t *)(slot() + 0x400 + 0x402); } std::bitset<0xce40 * 8> *Max::map_bits(int n) { diff --git a/max.h b/max.h index 658bb7f..6510889 100644 --- a/max.h +++ b/max.h @@ -296,6 +296,7 @@ struct Max { uint8_t *manticore(); Pause *pause(); uint32_t *timer(); + uint32_t *steps(); void save_game(); uint8_t *mural_selection(); std::array *mural(); diff --git a/ui.cpp b/ui.cpp index b18b9e7..1cbb658 100644 --- a/ui.cpp +++ b/ui.cpp @@ -558,6 +558,7 @@ void UI::DrawPlayer() { Tooltip("This sets your current room as spawn and runs the save function " "anywhere.\nIn rooms without a phone you will spawn near the " "top left corner."); + ImGui::SeparatorText("Inventory"); if (ImGui::CollapsingHeader("Unlock everything##PlayerEverything")) { ImGui::PushID("PlayerSectionEverything"); static bool everything{false}; @@ -1298,6 +1299,54 @@ void UI::DrawPlayer() { Max::get().keys() + 2, 0.1f); ImGui::PopID(); } + if (ImGui::CollapsingHeader("Unlockables")) { + ImGui::PushID("GlobalUnlockables"); + auto *save = Max::get().save(); + DebugPtr(&save->unlockables); + bool all = (save->unlockables & 0x5ffff) == 0x5ffff; + if (ImGui::Checkbox("Unlock all unlockables##UnlockAllUnlockables", &all)) { + if (all) { + save->unlockables = 0x5ffff; + } else { + save->unlockables = 0; + } + } + ImGui::Separator(); + auto goto_item = + Flags(unlockable_names, &save->unlockables, false, 0, true); + if (goto_item != -1) { + static const std::array item_tiles{{ + {583, 12, 5, 2}, // stopwatch + {799, 0, 2, 0}, // pedometer + {795}, // pink phone + {231}, // souvenir cup + {619, 0, 2, 3}, // origami + {818, 0, 0, 0, 1}, // rabbits + {237, 0, 12, 16, 0}, // owl + {237, 0, 19, 14, 0}, // cat + {237, 0, 12, 16, 2}, // fish + {237, 0, 19, 14, 2}, // donkey + {237, 0, 5, 14, 2}, // decorabbit + {811, 0, 0, 1}, // mama cha + {169}, // giraffe (flute) + {237, 0, 5, 14, 0}, // incense burner + {799, 0, 2, 0}, // peacock (pedometer) + {799, 0, 2, 0}, // otter (pedometer) + {169}, // duck (flute) + {u16_max}, // unused + {799, 0, 2, 0}, // pedometer wingding + {u16_max}, // unused + }}; + auto tileId = item_tiles[goto_item].tile; + auto tile = GetNthTile(tileId, item_tiles[goto_item].n, + item_tiles[goto_item].map); + if (tile.has_value()) + WarpToTile(tile.value(), item_tiles[goto_item].x, + item_tiles[goto_item].y); + } + ImGui::PopID(); + } + ImGui::SeparatorText("State"); if (ImGui::CollapsingHeader("Position##PlayerPositionAndRoom")) { ImGui::PushID("PlayerSectionPosition"); DebugPtr(Max::get().player_position()); @@ -1329,6 +1378,8 @@ void UI::DrawPlayer() { Max::get().timer()); ImGui::InputScalar("Total time##StateTotalTime", ImGuiDataType_U32, Max::get().timer() + 1); + ImGui::InputScalar("Steps##StateSteps", ImGuiDataType_U32, + Max::get().steps()); ImGui::Checkbox("Paused##StatePaused", &Max::get().pause()->paused); ImGui::PopID(); } @@ -1369,53 +1420,6 @@ void UI::DrawPlayer() { } else if (*Max::get().equipment() == 0) { *Max::get().item() = 0; } - if (ImGui::CollapsingHeader("Unlockables")) { - ImGui::PushID("GlobalUnlockables"); - auto *save = Max::get().save(); - DebugPtr(&save->unlockables); - bool all = (save->unlockables & 0x5ffff) == 0x5ffff; - if (ImGui::Checkbox("Unlock all unlockables##UnlockAllUnlockables", &all)) { - if (all) { - save->unlockables = 0x5ffff; - } else { - save->unlockables = 0; - } - } - ImGui::Separator(); - auto goto_item = - Flags(unlockable_names, &save->unlockables, false, 0, true); - if (goto_item != -1) { - static const std::array item_tiles{{ - {583, 12, 5, 2}, // stopwatch - {799, 0, 2, 0}, // pedometer - {795}, // pink phone - {231}, // souvenir cup - {619, 0, 2, 3}, // origami - {818, 0, 0, 0, 1}, // rabbits - {237, 0, 12, 16, 0}, // owl - {237, 0, 19, 14, 0}, // cat - {237, 0, 12, 16, 2}, // fish - {237, 0, 19, 14, 2}, // donkey - {237, 0, 5, 14, 2}, // decorabbit - {811, 0, 0, 1}, // mama cha - {169}, // giraffe (flute) - {237, 0, 5, 14, 0}, // incense burner - {799, 0, 2, 0}, // peacock (pedometer) - {799, 0, 2, 0}, // otter (pedometer) - {169}, // duck (flute) - {u16_max}, // unused - {799, 0, 2, 0}, // pedometer wingding - {u16_max}, // unused - }}; - auto tileId = item_tiles[goto_item].tile; - auto tile = GetNthTile(tileId, item_tiles[goto_item].n, - item_tiles[goto_item].map); - if (tile.has_value()) - WarpToTile(tile.value(), item_tiles[goto_item].x, - item_tiles[goto_item].y); - } - ImGui::PopID(); - } ImGui::PopItemWidth(); }