From 0448f5608fda54ef92d9826728af537450bc339d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 4 Aug 2019 10:59:39 -0700 Subject: GLK: FROTZ: V6 window creation so Arthur intro now progresses further --- engines/glk/frotz/processor_screen.cpp | 2 ++ engines/glk/frotz/windows.cpp | 13 +++++++++++++ engines/glk/frotz/windows.h | 5 +++++ 3 files changed, 20 insertions(+) diff --git a/engines/glk/frotz/processor_screen.cpp b/engines/glk/frotz/processor_screen.cpp index f6eb16ac20..78c884de3a 100644 --- a/engines/glk/frotz/processor_screen.cpp +++ b/engines/glk/frotz/processor_screen.cpp @@ -104,6 +104,8 @@ uint32 Processor::zchar_to_unicode_rune(zchar c) { void Processor::screen_char(zchar c) { Window &w = _wp.currWin(); + w.ensureTextWindow(); + if (gos_linepending && (w == gos_linewin)) { gos_cancel_pending_line(); if (_wp.currWin() == _wp._upper) { diff --git a/engines/glk/frotz/windows.cpp b/engines/glk/frotz/windows.cpp index 6e279193bd..7e647ea06c 100644 --- a/engines/glk/frotz/windows.cpp +++ b/engines/glk/frotz/windows.cpp @@ -23,6 +23,7 @@ #include "glk/frotz/windows.h" #include "glk/frotz/frotz.h" #include "glk/window_pair.h" +#include "glk/window_text_grid.h" #include "glk/window_text_buffer.h" #include "glk/conf.h" @@ -123,6 +124,18 @@ Window &Window::operator=(winid_t win) { return *this; } +void Window::ensureTextWindow() { + if (_win) { + // There's a window present, so make sure it's a text grid or text buffer window + if (dynamic_cast(_win) || dynamic_cast(_win)) + return; + + g_vm->glk_window_close(_win); + _win = nullptr; + } + + createGlkWindow(); +} void Window::setSize(const Point &newSize) { checkRepositionLower(); diff --git a/engines/glk/frotz/windows.h b/engines/glk/frotz/windows.h index 8043a103ba..785fb10d8f 100644 --- a/engines/glk/frotz/windows.h +++ b/engines/glk/frotz/windows.h @@ -153,6 +153,11 @@ public: */ PropertyAccessor operator[](WindowProperty propType) { return PropertyAccessor(this, propType); } + /** + * Ensures that the underlying window is a Glk text window + */ + void ensureTextWindow(); + /** * Set the window size */ -- cgit v1.2.3