diff options
Diffstat (limited to 'engines/glk/frotz')
-rw-r--r-- | engines/glk/frotz/processor.h | 21 | ||||
-rw-r--r-- | engines/glk/frotz/processor_windows.cpp | 24 |
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 |