summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluckytyphlosion <alan.rj.huang@gmail.com>2015-12-23 15:40:59 -0500
committerluckytyphlosion <alan.rj.huang@gmail.com>2015-12-23 15:40:59 -0500
commit043e9327650f2ee0053fe43a29c9d63bc5e120d3 (patch)
tree0fe1b2d958825dfd22d921d77fe068087e164ddf
parent8b82d13dd520d387f926db819fda949ad0021b53 (diff)
engine/trade.asm, trade2.asm, intro.asm, overworld/emotion_bubbles.asm
Also document Func_1681 (GetFarByte) and fix Missingno's dex entry
-rwxr-xr-xdata/pokedex_entries.asm6
-rwxr-xr-xengine/intro.asm367
-rwxr-xr-xengine/overworld/emotion_bubbles.asm36
-rwxr-xr-xengine/trade.asm140
-rwxr-xr-xengine/trade2.asm14
-rw-r--r--gfx/emotion_bubbles.pngbin149 -> 269 bytes
-rw-r--r--home/copy2.asm12
-rwxr-xr-xyellow/main.asm15
8 files changed, 153 insertions, 437 deletions
diff --git a/data/pokedex_entries.asm b/data/pokedex_entries.asm
index 3635ddff..8b021287 100755
--- a/data/pokedex_entries.asm
+++ b/data/pokedex_entries.asm
@@ -1260,6 +1260,6 @@ MissingNoDexEntry: ; 41072 (10:5072)
; what the game sees
; db "???@"
-; db 10,100 ; 10 feet 100 inches
-; dw 41097 ; dw "コメ"
-; db "ント さくせいちゅう@" ; a whole bunch of sound effects \ No newline at end of file
+; db 10,100 ; 10 feet, 100 inches
+; dw 35072 ; dw ("コ" << 8 | 0), 3507.2 lbs
+; db "メント さくせいちゅう@" ; a whole bunch of sound effects \ No newline at end of file
diff --git a/engine/intro.asm b/engine/intro.asm
index d4db9c93..27a357a7 100755
--- a/engine/intro.asm
+++ b/engine/intro.asm
@@ -2,14 +2,13 @@ MOVE_GENGAR_RIGHT EQU $00
MOVE_GENGAR_LEFT EQU $01
MOVE_NIDORINO_RIGHT EQU $ff
-PlayIntro: ; 41682 (10:5682)
+PlayIntro: ; 41997 (10:5997)
xor a
ld [hJoyHeld], a
inc a
ld [H_AUTOBGTRANSFERENABLED], a
call PlayShootingStar
- call PlayIntroScene
- call GBFadeOutToWhite
+ callab PlayIntroScene ; 3e:582d
xor a
ld [hSCX], a
ld [H_AUTOBGTRANSFERENABLED], a
@@ -17,163 +16,7 @@ PlayIntro: ; 41682 (10:5682)
call DelayFrame
ret
-PlayIntroScene: ; 4169d (10:569d)
- ld b, SET_PAL_NIDORINO_INTRO
- call RunPaletteCommand
- ld a, %11100100
- ld [rBGP], a
- ld [rOBP0], a
- ld [rOBP1], a
- xor a
- ld [hSCX], a
- ld b, $3 ; Gengar tiles
- call IntroCopyTiles
- ld a, 0
- ld [wBaseCoordX], a
- ld a, 80
- ld [wBaseCoordY], a
- lb bc, 6, 6
- call InitIntroNidorinoOAM
- lb de, 80 / 2, MOVE_NIDORINO_RIGHT
- call IntroMoveMon
- ret c
-
-; hip
- ld a, SFX_INTRO_HIP
- call PlaySound
- xor a
- ld [wIntroNidorinoBaseTile], a
- ld de, IntroNidorinoAnimation1
- call AnimateIntroNidorino
-; hop
- ld a, SFX_INTRO_HOP
- call PlaySound
- ld de, IntroNidorinoAnimation2
- call AnimateIntroNidorino
- ld c, $a
- call CheckForUserInterruption
- ret c
-
-; hip
- ld a, SFX_INTRO_HIP
- call PlaySound
- ld de, IntroNidorinoAnimation1
- call AnimateIntroNidorino
-; hop
- ld a, SFX_INTRO_HOP
- call PlaySound
- ld de, IntroNidorinoAnimation2
- call AnimateIntroNidorino
- ld c, $1e
- call CheckForUserInterruption
- ret c
-
-; raise
- ld b, $4
- call IntroCopyTiles
- ld a, SFX_INTRO_RAISE
- call PlaySound
- lb de, 8 / 2, MOVE_GENGAR_LEFT
- call IntroMoveMon
- ld c, $1e
- call CheckForUserInterruption
- ret c
-
-; slash
- ld b, $5
- call IntroCopyTiles
- ld a, SFX_INTRO_CRASH
- call PlaySound
- lb de, 16 / 2, MOVE_GENGAR_RIGHT
- call IntroMoveMon
-; hip
- ld a, SFX_INTRO_HIP
- call PlaySound
- ld a, $24
- ld [wIntroNidorinoBaseTile], a
- ld de, IntroNidorinoAnimation3
- call AnimateIntroNidorino
- ld c, $1e
- call CheckForUserInterruption
- ret c
-
- lb de, 8 / 2, MOVE_GENGAR_LEFT
- call IntroMoveMon
- ld b, $3
- call IntroCopyTiles
- ld c, $3c
- call CheckForUserInterruption
- ret c
-
-; hip
- ld a, SFX_INTRO_HIP
- call PlaySound
- xor a
- ld [wIntroNidorinoBaseTile], a
- ld de, IntroNidorinoAnimation4
- call AnimateIntroNidorino
-; hop
- ld a, SFX_INTRO_HOP
- call PlaySound
- ld de, IntroNidorinoAnimation5
- call AnimateIntroNidorino
- ld c, $14
- call CheckForUserInterruption
- ret c
-
- ld a, $24
- ld [wIntroNidorinoBaseTile], a
- ld de, IntroNidorinoAnimation6
- call AnimateIntroNidorino
- ld c, $1e
- call CheckForUserInterruption
- ret c
-
-; lunge
- ld a, SFX_INTRO_LUNGE
- call PlaySound
- ld a, $48
- ld [wIntroNidorinoBaseTile], a
- ld de, IntroNidorinoAnimation7
- jp AnimateIntroNidorino
-
-AnimateIntroNidorino: ; 41793 (10:5793)
- ld a, [de]
- cp $50
- ret z
- ld [wBaseCoordY], a
- inc de
- ld a, [de]
- ld [wBaseCoordX], a
- push de
- ld c, 6 * 6
- call UpdateIntroNidorinoOAM
- ld c, 5
- call DelayFrames
- pop de
- inc de
- jr AnimateIntroNidorino
-
-UpdateIntroNidorinoOAM: ; 417ae (10:57ae)
- ld hl, wOAMBuffer
- ld a, [wIntroNidorinoBaseTile]
- ld d, a
-.loop
- ld a, [wBaseCoordY]
- add [hl]
- ld [hli], a ; Y
- ld a, [wBaseCoordX]
- add [hl]
- ld [hli], a ; X
- ld a, d
- ld [hli], a ; tile
- inc hl
- inc d
- dec c
- jr nz, .loop
- ret
-
-InitIntroNidorinoOAM: ; 417c7 (10:57c7)
+InitIntroNidorinoOAM: ; 419b4 (10:59b4)
ld hl, wOAMBuffer
ld d, 0
.loop
@@ -202,17 +45,17 @@ InitIntroNidorinoOAM: ; 417c7 (10:57c7)
jr nz, .loop
ret
-IntroClearScreen: ; 417f0 (10:57f0)
+IntroClearScreen: ; 419dd (10:59dd)
ld hl, vBGMap1
ld bc, $240
jr IntroClearCommon
-IntroClearMiddleOfScreen: ; 417f8 (10:57f8)
+IntroClearMiddleOfScreen: ; 419e5 (10:59e5)
; clear the area of the tile map between the black bars on the top and bottom
coord hl, 0, 4
ld bc, SCREEN_WIDTH * 10
-IntroClearCommon: ; 417fe (10:57fe)
+IntroClearCommon: ; 419eb (10:59eb)
ld [hl], $0
inc hl
dec bc
@@ -221,7 +64,7 @@ IntroClearCommon: ; 417fe (10:57fe)
jr nz, IntroClearCommon
ret
-IntroPlaceBlackTiles: ; 41807 (10:5807)
+IntroPlaceBlackTiles: ; 419f4 (10:59f4)
ld a, $1
.loop
ld [hli], a
@@ -229,84 +72,17 @@ IntroPlaceBlackTiles: ; 41807 (10:5807)
jr nz, .loop
ret
-IntroMoveMon: ; 4180e (10:580e)
-; d = number of times to move the mon (2 pixels each time)
-; e: $00 = move Gengar right, $01 = move Gengar left, $ff = move Nidorino right
- ld a, e
- cp $ff
- jr z, .moveNidorinoRight
- cp $1
- jr z, .moveGengarLeft
-; move Gengar right
- ld a, [hSCX]
- dec a
- dec a
- jr .next
-.moveNidorinoRight
- push de
- ld a, 2
- ld [wBaseCoordX], a
- xor a
- ld [wBaseCoordY], a
- ld c, 6 * 6
- call UpdateIntroNidorinoOAM
- pop de
-.moveGengarLeft
- ld a, [hSCX]
- inc a
- inc a
-.next
- ld [hSCX], a
- push de
- ld c, 2
- call CheckForUserInterruption
- pop de
- ret c
- dec d
- jr nz, IntroMoveMon
- ret
-
-IntroCopyTiles: ; 4183f (10:583f)
- coord hl, 13, 7
-
-CopyTileIDsFromList_ZeroBaseTileID: ; 41842 (10:5842)
+CopyTileIDsFromList_ZeroBaseTileID: ; 419fb (10:59fb)
ld c, 0
predef_jump CopyTileIDsFromList
-PlayMoveSoundB: ; 41849 (10:5849)
-; unused
- predef GetMoveSoundB
- ld a, b
- jp PlaySound
-
-LoadIntroGraphics: ; 41852 (10:5852)
- ld hl, FightIntroBackMon
- ld de, vChars2
- ld bc, FightIntroBackMonEnd - FightIntroBackMon
- ld a, BANK(FightIntroBackMon)
- call FarCopyData
- ld hl, GameFreakIntro
- ld de, vChars2 + $600
- ld bc, GameFreakIntroEnd - GameFreakIntro
- ld a, BANK(GameFreakIntro)
- call FarCopyData
- ld hl, GameFreakIntro
- ld de, vChars1
- ld bc, GameFreakIntroEnd - GameFreakIntro
- ld a, BANK(GameFreakIntro)
- call FarCopyData
- ld hl, FightIntroFrontMon
- ld de, vChars0
- ld bc, FightIntroFrontMonEnd - FightIntroFrontMon
- ld a, BANK(FightIntroFrontMon)
- jp FarCopyData
-
-PlayShootingStar: ; 4188a (10:588a)
+PlayShootingStar: ; 41a02 (10:5a02)
ld b, SET_PAL_GAME_FREAK_INTRO
call RunPaletteCommand
callba LoadCopyrightAndTextBoxTiles
- ld a, $e4
+ ld a, %11100100
ld [rBGP], a
+ call UpdateGBCPal_BGP
ld c, 180
call DelayFrames
call ClearScreen
@@ -314,7 +90,27 @@ PlayShootingStar: ; 4188a (10:588a)
xor a
ld [wCurOpponent], a
call IntroDrawBlackBars
- call LoadIntroGraphics
+; write the black and white tiles
+ ld hl, vChars2
+ ld bc, $10
+ xor a
+ call FillMemory
+ ld hl, vChars2 + $10
+ ld bc, $10
+ ld a, $ff
+ call FillMemory
+; copy gamefreak logo and others
+ ld hl, GameFreakIntro
+ ld de, vChars2 + $600
+ ld bc, GameFreakIntroEnd - GameFreakIntro
+ ld a, BANK(GameFreakIntro)
+ call FarCopyData
+ ld hl, GameFreakIntro
+ ld de, vChars1
+ ld bc, GameFreakIntroEnd - GameFreakIntro
+ ld a, BANK(GameFreakIntro)
+ call FarCopyData
+
call EnableLCD
ld hl, rLCDC
res 5, [hl]
@@ -328,17 +124,11 @@ PlayShootingStar: ; 4188a (10:588a)
ld c, 40
call DelayFrames
.next
- ld a, BANK(Music_IntroBattle)
- ld [wAudioROMBank], a
- ld [wAudioSavedROMBank], a
- ld a, MUSIC_INTRO_BATTLE
- ld [wNewSoundID], a
- call PlaySound
call IntroClearMiddleOfScreen
call ClearSprites
jp Delay3
-IntroDrawBlackBars: ; 418e9 (10:58e9)
+IntroDrawBlackBars: ; 41a82 (10:5a82)
; clear the screen and draw black bars on the top and bottom
call IntroClearScreen
coord hl, 0, 0
@@ -354,96 +144,11 @@ IntroDrawBlackBars: ; 418e9 (10:58e9)
ld c, $80
jp IntroPlaceBlackTiles
-EmptyFunc4: ; 4190c (10:590c)
+EmptyFunc4: ; 41aa5 (10:5aa5)
ret
-IntroNidorinoAnimation0: ; 4190d (10:590d)
- db 0, 0
- db $50
-
-IntroNidorinoAnimation1: ; 41910 (10:5910)
-; This is a sequence of pixel movements for part of the Nidorino animation. This
-; list describes how Nidorino should hop.
-; First byte is y movement, second byte is x movement
- db 0, 0
- db -2, 2
- db -1, 2
- db 1, 2
- db 2, 2
- db $50 ; list terminator
-
-IntroNidorinoAnimation2: ; 4191b (10:591b)
-; This is a sequence of pixel movements for part of the Nidorino animation.
-; First byte is y movement, second byte is x movement
- db 0, 0
- db -2, -2
- db -1, -2
- db 1, -2
- db 2, -2
- db $50 ; list terminator
-
-IntroNidorinoAnimation3: ; 41926 (10:5926)
-; This is a sequence of pixel movements for part of the Nidorino animation.
-; First byte is y movement, second byte is x movement
- db 0, 0
- db -12, 6
- db -8, 6
- db 8, 6
- db 12, 6
- db $50 ; list terminator
-
-IntroNidorinoAnimation4: ; 41931 (10:5931)
-; This is a sequence of pixel movements for part of the Nidorino animation.
-; First byte is y movement, second byte is x movement
- db 0, 0
- db -8, -4
- db -4, -4
- db 4, -4
- db 8, -4
- db $50 ; list terminator
-
-IntroNidorinoAnimation5: ; 4193c (10:593c)
-; This is a sequence of pixel movements for part of the Nidorino animation.
-; First byte is y movement, second byte is x movement
- db 0, 0
- db -8, 4
- db -4, 4
- db 4, 4
- db 8, 4
- db $50 ; list terminator
-
-IntroNidorinoAnimation6: ; 41947 (10:5947)
-; This is a sequence of pixel movements for part of the Nidorino animation.
-; First byte is y movement, second byte is x movement
- db 0, 0
- db 2, 0
- db 2, 0
- db 0, 0
- db $50 ; list terminator
-
-IntroNidorinoAnimation7: ; 41950 (10:5950)
-; This is a sequence of pixel movements for part of the Nidorino animation.
-; First byte is y movement, second byte is x movement
- db -8, -16
- db -7, -14
- db -6, -12
- db -4, -10
- db $50 ; list terminator
-
-GameFreakIntro: ; 41959 (10:5959)
+GameFreakIntro: ; 41959 (10:5aa6)
INCBIN "gfx/gamefreak_intro.2bpp"
INCBIN "gfx/gamefreak_logo.2bpp"
ds $10 ; blank tile
-GameFreakIntroEnd:
-
-FightIntroBackMon: ; 41a99 (10:5a99)
- INCBIN "gfx/intro_fight.2bpp"
-FightIntroBackMonEnd:
-
-FightIntroFrontMon: ; 42099 (10:6099)
- INCBIN "gfx/intro_nido_1.6x6.2bpp"
- INCBIN "gfx/intro_nido_2.6x6.2bpp"
- INCBIN "gfx/intro_nido_3.6x6.2bpp"
-FightIntroFrontMonEnd:
-
- ds $10 ; blank tile
+GameFreakIntroEnd: \ No newline at end of file
diff --git a/engine/overworld/emotion_bubbles.asm b/engine/overworld/emotion_bubbles.asm
index f8665dd6..f002deed 100755
--- a/engine/overworld/emotion_bubbles.asm
+++ b/engine/overworld/emotion_bubbles.asm
@@ -1,13 +1,16 @@
-EmotionBubble: ; 17c47 (5:7c47)
+EmotionBubble: ; 4116f (10:516f)
ld a, [wWhichEmotionBubble]
+ and $f
+ swap a
ld c, a
- ld b, 0
- ld hl, EmotionBubblesPointerTable
+ ld b, $0
+ ld hl, EmotionBubbles
+ add hl, bc ; each emotion bubble is 16 bytes, so calculate the offset directly instead of with a pointer table
add hl, bc
add hl, bc
- ld e, [hl]
- inc hl
- ld d, [hl]
+ add hl, bc
+ ld e, l
+ ld d, h
ld hl, vChars1 + $780
lb bc, BANK(EmotionBubbles), $04
call CopyVideoData
@@ -17,11 +20,11 @@ EmotionBubble: ; 17c47 (5:7c47)
ld [wUpdateSpritesEnabled], a
ld a, [wd736]
bit 6, a ; are the last 4 OAM entries reserved for a shadow or fishing rod?
- ld hl, wOAMBuffer + $8f
- ld de, wOAMBuffer + $9f
+ ld hl, wOAMBuffer + 4 * 35 + $3 ; $8f
+ ld de, wOAMBuffer + 4 * 39 + $3 ; $9f
jr z, .next
- ld hl, wOAMBuffer + $7f
- ld de, wOAMBuffer + $8f
+ ld hl, wOAMBuffer + 4 * 31 + $3 ; $7f
+ ld de, wOAMBuffer + 4 * 35 + $3 ; $8f
; Copy OAM data 16 bytes forward to make room for emotion bubble OAM data at the
; start of the OAM buffer.
@@ -59,16 +62,13 @@ EmotionBubble: ; 17c47 (5:7c47)
pop af
ld [wUpdateSpritesEnabled], a
call DelayFrame
- jp UpdateSprites
-
-EmotionBubblesPointerTable: ; 17caf (5:7caf)
- dw EmotionBubbles
- dw EmotionBubbles + $40
- dw EmotionBubbles + $80
+ call UpdateSprites
+ ret
+ ; jp UpdateSprites
-EmotionBubblesOAM: ; 17cb5 (5:7cb5)
+EmotionBubblesOAM: ; 411dd (5:51dd)
db $F8,$00,$F9,$00
db $FA,$00,$FB,$00
-EmotionBubbles: ; 17cbd (5:7cbd)
+EmotionBubbles: ; 411e5 (10:51e5)
INCBIN "gfx/emotion_bubbles.2bpp"
diff --git a/engine/trade.asm b/engine/trade.asm
index 2638835b..bef9a540 100755
--- a/engine/trade.asm
+++ b/engine/trade.asm
@@ -1,4 +1,4 @@
-InternalClockTradeAnim: ; 410e2 (10:50e2)
+InternalClockTradeAnim: ; 413e5 (10:53e5)
; Do the trading animation with the player's gameboy on the left.
; In-game trades and internally clocked link cable trades use this.
ld a, [wTradedPlayerMonSpecies]
@@ -8,7 +8,7 @@ InternalClockTradeAnim: ; 410e2 (10:50e2)
ld de, InternalClockTradeFuncSequence
jr TradeAnimCommon
-ExternalClockTradeAnim: ; 410f3 (10:50f3)
+ExternalClockTradeAnim: ; 413f6 (10:53f6)
; Do the trading animation with the player's gameboy on the right.
; Externally clocked link cable trades use this.
ld a, [wTradedEnemyMonSpecies]
@@ -17,15 +17,16 @@ ExternalClockTradeAnim: ; 410f3 (10:50f3)
ld [wRightGBMonSpecies], a
ld de, ExternalClockTradeFuncSequence
-TradeAnimCommon: ; 41102 (10:5102)
+TradeAnimCommon: ; 41405 (10:5405)
ld a, [wOptions]
push af
+ and %110000 ; preserve speaker options
+ ld [wOptions], a
ld a, [hSCY]
push af
ld a, [hSCX]
push af
xor a
- ld [wOptions], a
ld [hSCY], a
ld [hSCX], a
push de
@@ -69,7 +70,7 @@ tradefunc: MACRO
; They are from opposite perspectives. The external clock one makes use of
; Trade_SwapNames to swap the player and enemy names for some functions.
-InternalClockTradeFuncSequence: ; 41138 (10:5138)
+InternalClockTradeFuncSequence: ; 4143d (10:543d)
tradefunc LoadTradingGFXAndMonNames
tradefunc Trade_ShowPlayerMon
tradefunc Trade_DrawOpenEndOfLinkCable
@@ -88,7 +89,7 @@ InternalClockTradeFuncSequence: ; 41138 (10:5138)
tradefunc Trade_Cleanup
db $FF
-ExternalClockTradeFuncSequence: ; 41149 (10:5149)
+ExternalClockTradeFuncSequence: ; 4144e (10:544e)
tradefunc LoadTradingGFXAndMonNames
tradefunc Trade_ShowClearedWindow
tradefunc PrintTradeWillTradeText
@@ -112,7 +113,7 @@ ExternalClockTradeFuncSequence: ; 41149 (10:5149)
tradefunc Trade_Cleanup
db $FF
-TradeFuncPointerTable: ; 4115f (10:515f)
+TradeFuncPointerTable: ; 41464 (10:5464)
addtradefunc LoadTradingGFXAndMonNames
addtradefunc Trade_ShowPlayerMon
addtradefunc Trade_DrawOpenEndOfLinkCable
@@ -131,11 +132,11 @@ TradeFuncPointerTable: ; 4115f (10:515f)
addtradefunc Trade_SlideTextBoxOffScreen
addtradefunc Trade_SwapNames
-Trade_Delay100: ; 41181 (10:5181)
+Trade_Delay100: ; 41486 (10:5486)
ld c, 100
jp DelayFrames
-Trade_CopyTileMapToVRAM: ; 41186 (10:5186)
+Trade_CopyTileMapToVRAM: ; 4148b (10:548b)
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a
call Delay3
@@ -143,17 +144,17 @@ Trade_CopyTileMapToVRAM: ; 41186 (10:5186)
ld [H_AUTOBGTRANSFERENABLED], a
ret
-Trade_Delay80: ; 41191 (10:5191)
+Trade_Delay80: ; 41496 (10:5496)
ld c, 80
jp DelayFrames
-Trade_ClearTileMap: ; 41196 (10:5196)
+Trade_ClearTileMap: ; 4149b (10:549b)
coord hl, 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, " "
jp FillMemory
-LoadTradingGFXAndMonNames: ; 411a1 (10:51a1)
+LoadTradingGFXAndMonNames: ; 414a6 (10:54a6)
call Trade_ClearTileMap
call DisableLCD
ld hl, TradingAnimationGraphics
@@ -182,6 +183,7 @@ LoadTradingGFXAndMonNames: ; 411a1 (10:51a1)
ld a, $f0 ; SGB OBP0
.next
ld [rOBP0], a
+ call UpdateGBCPal_OBP0
call EnableLCD
xor a
ld [H_AUTOBGTRANSFERENABLED], a
@@ -196,12 +198,13 @@ LoadTradingGFXAndMonNames: ; 411a1 (10:51a1)
ld [wd11e], a
jp GetMonName
-Trade_LoadMonPartySpriteGfx: ; 4120b (10:520b)
+Trade_LoadMonPartySpriteGfx: ; 41513 (10:5513)
ld a, %11010000
ld [rOBP1], a
+ call UpdateGBCPal_OBP1
jpba LoadMonPartySpriteGfx
-Trade_SwapNames: ; 41217 (10:5217)
+Trade_SwapNames: ; 41522 (10:5522)
ld hl, wPlayerName
ld de, wBuffer
ld bc, NAME_LENGTH
@@ -215,14 +218,14 @@ Trade_SwapNames: ; 41217 (10:5217)
ld bc, NAME_LENGTH
jp CopyData
-Trade_Cleanup: ; 4123b (10:523b)
+Trade_Cleanup: ; 41546 (10:5546)
xor a
call LoadGBPal
ld hl, wd730
res 6, [hl] ; turn off instant text printing
ret
-Trade_ShowPlayerMon: ; 41245 (10:5245)
+Trade_ShowPlayerMon: ; 41550 (10:5550)
ld a, %10101011
ld [rLCDC], a
ld a, $50
@@ -233,8 +236,7 @@ Trade_ShowPlayerMon: ; 41245 (10:5245)
xor a
ld [H_AUTOBGTRANSFERENABLED], a
coord hl, 4, 0
- ld b, 6
- ld c, 10
+ lb bc, 6, 10
call TextBoxBorder
call Trade_PrintPlayerMonInfoText
ld b, vBGMap0 / $100
@@ -251,7 +253,7 @@ Trade_ShowPlayerMon: ; 41245 (10:5245)
ld [hSCX], a
dec a
dec a
- and a
+ and a ; useless since flags are updated with dec a
jr nz, .slideScreenLoop
call Trade_Delay80
ld a, TRADE_BALL_POOF_ANIM
@@ -264,7 +266,7 @@ Trade_ShowPlayerMon: ; 41245 (10:5245)
ld [H_AUTOBGTRANSFERENABLED], a
ret
-Trade_DrawOpenEndOfLinkCable: ; 41298 (10:5298)
+Trade_DrawOpenEndOfLinkCable: ; 415a2 (10:55a2)
call Trade_ClearTileMap
ld b, vBGMap0 / $100
call CopyScreenTileBufferToVRAM
@@ -296,16 +298,17 @@ Trade_DrawOpenEndOfLinkCable: ; 41298 (10:5298)
jr nz, .loop
ret
-Trade_AnimateBallEnteringLinkCable: ; 412d2 (10:52d2)
+Trade_AnimateBallEnteringLinkCable: ; 415dc (10:55dc)
ld a, TRADE_BALL_SHAKE_ANIM
call Trade_ShowAnimation
ld c, 10
call DelayFrames
ld a, %11100100
ld [rOBP0], a
+ call UpdateGBCPal_OBP0
xor a
ld [wLinkCableAnimBulgeToggle], a
- ld bc, $2060
+ lb bc, $20, $60
.moveBallInsideLinkCableLoop
push bc
xor a
@@ -345,17 +348,16 @@ Trade_AnimateBallEnteringLinkCable: ; 412d2 (10:52d2)
ld [H_AUTOBGTRANSFERENABLED], a
ret
-Trade_BallInsideLinkCableOAM: ; 4132e (10:532e)
+Trade_BallInsideLinkCableOAM: ; 4163b (10:563b)
db $7E,$00,$7E,$20
db $7E,$40,$7E,$60
-Trade_ShowEnemyMon: ; 41336 (10:5336)
+Trade_ShowEnemyMon: ; 41643 (10:5643)
ld a, TRADE_BALL_TILT_ANIM
call Trade_ShowAnimation
call Trade_ShowClearedWindow
coord hl, 4, 10
- ld b, 6
- ld c, 10
+ lb bc, 6, 10
call TextBoxBorder
call Trade_PrintEnemyMonInfoText
call Trade_CopyTileMapToVRAM
@@ -375,13 +377,14 @@ Trade_ShowEnemyMon: ; 41336 (10:5336)
call ClearScreenArea
jp PrintTradeTakeCareText
-Trade_AnimLeftToRight: ; 41376 (10:5376)
+Trade_AnimLeftToRight: ; 41682 (10:5682)
; Animates the mon moving from the left GB to the right one.
call Trade_InitGameboyTransferGfx
ld a, $1
ld [wTradedMonMovingRight], a
- ld a, $e4
+ ld a, %11100100
ld [rOBP0], a
+ call UpdateGBCPal_OBP0
ld a, $54
ld [wBaseCoordX], a
ld a, $1c
@@ -409,7 +412,7 @@ Trade_AnimLeftToRight: ; 41376 (10:5376)
call Trade_AnimMonMoveVertical
jp ClearSprites
-Trade_AnimRightToLeft: ; 413c6 (10:53c6)
+Trade_AnimRightToLeft: ; 416d5 (10:56d5)
; Animates the mon moving from the right GB to the left one.
call Trade_InitGameboyTransferGfx
xor a
@@ -441,11 +444,13 @@ Trade_AnimRightToLeft: ; 413c6 (10:53c6)
ld [H_AUTOBGTRANSFERENABLED], a
jp ClearSprites
-Trade_InitGameboyTransferGfx: ; 41411 (10:5411)
+Trade_InitGameboyTransferGfx: ; 41720 (10:5720)
; Initialises the graphics for showing a mon moving between gameboys.
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a
call ClearScreen
+ ld b, SET_PAL_GENERIC
+ call RunPaletteCommand
xor a
ld [H_AUTOBGTRANSFERENABLED], a
call Trade_LoadMonPartySpriteGfx
@@ -458,7 +463,7 @@ Trade_InitGameboyTransferGfx: ; 41411 (10:5411)
ld [hWY], a
ret
-Trade_DrawLeftGameboy: ; 4142d (10:542d)
+Trade_DrawLeftGameboy: ; 41741 (10:5741)
call Trade_ClearTileMap
; draw link cable
@@ -466,7 +471,7 @@ Trade_DrawLeftGameboy: ; 4142d (10:542d)
ld a, $5d
ld [hli], a
ld a, $5e
- ld c, $8
+ ld c, 8
.loop
ld [hli], a
dec c
@@ -479,8 +484,7 @@ Trade_DrawLeftGameboy: ; 4142d (10:542d)
; draw text box with player name below gameboy pic
coord hl, 4, 12
- ld b, 2
- ld c, 7
+ lb bc, 2, 7
call TextBoxBorder
coord hl, 5, 14
ld de, wPlayerName
@@ -488,7 +492,7 @@ Trade_DrawLeftGameboy: ; 4142d (10:542d)
jp DelayFrame
-Trade_DrawRightGameboy: ; 4145c (10:545c)
+Trade_DrawRightGameboy: ; 4176f (10:576f)
call Trade_ClearTileMap
; draw horizontal segment of link cable
@@ -526,8 +530,7 @@ Trade_DrawRightGameboy: ; 4145c (10:545c)
; draw text box with enemy name above link cable
coord hl, 6, 0
- ld b, $2
- ld c, $7
+ lb bc, 2, 7
call TextBoxBorder
coord hl, 7, 2
ld de, wLinkEnemyTrainerName
@@ -535,7 +538,7 @@ Trade_DrawRightGameboy: ; 4145c (10:545c)
jp DelayFrame
-Trade_DrawCableAcrossScreen: ; 4149f (10:549f)
+Trade_DrawCableAcrossScreen: ; 417b1 (10:57b1)
; Draws the link cable across the screen.
call Trade_ClearTileMap
coord hl, 0, 4
@@ -547,7 +550,7 @@ Trade_DrawCableAcrossScreen: ; 4149f (10:549f)
jr nz, .loop
ret
-Trade_CopyCableTilesOffScreen: ; 414ae (10:54ae)
+Trade_CopyCableTilesOffScreen: ; 417c0 (10:57c0)
; This is used to copy the link cable tiles off screen so that the cable
; continues when the screen is scrolled.
push hl
@@ -563,7 +566,7 @@ Trade_CopyCableTilesOffScreen: ; 414ae (10:54ae)
ld c, 10
jp DelayFrames
-Trade_AnimMonMoveHorizontal: ; 414c5 (10:54c5)
+Trade_AnimMonMoveHorizontal: ; 417d7 (10:57d7)
; Animates the mon going through the link cable horizontally over a distance of
; b 16-pixel units.
ld a, [wTradedMonMovingRight]
@@ -590,7 +593,7 @@ Trade_AnimMonMoveHorizontal: ; 414c5 (10:54c5)
jr nz, Trade_AnimMonMoveHorizontal
ret
-Trade_AnimCircledMon: ; 414e8 (10:54e8)
+Trade_AnimCircledMon: ; 417fa (10:57fa)
; Cycles between the two animation frames of the mon party sprite, cycles
; between a circle and an oval around the mon sprite, and makes the cable flash.
push de
@@ -599,6 +602,7 @@ Trade_AnimCircledMon: ; 414e8 (10:54e8)
ld a, [rBGP]
xor $3c ; make link cable flash
ld [rBGP], a
+ call UpdateGBCPal_BGP
ld hl, wOAMBuffer + $02
ld de, $4
ld c, $14
@@ -614,13 +618,13 @@ Trade_AnimCircledMon: ; 414e8 (10:54e8)
pop de
ret
-Trade_WriteCircledMonOAM: ; 41505 (10:5505)
+Trade_WriteCircledMonOAM: ; 4181a (10:581a)
callba WriteMonPartySpriteOAMBySpecies
call Trade_WriteCircleOAM
-Trade_AddOffsetsToOAMCoords: ; 41510 (10:5510)
+Trade_AddOffsetsToOAMCoords: ; 41825 (10:5825)
ld hl, wOAMBuffer
- ld c, $14
+ ld c, $14 ; SCREEN_WIDTH?
.loop
ld a, [wBaseCoordY]
add [hl]
@@ -634,7 +638,7 @@ Trade_AddOffsetsToOAMCoords: ; 41510 (10:5510)
jr nz, .loop
ret
-Trade_AnimMonMoveVertical: ; 41525 (10:5525)
+Trade_AnimMonMoveVertical: ; 4183a (10:583a)
; Animates the mon going through the link cable vertically as well as
; horizontally for a bit. The last bit of horizontal movement (when moving
; right) or the first bit of horizontal movement (when moving left) are done
@@ -670,7 +674,7 @@ Trade_AnimMonMoveVertical: ; 41525 (10:5525)
jr nz, .loop
ret
-Trade_WriteCircleOAM: ; 41558 (10:5558)
+Trade_WriteCircleOAM: ; 4186d (10:586d)
; Writes the OAM blocks for the circle around the traded mon as it passes
; the link cable.
ld hl, Trade_CircleOAMPointers
@@ -697,7 +701,7 @@ Trade_WriteCircleOAM: ; 41558 (10:5558)
jr nz, .loop
ret
-Trade_CircleOAMPointers: ; 41574 (10:5574)
+Trade_CircleOAMPointers: ; 41889 (10:5889)
dw Trade_CircleOAM0
db $08,$08
dw Trade_CircleOAM1
@@ -707,24 +711,24 @@ Trade_CircleOAMPointers: ; 41574 (10:5574)
dw Trade_CircleOAM3
db $18,$18
-Trade_CircleOAM0: ; 41584 (10:5584)
+Trade_CircleOAM0: ; 41899 (10:5899)
db $38,$10,$39,$10
db $3A,$10,$3B,$10
-Trade_CircleOAM1: ; 4158c (10:558c)
+Trade_CircleOAM1: ; 418a1 (10:58a1)
db $39,$30,$38,$30
db $3B,$30,$3A,$30
-Trade_CircleOAM2: ; 41594 (10:5594)
+Trade_CircleOAM2: ; 418a9 (10:58a9)
db $3A,$50,$3B,$50
db $38,$50,$39,$50
-Trade_CircleOAM3: ; 4159c (10:559c)
+Trade_CircleOAM3: ; 418b1 (10:58b1)
db $3B,$70,$3A,$70
db $39,$70,$38,$70
; a = species
-Trade_LoadMonSprite: ; 415a4 (10:55a4)
+Trade_LoadMonSprite: ; 418b9 (10:58b9)
ld [wcf91], a
ld [wd0b5], a
ld [wWholeScreenPaletteMonSpecies], a
@@ -740,7 +744,7 @@ Trade_LoadMonSprite: ; 415a4 (10:55a4)
ld c, 10
jp DelayFrames
-Trade_ShowClearedWindow: ; 415c8 (10:55c8)
+Trade_ShowClearedWindow: ; 418dd (10:58dd)
; clears the window and covers the BG entirely with the window
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a
@@ -755,7 +759,7 @@ Trade_ShowClearedWindow: ; 415c8 (10:55c8)
ld [hSCX], a
ret
-Trade_SlideTextBoxOffScreen: ; 415df (10:55df)
+Trade_SlideTextBoxOffScreen: ; 418f4 (10:58f4)
; Slides the window right until it's off screen. The window usually just has
; a text box at the bottom when this is called. However, when this is called
; after Trade_ShowEnemyMon in the external clock sequence, there is a mon pic
@@ -777,18 +781,18 @@ Trade_SlideTextBoxOffScreen: ; 415df (10:55df)
ld [rWX], a
ret
-PrintTradeWentToText: ; 415fe (10:55fe)
+PrintTradeWentToText: ; 41913 (10:5913)
ld hl, TradeWentToText
call PrintText
ld c, 200
call DelayFrames
jp Trade_SlideTextBoxOffScreen
-TradeWentToText: ; 4160c (10:560c)
+TradeWentToText: ; 41921 (10:5921)
TX_FAR _TradeWentToText
db "@"
-PrintTradeForSendsText: ; 41611 (10:5611)
+PrintTradeForSendsText: ; 41926 (10:5926)
ld hl, TradeForText
call PrintText
call Trade_Delay80
@@ -796,15 +800,15 @@ PrintTradeForSendsText: ; 41611 (10:5611)
call PrintText
jp Trade_Delay80
-TradeForText: ; 41623 (10:5623)
+TradeForText: ; 41938 (10:5938)
TX_FAR _TradeForText
db "@"
-TradeSendsText: ; 41628 (10:5628)
+TradeSendsText: ; 4193d (10:593d)
TX_FAR _TradeSendsText
db "@"
-PrintTradeFarewellText: ; 4162d (10:562d)
+PrintTradeFarewellText: ; 41942 (10:5942)
ld hl, TradeWavesFarewellText
call PrintText
call Trade_Delay80
@@ -813,24 +817,24 @@ PrintTradeFarewellText: ; 4162d (10:562d)
call Trade_Delay80
jp Trade_SlideTextBoxOffScreen
-TradeWavesFarewellText: ; 41642 (10:5642)
+TradeWavesFarewellText: ; 41957 (10:5957)
TX_FAR _TradeWavesFarewellText
db "@"
-TradeTransferredText: ; 41647 (10:5647)
+TradeTransferredText: ; 4195c (10:595c)
TX_FAR _TradeTransferredText
db "@"
-PrintTradeTakeCareText: ; 4164c (10:564c)
+PrintTradeTakeCareText: ; 41961 (10:5961)
ld hl, TradeTakeCareText
call PrintText
jp Trade_Delay80
-TradeTakeCareText: ; 41655 (10:5655)
+TradeTakeCareText: ; 4196a (10:596a)
TX_FAR _TradeTakeCareText
db "@"
-PrintTradeWillTradeText: ; 4165a (10:565a)
+PrintTradeWillTradeText: ; 4196f (10:596f)
ld hl, TradeWillTradeText
call PrintText
call Trade_Delay80
@@ -838,15 +842,15 @@ PrintTradeWillTradeText: ; 4165a (10:565a)
call PrintText
jp Trade_Delay80
-TradeWillTradeText: ; 4166c (10:566c)
+TradeWillTradeText: ; 41981 (10:5981)
TX_FAR _TradeWillTradeText
db "@"
-TradeforText: ; 41671 (10:5671)
+TradeforText: ; 41986 (10:5986)
TX_FAR _TradeforText
db "@"
-Trade_ShowAnimation: ; 41676 (10:5676)
+Trade_ShowAnimation: ; 4198b (10:598b)
ld [W_ANIMATIONID], a
xor a
ld [wAnimationType], a
diff --git a/engine/trade2.asm b/engine/trade2.asm
index 10bef792..a4996403 100755
--- a/engine/trade2.asm
+++ b/engine/trade2.asm
@@ -1,4 +1,4 @@
-Trade_PrintPlayerMonInfoText: ; 42769 (10:6769)
+Trade_PrintPlayerMonInfoText: ; 41be6 (10:5be6)
coord hl, 5, 0
ld de,Trade_MonInfoText
call PlaceString
@@ -20,7 +20,7 @@ Trade_PrintPlayerMonInfoText: ; 42769 (10:6769)
lb bc, LEADING_ZEROES | 2, 5
jp PrintNumber
-Trade_PrintEnemyMonInfoText: ; 427a7 (10:67a7)
+Trade_PrintEnemyMonInfoText: ; 41c24 (10:5c24)
coord hl, 5, 10
ld de,Trade_MonInfoText
call PlaceString
@@ -42,8 +42,8 @@ Trade_PrintEnemyMonInfoText: ; 427a7 (10:67a7)
lb bc, LEADING_ZEROES | 2, 5
jp PrintNumber
-Trade_MonInfoText: ; 427e5 (10:67e5)
- db "──",$74,$F2,$4E
- db $4E
- db "OT/",$4E
- db $73,"№",$F2,"@"
+Trade_MonInfoText: ; 41c62 (10:5c62)
+ db "──",$74,$F2
+ db $4e ; next
+ next "OT/"
+ next $73,"№",$F2,"@"
diff --git a/gfx/emotion_bubbles.png b/gfx/emotion_bubbles.png
index 31deacf4..652c56b1 100644
--- a/gfx/emotion_bubbles.png
+++ b/gfx/emotion_bubbles.png
Binary files differ
diff --git a/home/copy2.asm b/home/copy2.asm
index 41ba3dea..5318dc35 100644
--- a/home/copy2.asm
+++ b/home/copy2.asm
@@ -149,17 +149,19 @@ FillMemory:: ; 166e (0:166e)
jr nz, .loop
ret
-Func_1681:: ; 1681 (0:1681)
+GetFarByte:: ; 1681 (0:1681)
+; get a byte from a:hl
+; and return it in a
push bc
- ld b,a
+ ld b, a
ld a, [H_LOADEDROMBANK]
push af
- ld a,b
+ ld a, b
call BankswitchCommon
- ld b,[hl]
+ ld b, [hl]
pop af
call BankswitchCommon
- ld a,b
+ ld a, b
pop bc
ret
diff --git a/yellow/main.asm b/yellow/main.asm
index 10006296..ee205439 100755
--- a/yellow/main.asm
+++ b/yellow/main.asm
@@ -4013,10 +4013,12 @@ INCLUDE "engine/battle/draw_hud_pokeball_gfx.asm"
TradingAnimationGraphics:
INCBIN "gfx/game_boy.norepeat.2bpp"
INCBIN "gfx/link_cable.2bpp"
-
+TradingAnimationGraphicsEnd:
+
TradingAnimationGraphics2:
; Pokeball traveling through the link cable.
INCBIN "gfx/trade2.2bpp"
+TradingAnimationGraphics2End:
INCLUDE "engine/evos_moves.asm"
@@ -4117,9 +4119,10 @@ PlayCurrentMoveAnimation: ; 3fb83 (f:7b83)
SECTION "bank10",ROMX,BANK[$10]
INCLUDE "engine/menu/pokedex.asm"
-
- dr $4116f,$41c70
-
+INCLUDE "engine/overworld/emotion_bubbles.asm"
+INCLUDE "engine/trade.asm"
+INCLUDE "engine/intro.asm"
+INCLUDE "engine/trade2.asm"
INCLUDE "engine/menu/options.asm"
@@ -4367,7 +4370,9 @@ INCLUDE "engine/bank3d/main.asm"
SECTION "bank3E",ROMX,BANK[$3E]
- dr $f8000,$fa35a
+ dr $f8000,$f982d
+PlayIntroScene: ; f982d (3e:582d)
+ dr $f982d,$fa35a
YellowIntroGraphics: INCBIN "gfx/yellow_intro.2bpp"