aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2018-12-06 19:35:58 -0800
committerPaul Gilbert2018-12-08 19:05:59 -0800
commit88b47cdd8bd20e54fcfdf5e98c24c8e7d0c97415 (patch)
tree6019d2a3bbd76a65c5799624f970188e514cde2a /engines
parentab8ff73453005f55acdf13ebbc39cb3acb7aa74a (diff)
downloadscummvm-rg350-88b47cdd8bd20e54fcfdf5e98c24c8e7d0c97415.tar.gz
scummvm-rg350-88b47cdd8bd20e54fcfdf5e98c24c8e7d0c97415.tar.bz2
scummvm-rg350-88b47cdd8bd20e54fcfdf5e98c24c8e7d0c97415.zip
GLK: FROTZ: Added winarg methods
Diffstat (limited to 'engines')
-rw-r--r--engines/glk/frotz/processor.h21
-rw-r--r--engines/glk/frotz/processor_windows.cpp24
2 files changed, 42 insertions, 3 deletions
diff --git a/engines/glk/frotz/processor.h b/engines/glk/frotz/processor.h
index dcf39869c1..5d6d4487f9 100644
--- a/engines/glk/frotz/processor.h
+++ b/engines/glk/frotz/processor.h
@@ -549,7 +549,6 @@ protected:
/**
* Map a Unicode character onto the ZSCII alphabet.
- *
*/
zbyte translate_to_zscii(zchar c);
@@ -668,6 +667,26 @@ protected:
zchar unicode_tolower(zchar c);
/**@}*/
+
+ /**
+ * \defgroup Window/V6 Opcode methods
+ * @{
+ */
+
+ /**
+ * Return the window number in zargs[0]. In V6 only, -3 refers to the
+ * current window.
+ */
+ zword winarg0();
+
+ /**
+ * Return the (optional) window number in zargs[2]. -3 refers to the
+ * current window. This optional window number was only used by some
+ * V6 opcodes: set_cursor, set_margins, set_colour.
+ */
+ zword winarg2();
+
+ /**@}*/
protected:
/**
* \defgroup General Opcode methods
diff --git a/engines/glk/frotz/processor_windows.cpp b/engines/glk/frotz/processor_windows.cpp
index 34c3be1fdb..5e24ac818a 100644
--- a/engines/glk/frotz/processor_windows.cpp
+++ b/engines/glk/frotz/processor_windows.cpp
@@ -255,7 +255,7 @@ void Processor::z_get_wind_prop() {
}
else
- runtime_error(ERR_ILL_WIN_PROP);
+ runtimeError(ERR_ILL_WIN_PROP);
#endif
}
@@ -264,7 +264,7 @@ void Processor::z_put_wind_prop() {
flush_buffer();
if (zargs[1] >= 16)
- runtime_error(ERR_ILL_WIN_PROP);
+ runtimeError(ERR_ILL_WIN_PROP);
((zword *)(wp + winarg0()))[zargs[1]] = zargs[2];
#endif
@@ -309,5 +309,25 @@ void Processor::z_picture_table() {
*/
}
+zword Processor::winarg0() {
+ if (h_version == V6 && (short)zargs[0] == -3)
+ return cwin;
+
+ if (zargs[0] >= ((h_version == V6) ? 8 : 2))
+ runtimeError(ERR_ILL_WIN);
+
+ return zargs[0];
+}
+
+zword Processor::winarg2() {
+ if (zargc < 3 || (short)zargs[2] == -3)
+ return cwin;
+
+ if (zargs[2] >= 8)
+ runtimeError(ERR_ILL_WIN);
+
+ return zargs[2];
+}
+
} // End of namespace Scott
} // End of namespace Glk