Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 7 additions & 16 deletions src/window_message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,11 @@ void Window_Message::StartMessageProcessing(PendingMessage pm) {

DebugLog("{}: MSG TEXT \n{}", text);

disallow_next_message = true;
msg_was_pushed_this_frame = true;
auto open_frames = (!IsVisible() && !Game_Battle::IsBattleRunning()) ? message_animation_frames : 0;
SetOpenAnimation(open_frames);
DebugLog("{}: MSG START OPEN {}", open_frames);

InsertNewPage();
}

void Window_Message::OnFinishPage() {
Expand Down Expand Up @@ -416,7 +419,7 @@ void Window_Message::Update() {
if (IsClosing()) { DebugLog("{}: MSG CLOSING"); }

close_started_this_frame = false;
disallow_next_message = false;
close_finished_this_frame = false;

const bool was_closing = IsClosing();

Expand All @@ -425,22 +428,10 @@ void Window_Message::Update() {
gold_window->Update();

if (was_closing && !IsClosing()) {
disallow_next_message = true;
close_finished_this_frame = true;
}

if (!IsVisible()) {
if (msg_was_pushed_this_frame) {
msg_was_pushed_this_frame = false;
disallow_next_message = true;
return;
}
if (!text.empty() && text_index == text.data()) {
auto open_frames = (!IsVisible() && !Game_Battle::IsBattleRunning()) ? message_animation_frames : 0;
SetOpenAnimation(open_frames);
DebugLog("{}: MSG START OPEN {}", open_frames);

InsertNewPage();
}
return;
}

Expand Down
7 changes: 3 additions & 4 deletions src/window_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,8 @@ class Window_Message: public Window_Selectable {
// FIXME: This hacky flags exist because RPG_RT likely animates the message window
// after the game loop finishes. Our code isn't structured that way, so we must hack
// around it.
bool msg_was_pushed_this_frame = false;
bool close_started_this_frame = false;
bool disallow_next_message = false;
bool close_finished_this_frame = false;

/** Frames to wait when a message wait command was used */
int wait_count = 0;
Expand Down Expand Up @@ -215,8 +214,8 @@ inline AsyncOp Window_Message::GetAsyncOp() const {
}

inline bool Window_Message::GetAllowNextMessage(bool foreground) const {
bool is_active = (IsVisible() || disallow_next_message);
return foreground ? !is_active || (close_started_this_frame && !disallow_next_message): !is_active;
bool is_active = (IsVisible() || close_finished_this_frame);
return foreground ? !is_active || close_started_this_frame : !is_active;
}

inline int Window_Message::GetMaxLinesPerPage() const {
Expand Down
Loading