From e344809eeac75e9dbfd943015c083001a2628440 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 16 Nov 2018 21:53:59 -0800 Subject: GLK: FROTZ: Fix gcc warnings, adding extra method comments --- engines/glk/frotz/glk_interface.h | 23 +++++++++++++++++++++++ engines/glk/frotz/mem.cpp | 4 ++-- engines/glk/frotz/processor.h | 25 +++++++++++++++++++++++-- engines/glk/frotz/processor_buffer.cpp | 2 +- engines/glk/frotz/processor_screen.cpp | 1 - engines/glk/frotz/processor_streams.cpp | 2 +- 6 files changed, 50 insertions(+), 7 deletions(-) (limited to 'engines/glk/frotz') diff --git a/engines/glk/frotz/glk_interface.h b/engines/glk/frotz/glk_interface.h index 0103f88b1b..5e2fa62663 100644 --- a/engines/glk/frotz/glk_interface.h +++ b/engines/glk/frotz/glk_interface.h @@ -94,10 +94,33 @@ public: bool _soundLocked; bool _soundPlaying; protected: + /** + * Return the length of the character in screen units. + */ int os_char_width(zchar z); + + /** + * Calculate the length of a word in screen units. Apart from letters, + * the word may contain special codes: + * + * ZC_NEW_STYLE - next character is a new text style + * ZC_NEW_FONT - next character is a new font + */ int os_string_width(const zchar *s); + + /** + * Return the length of a string + */ int os_string_length(zchar *s); + + /** + * Prepare a sample for playing + */ void os_prepare_sample(int a); + + /** + * Signal that a given sample is finished with + */ void os_finish_with_sample(int a); /** diff --git a/engines/glk/frotz/mem.cpp b/engines/glk/frotz/mem.cpp index 378e49666d..6ee6781690 100644 --- a/engines/glk/frotz/mem.cpp +++ b/engines/glk/frotz/mem.cpp @@ -174,10 +174,10 @@ void Mem::initializeStoryFile() { } void Mem::initializeUndo() { - void *reserved = nullptr; + byte *reserved = nullptr; if (reserve_mem != 0) { - if ((reserved = malloc(reserve_mem)) == NULL) + if ((reserved = new byte[reserve_mem]) == nullptr) return; } diff --git a/engines/glk/frotz/processor.h b/engines/glk/frotz/processor.h index 7c8944f451..5f61a2e658 100644 --- a/engines/glk/frotz/processor.h +++ b/engines/glk/frotz/processor.h @@ -314,11 +314,32 @@ private: * @{ */ + /** + * Start printing a so-called debugging message. The contents of the + * message are passed to the message stream, a Frotz specific output + * stream with maximum priority. + */ + void screen_mssg_on(); + + /** + * Stop printing a "debugging" message + */ + void screen_mssg_off(); + + /** + * Display a single character on the screen. + */ void screen_char(zchar c); + + /** + * Print a newline to the screen. + */ void screen_new_line(); + + /** + * Print a newline to the screen. + */ void screen_word(const zchar *s); - void screen_mssg_on(); - void screen_mssg_off(); /**@}*/ diff --git a/engines/glk/frotz/processor_buffer.cpp b/engines/glk/frotz/processor_buffer.cpp index c4eaeaa42e..b8b37ed60e 100644 --- a/engines/glk/frotz/processor_buffer.cpp +++ b/engines/glk/frotz/processor_buffer.cpp @@ -158,7 +158,7 @@ void Processor::runtimeError(ErrorCode errNum) { if (_err_report_mode == ERR_REPORT_FATAL || (!_ignore_errors && errNum <= ERR_MAX_FATAL)) { flush_buffer(); - error(ERR_MESSAGES[errNum - 1]); + error("%s", ERR_MESSAGES[errNum - 1]); return; } diff --git a/engines/glk/frotz/processor_screen.cpp b/engines/glk/frotz/processor_screen.cpp index 2e07b477cb..c0d8ca1e2a 100644 --- a/engines/glk/frotz/processor_screen.cpp +++ b/engines/glk/frotz/processor_screen.cpp @@ -122,7 +122,6 @@ void Processor::screen_word(const zchar *s) { } } - void Processor::z_buffer_mode() { // No implementation } diff --git a/engines/glk/frotz/processor_streams.cpp b/engines/glk/frotz/processor_streams.cpp index 93b9c0bb91..ebeb3035f7 100644 --- a/engines/glk/frotz/processor_streams.cpp +++ b/engines/glk/frotz/processor_streams.cpp @@ -174,7 +174,7 @@ zchar Processor::stream_read_input(int max, zchar *buf, zword timeout, zword rou // Remove initial input from the transscript file or from the screen if (ostream_script && enable_scripting && !no_scripting) - script_erase_input(buf); + script_erase_input(buf); // Read input line from current input stream continue_input: -- cgit v1.2.3