Skip to content

Commit

Permalink
Merge pull request #3250 from EasyRPG-NewFeatures/Maniacs-Call-System…
Browse files Browse the repository at this point in the history
…-Functions

Maniacs Patch - Call System Functions
  • Loading branch information
Ghabry authored Sep 2, 2024
2 parents b4fd5d5 + a2080c7 commit bc2fed8
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/game_interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ bool Game_Interpreter::ExecuteCommand(lcf::rpg::EventCommand const& com) {
return CommandManiacControlStrings(com);
case Cmd::Maniac_CallCommand:
return CommandManiacCallCommand(com);
case Cmd::EasyRpg_SetInterpreterFlag: //Cmd::EasyRpg_SetInterpreterFlag
case Cmd::EasyRpg_SetInterpreterFlag:
return CommandEasyRpgSetInterpreterFlag(com);
default:
return true;
Expand Down
52 changes: 49 additions & 3 deletions src/game_interpreter_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include "scene_load.h"
#include "scene_name.h"
#include "scene_shop.h"
#include "scene_debug.h"
#include "scene_gameover.h"
#include "scene.h"
#include "graphics.h"
Expand Down Expand Up @@ -716,7 +717,7 @@ bool Game_Interpreter_Map::CommandPlayMovie(lcf::rpg::EventCommand const& com) {
return true;
}

bool Game_Interpreter_Map::CommandOpenSaveMenu(lcf::rpg::EventCommand const& /* com */) { // code 11910
bool Game_Interpreter_Map::CommandOpenSaveMenu(lcf::rpg::EventCommand const& com) { // code 11910
if (Game_Message::IsMessageActive()) {
return false;
}
Expand All @@ -725,8 +726,53 @@ bool Game_Interpreter_Map::CommandOpenSaveMenu(lcf::rpg::EventCommand const& /*
auto& index = frame.current_command;

Scene::instance->SetRequestedScene(std::make_shared<Scene_Save>());
++index;
return false;

const int current_system_function = com.parameters[0];

// Handle save menu (default behavior)
if (!Player::IsPatchManiac() || current_system_function <= 0) {
Scene::instance->SetRequestedScene(std::make_shared<Scene_Save>());
++index;
return false;
}

// Command "Call System Functions"
switch (current_system_function) {
case 1: // Load menu
return CommandOpenLoadMenu(com);
case 2: // Game menu
return CommandOpenMainMenu(com);
case 3: // Toggle fullscreen
// TODO Implement fullscreen mode once maniacs supports it
// const int fullscreen_mode = com.parameters[1]; // Broken in Maniac.
return CommandToggleFullscreen(com);
case 4: // Settings menu
return CommandOpenVideoOptions(com);
case 5: // Debug menu
// const int pause_while_debugging = com.parameters[1]; // unused in our ingame debug screen.
Scene::instance->SetRequestedScene(std::make_shared<Scene_Debug>());
++index;
return false;
case 6: // License information menu
// TODO Implement license information menu
return true;
case 7: // Reset game
return CommandReturnToTitleScreen(com);
default:
if (Player::HasEasyRpgExtensions() && current_system_function >= 200 && current_system_function < 210) {
const int actor_index = ValueOrVariable(com.parameters[1], com.parameters[2]);
const bool is_db_actor = ValueOrVariable(com.parameters[3], com.parameters[4]);

if (RequestMainMenuScene(current_system_function - 200, actor_index, is_db_actor)) {
++index;
return false;
}
} else {
Output::Warning("CommandOpenSaveMenu: Unsupported scene {}", current_system_function);
}
}

return true;
}

bool Game_Interpreter_Map::CommandOpenMainMenu(lcf::rpg::EventCommand const&) { // code 11950
Expand Down
2 changes: 1 addition & 1 deletion src/platform/switch/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ bool NxUi::ProcessEvents() {

// do not handle touch when not displaying buttons or no touch happened
if (is_docked || vcfg.touch_ui.IsLocked() || !vcfg.touch_ui.Get() || !hidGetTouchScreenStates(&touch, 1))
return;
return true;

for (int32_t i = 0; i < touch.count; ++i) {
if (touch.touches[i].x < 160) {
Expand Down

0 comments on commit bc2fed8

Please sign in to comment.