| 102 | } |
| 103 | |
| 104 | bool Game_Interpreter_Map::RequestMainMenuScene(int subscreen_id, int actor_index, bool is_db_actor) { |
| 105 | if (Player::game_config.patch_direct_menu.Get() && subscreen_id == -1) { |
| 106 | subscreen_id = Main_Data::game_variables->Get(Player::game_config.patch_direct_menu.Get()); |
| 107 | actor_index = Main_Data::game_variables->Get(Player::game_config.patch_direct_menu.Get() + 1); |
| 108 | // When true refers to the index of an actor, instead of a party index |
| 109 | is_db_actor = (actor_index < 0); |
| 110 | actor_index = std::abs(actor_index); |
| 111 | } |
| 112 | |
| 113 | std::vector<Game_Actor*> actors; |
| 114 | |
| 115 | switch (subscreen_id) |
| 116 | { |
| 117 | case 1: // Inventory |
| 118 | Scene::instance->SetRequestedScene(std::make_shared<Scene_Item>()); |
| 119 | return true; |
| 120 | case 2: // Skills |
| 121 | case 3: // Equipment |
| 122 | case 4: // Status |
| 123 | if (is_db_actor) { |
| 124 | Game_Actor* actor = Main_Data::game_actors->GetActor(actor_index); |
| 125 | if (!actor) { |
| 126 | Output::Warning("RequestMainMenu: Invalid actor ID {}", actor_index); |
| 127 | return false; |
| 128 | } |
| 129 | actors = std::vector{actor}; |
| 130 | actor_index = 0; |
| 131 | } else { |
| 132 | // 0, 1 and 5+ refer to the first actor |
| 133 | if (actor_index == 0 || actor_index > 4) { |
| 134 | actor_index = 1; |
| 135 | } |
| 136 | actor_index--; |
| 137 | actors = Main_Data::game_party->GetActors(); |
| 138 | |
| 139 | if (actor_index < 0 || actor_index >= static_cast<int>(actors.size())) { |
| 140 | Output::Warning("RequestMainMenu: Invalid actor party member {}", actor_index); |
| 141 | return false; |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | if (subscreen_id == 2) { |
| 146 | Scene::instance->SetRequestedScene(std::make_shared<Scene_Skill>(actors, actor_index)); |
| 147 | } |
| 148 | else if (subscreen_id == 3) { |
| 149 | Scene::instance->SetRequestedScene(std::make_shared<Scene_Equip>(actors, actor_index)); |
| 150 | } |
| 151 | else if (subscreen_id == 4) { |
| 152 | Scene::instance->SetRequestedScene(std::make_shared<Scene_Status>(actors, actor_index)); |
| 153 | } |
| 154 | return true; |
| 155 | case 5: // Order |
| 156 | if (!Feature::HasRow()) { |
| 157 | break; |
| 158 | } |
| 159 | |
| 160 | if (Main_Data::game_party->GetActors().size() <= 1) { |
| 161 | Output::Warning("Party size must exceed '1' for 'Order' subscreen to be opened"); |
no test coverage detected