diff options
Diffstat (limited to 'engine/link')
-rw-r--r-- | engine/link/cable_club.asm | 51 | ||||
-rw-r--r-- | engine/link/cable_club_npc.asm | 59 | ||||
-rw-r--r-- | engine/link/print_waiting_text.asm | 3 |
3 files changed, 88 insertions, 25 deletions
diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index f3bf3b5d..f9728f47 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -10,8 +10,7 @@ CableClub_DoBattleOrTrade: call LoadHpBarAndStatusTilePatterns call LoadTrainerInfoTextBoxTiles hlcoord 3, 8 - ld b, 2 - ld c, 12 + lb bc, 2, 12 call CableClub_TextBoxBorder hlcoord 4, 10 ld de, PleaseWaitString @@ -119,6 +118,7 @@ CableClub_DoBattleOrTradeAgain: ldh [rSC], a .skipSendingTwoZeroBytes call Delay3 + call StopAllMusic ld a, (1 << SERIAL) ldh [rIE], a ld hl, wSerialRandomNumberListBlock @@ -139,8 +139,6 @@ CableClub_DoBattleOrTradeAgain: call Serial_ExchangeBytes ld a, (1 << SERIAL) | (1 << TIMER) | (1 << VBLANK) ldh [rIE], a - ld a, SFX_STOP_ALL_MUSIC - call PlaySound ldh a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK jr z, .skipCopyingRandomNumberList ; the list generated by the gameboy clocking the connection is used by both gameboys @@ -261,8 +259,7 @@ CableClub_DoBattleOrTradeAgain: ld [wUnusedCF8D + 1], a xor a ld [wTradeCenterPointerTableIndex], a - ld a, SFX_STOP_ALL_MUSIC - call PlaySound + call StopAllMusic ldh a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK ld c, 66 @@ -278,9 +275,17 @@ CableClub_DoBattleOrTradeAgain: ld [wCurOpponent], a call ClearScreen call Delay3 + ld b, $9 + call RunPaletteCommand ld hl, wOptions res 7, [hl] + ld a, [wLetterPrintingDelayFlags] + push af + xor a + ld [wLetterPrintingDelayFlags], a predef InitOpponent + pop af + ld [wLetterPrintingDelayFlags], a predef HealParty jp ReturnToCableClubRoom .trading @@ -308,6 +313,9 @@ CallCurrentTradeCenterFunction: TradeCenter_SelectMon: call ClearScreen + call Delay3 + ld b, $9 + call RunPaletteCommand call LoadTrainerInfoTextBoxTiles call TradeCenter_DrawPartyLists call TradeCenter_DrawCancelBox @@ -465,8 +473,7 @@ TradeCenter_SelectMon: .displayStatsTradeMenu push af hlcoord 0, 14 - ld b, 2 - ld c, 18 + lb bc, 2, 18 call CableClub_TextBoxBorder hlcoord 2, 16 ld de, .statsTrade @@ -601,8 +608,7 @@ TradeCenter_DrawCancelBox: ld bc, 2 * SCREEN_WIDTH + 9 call FillMemory hlcoord 0, 15 - ld b, 1 - ld c, 9 + lb bc, 1, 9 call CableClub_TextBoxBorder hlcoord 2, 16 ld de, CancelTextString @@ -624,6 +630,9 @@ TradeCenter_DisplayStats: ld [wWhichPokemon], a predef StatusScreen predef StatusScreen2 + call Delay3 + ld b, $9 + call RunPaletteCommand call GBPalNormal call LoadTrainerInfoTextBoxTiles call TradeCenter_DrawPartyLists @@ -631,12 +640,10 @@ TradeCenter_DisplayStats: TradeCenter_DrawPartyLists: hlcoord 0, 0 - ld b, 6 - ld c, 18 + lb bc, 6, 18 call CableClub_TextBoxBorder hlcoord 0, 8 - ld b, 6 - ld c, 18 + lb bc, 6, 18 call CableClub_TextBoxBorder hlcoord 5, 0 ld de, wPlayerName @@ -685,8 +692,7 @@ TradeCenter_Trade: ld [wMenuWatchMovingOutOfBounds], a ld [wMenuJoypadPollCount], a hlcoord 0, 12 - ld b, 4 - ld c, 18 + lb bc, 4, 18 call CableClub_TextBoxBorder ld a, [wTradingWhichPlayerMon] ld hl, wPartySpecies @@ -727,8 +733,7 @@ TradeCenter_Trade: ld a, $1 ld [wSerialExchangeNybbleSendData], a hlcoord 0, 12 - ld b, 4 - ld c, 18 + lb bc, 4, 18 call CableClub_TextBoxBorder hlcoord 1, 14 ld de, TradeCanceled @@ -744,8 +749,7 @@ TradeCenter_Trade: jr nz, .doTrade ; if the other person cancelled hlcoord 0, 12 - ld b, 4 - ld c, 18 + lb bc, 4, 18 call CableClub_TextBoxBorder hlcoord 1, 14 ld de, TradeCanceled @@ -792,6 +796,7 @@ TradeCenter_Trade: add hl, bc ld a, [hl] ld [wTradedPlayerMonSpecies], a + callabd_ModifyPikachuHappiness PIKAHAPPY_TRADE xor a ld [wRemoveMonFromBox], a call RemovePokemon @@ -851,9 +856,11 @@ TradeCenter_Trade: call Serial_PrintWaitingTextAndSyncAndExchangeNybble ld c, 40 call DelayFrames + call Delay3 + ld b, $9 + call RunPaletteCommand hlcoord 0, 12 - ld b, 4 - ld c, 18 + lb bc, 4, 18 call CableClub_TextBoxBorder hlcoord 1, 14 ld de, TradeCompleted diff --git a/engine/link/cable_club_npc.asm b/engine/link/cable_club_npc.asm index 594adf08..4d0a0a8a 100644 --- a/engine/link/cable_club_npc.asm +++ b/engine/link/cable_club_npc.asm @@ -1,9 +1,12 @@ CableClubNPC:: ld hl, CableClubNPCWelcomeText call PrintText + call CheckPikachuFollowingPlayer + jr nz, .asm_7048 CheckEvent EVENT_GOT_POKEDEX jp nz, .receivedPokedex ; if the player hasn't received the pokedex +.asm_7048 ld c, 60 call DelayFrames ld hl, CableClubNPCMakingPreparationsText @@ -107,7 +110,61 @@ CableClubNPC:: xor a ld [hld], a ld [hl], a - jpfar LinkMenu + ld a, [wLetterPrintingDelayFlags] + push af + callfar LinkMenu + pop af + ld [wLetterPrintingDelayFlags], a + ret + +; seems to be similar of Serial_SyncAndExchangeNybble +Serial_SyncAndExchangeNybbleDouble: + ld a, $ff + ld [wSerialExchangeNybbleReceiveData], a +.loop + call Serial_ExchangeNybble + call DelayFrame + push hl + ld hl, wUnknownSerialCounter + 1 + dec [hl] + jr nz, .next + dec hl + dec [hl] + jr nz, .next + pop hl + jr .setUnknownSerialCounterToFFFF +.next + pop hl + ld a, [wSerialExchangeNybbleReceiveData] + inc a + jr z, .loop + call DelayFrame + ld a, $ff + ld [wSerialExchangeNybbleReceiveData], a + call Serial_ExchangeNybble + ld a, [wSerialExchangeNybbleReceiveData] + inc a + jr z, .loop + ld b, 10 +.syncLoop1 + call DelayFrame + call Serial_ExchangeNybble + dec b + jr nz, .syncLoop1 + ld b, 10 +.syncLoop2 + call DelayFrame + call Serial_SendZeroByte + dec b + jr nz, .syncLoop2 + ld a, [wSerialExchangeNybbleReceiveData] + ld [wSerialSyncAndExchangeNybbleReceiveData], a + ret +.setUnknownSerialCounterToFFFF + ld a, $ff + ld [wUnknownSerialCounter], a + ld [wUnknownSerialCounter + 1], a + ret CableClubNPCAreaReservedFor2FriendsLinkedByCableText: text_far _CableClubNPCAreaReservedFor2FriendsLinkedByCableText diff --git a/engine/link/print_waiting_text.asm b/engine/link/print_waiting_text.asm index 1a16e2f2..a07967fd 100644 --- a/engine/link/print_waiting_text.asm +++ b/engine/link/print_waiting_text.asm @@ -1,7 +1,6 @@ PrintWaitingText:: hlcoord 3, 10 - ld b, 1 - ld c, 11 + lb bc, 1, 11 ld a, [wIsInBattle] and a jr z, .trade |