Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
PikalaxALT committed Oct 28, 2024
1 parent b918c4a commit 6541a76
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion include/mail_misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion include/options_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion include/overlay_55.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion include/party_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
22 changes: 11 additions & 11 deletions src/alph_puzzle.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ typedef struct AlphPuzzleTile {

typedef struct AlphPuzzleData {
HeapID heapId;
MenuInputState menuIgnoreTouchFlag;
MenuInputState menuInputState;
int unkState;
u16 subState;
u16 sceneTimer;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
20 changes: 10 additions & 10 deletions src/application/view_photo.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ typedef enum ViewPhotoTaskState {
typedef struct ViewPhotoSysTaskData {
HeapID heapId;
int state;
MenuInputState lastInputWasTouch;
MenuInputState menuInputState;
ViewPhotoInputResponse lastInput;
SaveData *saveData;
FieldSystem *fieldSystem;
Expand Down Expand Up @@ -135,20 +135,20 @@ 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);
}

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);
Expand Down Expand Up @@ -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:
Expand Down
12 changes: 6 additions & 6 deletions src/options_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/overlay_55.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
10 changes: 5 additions & 5 deletions src/party_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/touch_save_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 6541a76

Please sign in to comment.