Fix Tracy's goods check-out window

This commit is contained in:
jeffman 2019-02-23 17:22:43 -05:00
parent d78af6a8c0
commit 68af5adbc0
4 changed files with 25 additions and 7 deletions

View File

@ -151,6 +151,11 @@ Subroutines
80BF858: goods character selector state machine 80BF858: goods character selector state machine
r0: window pointer r0: window pointer
returns: 0 if no action, 1 if descending deeper into window, -1 if exited returns: 0 if no action, 1 if descending deeper into window, -1 if exited
80C0420: goods character selector state machine (escargo express check-out from Tracy)
seems to be identical to 80BF858 except that the window is shifted down by one tile,
and the text is shifted down another tile so that it renders properly
r0: window pointer
returns: 0 if no action, 1 if A/L pressed, -1 if B/select pressed
80C0A5C: render numbers on status window 80C0A5C: render numbers on status window
80C1FBC: draw PSI window for character r0 80C1FBC: draw PSI window for character r0
80C239C: print PSI name with Greek letter 80C239C: print PSI name with Greek letter

View File

@ -9,7 +9,9 @@
// Returns 1 if the user steps into the inner window, // Returns 1 if the user steps into the inner window,
// -1 if the user steps back out to the previous window, // -1 if the user steps back out to the previous window,
// and 0 for no action. // and 0 for no action.
int goods_outer_process(WINDOW* window) // y_offset is added to account for the Tracy goods window, which
// the game offsets by one tile downwards
int goods_outer_process(WINDOW* window, int y_offset)
{ {
// Get the weird signed parity value // Get the weird signed parity value
short unknown = window->unknown6; short unknown = window->unknown6;
@ -115,7 +117,7 @@ int goods_outer_process(WINDOW* window)
// Print item names // Print item names
if (!window->vwf_skip) if (!window->vwf_skip)
{ {
goods_print_items(window, current_items); goods_print_items(window, current_items, y_offset);
window->vwf_skip = true; window->vwf_skip = true;
} }
@ -389,7 +391,7 @@ int goods_inner_process(WINDOW *window, unsigned short *items)
m2_clearwindowtiles(window); m2_clearwindowtiles(window);
if (weird_value > 0) if (weird_value > 0)
goods_print_items(window, items); goods_print_items(window, items, 0);
} }
if (state_shadow.up || state_shadow.down || state_shadow.left || state_shadow.right) if (state_shadow.up || state_shadow.down || state_shadow.left || state_shadow.right)
@ -446,10 +448,10 @@ int goods_inner_process(WINDOW *window, unsigned short *items)
// Prints all 14 items to a goods window. // Prints all 14 items to a goods window.
// Erases the slot before printing. Prints blanks for null items. // Erases the slot before printing. Prints blanks for null items.
void goods_print_items(WINDOW *window, unsigned short *items) void goods_print_items(WINDOW *window, unsigned short *items, int y_offset)
{ {
int item_x = (window->window_x << 3) + 8; int item_x = (window->window_x << 3) + 8;
int item_y = window->window_y << 3; int item_y = (window->window_y + y_offset) << 3;
for (int i = 0; i < 14; i++) for (int i = 0; i < 14; i++)
{ {

View File

@ -18,9 +18,9 @@ typedef enum GOODS_ACTION
ACTION_STEPOUT = -1 ACTION_STEPOUT = -1
} GOODS_ACTION; } GOODS_ACTION;
int goods_outer_process(WINDOW* window); int goods_outer_process(WINDOW* window, int y_offset);
int goods_inner_process(WINDOW *window, unsigned short *items); int goods_inner_process(WINDOW *window, unsigned short *items);
void goods_print_items(WINDOW *window, unsigned short *items); void goods_print_items(WINDOW *window, unsigned short *items, int y_offset);
extern bool m2_isequipped(int item_index); extern bool m2_isequipped(int item_index);
extern void m2_soundeffect(int index); extern void m2_soundeffect(int index);

View File

@ -631,6 +631,17 @@ pop {pc}
.org 0x80BF858 .org 0x80BF858
push {lr} push {lr}
mov r1,0
bl goods_outer_process
pop {pc}
//---------------------------------------------------------
// C0420 hacks (Goods outer menu for Tracy)
//---------------------------------------------------------
.org 0x80C0420
push {lr}
mov r1,1
bl goods_outer_process bl goods_outer_process
pop {pc} pop {pc}