| 838 | } |
| 839 | |
| 840 | void Window_Message::SetWaitForCharacter(int width) { |
| 841 | int frames = 0; |
| 842 | if (!instant_speed && width > 0) { |
| 843 | bool is_last_for_page; |
| 844 | if (!shape_ret.empty()) { |
| 845 | is_last_for_page = (shape_ret.size() == 1) && ( |
| 846 | (text.data() + text.size() - text_index) <= 1 || (*text_index == '\n' && *(text_index + 1) == '\f')); |
| 847 | } else { |
| 848 | is_last_for_page = (text.data() + text.size() - text_index) <= 1 || (*text_index == '\n' && *(text_index + 1) == '\f'); |
| 849 | } |
| 850 | |
| 851 | if (is_last_for_page) { |
| 852 | // RPG_RT always waits 2 frames for last character on the page. |
| 853 | // FIXME: Exfonts / wide last on page? |
| 854 | DebugLogText("{}: is_last_for_page"); |
| 855 | frames = 2; |
| 856 | } else { |
| 857 | if (speed > 1) { |
| 858 | frames = speed * width / 2 + 1; |
| 859 | } else { |
| 860 | frames = width / 2; |
| 861 | if (width & 1) { |
| 862 | bool is_last_for_line; |
| 863 | if (!shape_ret.empty()) { |
| 864 | is_last_for_line = shape_ret.size() == 1 && (*text_index == '\n'); |
| 865 | } else { |
| 866 | is_last_for_line = (*text_index == '\n'); |
| 867 | } |
| 868 | if (is_last_for_line) { |
| 869 | DebugLogText("{}: is_last_for_line"); |
| 870 | } |
| 871 | |
| 872 | // RPG_RT waits for every even character. Also always waits |
| 873 | // for the last character. |
| 874 | frames += (line_char_counter & 1) || is_last_for_line; |
| 875 | } |
| 876 | } |
| 877 | } |
| 878 | } |
| 879 | prev_char_waited = (instant_speed || frames > 0); |
| 880 | prev_char_printable = true; |
| 881 | SetWait(frames); |
| 882 | IncrementLineCharCounter(width); |
| 883 | } |
| 884 | |
| 885 | void Window_Message::SetWait(int frames) { |
| 886 | assert(speed >= 1 && speed <= 20); |
nothing calls this directly
no test coverage detected