| 455 | } |
| 456 | |
| 457 | void Window_Message::UpdateMessage() { |
| 458 | // Message Box Show Message rendering loop |
| 459 | bool instant_speed_forced = false; |
| 460 | |
| 461 | if (Player::debug_flag && Input::IsPressed(Input::SHIFT)) { |
| 462 | instant_speed = true; |
| 463 | instant_speed_forced = true; |
| 464 | } |
| 465 | |
| 466 | auto system = Cache::SystemOrBlack(); |
| 467 | |
| 468 | while (true) { |
| 469 | const auto* end = text.data() + text.size(); |
| 470 | |
| 471 | if (wait_count > 0) { |
| 472 | DebugLog("{}: MSG WAIT LOOP {}", wait_count); |
| 473 | --wait_count; |
| 474 | break; |
| 475 | } |
| 476 | |
| 477 | if (!shape_ret.empty()) { |
| 478 | if (!DrawGlyph(*page_font, *system, shape_ret[0])) { |
| 479 | continue; |
| 480 | } |
| 481 | |
| 482 | shape_ret.erase(shape_ret.begin()); |
| 483 | continue; |
| 484 | } |
| 485 | |
| 486 | if (GetPause() || GetIndex() >= 0 || number_input_window->GetActive()) { |
| 487 | break; |
| 488 | } |
| 489 | |
| 490 | if (text_index == end) { |
| 491 | FinishMessageProcessing(); |
| 492 | break; |
| 493 | } |
| 494 | |
| 495 | auto tret = Utils::TextNext(text_index, end, Player::escape_char); |
| 496 | auto text_prev = text_index; |
| 497 | text_index = tret.next; |
| 498 | |
| 499 | if (EP_UNLIKELY(!tret)) { |
| 500 | continue; |
| 501 | } |
| 502 | |
| 503 | const auto ch = tret.ch; |
| 504 | if (tret.is_exfont) { |
| 505 | if (!DrawGlyph(*page_font, *system, ch, true)) { |
| 506 | text_index = text_prev; |
| 507 | } |
| 508 | continue; |
| 509 | } |
| 510 | |
| 511 | if (ch == '\f') { |
| 512 | if (text_index != end) { |
| 513 | InsertNewPage(); |
| 514 | SetWait(1); |