aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/glk/frotz/glk_interface.cpp1
-rw-r--r--engines/glk/frotz/processor_screen.cpp32
-rw-r--r--engines/glk/frotz/processor_windows.cpp2
-rw-r--r--engines/glk/frotz/windows.cpp71
-rw-r--r--engines/glk/frotz/windows.h11
5 files changed, 80 insertions, 37 deletions
diff --git a/engines/glk/frotz/glk_interface.cpp b/engines/glk/frotz/glk_interface.cpp
index 69b1dc5882..4d60fe7ac7 100644
--- a/engines/glk/frotz/glk_interface.cpp
+++ b/engines/glk/frotz/glk_interface.cpp
@@ -542,6 +542,7 @@ void GlkInterface::showBeyondZorkTitle() {
}
void GlkInterface::os_draw_picture(int picture, const Common::Point &pos) {
+ assert(pos.x != 0 && pos.y != 0);
if (_wp._cwin == 0) {
// Picture embedded within the lower text area
glk_image_draw(_wp._lower, picture, imagealign_MarginLeft, 0);
diff --git a/engines/glk/frotz/processor_screen.cpp b/engines/glk/frotz/processor_screen.cpp
index 992df74757..a3134d3c35 100644
--- a/engines/glk/frotz/processor_screen.cpp
+++ b/engines/glk/frotz/processor_screen.cpp
@@ -359,7 +359,7 @@ void Processor::z_set_colour() {
_wp[win][TRUE_BG_COLOR] = bg;
if (win == _wp._cwin || h_version != V6)
- garglk_set_zcolors(fg, bg);
+ _wp.currWin().updateColors(fg, bg);
}
void Processor::z_set_font() {
@@ -440,35 +440,7 @@ void Processor::z_set_text_style() {
if (gos_linepending && _wp.currWin() == gos_linewin)
return;
- if (style & REVERSE_STYLE) {
- os_set_reverse_video(true);
- }
-
- if (style & FIXED_WIDTH_STYLE) {
- if (curr_font == GRAPHICS_FONT)
- glk_set_style(style_User1); // character graphics
- else if (style & BOLDFACE_STYLE && style & EMPHASIS_STYLE)
- glk_set_style(style_BlockQuote); // monoz
- else if (style & EMPHASIS_STYLE)
- glk_set_style(style_Alert); // monoi
- else if (style & BOLDFACE_STYLE)
- glk_set_style(style_Subheader); // monob
- else
- glk_set_style(style_Preformatted); // monor
- } else {
- if (style & BOLDFACE_STYLE && style & EMPHASIS_STYLE)
- glk_set_style(style_Note); // propz
- else if (style & EMPHASIS_STYLE)
- glk_set_style(style_Emphasized); // propi
- else if (style & BOLDFACE_STYLE)
- glk_set_style(style_Header); // propb
- else
- glk_set_style(style_Normal); // propr
- }
-
- if (curstyle == 0) {
- os_set_reverse_video(false);
- }
+ _wp[_wp._cwin].setStyle(style);
}
void Processor::z_set_window() {
diff --git a/engines/glk/frotz/processor_windows.cpp b/engines/glk/frotz/processor_windows.cpp
index a9591c392b..2ebc960a5c 100644
--- a/engines/glk/frotz/processor_windows.cpp
+++ b/engines/glk/frotz/processor_windows.cpp
@@ -59,8 +59,8 @@ void Processor::z_draw_picture() {
y = win[Y_CURSOR];
}
- y += win[Y_POS] - 1;
x += win[X_POS] - 1;
+ y += win[Y_POS] - 1;
/* The following is necessary to make Amiga and Macintosh story
* files work with MCGA graphics files. Some screen-filling
diff --git a/engines/glk/frotz/windows.cpp b/engines/glk/frotz/windows.cpp
index 38e5dd96dc..0fe836a5ad 100644
--- a/engines/glk/frotz/windows.cpp
+++ b/engines/glk/frotz/windows.cpp
@@ -30,8 +30,10 @@ namespace Glk {
namespace Frotz {
Windows::Windows() : _lower(_windows[0]), _upper(_windows[1]), _background(nullptr), _cwin(0) {
- for (size_t idx = 0; idx < 8; ++idx)
+ for (size_t idx = 0; idx < 8; ++idx) {
_windows[idx]._windows = this;
+ _windows[idx]._index = idx;
+ }
}
size_t Windows::size() const {
@@ -49,7 +51,7 @@ void Windows::setup(bool isVersion6) {
// flexibility of wher we draw pictures, and the lower and upper areas sit on top of them
_background = g_vm->glk_window_open(0, 0, 0, wintype_Graphics, 0);
_background->setBackgroundColor(0xffffff);
-
+ /*
MonoFontInfo &fi = g_vm->_conf->_monoInfo;
_lower = g_vm->glk_window_open(g_vm->glk_window_get_root(),
winmethod_Arbitrary | winmethod_Fixed, 0, wintype_TextBuffer, 0);
@@ -59,15 +61,16 @@ void Windows::setup(bool isVersion6) {
_upper.setSize(Point(g_system->getWidth() / fi._cellW, 1));
_lower.setPosition(Point(1, 2));
_lower.setSize(Point(g_system->getWidth() / fi._cellW, g_system->getHeight() / fi._cellH - 1));
+ */
} else {
_lower = g_vm->glk_window_open(0, 0, 0, wintype_TextBuffer, 0);
_upper = g_vm->glk_window_open(_lower, winmethod_Above | winmethod_Fixed, 0, wintype_TextGrid, 0);
- }
- _lower.update();
- _upper.update();
- g_vm->glk_set_window(_lower);
+ _lower.update();
+ _upper.update();
+ g_vm->glk_set_window(_lower);
+ }
}
void Windows::setWindow(int win) {
@@ -176,6 +179,62 @@ void Window::updateColors(uint fore, uint back) {
updateColors();
}
+void Window::setStyle(uint style) {
+ /*
+ if (style & REVERSE_STYLE) {
+ os_set_reverse_video(true);
+ }*/
+
+ if (!_win)
+ createGlkWindow();
+
+ if (style & FIXED_WIDTH_STYLE) {
+ if (g_vm->curr_font == GRAPHICS_FONT)
+ _win->_stream->setStyle(style_User1); // character graphics
+ else if (style & BOLDFACE_STYLE && style & EMPHASIS_STYLE)
+ _win->_stream->setStyle(style_BlockQuote); // monoz
+ else if (style & EMPHASIS_STYLE)
+ _win->_stream->setStyle(style_Alert); // monoi
+ else if (style & BOLDFACE_STYLE)
+ _win->_stream->setStyle(style_Subheader); // monob
+ else
+ _win->_stream->setStyle(style_Preformatted); // monor
+ } else {
+ if (style & BOLDFACE_STYLE && style & EMPHASIS_STYLE)
+ _win->_stream->setStyle(style_Note); // propz
+ else if (style & EMPHASIS_STYLE)
+ _win->_stream->setStyle(style_Emphasized); // propi
+ else if (style & BOLDFACE_STYLE)
+ _win->_stream->setStyle(style_Header); // propb
+ else
+ _win->_stream->setStyle(style_Normal); // propr
+ }
+
+ /*
+ if (curstyle == 0) {
+ os_set_reverse_video(false);
+ }
+ */
+}
+
+void Window::createGlkWindow() {
+ // Create a new window
+ if (_index == 1) {
+ // Text grid window
+ _win = g_vm->glk_window_open(g_vm->glk_window_get_root(),
+ winmethod_Arbitrary | winmethod_Fixed, 0, wintype_TextGrid, 0);
+ } else {
+ // text buffer window
+ _win = g_vm->glk_window_open(g_vm->glk_window_get_root(),
+ winmethod_Arbitrary | winmethod_Fixed, 0, wintype_TextBuffer, 0);
+ }
+
+ setSize(Point(_properties[X_SIZE], _properties[Y_SIZE]));
+ setPosition(Point(_properties[X_POS], _properties[Y_POS]));
+
+ g_vm->glk_set_window(_win);
+}
+
const uint &Window::getProperty(WindowProperty propType) {
if (_win)
update();
diff --git a/engines/glk/frotz/windows.h b/engines/glk/frotz/windows.h
index 9d9af2aa00..0f2bdff772 100644
--- a/engines/glk/frotz/windows.h
+++ b/engines/glk/frotz/windows.h
@@ -77,6 +77,7 @@ class Window {
};
private:
Windows *_windows;
+ int _index;
winid_t _win;
uint _properties[TRUE_BG_COLOR + 1];
private:
@@ -99,6 +100,11 @@ private:
* Updates the local window properties based on an attached Glk window
*/
void update();
+
+ /**
+ * Creates a new Glk window to attach to the window
+ */
+ void createGlkWindow();
public:
/**
* Constructor
@@ -162,6 +168,11 @@ public:
* Update colors for the window
*/
void updateColors(uint fore, uint back);
+
+ /**
+ * Set the textstyle
+ */
+ void setStyle(uint style);
};
/**