Skip to content

Commit

Permalink
Maniacs Patch - Call System Functions
Browse files Browse the repository at this point in the history
In Maniacs, CommandOpenSaveMenu is renamed to "Call System Function".
I implemented what is closer to our code.

Also expanded the code to cover our custom submenus (Cases 8 to 12).

Update game_interpreter_map.cpp
  • Loading branch information
jetrotal committed Jul 25, 2024
1 parent 4077070 commit 0c7528a
Showing 1 changed file with 51 additions and 2 deletions.
53 changes: 51 additions & 2 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 @@ -712,15 +713,63 @@ 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
auto& frame = GetFrame();
auto& index = frame.current_command;

if (Game_Message::IsMessageActive()) {
return false;
}

Scene::instance->SetRequestedScene(std::make_shared<Scene_Save>());
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;
}

// Parse common parameters
const int fullscreen_mode = com.parameters[1]; // Broken in Maniac.
const int pause_while_debugging = com.parameters[1]; // unused in our ingame debug screen.

const int actor_index = ValueOrVariable(com.parameters[1], com.parameters[2]);
const bool is_db_actor = ValueOrVariable(com.parameters[3], com.parameters[4]);

switch (current_system_function) {
case 1: // Load menu
return CommandOpenLoadMenu(com);
case 2: // Game menu
Scene::instance->SetRequestedScene(std::make_shared<Scene_Menu>());
break;
case 3: // Toggle fullscreen
// TODO? Implement fullscreen mode once maniacs supports it
return CommandToggleFullscreen(com);
case 4: // Settings menu
return CommandOpenVideoOptions(com);
case 5: // Debug menu
Scene::instance->SetRequestedScene(std::make_shared<Scene_Debug>());
break;
case 6: // License information menu
// TODO? Implement license information menu
return true;
case 7: // Reset game
return CommandReturnToTitleScreen(com);
case 8: // EASYRPG Inventory menu
return RequestMainMenuScene(1);
case 9: // EASYRPG Skills menu
return RequestMainMenuScene(2, actor_index, is_db_actor);
case 10: // EASYRPG Equip menu
return RequestMainMenuScene(3, actor_index, is_db_actor);
case 11: // EASYRPG Status menu
return RequestMainMenuScene(4, actor_index, is_db_actor);
case 12: // EASYRPG Reorder Party menu
return RequestMainMenuScene(5);
default:
return true;
}

++index;
return false;
}
Expand Down

0 comments on commit 0c7528a

Please sign in to comment.