This commit is contained in:
dannye 2022-12-28 17:38:38 -06:00
commit 3f691fcb21
970 changed files with 15106 additions and 11361 deletions

View file

@ -123,19 +123,22 @@ CableClub_DoBattleOrTradeAgain:
ldh [rIE], a
ld hl, wSerialRandomNumberListBlock
ld de, wSerialOtherGameboyRandomNumberListBlock
ld bc, $11
ld bc, SERIAL_RN_PREAMBLE_LENGTH + SERIAL_RNS_LENGTH
vc_hook Wireless_ExchangeBytes_RNG_state_unknown_Type5
call Serial_ExchangeBytes
ld a, SERIAL_NO_DATA_BYTE
ld [de], a
ld hl, wSerialPlayerDataBlock
ld de, wSerialEnemyDataBlock
ld bc, $1a8
ld bc, SERIAL_PREAMBLE_LENGTH + NAME_LENGTH + 1 + PARTY_LENGTH + 1 + (PARTYMON_STRUCT_LENGTH + NAME_LENGTH * 2) * PARTY_LENGTH + 3
vc_hook Wireless_ExchangeBytes_party_structs
call Serial_ExchangeBytes
ld a, SERIAL_NO_DATA_BYTE
ld [de], a
ld hl, wSerialPartyMonsPatchList
ld de, wSerialEnemyMonsPatchList
ld bc, $c8
ld bc, 200
vc_hook Wireless_ExchangeBytes_patch_lists
call Serial_ExchangeBytes
ld a, (1 << SERIAL) | (1 << TIMER) | (1 << VBLANK)
ldh [rIE], a
@ -345,7 +348,7 @@ TradeCenter_SelectMon:
res 1, [hl]
and a
jp z, .getNewInput
bit 0, a ; A button pressed?
bit BIT_A_BUTTON, a
jr z, .enemyMonMenu_ANotPressed
; if A button pressed
ld a, [wMaxMenuItem]
@ -364,7 +367,7 @@ TradeCenter_SelectMon:
call TradeCenter_DisplayStats
jp .getNewInput
.enemyMonMenu_ANotPressed
bit 5, a ; Left pressed?
bit BIT_D_LEFT, a
jr z, .enemyMonMenu_LeftNotPressed
; if Left pressed, switch back to the player mon menu
xor a ; player mon menu
@ -384,7 +387,7 @@ TradeCenter_SelectMon:
ld [wCurrentMenuItem], a
jr .playerMonMenu
.enemyMonMenu_LeftNotPressed
bit 7, a ; Down pressed?
bit BIT_D_DOWN, a
jp z, .getNewInput
jp .selectedCancelMenuItem ; jump if Down pressed
.playerMonMenu
@ -412,7 +415,7 @@ TradeCenter_SelectMon:
jr nz, .playerMonMenu_SomethingPressed
jp .getNewInput
.playerMonMenu_SomethingPressed
bit 0, a ; A button pressed?
bit BIT_A_BUTTON, a
jr z, .playerMonMenu_ANotPressed
jp .chosePlayerMon ; jump if A button pressed
; unreachable code
@ -422,7 +425,7 @@ TradeCenter_SelectMon:
call TradeCenter_DisplayStats
jp .getNewInput
.playerMonMenu_ANotPressed
bit 4, a ; Right pressed?
bit BIT_D_RIGHT, a
jr z, .playerMonMenu_RightNotPressed
; if Right pressed, switch to the enemy mon menu
ld a, $1 ; enemy mon menu
@ -444,7 +447,7 @@ TradeCenter_SelectMon:
.notPastLastEnemyMon
jp .enemyMonMenu
.playerMonMenu_RightNotPressed
bit 7, a ; Down pressed?
bit BIT_D_DOWN, a
jr z, .getNewInput
jp .selectedCancelMenuItem ; jump if Down pressed
.getNewInput
@ -488,7 +491,7 @@ TradeCenter_SelectMon:
call HandleMenuInput
bit 4, a ; Right pressed?
jr nz, .selectTradeMenuItem
bit 1, a ; B button pressed?
bit BIT_B_BUTTON, a
jr z, .displayPlayerMonStats
.cancelPlayerMonChoice
pop af
@ -503,9 +506,9 @@ TradeCenter_SelectMon:
ld a, 11
ld [wTopMenuItemX], a
call HandleMenuInput
bit 5, a ; Left pressed?
bit BIT_D_LEFT, a
jr nz, .selectStatsMenuItem
bit 1, a ; B button pressed?
bit BIT_B_BUTTON, a
jr nz, .cancelPlayerMonChoice
jr .choseTrade
.displayPlayerMonStats
@ -554,9 +557,9 @@ TradeCenter_SelectMon:
ldh a, [hJoy5]
and a ; pressed anything?
jr z, .cancelMenuItem_JoypadLoop
bit 0, a ; A button pressed?
bit BIT_A_BUTTON, a
jr nz, .cancelMenuItem_APressed
bit 6, a ; Up pressed?
bit BIT_D_UP, a
jr z, .cancelMenuItem_JoypadLoop
; if Up pressed
ld a, " "
@ -648,7 +651,7 @@ TradeCenter_DrawPartyLists:
ld de, wPartySpecies
call TradeCenter_PrintPartyListNames
hlcoord 2, 9
ld de, wEnemyPartyMons
ld de, wEnemyPartySpecies
; fall through
TradeCenter_PrintPartyListNames:
@ -701,7 +704,7 @@ TradeCenter_Trade:
ld bc, NAME_LENGTH
call CopyData
ld a, [wTradingWhichEnemyMon]
ld hl, wEnemyPartyMons
ld hl, wEnemyPartySpecies
ld c, a
ld b, 0
add hl, bc
@ -798,7 +801,7 @@ TradeCenter_Trade:
ld a, [wTradingWhichEnemyMon]
ld c, a
ld [wWhichPokemon], a
ld hl, wEnemyPartyMons
ld hl, wEnemyPartySpecies
ld d, 0
ld e, a
add hl, de
@ -818,7 +821,7 @@ TradeCenter_Trade:
ld a, $1
ld [wForceEvolution], a
ld a, [wTradingWhichEnemyMon]
ld hl, wEnemyPartyMons
ld hl, wEnemyPartySpecies
ld b, 0
ld c, a
add hl, bc
@ -859,6 +862,7 @@ TradeCenter_Trade:
ld de, TradeCompleted
call PlaceString
predef SaveSAVtoSRAM2
vc_hook Trade_save_game_end
ld c, 50
call DelayFrames
xor a

View file

@ -27,6 +27,15 @@ CableClubNPC::
xor a
ldh [hSerialReceiveData], a
ld a, START_TRANSFER_EXTERNAL_CLOCK
; This vc_hook causes the Virtual Console to set [hSerialConnectionStatus] to
; USING_INTERNAL_CLOCK, which allows the player to proceed past the link
; receptionist's "Please wait." It assumes that hSerialConnectionStatus is at
; its original address.
vc_hook Link_fake_connection_status
vc_assert hSerialConnectionStatus == $ffaa, \
"hSerialConnectionStatus is no longer located at 00:ffaa"
vc_assert USING_INTERNAL_CLOCK == $02, \
"USING_INTERNAL_CLOCK is no longer equal to $02."
ldh [rSC], a
ld a, [wLinkTimeoutCounter]
dec a
@ -54,6 +63,7 @@ CableClubNPC::
ld a, [wCurrentMenuItem]
and a
jr nz, .choseNo
vc_hook Wireless_TryQuickSave_block_input
callfar SaveSAVtoSRAM
call WaitForSoundToFinish
ld a, SFX_SAVE
@ -66,8 +76,10 @@ CableClubNPC::
xor a
ld [hl], a
ldh [hSerialReceivedNewData], a
vc_hook Wireless_prompt
ld [wSerialExchangeNybbleSendData], a
call Serial_SyncAndExchangeNybble
vc_hook Wireless_net_recheck
ld hl, wUnknownSerialCounter
ld a, [hli]
inc a