From 69b2fd88987a8af0165425b9ea2815176bf2b302 Mon Sep 17 00:00:00 2001 From: uyjulian Date: Thu, 21 Oct 2021 23:14:58 -0500 Subject: [PATCH] Set a flag when any of the 'lang' series of commands are used Only check current_read_language on page wait if current_language_set is set Fixes page breaks not working properly when any of the 'lang' series of commands are not used --- src/PonscripterLabel_command.cpp | 5 +++++ src/PonscripterLabel_text.cpp | 2 +- src/ScriptParser.cpp | 2 ++ src/ScriptParser.h | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/PonscripterLabel_command.cpp b/src/PonscripterLabel_command.cpp index a9d236ac..68e0d776 100644 --- a/src/PonscripterLabel_command.cpp +++ b/src/PonscripterLabel_command.cpp @@ -1739,6 +1739,7 @@ int PonscripterLabel::getreadlangCommand(const pstring& cmd) int PonscripterLabel::showlangenCommand(const pstring& cmd) { current_language = 0; + current_language_set = 1; //loadSaveFile(15); text_info.fill(0, 0, 0, 0); flush(refreshMode(), &sentence_font_info.pos); @@ -1749,6 +1750,7 @@ int PonscripterLabel::showlangenCommand(const pstring& cmd) int PonscripterLabel::showlangjpCommand(const pstring& cmd) { current_language = 1; + current_language_set = 1; //loadSaveFile(15); text_info.fill(0, 0, 0, 0); flush(refreshMode(), &sentence_font_info.pos); @@ -1759,6 +1761,7 @@ int PonscripterLabel::showlangjpCommand(const pstring& cmd) int PonscripterLabel::langenCommand(const pstring& cmd) { current_read_language = 0; + current_language_set = 1; return RET_CONTINUE; } @@ -1769,6 +1772,7 @@ int PonscripterLabel::langjpCommand(const pstring& cmd) // saveSaveFile(15); //} current_read_language = 1; + current_language_set = 1; return RET_CONTINUE; } @@ -1776,6 +1780,7 @@ int PonscripterLabel::langjpCommand(const pstring& cmd) int PonscripterLabel::langallCommand(const pstring& cmd) { current_read_language = -1; + current_language_set = 1; return RET_CONTINUE; } diff --git a/src/PonscripterLabel_text.cpp b/src/PonscripterLabel_text.cpp index db6c3c85..1950b2c6 100644 --- a/src/PonscripterLabel_text.cpp +++ b/src/PonscripterLabel_text.cpp @@ -432,7 +432,7 @@ int PonscripterLabel::clickNewPage(bool display_char) { const char* c = script_h.getStrBuf(string_buffer_offset); - if (current_read_language != -1 && current_read_language != current_language) { + if ((current_read_language != -1 && current_read_language != current_language) || (!current_language_set)) { clickstr_state = CLICK_NEWPAGE; } diff --git a/src/ScriptParser.cpp b/src/ScriptParser.cpp index c685f122..c34ac064 100644 --- a/src/ScriptParser.cpp +++ b/src/ScriptParser.cpp @@ -188,6 +188,7 @@ ScriptParser::ScriptParser() current_language = 0; current_read_language = -1; + current_language_set = 0; syscall_dict["skip"] = SYSTEM_SKIP; syscall_dict["reset"] = SYSTEM_RESET; syscall_dict["save"] = SYSTEM_SAVE; @@ -268,6 +269,7 @@ void ScriptParser::reset() max_text_buffer = MAX_TEXT_BUFFER; num_chars_in_sentence = 0; current_read_language = -1; + current_language_set = 0; // textbufferchange int i; diff --git a/src/ScriptParser.h b/src/ScriptParser.h index b0adc38a..198197b9 100644 --- a/src/ScriptParser.h +++ b/src/ScriptParser.h @@ -379,6 +379,7 @@ class ScriptParser { TextBuffer *start_text_buffer[2], *current_text_buffer[2]; int current_language; int current_read_language; + int current_language_set; void TextBuffer_dumpstate(int = 0); int max_text_buffer;