From 386faebad1c4aab2ae92a7ac846d0f95a608f636 Mon Sep 17 00:00:00 2001 From: Lobomon Date: Sat, 7 Dec 2013 18:36:39 -0600 Subject: [PATCH 1/2] Several fixes to the commands, now the structure should run on most of games. The stack calls works and also the break. Fixed the teleport to store location. --- src/game_interpreter.cpp | 19 +++++++++++++++++-- src/game_interpreter.h | 3 ++- src/game_interpreter_map.cpp | 3 +++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/game_interpreter.cpp b/src/game_interpreter.cpp index e8bbbdda75..178e9f95c6 100644 --- a/src/game_interpreter.cpp +++ b/src/game_interpreter.cpp @@ -64,6 +64,7 @@ Game_Interpreter::~Game_Interpreter() { void Game_Interpreter::Clear() { map_id = 0; // map ID when starting up event_id = 0; // event ID + StateAftercall=-1; //Game_Message::message_waiting = false; // waiting for message to end move_route_waiting = false; // waiting for move completion button_input_variable_id = 0; // button input variable ID @@ -224,6 +225,19 @@ void Game_Interpreter::Update() { // faster then Player does. // No idea if any game depends on this special case. index++; + + // If you are a father and do not have child after an stack call + // reduce index + if(((StateAftercall!=(-1))&&(!child_interpreter))&&((index)==(StateAftercall+2))) + { + index=StateAftercall+1; + StateAftercall=-1; + } + //the setup got correctly set so remove the stack info + if(((StateAftercall!=(-1))&&(!child_interpreter))&&((index)==(StateAftercall+1))) + { + StateAftercall=-1; + } } // for // Executed Events Count exceeded (10000) @@ -262,8 +276,9 @@ bool Game_Interpreter::SkipTo(int code, int code2, int min_indent, int max_inden index = idx; return true; } - - return false; + // if you do not find it set the page size so the easy do not stuck + index = list.size()-1; + return true; } // Execute Command. diff --git a/src/game_interpreter.h b/src/game_interpreter.h index fe7a521f52..056aa4b7b6 100644 --- a/src/game_interpreter.h +++ b/src/game_interpreter.h @@ -37,6 +37,7 @@ class Game_CommonEvent; class Game_Interpreter { public: + int StateAftercall; Game_Interpreter(int _depth = 0, bool _main_flag = false); virtual ~Game_Interpreter(); @@ -65,7 +66,7 @@ class Game_Interpreter bool main_flag; int loop_count; - + bool move_route_waiting; int button_input_variable_id; diff --git a/src/game_interpreter_map.cpp b/src/game_interpreter_map.cpp index e7803e0238..75b6dfd103 100644 --- a/src/game_interpreter_map.cpp +++ b/src/game_interpreter_map.cpp @@ -251,6 +251,7 @@ bool Game_Interpreter_Map::ExecuteCommand() { case Cmd::ChangeMapTileset: return CommandChangeMapTileset(com); case Cmd::CallEvent: + StateAftercall=index; return CommandCallEvent(com); case Cmd::ChangeEncounterRate: return CommandChangeEncounterRate(com); @@ -418,6 +419,8 @@ bool Game_Interpreter_Map::CommandRecallToLocation(RPG::EventCommand const& com) } Main_Data::game_player->ReserveTeleport(map_id, x, y); + Main_Data::game_player->StartTeleport(); + index++; return false; From c38547ce3ee2e7862e179cdd57389d0011806ce0 Mon Sep 17 00:00:00 2001 From: Ghabry Date: Wed, 11 Dec 2013 21:05:54 +0100 Subject: [PATCH 2/2] Fix: When an event had the structure "[Call Event] [Show Message]" and the event called via "Call event" displayed a message the message directly after the "Call event" call was not displayed. --- src/game_interpreter.cpp | 14 -------------- src/game_interpreter.h | 1 - src/game_interpreter_map.cpp | 1 - src/window_message.cpp | 2 +- 4 files changed, 1 insertion(+), 17 deletions(-) diff --git a/src/game_interpreter.cpp b/src/game_interpreter.cpp index 178e9f95c6..7e77e7dfda 100644 --- a/src/game_interpreter.cpp +++ b/src/game_interpreter.cpp @@ -64,7 +64,6 @@ Game_Interpreter::~Game_Interpreter() { void Game_Interpreter::Clear() { map_id = 0; // map ID when starting up event_id = 0; // event ID - StateAftercall=-1; //Game_Message::message_waiting = false; // waiting for message to end move_route_waiting = false; // waiting for move completion button_input_variable_id = 0; // button input variable ID @@ -225,19 +224,6 @@ void Game_Interpreter::Update() { // faster then Player does. // No idea if any game depends on this special case. index++; - - // If you are a father and do not have child after an stack call - // reduce index - if(((StateAftercall!=(-1))&&(!child_interpreter))&&((index)==(StateAftercall+2))) - { - index=StateAftercall+1; - StateAftercall=-1; - } - //the setup got correctly set so remove the stack info - if(((StateAftercall!=(-1))&&(!child_interpreter))&&((index)==(StateAftercall+1))) - { - StateAftercall=-1; - } } // for // Executed Events Count exceeded (10000) diff --git a/src/game_interpreter.h b/src/game_interpreter.h index 056aa4b7b6..992f43acaa 100644 --- a/src/game_interpreter.h +++ b/src/game_interpreter.h @@ -37,7 +37,6 @@ class Game_CommonEvent; class Game_Interpreter { public: - int StateAftercall; Game_Interpreter(int _depth = 0, bool _main_flag = false); virtual ~Game_Interpreter(); diff --git a/src/game_interpreter_map.cpp b/src/game_interpreter_map.cpp index 75b6dfd103..0d49b2f664 100644 --- a/src/game_interpreter_map.cpp +++ b/src/game_interpreter_map.cpp @@ -251,7 +251,6 @@ bool Game_Interpreter_Map::ExecuteCommand() { case Cmd::ChangeMapTileset: return CommandChangeMapTileset(com); case Cmd::CallEvent: - StateAftercall=index; return CommandCallEvent(com); case Cmd::ChangeEncounterRate: return CommandChangeEncounterRate(com); diff --git a/src/window_message.cpp b/src/window_message.cpp index 64d0bd0c62..936ea3d234 100644 --- a/src/window_message.cpp +++ b/src/window_message.cpp @@ -245,7 +245,7 @@ void Window_Message::Update() { Window_Selectable::Update(); number_input_window->Update(); - if (visible && !Game_Message::visible) { + if (!IsNextMessagePossible() && visible && !Game_Message::visible) { // The Event Page ended but the MsgBox was used in this Event // It can be closed now. TerminateMessage();