From 94509bbf916dcc67704789a1ce5e833dc34d5250 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 18 Dec 2018 21:55:07 -0800 Subject: GLK: FROTZ: Janitorial fixes --- engines/glk/frotz/frotz.cpp | 4 ++-- engines/glk/frotz/processor_input.cpp | 18 +++++++++--------- engines/glk/frotz/processor_objects.cpp | 4 ++-- engines/glk/frotz/processor_screen.cpp | 4 ++-- engines/glk/frotz/processor_streams.cpp | 6 +++--- engines/glk/frotz/processor_table.cpp | 4 ++-- engines/glk/frotz/processor_text.cpp | 27 +++++++++++++-------------- engines/glk/frotz/processor_windows.cpp | 2 +- 8 files changed, 34 insertions(+), 35 deletions(-) (limited to 'engines/glk') diff --git a/engines/glk/frotz/frotz.cpp b/engines/glk/frotz/frotz.cpp index 69ca0a3530..aaae44e670 100644 --- a/engines/glk/frotz/frotz.cpp +++ b/engines/glk/frotz/frotz.cpp @@ -102,7 +102,7 @@ Common::Error Frotz::loadGameData(strid_t file) { LOW_BYTE(H_SCREEN_COLS, old_screen_cols); // Reload cached header fields - restart_header (); + restart_header(); /* Since QUETZAL files may be saved on many different machines, * the screen sizes may vary a lot. Erasing the status window @@ -110,7 +110,7 @@ Common::Error Frotz::loadGameData(strid_t file) { */ if (h_version > V3 && h_version != V6 && (h_screen_rows != old_screen_rows || h_screen_cols != old_screen_cols)) - erase_window (1); + erase_window(1); } else { error("Error reading save file"); } diff --git a/engines/glk/frotz/processor_input.cpp b/engines/glk/frotz/processor_input.cpp index 7c1453d663..91c86c8b03 100644 --- a/engines/glk/frotz/processor_input.cpp +++ b/engines/glk/frotz/processor_input.cpp @@ -166,14 +166,14 @@ void Processor::z_read() { buffer[i] = unicode_tolower (buffer[i]); } - storeb((zword) (zargs[0] + ((h_version <= V4) ? 1 : 2) + i), translate_to_zscii (buffer[i])); + storeb((zword)(zargs[0] + ((h_version <= V4) ? 1 : 2) + i), translate_to_zscii(buffer[i])); } // Add null character (V1-V4) or write input length into 2nd byte if (h_version <= V4) - storeb((zword) (zargs[0] + 1 + i), 0); + storeb((zword)(zargs[0] + 1 + i), 0); else - storeb((zword) (zargs[0] + 1), i); + storeb((zword)(zargs[0] + 1), i); // Tokenise line if a token buffer is present if (key == ZC_RETURN && zargs[1] != 0) @@ -202,10 +202,10 @@ void Processor::z_read_char() { return; // Store key - store (translate_to_zscii (key)); + store(translate_to_zscii(key)); } -void Processor::z_read_mouse(){ +void Processor::z_read_mouse() { zword btn; // Read the mouse position, the last menu click and which buttons are down @@ -213,10 +213,10 @@ void Processor::z_read_mouse(){ hx_mouse_y = mouse_y; hx_mouse_x = mouse_x; - storew((zword) (zargs[0] + 0), hx_mouse_y); - storew((zword) (zargs[0] + 2), hx_mouse_x); - storew((zword) (zargs[0] + 4), btn); // mouse button bits - storew((zword) (zargs[0] + 6), menu_selected); // menu selection + storew((zword)(zargs[0] + 0), hx_mouse_y); + storew((zword)(zargs[0] + 2), hx_mouse_x); + storew((zword)(zargs[0] + 4), btn); // mouse button bits + storew((zword)(zargs[0] + 6), menu_selected); // menu selection } } // End of namespace Scott diff --git a/engines/glk/frotz/processor_objects.cpp b/engines/glk/frotz/processor_objects.cpp index d60dd8b65e..ab136f3c40 100644 --- a/engines/glk/frotz/processor_objects.cpp +++ b/engines/glk/frotz/processor_objects.cpp @@ -348,7 +348,7 @@ void Processor::z_get_next_prop() { // Return the property id LOW_BYTE(prop_addr, value); - store((zword) (value & mask)); + store((zword)(value & mask)); } void Processor::z_get_parent() { @@ -477,7 +477,7 @@ void Processor::z_get_prop_addr() { if (h_version >= V4 && (value & 0x80)) prop_addr++; - store((zword) (prop_addr + 1)); + store((zword)(prop_addr + 1)); } else { store(0); diff --git a/engines/glk/frotz/processor_screen.cpp b/engines/glk/frotz/processor_screen.cpp index a8ddb81e17..33c91081ca 100644 --- a/engines/glk/frotz/processor_screen.cpp +++ b/engines/glk/frotz/processor_screen.cpp @@ -242,8 +242,8 @@ void Processor::z_erase_window() { } void Processor::z_get_cursor() { - storew((zword) (zargs[0] + 0), cury); - storew((zword) (zargs[0] + 2), curx); + storew((zword)(zargs[0] + 0), cury); + storew((zword)(zargs[0] + 2), curx); } void Processor::z_print_table() { diff --git a/engines/glk/frotz/processor_streams.cpp b/engines/glk/frotz/processor_streams.cpp index 84872f11e4..187220bff6 100644 --- a/engines/glk/frotz/processor_streams.cpp +++ b/engines/glk/frotz/processor_streams.cpp @@ -565,9 +565,9 @@ void Processor::z_save() { } if (h_version <= V3) - branch (success); + branch(success); else - store (success); + store(success); } void Processor::z_restore() { @@ -593,7 +593,7 @@ void Processor::z_restore() { if (h_version <= V3) branch(result); else - store (result); + store(result); } void Processor::z_verify() { diff --git a/engines/glk/frotz/processor_table.cpp b/engines/glk/frotz/processor_table.cpp index e53dae5709..b926725871 100644 --- a/engines/glk/frotz/processor_table.cpp +++ b/engines/glk/frotz/processor_table.cpp @@ -47,7 +47,7 @@ void Processor::z_copy_table() { for (i = size - 1; i >= 0; i--) { addr = zargs[0] + i; LOW_BYTE(addr, value); - storeb((zword) (zargs[1] + i), value); + storeb((zword)(zargs[1] + i), value); } } } @@ -109,7 +109,7 @@ finished: } void Processor::z_storeb() { - storeb((zword) (zargs[0] + zargs[1]), zargs[2]); + storeb((zword)(zargs[0] + zargs[1]), zargs[2]); } void Processor::z_storew() { diff --git a/engines/glk/frotz/processor_text.cpp b/engines/glk/frotz/processor_text.cpp index 9b44d70abb..32625f6708 100644 --- a/engines/glk/frotz/processor_text.cpp +++ b/engines/glk/frotz/processor_text.cpp @@ -93,7 +93,7 @@ zbyte Processor::unicode_to_zscii(zchar c) { LOW_WORD(addr, unicode); if (c == unicode) - return (zbyte) i; + return (zbyte)i; } return 0; @@ -101,7 +101,7 @@ zbyte Processor::unicode_to_zscii(zchar c) { // game uses standard set for (i = 0x9b; i <= 0xdf; i++) if (c == ZSCII_TO_LATIN1[i - 0x9b]) - return (zbyte) i; + return (zbyte)i; return 0; } @@ -120,7 +120,7 @@ zbyte Processor::translate_to_zscii(zchar c) { if (c == 0) return 0; - c = unicode_to_zscii (c); + c = unicode_to_zscii(c); if (c == 0) c = '?'; @@ -188,8 +188,8 @@ void Processor::find_resolution() { runtimeError(ERR_DICT_LEN); } - _decoded = (zchar *)malloc (sizeof (zchar) * (3 * _resolution) + 1); - _encoded = (zchar *)malloc (sizeof (zchar) * _resolution); + _decoded = (zchar *)malloc(sizeof(zchar) * (3 * _resolution) + 1); + _encoded = (zchar *)malloc(sizeof(zchar) * _resolution); } void Processor::load_string (zword addr, zword length) { @@ -256,7 +256,7 @@ void Processor::encode_text(int padding) { goto letter_found; // Character not found, store its ZSCII value - c2 = translate_to_zscii (c); + c2 = translate_to_zscii(c); zchars[i++] = 5; zchars[i++] = 6; @@ -577,7 +577,6 @@ void Processor::tokenise_text(zword text, zword length, zword from, zword parse, addr = lookup_text(0x05, dct); if (addr != 0 || !flag) { - parse += 4 * token_count; storew((zword)(parse + 0), addr); @@ -785,26 +784,26 @@ void Processor::z_check_unicode() { result = 1; } - store (result); + store(result); } void Processor::z_encode_text() { int i; - load_string((zword) (zargs[0] + zargs[2]), zargs[1]); + load_string((zword)(zargs[0] + zargs[2]), zargs[1]); encode_text(0x05); for (i = 0; i < _resolution; i++) - storew((zword) (zargs[3] + 2 * i), _encoded[i]); + storew((zword)(zargs[3] + 2 * i), _encoded[i]); } void Processor::z_new_line() { - new_line (); + new_line(); } -void Processor::z_print () { +void Processor::z_print() { decode_text(EMBEDDED_STRING, 0); } @@ -829,7 +828,7 @@ void Processor::z_print_form() { break; if (!first) - new_line (); + new_line(); while (count--) { zbyte c; @@ -837,7 +836,7 @@ void Processor::z_print_form() { LOW_BYTE(addr, c); addr++; - print_char(translate_from_zscii (c)); + print_char(translate_from_zscii(c)); } first = false; diff --git a/engines/glk/frotz/processor_windows.cpp b/engines/glk/frotz/processor_windows.cpp index 53d2ae1dac..c0a1e3feee 100644 --- a/engines/glk/frotz/processor_windows.cpp +++ b/engines/glk/frotz/processor_windows.cpp @@ -46,7 +46,7 @@ void Processor::z_draw_picture() { zword x = zargs[2]; int i; - flush_buffer (); + flush_buffer(); if (!x || !y) { // Currently I only support getting the cursor for the text grid area -- cgit v1.2.3