diff options
Diffstat (limited to 'src/frontier_pass.c')
-rw-r--r-- | src/frontier_pass.c | 67 |
1 files changed, 21 insertions, 46 deletions
diff --git a/src/frontier_pass.c b/src/frontier_pass.c index 702f6c098..cf170b350 100644 --- a/src/frontier_pass.c +++ b/src/frontier_pass.c @@ -937,14 +937,14 @@ static void Task_HandleFrontierPassInput(u8 taskId) { u8 var = FALSE; // Reused, first informs whether the cursor moves, then used as the new cursor area. - if (gMain.heldKeys & DPAD_UP && sPassGfx->cursorSprite->pos1.y >= 9) + if (JOY_HELD(DPAD_UP) && sPassGfx->cursorSprite->pos1.y >= 9) { sPassGfx->cursorSprite->pos1.y -= 2; if (sPassGfx->cursorSprite->pos1.y <= 7) sPassGfx->cursorSprite->pos1.y = 2; var = TRUE; } - if (gMain.heldKeys & DPAD_DOWN && sPassGfx->cursorSprite->pos1.y <= 135) + if (JOY_HELD(DPAD_DOWN) && sPassGfx->cursorSprite->pos1.y <= 135) { sPassGfx->cursorSprite->pos1.y += 2; if (sPassGfx->cursorSprite->pos1.y >= 137) @@ -952,14 +952,14 @@ static void Task_HandleFrontierPassInput(u8 taskId) var = TRUE; } - if (gMain.heldKeys & DPAD_LEFT && sPassGfx->cursorSprite->pos1.x >= 6) + if (JOY_HELD(DPAD_LEFT) && sPassGfx->cursorSprite->pos1.x >= 6) { sPassGfx->cursorSprite->pos1.x -= 2; if (sPassGfx->cursorSprite->pos1.x <= 4) sPassGfx->cursorSprite->pos1.x = 5; var = TRUE; } - if (gMain.heldKeys & DPAD_RIGHT && sPassGfx->cursorSprite->pos1.x <= 231) + if (JOY_HELD(DPAD_RIGHT) && sPassGfx->cursorSprite->pos1.x <= 231) { sPassGfx->cursorSprite->pos1.x += 2; if (sPassGfx->cursorSprite->pos1.x >= 233) @@ -969,7 +969,7 @@ static void Task_HandleFrontierPassInput(u8 taskId) if (!var) // Cursor did not change. { - if (sPassData->cursorArea != CURSOR_AREA_NOTHING && gMain.newKeys & A_BUTTON) + if (sPassData->cursorArea != CURSOR_AREA_NOTHING && JOY_NEW(A_BUTTON)) { if (sPassData->cursorArea <= CURSOR_AREA_RECORD) // Map, Card, Record { @@ -983,10 +983,13 @@ static void Task_HandleFrontierPassInput(u8 taskId) SetMainCallback2(CB2_HideFrontierPass); DestroyTask(taskId); // BUG. The function should return here. Otherwise, it can play the same sound twice and destroy the same task twice. + #ifdef BUGFIX + return; + #endif } } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_PC_OFF); SetMainCallback2(CB2_HideFrontierPass); @@ -1173,75 +1176,47 @@ static void sub_80C5F58(bool8 arg0, bool8 arg1) static void sub_80C6104(u8 cursorArea, u8 previousCursorArea) { - bool32 var; - switch (previousCursorArea) { case CURSOR_AREA_MAP: CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk24, 16, 3, 12, 7, 17); - var = TRUE; break; case CURSOR_AREA_CARD: CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk24 + 336, 16, 10, 12, 7, 17); - var = TRUE; break; case CURSOR_AREA_RECORD: - if (!sPassData->hasBattleRecord) - { - var = FALSE; - } - else - { + if (sPassData->hasBattleRecord) CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk28, 2, 10, 12, 3, 17); - var = TRUE; - } + else if (cursorArea == CURSOR_AREA_NOTHING || cursorArea > CURSOR_AREA_CANCEL) + return; break; case CURSOR_AREA_CANCEL: CopyToBgTilemapBufferRect_ChangePalette(1, gUnknown_08DE3350, 21, 0, 9, 2, 17); - var = TRUE; break; default: - var = FALSE; - break; - } - - if (!var) - { if (cursorArea == CURSOR_AREA_NOTHING || cursorArea > CURSOR_AREA_CANCEL) return; + break; } - + switch (cursorArea) { case CURSOR_AREA_MAP: CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk24 + 168, 16, 3, 12, 7, 17); - var = TRUE; break; case CURSOR_AREA_CARD: CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk24 + 504, 16, 10, 12, 7, 17); - var = TRUE; break; case CURSOR_AREA_RECORD: - if (!sPassData->hasBattleRecord) + if (sPassData->hasBattleRecord) + CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk28 + 72, 2, 10, 12, 3, 17); + else return; - - CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk28 + 72, 2, 10, 12, 3, 17); - var = TRUE; - break; + break; //needed to match case CURSOR_AREA_CANCEL: CopyToBgTilemapBufferRect_ChangePalette(1, gUnknown_08DE3374, 21, 0, 9, 2, 17); - var = TRUE; break; default: - var = FALSE; - break; - } - - if (!var) - { - #ifndef NONMATCHING - asm("":::"r4"); - #endif if (previousCursorArea == CURSOR_AREA_NOTHING || previousCursorArea > CURSOR_AREA_CANCEL) return; } @@ -1471,19 +1446,19 @@ static void Task_HandleFrontierMap(u8 taskId) break; return; case 1: - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_PC_OFF); data[0] = 4; } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { if (sMapData->cursorPos >= NUM_FRONTIER_FACILITIES - 1) HandleFrontierMapCursorMove(0); else data[0] = 2; } - else if (gMain.newKeys & DPAD_UP) + else if (JOY_NEW(DPAD_UP)) { if (sMapData->cursorPos == 0) HandleFrontierMapCursorMove(1); |