From 6541a76a375bcc75459dc69e22048d8765afd546 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 28 Oct 2024 19:19:30 -0400 Subject: [PATCH] Address review comments --- include/mail_misc.h | 2 +- include/options_app.h | 2 +- include/overlay_55.h | 2 +- include/party_menu.h | 2 +- src/alph_puzzle.c | 22 +++++++++++----------- src/application/view_photo.c | 20 ++++++++++---------- src/options_app.c | 12 ++++++------ src/overlay_55.c | 4 ++-- src/party_menu.c | 10 +++++----- src/touch_save_app.c | 12 ++++++------ 10 files changed, 44 insertions(+), 44 deletions(-) diff --git a/include/mail_misc.h b/include/mail_misc.h index d82738acc9..3649c840e3 100644 --- a/include/mail_misc.h +++ b/include/mail_misc.h @@ -67,7 +67,7 @@ void sub_02090D8C(EasyChatArgs *args, MailMessage *msg1, MailMessage *msg2); BOOL sub_02090DC0(EasyChatArgs *args, MailMessage *msg1, MailMessage *msg2); void sub_02090E04(EasyChatArgs *args, MailMessage *msg1, MailMessage *msg2); int sub_02090E44(EasyChatArgs *args); -void sub_02090E5C(EasyChatArgs *args, MenuInputState a1); +void sub_02090E5C(EasyChatArgs *args, MenuInputState menuInputState); UseMailArgs *sub_02090E68(SaveData *saveData, u16 a1, u8 partyIdx, u8 mailType, HeapID heapId); UseMailArgs *sub_02090EC0(SaveData *saveData, int n, u16 i, HeapID heapId); UseMailArgs *sub_02090F00(SaveData *saveData, Pokemon *mon, HeapID heapId); diff --git a/include/options_app.h b/include/options_app.h index c45b92e3b3..5991ad50b6 100644 --- a/include/options_app.h +++ b/include/options_app.h @@ -8,7 +8,7 @@ typedef struct OptionsApp_Args { u32 unk0; Options *options; - MenuInputStateMgr *unk8; + MenuInputStateMgr *menuInputStateMgr; } OptionsApp_Args; BOOL OptionsMenu_Init(OVY_MANAGER *manager, int *state); diff --git a/include/overlay_55.h b/include/overlay_55.h index 7795ca6755..c8be5602db 100644 --- a/include/overlay_55.h +++ b/include/overlay_55.h @@ -11,7 +11,7 @@ typedef struct UnkStruct_ov55_021E5B08 { u16 unk0; u8 mailMessageIdx; Options *options; - MenuInputStateMgr *unk8; + MenuInputStateMgr *menuInputStateMgr; u32 mailOTID; u8 unk10; u8 mailLanguage; diff --git a/include/party_menu.h b/include/party_menu.h index 016c16a55d..caef2f11e5 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -484,7 +484,7 @@ u32 sub_0207CAA8(void); void sub_0207CAAC(HeapID heapId, u16 *a1, u16 *a2, u16 *a3); void PartyMenu_FormChangeScene_End(PartyMenu *partyMenu); void PartyMenu_DeleteContextMenuAndList(PartyMenu *partyMenu); -void sub_0207CB3C(PartyMenu *partyMenu, MenuInputState a1); +void sub_0207CB3C(PartyMenu *partyMenu, MenuInputState menuInputState); void PartyMenu_FormChangeScene_Begin(PartyMenu *partyMenu); #endif // POKEHEARTGOLD_PARTY_MENU_H diff --git a/src/alph_puzzle.c b/src/alph_puzzle.c index 174ce4db70..37cc7b2058 100644 --- a/src/alph_puzzle.c +++ b/src/alph_puzzle.c @@ -92,7 +92,7 @@ typedef struct AlphPuzzleTile { typedef struct AlphPuzzleData { HeapID heapId; - MenuInputState menuIgnoreTouchFlag; + MenuInputState menuInputState; int unkState; u16 subState; u16 sceneTimer; @@ -660,15 +660,15 @@ static void AlphPuzzle_ScreenOff(void) { } static void AlphPuzzle_InitTextOptionsAndPuzzleIndex(AlphPuzzleData *data) { - data->menuIgnoreTouchFlag = MenuInputStateMgr_GetState(data->args->menuInputStatePtr); - Options *options = Save_PlayerData_GetOptionsAddr(data->args->saveData); - data->textFrameDelay = Options_GetTextFrameDelay(options); - data->frame = Options_GetFrame(options); - data->puzzleIndex = data->args->puzzle; + data->menuInputState = MenuInputStateMgr_GetState(data->args->menuInputStatePtr); + Options *options = Save_PlayerData_GetOptionsAddr(data->args->saveData); + data->textFrameDelay = Options_GetTextFrameDelay(options); + data->frame = Options_GetFrame(options); + data->puzzleIndex = data->args->puzzle; } static void AlphPuzzle_Finish(AlphPuzzleData *data) { - MenuInputStateMgr_SetState(data->args->menuInputStatePtr, data->menuIgnoreTouchFlag); + MenuInputStateMgr_SetState(data->args->menuInputStatePtr, data->menuInputState); if (data->puzzleSolved) { Save_VarsFlags_SetAlphPuzzleFlag(Save_VarsFlags_Get(data->args->saveData), data->puzzleIndex); } @@ -782,7 +782,7 @@ static int AlphPuzzle_CheckInput(AlphPuzzleData *data) { return ALPH_PUZZLE_STATE_WAIT_FOR_INPUT; } if (TouchscreenHitbox_FindRectAtTouchNew(sButtonHitboxes) == TS_HITBOX_ALPH_QUIT) { - data->menuIgnoreTouchFlag = MENU_INPUT_STATE_TOUCH; + data->menuInputState = MENU_INPUT_STATE_TOUCH; AlphPuzzle_CreateQuitTask(data); PlaySE(SEQ_SE_DP_SELECT); return ALPH_PUZZLE_STATE_QUIT; @@ -793,7 +793,7 @@ static int AlphPuzzle_CheckInput(AlphPuzzleData *data) { } AlphPuzzle_UpdateSelectedTile(data, tileIndex, TRUE); PlaySE(SEQ_SE_GS_SEKIBAN_SENTAKU); - data->menuIgnoreTouchFlag = MENU_INPUT_STATE_TOUCH; + data->menuInputState = MENU_INPUT_STATE_TOUCH; return ALPH_PUZZLE_STATE_PICKUP_TILE; } @@ -1342,7 +1342,7 @@ static void AlphPuzzle_Quit_CreateYesNoPrompt(AlphPuzzleData *data) { unkStruct.bgId = 0; unkStruct.x = 25; unkStruct.y = 10; - unkStruct.ignoreTouchFlag = data->menuIgnoreTouchFlag; + unkStruct.ignoreTouchFlag = data->menuInputState; unkStruct.initialCursorPos = 1; unkStruct.shapeParam = 0; YesNoPrompt_InitFromTemplateWithPalette(data->yesNoPrompt, &unkStruct, data->palette); @@ -1360,7 +1360,7 @@ static AlphPuzzleStates AlphPuzzle_Quit_HandleYesNoPrompt(AlphPuzzleData *data) default: return ALPH_PUZZLE_STATE_QUIT; } - data->menuIgnoreTouchFlag = YesNoPrompt_IsInTouchMode(data->yesNoPrompt); + data->menuInputState = YesNoPrompt_IsInTouchMode(data->yesNoPrompt); YesNoPrompt_Reset(data->yesNoPrompt); ClearFrameAndWindow2(&data->window[ALPH_WINDOW_CONFIRM_QUIT], 1); FillWindowPixelBuffer(&data->window[ALPH_WINDOW_CONFIRM_QUIT], 0); diff --git a/src/application/view_photo.c b/src/application/view_photo.c index 8b7a66e4be..5d809519ae 100644 --- a/src/application/view_photo.c +++ b/src/application/view_photo.c @@ -26,7 +26,7 @@ typedef enum ViewPhotoTaskState { typedef struct ViewPhotoSysTaskData { HeapID heapId; int state; - MenuInputState lastInputWasTouch; + MenuInputState menuInputState; ViewPhotoInputResponse lastInput; SaveData *saveData; FieldSystem *fieldSystem; @@ -135,12 +135,12 @@ static const u8 _0225A03C[3] = { 9, 1, 4 }; SysTask *FieldSystem_CreateViewPhotoTask(FieldSystem *fieldSystem) { ViewPhotoSysTaskData *viewPhoto = AllocFromHeap(HEAP_ID_FIELD, sizeof(ViewPhotoSysTaskData)); MI_CpuClear8(viewPhoto, sizeof(ViewPhotoSysTaskData)); - viewPhoto->heapId = HEAP_ID_FIELD; - viewPhoto->fieldSystem = fieldSystem; - viewPhoto->bgConfig = fieldSystem->bgConfig; - viewPhoto->saveData = fieldSystem->saveData; - viewPhoto->parent = fieldSystem->viewPhotoTask; - viewPhoto->lastInputWasTouch = MenuInputStateMgr_GetState(&fieldSystem->menuInputState); + viewPhoto->heapId = HEAP_ID_FIELD; + viewPhoto->fieldSystem = fieldSystem; + viewPhoto->bgConfig = fieldSystem->bgConfig; + viewPhoto->saveData = fieldSystem->saveData; + viewPhoto->parent = fieldSystem->viewPhotoTask; + viewPhoto->menuInputState = MenuInputStateMgr_GetState(&fieldSystem->menuInputState); FieldViewPhoto_GetAlbumScrollParam(viewPhoto->parent, &viewPhoto->scrollData); return SysTask_CreateOnMainQueue(SysTask_ViewPhoto, viewPhoto, 1); } @@ -148,7 +148,7 @@ SysTask *FieldSystem_CreateViewPhotoTask(FieldSystem *fieldSystem) { void FieldSystem_DestroyViewPhotoTask(FieldSystem *fieldSystem) { ViewPhotoSysTaskData *viewPhoto = (ViewPhotoSysTaskData *)SysTask_GetData(fieldSystem->unk_D8); - MenuInputStateMgr_SetState(&fieldSystem->menuInputState, viewPhoto->lastInputWasTouch); + MenuInputStateMgr_SetState(&fieldSystem->menuInputState, viewPhoto->menuInputState); ViewPhotoSysTask_Teardown(viewPhoto); FreeToHeap(viewPhoto); SysTask_Destroy(fieldSystem->unk_D8); @@ -198,10 +198,10 @@ static ViewPhotoInputResponse ViewPhotoSysTask_HandleInput(ViewPhotoSysTaskData if (response == VIEW_PHOTO_INPUT_NOTHING) { response = ViewPhotoSysTask_GetKeyInput(viewPhoto); if (response == VIEW_PHOTO_INPUT_NOTHING) { - viewPhoto->lastInputWasTouch = MENU_INPUT_STATE_BUTTONS; + viewPhoto->menuInputState = MENU_INPUT_STATE_BUTTONS; } } else { - viewPhoto->lastInputWasTouch = MENU_INPUT_STATE_TOUCH; + viewPhoto->menuInputState = MENU_INPUT_STATE_TOUCH; } switch (response) { case VIEW_PHOTO_INPUT_END: diff --git a/src/options_app.c b/src/options_app.c index 0f54c25b5a..a05b4ab2eb 100644 --- a/src/options_app.c +++ b/src/options_app.c @@ -86,7 +86,7 @@ typedef struct OptionsApp_Data { SpriteGfxHandler *spriteGfxHandler; Sprite *sprites[9]; u8 filler2FC[36]; - u32 unk320; + u32 menuInputState; String *frameNumText; u8 textPrinter; } OptionsApp_Data; // size: 0x32c @@ -340,11 +340,11 @@ BOOL OptionsMenu_Init(OVY_MANAGER *manager, int *state) { data->options.buttonMode = Options_GetButtonMode(args->options); data->options.frame = Options_GetFrame(args->options); - data->menuInputPtr = args->unk8; + data->menuInputPtr = args->menuInputStateMgr; data->playerOptionsUnused = args->options; data->heapId = HEAP_ID_OPTIONS_APP; data->playerOptions = args->options; - data->unk320 = MenuInputStateMgr_GetState(data->menuInputPtr); + data->menuInputState = MenuInputStateMgr_GetState(data->menuInputPtr); data->frameNumText = String_New(40, data->heapId); TextFlags_SetCanABSpeedUpPrint(FALSE); @@ -913,7 +913,7 @@ static void OptionsApp_HandleInput(OptionsApp_Data *data) { ov54_021E6A64(data); data->unk10_0 = 1; PlaySE(SEQ_SE_DP_SAVE); - data->unk320 = 1; + data->menuInputState = 1; MenuInputStateMgr_SetState(data->menuInputPtr, MENU_INPUT_STATE_TOUCH); data->menuEntries[data->currentMenuEntryId].value = 1; ov54_021E69D4(data, data->currentMenuEntryId); @@ -926,7 +926,7 @@ static void OptionsApp_HandleInput(OptionsApp_Data *data) { ov54_021E6A64(data); data->unk10_0 = 2; PlaySE(SEQ_SE_GS_GEARCANCEL); - data->unk320 = 1; + data->menuInputState = 1; MenuInputStateMgr_SetState(data->menuInputPtr, MENU_INPUT_STATE_TOUCH); data->menuEntries[data->currentMenuEntryId].value = 0; ov54_021E69D4(data, data->currentMenuEntryId); @@ -949,7 +949,7 @@ static void OptionsApp_HandleInput(OptionsApp_Data *data) { ov54_021E69D4(data, data->currentMenuEntryId); OptionsApp_SetActiveButtonsXPosition(data); ov54_021E6A64(data); - data->unk320 = 1; + data->menuInputState = 1; PlaySE(SEQ_SE_DP_SELECT); break; } diff --git a/src/overlay_55.c b/src/overlay_55.c index 441507cc54..cca54aef9e 100644 --- a/src/overlay_55.c +++ b/src/overlay_55.c @@ -67,8 +67,8 @@ BOOL ov55_UnkApp_Init(OVY_MANAGER *manager, int *state) { if (overlayData->unk10->mailType >= NUM_MAIL) { overlayData->unk10->mailType = MAIL_GRASS; } - overlayData->unk10->unk0 = args->unk0; - overlayData->unk10->unk8 = args->menuInputStatePtr; + overlayData->unk10->unk0 = args->unk0; + overlayData->unk10->menuInputStateMgr = args->menuInputStatePtr; return TRUE; } diff --git a/src/party_menu.c b/src/party_menu.c index e595506d13..2613156e21 100644 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -91,7 +91,7 @@ static BOOL PartyMenu_HandleDpadInput(PartyMenu *partyMenu); static u8 PartyMenu_GetSelectionInDirection(PartyMenu *partyMenu, u8 *px, u8 *py, u8 direction); static u8 PartyMenu_GetNewSelectionFromTable(PartyMenu *partyMenu, u8 *px, u8 *py, const u8 *table); static void sub_0207AC20(PartyMenu *partyMenu); -static int sub_0207AC70(PartyMenu *partyMenu, MenuInputState a1); +static int sub_0207AC70(PartyMenu *partyMenu, MenuInputState menuInputState); static int PartyMenu_GetTouchButtonInput(PartyMenu *partyMenu); static u8 PartyMenu_HandleInput(PartyMenu *partyMenu); static void sub_0207AFC4(PartyMenu *partyMenu); @@ -1443,14 +1443,14 @@ static void sub_0207AC20(PartyMenu *partyMenu) { } } -static int sub_0207AC70(PartyMenu *partyMenu, MenuInputState a1) { +static int sub_0207AC70(PartyMenu *partyMenu, MenuInputState menuInputState) { G2_BlendNone(); if (partyMenu->partyMonIndex == PARTY_MON_SELECTION_CANCEL) { return 4; } else if (partyMenu->partyMonIndex == PARTY_MON_SELECTION_CONFIRM) { PlaySE(SEQ_SE_GS_GEARCANCEL); if (!partyMenu->cancelDisabled) { - sub_0207CB3C(partyMenu, a1); + sub_0207CB3C(partyMenu, menuInputState); return 3; } } else if (partyMenu->args->context == PARTY_MENU_CONTEXT_3 || partyMenu->args->context == PARTY_MENU_CONTEXT_INGAME_TRADE) { @@ -2712,9 +2712,9 @@ void PartyMenu_DeleteContextMenuAndList(PartyMenu *partyMenu) { ListMenuItems_Delete(partyMenu->listMenuItems); } -void sub_0207CB3C(PartyMenu *partyMenu, MenuInputState a1) { +void sub_0207CB3C(PartyMenu *partyMenu, MenuInputState menuInputState) { if (partyMenu->args->menuInputStatePtr != NULL) { - MenuInputStateMgr_SetState(partyMenu->args->menuInputStatePtr, a1); + MenuInputStateMgr_SetState(partyMenu->args->menuInputStatePtr, menuInputState); } } diff --git a/src/touch_save_app.c b/src/touch_save_app.c index c72cb67cad..3f840242be 100644 --- a/src/touch_save_app.c +++ b/src/touch_save_app.c @@ -94,7 +94,7 @@ static BOOL TouchSaveApp_PrintSavedMessage(TouchSaveAppData *data); static BOOL TouchSaveApp_SaveSucceeded(TouchSaveAppData *data); static BOOL TouchSaveApp_CloseApp(TouchSaveAppData *data); static BOOL TouchSaveApp_ShouldPrintAlternateSavingMessage(TouchSaveAppData *data); -static void ov30_0225DC00(MenuInputStateMgr *stateMgr, MenuInputState state); +static void TouchSaveApp_SetMenuInputState(MenuInputStateMgr *stateMgr, MenuInputState state); static void ov30_0225DC08(void); static void ov30_0225DC18(void); static void ov30_0225DC28(void); @@ -363,7 +363,7 @@ static BOOL TouchSaveApp_GetSaveConfirmation(TouchSaveAppData *data) { static BOOL TouchSaveApp_HandleSaveConfirmation(TouchSaveAppData *data) { switch (YesNoPrompt_HandleInputForSave(data->yesNoPrompt)) { case YESNORESPONSE_YES: - ov30_0225DC00(&data->fieldSystem->menuInputState, YesNoPrompt_IsInTouchMode(data->yesNoPrompt)); + TouchSaveApp_SetMenuInputState(&data->fieldSystem->menuInputState, YesNoPrompt_IsInTouchMode(data->yesNoPrompt)); YesNoPrompt_Destroy(data->yesNoPrompt); if (Save_FileExists(data->fieldSystem->saveData) == TRUE) { data->state = TOUCHSAVEAPP_STATE_PRINT_OVERWRITE_MESSAGE; @@ -372,7 +372,7 @@ static BOOL TouchSaveApp_HandleSaveConfirmation(TouchSaveAppData *data) { } break; case YESNORESPONSE_NO: - ov30_0225DC00(&data->fieldSystem->menuInputState, YesNoPrompt_IsInTouchMode(data->yesNoPrompt)); + TouchSaveApp_SetMenuInputState(&data->fieldSystem->menuInputState, YesNoPrompt_IsInTouchMode(data->yesNoPrompt)); YesNoPrompt_Destroy(data->yesNoPrompt); return TRUE; default: // clang(-Wswitch) @@ -401,12 +401,12 @@ static BOOL TouchSaveApp_GetOverwriteConfirmation(TouchSaveAppData *data) { static BOOL TouchSaveApp_HandleOverwriteConfirmation(TouchSaveAppData *data) { switch (YesNoPrompt_HandleInputForSave(data->yesNoPrompt)) { case YESNORESPONSE_YES: - ov30_0225DC00(&data->fieldSystem->menuInputState, YesNoPrompt_IsInTouchMode(data->yesNoPrompt)); + TouchSaveApp_SetMenuInputState(&data->fieldSystem->menuInputState, YesNoPrompt_IsInTouchMode(data->yesNoPrompt)); YesNoPrompt_Destroy(data->yesNoPrompt); data->state = TOUCHSAVEAPP_STATE_PRINT_SAVING_MESSAGE; break; case YESNORESPONSE_NO: - ov30_0225DC00(&data->fieldSystem->menuInputState, YesNoPrompt_IsInTouchMode(data->yesNoPrompt)); + TouchSaveApp_SetMenuInputState(&data->fieldSystem->menuInputState, YesNoPrompt_IsInTouchMode(data->yesNoPrompt)); YesNoPrompt_Destroy(data->yesNoPrompt); return TRUE; default: // clang(-Wswitch) @@ -497,7 +497,7 @@ static BOOL TouchSaveApp_ShouldPrintAlternateSavingMessage(TouchSaveAppData *dat return Save_NumModifiedPCBoxesIsMany(data->fieldSystem->saveData); } -static void ov30_0225DC00(MenuInputStateMgr *stateMgr, MenuInputState state) { +static void TouchSaveApp_SetMenuInputState(MenuInputStateMgr *stateMgr, MenuInputState state) { MenuInputStateMgr_SetState(stateMgr, state); }