Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into mergin
Browse files Browse the repository at this point in the history
  • Loading branch information
z64a committed Oct 31, 2024
2 parents c0d40f8 + b1ca4bd commit 765e6cf
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 41 deletions.
6 changes: 3 additions & 3 deletions include/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -5368,14 +5368,14 @@ enum FileMenuMessages {
/* 31 */ FILE_MESSAGE_HAS_BEEN_CREATED, // has been created.[End]
#if VERSION_PAL
// TODO: determine where these new entries should be placed
UNK1,
UNK2,
FILE_MESSAGE_PAL_UNK1,
FILE_MESSAGE_PAL_UNK2,
#endif
/* 32 */ FILE_MESSAGE_ENTER_A_FILE_NAME, // Enter a file name![End]
/* 33 */ FILE_MESSAGE_QUESTION, // ?[End]
/* 34 */ FILE_MESSAGE_PERIOD_34, // .[End]
#if VERSION_PAL
FILE_MESSAGE_BASE_UNK,
FILE_MESSAGE_PAL_UNK3,
#endif
};

Expand Down
2 changes: 1 addition & 1 deletion include/filemenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ extern u8 D_filemenu_8025095C[4];
f32* scaleX, f32* scaleY,\
f32* rotX, f32* rotY, f32* rotZ,\
s32* darkening,\
s32* opacity);\
s32* opacity)

WINDOW_UPDATE_FUNC(filemenu_update_show_name_input);
WINDOW_UPDATE_FUNC(filemenu_update_show_options_left);
Expand Down
4 changes: 2 additions & 2 deletions include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ void pause_handle_input(s32 buttonsPressed, s32 buttonsHeld);
void pause_cleanup(void);

// file menu stuff
void filemenu_init(s32);
void filemenu_init(s32 mode);
void filemenu_cleanup(void);
void filemenu_update(void);
s32 func_80244BC4(void);
s32 filemenu_get_exit_mode(void);
void filemenu_set_selected(MenuPanel* menu, s32 col, s32 row);
void filemenu_set_cursor_alpha(s32 arg0);
void filemenu_set_cursor_goal_pos(s32 windowIndex, s32 posX, s32 posY);
Expand Down
6 changes: 6 additions & 0 deletions src/battle/btl_states_menus.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,19 @@ BSS s32 D_802AD6D4;
void create_battle_popup_menu(PopupMenu* popup);

s32 get_player_anim_for_status(s32 animID);
<<<<<<< HEAD

=======
>>>>>>> upstream/main
void btl_menu_moves_draw_content(void* data, s32 x, s32 y);
void btl_menu_moves_show_title(void* data, s32 x, s32 y);
void btl_menu_moves_show_icon(void* data, s32 x, s32 y);
void btl_menu_moves_show_desc(void* data, s32 x, s32 y);
void btl_menu_moves_show_error(void* data, s32 x, s32 y);
<<<<<<< HEAD

=======
>>>>>>> upstream/main
void btl_menu_strats_draw_content(void* data, s32 x, s32 y);
void btl_menu_strats_show_title(void* data, s32 x, s32 y);
void btl_menu_strats_show_desc(void* data, s32 x, s32 y);
Expand Down
35 changes: 20 additions & 15 deletions src/filemenu/filemenu_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -733,15 +733,15 @@ void filemenu_update_hidden_name_confirm(
}

void filemenu_draw_cursor(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) {
s32 temp_a1;
s32 alpha;

filemenu_update_cursor();
temp_a1 = filemenu_cursor_alpha;
if (temp_a1 > 0) {
if (temp_a1 > 255) {
temp_a1 = 255;
alpha = filemenu_cursor_alpha;
if (alpha > 0) {
if (alpha > 255) {
alpha = 255;
}
hud_element_set_alpha(filemenu_cursorHIDs[0], temp_a1);
hud_element_set_alpha(filemenu_cursorHIDs[0], alpha);
hud_element_set_render_pos(filemenu_cursorHIDs[0], baseX + filemenu_cursor_posX, baseY + filemenu_cursor_posY);
hud_element_draw_without_clipping(filemenu_cursorHIDs[0]);
}
Expand Down Expand Up @@ -875,7 +875,8 @@ void filemenu_draw_contents_copy_arrow(MenuPanel* menu, s32 baseX, s32 baseY, s3
}

// TODO bad match, look into
void filemenu_init(s32 arg0) {
void filemenu_init(s32 mode) {
MenuPanel** panelIt;
MenuPanel* menu;
s32 i;

Expand All @@ -887,7 +888,7 @@ void filemenu_init(s32 arg0) {
}

filemenu_cursorHID = filemenu_cursorHIDs[0];
if (arg0 == 0) {
if (mode == 0) {
filemenu_common_windowBPs[0].style.customStyle->background.imgData = NULL; // ???
}
setup_pause_menu_tab(filemenu_common_windowBPs, ARRAY_COUNT(filemenu_common_windowBPs));
Expand Down Expand Up @@ -952,18 +953,22 @@ void filemenu_cleanup(void) {

set_window_update(WIN_PAUSE_TUTORIAL, WINDOW_UPDATE_HIDE);
set_window_update(WIN_PAUSE_DECRIPTION, WINDOW_UPDATE_HIDE);
func_80244BC4();
filemenu_get_exit_mode(); // part of a conditional that optimized out?
}

s32 func_80244BC4() {
s32 filemenu_get_exit_mode() {
if (filemenu_menus[FILE_MENU_MAIN]->state == FM_MAIN_SELECT_FILE
&& filemenu_currentMenu == FILE_MENU_CONFIRM
&& filemenu_menus[FILE_MENU_CONFIRM]->selected == 0)
{
&& filemenu_menus[FILE_MENU_CONFIRM]->selected == 0
) {
return 2;
} else if (filemenu_menus[FILE_MENU_MAIN]->state == FM_MAIN_SELECT_FILE && filemenu_menus[FILE_MENU_MAIN]->selected < 4) {
}

if (filemenu_menus[FILE_MENU_MAIN]->state == FM_MAIN_SELECT_FILE
&& filemenu_menus[FILE_MENU_MAIN]->selected <= FM_MAIN_OPT_FILE_4
) {
return 1;
} else {
return 0;
}

return 0;
}
4 changes: 4 additions & 0 deletions src/filemenu/filemenu_createfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,8 @@ void filemenu_choose_name_handle_input(MenuPanel* menu) {
}

if (filemenu_pressedButtons & BUTTON_A) {
MenuPanel* confirmMenu;

switch (menu->selected) {
case MSG_CHAR_MENU_SPACE:
sfx_play_sound(SOUND_CREATE_FILE_SET_CHARACTER);
Expand Down Expand Up @@ -540,6 +542,8 @@ void filemenu_choose_name_handle_input(MenuPanel* menu) {
}

if (filemenu_pressedButtons & BUTTON_START) {
MenuPanel* confirmMenu;

for (i = 0; i < ARRAY_COUNT(filemenu_filename); i++) {
if (filemenu_filename[i] != MSG_CHAR_READ_SPACE) {
break;
Expand Down
2 changes: 1 addition & 1 deletion src/filemenu/filemenu_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void filemenu_info_draw_message_contents(
xOffset += D_filemenu_802508FC[gCurrentLanguage];
draw_number(filemenu_menus[FILE_MENU_MAIN]->selected + 1, baseX + xOffset, baseY + 6, 0, 0, 255, 3);
xOffset++;
filemenu_draw_message(filemenu_get_menu_message(0x1F), baseX + xOffset, baseY + 4, 255, 0, 0);
filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_PAL_UNK1), baseX + xOffset, baseY + 4, 255, 0, 0);
break;
}
#else
Expand Down
12 changes: 6 additions & 6 deletions src/filemenu/filemenu_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,9 @@ void filemenu_draw_contents_option_center(
s32 yOffset;

switch (menu->state) {
case 1:
case 2:
case 3:
case 4:
case FM_MAIN_SELECT_DELETE:
case FM_MAIN_SELECT_COPY_FROM:
case FM_MAIN_SELECT_COPY_TO:
msgIdx = FILE_MESSAGE_CANCEL;
xOffset = CENTER_CANCEL_X;
yOffset = 0;
Expand Down Expand Up @@ -623,12 +622,12 @@ void filemenu_draw_contents_file_title(
filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_OK), baseX + FILE_X, baseY + 1, 255, 0, 1);

if (!gSaveSlotHasData[fileIdx]) {
filemenu_draw_message(filemenu_get_menu_message(fileIdx + FILE_MESSAGE_BASE_UNK),
filemenu_draw_message(filemenu_get_menu_message(fileIdx + FILE_MESSAGE_PAL_UNK3),
baseX + D_filemenu_802508D0[gCurrentLanguage], baseY + 1, 255, 0, 1);
} else {
s32 tmp = D_filemenu_802508D0[gCurrentLanguage];

filemenu_draw_message(filemenu_get_menu_message(fileIdx + FILE_MESSAGE_BASE_UNK),
filemenu_draw_message(filemenu_get_menu_message(fileIdx + FILE_MESSAGE_PAL_UNK3),
baseX + tmp, baseY + 1, 255, 0, 1);

tmp += D_filemenu_802508D4[gCurrentLanguage];
Expand Down Expand Up @@ -753,6 +752,7 @@ void filemenu_main_init(MenuPanel* menu) {
setup_pause_menu_tab(filemenu_main_windowBPs, ARRAY_COUNT(filemenu_main_windowBPs));
menu->selected = MENU_PANEL_SELECTED_GRID_DATA(menu);

#if VERSION_PAL
gWindows[WIN_FILES_TITLE].pos.y = 1;
gWindows[WIN_FILES_TITLE].width = 162;
gWindows[WIN_FILES_TITLE].height = 25;
Expand Down
14 changes: 7 additions & 7 deletions src/filemenu/filemenu_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,21 +589,21 @@ s32 filemenu_draw_char(s32 c, s32 x, s32 y, s32 flag1, s32 color, s32 flag2) {
}
#endif

if (c == 0xF7) {
if (c == MSG_CHAR_READ_SPACE) {
return charWidth - 6;
}

switch (c) {
case 0xF3:
case MSG_CHAR_READ_VARIANT0:
filemenu_charset_raster_id = 0;
break;
case 0xF4:
case MSG_CHAR_READ_VARIANT1:
filemenu_charset_raster_id = 1;
break;
case 0xF5:
case MSG_CHAR_READ_VARIANT2:
filemenu_charset_raster_id = 2;
break;
case 0xF6:
case MSG_CHAR_READ_VARIANT3:
filemenu_charset_raster_id = 3;
break;
}
Expand Down Expand Up @@ -637,7 +637,7 @@ void filemenu_draw_message(u8* message, s32 x, s32 y, s32 alpha, s32 color, u32
u8* tmp;
filemenu_draw_char(0xF3, x, y, flag1, color, flag2);
tmp = message;
while (*tmp != 0xFD) {
while (*tmp != MSG_CHAR_READ_END) {
#if VERSION_IQUE
int ord = *tmp;
if (ord >= MSG_CHAR_MULTIBYTE_FIRST && ord <= MSG_CHAR_MULTIBYTE_LAST) {
Expand Down Expand Up @@ -671,7 +671,7 @@ void filemenu_draw_file_name(u8* filename, s32 length, s32 x, s32 y, s32 alpha,
for (i = 0; i < length; i++) {
u32 c = filename[i];

if (c != 0xF7) {
if (c != MSG_CHAR_READ_SPACE) {
#if VERSION_IQUE
// Numerals get drawn one pixel lower than other characters
if (c >= MSG_CHAR_DIGIT_0 && c <= MSG_CHAR_DIGIT_9) {
Expand Down
3 changes: 3 additions & 0 deletions src/filemenu/filemenu_yesno.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@

u8 filemenu_yesno_gridData[] = {
0, 1,
#if !VERSION_PAL
0, 1,
#endif
0, 1,
0, 1,
0, 1,
Expand Down
8 changes: 4 additions & 4 deletions src/state_file_select.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void state_init_exit_file_select(void) {
D_800A0932 = 0;
D_800A0930 = 0;

if (func_80244BC4() == 0) {
if (filemenu_get_exit_mode() == 0) {
set_map_transition_effect(TRANSITION_SLOW_FADE_TO_WHITE);
} else {
set_map_transition_effect(TRANSITION_ENTER_WORLD);
Expand All @@ -136,7 +136,7 @@ void state_init_exit_file_select(void) {
}

void state_step_exit_file_select(void) {
s32 temp_s0 = func_80244BC4();
s32 exitMode = filemenu_get_exit_mode();
s32 flagSum;
s32 i;

Expand All @@ -157,7 +157,7 @@ void state_step_exit_file_select(void) {
}
break;
case 1:
if (temp_s0 == 0 || update_exit_map_screen_overlay(&D_800A0932) != 0) {
if (exitMode == 0 || update_exit_map_screen_overlay(D_800A0932) != 0) {
D_800A0931 = 2;
}
break;
Expand All @@ -167,7 +167,7 @@ void state_step_exit_file_select(void) {
D_800A0931 = 3;
case 3:
set_time_freeze_mode(TIME_FREEZE_NONE);
if (temp_s0 == 0) {
if (exitMode == 0) {
set_game_mode(GAME_MODE_TITLE_SCREEN);
gOverrideFlags &= ~GLOBAL_OVERRIDES_WINDOWS_OVER_CURTAINS;
} else {
Expand Down
2 changes: 1 addition & 1 deletion ver/jp/undefined_syms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pause_handle_input = 0x80243BF4;
pause_cleanup = 0x80243EC4;
filemenu_init = 0x802440B0;
filemenu_cleanup = 0x802442D0;
func_80244BC4 = 0x80244394;
filemenu_get_exit_mode = 0x80244394;
heap_collisionHead = 0x80268000;
shim_create_audio_system_obfuscated = 0x802B2000;
shim_load_engine_data_obfuscated = 0x802B203C;
Expand Down
2 changes: 1 addition & 1 deletion ver/us/symbol_addrs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6342,7 +6342,7 @@ filemenu_draw_cursor = 0x80244030; // type:func rom:0x164890
filemenu_draw_contents_copy_arrow = 0x802440BC; // type:func rom:0x16491C
filemenu_init = 0x802448E0; // type:func rom:0x165140
filemenu_cleanup = 0x80244B00; // type:func rom:0x165360
func_80244BC4 = 0x80244BC4; // type:func rom:0x165424
filemenu_get_exit_mode = 0x80244BC4; // type:func rom:0x165424
filemenu_draw_contents_title = 0x80244C30; // type:func rom:0x165490
filemenu_draw_contents_stereo = 0x80244CEC; // type:func rom:0x16554C
filemenu_draw_contents_mono = 0x80244D60; // type:func rom:0x1655C0
Expand Down

0 comments on commit 765e6cf

Please sign in to comment.