From e4f11c207b3a38176b16cf919a52d522c8dacb02 Mon Sep 17 00:00:00 2001 From: jeffman Date: Mon, 28 Jan 2019 22:48:07 -0500 Subject: [PATCH] Rename window fields --- src/c/goods.c | 8 ++++---- src/c/vwf.c | 6 +++--- src/c/window.h | 19 ++++++++++++------- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/c/goods.c b/src/c/goods.c index f881280..6100e9a 100644 --- a/src/c/goods.c +++ b/src/c/goods.c @@ -41,7 +41,7 @@ int goods_outer_process(WINDOW* window) PAD_STATE state = *pad_state; MOVED moved = DIRECTION_NONE; - if (!window->flags_unknown2) + if (!window->hold) { if (state.right) { @@ -101,7 +101,7 @@ int goods_outer_process(WINDOW* window) { current_items = (*pc_stats)[current_pc].goods; window->unknown7 = 0; - window->cursor_x = window->page; + window->cursor_x = window->cursor_x_base; window->cursor_y = 0; window->unknown6 = 0; window->unknown6a = 0; @@ -134,11 +134,11 @@ int goods_outer_process(WINDOW* window) } } - window->flags_unknown2 = true; + window->hold = true; } else { - window->flags_unknown2 = false; + window->hold = false; } // Check if we're exiting diff --git a/src/c/vwf.c b/src/c/vwf.c index 2c1793e..0db5fc0 100644 --- a/src/c/vwf.c +++ b/src/c/vwf.c @@ -438,7 +438,7 @@ int print_menu_string(WINDOW* window) // If we're calling SET the second time, update the // window cursor delta to be the difference between // the two set values - window->cursor_delta = (set_value - first_set_value) >> 3; + window->cursor_x_delta = (set_value - first_set_value) >> 3; } break; @@ -545,7 +545,7 @@ void print_number_menu(WINDOW* window, int style) x += 8; // Print the zeroes (0x60) - for (int i = 0; i < window->cursor_delta; i++) + for (int i = 0; i < window->cursor_x_delta; i++) { print_character(decode_character(0x60), x, y); x += 8; @@ -562,7 +562,7 @@ void print_number_menu(WINDOW* window, int style) void print_number_menu_current(byte digit, WINDOW* window) { // Skip the 4 blank tiles - int x = (window->window_x + (window->cursor_delta - window->cursor_x) + 4) << 3; + int x = (window->window_x + (window->cursor_x_delta - window->cursor_x) + 4) << 3; // Skip the first two text rows int y = (window->window_y + 4) << 3; diff --git a/src/c/window.h b/src/c/window.h index 2d88a2d..80df8a7 100644 --- a/src/c/window.h +++ b/src/c/window.h @@ -2,11 +2,16 @@ typedef struct WINDOW { // 0x00 - bool enable : 1; // 0x0001 - unsigned int flags_unknown1 : 3; // 0x000E - bool flags_unknown2 : 1; // 0x0010 - bool redraw : 1; // 0x0020 - unsigned int flags_unknown3 : 10; // 0xFFC0 + bool enable : 1; // 0x0001 Indicates that the window is enabled. + unsigned int flags_unknown1 : 3; // 0x000E + bool hold : 1; // 0x0010 Indicates that a button is still being held from a previous frame. + bool redraw : 1; // 0x0020 Indicates that the window border should be redrawn. + unsigned int flags_unknown3a : 5; // 0x07C0 + bool first : 1; // 0x0800 Set immediately after the window is initialized and drawn. + // Typically checked and cleared on the first frame of the window loop. + // Might not be used for all windows. + // Definitely used for the goods *inner* window loop, but not the outer loop. + unsigned int flags_unknown3b : 4; // 0xF000 byte pixel_x; bool vwf_skip : 1; unsigned int vwf_unused : 7; @@ -41,8 +46,8 @@ typedef struct WINDOW { unsigned short unknown7a; // 0x40 - unsigned short page; - unsigned short cursor_delta; + unsigned short cursor_x_base; + unsigned short cursor_x_delta; int unknown9; int unknown10; int unknown11;