aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2018-12-03 20:32:12 -0800
committerPaul Gilbert2018-12-08 19:05:59 -0800
commit63079834fa7fd7f4592b0a52e709d01b431740e2 (patch)
treec2fd44208c1610861f5bcef04cad6d2862eb9883
parent1933130dfcc417c96e0dfd5eadee68833daf0821 (diff)
downloadscummvm-rg350-63079834fa7fd7f4592b0a52e709d01b431740e2.tar.gz
scummvm-rg350-63079834fa7fd7f4592b0a52e709d01b431740e2.tar.bz2
scummvm-rg350-63079834fa7fd7f4592b0a52e709d01b431740e2.zip
GLK: FROTZ: Improved rendering of Beyond Zork description area
-rw-r--r--engines/glk/frotz/glk_interface.cpp2
-rw-r--r--engines/glk/frotz/processor_screen.cpp47
-rw-r--r--engines/glk/window_text_grid.h5
-rw-r--r--engines/glk/windows.h5
4 files changed, 40 insertions, 19 deletions
diff --git a/engines/glk/frotz/glk_interface.cpp b/engines/glk/frotz/glk_interface.cpp
index c2d6ca2703..7367375f05 100644
--- a/engines/glk/frotz/glk_interface.cpp
+++ b/engines/glk/frotz/glk_interface.cpp
@@ -203,6 +203,8 @@ bool GlkInterface::initPictures() {
}
int GlkInterface::os_char_width(zchar z) {
+ // Note: I'm presuming this is 1 because Glk Text Grid windows take care of font sizes internally,
+ // so we can pretend that any font has a 1x1 size
return 1;
}
diff --git a/engines/glk/frotz/processor_screen.cpp b/engines/glk/frotz/processor_screen.cpp
index 6627bf672d..2ec012854a 100644
--- a/engines/glk/frotz/processor_screen.cpp
+++ b/engines/glk/frotz/processor_screen.cpp
@@ -181,8 +181,9 @@ void Processor::z_get_cursor() {
void Processor::z_print_table() {
zword addr = zargs[0];
- zword x;
+ zword xs = curx;
int i, j;
+ zbyte c;
// Supply default arguments
if (zargc < 3)
@@ -191,18 +192,10 @@ void Processor::z_print_table() {
zargs[3] = 0;
// Write text in width x height rectangle
- x = curx;
-
- for (i = 0; i < zargs[2]; i++) {
- if (i != 0) {
- cury += 1;
- curx = x;
- }
+ for (i = 0; i < zargs[2]; i++, curx = xs, cury++) {
+ glk_window_move_cursor(cwin == 0 ? gos_lower : gos_upper, xs - 1, cury - 1);
for (j = 0; j < zargs[1]; j++) {
-
- zbyte c;
-
LOW_BYTE(addr, c);
addr++;
@@ -330,17 +323,33 @@ void Processor::z_set_font() {
}
void Processor::z_set_cursor() {
- cury = zargs[0];
- curx = zargs[1];
+ int x = (int16)zargs[1], y = (int16)zargs[0];
+ assert(gos_upper);
- if (gos_upper) {
- if (cury > mach_status_ht) {
- mach_status_ht = cury;
- reset_status_ht();
- }
+ flush_buffer();
- glk_window_move_cursor(gos_upper, curx - 1, cury - 1);
+ if (y < 0) {
+ // Cursor on/off
+ error("TODO: Turning cursor on/off");
}
+
+ if (!x || !y) {
+ Point cursorPos = gos_upper->getCursor();
+ if (!x)
+ x = cursorPos.x;
+ if (!y)
+ y = cursorPos.y;
+ }
+
+ curx = x;
+ cury = y;
+
+ if (cury > mach_status_ht) {
+ mach_status_ht = cury;
+ reset_status_ht();
+ }
+
+ glk_window_move_cursor(gos_upper, curx - 1, cury - 1);
}
void Processor::z_set_text_style() {
diff --git a/engines/glk/window_text_grid.h b/engines/glk/window_text_grid.h
index 30a0f79b25..d7830e08ef 100644
--- a/engines/glk/window_text_grid.h
+++ b/engines/glk/window_text_grid.h
@@ -108,6 +108,11 @@ public:
virtual bool unputCharUni(uint32 ch) override;
/**
+ * Get the cursor position
+ */
+ virtual Point getCursor() const override { return Point(_curX, _curY); }
+
+ /**
* Move the cursor
*/
virtual void moveCursor(const Point &newPos) override;
diff --git a/engines/glk/windows.h b/engines/glk/windows.h
index 27380fa23e..4b71aa0fab 100644
--- a/engines/glk/windows.h
+++ b/engines/glk/windows.h
@@ -440,6 +440,11 @@ public:
}
/**
+ * Get the cursor position
+ */
+ virtual Point getCursor() const { return Point(); }
+
+ /**
* Move the cursor
*/
virtual void moveCursor(const Point &newPos);