aboutsummaryrefslogtreecommitdiffstats
path: root/engine/cable_club.asm
diff options
context:
space:
mode:
Diffstat (limited to 'engine/cable_club.asm')
-rwxr-xr-xengine/cable_club.asm135
1 files changed, 72 insertions, 63 deletions
diff --git a/engine/cable_club.asm b/engine/cable_club.asm
index 059b309a..2ec470df 100755
--- a/engine/cable_club.asm
+++ b/engine/cable_club.asm
@@ -1,7 +1,7 @@
; performs the appropriate action when the player uses the gameboy on the table in the Colosseum or Trade Center
; In the Colosseum, it starts a battle. In the Trade Center, it displays the trade selection screen.
; Before doing either action, it swaps random numbers, trainer names and party data with the other gameboy.
-CableClub_DoBattleOrTrade: ; 5317 (1:5317)
+CableClub_DoBattleOrTrade: ; 53a5 (1:53a5)
ld c, 80
call DelayFrames
call ClearScreen
@@ -10,8 +10,7 @@ CableClub_DoBattleOrTrade: ; 5317 (1:5317)
call LoadHpBarAndStatusTilePatterns
call LoadTrainerInfoTextBoxTiles
coord hl, 3, 8
- ld b, 2
- ld c, 12
+ lb bc, 2, 12
call CableClub_TextBoxBorder
coord hl, 4, 10
ld de, PleaseWaitString
@@ -23,14 +22,14 @@ CableClub_DoBattleOrTrade: ; 5317 (1:5317)
; fall through
; This is called after completing a trade.
-CableClub_DoBattleOrTradeAgain: ; 5345
+CableClub_DoBattleOrTradeAgain: ; 53d2 (1:53d2)
ld hl, wSerialPlayerDataBlock
ld a, SERIAL_PREAMBLE_BYTE
ld b, 6
-.writePlayeDataBlockPreambleLoop
+.writePlayerDataBlockPreambleLoop
ld [hli], a
dec b
- jr nz, .writePlayeDataBlockPreambleLoop
+ jr nz, .writePlayerDataBlockPreambleLoop
ld hl, wSerialRandomNumberListBlock
ld a, SERIAL_PREAMBLE_BYTE
ld b, 7
@@ -57,8 +56,8 @@ CableClub_DoBattleOrTradeAgain: ; 5345
ld [hli], a
dec b
jr nz, .zeroPlayerDataPatchListLoop
- ld hl, W_GRASSRATE
- ld bc, W_TRAINERHEADERPTR - W_GRASSRATE
+ ld hl, wGrassRate
+ ld bc, wTrainerHeaderPtr - wGrassRate
.zeroEnemyPartyLoop
xor a
ld [hli], a
@@ -119,6 +118,7 @@ CableClub_DoBattleOrTradeAgain: ; 5345
ld [rSC], a
.skipSendingTwoZeroBytes
call Delay3
+ call StopAllMusic
ld a, (1 << SERIAL)
ld [rIE], a
ld hl, wSerialRandomNumberListBlock
@@ -139,8 +139,6 @@ CableClub_DoBattleOrTradeAgain: ; 5345
call Serial_ExchangeBytes
ld a, (1 << SERIAL) | (1 << TIMER) | (1 << VBLANK)
ld [rIE], a
- ld a, $ff
- call PlaySound
ld a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr z, .skipCopyingRandomNumberList ; the list generated by the gameboy clocking the connection is used by both gameboys
@@ -186,7 +184,7 @@ CableClub_DoBattleOrTradeAgain: ; 5345
dec c
jr nz, .copyEnemyNameLoop
ld de, wEnemyPartyCount
- ld bc, W_TRAINERHEADERPTR - wEnemyPartyCount
+ ld bc, wTrainerHeaderPtr - wEnemyPartyCount
.copyEnemyPartyLoop
ld a, [hli]
cp SERIAL_NO_DATA_BYTE
@@ -255,14 +253,13 @@ CableClub_DoBattleOrTradeAgain: ; 5345
ld hl, wEnemyMons + (SERIAL_PREAMBLE_BYTE - 1)
dec c
jr nz, .unpatchEnemyMonsLoop
- ld a, wEnemyMonOT % $100
+ ld a, wEnemyMonOT & $ff
ld [wUnusedCF8D], a
ld a, wEnemyMonOT / $100
ld [wUnusedCF8D + 1], a
xor a
ld [wTradeCenterPointerTableIndex], a
- ld a, $ff
- call PlaySound
+ call StopAllMusic
ld a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
ld c, 66
@@ -271,28 +268,36 @@ CableClub_DoBattleOrTradeAgain: ; 5345
cp LINK_STATE_START_BATTLE
ld a, LINK_STATE_TRADING
ld [wLinkState], a
- jr nz, .asm_5506
+ jr nz, .asm_55a0
ld a, LINK_STATE_BATTLING
ld [wLinkState], a
ld a, OPP_SONY1
- ld [W_CUROPPONENT], a
+ ld [wCurOpponent], a
call ClearScreen
call Delay3
- ld hl, W_OPTIONS
+ 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
-.asm_5506
+.asm_55a0
ld c, BANK(Music_GameCorner)
ld a, MUSIC_GAME_CORNER
call PlayMusic
jr CallCurrentTradeCenterFunction
-PleaseWaitString: ; 550f (1:550f)
+PleaseWaitString: ; 55a9 (1:55a9)
db "PLEASE WAIT!@"
-CallCurrentTradeCenterFunction:
+CallCurrentTradeCenterFunction: ; 55b6 (1:55b6)
ld hl, TradeCenterPointerTable
ld b, 0
ld a, [wTradeCenterPointerTableIndex]
@@ -306,8 +311,11 @@ CallCurrentTradeCenterFunction:
ld l, a
jp [hl]
-TradeCenter_SelectMon:
+TradeCenter_SelectMon: ; 55ca (1:55ca)
call ClearScreen
+ call Delay3
+ ld b, $9
+ call RunPaletteCommand
call LoadTrainerInfoTextBoxTiles
call TradeCenter_DrawPartyLists
call TradeCenter_DrawCancelBox
@@ -438,6 +446,7 @@ TradeCenter_SelectMon:
ld a, [wEnemyPartyCount]
dec a
cp b
+ ; continue
jr nc, .notPastLastEnemyMon
; when switching to the enemy mon menu, if the menu selection would be past the last enemy mon, select the last enemy mon
ld [wCurrentMenuItem], a
@@ -465,8 +474,7 @@ TradeCenter_SelectMon:
.displayStatsTradeMenu
push af
coord hl, 0, 14
- ld b, 2
- ld c, 18
+ lb bc, 2, 18
call CableClub_TextBoxBorder
coord hl, 2, 16
ld de, .statsTrade
@@ -576,7 +584,7 @@ TradeCenter_SelectMon:
jr nz, .cancelMenuItem_Loop
; fall through
-ReturnToCableClubRoom: ; 577d (1:577d)
+ReturnToCableClubRoom: ; 581e (1:581e)
call GBPalWhiteOutWithDelay3
ld hl, wFontLoaded
ld a, [hl]
@@ -595,23 +603,22 @@ ReturnToCableClubRoom: ; 577d (1:577d)
call GBFadeInFromWhite
ret
-TradeCenter_DrawCancelBox:
+TradeCenter_DrawCancelBox: ; 5843 (1:5843)
coord hl, 11, 15
ld a, $7e
ld bc, 2 * SCREEN_WIDTH + 9
call FillMemory
coord hl, 0, 15
- ld b, 1
- ld c, 9
+ lb bc, 1, 9
call CableClub_TextBoxBorder
coord hl, 2, 16
ld de, CancelTextString
jp PlaceString
-CancelTextString:
+CancelTextString: ; 5860 (1:5860)
db "CANCEL@"
-TradeCenter_PlaceSelectedEnemyMonMenuCursor:
+TradeCenter_PlaceSelectedEnemyMonMenuCursor: ; 5867 (1:5867)
ld a, [wSerialSyncAndExchangeNybbleReceiveData]
coord hl, 1, 9
ld bc, SCREEN_WIDTH
@@ -619,24 +626,25 @@ TradeCenter_PlaceSelectedEnemyMonMenuCursor:
ld [hl], $ec ; cursor
ret
-TradeCenter_DisplayStats:
+TradeCenter_DisplayStats: ; 5876 (1:5876)
ld a, [wCurrentMenuItem]
ld [wWhichPokemon], a
predef StatusScreen
predef StatusScreen2
+ call Delay3
+ ld b, $9
+ call RunPaletteCommand
call GBPalNormal
call LoadTrainerInfoTextBoxTiles
call TradeCenter_DrawPartyLists
jp TradeCenter_DrawCancelBox
-TradeCenter_DrawPartyLists:
+TradeCenter_DrawPartyLists: ; 589a (1:589a)
coord hl, 0, 0
- ld b, 6
- ld c, 18
+ lb bc, 6, 18
call CableClub_TextBoxBorder
coord hl, 0, 8
- ld b, 6
- ld c, 18
+ lb bc, 6, 18
call CableClub_TextBoxBorder
coord hl, 5, 0
ld de, wPlayerName
@@ -651,7 +659,7 @@ TradeCenter_DrawPartyLists:
ld de, wEnemyPartyMons
; fall through
-TradeCenter_PrintPartyListNames:
+TradeCenter_PrintPartyListNames: ; 58cd (1:58cd)
ld c, $0
.loop
ld a, [de]
@@ -676,7 +684,7 @@ TradeCenter_PrintPartyListNames:
inc c
jr .loop
-TradeCenter_Trade:
+TradeCenter_Trade: ; 58ef (1:58ef)
ld c, 100
call DelayFrames
xor a
@@ -685,8 +693,7 @@ TradeCenter_Trade:
ld [wMenuWatchMovingOutOfBounds], a
ld [wMenuJoypadPollCount], a
coord hl, 0, 12
- ld b, 4
- ld c, 18
+ lb bc, 4, 18
call CableClub_TextBoxBorder
ld a, [wTradingWhichPlayerMon]
ld hl, wPartySpecies
@@ -727,8 +734,7 @@ TradeCenter_Trade:
ld a, $1
ld [wSerialExchangeNybbleSendData], a
coord hl, 0, 12
- ld b, 4
- ld c, 18
+ lb bc, 4, 18
call CableClub_TextBoxBorder
coord hl, 1, 14
ld de, TradeCanceled
@@ -744,8 +750,7 @@ TradeCenter_Trade:
jr nz, .doTrade
; if the other person cancelled
coord hl, 0, 12
- ld b, 4
- ld c, 18
+ lb bc, 4, 18
call CableClub_TextBoxBorder
coord hl, 1, 14
ld de, TradeCanceled
@@ -792,6 +797,7 @@ TradeCenter_Trade:
add hl, bc
ld a, [hl]
ld [wTradedPlayerMonSpecies], a
+ callabd_ModifyPikachuHappiness PIKAHAPPY_TRADE
xor a
ld [wRemoveMonFromBox], a
call RemovePokemon
@@ -845,15 +851,18 @@ TradeCenter_Trade:
.usingExternalClock
predef ExternalClockTradeAnim
.tradeCompleted
+; continue
callab TryEvolvingMon
call ClearScreen
call LoadTrainerInfoTextBoxTiles
call Serial_PrintWaitingTextAndSyncAndExchangeNybble
ld c, 40
call DelayFrames
+ call Delay3
+ ld b, $9
+ call RunPaletteCommand
coord hl, 0, 12
- ld b, 4
- ld c, 18
+ lb bc, 4, 18
call CableClub_TextBoxBorder
coord hl, 1, 14
ld de, TradeCompleted
@@ -871,22 +880,22 @@ TradeCenter_Trade:
ld [wTradeCenterPointerTableIndex], a
jp CallCurrentTradeCenterFunction
-WillBeTradedText: ; 5a24 (1:5a24)
+WillBeTradedText: ; 5ad8 (1:5ad8)
TX_FAR _WillBeTradedText
db "@"
-TradeCompleted:
+TradeCompleted: ; 5add (1:5add)
db "Trade completed!@"
-TradeCanceled:
+TradeCanceled: ; 5aee (1:5aee)
db "Too bad! The trade"
next "was canceled!@"
-TradeCenterPointerTable: ; 5a5b (1:5a5b)
+TradeCenterPointerTable: ; 5b0f (1:5b0f)
dw TradeCenter_SelectMon
dw TradeCenter_Trade
-CableClub_Run: ; 5a5f (1:5a5f)
+CableClub_Run: ; 5b13 (1:5b13)
ld a, [wLinkState]
cp LINK_STATE_START_TRADE
jr z, .doBattleOrTrade
@@ -900,18 +909,18 @@ CableClub_Run: ; 5a5f (1:5a5f)
call CableClub_DoBattleOrTrade
ld hl, Club_GFX
ld a, h
- ld [W_TILESETGFXPTR + 1], a
+ ld [wTilesetGFXPtr + 1], a
ld a, l
- ld [W_TILESETGFXPTR], a
+ ld [wTilesetGFXPtr], a
ld a, Bank(Club_GFX)
- ld [W_TILESETBANK], a
+ ld [wTilesetBank], a
ld hl, Club_Coll
ld a, h
- ld [W_TILESETCOLLISIONPTR + 1], a
+ ld [wTilesetCollisionPtr + 1], a
ld a, l
- ld [W_TILESETCOLLISIONPTR], a
+ ld [wTilesetCollisionPtr], a
xor a
- ld [W_GRASSRATE], a
+ ld [wGrassRate], a
inc a ; LINK_STATE_IN_CABLE_CLUB
ld [wLinkState], a
ld [$ffb5], a
@@ -923,15 +932,15 @@ CableClub_Run: ; 5a5f (1:5a5f)
ld [wNewSoundID], a
jp PlaySound
-EmptyFunc3: ; 5aaf (1:5aaf)
+EmptyFunc3: ; 5b63 (1:5b63)
ret
-Diploma_TextBoxBorder: ; 5ab0 (1:5ab0)
+Diploma_TextBoxBorder: ; 5b64 (1:5b64)
call GetPredefRegisters
; b = height
; c = width
-CableClub_TextBoxBorder: ; 5ab3 (1:5ab3)
+CableClub_TextBoxBorder: ; 5b67 (1:5b67)
push hl
ld a, $78 ; border upper left corner tile
ld [hli], a
@@ -962,10 +971,10 @@ CableClub_TextBoxBorder: ; 5ab3 (1:5ab3)
ret
; c = width
-CableClub_DrawHorizontalLine: ; 5ae0 (1:5ae0)
+CableClub_DrawHorizontalLine: ; 5b94 (1:5b94)
ld d, c
-.asm_5ae1
+.drawHorizontalLineLoop
ld [hli], a
dec d
- jr nz, .asm_5ae1
- ret
+ jr nz, .drawHorizontalLineLoop
+ ret \ No newline at end of file