serial/trade/misc

This commit is contained in:
YamaArashi 2015-02-07 02:43:08 -08:00
parent 9de54645c8
commit 3fdb8a0d89
74 changed files with 1934 additions and 1648 deletions

View file

@ -30,6 +30,9 @@ OAM_X_FLIP EQU 5
OAM_Y_FLIP EQU 6
OAM_PRIORITY EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3)
; serial
START_TRANSFER_EXTERNAL_CLOCK EQU $80
START_TRANSFER_INTERNAL_CLOCK EQU $81
; Hardware registers
rJOYP EQU $ff00 ; Joypad (R/W)

View file

@ -26,4 +26,40 @@ SCREEN_HEIGHT EQU 18
NPC_MOVEMENT_DOWN EQU $00
NPC_MOVEMENT_UP EQU $40
NPC_MOVEMENT_LEFT EQU $80
NPC_MOVEMENT_RIGHT EQU $C0
NPC_MOVEMENT_RIGHT EQU $C0
; two option menu constants
YES_NO_MENU EQU 0
NORTH_WEST_MENU EQU 1
SOUTH_EAST_MENU EQU 2
WIDE_YES_NO_MENU EQU 3
NORTH_EAST_MENU EQU 4
TRADE_CANCEL_MENU EQU 5
HEAL_CANCEL_MENU EQU 6
NO_YES_MENU EQU 7
; serial
ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK EQU $01
ESTABLISH_CONNECTION_WITH_EXTERNAL_CLOCK EQU $02
USING_EXTERNAL_CLOCK EQU $01
USING_INTERNAL_CLOCK EQU $02
CONNECTION_NOT_ESTABLISHED EQU $ff
; signals the start of an array of bytes transferred over the link cable
SERIAL_PREAMBLE_BYTE EQU $FD
; this byte is used when there is no data to send
SERIAL_NO_DATA_BYTE EQU $FE
; signals the end of one part of a patch list (there are two parts) for player/enemy party data
SERIAL_PATCH_LIST_PART_TERMINATOR EQU $FF
LINK_STATE_NONE EQU $00 ; not using link
LINK_STATE_IN_CABLE_CLUB EQU $01 ; in a cable club room (Colosseum or Trade Centre)
LINK_STATE_START_TRADE EQU $02 ; pre-trade selection screen initialisation
LINK_STATE_START_BATTLE EQU $03 ; pre-battle initialisation
LINK_STATE_BATTLING EQU $04 ; in a link battle
LINK_STATE_RESET EQU $05 ; reset game (unused)
LINK_STATE_TRADING EQU $32 ; in a link trade

View file

@ -175,10 +175,10 @@ NUM_ATTACKS EQU const_value + -1
const STATUS_AFFECTED_ANIM
const ANIM_A8
const ANIM_A9
const ANIM_AA
const ANIM_AB
const ANIM_AC
const ANIM_AD
const TRADE_BALL_DROP_ANIM
const TRADE_BALL_SHAKE_ANIM
const TRADE_BALL_TILT_ANIM
const TRADE_BALL_POOF_ANIM
const XSTATITEM_ANIM ; use X Attack/Defense/Speed/Special
const ANIM_AF
const ANIM_B0

View file

@ -2,13 +2,9 @@
SPRITEBUFFERSIZE EQU 7*7 * 8 ; 7 * 7 (tiles) * 8 (bytes per tile)
; Overload W_GRASSMONS
wd893 EQU $d893 ; W_GRASSMONS + 11
wd896 EQU $d896 ; W_GRASSMONS + 14
wSerialEnemyDataBlock EQU $d893 ; W_GRASSMONS + 11
; Overload enemy party data
W_WATERRATE EQU $d8a4 ; wEnemyMon1Species
W_WATERMONS EQU $d8a5 ; wEnemyMon1Species + 1
; Overload enemy stat modifiers
wTradeMonNick EQU $cd1e ; wPlayerMonAccuracyMod

View file

@ -177,19 +177,19 @@ HiddenObjectPointers: ; 46a96 (11:6a96)
; format: y-coord, x-coord, text id/item id, object routine
BattleCenterHiddenObjects: ; 46b40 (11:6b40)
db $04,$05,$d0
db BANK(PrintJustAMomentText2)
dw PrintJustAMomentText2
db BANK(CableClubRightGameboy)
dw CableClubRightGameboy
db $04,$04,$d0
db BANK(PrintJustAMomentText1)
dw PrintJustAMomentText1
db BANK(CableClubLeftGameboy)
dw CableClubLeftGameboy
db $FF
TradeCenterHiddenObjects: ; 46b4d (11:6b4d)
db $04,$05,$d0
db BANK(PrintJustAMomentText2)
dw PrintJustAMomentText2
db BANK(CableClubRightGameboy)
dw CableClubRightGameboy
db $04,$04,$d0
db BANK(PrintJustAMomentText1)
dw PrintJustAMomentText1
db BANK(CableClubLeftGameboy)
dw CableClubLeftGameboy
db $FF
RedsHouse2FHiddenObjects: ; 46b5a (11:6b5a)
db $01,$00,$04

View file

@ -1,6 +1,6 @@
GainExperience: ; 5524f (15:524f)
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
ret z ; return if link battle
call DivideExpDataByNumMonsGainingExp
ld hl, wPartyMon1
@ -226,8 +226,8 @@ GainExperience: ; 5524f (15:524f)
ld a, [W_PLAYERBATTSTATUS3]
bit 3, a ; is the mon transformed?
jr nz, .recalcStatChanges
; the mon is transformed, so copy transformed data
ld de, wcd0f
; the mon is not transformed, so update the unmodified stats
ld de, wPlayerMonUnmodifiedLevel
ld bc, $b
call CopyData
.recalcStatChanges

View file

@ -127,8 +127,8 @@ BattleTransition: ; 7096d (1c:496d)
call Delay3
call LoadBattleTransitionTile
ld bc, $0
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr z, .linkBattle
call GetBattleTransitionID_WildOrTrainer
call GetBattleTransitionID_CompareLevels

View file

@ -1,6 +1,6 @@
EndOfBattle: ; 137aa (4:77aa)
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr nz, .notLinkBattle
; link battle
ld a, [wEnemyMonPartyPos]
@ -110,7 +110,7 @@ Func_13870: ; 13870 (4:7870)
jr z, .lastRepelStep
ld [wRepelRemainingSteps], a
.asm_1389e
; determine if wild pokémon can appear in the half-block were standing
; determine if wild pokémon can appear in the half-block were standing
; is the bottom right tile (9,9) of the half-block are we standing a grass/water tile?
hlCoord 9, 9
ld c, [hl]
@ -122,9 +122,9 @@ Func_13870: ; 13870 (4:7870)
cp c
ld a, [W_WATERRATE]
jr z, .CanEncounter
; even if not in grass/water, standing anywhere we can encounter pokémon
; so long as the map is “indoor” and has wild pokémon defined.
; …as long as its not Viridian Forest or Safari Zone.
; even if not in grass/water, standing anywhere we can encounter pokémon
; so long as the map is “indoor” and has wild pokémon defined.
; …as long as its not Viridian Forest or Safari Zone.
ld a, [W_CURMAP]
cp REDS_HOUSE_1F ; is this an indoor map?
jr c, .CantEncounter
@ -148,7 +148,7 @@ Func_13870: ; 13870 (4:7870)
inc hl
jr .determineEncounterSlot
.gotEncounterSlot
; determine which wild pokémon (grass or water) can appear in the half-block were standing
; determine which wild pokémon (grass or water) can appear in the half-block were standing
ld c, [hl]
ld hl, W_GRASSMONS
aCoord 8, 9
@ -314,7 +314,7 @@ HazeEffect_: ; 139da (4:79da)
call Func_13a43
ld hl, wEnemyMonAttackMod
call Func_13a43
ld hl, wcd12
ld hl, wPlayerMonUnmodifiedAttack
ld de, wBattleMonAttack
call Func_13a4a
ld hl, wEnemyMonUnmodifiedAttack
@ -386,8 +386,8 @@ StatusChangesEliminatedText: ; 13a53 (4:7a53)
db "@"
GetTrainerName_: ; 13a58 (4:7a58)
ld hl, W_GRASSRATE
ld a, [W_ISLINKBATTLE]
ld hl, W_GRASSRATE
ld a, [wLinkState]
and a
jr nz, .rival
ld hl, W_RIVALNAME ; wd34a

View file

@ -528,9 +528,9 @@ Func_78e23: ; 78e23 (1e:4e23)
ld [wcc79], a
ld b, $e4
ld a, [W_ANIMATIONID] ; W_ANIMATIONID
cp ANIM_AA
cp TRADE_BALL_DROP_ANIM
jr c, .asm_78e3f
cp ANIM_AD + 1
cp TRADE_BALL_POOF_ANIM + 1
jr nc, .asm_78e3f
ld b, $f0
.asm_78e3f
@ -700,13 +700,13 @@ AnimationIdSpecialEffects: ; 78ef5 (1e:4ef5)
db ROCK_SLIDE
dw DoRockSlideSpecialEffects
db ANIM_AA
db TRADE_BALL_DROP_ANIM
dw Func_79041
db ANIM_AB
db TRADE_BALL_SHAKE_ANIM
dw Func_7904c
db ANIM_AC
db TRADE_BALL_TILT_ANIM
dw Func_7907c
db TOSS_ANIM
@ -960,9 +960,9 @@ Func_7907c ; 507C
ld c,5
call DelayFrames
pop bc
ld a,[$ffae] ; background scroll X
ld a,[hSCX] ; background scroll X
sub a,8 ; scroll to the left
ld [$ffae],a
ld [hSCX],a
pop de
jr .loop
@ -1307,9 +1307,9 @@ AnimationSlideMonUp: ; 7927a (1e:527a)
AnimationSlideMonDown: ; 79297 (1e:5297)
; Slides the mon's sprite down out of the screen.
xor a
call Func_79842
call GetTileIDList
.asm_7929b
call Func_79820
call GetMonSpriteTileMapPointerFromRowCount
push bc
push de
call Func_79aae
@ -1498,8 +1498,8 @@ AnimationFlashEnemyMonPic: ; 79398 (1e:5398)
AnimationShowMonPic: ; 7939e (1e:539e)
xor a
call Func_79842
call Func_79820
call GetTileIDList
call GetMonSpriteTileMapPointerFromRowCount
call Func_79aae
jp Delay3
@ -1533,7 +1533,7 @@ AnimationShakeBackAndForth: ; 793b1 (1e:53b1)
push af
push hl
push hl
call Func_79842
call GetTileIDList
pop hl
call Func_79aae
call Delay3
@ -1541,7 +1541,7 @@ AnimationShakeBackAndForth: ; 793b1 (1e:53b1)
ld bc, $0709
call ClearScreenArea
pop af
call Func_79842
call GetTileIDList
pop hl
call Func_79aae
call Delay3
@ -1568,7 +1568,7 @@ AnimationMoveMonHorizontally: ; 793f9 (1e:53f9)
.asm_79407
xor a
push hl
call Func_79842
call GetTileIDList
pop hl
call Func_79aae
ld c, $3
@ -1863,8 +1863,8 @@ AnimationSlideMonDownAndHide: ; 795c9 (1e:55c9)
call AnimationHideMonPic
pop af
push af
call Func_79842
call Func_79820
call GetTileIDList
call GetMonSpriteTileMapPointerFromRowCount
call Func_79aae
ld c, $8
call DelayFrames
@ -2133,8 +2133,8 @@ Func_79793: ; 79793 (1e:5793)
call GetMonHeader
predef LoadMonBackPic
xor a
call Func_79842
call Func_79820
call GetTileIDList
call GetMonSpriteTileMapPointerFromRowCount
call Func_79aae
pop af
ld [wBattleMonSpecies2], a
@ -2194,37 +2194,46 @@ Func_7980c: ; 7980c (1e:580c)
pop hl
ret
Func_79820: ; 79820 (1e:5820)
; puts the tile map destination address of a mon sprite in hl, given the row count in b
; The usual row count is 7, but it may be smaller when sliding a mon sprite in/out,
; in order to show only a portion of the mon sprite.
GetMonSpriteTileMapPointerFromRowCount: ; 79820 (1e:5820)
push de
ld a, [H_WHOSETURN] ; $fff3
ld a, [H_WHOSETURN]
and a
jr nz, .asm_7982a
ld a, $65
jr .asm_7982c
.asm_7982a
ld a, $c
.asm_7982c
jr nz, .enemyTurn
ld a, 20 * 5 + 1
jr .next
.enemyTurn
ld a, 12
.next
ld hl, wTileMap
ld e, a
ld d, $0
ld d, 0
add hl, de
ld a, $7
ld a, 7
sub b
and a
jr z, .asm_79840
ld de, $14
.asm_7983c
jr z, .done
ld de, 20
.loop
add hl, de
dec a
jr nz, .asm_7983c
.asm_79840
jr nz, .loop
.done
pop de
ret
Func_79842: ; 79842 (1e:5842)
ld hl, PointerTable_79aea ; $5aea
; Input:
; a = tile ID list index
; Output:
; de = tile ID list pointer
; b = number of rows
; c = number of columns
GetTileIDList: ; 79842 (1e:5842)
ld hl, TileIDListPointerTable
ld e, a
ld d, $0
ld d, 0
add hl, de
add hl, de
add hl, de
@ -2486,13 +2495,14 @@ MoveSoundTable: ; 798bc (1e:58bc)
db (SFX_08_4b - SFX_Headers_08) / 3,$00,$80
Func_79aae: ; 79aae (1e:5aae)
ld a, [H_WHOSETURN] ; $fff3
ld a, [H_WHOSETURN]
and a
ld a, $31
ld a, $31 ; base tile ID of player mon sprite
jr z, .asm_79ab6
xor a
; enemy turn
xor a ; base tile ID of enemy mon sprite
.asm_79ab6
ld [H_DOWNARROWBLINKCNT1], a ; $ff8b
ld [hBaseTileID], a
jr asm_79acb
Func_79aba: ; 79aba (1e:5aba)
@ -2506,34 +2516,36 @@ Func_79aba: ; 79aba (1e:5aba)
ld de, Unknown_79b1b ; $5b1b
asm_79acb: ; 79acb (1e:5acb)
xor a
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld [H_AUTOBGTRANSFERENABLED], a
Func_79ace: ; 79ace (1e:5ace)
; b = number of rows
; c = number of columns
CopyTileIDs: ; 79ace (1e:5ace)
push hl
.asm_79acf
.rowLoop
push bc
push hl
ld a, [H_DOWNARROWBLINKCNT1] ; $ff8b
ld a, [hBaseTileID]
ld b, a
.asm_79ad4
.columnLoop
ld a, [de]
add b
inc de
ld [hli], a
dec c
jr nz, .asm_79ad4
jr nz, .columnLoop
pop hl
ld bc, $14
ld bc, 20
add hl, bc
pop bc
dec b
jr nz, .asm_79acf
jr nz, .rowLoop
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld [H_AUTOBGTRANSFERENABLED], a
pop hl
ret
PointerTable_79aea: ; 79aea (1e:5aea)
TileIDListPointerTable: ; 79aea (1e:5aea)
dw Unknown_79b24
db $77
dw Unknown_79b55
@ -2552,34 +2564,79 @@ PointerTable_79aea: ; 79aea (1e:5aea)
db $3C
Unknown_79b02: ; 79b02 (1e:5b02)
db $31,$38,$46,$54,$5B,$32,$39,$47,$55,$5C,$34,$3B,$49,$57,$5E,$36,$3D,$4B,$59,$60,$37,$3E,$4C,$5A,$61
db $31,$38,$46,$54,$5B
db $32,$39,$47,$55,$5C
db $34,$3B,$49,$57,$5E
db $36,$3D,$4B,$59,$60
db $37,$3E,$4C,$5A,$61
Unknown_79b1b: ; 79b1b (1e:5b1b)
db $31,$46,$5B,$34,$49,$5E,$37,$4C,$61
db $31,$46,$5B
db $34,$49,$5E
db $37,$4C,$61
Unknown_79b24: ; 79b24 (1e:5b24)
db $00,$07,$0E,$15,$1C,$23,$2A,$01,$08,$0F,$16,$1D,$24,$2B,$02,$09,$10,$17,$1E,$25,$2C,$03,$0A,$11,$18,$1F,$26,$2D,$04,$0B,$12,$19,$20,$27,$2E,$05,$0C,$13,$1A,$21,$28,$2F,$06,$0D,$14,$1B,$22,$29,$30
db $00,$07,$0E,$15,$1C,$23,$2A
db $01,$08,$0F,$16,$1D,$24,$2B
db $02,$09,$10,$17,$1E,$25,$2C
db $03,$0A,$11,$18,$1F,$26,$2D
db $04,$0B,$12,$19,$20,$27,$2E
db $05,$0C,$13,$1A,$21,$28,$2F
db $06,$0D,$14,$1B,$22,$29,$30
Unknown_79b55: ; 79b55 (1e:5b55)
db $00,$07,$0E,$15,$1C,$23,$2A,$01,$08,$0F,$16,$1D,$24,$2B,$03,$0A,$11,$18,$1F,$26,$2D,$04,$0B,$12,$19,$20,$27,$2E,$05,$0C,$13,$1A,$21,$28,$2F
db $00,$07,$0E,$15,$1C,$23,$2A
db $01,$08,$0F,$16,$1D,$24,$2B
db $03,$0A,$11,$18,$1F,$26,$2D
db $04,$0B,$12,$19,$20,$27,$2E
db $05,$0C,$13,$1A,$21,$28,$2F
Unknown_79b78: ; 79b78 (1e:5b78)
db $00,$07,$0E,$15,$1C,$23,$2A,$02,$09,$10,$17,$1E,$25,$2C,$04,$0B,$12,$19,$20,$27,$2E
db $00,$07,$0E,$15,$1C,$23,$2A
db $02,$09,$10,$17,$1E,$25,$2C
db $04,$0B,$12,$19,$20,$27,$2E
Unknown_79b8d: ; 79b8d (1e:5b8d)
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$19,$00,$02,$06,$0B,$10,$14,$1A,$00,$00,$07,$0C,$11,$15,$1B,$00,$03,$08,$0D,$12,$16,$1C,$00,$04,$09,$0E,$13,$17,$1D,$1F,$05,$0A,$0F,$01,$18,$1E,$20
db $00,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$19,$00
db $02,$06,$0B,$10,$14,$1A,$00
db $00,$07,$0C,$11,$15,$1B,$00
db $03,$08,$0D,$12,$16,$1C,$00
db $04,$09,$0E,$13,$17,$1D,$1F
db $05,$0A,$0F,$01,$18,$1E,$20
Unknown_79bbe: ; 79bbe (1e:5bbe)
db $00,$00,$00,$30,$00,$37,$00,$00,$00,$2B,$31,$34,$38,$3D,$21,$26,$2C,$01,$35,$39,$3E,$22,$27,$2D,$32,$36,$01,$00,$23,$28,$2E,$33,$01,$3A,$00,$24,$29,$2F,$01,$01,$3B,$00,$25,$2A,$01,$01,$01,$3C,$00
db $00,$00,$00,$30,$00,$37,$00
db $00,$00,$2B,$31,$34,$38,$3D
db $21,$26,$2C,$01,$35,$39,$3E
db $22,$27,$2D,$32,$36,$01,$00
db $23,$28,$2E,$33,$01,$3A,$00
db $24,$29,$2F,$01,$01,$3B,$00
db $25,$2A,$01,$01,$01,$3C,$00
Unknown_79bef: ; 79bef (1e:5bef)
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$47,$4D,$00,$00,$00,$00,$00,$48,$4E,$52,$56,$5B,$3F,$43,$49,$4F,$53,$57,$5C,$40,$44,$4A,$50,$54,$58,$00,$41,$45,$4B,$51,$4C,$59,$5D,$42,$46,$4C,$4C,$55,$5A,$5E
db $00,$00,$00,$00,$00,$00,$00
db $00,$00,$47,$4D,$00,$00,$00
db $00,$00,$48,$4E,$52,$56,$5B
db $3F,$43,$49,$4F,$53,$57,$5C
db $40,$44,$4A,$50,$54,$58,$00
db $41,$45,$4B,$51,$4C,$59,$5D
db $42,$46,$4C,$4C,$55,$5A,$5E
Unknown_79c20: ; 79c20 (1e:5c20)
db $31,$32,$32,$32,$32,$33,$34,$35,$36,$36,$37,$38,$34,$39,$3A,$3A,$3B,$38,$3C,$3D,$3E,$3E,$3F,$40,$41,$42,$43,$43,$44,$45,$46,$47,$43,$48,$49,$4A,$41,$43,$4B,$4C,$4D,$4E,$4F,$50,$50,$50,$51,$52
db $31,$32,$32,$32,$32,$33
db $34,$35,$36,$36,$37,$38
db $34,$39,$3A,$3A,$3B,$38
db $3C,$3D,$3E,$3E,$3F,$40
db $41,$42,$43,$43,$44,$45
db $46,$47,$43,$48,$49,$4A
db $41,$43,$4B,$4C,$4D,$4E
db $4F,$50,$50,$50,$51,$52
Unknown_79c50: ; 79c50 (1e:5c50)
db $43,$55,$56,$53,$53,$53,$53,$53,$53,$53,$53,$53,$43,$57,$58,$54,$54,$54,$54,$54,$54,$54,$54,$54,$43,$59,$5A,$43,$43,$43,$43,$43,$43,$43,$43,$43
db $43,$55,$56,$53,$53,$53,$53,$53,$53,$53,$53,$53
db $43,$57,$58,$54,$54,$54,$54,$54,$54,$54,$54,$54
db $43,$59,$5A,$43,$43,$43,$43,$43,$43,$43,$43,$43
AnimationLeavesFalling: ; 79c74 (1e:5c74)
; Makes leaves float down from the top of the screen. This is used
@ -2743,7 +2800,7 @@ AnimationShakeEnemyHUD: ; 79d77 (1e:5d77)
ld bc, 7 * 7
call CopyVideoData
xor a
ld [$ffae], a
ld [hSCX], a
ld hl, vBGMap0
call Func_79e0d
ld a, $90
@ -2776,34 +2833,36 @@ AnimationShakeEnemyHUD: ; 79d77 (1e:5d77)
ld hl, vBGMap1
jp Func_79e0d
Func_79dda: ; 79dda (1e:5dda)
; b = tile ID list index
; c = base tile ID
CopyTileIDsFromList: ; 79dda (1e:5dda)
call GetPredefRegisters
ld a, c
ld [H_DOWNARROWBLINKCNT1], a ; $ff8b
ld [hBaseTileID], a
ld a, b
push hl
call Func_79842
call GetTileIDList
pop hl
jp Func_79ace
jp CopyTileIDs
Func_79de9: ; 79de9 (1e:5de9)
ld a, [$ffae]
ld a, [hSCX]
ld [wTrainerSpriteOffset], a
.asm_79dee
ld a, [wTrainerSpriteOffset]
add d
ld [$ffae], a
ld [hSCX], a
ld c, $2
call DelayFrames
ld a, [wTrainerSpriteOffset]
sub d
ld [$ffae], a
ld [hSCX], a
ld c, $2
call DelayFrames
dec e
jr nz, .asm_79dee
ld a, [wTrainerSpriteOffset]
ld [$ffae], a
ld [hSCX], a
ret
Func_79e0d: ; 79e0d (1e:5e0d)

View file

@ -99,7 +99,7 @@ SpecialEffectsCont: ; 3c049 (f:4049)
SlidePlayerAndEnemySilhouettesOnScreen: ; 3c04c (f:404c)
call LoadPlayerBackPic
ld a, $1 ; the usual text box at the bottom of the screen
ld [wd125], a
ld [wTextBoxID], a
call DisplayTextBoxID
hlCoord 1, 5
ld bc, $307
@ -240,7 +240,7 @@ StartBattle: ; 3c11e (f:411e)
jr .findFirstAliveEnemyMonLoop
.foundFirstAliveEnemyMon
ld a, d
ld [wcc3e], a
ld [wSerialExchangeNybbleReceiveData], a
ld a, [W_ISINBATTLE]
dec a ; is it a trainer battle?
call nz, EnemySendOutFirstMon ; if it is a trainer battle, send out enemy mon
@ -345,8 +345,8 @@ StartBattle: ; 3c11e (f:411e)
; wild mon or link battle enemy ran from battle
EnemyRan: ; 3c202 (f:4202)
call LoadScreenTilesFromBuffer1
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
ld hl, WildRanText
jr nz, .printText
; link battle
@ -431,11 +431,11 @@ MainInBattleLoop: ; 3c233 (f:4233)
jr nz, MainInBattleLoop ; if the player didn't select a move, jump
.selectEnemyMove
call SelectEnemyMove
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr nz, .noLinkBattle
; link battle
ld a, [wcc3e]
ld a, [wSerialExchangeNybbleReceiveData]
cp $f
jp z, EnemyRan
cp $e
@ -838,7 +838,7 @@ FaintEnemyPokemon ; 0x3c567
ld hl, W_PLAYERBATTSTATUS1
res AttackingMultipleTimes, [hl]
xor a
ld [W_NUMHITS], a
ld [wPlayerNumHits], a
ld hl, wd065 ; clear enemy statuses
ld [hli], a
ld [hli], a
@ -976,12 +976,12 @@ ReplaceFaintedEnemyMon: ; 3c664 (f:4664)
ld e, $30
call GetBattleHealthBarColor
callab DrawEnemyPokeballs
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr nz, .notLinkBattle
; link battle
call LinkBattleExchangeData
ld a, [wcc3e]
ld a, [wSerialExchangeNybbleReceiveData]
cp $f
ret z
call LoadScreenTilesFromBuffer1
@ -1009,14 +1009,14 @@ TrainerBattleVictory: ; 3c696 (f:4696)
ld hl, W_FLAGS_D733
set 1, [hl]
.notrival
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
ld a, b
call nz, PlayBattleVictoryMusic
ld hl, TrainerDefeatedText
call PrintText
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
ret z
call ScrollTrainerPicAfterBattle
ld c, $28
@ -1096,7 +1096,7 @@ RemoveFaintedPlayerMon: ; 3c741 (f:4741)
ld [wd083], a
call WaitForSoundToFinish
.skipWaitForSound
ld hl, wcd05
ld hl, wEnemyNumHits
ld [hli], a
ld [hl], a
ld [wBattleMonStatus], a
@ -1136,7 +1136,7 @@ DoUseNextMonDialogue: ; 3c79b (f:479b)
hlCoord 13, 9
ld bc, $a0e
ld a, $14 ; yes/no text box
ld [wd125], a
ld [wTextBoxID], a
call DisplayTextBoxID
ld a, [wd12e]
cp $2 ; did the player choose NO?
@ -1169,8 +1169,8 @@ ChooseNextMon: ; 3c7d8 (f:47d8)
.monChosen
call HasMonFainted
jr z, .goBackToPartyMenu ; if mon fainted, you have to choose another
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr nz, .notLinkBattle
inc a
ld [wcd6a], a
@ -1204,8 +1204,8 @@ ChooseNextMon: ; 3c7d8 (f:47d8)
; called when player is out of usable mons.
; prints approriate lose message, sets carry flag if player blacked out (special case for initial rival fight)
HandlePlayerBlackOut: ; 3c837 (f:4837)
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr z, .notSony1Battle
ld a, [W_CUROPPONENT]
cp $c8 + SONY1
@ -1225,8 +1225,8 @@ HandlePlayerBlackOut: ; 3c837 (f:4837)
ld b, $0
call GoPAL_SET
ld hl, PlayerBlackedOutText2
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr nz, .noLinkBattle
ld hl, LinkBattleLostText
.noLinkBattle
@ -1385,10 +1385,10 @@ EnemySendOutFirstMon: ; 3c92a (f:492a)
call SlideTrainerPicOffScreen
call PrintEmptyString
call SaveScreenTilesToBuffer1
ld a,[W_ISLINKBATTLE]
cp 4
ld a,[wLinkState]
cp LINK_STATE_BATTLING
jr nz,.next
ld a,[wcc3e]
ld a,[wSerialExchangeNybbleReceiveData]
sub 4
ld [wWhichPokemon],a
jr .next3
@ -1442,8 +1442,8 @@ EnemySendOutFirstMon: ; 3c92a (f:492a)
ld a,[wPartyCount]
dec a
jr z,.next4
ld a,[W_ISLINKBATTLE]
cp 4
ld a,[wLinkState]
cp LINK_STATE_BATTLING
jr z,.next4
ld a,[W_OPTIONS]
bit 6,a
@ -1453,7 +1453,7 @@ EnemySendOutFirstMon: ; 3c92a (f:492a)
hlCoord 0, 7
ld bc,$0801
ld a,$14
ld [wd125],a
ld [wTextBoxID],a
call DisplayTextBoxID
ld a,[wCurrentMenuItem]
and a
@ -1572,8 +1572,8 @@ TryRunningFromBattle: ; 3cab9 (f:4ab9)
ld a, [W_BATTLETYPE]
cp $2
jp z, .canEscape ; jump if it's a safari battle
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jp z, .canEscape
ld a, [W_ISINBATTLE]
dec a
@ -1654,8 +1654,8 @@ TryRunningFromBattle: ; 3cab9 (f:4ab9)
and a ; reset carry
ret
.canEscape
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
ld a, $2
jr nz, .playSound
; link battle
@ -1666,7 +1666,7 @@ TryRunningFromBattle: ; 3cab9 (f:4ab9)
ld [wPlayerMoveListIndex], a
call LinkBattleExchangeData
call LoadScreenTilesFromBuffer1
ld a, [wcc3e]
ld a, [wSerialExchangeNybbleReceiveData]
cp $f
ld a, $2
jr z, .playSound
@ -2082,7 +2082,7 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3)
jr nz, .menuselected
ld a, $1b ; regular menu id
.menuselected
ld [wd125], a
ld [wTextBoxID], a
call DisplayTextBoxID
ld a, [W_BATTLETYPE]
dec a
@ -2234,8 +2234,8 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3)
jp nz, PartyMenuOrRockOrRun
; either the bag (normal battle) or bait (safari battle) was selected
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr nz, .notLinkBattle
; can't use items in link battles
@ -2401,7 +2401,7 @@ PartyMenuOrRockOrRun:
jr .checkIfPartyMonWasSelected
.partyMonWasSelected
ld a, $c ; switch/stats/cancel menu
ld [wd125], a
ld [wTextBoxID], a
call DisplayTextBoxID
ld hl, wTopMenuItemY
ld a, $c
@ -2620,8 +2620,8 @@ MoveSelectionMenu: ; 3d219 (f:5219)
dec a
ld b, $c3
jr z, .matchedkeyspicked
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr z, .matchedkeyspicked
ld a, [W_FLAGS_D733]
bit 0, a
@ -2974,14 +2974,14 @@ TypeText: ; 3d55f (f:555f)
db "TYPE@"
SelectEnemyMove: ; 3d564 (f:5564)
ld a, [W_ISLINKBATTLE]
ld a, [wLinkState]
sub $4
jr nz, .noLinkBattle
; link battle
call SaveScreenTilesToBuffer1
call LinkBattleExchangeData
call LoadScreenTilesFromBuffer1
ld a, [wcc3e]
ld a, [wSerialExchangeNybbleReceiveData]
cp $e
jp z, .asm_3d601
cp $d
@ -3068,7 +3068,7 @@ SelectEnemyMove: ; 3d564 (f:5564)
; this appears to exchange data with the other gameboy during link battles
LinkBattleExchangeData: ; 3d605 (f:5605)
ld a, $ff
ld [wcc3e], a
ld [wSerialExchangeNybbleReceiveData], a
ld a, [wPlayerMoveListIndex]
cp $f ; is the player running from battle?
jr z, .asm_3d630
@ -3091,24 +3091,24 @@ LinkBattleExchangeData: ; 3d605 (f:5605)
.asm_3d62f
ld a, b
.asm_3d630
ld [wcc42], a
ld [wSerialExchangeNybbleSendData], a
callab PrintWaitingText
.asm_3d63b
call Func_22c3
call Serial_ExchangeNybble
call DelayFrame
ld a, [wcc3e]
ld a, [wSerialExchangeNybbleReceiveData]
inc a
jr z, .asm_3d63b
ld b, $a
.asm_3d649
call DelayFrame
call Func_22c3
call Serial_ExchangeNybble
dec b
jr nz, .asm_3d649
ld b, $a
.asm_3d654
call DelayFrame
call Func_22ed
call Serial_SendZeroByte
dec b
jr nz, .asm_3d654
ret
@ -3296,7 +3296,7 @@ MirrorMoveCheck
ld hl,MultiHitText
call PrintText
xor a
ld [W_NUMHITS],a
ld [wPlayerNumHits],a
.executeOtherEffects
ld a,[W_PLAYERMOVEEFFECT]
and a
@ -3529,7 +3529,7 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854)
ld a,[hli]
ld b,a
ld c,[hl]
ld hl,wd075
ld hl,wPlayerBideAccumulatedDamage + 1
ld a,[hl]
add c ; acumulate damage taken
ld [hld],a
@ -3548,7 +3548,7 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854)
call PrintText
ld a,1
ld [W_PLAYERMOVEPOWER],a
ld hl,wd075
ld hl,wPlayerBideAccumulatedDamage + 1
ld a,[hld]
add a
ld b,a
@ -3998,8 +3998,8 @@ OHKOText: ; 3dc83 (f:5c83)
CheckForDisobedience: ; 3dc88 (f:5c88)
xor a
ld [wcced], a
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr nz, .checkIfMonIsTraded
ld a, $1
and a
@ -4424,8 +4424,8 @@ GetDamageVarsForEnemyAttack: ; 3de75 (f:5e75)
GetEnemyMonStat: ; 3df1c (f:5f1c)
push de
push bc
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr nz, .notLinkBattle
ld hl, wEnemyMon1Stats
dec c
@ -5627,11 +5627,11 @@ ExecuteEnemyMove: ; 3e6bc (f:66bc)
jp z, ExecuteEnemyMoveDone
call PrintGhostText
jp z, ExecuteEnemyMoveDone
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr nz, .executeEnemyMove
ld b, $1
ld a, [wcc3e]
ld a, [wSerialExchangeNybbleReceiveData]
cp $e
jr z, .executeEnemyMove
cp $4
@ -5819,7 +5819,7 @@ asm_3e7ef: ; 3e7ef (f:67ef)
ld hl, HitXTimesText
call PrintText
xor a
ld [wcd05], a
ld [wEnemyNumHits], a
.asm_3e873
ld a, [W_ENEMYMOVEEFFECT]
and a
@ -6028,7 +6028,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
ld a, [hli]
ld b, a
ld c, [hl]
ld hl, wcd06
ld hl, wEnemyBideAccumulatedDamage + 1
ld a, [hl]
add c
ld [hld], a
@ -6047,7 +6047,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
call PrintText
ld a, $1
ld [W_ENEMYMOVEPOWER], a
ld hl, wcd06
ld hl, wEnemyBideAccumulatedDamage + 1
ld a, [hld]
add a
ld b, a
@ -6152,8 +6152,8 @@ GetCurrentMove: ; 3eabe (f:6abe)
jp CopyStringToCF4B
LoadEnemyMonData: ; 3eb01 (f:6b01)
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jp z, LoadEnemyMonFromParty
ld a, [wEnemyMonSpecies2]
ld [wEnemyMonSpecies], a
@ -6312,8 +6312,8 @@ LoadEnemyMonData: ; 3eb01 (f:6b01)
; calls BattleTransition to show the battle transition animation and initializes some battle variables
DoBattleTransitionAndInitBattleVariables: ; 3ec32 (f:6c32)
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr nz, .next
; link battle
xor a
@ -6616,8 +6616,8 @@ CalculateModifiedStat: ; 3eda5 (f:6da5)
ret
ApplyBadgeStatBoosts: ; 3ee19 (f:6e19)
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
ret z ; return if link battle
ld a, [W_OBTAINEDBADGES]
ld b, a
@ -6706,19 +6706,19 @@ PrintEmptyString: ; 3ee94 (f:6e94)
BattleRandom:
; Link battles use a shared PRNG.
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jp nz, Random
push hl
push bc
ld a, [wLinkBattleRNCount]
ld a, [wLinkBattleRandomNumberListIndex]
ld c, a
ld b, 0
ld hl, wd148
ld hl, wLinkBattleRandomNumberList
add hl, bc
inc a
ld [wLinkBattleRNCount], a
ld [wLinkBattleRandomNumberListIndex], a
cp 9
ld a, [hl]
pop bc
@ -6732,8 +6732,9 @@ BattleRandom:
; point to seed 0 so we pick the first number the next time
xor a
ld [wLinkBattleRNCount], a
ld hl, wd148
ld [wLinkBattleRandomNumberListIndex], a
ld hl, wLinkBattleRandomNumberList
ld b, 9
.loop
ld a, [hl]
@ -6939,7 +6940,7 @@ _LoadTrainerPic: ; 3f04b (f:704b)
ld e, a
ld a, [wd034]
ld d, a ; de contains pointer to trainer pic
ld a, [W_ISLINKBATTLE]
ld a, [wLinkState]
and a
ld a, Bank(TrainerPics) ; this is where all the trainer pics are (not counting Red's)
jr z, .loadSprite
@ -7698,8 +7699,8 @@ StatModifierDownEffect: ; 3f54c (f:754c)
ld hl, wPlayerMonStatMods
ld de, W_ENEMYMOVEEFFECT
ld bc, W_PLAYERBATTSTATUS1
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr z, .statModifierDownEffect
call BattleRandom
cp $40 ; 1/4 chance to miss by in regular battle
@ -7934,13 +7935,13 @@ StatModifierRatios: ; 3f6cb (f:76cb)
BideEffect: ; 3f6e5 (f:76e5)
ld hl, W_PLAYERBATTSTATUS1
ld de, W_NUMHITS
ld de, wPlayerBideAccumulatedDamage
ld bc, wPlayerNumAttacksLeft
ld a, [H_WHOSETURN]
and a
jr z, .bideEffect
ld hl, W_ENEMYBATTSTATUS1
ld de, wcd05
ld de, wEnemyBideAccumulatedDamage
ld bc, wEnemyNumAttacksLeft
.bideEffect
set StoringEnergy, [hl] ; mon is now using bide
@ -8096,13 +8097,13 @@ WasBlownAwayText: ; 3f80c (f:780c)
TwoToFiveAttacksEffect: ; 3f811 (f:7811)
ld hl, W_PLAYERBATTSTATUS1
ld de, wPlayerNumAttacksLeft
ld bc, W_NUMHITS
ld bc, wPlayerNumHits
ld a, [H_WHOSETURN]
and a
jr z, .twoToFiveAttacksEffect
ld hl, W_ENEMYBATTSTATUS1
ld de, wEnemyNumAttacksLeft
ld bc, wcd05
ld bc, wEnemyNumHits
.twoToFiveAttacksEffect
bit AttackingMultipleTimes, [hl] ; is mon attacking multiple times?
ret nz
@ -8394,8 +8395,8 @@ MimicEffect: ; 3f9ed (f:79ed)
ld hl, wBattleMonMoves
ld a, [W_PLAYERBATTSTATUS1]
jr nz, .asm_3fa13
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr nz, .asm_3fa3a
ld hl, wEnemyMonMoves
ld a, [W_ENEMYBATTSTATUS1]
@ -8500,8 +8501,8 @@ DisableEffect: ; 3fa8a (f:7a8a)
and a
ld hl, wBattleMonPP
jr nz, .asm_3facf
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
pop hl
jr nz, .asm_3fae1
push hl
@ -8629,7 +8630,7 @@ ParalyzedMayNotAttackText: ; 3fb74 (f:7b74)
CheckTargetSubstitute: ; 3fb79 (f:7b79)
push hl
ld hl, W_ENEMYBATTSTATUS2
ld a, [$fff3]
ld a, [H_WHOSETURN]
and a
jr z, .next1
ld hl, W_PLAYERBATTSTATUS2

View file

@ -9,7 +9,7 @@ DisplayLinkBattleVersusTextBox: ; 372d6 (d:72d6)
ld de, wPlayerName
call PlaceString
hlCoord 4, 10
ld de, W_GRASSRATE ; enemy name
ld de, wLinkEnemyTrainerName
call PlaceString
; place bold "VS" tiles between the names
hlCoord 9, 8

View file

@ -700,7 +700,7 @@ Func_39c37: ; 39c37 (e:5c37)
ReadTrainer: ; 39c53 (e:5c53)
; don't change any moves in a link battle
ld a,[W_ISLINKBATTLE]
ld a,[wLinkState]
and a
ret nz
@ -872,8 +872,8 @@ TrainerAI: ; 3a52e (e:652e)
ld a,[W_ISINBATTLE]
dec a
ret z ; if not a trainer, we're done here
ld a,[W_ISLINKBATTLE]
cp 4
ld a,[wLinkState]
cp LINK_STATE_BATTLING
ret z
ld a,[W_TRAINERCLASS] ; what trainer class is this?
dec a
@ -1230,8 +1230,8 @@ SwitchEnemyMon: ; 3a74b (e:674b)
xor a
ld [wd11d],a
ld a,[W_ISLINKBATTLE]
cp 4
ld a,[wLinkState]
cp LINK_STATE_BATTLING
ret z
scf
ret

File diff suppressed because it is too large Load diff

View file

@ -7,10 +7,10 @@ Func_1c98a: ; 1c98a (7:498a)
call PrintText
hlCoord 14, 7
ld bc, $80f
ld a, $7
ld [wd12c], a
ld a, NO_YES_MENU
ld [wTwoOptionMenuID], a
ld a, $14
ld [wd125], a
ld [wTextBoxID], a
call DisplayTextBoxID
ld a, [wCurrentMenuItem] ; wCurrentMenuItem
and a

View file

@ -17,7 +17,7 @@ EvolveTradeMon: ; 17d7d (5:7d7d)
; This was fixed in Yellow.
ld a, [wTradeMonNick]
ld a, [wInGameTradeReceiveMonName]
; GRAVELER
cp "G"
@ -26,7 +26,7 @@ EvolveTradeMon: ; 17d7d (5:7d7d)
; "SPECTRE" (HAUNTER)
cp "S"
ret nz
ld a, [wTradeMonNick + 1]
ld a, [wInGameTradeReceiveMonName + 1]
cp "P"
ret nz
@ -36,9 +36,9 @@ EvolveTradeMon: ; 17d7d (5:7d7d)
ld [wWhichPokemon], a ; wWhichPokemon
ld a, $1
ld [wccd4], a
ld a, $32
ld [W_ISLINKBATTLE], a ; W_ISLINKBATTLE
ld a, LINK_STATE_TRADING
ld [wLinkState], a
callab TryEvolvingMon
xor a
ld [W_ISLINKBATTLE], a ; W_ISLINKBATTLE
xor a ; LINK_STATE_NONE
ld [wLinkState], a
jp PlayDefaultMusic

View file

@ -70,9 +70,9 @@ Evolution_PartyMonLoop: ; loop over party mons
cp EV_TRADE
jr z, .checkTradeEvo
; not trade evolution
ld a, [W_ISLINKBATTLE]
cp $32 ; in a trade?
jr z, Evolution_PartyMonLoop ; if so, go the next mon
ld a, [wLinkState]
cp LINK_STATE_TRADING
jr z, Evolution_PartyMonLoop ; if trading, go the next mon
ld a, b
cp EV_ITEM
jr z, .checkItemEvo
@ -83,9 +83,9 @@ Evolution_PartyMonLoop: ; loop over party mons
cp EV_LEVEL
jr z, .checkLevel
.checkTradeEvo
ld a, [W_ISLINKBATTLE]
cp $32 ; in a trade?
jp nz, .nextEvoEntry1 ; if not, go to the next evolution entry
ld a, [wLinkState]
cp LINK_STATE_TRADING
jp nz, .nextEvoEntry1 ; if not trading, go to the next evolution entry
ld a, [hli] ; level requirement
ld b, a
ld a, [wcfb9]
@ -246,8 +246,8 @@ Evolution_PartyMonLoop: ; loop over party mons
pop hl
pop af
ld [hTilesetType], a
ld a, [W_ISLINKBATTLE]
cp $32
ld a, [wLinkState]
cp LINK_STATE_TRADING
ret z
ld a, [W_ISINBATTLE]
and a
@ -312,9 +312,9 @@ IsEvolvingText: ; 3af4d (e:6f4d)
db "@"
Evolution_ReloadTilesetTilePatterns: ; 3af52 (e:6f52)
ld a, [W_ISLINKBATTLE] ; W_ISLINKBATTLE
cp $32 ; in a trade?
ret z ; if so, return
ld a, [wLinkState]
cp LINK_STATE_TRADING
ret z
jp ReloadTilesetTilePatterns
LearnMoveFromLevelUp: ; 3af5b (e:6f5b)

View file

@ -10,7 +10,7 @@ StartSlotMachine: ; 37e2d (d:7e2d)
ld a, [wTrainerSpriteOffset]
and a
ret z
ld a, [wcd05]
ld a, [wUnknownSlotVar]
ld b, a
ld a, [wTrainerFacingDirection]
inc a

View file

@ -97,9 +97,9 @@ HallOfFameText: ; 7026b (1c:426b)
Func_70278: ; 70278 (1c:4278)
call ClearScreen
ld a, $d0
ld [$ffaf], a
ld [hSCY], a
ld a, $c0
ld [$ffae], a
ld [hSCX], a
ld a, [wWhichTrade] ; wWhichTrade
ld [wcf91], a
ld [wd0b5], a
@ -132,16 +132,16 @@ Func_70278: ; 70278 (1c:4278)
.asm_702c7
call .asm_702d5
xor a
ld [$ffaf], a
ld [hSCY], a
ld c, a
call Func_7036d
ld d, $0
ld e, $fc
.asm_702d5
call DelayFrame
ld a, [$ffae]
ld a, [hSCX]
add e
ld [$ffae], a
ld [hSCX], a
cp d
jr nz, .asm_702d5
ret
@ -200,7 +200,7 @@ Func_7033e: ; 7033e (1c:433e)
Func_7036d: ; 7036d (1c:436d)
ld b, $0
hlCoord 12, 5
predef_jump Func_79dda
predef_jump CopyTileIDsFromList
Func_70377: ; 70377 (1c:4377)
ld hl, wd747

View file

@ -67,7 +67,7 @@ DisplayMonFrontSpriteInBox: ; 5dbd9 (17:5bd9)
ld [hWY], a
call SaveScreenTilesToBuffer1
ld a, $11
ld [wd125], a
ld [wTextBoxID], a
call DisplayTextBoxID
call UpdateSprites
ld a, [wcf91]

View file

@ -1,4 +1,4 @@
Predef54: ; 71ad9 (1c:5ad9)
DoInGameTradeDialogue: ; 71ad9 (1c:5ad9)
; trigger the trade offer/action specified by wWhichTrade
call SaveScreenTilesToBuffer2
ld hl,TradeMons
@ -8,15 +8,15 @@ Predef54: ; 71ad9 (1c:5ad9)
sub b
sub b
ld c,a
ld b,$0
ld b,0
add hl,bc
ld a,[hli]
ld [wcd0f],a
ld [wInGameTradeGiveMonSpecies],a
ld a,[hli]
ld [wcd34],a
ld [wInGameTradeReceiveMonSpecies],a
ld a,[hli]
push af
ld de,wcd29
ld de,wInGameTradeMonNick
ld bc,$000b
call CopyData
pop af
@ -26,16 +26,16 @@ Predef54: ; 71ad9 (1c:5ad9)
add hl,hl
add hl,de
ld a,[hli]
ld [wcd10],a
ld [wInGameTradeTextPointerTablePointer],a
ld a,[hl]
ld [wcd11],a
ld a,[wcd0f]
ld de,wcd13
call Func_71b6a
ld a,[wcd34]
ld de,wPlayerMonAccuracyMod
call Func_71b6a
ld hl,wd737
ld [wInGameTradeTextPointerTablePointer + 1],a
ld a,[wInGameTradeGiveMonSpecies]
ld de,wInGameTradeGiveMonName
call InGameTrade_GetMonName
ld a,[wInGameTradeReceiveMonSpecies]
ld de,wInGameTradeReceiveMonName
call InGameTrade_GetMonName
ld hl,wCompletedInGameTradeFlags
ld a,[wWhichTrade]
ld c,a
ld b,$2
@ -43,28 +43,29 @@ Predef54: ; 71ad9 (1c:5ad9)
ld a,c
and a
ld a,$4
ld [wcd12],a
jr nz,.asm_99bca ; 0x71b36 $20
ld [wInGameTradeTextPointerTableIndex],a
jr nz,.printText
; if the trade hasn't been done yet
xor a
ld [wcd12],a
call .asm_99bca
ld [wInGameTradeTextPointerTableIndex],a
call .printText
ld a,$1
ld [wcd12],a
ld [wInGameTradeTextPointerTableIndex],a
call YesNoChoice
ld a,[wCurrentMenuItem]
and a
jr nz,.asm_99bca ; 0x71b4b $b
call Func_71c07
jr c,.asm_99bca ; 0x71b50 $6
jr nz,.printText
call InGameTrade_DoTrade
jr c,.printText
ld hl, TradedForText
call PrintText
.asm_99bca ; 0x71b58
ld hl,wcd12
ld a,[hld]
.printText
ld hl,wInGameTradeTextPointerTableIndex
ld a,[hld] ; wInGameTradeTextPointerTableIndex
ld e,a
ld d,$0
ld a,[hld]
ld l,[hl]
ld d,0
ld a,[hld] ; wInGameTradeTextPointerTablePointer + 1
ld l,[hl] ; wInGameTradeTextPointerTablePointer
ld h,a
add hl,de
add hl,de
@ -73,7 +74,8 @@ Predef54: ; 71ad9 (1c:5ad9)
ld l,a
jp PrintText
Func_71b6a: ; 71b6a (1c:5b6a)
; copies name of species a to hl
InGameTrade_GetMonName: ; 71b6a (1c:5b6a)
push de
ld [wd11e],a
call GetMonName
@ -84,30 +86,30 @@ Func_71b6a: ; 71b6a (1c:5b6a)
INCLUDE "data/trades.asm"
Func_71c07: ; 71c07 (1c:5c07)
InGameTrade_DoTrade: ; 71c07 (1c:5c07)
xor a
ld [wd07d],a
dec a
ld [wUpdateSpritesEnabled],a
call DisplayPartyMenu
push af
call Func_71ca2
call InGameTrade_RestoreScreen
pop af
ld a,$1
jp c,.asm_c4bc2
ld a,[wcd0f]
jp c,.tradeFailed ; jump if the player didn't select a pokemon
ld a,[wInGameTradeGiveMonSpecies]
ld b,a
ld a,[wcf91]
cp b
ld a,$2
jr nz,.asm_c4bc2 ; 0x71c26 $75
jr nz,.tradeFailed ; jump if the selected mon's species is not the required one
ld a,[wWhichPokemon]
ld hl,wPartyMon1Level
ld bc,$002c
call AddNTimes
ld a,[hl]
ld [W_CURENEMYLVL],a
ld hl,wd737
ld hl,wCompletedInGameTradeFlags
ld a,[wWhichTrade]
ld c,a
ld b,$1
@ -119,13 +121,13 @@ Func_71c07: ; 71c07 (1c:5c07)
ld a,[W_CURENEMYLVL]
push af
call LoadHpBarAndStatusTilePatterns
call Func_71cc1
call InGameTrade_PrepareTradeData
predef Func_410e2
pop af
ld [W_CURENEMYLVL],a
pop af
ld [wWhichPokemon],a
ld a,[wcd34]
ld a,[wInGameTradeReceiveMonSpecies]
ld [wcf91],a
xor a
ld [wcc49],a
@ -134,64 +136,64 @@ Func_71c07: ; 71c07 (1c:5c07)
ld a,$80
ld [wcc49],a
call AddPartyMon
call Func_71d19
call InGameTrade_CopyDataToReceivedMon
callab EvolveTradeMon
call ClearScreen
call Func_71ca2
call InGameTrade_RestoreScreen
callba RedrawMapView
and a
ld a,$3
jr .asm_ee803 ; 0x71c9b $1
.asm_c4bc2 ; 0x71c9d
jr .tradeSucceeded
.tradeFailed
scf
.asm_ee803 ; 0x71c9e
ld [wcd12],a
.tradeSucceeded
ld [wInGameTradeTextPointerTableIndex],a
ret
Func_71ca2: ; 71ca2 (1c:5ca2)
InGameTrade_RestoreScreen: ; 71ca2 (1c:5ca2)
call GBPalWhiteOutWithDelay3
call RestoreScreenTilesAndReloadTilePatterns
call ReloadTilesetTilePatterns
call LoadScreenTilesFromBuffer2
call Delay3
call LoadGBPal
ld c, $a
ld c, 10
call DelayFrames
ld b, BANK(LoadWildData)
ld hl, LoadWildData
jp Bankswitch
Func_71cc1: ; 71cc1 (1c:5cc1)
ld hl, wWhichTrade ; wWhichTrade
ld a, [wcd0f]
ld [hli], a
ld a, [wcd34]
ld [hl], a
ld hl, wPartyMonOT ; wd273
InGameTrade_PrepareTradeData: ; 71cc1 (1c:5cc1)
ld hl, wTradedPlayerMonSpecies
ld a, [wInGameTradeGiveMonSpecies]
ld [hli], a ; wTradedPlayerMonSpecies
ld a, [wInGameTradeReceiveMonSpecies]
ld [hl], a ; wTradedEnemyMonSpecies
ld hl, wPartyMonOT
ld bc, $b
ld a, [wWhichPokemon] ; wWhichPokemon
ld a, [wWhichPokemon]
call AddNTimes
ld de, wTrainerScreenX
ld de, wTradedPlayerMonOT
ld bc, $b
call Func_71d11
ld hl, String_71d59 ; $5d59
call InGameTrade_CopyData
ld hl, InGameTrade_TrainerString
ld de, wcd4e
call Func_71d11
ld de, W_GRASSRATE ; W_GRASSRATE
call Func_71d11
ld hl, wPartyMon1OTID ; wPartyMon1OTID
ld bc, $2c
ld a, [wWhichPokemon] ; wWhichPokemon
call InGameTrade_CopyData
ld de, W_GRASSRATE
call InGameTrade_CopyData
ld hl, wPartyMon1OTID
ld bc, wPartyMon2 - wPartyMon1
ld a, [wWhichPokemon]
call AddNTimes
ld de, wcd4c
ld de, wTradedPlayerMonOTID
ld bc, $2
call Func_71d11
call InGameTrade_CopyData
call Random
ld hl, hRandomAdd
ld de, wcd59
ld de, wTradedEnemyMonOTID
jp CopyData
Func_71d11: ; 71d11 (1c:5d11)
InGameTrade_CopyData: ; 71d11 (1c:5d11)
push hl
push bc
call CopyData
@ -199,35 +201,37 @@ Func_71d11: ; 71d11 (1c:5d11)
pop hl
ret
Func_71d19: ; 71d19 (1c:5d19)
ld hl, wPartyMonNicks ; wPartyMonNicks
InGameTrade_CopyDataToReceivedMon: ; 71d19 (1c:5d19)
ld hl, wPartyMonNicks
ld bc, $b
call Func_71d4f
ld hl, wcd29
call InGameTrade_GetReceivedMonPointer
ld hl, wInGameTradeMonNick
ld bc, $b
call CopyData
ld hl, wPartyMonOT ; wd273
ld hl, wPartyMonOT
ld bc, $b
call Func_71d4f
ld hl, String_71d59 ; $5d59
call InGameTrade_GetReceivedMonPointer
ld hl, InGameTrade_TrainerString
ld bc, $b
call CopyData
ld hl, wPartyMon1OTID ; wPartyMon1OTID
ld bc, $2c
call Func_71d4f
ld hl, wcd59
ld hl, wPartyMon1OTID
ld bc, wPartyMon2 - wPartyMon1
call InGameTrade_GetReceivedMonPointer
ld hl, wTradedEnemyMonOTID
ld bc, $2
jp CopyData
Func_71d4f: ; 71d4f (1c:5d4f)
ld a, [wPartyCount] ; wPartyCount
; the received mon's index is (partyCount - 1),
; so this adds bc to hl (partyCount - 1) times and moves the result to de
InGameTrade_GetReceivedMonPointer: ; 71d4f (1c:5d4f)
ld a, [wPartyCount]
dec a
call AddNTimes
ld e, l
ld d, h
ret
String_71d59: ; 71d59 (1c:5d59)
InGameTrade_TrainerString: ; 71d59 (1c:5d59)
; "TRAINER@@@@@@@@@@"
db $5d, "@@@@@@@@@@"

View file

@ -7,7 +7,7 @@ PlayIntro: ; 41682 (10:5682)
call PlayIntroScene
call GBFadeOutToWhite
xor a
ld [$ffae], a
ld [hSCX], a
ld [H_AUTOBGTRANSFERENABLED], a
call ClearSprites
call DelayFrame
@ -21,7 +21,7 @@ PlayIntroScene: ; 4169d (10:569d)
ld [rOBP0], a
ld [rOBP1], a
xor a
ld [$ffae], a
ld [hSCX], a
ld b, $3
call Func_4183f
ld a, 0
@ -229,7 +229,7 @@ Func_4180e: ; 4180e (10:580e)
jr z, .asm_4181d
cp $1
jr z, .asm_4182d
ld a, [$ffae]
ld a, [hSCX]
dec a
dec a
jr .asm_41831
@ -243,11 +243,11 @@ Func_4180e: ; 4180e (10:580e)
call Func_417ae
pop de
.asm_4182d
ld a, [$ffae]
ld a, [hSCX]
inc a
inc a
.asm_41831
ld [$ffae], a
ld [hSCX], a
push de
ld c, $2
call CheckForUserInterruption
@ -260,9 +260,9 @@ Func_4180e: ; 4180e (10:580e)
Func_4183f: ; 4183f (10:583f)
hlCoord 13, 7
Func_41842: ; 41842 (10:5842)
CopyTileIDsFromList_ZeroBaseTileID: ; 41842 (10:5842)
ld c, $0
predef_jump Func_79dda
predef_jump CopyTileIDsFromList
Func_41849: ; 41849 (10:5849)
predef Func_79869

View file

@ -2098,7 +2098,7 @@ ItemUseTMHM: ; e479 (3:6479)
hlCoord 14, 7
ld bc,$080f
ld a,$14
ld [wd125],a
ld [wTextBoxID],a
call DisplayTextBoxID ; yes/no menu
ld a,[wCurrentMenuItem]
and a
@ -2489,7 +2489,7 @@ TossItem_: ; e6f1 (3:66f1)
hlCoord 14, 7
ld bc,$080f
ld a,$14
ld [wd125],a
ld [wTextBoxID],a
call DisplayTextBoxID ; yes/no menu
ld a,[wd12e]
cp a,2

View file

@ -79,7 +79,7 @@ AbandonLearning: ; 6eda (1:6eda)
hlCoord 14, 7
ld bc, $80f
ld a, $14
ld [wd125], a
ld [wTextBoxID], a
call DisplayTextBoxID
ld a, [wCurrentMenuItem] ; wCurrentMenuItem
and a
@ -102,7 +102,7 @@ TryingToLearn: ; 6f07 (1:6f07)
hlCoord 14, 7
ld bc, $80f
ld a, $14
ld [wd125], a
ld [wTextBoxID], a
call DisplayTextBoxID
pop hl
ld a, [wCurrentMenuItem] ; wCurrentMenuItem

View file

@ -508,48 +508,48 @@ MonWasReleasedText: ; 0x21820
TX_FAR _MonWasReleasedText
db "@"
PrintJustAMomentText1:: ; 5824 (8:5825)
ld a, [$ffaa]
cp $1
CableClubLeftGameboy:: ; 5824 (8:5825)
ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
ret z
ld a, [wSpriteStateData1 + 9]
cp $c
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction
cp SPRITE_FACING_RIGHT
ret nz
ld a, [W_CURMAP]
cp BATTLE_CENTER
ld a, $2
ld a, LINK_STATE_START_TRADE
jr z, .asm_2183a
inc a
inc a ; LINK_STATE_START_BATTLE
.asm_2183a
ld [W_ISLINKBATTLE], a
ld [wLinkState], a
call EnableAutoTextBoxDrawing
ld a, $22
ld a, $22 ; JustAMomentText
jp PrintPredefTextID
PrintJustAMomentText2:: ; 5845 (8:5845)
ld a, [$ffaa]
cp $2
CableClubRightGameboy:: ; 5845 (8:5845)
ld a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
ret z
ld a, [wSpriteStateData1 + 9]
cp $8
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction
cp SPRITE_FACING_LEFT
ret nz
ld a, [W_CURMAP]
cp BATTLE_CENTER
ld a, $2
ld a, LINK_STATE_START_TRADE
jr z, .asm_2185a
inc a
inc a ; LINK_STATE_START_BATTLE
.asm_2185a
ld [W_ISLINKBATTLE], a
ld [wLinkState], a
call EnableAutoTextBoxDrawing
ld a, $22
ld a, $22 ; JustAMomentText
jp PrintPredefTextID
JustAMomentText:: ; 21865 (8:5865)
TX_FAR _JustAMomentText
db "@"
ld a, [wSpriteStateData1 + 9]
cp $4
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction
cp SPRITE_FACING_UP
ret nz
call EnableAutoTextBoxDrawing
ld a, $23

View file

@ -14,7 +14,7 @@ DisplayDiploma: ; 566e2 (15:66e2)
call FarCopyData2
ld hl, wTileMap
ld bc, $1012
predef Func_5ab0
predef Diploma_TextBoxBorder
ld hl, DiplomaTextPointersAndCoords ; $6784
ld c, $5
.asm_56715

View file

@ -14,8 +14,8 @@ MainMenu: ; 5af2 (1:5af2)
.next0
ld c,20
call DelayFrames
xor a
ld [W_ISLINKBATTLE],a
xor a ; LINK_STATE_NONE
ld [wLinkState],a
ld hl,wcc2b
ld [hli],a
ld [hli],a
@ -133,7 +133,7 @@ LinkMenu: ; 5c0a (1:5c0a)
ld [wd358], a
ld hl, wd72e
set 6, [hl]
ld hl, TextTerminator_6b20 ; $6b20
ld hl, TextTerminator_6b20
call PrintText
call SaveScreenTilesToBuffer1
ld hl, WhereWouldYouLikeText
@ -149,7 +149,7 @@ LinkMenu: ; 5c0a (1:5c0a)
xor a
ld [wcd37], a
ld [wd72d], a
ld hl, wTopMenuItemY ; wTopMenuItemY
ld hl, wTopMenuItemY
ld a, $7
ld [hli], a
ld a, $6
@ -163,97 +163,101 @@ LinkMenu: ; 5c0a (1:5c0a)
ld [hli], a
xor a
ld [hl], a
.asm_5c52
.waitForInputLoop
call HandleMenuInput
and $3
and A_BUTTON | B_BUTTON
add a
add a
ld b, a
ld a, [wCurrentMenuItem] ; wCurrentMenuItem
ld a, [wCurrentMenuItem]
add b
add $d0
ld [wcc42], a
ld [wcc43], a
.asm_5c66
call Func_2247
ld a, [wcc3d]
ld [wLinkMenuSelectionSendBuffer], a
ld [wLinkMenuSelectionSendBuffer + 1], a
.exchangeMenuSelectionLoop
call Serial_ExchangeLinkMenuSelection
ld a, [wLinkMenuSelectionReceiveBuffer]
ld b, a
and $f0
cp $d0
jr z, .asm_5c7d
ld a, [wcc3e]
ld a, [wLinkMenuSelectionReceiveBuffer + 1]
ld b, a
and $f0
cp $d0
jr nz, .asm_5c66
jr nz, .exchangeMenuSelectionLoop
.asm_5c7d
ld a, b
and $c
jr nz, .asm_5c8b
ld a, [wcc42]
and $c
jr z, .asm_5c52
jr .asm_5ca1
.asm_5c8b
ld a, [wcc42]
and $c
jr z, .asm_5c98
ld a, [$ffaa]
cp $2
jr z, .asm_5ca1
.asm_5c98
and $c ; did the enemy press A or B?
jr nz, .enemyPressedAOrB
; the enemy didn't press A or B
ld a, [wLinkMenuSelectionSendBuffer]
and $c ; did the player press A or B?
jr z, .waitForInputLoop ; if neither the player nor the enemy pressed A or B, try again
jr .doneChoosingMenuSelection ; if the player pressed A or B but the enemy didn't, use the player's selection
.enemyPressedAOrB
ld a, [wLinkMenuSelectionSendBuffer]
and $c ; did the player press A or B?
jr z, .useEnemyMenuSelection ; if the enemy pressed A or B but the player didn't, use the enemy's selection
; the enemy and the player both pressed A or B
; The gameboy that is clocking the connection wins.
ld a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr z, .doneChoosingMenuSelection
.useEnemyMenuSelection
ld a, b
ld [wcc42], a
ld [wLinkMenuSelectionSendBuffer], a
and $3
ld [wCurrentMenuItem], a ; wCurrentMenuItem
.asm_5ca1
ld a, [$ffaa]
cp $2
jr nz, .asm_5cb1
.doneChoosingMenuSelection
ld a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr nz, .skipStartingTransfer
call DelayFrame
call DelayFrame
ld a, $81
ld [$ff02], a
.asm_5cb1
ld a, START_TRANSFER_INTERNAL_CLOCK
ld [rSC], a
.skipStartingTransfer
ld b, $7f
ld c, $7f
ld d, $ec
ld a, [wcc42]
and $8
jr nz, .asm_5ccc
ld a, [wCurrentMenuItem] ; wCurrentMenuItem
ld a, [wLinkMenuSelectionSendBuffer]
and (B_BUTTON << 2) ; was B button pressed?
jr nz, .updateCursorPosition
; A button was pressed
ld a, [wCurrentMenuItem]
cp $2
jr z, .asm_5ccc
jr z, .updateCursorPosition
ld c, d
ld d, b
dec a
jr z, .asm_5ccc
jr z, .updateCursorPosition
ld b, c
ld c, d
.asm_5ccc
.updateCursorPosition
ld a, b
Coorda 6, 7
ld a, c
Coorda 6, 9
ld a, d
Coorda 6, 11
ld c, $28
ld c, 40
call DelayFrames
call LoadScreenTilesFromBuffer1
ld a, [wcc42]
and $8
jr nz, .asm_5d2d
ld a, [wCurrentMenuItem] ; wCurrentMenuItem
ld a, [wLinkMenuSelectionSendBuffer]
and (B_BUTTON << 2) ; was B button pressed?
jr nz, .choseCancel ; cancel if B pressed
ld a, [wCurrentMenuItem]
cp $2
jr z, .asm_5d2d
jr z, .choseCancel
xor a
ld [wWalkBikeSurfState], a
ld a, [wCurrentMenuItem] ; wCurrentMenuItem
ld [wWalkBikeSurfState], a ; start walking
ld a, [wCurrentMenuItem]
and a
ld a, TRADE_CENTER
jr nz, .asm_5cfc
jr nz, .next
ld a, BATTLE_CENTER
.asm_5cfc
.next
ld [wd72d], a
ld hl, PleaseWaitText
call PrintText
@ -261,23 +265,23 @@ LinkMenu: ; 5c0a (1:5c0a)
call DelayFrames
ld hl, wd732
res 1, [hl]
ld a, [W_ANIMATIONID] ; W_ANIMATIONID
ld a, [W_ANIMATIONID]
ld [wDestinationMap], a
call SpecialWarpIn
ld c, $14
call DelayFrames
xor a
ld [wMenuJoypadPollCount], a ; wMenuJoypadPollCount
ld [wcc42], a
inc a
ld [W_ISLINKBATTLE], a ; W_ISLINKBATTLE
ld [wMenuJoypadPollCount], a
ld [wSerialExchangeNybbleSendData], a
inc a ; LINK_STATE_IN_CABLE_CLUB
ld [wLinkState], a
ld [wcc47], a
jr SpecialEnterMap
.asm_5d2d
.choseCancel
xor a
ld [wMenuJoypadPollCount], a ; wMenuJoypadPollCount
ld [wMenuJoypadPollCount], a
call Delay3
call Func_72d7
call CloseLinkConnection
ld hl, LinkCanceledText
call PrintText
ld hl, wd72e

View file

@ -16,7 +16,7 @@ AskName: ; 64eb (1:64eb)
hlCoord 14, 7
ld bc, $80f
ld a, $14
ld [wd125], a
ld [wTextBoxID], a
call DisplayTextBoxID
pop hl
ld a, [wCurrentMenuItem] ; wCurrentMenuItem

View file

@ -31,7 +31,7 @@ StartMenu_Pokemon: ; 130a9 (4:70a9)
.chosePokemon
call SaveScreenTilesToBuffer1 ; save screen
ld a,$04
ld [wd125],a
ld [wTextBoxID],a
call DisplayTextBoxID ; display pokemon menu options
ld hl,wWhichTrade
ld bc,$020c ; max menu item ID, top menu item Y
@ -300,13 +300,13 @@ ItemMenuLoop: ; 132fc (4:72fc)
call GoPAL_SET_CF1C
StartMenu_Item: ; 13302 (4:7302)
ld a,[W_ISLINKBATTLE]
dec a
jr nz,.notInLinkBattle
ld a,[wLinkState]
dec a ; is the player in the Colosseum or Trade Centre?
jr nz,.notInCableClubRoom
ld hl,CannotUseItemsHereText
call PrintText
jr .exitMenu
.notInLinkBattle
.notInCableClubRoom
ld bc,wNumBagItems
ld hl,wcf8b
ld a,c
@ -342,7 +342,7 @@ StartMenu_Item: ; 13302 (4:7302)
jp z,.useOrTossItem
.notBicycle1
ld a,$06 ; use/toss menu
ld [wd125],a
ld [wTextBoxID],a
call DisplayTextBoxID
ld hl,wTopMenuItemY
ld a,11

View file

@ -2,7 +2,7 @@ VendingMachineMenu: ; 74ee0 (1d:4ee0)
ld hl, VendingMachineText1
call PrintText
ld a, $13
ld [wd125], a
ld [wTextBoxID], a
call DisplayTextBoxID
xor a
ld [wCurrentMenuItem], a ; wCurrentMenuItem
@ -70,7 +70,7 @@ VendingMachineMenu: ; 74ee0 (1d:4ee0)
ld c, $3
predef SubBCDPredef
ld a, $13
ld [wd125], a
ld [wTextBoxID], a
jp DisplayTextBoxID
.BagFull
ld hl, VendingMachineText6

View file

@ -382,7 +382,7 @@ GetPartyMonSpriteID: ; 718e9 (1c:58e9)
ld c, a
dec a
srl a
ld hl, MonPartyData ; $590d
ld hl, MonPartyData
ld e, a
ld d, $0
add hl, de

View file

@ -1,51 +1,51 @@
CableClubNPC: ; 71c5 (1:71c5)
ld hl, CableClubNPCText1
ld hl, CableClubNPCWelcomeText
call PrintText
ld a, [wd74b]
bit 5, a
jp nz, Func_71e1
bit 5, a ; received pokedex?
jp nz, .receivedPokedex
; if the player hasn't received the pokedex
ld c, $3c
call DelayFrames
ld hl, CableClubNPCText6
ld hl, CableClubNPCMakingPreparationsText
call PrintText
jp Func_7298
Func_71e1: ; 71e1 (1:71e1)
.receivedPokedex
ld a, $1
ld [wMenuJoypadPollCount], a
ld a, $5a
ld [wcc47], a
.asm_71eb
ld a, [$ffaa]
cp $2
jr z, .asm_721a ; 0x71ef $29
cp $1
jr z, .asm_721a ; 0x71f3 $25
ld a, $ff
ld [$ffaa], a
ld a, $2
ld a, 90
ld [wLinkTimeoutCounter], a
.establishConnectionLoop
ld a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr z, .establishedConnection
cp USING_EXTERNAL_CLOCK
jr z, .establishedConnection
ld a, CONNECTION_NOT_ESTABLISHED
ld [hSerialConnectionStatus], a
ld a, ESTABLISH_CONNECTION_WITH_EXTERNAL_CLOCK
ld [rSB], a
xor a
ld [$ffad], a
ld a, $80
ld [$ff02], a
ld a, [wcc47]
ld [hSerialReceiveData], a
ld a, START_TRANSFER_EXTERNAL_CLOCK
ld [rSC], a
ld a, [wLinkTimeoutCounter]
dec a
ld [wcc47], a
jr z, .asm_7287 ; 0x720b $7a
ld a, $1
ld [wLinkTimeoutCounter], a
jr z, .failedToEstablishConnection
ld a, ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK
ld [rSB], a
ld a, $81
ld [$ff02], a
ld a, START_TRANSFER_INTERNAL_CLOCK
ld [rSC], a
call DelayFrame
jr .asm_71eb ; 0x7218 $d1
.asm_721a
call Func_22ed
jr .establishConnectionLoop
.establishedConnection
call Serial_SendZeroByte
call DelayFrame
call Func_22ed
ld c, $32
call Serial_SendZeroByte
ld c, 50
call DelayFrames
ld hl, CableClubNPCText2
ld hl, CableClubNPCPleaseApplyHereHaveToSaveText
call PrintText
xor a
ld [wMenuJoypadPollCount], a
@ -54,22 +54,22 @@ Func_71e1: ; 71e1 (1:71e1)
ld [wMenuJoypadPollCount], a
ld a, [wCurrentMenuItem]
and a
jr nz, .asm_728f ; 0x723e $4f
jr nz, .choseNo
callab SaveSAVtoSRAM
call WaitForSoundToFinish
ld a, (SFX_02_5d - SFX_Headers_02) / 3
call PlaySoundWaitForCurrent
ld hl, CableClubNPCText3
ld hl, CableClubNPCPleaseWaitText
call PrintText
ld hl, wcc47
ld hl, wUnknownSerialCounter
ld a, $3
ld [hli], a
xor a
ld [hl], a
ld [$ffa9], a
ld [wcc42], a
call Func_227f
ld hl, wcc47
ld [hSerialReceivedNewData], a
ld [wSerialExchangeNybbleSendData], a
call Serial_SyncAndExchangeNybble
ld hl, wUnknownSerialCounter
ld a, [hli]
inc a
jr nz, Func_72a8 ; 0x726b $3b
@ -79,26 +79,26 @@ Func_71e1: ; 71e1 (1:71e1)
ld b, $a
.asm_7273
call DelayFrame
call Func_22ed
call Serial_SendZeroByte
dec b
jr nz, .asm_7273 ; 0x727a $f7
call Func_72d7
ld hl, CableClubNPCText4
call CloseLinkConnection
ld hl, CableClubNPCLinkClosedBecauseOfInactivityText
call PrintText
jr Func_7298 ; 0x7285 $11
.asm_7287
ld hl, CableClubNPCText7
.failedToEstablishConnection
ld hl, CableClubNPCAreaReservedFor2FriendsLinkedByCableText
call PrintText
jr Func_7298 ; 0x728d $9
.asm_728f
call Func_72d7
ld hl, CableClubNPCText5
.choseNo
call CloseLinkConnection
ld hl, CableClubNPCPleaseComeAgainText
call PrintText
; fall through
Func_7298: ; 7298 (1:7298)
xor a
ld hl, wcc47
ld hl, wUnknownSerialCounter
ld [hli], a
ld [hl], a
ld hl, wd72e
@ -115,42 +115,42 @@ Func_72a8: ; 72a8 (1:72a8)
ld b, BANK(LinkMenu)
jp Bankswitch
CableClubNPCText7: ; 72b3 (1:72b3)
TX_FAR _CableClubNPCText7
CableClubNPCAreaReservedFor2FriendsLinkedByCableText: ; 72b3 (1:72b3)
TX_FAR _CableClubNPCAreaReservedFor2FriendsLinkedByCableText
db "@"
CableClubNPCText1: ; 72b8 (1:72b8)
TX_FAR _CableClubNPCText1
CableClubNPCWelcomeText: ; 72b8 (1:72b8)
TX_FAR _CableClubNPCWelcomeText
db "@"
CableClubNPCText2: ; 72bd (1:72bd)
TX_FAR _CableClubNPCText2
CableClubNPCPleaseApplyHereHaveToSaveText: ; 72bd (1:72bd)
TX_FAR _CableClubNPCPleaseApplyHereHaveToSaveText
db "@"
CableClubNPCText3: ; 72c2 (1:72c2)
TX_FAR _CableClubNPCText3
CableClubNPCPleaseWaitText: ; 72c2 (1:72c2)
TX_FAR _CableClubNPCPleaseWaitText
db $a, "@"
CableClubNPCText4: ; 72c8 (1:72c8)
TX_FAR _CableClubNPCText4
CableClubNPCLinkClosedBecauseOfInactivityText: ; 72c8 (1:72c8)
TX_FAR _CableClubNPCLinkClosedBecauseOfInactivityText
db "@"
CableClubNPCText5: ; 72cd (1:72cd)
TX_FAR _CableClubNPCText5
CableClubNPCPleaseComeAgainText: ; 72cd (1:72cd)
TX_FAR _CableClubNPCPleaseComeAgainText
db "@"
CableClubNPCText6: ; 72d2 (1:72d2)
TX_FAR _CableClubNPCText6
CableClubNPCMakingPreparationsText: ; 72d2 (1:72d2)
TX_FAR _CableClubNPCMakingPreparationsText
db "@"
Func_72d7: ; 72d7 (1:72d7)
CloseLinkConnection: ; 72d7 (1:72d7)
call Delay3
ld a, $ff
ld [$ffaa], a
ld a, $2
ld a, CONNECTION_NOT_ESTABLISHED
ld [hSerialConnectionStatus], a
ld a, ESTABLISH_CONNECTION_WITH_EXTERNAL_CLOCK
ld [rSB], a
xor a
ld [$ffad], a
ld a, $80
ld [$ff02], a
ld [hSerialReceiveData], a
ld a, START_TRANSFER_EXTERNAL_CLOCK
ld [rSC], a
ret

View file

@ -6,7 +6,7 @@ ShakeElevator: ; 7bf15 (1e:7f15)
call Delay3
ld a, $ff
call PlaySound
ld a, [$ffaf]
ld a, [hSCY]
ld d, a
ld e, $1
; number of times to play collision sfx
@ -16,7 +16,7 @@ ShakeElevator: ; 7bf15 (1e:7f15)
xor $fe
ld e, a
add d
ld [$ffaf], a
ld [hSCY], a
push bc
ld c, BANK(SFX_02_5b)
ld a, (SFX_02_5b - SFX_Headers_02) / 3
@ -27,7 +27,7 @@ ShakeElevator: ; 7bf15 (1e:7f15)
dec b
jr nz, .asm_7bf30
ld a, d
ld [$ffaf], a
ld [hSCY], a
ld a, $ff
call PlaySound
ld c, BANK(SFX_02_5f)

View file

@ -12,10 +12,10 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20)
inc a
ld [wcf93],a
ld a,$13
ld [wd125],a
ld [wTextBoxID],a
call DisplayTextBoxID ; draw money text box
ld a,$15
ld [wd125],a
ld [wTextBoxID],a
call DisplayTextBoxID ; do buy/sell/quit menu
ld hl,wd128 ; pointer to this pokemart's inventory
ld a,[hli]
@ -46,7 +46,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20)
.sellMenuLoop
call LoadScreenTilesFromBuffer1 ; restore saved screen
ld a,$13
ld [wd125],a
ld [wTextBoxID],a
call DisplayTextBoxID ; draw money text box
ld hl,wNumBagItems
ld a,l
@ -80,7 +80,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20)
hlCoord 14, 7
ld bc,$080f
ld a,$14
ld [wd125],a
ld [wTextBoxID],a
call DisplayTextBoxID ; yes/no menu
ld a,[wd12e]
cp a,$02
@ -120,7 +120,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20)
.buyMenuLoop
call LoadScreenTilesFromBuffer1 ; restore saved screen
ld a,$13
ld [wd125],a
ld [wTextBoxID],a
call DisplayTextBoxID ; draw money text box
ld hl,wStringBuffer2 + 11
ld a,l
@ -151,7 +151,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20)
hlCoord 14, 7
ld bc,$080f
ld a,$14
ld [wd125],a
ld [wTextBoxID],a
call DisplayTextBoxID ; yes/no menu
ld a,[wd12e]
cp a,$02
@ -181,7 +181,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20)
.returnToMainPokemartMenu
call LoadScreenTilesFromBuffer1
ld a,$13
ld [wd125],a
ld [wTextBoxID],a
call DisplayTextBoxID ; draw money text box
ld hl,PokemartAnythingElseText
call PrintText

View file

@ -91,17 +91,17 @@ PredefPointers:: ; 4fe79 (13:7e79)
add_predef Func_48125
add_predef UpdateHPBar
add_predef HPBarLength
add_predef Func_5ab0
add_predef Diploma_TextBoxBorder
add_predef Func_3ed02
add_predef ShowPokedexMenu
add_predef EvolutionAfterBattle
add_predef SaveSAVtoSRAM0
add_predef InitOpponent
add_predef Func_5a5f
add_predef CableClub_Run
add_predef DrawBadges
add_predef Func_410f3
add_predef BattleTransition
add_predef Func_79dda
add_predef CopyTileIDsFromList
add_predef PlayIntro
add_predef Func_79869
add_predef FlashScreen
@ -129,14 +129,14 @@ PredefPointers:: ; 4fe79 (13:7e79)
add_predef LoadTownMap_Nest
add_predef Func_27d6b
add_predef EmotionBubble; 4C player exclamation
add_predef Func_5aaf; return immediately
add_predef EmptyFunc3; return immediately
add_predef AskName
add_predef PewterGuys
add_predef SaveSAVtoSRAM2
add_predef LoadSAVCheckSum2
add_predef LoadSAV
add_predef SaveSAVtoSRAM1
add_predef Predef54 ; 54 initiate trade
add_predef DoInGameTradeDialogue ; 54 initiate trade
add_predef HallOfFamePC
add_predef DisplayDexRating
dbw $1E, _LeaveMapAnim ; wrong bank

View file

@ -175,7 +175,7 @@ SaveSAVConfirm: ; 73768 (1c:7768)
hlCoord 0, 7
ld bc,$0801 ;arrow's coordinates |b = Y|c = X|
ld a,$14 ;one line shifting ($28 = 2 lines)
ld [wd125],a
ld [wTextBoxID],a
call DisplayTextBoxID ;handle Yes/No KeyPress
ld a,[wCurrentMenuItem]
ret

View file

@ -135,10 +135,10 @@ MainSlotMachineLoop: ; 37395 (d:7395)
call PrintText
ld hl, wTileMap + $fe
ld bc, $0d0f
xor a
ld [wd12c], a
xor a ; YES_NO_MENU
ld [wTwoOptionMenuID], a
ld a, $14
ld [wd125], a
ld [wTextBoxID], a
call DisplayTextBoxID
ld a, [wCurrentMenuItem]
and a

View file

@ -27,9 +27,9 @@ LoadTitlescreenGraphics: ; 42dd (1:42dd)
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
xor a
ld [hTilesetType], a
ld [$ffae], a
ld [hSCX], a
ld a, $40
ld [$ffaf], a
ld [hSCY], a
ld a, $90
ld [hWY], a
call ClearScreen

View file

@ -1,29 +1,29 @@
Func_410e2: ; 410e2 (10:50e2)
ld a, [wWhichTrade] ; wWhichTrade
ld a, [wTradedPlayerMonSpecies]
ld [wcd5e], a
ld a, [wTrainerEngageDistance]
ld a, [wTradedEnemyMonSpecies]
ld [wcd5f], a
ld de, PointerIDs_41138 ; $5138
ld de, PointerIDs_41138
jr Func_41102
Func_410f3: ; 410f3 (10:50f3)
ld a, [wTrainerEngageDistance]
ld a, [wTradedEnemyMonSpecies]
ld [wcd5e], a
ld a, [wTrainerSpriteOffset]
ld [wcd5f], a
ld de, PointerIDs_41149
Func_41102: ; 41102 (10:5102)
ld a, [W_OPTIONS] ; W_OPTIONS
ld a, [W_OPTIONS]
push af
ld a, [$ffaf]
ld a, [hSCY]
push af
ld a, [$ffae]
ld a, [hSCX]
push af
xor a
ld [W_OPTIONS], a ; W_OPTIONS
ld [$ffaf], a
ld [$ffae], a
ld [W_OPTIONS], a
ld [hSCY], a
ld [hSCX], a
push de
.asm_41115
pop de
@ -32,7 +32,7 @@ Func_41102: ; 41102 (10:5102)
jr z, .asm_4112d
inc de
push de
ld hl, PointerTable_4115f ; $515f
ld hl, PointerTable_4115f
add a
ld c, a
ld b, $0
@ -40,16 +40,16 @@ Func_41102: ; 41102 (10:5102)
ld a, [hli]
ld h, [hl]
ld l, a
ld de, .asm_41115 ; $5115
ld de, .asm_41115
push de
jp [hl]
.asm_4112d
pop af
ld [$ffae], a
ld [hSCX], a
pop af
ld [$ffaf], a
ld [hSCY], a
pop af
ld [W_OPTIONS], a ; W_OPTIONS
ld [W_OPTIONS], a
ret
; these bytes refer to the $00th through $10th pointer of PointerTable_4115f
@ -61,13 +61,13 @@ PointerIDs_41149: ; 41149 (10:5149)
PointerTable_4115f: ; 4115f (10:515f)
dw LoadTradingGFXAndMonNames
dw Func_41245
dw Func_41298
dw Func_412d2
dw Func_41336
dw Trade_ShowPlayerMon
dw Trade_DrawOpenEndOfLinkCable
dw Trade_AnimateBallEnteringLinkCable
dw Trade_ShowEnemyMon
dw Func_41376
dw Func_413c6
dw Func_41181
dw Trade_Delay100
dw Func_415c8
dw PrintTradeWentToText
dw PrintTradeForSendsText
@ -76,46 +76,46 @@ PointerTable_4115f: ; 4115f (10:515f)
dw PrintTradeWillTradeText
dw Func_4123b
dw Func_415df
dw Func_41217
dw Trade_SwapNames
Func_41181: ; 41181 (10:5181)
ld c, $64
Trade_Delay100: ; 41181 (10:5181)
ld c, 100
jp DelayFrames
Func_41186: ; 41186 (10:5186)
Trade_CopyTileMapToVRAM: ; 41186 (10:5186)
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld [H_AUTOBGTRANSFERENABLED], a
call Delay3
xor a
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld [H_AUTOBGTRANSFERENABLED], a
ret
Delay50: ; 41191 (10:5191)
ld c, $50
Trade_Delay80: ; 41191 (10:5191)
ld c, 80
jp DelayFrames
Func_41196: ; 41196 (10:5196)
Trade_ClearTileMap: ; 41196 (10:5196)
ld hl, wTileMap
ld bc, $168
ld a, $7f
ld bc, 20 * 18
ld a, " "
jp FillMemory
LoadTradingGFXAndMonNames: ; 411a1 (10:51a1)
call Func_41196
call Trade_ClearTileMap
call DisableLCD
ld hl, TradingAnimationGraphics ; $69be
ld hl, TradingAnimationGraphics
ld de, vChars2 + $310
ld bc, $310
ld a, BANK(TradingAnimationGraphics)
call FarCopyData2
ld hl, TradingAnimationGraphics2 ; $6cce
ld hl, TradingAnimationGraphics2
ld de, vSprites + $7c0
ld bc, $40
ld a, BANK(TradingAnimationGraphics2)
call FarCopyData2
ld hl, vBGMap0
ld bc, $800
ld a, $7f
ld a, " "
call FillMemory
call ClearSprites
ld a, $ff
@ -128,40 +128,40 @@ LoadTradingGFXAndMonNames: ; 411a1 (10:51a1)
jr z, .asm_411e5
ld a, $f0
.asm_411e5
ld [rOBP0], a ; $ff48
ld [rOBP0], a
call EnableLCD
xor a
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld a, [wWhichTrade] ; wWhichTrade
ld [H_AUTOBGTRANSFERENABLED], a
ld a, [wTradedPlayerMonSpecies]
ld [wd11e], a
call GetMonName
ld hl, wcd6d
ld de, wcf4b
ld bc, $b
call CopyData
ld a, [wTrainerEngageDistance]
ld a, [wTradedEnemyMonSpecies]
ld [wd11e], a
jp GetMonName
Func_4120b: ; 4120b (10:520b)
ld a, $d0
ld [rOBP1], a ; $ff49
ld a, %11010000
ld [rOBP1], a
ld b, BANK(Func_7176c)
ld hl, Func_7176c
jp Bankswitch
Func_41217: ; 41217 (10:5217)
Trade_SwapNames: ; 41217 (10:5217)
ld hl, wPlayerName
ld de, wHPBarMaxHP
ld bc, $000b
ld de, wBuffer
ld bc, 11
call CopyData
ld hl, W_GRASSRATE
ld hl, wLinkEnemyTrainerName
ld de, wPlayerName
ld bc, $000b
ld bc, 11
call CopyData
ld hl, wHPBarMaxHP
ld de, W_GRASSRATE
ld bc, $000b
ld hl, wBuffer
ld de, wLinkEnemyTrainerName
ld bc, 11
jp CopyData
Func_4123b: ; 4123b (10:523b)
@ -171,90 +171,90 @@ Func_4123b: ; 4123b (10:523b)
res 6, [hl]
ret
Func_41245: ; 41245 (10:5245)
ld a, $ab
ld [rLCDC], a ; $ff40
Trade_ShowPlayerMon: ; 41245 (10:5245)
ld a, %10101011
ld [rLCDC], a
ld a, $50
ld [hWY], a
ld a, $86
ld [rWX], a ; $ff4b
ld [$ffae], a
ld [rWX], a
ld [hSCX], a
xor a
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld [H_AUTOBGTRANSFERENABLED], a
hlCoord 4, 0
ld b, $6
ld c, $a
ld b, 6
ld c, 10
call TextBoxBorder
call Func_42769
call Trade_PrintPlayerMonInfoText
ld b, $98
call CopyScreenTileBufferToVRAM
call ClearScreen
ld a, [wWhichTrade] ; wWhichTrade
call Func_415a4
ld a, [wTradedPlayerMonSpecies]
call Trade_LoadMonSprite
ld a, $7e
.asm_41273
.slideScreenLoop
push af
call DelayFrame
pop af
ld [rWX], a ; $ff4b
ld [$ffae], a
ld [rWX], a
ld [hSCX], a
dec a
dec a
and a
jr nz, .asm_41273
call Delay50
ld a, ANIM_AD
call Func_41676
ld a, ANIM_AA
call Func_41676
ld a, [wWhichTrade] ; wWhichTrade
jr nz, .slideScreenLoop
call Trade_Delay80
ld a, TRADE_BALL_POOF_ANIM
call Trade_ShowAnimation
ld a, TRADE_BALL_DROP_ANIM
call Trade_ShowAnimation
ld a, [wTradedPlayerMonSpecies]
call PlayCry
xor a
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld [H_AUTOBGTRANSFERENABLED], a
ret
Func_41298: ; 41298 (10:5298)
call Func_41196
Trade_DrawOpenEndOfLinkCable: ; 41298 (10:5298)
call Trade_ClearTileMap
ld b, $98
call CopyScreenTileBufferToVRAM
ld b, $8
call GoPAL_SET
ld hl, vBGMap1 + $8c
call Func_414ae
call Trade_RedrawRows4And5
ld a, $a0
ld [$ffae], a
ld [hSCX], a
call DelayFrame
ld a, $8b
ld [rLCDC], a ; $ff40
ld a, %10001011
ld [rLCDC], a
hlCoord 6, 2
ld b, $7
call Func_41842
call Func_41186
ld b, $7 ; open end of link cable tile ID list index
call CopyTileIDsFromList_ZeroBaseTileID
call Trade_CopyTileMapToVRAM
ld a, (SFX_02_3d - SFX_Headers_02) / 3
call PlaySound
ld c, $14
.asm_412c8
ld a, [$ffae]
add $4
ld [$ffae], a
ld c, 20
.loop
ld a, [hSCX]
add 4
ld [hSCX], a
dec c
jr nz, .asm_412c8
jr nz, .loop
ret
Func_412d2: ; 412d2 (10:52d2)
ld a, ANIM_AB
call Func_41676
Trade_AnimateBallEnteringLinkCable: ; 412d2 (10:52d2)
ld a, TRADE_BALL_SHAKE_ANIM
call Trade_ShowAnimation
ld c, 10
call DelayFrames
ld a, $e4
ld [rOBP0], a ; $ff48
ld a, %11100100
ld [rOBP0], a
xor a
ld [wd09f], a
ld bc, $2060
.asm_412e7
.moveBallInsideLinkCableLoop
push bc
xor a
ld de, UnknownOAM_4132e ; $532e
ld de, Trade_BallInsideLinkCableOAM
call WriteOAMBlock
ld a, [wd09f]
xor $1
@ -263,58 +263,58 @@ Func_412d2: ; 412d2 (10:52d2)
ld hl, wOAMBuffer + $02
ld de, $4
ld c, e
.asm_41300
.cycleSpriteFramesLoop
ld [hl], a
add hl, de
dec c
jr nz, .asm_41300
jr nz, .cycleSpriteFramesLoop
call Delay3
pop bc
ld a, c
add $4
ld c, a
cp $a0
jr nc, .asm_41318
jr nc, .ballSpriteReachedEdgeOfScreen
ld a, (SFX_02_3c - SFX_Headers_02) / 3
call PlaySound
jr .asm_412e7
.asm_41318
jr .moveBallInsideLinkCableLoop
.ballSpriteReachedEdgeOfScreen
call ClearSprites
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld [H_AUTOBGTRANSFERENABLED], a
call ClearScreen
ld b, $98
call CopyScreenTileBufferToVRAM
call Delay3
xor a
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld [H_AUTOBGTRANSFERENABLED], a
ret
UnknownOAM_4132e: ; 4132e (10:532e)
Trade_BallInsideLinkCableOAM: ; 4132e (10:532e)
db $7E,$00,$7E,$20
db $7E,$40,$7E,$60
Func_41336: ; 41336 (10:5336)
ld a, ANIM_AC
call Func_41676
Trade_ShowEnemyMon: ; 41336 (10:5336)
ld a, TRADE_BALL_TILT_ANIM
call Trade_ShowAnimation
call Func_415c8
hlCoord 4, 10
ld b, $6
ld c, $a
ld b, 6
ld c, 10
call TextBoxBorder
call Func_427a7
call Func_41186
call Trade_PrintEnemyMonInfoText
call Trade_CopyTileMapToVRAM
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld a, [wTrainerEngageDistance]
call Func_415a4
ld a, ANIM_AD
call Func_41676
ld [H_AUTOBGTRANSFERENABLED], a
ld a, [wTradedEnemyMonSpecies]
call Trade_LoadMonSprite
ld a, TRADE_BALL_POOF_ANIM
call Trade_ShowAnimation
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld a, [wTrainerEngageDistance]
ld [H_AUTOBGTRANSFERENABLED], a
ld a, [wTradedEnemyMonSpecies]
call PlayCry
call Func_41181
call Trade_Delay100
hlCoord 4, 10
ld bc, $80c
call ClearScreenArea
@ -325,23 +325,23 @@ Func_41376: ; 41376 (10:5376)
ld a, $1
ld [wd08a], a
ld a, $e4
ld [rOBP0], a ; $ff48
ld [rOBP0], a
ld a, $54
ld [W_BASECOORDX], a ; wd081
ld [W_BASECOORDX], a
ld a, $1c
ld [W_BASECOORDY], a ; wd082
ld [W_BASECOORDY], a
ld a, [wcd5e]
ld [wcd5d], a
call Func_41505
call Func_4142d
call Func_41186
call Trade_CopyTileMapToVRAM
call Func_4149f
ld hl, vBGMap1 + $8c
call Func_414ae
call Trade_RedrawRows4And5
ld b, $6
call Func_414c5
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld [H_AUTOBGTRANSFERENABLED], a
call Func_4149f
ld b, $4
call Func_414c5
@ -349,7 +349,7 @@ Func_41376: ; 41376 (10:5376)
ld b, $6
call Func_414c5
xor a
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld [H_AUTOBGTRANSFERENABLED], a
call Func_41525
jp ClearSprites
@ -358,22 +358,22 @@ Func_413c6: ; 413c6 (10:53c6)
xor a
ld [wd08a], a
ld a, $64
ld [W_BASECOORDX], a ; wd081
ld [W_BASECOORDX], a
ld a, $44
ld [W_BASECOORDY], a ; wd082
ld [W_BASECOORDY], a
ld a, [wcd5f]
ld [wcd5d], a
call Func_41505
call Func_4145c
call Func_41186
call Trade_CopyTileMapToVRAM
call Func_4149f
ld hl, vBGMap1 + $94
call Func_414ae
call Trade_RedrawRows4And5
call Func_41525
ld b, $6
call Func_414c5
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld [H_AUTOBGTRANSFERENABLED], a
call Func_4149f
ld b, $4
call Func_414c5
@ -381,27 +381,27 @@ Func_413c6: ; 413c6 (10:53c6)
ld b, $6
call Func_414c5
xor a
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld [H_AUTOBGTRANSFERENABLED], a
jp ClearSprites
Func_41411: ; 41411 (10:5411)
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld [H_AUTOBGTRANSFERENABLED], a
call ClearScreen
xor a
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld [H_AUTOBGTRANSFERENABLED], a
call Func_4120b
call DelayFrame
ld a, $ab
ld [rLCDC], a ; $ff40
ld a, %10101011
ld [rLCDC], a
xor a
ld [$ffae], a
ld [hSCX], a
ld a, $90
ld [hWY], a
ret
Func_4142d: ; 4142d (10:542d)
call Func_41196
call Trade_ClearTileMap
hlCoord 11, 4
ld a, $5d
ld [hli], a
@ -413,18 +413,18 @@ Func_4142d: ; 4142d (10:542d)
jr nz, .asm_4143a
hlCoord 5, 3
ld b, $6
call Func_41842
call CopyTileIDsFromList_ZeroBaseTileID
hlCoord 4, 12
ld b, $2
ld c, $7
ld b, 2
ld c, 7
call TextBoxBorder
hlCoord 5, 14
ld de, wPlayerName ; wd158
ld de, wPlayerName
call PlaceString
jp DelayFrame
Func_4145c: ; 4145c (10:545c)
call Func_41196
call Trade_ClearTileMap
hlCoord 0, 4
ld a, $5e
ld c, $e
@ -451,18 +451,18 @@ Func_4145c: ; 4145c (10:545c)
ld [hl], a
hlCoord 7, 8
ld b, $6
call Func_41842
call CopyTileIDsFromList_ZeroBaseTileID
hlCoord 6, 0
ld b, $2
ld c, $7
call TextBoxBorder
hlCoord 7, 2
ld de, W_GRASSRATE ; W_GRASSRATE
ld de, wLinkEnemyTrainerName
call PlaceString
jp DelayFrame
Func_4149f: ; 4149f (10:549f)
call Func_41196
call Trade_ClearTileMap
hlCoord 0, 4
ld a, $5e
ld c, $14
@ -472,7 +472,7 @@ Func_4149f: ; 4149f (10:549f)
jr nz, .asm_414a9
ret
Func_414ae: ; 414ae (10:54ae)
Trade_RedrawRows4And5: ; 414ae (10:54ae)
push hl
hlCoord 0, 4
call CopyToScreenEdgeTiles
@ -480,10 +480,10 @@ Func_414ae: ; 414ae (10:54ae)
ld a, h
ld [H_SCREENEDGEREDRAWADDR + 1], a
ld a, l
ld [H_SCREENEDGEREDRAWADDR], a ; $ffd1
ld a, $2
ld [H_SCREENEDGEREDRAW], a ; $ffd0
ld c, $a
ld [H_SCREENEDGEREDRAWADDR], a
ld a, REDRAWROW
ld [H_SCREENEDGEREDRAW], a
ld c, 10
jp DelayFrames
Func_414c5: ; 414c5 (10:54c5)
@ -494,14 +494,14 @@ Func_414c5: ; 414c5 (10:54c5)
ld a, e
dec a
jr z, .asm_414d5
ld a, [$ffae]
ld a, [hSCX]
sub $2
jr .asm_414d9
.asm_414d5
ld a, [$ffae]
ld a, [hSCX]
add $2
.asm_414d9
ld [$ffae], a
ld [hSCX], a
call DelayFrame
dec d
jr nz, .asm_414cb
@ -514,9 +514,9 @@ Func_414e8: ; 414e8 (10:54e8)
push de
push bc
push hl
ld a, [rBGP] ; $ff47
ld a, [rBGP]
xor $3c
ld [rBGP], a ; $ff47
ld [rBGP], a
ld hl, wOAMBuffer + $02
ld de, $4
ld c, $14
@ -540,10 +540,10 @@ Func_41510: ; 41510 (10:5510)
ld hl, wOAMBuffer
ld c, $14
.asm_41515
ld a, [W_BASECOORDY] ; wd082
ld a, [W_BASECOORDY]
add [hl]
ld [hli], a
ld a, [W_BASECOORDX] ; wd081
ld a, [W_BASECOORDX]
add [hl]
ld [hli], a
inc hl
@ -566,9 +566,9 @@ Func_41525: ; 41525 (10:5525)
ld bc, $fc00
.asm_4153f
ld a, b
ld [W_BASECOORDX], a ; wd081
ld [W_BASECOORDX], a
ld a, c
ld [W_BASECOORDY], a ; wd082
ld [W_BASECOORDY], a
ld d, $4
.asm_41549
call Func_41510
@ -580,7 +580,7 @@ Func_41525: ; 41525 (10:5525)
ret
Func_41558: ; 41558 (10:5558)
ld hl, OAMPointers_41574 ; $5574
ld hl, OAMPointers_41574
ld c, $4
xor a
.asm_4155e
@ -630,58 +630,59 @@ UnknownOAM_4159c: ; 4159c (10:559c)
db $3B,$70,$3A,$70
db $39,$70,$38,$70
Func_415a4: ; 415a4 (10:55a4)
; a = species
Trade_LoadMonSprite: ; 415a4 (10:55a4)
ld [wcf91], a
ld [wd0b5], a
ld [wcf1d], a
ld b, $b
ld c, $0
call GoPAL_SET
ld a, [H_AUTOBGTRANSFERENABLED] ; $ffba
ld a, [H_AUTOBGTRANSFERENABLED]
xor $1
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld [H_AUTOBGTRANSFERENABLED], a
call GetMonHeader
hlCoord 7, 2
call LoadFlippedFrontSpriteByMonIndex
ld c, $a
ld c, 10
jp DelayFrames
Func_415c8: ; 415c8 (10:55c8)
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld [H_AUTOBGTRANSFERENABLED], a
call ClearScreen
ld a, $e3
ld [rLCDC], a ; $ff40
ld a, %11100011
ld [rLCDC], a
ld a, $7
ld [rWX], a ; $ff4b
ld [rWX], a
xor a
ld [hWY], a
ld a, $90
ld [$ffae], a
ld [hSCX], a
ret
Func_415df: ; 415df (10:55df)
ld c, $32
ld c, 50
call DelayFrames
.asm_415e4
.loop
call DelayFrame
ld a, [rWX] ; $ff4b
ld a, [rWX]
inc a
inc a
ld [rWX], a ; $ff4b
ld [rWX], a
cp $a1
jr nz, .asm_415e4
call Func_41196
ld c, $a
jr nz, .loop
call Trade_ClearTileMap
ld c, 10
call DelayFrames
ld a, $7
ld [rWX], a ; $ff4b
ld [rWX], a
ret
PrintTradeWentToText: ; 415fe (10:55fe)
ld hl, TradeWentToText
call PrintText
ld c, $c8
ld c, 200
call DelayFrames
jp Func_415df
@ -692,10 +693,10 @@ TradeWentToText: ; 4160c (10:560c)
PrintTradeForSendsText: ; 41611 (10:5611)
ld hl, TradeForText
call PrintText
call Delay50
call Trade_Delay80
ld hl, TradeSendsText
call PrintText
jp Delay50
jp Trade_Delay80
TradeForText: ; 41623 (10:5623)
TX_FAR _TradeForText
@ -708,10 +709,10 @@ TradeSendsText: ; 41628 (10:5628)
PrintTradeFarewellText: ; 4162d (10:562d)
ld hl, TradeWavesFarewellText
call PrintText
call Delay50
call Trade_Delay80
ld hl, TradeTransferredText
call PrintText
call Delay50
call Trade_Delay80
jp Func_415df
TradeWavesFarewellText: ; 41642 (10:5642)
@ -725,7 +726,7 @@ TradeTransferredText: ; 41647 (10:5647)
PrintTradeTakeCareText: ; 4164c (10:564c)
ld hl, TradeTakeCareText
call PrintText
jp Delay50
jp Trade_Delay80
TradeTakeCareText: ; 41655 (10:5655)
TX_FAR _TradeTakeCareText
@ -734,10 +735,10 @@ TradeTakeCareText: ; 41655 (10:5655)
PrintTradeWillTradeText: ; 4165a (10:565a)
ld hl, TradeWillTradeText
call PrintText
call Delay50
call Trade_Delay80
ld hl, TradeforText
call PrintText
jp Delay50
jp Trade_Delay80
TradeWillTradeText: ; 4166c (10:566c)
TX_FAR _TradeWillTradeText
@ -747,8 +748,8 @@ TradeforText: ; 41671 (10:5671)
TX_FAR _TradeforText
db "@"
Func_41676: ; 41676 (10:5676)
ld [W_ANIMATIONID], a ; W_ANIMATIONID
Trade_ShowAnimation: ; 41676 (10:5676)
ld [W_ANIMATIONID], a
xor a
ld [wcc5b], a
predef_jump MoveAnimation

View file

@ -1,8 +1,8 @@
Func_42769: ; 42769 (10:6769)
Trade_PrintPlayerMonInfoText: ; 42769 (10:6769)
hlCoord 5, 0
ld de,OTString67E5
ld de,Trade_MonInfoText
call PlaceString
ld a,[wWhichTrade]
ld a,[wTradedPlayerMonSpecies]
ld [wd11e],a
predef IndexToPokedex
hlCoord 9, 0
@ -13,18 +13,18 @@ Func_42769: ; 42769 (10:6769)
ld de,wcf4b
call PlaceString
hlCoord 8, 4
ld de,wTrainerScreenX
ld de,wTradedPlayerMonOT
call PlaceString
hlCoord 8, 6
ld de,wcd4c
ld de,wTradedPlayerMonOTID
ld bc,$8205
jp PrintNumber
Func_427a7: ; 427a7 (10:67a7)
Trade_PrintEnemyMonInfoText: ; 427a7 (10:67a7)
hlCoord 5, 10
ld de,OTString67E5
ld de,Trade_MonInfoText
call PlaceString
ld a,[wTrainerEngageDistance]
ld a,[wTradedEnemyMonSpecies]
ld [wd11e],a
predef IndexToPokedex
hlCoord 9, 10
@ -35,14 +35,14 @@ Func_427a7: ; 427a7 (10:67a7)
ld de,wcd6d
call PlaceString
hlCoord 8, 14
ld de,wcd4e
ld de,wTradedEnemyMonOT
call PlaceString
hlCoord 8, 16
ld de,wcd59
ld de,wTradedEnemyMonOTID
ld bc,$8205
jp PrintNumber
OTString67E5: ; 427e5 (10:67e5)
Trade_MonInfoText: ; 427e5 (10:67e5)
db "──",$74,$F2,$4E
db $4E
db "OT/",$4E

2
extras

@ -1 +1 @@
Subproject commit a87f66964cc602ff5575efebf27c388ef03fa94d
Subproject commit 698b0fc7e63d3dadf07247015e230bce145cc500

View file

@ -1326,7 +1326,7 @@ AddAmountSoldToMoney:: ; 2b9e (0:2b9e)
ld c,3 ; length of money in bytes
predef AddBCDPredef ; add total price to money
ld a,$13
ld [wd125],a
ld [wTextBoxID],a
call DisplayTextBoxID ; redraw money text box
ld a, (SFX_02_5a - SFX_Headers_02) / 3
call PlaySoundWaitForCurrent ; play sound
@ -1399,7 +1399,7 @@ DisplayListMenuID:: ; 2be6 (0:2be6)
ld a,[hl]
ld [wd12a],a ; [wd12a] = number of list entries
ld a,$0d ; list menu text box ID
ld [wd125],a
ld [wTextBoxID],a
call DisplayTextBoxID ; draw the menu text box
call UpdateSprites ; disable sprites behind the text box
; the code up to .skipMovingSprites appears to be useless
@ -2136,7 +2136,7 @@ IsKeyItem:: ; 30d9 (0:30d9)
; function to draw various text boxes
; INPUT:
; [wd125] = text box ID
; [wTextBoxID] = text box ID
DisplayTextBoxID:: ; 30e8 (0:30e8)
ld a,[H_LOADEDROMBANK]
push af
@ -2898,7 +2898,7 @@ GetSpriteMovementByte2Pointer:: ; 3558 (0:3558)
GetTrainerInformation:: ; 3566 (0:3566)
call GetTrainerName
ld a, [W_ISLINKBATTLE] ; W_ISLINKBATTLE
ld a, [wLinkState]
and a
jr nz, .linkBattle
ld a, Bank(TrainerPicAndMoneyPointers)
@ -2997,34 +2997,34 @@ YesNoChoice:: ; 35ec (0:35ec)
Func_35f4:: ; 35f4 (0:35f4)
ld a, $14
ld [wd125], a
ld [wTextBoxID], a
call InitYesNoTextBoxParameters
jp DisplayTextBoxID
InitYesNoTextBoxParameters:: ; 35ff (0:35ff)
xor a
ld [wd12c], a
xor a ; YES_NO_MENU
ld [wTwoOptionMenuID], a
hlCoord 14, 7
ld bc, $80f
ret
YesNoChoicePokeCenter:: ; 360a (0:360a)
call SaveScreenTilesToBuffer1
ld a, $6
ld [wd12c], a
ld a, HEAL_CANCEL_MENU
ld [wTwoOptionMenuID], a
hlCoord 11, 6
ld bc, $80c
jr DisplayYesNoChoice
Func_361a:: ; 361a (0:361a)
call SaveScreenTilesToBuffer1
ld a, $3
ld [wd12c], a
ld a, WIDE_YES_NO_MENU
ld [wTwoOptionMenuID], a
hlCoord 12, 7
ld bc, $080d
DisplayYesNoChoice:: ; 3628 (0:3628)
ld a, $14
ld [wd125], a
ld [wTextBoxID], a
call DisplayTextBoxID
jp LoadScreenTilesFromBuffer1
@ -3467,7 +3467,7 @@ WaitForTextScrollButtonPress:: ; 3865 (0:3865)
call HandleDownArrowBlinkTiming
pop hl
call JoypadLowSensitivity
predef Func_5a5f
predef CableClub_Run
ld a, [hJoy5]
and A_BUTTON | B_BUTTON
jr z, .loop
@ -3479,8 +3479,8 @@ WaitForTextScrollButtonPress:: ; 3865 (0:3865)
; (unless in link battle) waits for A or B being pressed and outputs the scrolling sound effect
ManualTextScroll:: ; 3898 (0:3898)
ld a, [W_ISLINKBATTLE]
cp $4
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr z, .inLinkBattle
call WaitForTextScrollButtonPress
ld a, (SFX_02_40 - SFX_Headers_02) / 3
@ -4194,7 +4194,7 @@ PrintText:: ; 3c49 (0:3c49)
; Print text hl at (1, 14).
push hl
ld a,1
ld [wd125],a
ld [wTextBoxID],a
call DisplayTextBoxID
call UpdateSprites
call Delay3

View file

@ -26,7 +26,7 @@ rLCDC_DEFAULT EQU %11100011
ld [$ff43], a
ld [$ff42], a
ld [rSB], a
ld [$ff02], a
ld [rSC], a
ld [$ff4b], a
ld [$ff4a], a
ld [$ff06], a
@ -67,8 +67,8 @@ rLCDC_DEFAULT EQU %11100011
xor a
ld [hTilesetType], a
ld [$ff41], a
ld [$ffae], a
ld [$ffaf], a
ld [hSCX], a
ld [hSCY], a
ld [$ff0f], a
ld a, 1 << VBLANK + 1 << TIMER + 1 << SERIAL
ld [rIE], a
@ -79,8 +79,8 @@ rLCDC_DEFAULT EQU %11100011
ld a, 7
ld [rWX], a
ld a, $ff
ld [$ffaa], a
ld a, CONNECTION_NOT_ESTABLISHED
ld [hSerialConnectionStatus], a
ld h, vBGMap0 / $100
call ClearBgMap

View file

@ -1609,12 +1609,12 @@ AdvancePlayerSprite:: ; 0d27 (0:0d27)
ld c,a
sla b
sla c
ld a,[$ffaf]
ld a,[hSCY]
add b
ld [$ffaf],a ; update background scroll Y
ld a,[$ffae]
ld [hSCY],a ; update background scroll Y
ld a,[hSCX]
add c
ld [$ffae],a ; update background scroll X
ld [hSCX],a ; update background scroll X
; shift all the sprites in the direction opposite of the player's motion
; so that the player appears to move relative to them
ld hl,wSpriteStateData1 + $14
@ -2310,8 +2310,8 @@ LoadMapData:: ; 1241 (0:1241)
ld [wMapViewVRAMPointer + 1],a
xor a
ld [wMapViewVRAMPointer],a
ld [$ffaf],a
ld [$ffae],a
ld [hSCY],a
ld [hSCX],a
ld [wWalkCounter],a
ld [wd119],a
ld [wWalkBikeSurfStateCopy],a

View file

@ -1,304 +1,313 @@
Serial:: ; 2125 (0:2125)
push af
push bc
push de
push hl
ld a, [$ffaa]
inc a
jr z, .asm_2142
ld a, [$ff01]
ld [$ffad], a
ld a, [$ffac]
ld [$ff01], a
ld a, [$ffaa]
cp $2
jr z, .asm_2162
ld a, $80
ld [$ff02], a
jr .asm_2162
.asm_2142
ld a, [$ff01]
ld [$ffad], a
ld [$ffaa], a
cp $2
jr z, .asm_215f
xor a
ld [$ff01], a
ld a, $3
ld [rDIV], a ; $ff04
.asm_2153
ld a, [rDIV] ; $ff04
bit 7, a
jr nz, .asm_2153
ld a, $80
ld [$ff02], a
jr .asm_2162
.asm_215f
xor a
ld [$ff01], a
.asm_2162
ld a, $1
ld [$ffa9], a
ld a, $fe
ld [$ffac], a
pop hl
pop de
pop bc
pop af
reti
Func_216f:: ; 216f (0:216f)
ld a, $1
ld [$ffab], a
.asm_2173
ld a, [hl]
ld [$ffac], a
call Func_219a
push bc
ld b, a
inc hl
ld a, $30
.asm_217e
dec a
jr nz, .asm_217e
ld a, [$ffab]
and a
ld a, b
pop bc
jr z, .asm_2192
dec hl
cp $fd
jr nz, .asm_2173
xor a
ld [$ffab], a
jr .asm_2173
.asm_2192
ld [de], a
inc de
dec bc
ld a, b
or c
jr nz, .asm_2173
ret
Func_219a:: ; 219a (0:219a)
xor a
ld [$ffa9], a
ld a, [$ffaa]
cp $2
jr nz, .asm_21a7
ld a, $81
ld [$ff02], a
.asm_21a7
ld a, [$ffa9]
and a
jr nz, .asm_21f1
ld a, [$ffaa]
cp $1
jr nz, .asm_21cc
call Func_2237
jr z, .asm_21cc
call Func_2231
push hl
ld hl, wcc48
inc [hl]
jr nz, .asm_21c3
dec hl
inc [hl]
.asm_21c3
pop hl
call Func_2237
jr nz, .asm_21a7
jp Func_223f
.asm_21cc
ld a, [rIE] ; $ffff
and $f
cp $8
jr nz, .asm_21a7
ld a, [W_NUMHITS] ; wd074
dec a
ld [W_NUMHITS], a ; wd074
jr nz, .asm_21a7
ld a, [wd075]
dec a
ld [wd075], a
jr nz, .asm_21a7
ld a, [$ffaa]
cp $1
jr z, .asm_21f1
ld a, $ff
.asm_21ee
dec a
jr nz, .asm_21ee
.asm_21f1
xor a
ld [$ffa9], a
ld a, [rIE] ; $ffff
and $f
sub $8
jr nz, .asm_2204
ld [W_NUMHITS], a ; wd074
ld a, $50
ld [wd075], a
.asm_2204
ld a, [$ffad]
cp $fe
ret nz
call Func_2237
jr z, .asm_221f
push hl
ld hl, wcc48
ld a, [hl]
dec a
ld [hld], a
inc a
jr nz, .asm_2219
dec [hl]
.asm_2219
pop hl
call Func_2237
jr z, Func_223f
.asm_221f
ld a, [rIE] ; $ffff
and $f
cp $8
ld a, $fe
ret z
ld a, [hl]
ld [$ffac], a
call DelayFrame
jp Func_219a
Func_2231:: ; 2231 (0:2231)
ld a, $f
.asm_2233
dec a
jr nz, .asm_2233
ret
Func_2237:: ; 2237 (0:2237)
push hl
ld hl, wcc47
ld a, [hli]
or [hl]
pop hl
ret
Func_223f:: ; 223f (0:223f)
dec a
ld [wcc47], a
ld [wcc48], a
ret
Func_2247:: ; 2247 (0:2247)
ld hl, wcc42
ld de, wcc3d
ld c, $2
ld a, $1
ld [$ffab], a
.asm_2253
call DelayFrame
ld a, [hl]
ld [$ffac], a
call Func_219a
ld b, a
inc hl
ld a, [$ffab]
and a
ld a, $0
ld [$ffab], a
jr nz, .asm_2253
ld a, b
ld [de], a
inc de
dec c
jr nz, .asm_2253
ret
Func_226e:: ; 226e (0:226e)
call SaveScreenTilesToBuffer1
callab PrintWaitingText
call Func_227f
jp LoadScreenTilesFromBuffer1
Func_227f:: ; 227f (0:227f)
ld a, $ff
ld [wcc3e], a
.asm_2284
call Func_22c3
call DelayFrame
call Func_2237
jr z, .asm_22a0
push hl
ld hl, wcc48
dec [hl]
jr nz, .asm_229f
dec hl
dec [hl]
jr nz, .asm_229f
pop hl
xor a
jp Func_223f
.asm_229f
pop hl
.asm_22a0
ld a, [wcc3e]
inc a
jr z, .asm_2284
ld b, $a
.asm_22a8
call DelayFrame
call Func_22c3
dec b
jr nz, .asm_22a8
ld b, $a
.asm_22b3
call DelayFrame
call Func_22ed
dec b
jr nz, .asm_22b3
ld a, [wcc3e]
ld [wcc3d], a
ret
Func_22c3:: ; 22c3 (0:22c3)
call asm_22d7
ld a, [wcc42]
add $60
ld [$ffac], a
ld a, [$ffaa]
cp $2
jr nz, asm_22d7
ld a, $81
ld [$ff02], a
asm_22d7:: ; 22d7 (0:22d7)
ld a, [$ffad]
ld [wcc3d], a
and $f0
cp $60
ret nz
xor a
ld [$ffad], a
ld a, [wcc3d]
and $f
ld [wcc3e], a
ret
Func_22ed:: ; 22ed (0:22ed)
xor a
ld [$ffac], a
ld a, [$ffaa]
cp $2
ret nz
ld a, $81
ld [$ff02], a
ret
Func_22fa:: ; 22fa (0:22fa)
ld a, $2
ld [$ff01], a
xor a
ld [$ffad], a
ld a, $80
ld [$ff02], a
ret
Serial:: ; 2125 (0:2125)
push af
push bc
push de
push hl
ld a, [hSerialConnectionStatus]
inc a
jr z, .connectionNotYetEstablished
ld a, [rSB]
ld [hSerialReceiveData], a
ld a, [hSerialSendData]
ld [rSB], a
ld a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr z, .done
; using external clock
ld a, START_TRANSFER_EXTERNAL_CLOCK
ld [rSC], a
jr .done
.connectionNotYetEstablished
ld a, [rSB]
ld [hSerialReceiveData], a
ld [hSerialConnectionStatus], a
cp USING_INTERNAL_CLOCK
jr z, .usingInternalClock
; using external clock
xor a
ld [rSB], a
ld a, $3
ld [rDIV], a
.waitLoop
ld a, [rDIV]
bit 7, a
jr nz, .waitLoop
ld a, START_TRANSFER_EXTERNAL_CLOCK
ld [rSC], a
jr .done
.usingInternalClock
xor a
ld [rSB], a
.done
ld a, $1
ld [hSerialReceivedNewData], a
ld a, SERIAL_NO_DATA_BYTE
ld [hSerialSendData], a
pop hl
pop de
pop bc
pop af
reti
; hl = send data
; de = receive data
; bc = length of data
Serial_ExchangeBytes:: ; 216f (0:216f)
ld a, 1
ld [hSerialIgnoringInitialData], a
.loop
ld a, [hl]
ld [hSerialSendData], a
call Serial_ExchangeByte
push bc
ld b, a
inc hl
ld a, 48
.waitLoop
dec a
jr nz, .waitLoop
ld a, [hSerialIgnoringInitialData]
and a
ld a, b
pop bc
jr z, .storeReceivedByte
dec hl
cp SERIAL_PREAMBLE_BYTE
jr nz, .loop
xor a
ld [hSerialIgnoringInitialData], a
jr .loop
.storeReceivedByte
ld [de], a
inc de
dec bc
ld a, b
or c
jr nz, .loop
ret
Serial_ExchangeByte:: ; 219a (0:219a)
xor a
ld [hSerialReceivedNewData], a
ld a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr nz, .asm_21a7
ld a, START_TRANSFER_INTERNAL_CLOCK
ld [rSC], a
.asm_21a7
ld a, [hSerialReceivedNewData]
and a
jr nz, .asm_21f1
ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr nz, .asm_21cc
call IsUnknownCounterZero
jr z, .asm_21cc
call WaitLoop_15Iterations
push hl
ld hl, wUnknownSerialCounter + 1
inc [hl]
jr nz, .asm_21c3
dec hl
inc [hl]
.asm_21c3
pop hl
call IsUnknownCounterZero
jr nz, .asm_21a7
jp SetUnknownCounterToFFFF
.asm_21cc
ld a, [rIE]
and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
cp (1 << SERIAL)
jr nz, .asm_21a7
ld a, [wUnknownSerialCounter2]
dec a
ld [wUnknownSerialCounter2], a
jr nz, .asm_21a7
ld a, [wUnknownSerialCounter2 + 1]
dec a
ld [wUnknownSerialCounter2 + 1], a
jr nz, .asm_21a7
ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr z, .asm_21f1
ld a, 255
.waitLoop
dec a
jr nz, .waitLoop
.asm_21f1
xor a
ld [hSerialReceivedNewData], a
ld a, [rIE]
and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
sub (1 << SERIAL)
jr nz, .asm_2204
ld [wUnknownSerialCounter2], a
ld a, $50
ld [wUnknownSerialCounter2 + 1], a
.asm_2204
ld a, [hSerialReceiveData]
cp SERIAL_NO_DATA_BYTE
ret nz
call IsUnknownCounterZero
jr z, .asm_221f
push hl
ld hl, wUnknownSerialCounter + 1
ld a, [hl]
dec a
ld [hld], a
inc a
jr nz, .asm_2219
dec [hl]
.asm_2219
pop hl
call IsUnknownCounterZero
jr z, SetUnknownCounterToFFFF
.asm_221f
ld a, [rIE]
and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
cp (1 << SERIAL)
ld a, SERIAL_NO_DATA_BYTE
ret z
ld a, [hl]
ld [hSerialSendData], a
call DelayFrame
jp Serial_ExchangeByte
WaitLoop_15Iterations:: ; 2231 (0:2231)
ld a, 15
.waitLoop
dec a
jr nz, .waitLoop
ret
IsUnknownCounterZero:: ; 2237 (0:2237)
push hl
ld hl, wUnknownSerialCounter
ld a, [hli]
or [hl]
pop hl
ret
; a is always 0 when this is called
SetUnknownCounterToFFFF:: ; 223f (0:223f)
dec a
ld [wUnknownSerialCounter], a
ld [wUnknownSerialCounter + 1], a
ret
; This is used to exchange the button press and selected menu item on the link menu.
; The data is sent thrice and read twice to increase reliability.
Serial_ExchangeLinkMenuSelection:: ; 2247 (0:2247)
ld hl, wLinkMenuSelectionSendBuffer
ld de, wLinkMenuSelectionReceiveBuffer
ld c, 2 ; number of bytes to save
ld a, 1
ld [hSerialIgnoringInitialData], a
.loop
call DelayFrame
ld a, [hl]
ld [hSerialSendData], a
call Serial_ExchangeByte
ld b, a
inc hl
ld a, [hSerialIgnoringInitialData]
and a
ld a, 0
ld [hSerialIgnoringInitialData], a
jr nz, .loop
ld a, b
ld [de], a
inc de
dec c
jr nz, .loop
ret
Serial_PrintWaitingTextAndSyncAndExchangeByte:: ; 226e (0:226e)
call SaveScreenTilesToBuffer1
callab PrintWaitingText
call Serial_SyncAndExchangeNybble
jp LoadScreenTilesFromBuffer1
Serial_SyncAndExchangeNybble:: ; 227f (0:227f)
ld a, $ff
ld [wSerialExchangeNybbleReceiveData], a
.loop1
call Serial_ExchangeNybble
call DelayFrame
call IsUnknownCounterZero
jr z, .next1
push hl
ld hl, wUnknownSerialCounter + 1
dec [hl]
jr nz, .next2
dec hl
dec [hl]
jr nz, .next2
pop hl
xor a
jp SetUnknownCounterToFFFF
.next2
pop hl
.next1
ld a, [wSerialExchangeNybbleReceiveData]
inc a
jr z, .loop1
ld b, 10
.loop2
call DelayFrame
call Serial_ExchangeNybble
dec b
jr nz, .loop2
ld b, 10
.loop3
call DelayFrame
call Serial_SendZeroByte
dec b
jr nz, .loop3
ld a, [wSerialExchangeNybbleReceiveData]
ld [wSerialSyncAndExchangeNybbleReceiveData], a
ret
; exchange one byte with value of $f or less
Serial_ExchangeNybble:: ; 22c3 (0:22c3)
call .doExchange
ld a, [wSerialExchangeNybbleSendData]
add $60
ld [hSerialSendData], a
ld a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr nz, .doExchange
ld a, START_TRANSFER_INTERNAL_CLOCK
ld [rSC], a
.doExchange
ld a, [hSerialReceiveData]
ld [wSerialExchangeNybbleTempReceiveData], a
and $f0
cp $60
ret nz
xor a
ld [hSerialReceiveData], a
ld a, [wSerialExchangeNybbleTempReceiveData]
and $f
ld [wSerialExchangeNybbleReceiveData], a
ret
Serial_SendZeroByte:: ; 22ed (0:22ed)
xor a
ld [hSerialSendData], a
ld a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
ret nz
ld a, START_TRANSFER_INTERNAL_CLOCK
ld [rSC], a
ret
Serial_TryEstablishingExternallyClockedConnection:: ; 22fa (0:22fa)
ld a, ESTABLISH_CONNECTION_WITH_EXTERNAL_CLOCK
ld [rSB], a
xor a
ld [hSerialReceiveData], a
ld a, START_TRANSFER_EXTERNAL_CLOCK
ld [rSC], a
ret

View file

@ -265,8 +265,8 @@ Char5F:: ; 1a91 (0:1a91)
ret
Char58:: ; 1a95 (0:1a95)
ld a,[W_ISLINKBATTLE]
cp 4
ld a,[wLinkState]
cp LINK_STATE_BATTLING
jp z,Next1AA2
ld a,$EE
Coorda 18, 16
@ -506,8 +506,8 @@ TextCommand05:: ; 1bc5 (0:1bc5)
; 06
; (no arguments)
TextCommand06:: ; 1bcc (0:1bcc)
ld a,[W_ISLINKBATTLE]
cp a,$04
ld a,[wLinkState]
cp a,LINK_STATE_BATTLING
jp z,TextCommand0D
ld a,$ee ; down arrow
Coorda 18, 16 ; place down arrow in lower right corner of dialogue text box

View file

@ -10,6 +10,8 @@ hSoftReset EQU $FF8A
; presses the reset sequence (A+B+SEL+START).
; Soft reset when 0 is reached.
hBaseTileID EQU $FF8B
; counters for blinking down arrow
H_DOWNARROWBLINKCNT1 EQU $FF8B
H_DOWNARROWBLINKCNT2 EQU $FF8C
@ -38,6 +40,19 @@ H_NUMTOPRINT EQU $FF96 ; 3 bytes
H_POWEROFTEN EQU $FF99 ; 3 bytes
H_SAVEDNUMTOPRINT EQU $FF9C ; 3 bytes
hSerialReceivedNewData EQU $FFA9
; $01 = using external clock
; $02 = using internal clock
; $ff = establishing connection
hSerialConnectionStatus EQU $FFAA
hSerialIgnoringInitialData EQU $FFAB
hSerialSendData EQU $FFAC
hSerialReceiveData EQU $FFAD
; these values are copied to SCX, SCY, and WY during V-blank
hSCX EQU $FFAE
hSCY EQU $FFAF

157
main.asm
View file

@ -167,7 +167,7 @@ PrintWaitingText:
call TextBoxBorder
jr .asm_4c1a
.asm_4c17
call Func_5ab3
call CableClub_TextBoxBorder
.asm_4c1a
hlCoord 4, 11
ld de, WaitingText
@ -633,8 +633,8 @@ LoadSpecialWarpData: ; 62ff (1:62ff)
cp BATTLE_CENTER
jr nz, .notBattleCenter
ld hl, BattleCenterSpec1
ld a, [$ffaa]
cp $2
ld a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK ; which gameboy is clocking determines who is on the left and who is on the right
jr z, .copyWarpData
ld hl, BattleCenterSpec2
jr .copyWarpData
@ -642,8 +642,8 @@ LoadSpecialWarpData: ; 62ff (1:62ff)
cp TRADE_CENTER
jr nz, .notTradeCenter
ld hl, TradeCenterSpec1
ld a, [$ffaa]
cp $2
ld a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr z, .copyWarpData
ld hl, TradeCenterSpec2
jr .copyWarpData
@ -798,7 +798,7 @@ SubtractAmountPaidFromMoney_: ; 6b21 (1:6b21)
ld c,3 ; length of money in bytes
predef SubBCDPredef ; subtract total price from money
ld a,$13
ld [wd125],a
ld [wTextBoxID],a
call DisplayTextBoxID ; redraw money text box
and a
ret
@ -1164,12 +1164,10 @@ PrintStartMenuItem: ; 71bb (1:71bb)
INCLUDE "engine/overworld/cable_club_npc.asm"
; function to draw various text boxes
; INPUT:
; [wd125] = text box ID
DisplayTextBoxID_: ; 72ea (1:72ea)
ld a,[wd125] ; a = text box ID
ld a,[wTextBoxID]
cp a,$14
jp z,DisplayYesNoTextBox
jp z,DisplayTwoOptionMenu
ld c,a
ld hl,TextBoxFunctionTable
ld de,3
@ -1437,7 +1435,7 @@ Func_74ba: ; 74ba (1:74ba)
ld hl, wd730
set 6, [hl]
ld a, $f
ld [wd125], a
ld [wTextBoxID], a
call DisplayTextBoxID
hlCoord 13, 1
ld b, $1
@ -1456,12 +1454,12 @@ CurrencyString: ; 74e2 (1:74e2)
Func_74ea: ; 74ea (1:74ea)
ld a, [wd730]
set 6, a
set 6, a ; no printing delay
ld [wd730], a
xor a
ld [wd12d], a
ld a, $e
ld [wd125], a
ld [wTextBoxID], a
call DisplayTextBoxID
ld a, $3
ld [wMenuWatchedKeys], a ; wMenuWatchedKeys
@ -1476,7 +1474,7 @@ Func_74ea: ; 74ea (1:74ea)
ld [wLastMenuItem], a ; wLastMenuItem
ld [wcc37], a
ld a, [wd730]
res 6, a
res 6, a ; turn on the printing delay
ld [wd730], a
call HandleMenuInput
call PlaceUnfilledArrowMenuCursor
@ -1505,46 +1503,50 @@ Func_74ea: ; 74ea (1:74ea)
scf
ret
DisplayYesNoTextBox: ; 7559 (1:7559)
; displays a menu with two options to choose from
; b = Y of upper left corner of text region
; c = X of upper left corner of text region
; hl = address where the text box border should be drawn
DisplayTwoOptionMenu: ; 7559 (1:7559)
push hl
ld a, [wd730]
set 6, a
set 6, a ; no printing delay
ld [wd730], a
xor a
ld [wd12d], a
ld [wd12e], a
ld a, $3
ld [wMenuWatchedKeys], a ; wMenuWatchedKeys
ld a, A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a
ld a, $1
ld [wMaxMenuItem], a ; wMaxMenuItem
ld [wMaxMenuItem], a
ld a, b
ld [wTopMenuItemY], a ; wTopMenuItemY
ld [wTopMenuItemY], a
ld a, c
ld [wTopMenuItemX], a ; wTopMenuItemX
ld [wTopMenuItemX], a
xor a
ld [wLastMenuItem], a ; wLastMenuItem
ld [wLastMenuItem], a
ld [wcc37], a
push hl
ld hl, wd12c
bit 7, [hl]
ld hl, wTwoOptionMenuID
bit 7, [hl] ; select second menu item by default?
res 7, [hl]
jr z, .asm_758d
jr z, .storeCurrentMenuItem
inc a
.asm_758d
ld [wCurrentMenuItem], a ; wCurrentMenuItem
.storeCurrentMenuItem
ld [wCurrentMenuItem], a
pop hl
push hl
push hl
call Func_763e
ld a, [wd12c]
ld hl, MenuStrings ; $7671
call TwoOptionMenu_SaveScreenTiles
ld a, [wTwoOptionMenuID]
ld hl, TwoOptionMenuStrings
ld e, a
ld d, $0
ld a, $5
.loop
.menuStringLoop
add hl, de
dec a
jr nz, .loop
jr nz, .menuStringLoop
ld a, [hli]
ld c, a
ld a, [hli]
@ -1553,22 +1555,22 @@ DisplayYesNoTextBox: ; 7559 (1:7559)
ld d, h
pop hl
push de
ld a, [wd12c]
cp $5
jr nz, .asm_75b9
call Func_5ab3
jr .asm_75bc
.asm_75b9
ld a, [wTwoOptionMenuID]
cp TRADE_CANCEL_MENU
jr nz, .notTradeCancelMenu
call CableClub_TextBoxBorder
jr .afterTextBoxBorder
.notTradeCancelMenu
call TextBoxBorder
.asm_75bc
.afterTextBoxBorder
call UpdateSprites
pop hl
ld a, [hli]
and a
ld bc, $16
jr z, .asm_75ca
ld bc, $2a
.asm_75ca
and a ; put blank line before first menu item?
ld bc, 20 + 2
jr z, .noBlankLine
ld bc, 2 * 20 + 2
.noBlankLine
ld a, [hli]
ld e, a
ld a, [hli]
@ -1577,61 +1579,69 @@ DisplayYesNoTextBox: ; 7559 (1:7559)
add hl, bc
call PlaceString
ld hl, wd730
res 6, [hl]
ld a, [wd12c]
cp $7
jr nz, .asm_7603
res 6, [hl] ; turn on the printing delay
ld a, [wTwoOptionMenuID]
cp NO_YES_MENU
jr nz, .notNoYesMenu
; No/Yes menu
; this menu type ignores the B button
; it only seems to be used when confirming the deletion of a save file
xor a
ld [wd12c], a
ld [wTwoOptionMenuID], a
ld a, [wFlags_0xcd60]
push af
push hl
ld hl, wFlags_0xcd60
bit 5, [hl]
set 5, [hl]
set 5, [hl] ; don't play sound when A or B is pressed in menu
pop hl
.asm_75f0
.noYesMenuInputLoop
call HandleMenuInput
bit 1, a
jr nz, .asm_75f0
bit 1, a ; A button pressed?
jr nz, .noYesMenuInputLoop ; try again if A was not pressed
pop af
pop hl
ld [wFlags_0xcd60], a
ld a, (SFX_02_40 - SFX_Headers_02) / 3
call PlaySound
jr .asm_760f
.asm_7603
jr .pressedAButton
.notNoYesMenu
xor a
ld [wd12c], a
ld [wTwoOptionMenuID], a
call HandleMenuInput
pop hl
bit 1, a
jr nz, .asm_7627
.asm_760f
ld a, [wCurrentMenuItem] ; wCurrentMenuItem
bit 1, a ; A button pressed?
jr nz, .choseSecondMenuItem ; automatically choose the second option if B is pressed
.pressedAButton
ld a, [wCurrentMenuItem]
ld [wd12d], a
and a
jr nz, .asm_7627
jr nz, .choseSecondMenuItem
; chose first menu item
ld a, $1
ld [wd12e], a
ld c, $f
ld c, 15
call DelayFrames
call Func_7656
call TwoOptionMenu_RestoreScreenTiles
and a
ret
.asm_7627
.choseSecondMenuItem
ld a, $1
ld [wCurrentMenuItem], a ; wCurrentMenuItem
ld [wCurrentMenuItem], a
ld [wd12d], a
ld a, $2
ld [wd12e], a
ld c, $f
ld c, 15
call DelayFrames
call Func_7656
call TwoOptionMenu_RestoreScreenTiles
scf
ret
Func_763e: ; 763e (1:763e)
; Some of the wider/taller two option menus will not have the screen areas
; they cover be fully saved/restored by the two functions below.
; The bottom and right edges of the menu may remain after the function returns.
TwoOptionMenu_SaveScreenTiles: ; 763e (1:763e)
ld de, wHPBarMaxHP
ld bc, $506
.asm_7644
@ -1641,7 +1651,7 @@ Func_763e: ; 763e (1:763e)
dec c
jr nz, .asm_7644
push bc
ld bc, $e
ld bc, 14
add hl, bc
pop bc
ld c, $6
@ -1649,7 +1659,7 @@ Func_763e: ; 763e (1:763e)
jr nz, .asm_7644
ret
Func_7656: ; 7656 (1:7656)
TwoOptionMenu_RestoreScreenTiles: ; 7656 (1:7656)
ld de, wHPBarMaxHP
ld bc, $506
.asm_765c
@ -1668,7 +1678,12 @@ Func_7656: ; 7656 (1:7656)
call UpdateSprites
ret
MenuStrings: ; 7671 (1:7671)
; Format:
; 00: byte width
; 01: byte height
; 02: byte put blank line before first menu item
; 03: word text pointer
TwoOptionMenuStrings: ; 7671 (1:7671)
db 4,3,0
dw .YesNoMenu
db 6,3,0

View file

@ -20,7 +20,7 @@ CeladonGameCornerScript_48bcf: ; 48bcf (12:4bcf)
srl a
srl a
srl a
ld [wcd05], a
ld [wUnknownSlotVar], a
ret
CeladonGameCornerScript_48bec: ; 48bec (12:4bec)

View file

@ -1,5 +1,5 @@
CeladonPokecenterScript: ; 488b8 (12:48b8)
call Func_22fa
call Serial_TryEstablishingExternallyClockedConnection
jp EnableAutoTextBoxDrawing
CeladonPokecenterTextPointers: ; 488be (12:48be)

View file

@ -13,5 +13,5 @@ CeruleanHouse1Text2: ; 1d702 (7:5702)
db $08 ; asm
ld a, $6
ld [wWhichTrade], a
predef Predef54
predef DoInGameTradeDialogue
jp TextScriptEnd

View file

@ -1,5 +1,5 @@
CeruleanPokecenterScript: ; 5c645 (17:4645)
call Func_22fa
call Serial_TryEstablishingExternallyClockedConnection
jp EnableAutoTextBoxDrawing
CeruleanPokecenterTextPointers: ; 5c64b (17:464b)

View file

@ -1,5 +1,5 @@
CinnabarPokecenterScript: ; 75e2c (1d:5e2c)
call Func_22fa
call Serial_TryEstablishingExternallyClockedConnection
jp EnableAutoTextBoxDrawing
CinnabarPokecenterTextPointers: ; 75e32 (1d:5e32)

View file

@ -129,7 +129,7 @@ DayCareMScript_562e1: ; 562e1 (15:62e1)
ld hl, DayCareMText_56428
call PrintText
ld a, $13
ld [wd125], a
ld [wTextBoxID], a
call DisplayTextBoxID
call YesNoChoice
ld hl, DayCareMText_56437
@ -159,7 +159,7 @@ DayCareMScript_562e1: ; 562e1 (15:62e1)
ld a, (SFX_02_5a - SFX_Headers_02) / 3
call PlaySoundWaitForCurrent
ld a, $13
ld [wd125], a
ld [wTextBoxID], a
call DisplayTextBoxID
ld hl, DayCareMText_5644f
call PrintText

View file

@ -1,5 +1,5 @@
FuchsiaPokecenterScript: ; 75063 (1d:5063)
call Func_22fa
call Serial_TryEstablishingExternallyClockedConnection
jp EnableAutoTextBoxDrawing
FuchsiaPokecenterTextPointers: ; 75069 (1d:5069)

View file

@ -1,5 +1,5 @@
IndigoPlateauLobbyScript: ; 19c5b (6:5c5b)
call Func_22fa
call Serial_TryEstablishingExternallyClockedConnection
call EnableAutoTextBoxDrawing
ld hl, wd126
bit 6, [hl]

View file

@ -21,5 +21,5 @@ Lab2Text3: ; 75c37 (1d:5c37)
ld a, $8
ld [wWhichTrade], a
asm_78552: ; 75c3d (1d:5c3d)
predef Predef54
predef DoInGameTradeDialogue
jp TextScriptEnd

View file

@ -108,7 +108,7 @@ Lab4Text2: ; 75dda (1d:5dda)
db $08 ; asm
ld a, $3
ld [wWhichTrade], a
predef Predef54
predef DoInGameTradeDialogue
jp TextScriptEnd
LoadFossilItemAndMonNameBank1D: ; 75de8 (1d:5de8)

View file

@ -1,5 +1,5 @@
LavenderPokecenterScript: ; 5c8da (17:48da)
call Func_22fa
call Serial_TryEstablishingExternallyClockedConnection
jp EnableAutoTextBoxDrawing
LavenderPokecenterTextPointers: ; 5c8e0 (17:48e0)

View file

@ -1,5 +1,5 @@
MtMoonPokecenterScript: ; 492cf (12:52cf)
call Func_22fa
call Serial_TryEstablishingExternallyClockedConnection
jp EnableAutoTextBoxDrawing
MtMoonPokecenterTextPointers: ; 492d5 (12:52d5)
@ -29,7 +29,7 @@ MtMoonPokecenterText4: ; 492ec (12:52ec)
ld hl, MtMoonPokecenterText_4935c
call PrintText
ld a, $13
ld [wd125], a
ld [wTextBoxID], a
call DisplayTextBoxID
call YesNoChoice
ld a, [wCurrentMenuItem]
@ -57,7 +57,7 @@ MtMoonPokecenterText4: ; 492ec (12:52ec)
ld c, $3
predef SubBCDPredef
ld a, $13
ld [wd125], a
ld [wTextBoxID], a
call DisplayTextBoxID
ld hl, wd7c6
set 7, [hl]

View file

@ -70,7 +70,7 @@ Museum1FText1: ; 5c135 (17:4135)
jp asm_d1145
.asm_3ded4
ld a, $13
ld [wd125], a
ld [wTextBoxID], a
call DisplayTextBoxID
xor a
ld [hJoyHeld], a
@ -105,7 +105,7 @@ Museum1FText1: ; 5c135 (17:4135)
ld c, $3
predef SubBCDPredef
ld a, $13
ld [wd125], a
ld [wTextBoxID], a
call DisplayTextBoxID
ld a, (SFX_02_5a - SFX_Headers_02) / 3
call PlaySoundWaitForCurrent

View file

@ -1,5 +1,5 @@
PewterPokecenterScript: ; 5c587 (17:4587)
call Func_22fa
call Serial_TryEstablishingExternallyClockedConnection
jp EnableAutoTextBoxDrawing
PewterPokecenterTextPointers: ; 5c58d (17:458d)

View file

@ -1,5 +1,5 @@
RockTunnelPokecenterScript: ; 493ba (12:53ba)
call Func_22fa
call Serial_TryEstablishingExternallyClockedConnection
jp EnableAutoTextBoxDrawing
RockTunnelPokecenterTextPointers: ; 493c0 (12:53c0)

View file

@ -11,7 +11,7 @@ Route11GateUpstairsText1: ; 4945f (12:545f)
db $08 ; asm
xor a
ld [wWhichTrade], a
predef Predef54
predef DoInGameTradeDialogue
asm_49469: ; 49469 (12:5469)
jp TextScriptEnd

View file

@ -10,7 +10,7 @@ Route18GateUpstairsText1: ; 4997e (12:597e)
db $08 ; asm
ld a, $5
ld [wWhichTrade], a
predef Predef54
predef DoInGameTradeDialogue
jp TextScriptEnd
Route18GateUpstairsText2: ; 4998c (12:598c)

View file

@ -13,5 +13,5 @@ Route2HouseText2: ; 1def9 (7:5ef9)
db $08 ; asm
ld a, $1
ld [wWhichTrade], a
predef Predef54
predef DoInGameTradeDialogue
jp TextScriptEnd

View file

@ -2,7 +2,7 @@
ld hl,.ForJust500Text
call PrintText
ld a,$13
ld [wd125],a
ld [wTextBoxID],a
call DisplayTextBoxID
call YesNoChoice
ld a,[wCurrentMenuItem]
@ -49,7 +49,7 @@
call $3736
call $373e
ld a,$13
ld [wd125],a
ld [wTextBoxID],a
call DisplayTextBoxID
ld hl,.MakePaymentText
call PrintText

View file

@ -148,7 +148,7 @@ SafariZoneEntranceTextPointers: ; 752b9 (1d:52b9)
TX_FAR SafariZoneEntranceText_9e6e4 ; 0x9e6e4
db $8
ld a, $13
ld [wd125],a
ld [wTextBoxID],a
call DisplayTextBoxID
call YesNoChoice
ld a,[wCurrentMenuItem]
@ -178,7 +178,7 @@ SafariZoneEntranceTextPointers: ; 752b9 (1d:52b9)
ld c,3
predef SubBCDPredef
ld a,$13
ld [wd125],a
ld [wTextBoxID],a
call DisplayTextBoxID
ld hl,.MakePaymentText
call PrintText

View file

@ -1,5 +1,5 @@
SaffronPokecenterScript: ; 5d535 (17:5535)
call Func_22fa
call Serial_TryEstablishingExternallyClockedConnection
jp EnableAutoTextBoxDrawing
SaffronPokecenterTextPointers: ; 5d53b (17:553b)

View file

@ -13,6 +13,6 @@ UndergroundPathEntranceRoute5Text1: ; 5d6b2 (17:56b2)
db $08 ; asm
ld a, $9
ld [wWhichTrade], a
predef Predef54
predef DoInGameTradeDialogue
ld hl, UndergroundPathEntranceRoute5_5d6af
ret

View file

@ -8,5 +8,5 @@ VermilionHouse3Text1: ; 19c17 (6:5c17)
db $08 ; asm
ld a, $4
ld [wWhichTrade], a
predef Predef54
predef DoInGameTradeDialogue
jp TextScriptEnd

View file

@ -1,5 +1,5 @@
VermilionPokecenterScript: ; 5c98f (17:498f)
call Func_22fa
call Serial_TryEstablishingExternallyClockedConnection
jp EnableAutoTextBoxDrawing
VermilionPokecenterTextPointers: ; 5c995 (17:4995)

View file

@ -1,5 +1,5 @@
ViridianPokeCenterScript: ; 4425d (11:425d)
call Func_22fa
call Serial_TryEstablishingExternallyClockedConnection
jp EnableAutoTextBoxDrawing
ViridianPokecenterTextPointers: ; 44263 (11:4263)

View file

@ -1231,7 +1231,7 @@ _NoMovesLeftText:: ; 89892 (22:5892)
_MultiHitText:: ; 898aa (22:58aa)
text "Hit the enemy"
line "@"
TX_NUM W_NUMHITS,1,1
TX_NUM wPlayerNumHits,1,1
text " times!"
prompt
@ -1450,7 +1450,7 @@ _MirrorMoveFailedText:: ; 89b96 (22:5b96)
_HitXTimesText:: ; 89baf (22:5baf)
text "Hit @"
TX_NUM wcd05, 1, 1
TX_NUM wEnemyNumHits, 1, 1
text " times!"
prompt
@ -1973,7 +1973,7 @@ _HisNameIsText:: ; 8a64a (22:664a)
prompt
_WillBeTradedText:: ; 8a677 (22:6677)
TX_RAM wTrainerFacingDirection
TX_RAM wNameOfPlayerMonToBeTraded
text " and"
line "@"
TX_RAM wcd6d
@ -2787,19 +2787,19 @@ _PokemonCenterFarewellText:: ; a2910 (28:6910)
line "you again!"
done
_CableClubNPCText7:: ; a292b (28:692b)
_CableClubNPCAreaReservedFor2FriendsLinkedByCableText:: ; a292b (28:692b)
text "This area is"
line "reserved for 2"
cont "friends who are"
cont "linked by cable."
done
_CableClubNPCText1:: ; a2969 (28:6969)
_CableClubNPCWelcomeText:: ; a2969 (28:6969)
text "Welcome to the"
line "Cable Club!"
done
_CableClubNPCText2:: ; a2985 (28:6985)
_CableClubNPCPleaseApplyHereHaveToSaveText:: ; a2985 (28:6985)
text "Please apply here."
para "Before opening"
@ -2807,10 +2807,10 @@ _CableClubNPCText2:: ; a2985 (28:6985)
cont "to save the game."
done
_CableClubNPCText3:: ; a29cc (28:69cc)
_CableClubNPCPleaseWaitText:: ; a29cc (28:69cc)
text "Please wait.@@"
_CableClubNPCText4:: ; a29db (28:69db)
_CableClubNPCLinkClosedBecauseOfInactivityText:: ; a29db (28:69db)
text "The link has been"
line "closed because of"
cont "inactivity."
@ -2823,11 +2823,11 @@ _CableClubNPCText4:: ; a29db (28:69db)
SECTION "Text 10", ROMX, BANK[TEXT_10]
_CableClubNPCText5:: ; a4000 (29:4000)
_CableClubNPCPleaseComeAgainText:: ; a4000 (29:4000)
text "Please come again!"
done
_CableClubNPCText6:: ; a4014 (29:4014)
_CableClubNPCMakingPreparationsText:: ; a4014 (29:4014)
text "We're making"
line "preparations."
cont "Please wait."
@ -3229,21 +3229,21 @@ _ConnectCableText:: ; a809a (2a:409a)
_TradedForText:: ; a80bc (2a:40bc)
text $52, " traded"
line "@"
TX_RAM wcd13
TX_RAM wInGameTradeGiveMonName
text " for"
cont "@"
TX_RAM wPlayerMonAccuracyMod
TX_RAM wInGameTradeReceiveMonName
text "!@@"
_WannaTrade1Text:: ; a80d8 (2a:40d8)
text "I'm looking for"
line "@"
TX_RAM wcd13
TX_RAM wInGameTradeGiveMonName
text "! Wanna"
para "trade one for"
line "@"
TX_RAM wPlayerMonAccuracyMod
TX_RAM wInGameTradeReceiveMonName
text "? "
done
@ -3255,7 +3255,7 @@ _NoTrade1Text:: ; a810b (2a:410b)
_WrongMon1Text:: ; a811d (2a:411d)
text "What? That's not"
line "@"
TX_RAM wcd13
TX_RAM wInGameTradeGiveMonName
text "!"
para "If you get one,"
@ -3269,7 +3269,7 @@ _Thanks1Text:: ; a8155 (2a:4155)
_AfterTrade1Text:: ; a8162 (2a:4162)
text "Isn't my old"
line "@"
TX_RAM wPlayerMonAccuracyMod
TX_RAM wInGameTradeReceiveMonName
text " great?"
done
@ -3278,10 +3278,10 @@ _WannaTrade2Text:: ; a817c (2a:417c)
line "you want to trade"
para "your @"
TX_RAM wcd13
TX_RAM wInGameTradeGiveMonName
db $0
line "for @"
TX_RAM wPlayerMonAccuracyMod
TX_RAM wInGameTradeReceiveMonName
text "?"
done
@ -3293,7 +3293,7 @@ _NoTrade2Text:: ; a81b5 (2a:41b5)
_WrongMon2Text:: ; a81d3 (2a:41d3)
text "Hmmm? This isn't"
line "@"
TX_RAM wcd13
TX_RAM wInGameTradeGiveMonName
text "."
para "Think of me when"
@ -3313,7 +3313,7 @@ IF DEF(_YELLOW)
cont "magnificent!"
ELSE
text "The @"
TX_RAM wcd13
TX_RAM wInGameTradeGiveMonName
text " you"
line "traded to me"
@ -3324,12 +3324,12 @@ ENDC
_WannaTrade3Text:: ; a8240 (2a:4240)
text "Hi! Do you have"
line "@"
TX_RAM wcd13
TX_RAM wInGameTradeGiveMonName
text "?"
para "Want to trade it"
line "for @"
TX_RAM wPlayerMonAccuracyMod
TX_RAM wInGameTradeReceiveMonName
text "?"
done
@ -3340,7 +3340,7 @@ _NoTrade3Text:: ; a8274 (2a:4274)
_WrongMon3Text:: ; a8284 (2a:4284)
text "...This is no"
line "@"
TX_RAM wcd13
TX_RAM wInGameTradeGiveMonName
text "."
para "If you get one,"
@ -3358,11 +3358,11 @@ ENDC
_AfterTrade3Text:: ; a82c9 (2a:42c9)
text "How is my old"
line "@"
TX_RAM wPlayerMonAccuracyMod
TX_RAM wInGameTradeReceiveMonName
text "?"
para "My @"
TX_RAM wcd13
TX_RAM wInGameTradeGiveMonName
text " is"
line "doing great!"
done

192
wram.asm
View file

@ -183,12 +183,21 @@ wTileMap:: ; c3a0
; buffer for tiles that are visible on screen (20 columns by 18 rows)
ds 20 * 18
wSerialPartyMonsPatchList:: ; c508
; list of indexes to patch with SERIAL_NO_DATA_BYTE after transfer
wTileMapBackup:: ; c508
; buffer for temporarily saving and restoring current screen's tiles
; (e.g. if menus are drawn on top)
ds 20 * 18
; ds 20 * 18
ds 120
ds 200
wSerialEnemyMonsPatchList:: ; c5d0
; list of indexes to patch with SERIAL_NO_DATA_BYTE after transfer
ds 200
ds 80
wTempPic::
wOverworldMap:: ; c6e8
@ -257,7 +266,12 @@ wListScrollOffset:: ; cc36
ds 1
wcc37:: ds 1
wcc38:: ds 2
wTradeCenterPointerTableIndex:: ; cc38
ds 1
ds 1
wcc3a:: ds 1
wcc3b:: ds 1
@ -265,12 +279,46 @@ wDoNotWaitForButtonPressAfterDisplayingText:: ; cc3c
; if non-zero, skip waiting for a button press after displaying text in DisplayTextID
ds 1
wSerialSyncAndExchangeNybbleReceiveData:: ; cc3d
; the final received nybble is stored here by Serial_SyncAndExchangeNybble
wSerialExchangeNybbleTempReceiveData:: ; cc3d
; temporary nybble used by Serial_ExchangeNybble
wLinkMenuSelectionReceiveBuffer:: ; cc3d
; two byte buffer
; the received menu selection is stored twice
wcc3d:: ds 1
wcc3e:: ds 4
wcc42:: ds 1
wcc43:: ds 4
wSerialExchangeNybbleReceiveData:: ; cc3e
; the final received nybble is stored here by Serial_ExchangeNybble
ds 1
ds 3
wSerialExchangeNybbleSendData:: ; cc42
; this nybble is sent when using Serial_SyncAndExchangeNybble or Serial_ExchangeNybble
wLinkMenuSelectionSendBuffer:: ; cc42
; two byte buffer
; the menu selection byte is stored twice before sending
ds 5
wLinkTimeoutCounter:: ; cc47
; 1 byte
wUnknownSerialCounter:: ; cc47
; 2 bytes
wcc47:: ds 1
wcc48:: ds 1
wWhichTradeMonSelectionMenu:: ; cc49
; $00 = player mons
; $01 = enemy mons
wcc49:: ds 1
wMenuWrappingEnabled:: ; cc4a
@ -348,7 +396,7 @@ wPlayerSelectedMove:: ; ccdc
wEnemySelectedMove:: ; ccdd
ds 1
wLinkBattleRNCount:: ; ccde
wLinkBattleRandomNumberListIndex:: ; ccde
ds 1
wAICount:: ; ccdf
@ -391,24 +439,32 @@ wPartyFoughtCurrentEnemyFlags::
wccf6:: ds 1
wccf7:: ds 14
wcd05:: ds 1
wcd06:: ds 9
wPlayerMonUnmodifiedLevel:: ; cd0f
ds 0
wcd0f:: ; overload, used in in-game trade code
wUnknownSlotVar:: ; cd05
wEnemyNumHits:: ; cd05
; number of hits by enemy in attacks like Double Slap, etc.
wEnemyBideAccumulatedDamage:: ; cd05
; the amount of damage accumulated by the enemy while biding (2 bytes)
ds 10
wInGameTradeGiveMonSpecies:: ; cd0f
wPlayerMonUnmodifiedLevel:: ; cd0f
ds 1
wInGameTradeTextPointerTablePointer:: ; cd10
wPlayerMonUnmodifiedMaxHP:: ; cd10
ds 0
wcd10:: ; overload, used in in-game trade code
ds 1
wcd11:: ; overload, used in in-game trade code
ds 1
ds 2
wInGameTradeTextPointerTableIndex:: ; cd12
wPlayerMonUnmodifiedAttack:: ; cd12
ds 0
wcd12:: ; overload, used in in-game trade code
ds 1
wcd13:: ; overload, used in in-game trade code (to store name string)
wInGameTradeGiveMonName:: ; cd13
ds 1
wPlayerMonUnmodifiedDefense:: ; cd14
ds 2
@ -430,6 +486,9 @@ wPlayerMonSpeedMod:: ; cd1c
ds 1
wPlayerMonSpecialMod:: ; cd1d
ds 1
wInGameTradeReceiveMonName:: ; cd1e
wPlayerMonAccuracyMod:: ; cd1e
ds 1
wPlayerMonEvasionMod:: ; cd1f
@ -445,8 +504,10 @@ wEnemyMonUnmodifiedAttack:: ; cd26
ds 2
wEnemyMonUnmodifiedDefense:: ; cd28
ds 1
wcd29:: ; overload, used in in-game trade code
wInGameTradeMonNick:: ; cd29
ds 1
wEnemyMonUnmodifiedSpeed:: ; cd2a
ds 2
wEnemyMonUnmodifiedSpecial:: ; cd2c
@ -475,7 +536,10 @@ wEnemyMonAccuracyMod:: ; cd32
wEnemyMonEvasionMod:: ; cd33
ds 1
wcd34:: ds 3
wInGameTradeReceiveMonSpecies::
ds 1
ds 2
wNPCMovementDirections2Index:: ; cd37
@ -501,6 +565,10 @@ wOverrideSimulatedJoypadStatesMask:: ; cd3b
ds 1
wTradedPlayerMonSpecies:: ; cd3d
wTradingWhichPlayerMon:: ; cd3d
wChangeBoxSavedMapTextPointer:: ; cd3d
wFlyAnimUsingCoordList:: ; cd3d
@ -520,6 +588,10 @@ wWhichTrade:: ; cd3d
wTrainerSpriteOffset:: ; cd3d
ds 1
wTradedEnemyMonSpecies:: ; cd3e
wTradingWhichEnemyMon:: ; cd3e
wFlyAnimCounter:: ; cd3e
wPlayerSpinInPlaceAnimFrameDelayDelta:: ; cd3e
@ -531,6 +603,8 @@ wHiddenObjectFunctionRomBank:: ; cd3e
wTrainerEngageDistance:: ; cd3e
ds 1
wNameOfPlayerMonToBeTraded:: ; cd3f
wFlyAnimBirdSpriteImageIndex:: ; cd3f
wPlayerSpinInPlaceAnimFrameDelayEndValue:: ; cd3f
@ -550,7 +624,9 @@ wHiddenObjectY:: ; cd40
wTrainerScreenY:: ; cd40
ds 1
wHiddenObjectX:: ; cd40
wTradedPlayerMonOT:: ; cd41
wHiddenObjectX:: ; cd41
wTrainerScreenX:: ; cd41
ds 1
@ -565,13 +641,21 @@ wcd48:: ds 1
wcd49:: ds 1
wcd4a:: ds 1
wcd4b:: ds 1
wTradedPlayerMonOTID:: ; cd4c
wcd4c:: ds 1
wcd4d:: ds 1
wTradedEnemyMonOT:: ; cd4e
wcd4e:: ds 1
wcd4f:: ds 1
wcd50:: ds 9
wcd59:: ds 1
wcd5a:: ds 1
wTradedEnemyMonOTID:: ; cd59
ds 2
wcd5b:: ds 1
wcd5c:: ds 1
wcd5d:: ds 1
@ -581,6 +665,7 @@ wcd5f:: ds 1
wFlags_0xcd60:: ; cd60
; bit 0: is player engaged by trainer (to avoid being engaged by multiple trainers simultaneously)
; bit 1: boulder dust animation (from using Strength) pending
; bit 5: don't play sound when A or B is pressed in menu
; bit 6: tried pushing against boulder once (you need to push twice before it will move)
ds 1
@ -599,6 +684,9 @@ wcd72:: ds 5
wcd77:: ds 1
wcd78:: ds 9
wSerialOtherGameboyRandomNumberListBlock:: ; cd81
; buffer for transferring the random number list generated by the other gameboy
wTileMapBackup2:: ; cd81
; second buffer for temporarily saving and restoring current screen's tiles (e.g. if menus are drawn on top)
ds 20 * 18
@ -960,11 +1048,16 @@ W_ENEMYDISABLEDMOVE:: ; d072
ds 1
W_NUMHITS:: ; d074
; number of hits in attacks like Doubleslap, etc.
ds 1
wPlayerNumHits:: ; d074
; number of hits by player in attacks like Double Slap, etc.
wd075:: ds 3
wPlayerBideAccumulatedDamage:: ; d074
; the amount of damage accumulated by the player while biding (2 bytes)
wUnknownSerialCounter2:: ; d075
; 2 bytes
ds 4
wEscapedFromBattle::
; non-zero when an item or move that allows escape from battle was used
@ -1205,7 +1298,10 @@ wNumRunAttempts::
wd121:: ds 1
wd122:: ds 2
wd124:: ds 1
wd125:: ds 1
wTextBoxID:: ; d125
ds 1
wd126:: ds 1
W_CURENEMYLVL:: ; d127
@ -1215,10 +1311,10 @@ wd128:: ds 1
wd129:: ds 1
wd12a:: ds 1
W_ISLINKBATTLE:: ; d12b
wLinkState:: ; d12b
ds 1
wd12c:: ds 1
wTwoOptionMenuID:: ds 1
wd12d:: ds 1
wd12e:: ds 1
wd12f:: ds 1
@ -1250,10 +1346,20 @@ W_PRIZE3:: ; d13f
ds 1
wSerialRandomNumberListBlock:: ; d141
; the first 7 bytes are the preamble
wd141:: ds 2
wd143:: ds 2
wd145:: ds 3
wd148:: ds 10
wLinkBattleRandomNumberList:: ; d148
; shared list of 9 random numbers, indexed by wLinkBattleRandomNumberListIndex
ds 10
wSerialPlayerDataBlock:: ; d152
; the first 6 bytes are the preamble
wd152:: ds 1
wd153:: ds 3
wd156:: ds 1
@ -1886,7 +1992,11 @@ wd736:: ; d736
; bit 6: jumping down a ledge
ds 1
wd737:: ds 4
wCompletedInGameTradeFlags:: ; d737
ds 2
ds 2
wd73b:: ds 1
wd73c:: ds 3
@ -1902,7 +2012,16 @@ wd743:: ds 1
wd744:: ds 3
wd747:: ds 3
wd74a:: ds 1
wd74b:: ds 1
wd74b:: ; d74b
; bit 0: Prof. Oak has lead the player to the north end of his lab
; bit 1: Prof. Oak has asked the player to choose a pokemon
; bit 2: the player and the rival have received their pokemon
; bit 3: the player has battled the rival in Oak's lab
; bit 4: Prof. Oak has given the player 5 pokeballs
; bit 5: received pokedex
ds 1
wd74c:: ds 2
wd74e:: ds 3
wd751:: ds 1
@ -2028,6 +2147,9 @@ wd880:: ds 1
wd881:: ds 1
wd882:: ds 5
wLinkEnemyTrainerName:: ; d887
; linked game's trainer name
W_GRASSRATE:: ; d887
ds 1