mirror of https://github.com/AxioDL/metaforce.git
Compact layout for Items window
This commit is contained in:
parent
4d92c87463
commit
822e5d3410
|
@ -479,7 +479,7 @@ std::string_view CPlayerState::ItemTypeToName(CPlayerState::EItemType type) {
|
||||||
case EItemType::GrappleBeam:
|
case EItemType::GrappleBeam:
|
||||||
return "Grapple Beam"sv;
|
return "Grapple Beam"sv;
|
||||||
case EItemType::XRayVisor:
|
case EItemType::XRayVisor:
|
||||||
return "XRay Visor"sv;
|
return "X-Ray Visor"sv;
|
||||||
case EItemType::IceSpreader:
|
case EItemType::IceSpreader:
|
||||||
return "Ice Spreader"sv;
|
return "Ice Spreader"sv;
|
||||||
case EItemType::SpaceJumpBoots:
|
case EItemType::SpaceJumpBoots:
|
||||||
|
|
|
@ -683,78 +683,33 @@ ImGuiConsole::~ImGuiConsole() {
|
||||||
stringTables.clear();
|
stringTables.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr std::array ItemOrder{
|
static constexpr std::array GeneralItems{
|
||||||
CPlayerState::EItemType::PowerBeam,
|
CPlayerState::EItemType::EnergyTanks, CPlayerState::EItemType::CombatVisor, CPlayerState::EItemType::ScanVisor,
|
||||||
CPlayerState::EItemType::ChargeBeam,
|
CPlayerState::EItemType::ThermalVisor, CPlayerState::EItemType::XRayVisor, CPlayerState::EItemType::GrappleBeam,
|
||||||
CPlayerState::EItemType::IceBeam,
|
CPlayerState::EItemType::SpaceJumpBoots, CPlayerState::EItemType::PowerSuit, CPlayerState::EItemType::VariaSuit,
|
||||||
CPlayerState::EItemType::WaveBeam,
|
CPlayerState::EItemType::GravitySuit, CPlayerState::EItemType::PhazonSuit,
|
||||||
CPlayerState::EItemType::PlasmaBeam,
|
|
||||||
CPlayerState::EItemType::EnergyTanks,
|
|
||||||
CPlayerState::EItemType::Missiles,
|
|
||||||
CPlayerState::EItemType::SuperMissile,
|
|
||||||
CPlayerState::EItemType::Flamethrower,
|
|
||||||
CPlayerState::EItemType::IceSpreader,
|
|
||||||
CPlayerState::EItemType::Wavebuster,
|
|
||||||
CPlayerState::EItemType::CombatVisor,
|
|
||||||
CPlayerState::EItemType::ScanVisor,
|
|
||||||
CPlayerState::EItemType::ThermalVisor,
|
|
||||||
CPlayerState::EItemType::XRayVisor,
|
|
||||||
CPlayerState::EItemType::MorphBall,
|
|
||||||
CPlayerState::EItemType::MorphBallBombs,
|
|
||||||
CPlayerState::EItemType::PowerBombs,
|
|
||||||
CPlayerState::EItemType::BoostBall,
|
|
||||||
CPlayerState::EItemType::SpiderBall,
|
|
||||||
CPlayerState::EItemType::GrappleBeam,
|
|
||||||
CPlayerState::EItemType::SpaceJumpBoots,
|
|
||||||
CPlayerState::EItemType::PowerSuit,
|
|
||||||
CPlayerState::EItemType::VariaSuit,
|
|
||||||
CPlayerState::EItemType::GravitySuit,
|
|
||||||
CPlayerState::EItemType::PhazonSuit,
|
|
||||||
CPlayerState::EItemType::Truth,
|
|
||||||
CPlayerState::EItemType::Strength,
|
|
||||||
CPlayerState::EItemType::Elder,
|
|
||||||
CPlayerState::EItemType::Wild,
|
|
||||||
CPlayerState::EItemType::Lifegiver,
|
|
||||||
CPlayerState::EItemType::Warrior,
|
|
||||||
CPlayerState::EItemType::Chozo,
|
|
||||||
CPlayerState::EItemType::Nature,
|
|
||||||
CPlayerState::EItemType::Sun,
|
|
||||||
CPlayerState::EItemType::World,
|
|
||||||
CPlayerState::EItemType::Spirit,
|
|
||||||
CPlayerState::EItemType::Newborn,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void ImGuiConsole::ShowItemsWindow() {
|
static constexpr std::array WeaponItems{
|
||||||
CPlayerState& pState = *g_StateManager->GetPlayerState();
|
CPlayerState::EItemType::Missiles, CPlayerState::EItemType::PowerBeam, CPlayerState::EItemType::IceBeam,
|
||||||
if (ImGui::Begin("Items", &m_showItemsWindow)) {
|
CPlayerState::EItemType::WaveBeam, CPlayerState::EItemType::PlasmaBeam, CPlayerState::EItemType::SuperMissile,
|
||||||
if (ImGui::Button("Refill")) {
|
CPlayerState::EItemType::Flamethrower, CPlayerState::EItemType::IceSpreader, CPlayerState::EItemType::Wavebuster,
|
||||||
for (const auto itemType : ItemOrder) {
|
CPlayerState::EItemType::ChargeBeam,
|
||||||
u32 maxValue = CPlayerState::GetPowerUpMaxValue(itemType);
|
};
|
||||||
pState.ResetAndIncrPickUp(itemType, maxValue);
|
|
||||||
}
|
static constexpr std::array MorphBallItems{
|
||||||
}
|
CPlayerState::EItemType::PowerBombs, CPlayerState::EItemType::MorphBall, CPlayerState::EItemType::MorphBallBombs,
|
||||||
auto& mapWorldInfo = *g_GameState->CurrentWorldState().MapWorldInfo();
|
CPlayerState::EItemType::BoostBall, CPlayerState::EItemType::SpiderBall,
|
||||||
ImGui::SameLine();
|
};
|
||||||
bool mapStationUsed = mapWorldInfo.GetMapStationUsed();
|
|
||||||
if (ImGui::Checkbox("Area map", &mapStationUsed)) {
|
static constexpr std::array ArtifactItems{
|
||||||
mapWorldInfo.SetMapStationUsed(mapStationUsed);
|
CPlayerState::EItemType::Truth, CPlayerState::EItemType::Strength, CPlayerState::EItemType::Elder,
|
||||||
}
|
CPlayerState::EItemType::Wild, CPlayerState::EItemType::Lifegiver, CPlayerState::EItemType::Warrior,
|
||||||
if (ImGui::Button("All")) {
|
CPlayerState::EItemType::Chozo, CPlayerState::EItemType::Nature, CPlayerState::EItemType::Sun,
|
||||||
for (const auto itemType : ItemOrder) {
|
CPlayerState::EItemType::World, CPlayerState::EItemType::Spirit, CPlayerState::EItemType::Newborn,
|
||||||
u32 maxValue = CPlayerState::GetPowerUpMaxValue(itemType);
|
};
|
||||||
pState.ReInitializePowerUp(itemType, maxValue);
|
|
||||||
pState.ResetAndIncrPickUp(itemType, maxValue);
|
static void RenderItemType(CPlayerState& pState, CPlayerState::EItemType itemType) {
|
||||||
}
|
|
||||||
mapWorldInfo.SetMapStationUsed(true);
|
|
||||||
}
|
|
||||||
ImGui::SameLine();
|
|
||||||
if (ImGui::Button("None")) {
|
|
||||||
for (const auto itemType : ItemOrder) {
|
|
||||||
pState.ReInitializePowerUp(itemType, 0);
|
|
||||||
}
|
|
||||||
mapWorldInfo.SetMapStationUsed(false);
|
|
||||||
}
|
|
||||||
for (const auto itemType : ItemOrder) {
|
|
||||||
u32 maxValue = CPlayerState::GetPowerUpMaxValue(itemType);
|
u32 maxValue = CPlayerState::GetPowerUpMaxValue(itemType);
|
||||||
std::string name{CPlayerState::ItemTypeToName(itemType)};
|
std::string name{CPlayerState::ItemTypeToName(itemType)};
|
||||||
if (maxValue == 1) {
|
if (maxValue == 1) {
|
||||||
|
@ -779,6 +734,81 @@ void ImGuiConsole::ShowItemsWindow() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <size_t N>
|
||||||
|
static inline void RenderItemsDualColumn(CPlayerState& pState, const std::array<CPlayerState::EItemType, N>& items,
|
||||||
|
int start) {
|
||||||
|
ImGui::BeginGroup();
|
||||||
|
// Render left group
|
||||||
|
for (int i = start; i < items.size(); i += 2) {
|
||||||
|
RenderItemType(pState, items[i]);
|
||||||
|
}
|
||||||
|
ImGui::EndGroup();
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::BeginGroup();
|
||||||
|
// Render right group
|
||||||
|
for (int i = start + 1; i < items.size(); i += 2) {
|
||||||
|
RenderItemType(pState, items[i]);
|
||||||
|
}
|
||||||
|
ImGui::EndGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGuiConsole::ShowItemsWindow() {
|
||||||
|
CPlayerState& pState = *g_StateManager->GetPlayerState();
|
||||||
|
if (ImGui::Begin("Items", &m_showItemsWindow, ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
|
if (ImGui::Button("Refill")) {
|
||||||
|
for (int i = 0; i < int(CPlayerState::EItemType::Max); ++i) {
|
||||||
|
auto itemType = static_cast<CPlayerState::EItemType>(i);
|
||||||
|
u32 maxValue = CPlayerState::GetPowerUpMaxValue(itemType);
|
||||||
|
pState.ResetAndIncrPickUp(itemType, maxValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
auto& mapWorldInfo = *g_GameState->CurrentWorldState().MapWorldInfo();
|
||||||
|
ImGui::SameLine();
|
||||||
|
bool mapStationUsed = mapWorldInfo.GetMapStationUsed();
|
||||||
|
if (ImGui::Checkbox("Area map", &mapStationUsed)) {
|
||||||
|
mapWorldInfo.SetMapStationUsed(mapStationUsed);
|
||||||
|
}
|
||||||
|
if (ImGui::Button("All")) {
|
||||||
|
for (int i = 0; i < int(CPlayerState::EItemType::Max); ++i) {
|
||||||
|
auto itemType = static_cast<CPlayerState::EItemType>(i);
|
||||||
|
u32 maxValue = CPlayerState::GetPowerUpMaxValue(itemType);
|
||||||
|
pState.ReInitializePowerUp(itemType, maxValue);
|
||||||
|
pState.ResetAndIncrPickUp(itemType, maxValue);
|
||||||
|
}
|
||||||
|
mapWorldInfo.SetMapStationUsed(true);
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("None")) {
|
||||||
|
for (int i = 0; i < int(CPlayerState::EItemType::Max); ++i) {
|
||||||
|
auto itemType = static_cast<CPlayerState::EItemType>(i);
|
||||||
|
pState.ReInitializePowerUp(itemType, 0);
|
||||||
|
}
|
||||||
|
mapWorldInfo.SetMapStationUsed(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::BeginTabBar("Items")) {
|
||||||
|
if (ImGui::BeginTabItem("General")) {
|
||||||
|
RenderItemType(pState, GeneralItems[0]); // full width
|
||||||
|
RenderItemsDualColumn(pState, GeneralItems, 1);
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
if (ImGui::BeginTabItem("Weapons")) {
|
||||||
|
RenderItemType(pState, WeaponItems[0]); // full width
|
||||||
|
RenderItemsDualColumn(pState, WeaponItems, 1);
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
if (ImGui::BeginTabItem("Morph Ball")) {
|
||||||
|
RenderItemType(pState, MorphBallItems[0]); // full width
|
||||||
|
RenderItemsDualColumn(pState, MorphBallItems, 1);
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
if (ImGui::BeginTabItem("Artifacts")) {
|
||||||
|
RenderItemsDualColumn(pState, ArtifactItems, 0);
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
ImGui::EndTabBar();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue