From 28ef2fb774bf596a3e7f81055453304e0d2ce066 Mon Sep 17 00:00:00 2001 From: PokeCodec <67983839+PokeCodec@users.noreply.github.com> Date: Fri, 4 Sep 2020 21:11:55 -0400 Subject: Switch to button macros --- src/frontier_pass.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/frontier_pass.c') diff --git a/src/frontier_pass.c b/src/frontier_pass.c index 702f6c098..1178cdbb4 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 { @@ -986,7 +986,7 @@ static void Task_HandleFrontierPassInput(u8 taskId) } } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_PC_OFF); SetMainCallback2(CB2_HideFrontierPass); @@ -1471,19 +1471,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); -- cgit v1.2.3 From 50a6b73edc134993b4c89227f1d72d421882035d Mon Sep 17 00:00:00 2001 From: PokeCodec <67983839+PokeCodec@users.noreply.github.com> Date: Thu, 10 Sep 2020 09:02:04 -0400 Subject: Fix sub_80C6104 --- src/frontier_pass.c | 44 ++++++++------------------------------------ 1 file changed, 8 insertions(+), 36 deletions(-) (limited to 'src/frontier_pass.c') diff --git a/src/frontier_pass.c b/src/frontier_pass.c index 1178cdbb4..ac81c51e0 100644 --- a/src/frontier_pass.c +++ b/src/frontier_pass.c @@ -1173,75 +1173,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 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; } -- cgit v1.2.3 From 7dc95a0103af08c95c9093b6efa6c77af77a2538 Mon Sep 17 00:00:00 2001 From: aaaaaa123456789 Date: Sun, 13 Sep 2020 04:22:50 -0300 Subject: Undo PokeCodec's PRs This commit undoes most of PokeCodec's PRs after the debate in chat. Some harmless or completely superseded PRs have been left alone, as there is not much benefit in attempting to undo them. Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136, #1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179, #1180, #1181, #1182 and #1183. --- src/frontier_pass.c | 62 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 17 deletions(-) (limited to 'src/frontier_pass.c') diff --git a/src/frontier_pass.c b/src/frontier_pass.c index ac81c51e0..702f6c098 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 (JOY_HELD(DPAD_UP) && sPassGfx->cursorSprite->pos1.y >= 9) + if (gMain.heldKeys & 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 (JOY_HELD(DPAD_DOWN) && sPassGfx->cursorSprite->pos1.y <= 135) + if (gMain.heldKeys & 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 (JOY_HELD(DPAD_LEFT) && sPassGfx->cursorSprite->pos1.x >= 6) + if (gMain.heldKeys & 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 (JOY_HELD(DPAD_RIGHT) && sPassGfx->cursorSprite->pos1.x <= 231) + if (gMain.heldKeys & 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 && JOY_NEW(A_BUTTON)) + if (sPassData->cursorArea != CURSOR_AREA_NOTHING && gMain.newKeys & A_BUTTON) { if (sPassData->cursorArea <= CURSOR_AREA_RECORD) // Map, Card, Record { @@ -986,7 +986,7 @@ static void Task_HandleFrontierPassInput(u8 taskId) } } - if (JOY_NEW(B_BUTTON)) + if (gMain.newKeys & B_BUTTON) { PlaySE(SE_PC_OFF); SetMainCallback2(CB2_HideFrontierPass); @@ -1173,47 +1173,75 @@ 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) + if (!sPassData->hasBattleRecord) + { + var = FALSE; + } + else + { CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk28, 2, 10, 12, 3, 17); - else if (cursorArea == CURSOR_AREA_NOTHING || cursorArea > CURSOR_AREA_CANCEL) - return; + var = TRUE; + } 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) - CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk28 + 72, 2, 10, 12, 3, 17); - else + if (!sPassData->hasBattleRecord) return; - break; // needed + + CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk28 + 72, 2, 10, 12, 3, 17); + var = TRUE; + break; 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; } @@ -1443,19 +1471,19 @@ static void Task_HandleFrontierMap(u8 taskId) break; return; case 1: - if (JOY_NEW(B_BUTTON)) + if (gMain.newKeys & B_BUTTON) { PlaySE(SE_PC_OFF); data[0] = 4; } - else if (JOY_NEW(DPAD_DOWN)) + else if (gMain.newKeys & DPAD_DOWN) { if (sMapData->cursorPos >= NUM_FRONTIER_FACILITIES - 1) HandleFrontierMapCursorMove(0); else data[0] = 2; } - else if (JOY_NEW(DPAD_UP)) + else if (gMain.newKeys & DPAD_UP) { if (sMapData->cursorPos == 0) HandleFrontierMapCursorMove(1); -- cgit v1.2.3 From b2b363159fd3cfdd1c7e462faacd791ee7004ded Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Mon, 26 Oct 2020 00:46:01 -0400 Subject: port sub_80C6104 fakematch fix --- src/frontier_pass.c | 46 +++++++++------------------------------------- 1 file changed, 9 insertions(+), 37 deletions(-) (limited to 'src/frontier_pass.c') diff --git a/src/frontier_pass.c b/src/frontier_pass.c index 702f6c098..dfd5c0f2d 100644 --- a/src/frontier_pass.c +++ b/src/frontier_pass.c @@ -1173,75 +1173,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; } -- cgit v1.2.3 From bacc831aa91d059936bd7c852bf0a0fb44d8f27a Mon Sep 17 00:00:00 2001 From: aaaaaa123456789 Date: Mon, 2 Nov 2020 22:02:39 -0300 Subject: Re-apply joypad macros (minus merge conflicts) --- src/frontier_pass.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/frontier_pass.c') diff --git a/src/frontier_pass.c b/src/frontier_pass.c index dfd5c0f2d..1b8030149 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 { @@ -986,7 +986,7 @@ static void Task_HandleFrontierPassInput(u8 taskId) } } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_PC_OFF); SetMainCallback2(CB2_HideFrontierPass); @@ -1443,19 +1443,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); -- cgit v1.2.3 From 81d95b9325ed2526ce638744408f453a8169abb4 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sat, 12 Dec 2020 23:28:01 -0500 Subject: Use BUGFIX for some inline fixes --- src/frontier_pass.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/frontier_pass.c') diff --git a/src/frontier_pass.c b/src/frontier_pass.c index 1b8030149..cf170b350 100644 --- a/src/frontier_pass.c +++ b/src/frontier_pass.c @@ -983,6 +983,9 @@ 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 } } -- cgit v1.2.3