aboutsummaryrefslogtreecommitdiff
path: root/engines/gargoyle
diff options
context:
space:
mode:
authorPaul Gilbert2018-11-12 11:40:31 -0800
committerPaul Gilbert2018-12-08 19:05:59 -0800
commit7d2406870e733258c7d59d54a7b490fbf52c2109 (patch)
tree29476d2cd3fd556e97888c61be5ec0e85191e058 /engines/gargoyle
parentaab1dfeff8002a8b8f69d4d5f24110a7a01c263d (diff)
downloadscummvm-rg350-7d2406870e733258c7d59d54a7b490fbf52c2109.tar.gz
scummvm-rg350-7d2406870e733258c7d59d54a7b490fbf52c2109.tar.bz2
scummvm-rg350-7d2406870e733258c7d59d54a7b490fbf52c2109.zip
GLK: FROTZ: Add screen message methods
Diffstat (limited to 'engines/gargoyle')
-rw-r--r--engines/gargoyle/frotz/glk_interface.cpp7
-rw-r--r--engines/gargoyle/frotz/glk_interface.h13
-rw-r--r--engines/gargoyle/frotz/processor_buffer.cpp5
-rw-r--r--engines/gargoyle/frotz/processor_input.cpp4
-rw-r--r--engines/gargoyle/frotz/processor_screen.cpp98
5 files changed, 108 insertions, 19 deletions
diff --git a/engines/gargoyle/frotz/glk_interface.cpp b/engines/gargoyle/frotz/glk_interface.cpp
index 13d0a562b5..c536a48df5 100644
--- a/engines/gargoyle/frotz/glk_interface.cpp
+++ b/engines/gargoyle/frotz/glk_interface.cpp
@@ -397,5 +397,12 @@ void GlkInterface::smartstatusline() {
glk_window_move_cursor(gos_upper, cury - 1, curx - 1);
}
+void GlkInterface::gos_cancel_pending_line() {
+ event_t ev;
+ glk_cancel_line_event(gos_linewin, &ev);
+ gos_linebuf[ev.val1] = '\0';
+ gos_linepending = 0;
+}
+
} // End of namespace Scott
} // End of namespace Gargoyle
diff --git a/engines/gargoyle/frotz/glk_interface.h b/engines/gargoyle/frotz/glk_interface.h
index 161a1f3a41..aeb33a8aa1 100644
--- a/engines/gargoyle/frotz/glk_interface.h
+++ b/engines/gargoyle/frotz/glk_interface.h
@@ -143,9 +143,22 @@ protected:
void smartstatusline();
/**
+ * Cancels any pending line
+ */
+ void gos_cancel_pending_line();
+
+ /**
* Called during game restarts
*/
void os_restart_game(RestartAction) {}
+
+ /**
+ * Reads the mouse buttons
+ */
+ zword os_read_mouse() {
+ // Not implemented
+ return 0;
+ }
public:
/**
* Constructor
diff --git a/engines/gargoyle/frotz/processor_buffer.cpp b/engines/gargoyle/frotz/processor_buffer.cpp
index be30bfe560..b2b6ccd015 100644
--- a/engines/gargoyle/frotz/processor_buffer.cpp
+++ b/engines/gargoyle/frotz/processor_buffer.cpp
@@ -27,11 +27,6 @@
namespace Gargoyle {
namespace Frotz {
-// TODO: Replace these method stubs with correct calls
-void stream_char(zchar) {}
-void stream_word(const zchar *) {}
-void stream_new_line(void) {}
-
void Processor::flush_buffer() {
/* Make sure we stop when flush_buffer is called from flush_buffer.
* Note that this is difficult to avoid as we might print a newline
diff --git a/engines/gargoyle/frotz/processor_input.cpp b/engines/gargoyle/frotz/processor_input.cpp
index 89aa1889fd..fa9da21795 100644
--- a/engines/gargoyle/frotz/processor_input.cpp
+++ b/engines/gargoyle/frotz/processor_input.cpp
@@ -25,10 +25,6 @@
namespace Gargoyle {
namespace Frotz {
-// TODO: Implement method stubs
-static zword os_read_mouse() { return 0; }
-
-
#define INPUT_BUFFER_SIZE 200
bool Processor::read_yes_or_no(const char *s) {
diff --git a/engines/gargoyle/frotz/processor_screen.cpp b/engines/gargoyle/frotz/processor_screen.cpp
index 27d3cda088..77e2e94295 100644
--- a/engines/gargoyle/frotz/processor_screen.cpp
+++ b/engines/gargoyle/frotz/processor_screen.cpp
@@ -25,28 +25,106 @@
namespace Gargoyle {
namespace Frotz {
-void Processor::screen_char(zchar c) {
- // TODO
+void Processor::screen_mssg_on() {
+ if (gos_curwin == gos_lower) {
+ oldstyle = curstyle;
+ glk_set_style(style_Preformatted);
+ glk_put_string("\n ");
+ }
}
-void Processor::screen_new_line() {
- // TODO
+void Processor::screen_mssg_off() {
+ if (gos_curwin == gos_lower) {
+ glk_put_char('\n');
+ zargs[0] = 0;
+ z_set_text_style();
+ zargs[0] = oldstyle;
+ z_set_text_style();
+ }
}
-void Processor::screen_word(const zchar *s) {
- // TODO
+void Processor::screen_char(zchar c) {
+ if (gos_linepending && (gos_curwin == gos_linewin)) {
+ gos_cancel_pending_line();
+ if (gos_curwin == gos_upper) {
+ curx = 1;
+ cury ++;
+ }
+ if (c == '\n')
+ return;
+ }
+
+ // check fixed flag in header, game can change it at whim
+ int forcefix = ((h_flags & FIXED_FONT_FLAG) != 0);
+ int curfix = ((curstyle & FIXED_WIDTH_STYLE) != 0);
+ if (forcefix && !curfix) {
+ zargs[0] = 0xf000; // tickle tickle!
+ z_set_text_style();
+ fixforced = true;
+ } else if (!forcefix && fixforced) {
+ zargs[0] = 0xf000; // tickle tickle!
+ z_set_text_style();
+ fixforced = false;
+ }
+
+ if (gos_upper && gos_curwin == gos_upper) {
+ if (c == '\n' || c == ZC_RETURN) {
+ glk_put_char('\n');
+ curx = 1;
+ cury ++;
+ } else {
+ if (cury == 1) {
+ if (curx <= ((sizeof statusline / sizeof(zchar)) - 1)) {
+ statusline[curx - 1] = c;
+ statusline[curx] = 0;
+ }
+ if (curx < h_screen_cols) {
+ glk_put_char_uni(c);
+ } else if (curx == h_screen_cols) {
+ glk_put_char_uni(c);
+ glk_window_move_cursor(gos_curwin, curx-1, cury-1);
+ } else {
+ smartstatusline();
+ }
+
+ curx++;
+ } else {
+ if (curx < h_screen_cols) {
+ glk_put_char_uni(c);
+ } else if (curx == (h_screen_cols)) {
+ glk_put_char_uni(c);
+ glk_window_move_cursor(gos_curwin, curx-1, cury-1);
+ }
+
+ curx++;
+ }
+ }
+ } else if (gos_curwin == gos_lower) {
+ if (c == ZC_RETURN)
+ glk_put_char('\n');
+ else glk_put_char_uni(c);
+ }
}
-void Processor::screen_mssg_on() {
- // TODO
+void Processor::screen_new_line() {
+ screen_char('\n');
}
-void Processor::screen_mssg_off() {
- // TODO
+void Processor::screen_word(const zchar *s) {
+ zchar c;
+ while ((c = *s++) != 0) {
+ if (c == ZC_NEW_FONT)
+ s++;
+ else if (c == ZC_NEW_STYLE)
+ s++;
+ else
+ screen_char(c);
+ }
}
void Processor::z_buffer_mode() {
+ // No implementation
}
void Processor::z_buffer_screen() {