Skip to content

Commit 4170efb

Browse files
authored
Merge pull request #3521 from Ghabry/revert-8cbb69
Revert "Refactored window_message, so that page setup is handled afte…
2 parents 2b3bee4 + a70a00f commit 4170efb

2 files changed

Lines changed: 10 additions & 20 deletions

File tree

src/window_message.cpp

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,11 @@ void Window_Message::StartMessageProcessing(PendingMessage pm) {
190190

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

193-
disallow_next_message = true;
194-
msg_was_pushed_this_frame = true;
193+
auto open_frames = (!IsVisible() && !Game_Battle::IsBattleRunning()) ? message_animation_frames : 0;
194+
SetOpenAnimation(open_frames);
195+
DebugLog("{}: MSG START OPEN {}", open_frames);
196+
197+
InsertNewPage();
195198
}
196199

197200
void Window_Message::OnFinishPage() {
@@ -416,7 +419,7 @@ void Window_Message::Update() {
416419
if (IsClosing()) { DebugLog("{}: MSG CLOSING"); }
417420

418421
close_started_this_frame = false;
419-
disallow_next_message = false;
422+
close_finished_this_frame = false;
420423

421424
const bool was_closing = IsClosing();
422425

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

427430
if (was_closing && !IsClosing()) {
428-
disallow_next_message = true;
431+
close_finished_this_frame = true;
429432
}
430433

431434
if (!IsVisible()) {
432-
if (msg_was_pushed_this_frame) {
433-
msg_was_pushed_this_frame = false;
434-
disallow_next_message = true;
435-
return;
436-
}
437-
if (!text.empty() && text_index == text.data()) {
438-
auto open_frames = (!IsVisible() && !Game_Battle::IsBattleRunning()) ? message_animation_frames : 0;
439-
SetOpenAnimation(open_frames);
440-
DebugLog("{}: MSG START OPEN {}", open_frames);
441-
442-
InsertNewPage();
443-
}
444435
return;
445436
}
446437

src/window_message.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,8 @@ class Window_Message: public Window_Selectable {
165165
// FIXME: This hacky flags exist because RPG_RT likely animates the message window
166166
// after the game loop finishes. Our code isn't structured that way, so we must hack
167167
// around it.
168-
bool msg_was_pushed_this_frame = false;
169168
bool close_started_this_frame = false;
170-
bool disallow_next_message = false;
169+
bool close_finished_this_frame = false;
171170

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

217216
inline bool Window_Message::GetAllowNextMessage(bool foreground) const {
218-
bool is_active = (IsVisible() || disallow_next_message);
219-
return foreground ? !is_active || (close_started_this_frame && !disallow_next_message): !is_active;
217+
bool is_active = (IsVisible() || close_finished_this_frame);
218+
return foreground ? !is_active || close_started_this_frame : !is_active;
220219
}
221220

222221
inline int Window_Message::GetMaxLinesPerPage() const {

0 commit comments

Comments
 (0)