diff options
Diffstat (limited to 'src/union_room.c')
-rw-r--r-- | src/union_room.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/src/union_room.c b/src/union_room.c index 1bac3678c..479792a7c 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -52,7 +52,6 @@ #include "constants/party_menu.h" #include "constants/rgb.h" #include "constants/songs.h" -#include "constants/species.h" // States for Task_RunUnionRoom enum { @@ -445,7 +444,7 @@ static void Task_TryBecomeLinkLeader(u8 taskId) break; case LL_STATE_AWAIT_PLAYERS: Leader_SetStateIfMemberListChanged(data, LL_STATE_ACCEPT_NEW_MEMBER_PROMPT, LL_STATE_MEMBER_LEFT); - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { if (data->playerCount == 1) data->state = LL_STATE_SHUTDOWN_AND_FAIL; @@ -458,7 +457,7 @@ static void Task_TryBecomeLinkLeader(u8 taskId) && data->playerCount > GROUP_MIN(sPlayerActivityGroupSize) - 1 && GROUP_MAX(sPlayerActivityGroupSize) != 0 && sub_8012240() - && gMain.newKeys & START_BUTTON) + && JOY_NEW(START_BUTTON)) { data->state = LL_STATE_MEMBERS_OK_PROMPT; LinkRfu_StopManagerAndFinalizeSlots(); @@ -479,7 +478,11 @@ static void Task_TryBecomeLinkLeader(u8 taskId) // BUG: sPlayerActivityGroupSize was meant below, not gPlayerCurrActivity // This will be false for all but ACTIVITY_BATTLE_DOUBLE and ACTIVITY_DECLINE // All this changes is which of two texts gets printed + #ifdef BUGFIX + id = (GROUP_MAX(sPlayerActivityGroupSize) == 2) ? 0 : 1; + #else id = (GROUP_MAX(gPlayerCurrActivity) == 2) ? 1 : 0; + #endif if (PrintOnTextbox(&data->textState, sPlayerUnavailableTexts[id])) { data->playerCount = sub_8013398(data->field_0); @@ -1005,7 +1008,7 @@ static void Task_TryJoinLinkGroup(u8 taskId) break; case 0: id = ListMenu_ProcessInput(data->listTaskId); - if (gMain.newKeys & A_BUTTON && id != -1) + if (JOY_NEW(A_BUTTON) && id != -1) { // this unused variable along with the assignment is needed to match u32 activity = data->field_0->arr[id].gname_uname.gname.activity; @@ -1032,7 +1035,7 @@ static void Task_TryJoinLinkGroup(u8 taskId) PlaySE(SE_WALL_HIT); } } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { data->state = LG_STATE_CANCEL_CHOOSE_LEADER; } @@ -1135,7 +1138,7 @@ static void Task_TryJoinLinkGroup(u8 taskId) break; } - if (RfuGetStatus() == RFU_STATUS_OK && gMain.newKeys & B_BUTTON) + if (RfuGetStatus() == RFU_STATUS_OK && JOY_NEW(B_BUTTON)) data->state = LG_STATE_ASK_LEAVE_GROUP; break; case LG_STATE_ASK_LEAVE_GROUP: @@ -1321,7 +1324,11 @@ static bool32 IsPartnerActivityAcceptable(u32 activity, u32 linkGroup) if (linkGroup == 0xFF) return TRUE; - if (linkGroup <= ARRAY_COUNT(sAcceptedActivityIds)) // UB: <= may access data outside the array + #ifdef UBFIX + if (linkGroup < ARRAY_COUNT(sAcceptedActivityIds)) + #else + if (linkGroup <= ARRAY_COUNT(sAcceptedActivityIds)) + #endif { const u8 *bytes = sAcceptedActivityIds[linkGroup]; @@ -1889,7 +1896,7 @@ static void Task_MEvent_Leader(u8 taskId) break; case 4: Leader_SetStateIfMemberListChanged(data, 5, 6); - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { data->state = 13; DestroyWirelessStatusIndicatorSprite(); @@ -2104,7 +2111,7 @@ static void Task_CardOrNewsWithFriend(u8 taskId) break; case 0: id = ListMenu_ProcessInput(data->listTaskId); - if (gMain.newKeys & A_BUTTON && id != -1) + if (JOY_NEW(A_BUTTON) && id != -1) { // this unused variable along with the assignment is needed to match u32 unusedVar; @@ -2126,7 +2133,7 @@ static void Task_CardOrNewsWithFriend(u8 taskId) PlaySE(SE_WALL_HIT); } } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { data->state = 6; } @@ -2289,7 +2296,7 @@ static void Task_CardOrNewsOverWireless(u8 taskId) } } } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { data->state = 6; data->refreshTimer = 0; @@ -2547,7 +2554,7 @@ static void Task_RunUnionRoom(u8 taskId) } else if (ScriptContext2_IsEnabled() != TRUE) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { if (TryInteractWithUnionRoomMember(uroom->field_0, &taskData[0], &taskData[1], uroom->spriteIds)) { @@ -2881,7 +2888,7 @@ static void Task_RunUnionRoom(u8 taskId) break; case UR_STATE_HANDLE_CONTACT_DATA: ReceiveUnionRoomActivityPacket(uroom); - if (UnionRoom_HandleContactFromOtherPlayer(uroom) && gMain.newKeys & B_BUTTON) + if (UnionRoom_HandleContactFromOtherPlayer(uroom) && JOY_NEW(B_BUTTON)) { sub_8011DE0(1); StringCopy(gStringVar4, sText_ChatEnded); @@ -4077,14 +4084,14 @@ static void TradeBoardPrintItemInfo(u8 windowId, u8 y, struct GFtgtGname * gname UR_AddTextPrinterParameterized(windowId, 1, uname, 8, y, colorIdx); if (species == SPECIES_EGG) { - UR_AddTextPrinterParameterized(windowId, 1, sText_EggTrade, 0x44, y, colorIdx); + UR_AddTextPrinterParameterized(windowId, 1, sText_EggTrade, 68, y, colorIdx); } else { - blit_move_info_icon(windowId, type + 1, 0x44, y); - UR_AddTextPrinterParameterized(windowId, 1, gSpeciesNames[species], 0x76, y, colorIdx); + BlitMenuInfoIcon(windowId, type + 1, 68, y); + UR_AddTextPrinterParameterized(windowId, 1, gSpeciesNames[species], 118, y, colorIdx); ConvertIntToDecimalStringN(levelStr, level, STR_CONV_MODE_RIGHT_ALIGN, 3); - UR_AddTextPrinterParameterized(windowId, 1, levelStr, 0xC6, y, colorIdx); + UR_AddTextPrinterParameterized(windowId, 1, levelStr, 198, y, colorIdx); } } |