shithub: pokecrystal

Download patch

ref: de073374a64aefe6e7823a3bb1ac66fe8e22215c
parent: 59d9932255aa01e54dedfd82e9eb6343e9fe7883
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Fri Jul 17 12:43:41 EDT 2020

Port pokered's more local system for trade animation scripts

Also factor out trade tilemaps

--- a/engine/movie/trade_animation.asm
+++ b/engine/movie/trade_animation.asm
@@ -9,6 +9,15 @@
 	const TRADEANIMSTATE_3 ; 3
 TRADEANIMJUMPTABLE_LENGTH EQU const_value
 
+add_tradeanim: MACRO
+\1_TradeCmd:
+	dw \1
+ENDM
+
+tradeanim: MACRO
+	db (\1_TradeCmd - DoTradeAnimation.JumpTable) / 2
+ENDM
+
 TradeAnimation:
 	xor a
 	ld [wcf66], a
@@ -22,43 +31,43 @@
 	jr RunTradeAnimScript
 
 .script
-	tradeanim_setup_givemon_scroll
-	tradeanim_show_givemon_data
-	tradeanim_do_givemon_scroll
-	tradeanim_wait_80
-	tradeanim_wait_96
-	tradeanim_poof
-	tradeanim_rocking_ball
-	tradeanim_enter_link_tube
-	tradeanim_wait_anim
-	tradeanim_bulge_through_tube
-	tradeanim_wait_anim
-	tradeanim_textbox_scroll
-	tradeanim_give_trademon_sfx
-	tradeanim_tube_to_ot
-	tradeanim_sent_to_ot_text
-	tradeanim_scroll_out_right
+	tradeanim TradeAnim_SetupGivemonScroll
+	tradeanim TradeAnim_ShowGivemonData
+	tradeanim TradeAnim_DoGivemonScroll
+	tradeanim TradeAnim_Wait80
+	tradeanim TradeAnim_Wait96
+	tradeanim TradeAnim_Poof
+	tradeanim TradeAnim_RockingBall
+	tradeanim TradeAnim_EnterLinkTube1
+	tradeanim TradeAnim_WaitAnim
+	tradeanim TradeAnim_BulgeThroughTube
+	tradeanim TradeAnim_WaitAnim
+	tradeanim TradeAnim_TextboxScrollStart
+	tradeanim TradeAnim_GiveTrademonSFX
+	tradeanim TradeAnim_TubeToOT1
+	tradeanim TradeAnim_SentToOTText
+	tradeanim TradeAnim_ScrollOutRight
 
-	tradeanim_ot_sends_text_1
-	tradeanim_ot_bids_farewell
-	tradeanim_wait_40
-	tradeanim_scroll_out_right
-	tradeanim_get_trademon_sfx
-	tradeanim_tube_to_player
-	tradeanim_enter_link_tube
-	tradeanim_drop_ball
-	tradeanim_exit_link_tube
-	tradeanim_wait_anim
-	tradeanim_show_getmon_data
-	tradeanim_poof
-	tradeanim_wait_anim
-	tradeanim_frontpic_scroll
-	tradeanim_animate_frontpic
-	tradeanim_wait_80_if_ot_egg
-	tradeanim_textbox_scroll
-	tradeanim_take_care_of_text
-	tradeanim_scroll_out_right
-	tradeanim_end
+	tradeanim TradeAnim_OTSendsText1
+	tradeanim TradeAnim_OTBidsFarewell
+	tradeanim TradeAnim_Wait40
+	tradeanim TradeAnim_ScrollOutRight
+	tradeanim TradeAnim_GetTrademonSFX
+	tradeanim TradeAnim_TubeToPlayer1
+	tradeanim TradeAnim_EnterLinkTube1
+	tradeanim TradeAnim_DropBall
+	tradeanim TradeAnim_ExitLinkTube
+	tradeanim TradeAnim_WaitAnim
+	tradeanim TradeAnim_ShowGetmonData
+	tradeanim TradeAnim_Poof
+	tradeanim TradeAnim_WaitAnim
+	tradeanim TradeAnim_FrontpicScrollStart
+	tradeanim TradeAnim_AnimateFrontpic
+	tradeanim TradeAnim_Wait80IfOTEgg
+	tradeanim TradeAnim_TextboxScrollStart
+	tradeanim TradeAnim_TakeCareOfText
+	tradeanim TradeAnim_ScrollOutRight
+	tradeanim TradeAnim_End
 
 TradeAnimationPlayer2:
 	xor a
@@ -73,42 +82,42 @@
 	jr RunTradeAnimScript
 
 .script
-	tradeanim_ot_sends_text_2
-	tradeanim_ot_bids_farewell
-	tradeanim_wait_40
-	tradeanim_scroll_out_right
-	tradeanim_get_trademon_sfx
-	tradeanim_tube_to_ot
-	tradeanim_enter_link_tube
-	tradeanim_drop_ball
-	tradeanim_exit_link_tube
-	tradeanim_wait_anim
-	tradeanim_show_getmon_data
-	tradeanim_poof
-	tradeanim_wait_anim
-	tradeanim_frontpic_scroll
-	tradeanim_animate_frontpic
-	tradeanim_wait_180_if_ot_egg
-	tradeanim_textbox_scroll
-	tradeanim_take_care_of_text
-	tradeanim_scroll_out_right
+	tradeanim TradeAnim_OTSendsText2
+	tradeanim TradeAnim_OTBidsFarewell
+	tradeanim TradeAnim_Wait40
+	tradeanim TradeAnim_ScrollOutRight
+	tradeanim TradeAnim_GetTrademonSFX
+	tradeanim TradeAnim_TubeToOT1
+	tradeanim TradeAnim_EnterLinkTube1
+	tradeanim TradeAnim_DropBall
+	tradeanim TradeAnim_ExitLinkTube
+	tradeanim TradeAnim_WaitAnim
+	tradeanim TradeAnim_ShowGetmonData
+	tradeanim TradeAnim_Poof
+	tradeanim TradeAnim_WaitAnim
+	tradeanim TradeAnim_FrontpicScrollStart
+	tradeanim TradeAnim_AnimateFrontpic
+	tradeanim TradeAnim_Wait180IfOTEgg
+	tradeanim TradeAnim_TextboxScrollStart
+	tradeanim TradeAnim_TakeCareOfText
+	tradeanim TradeAnim_ScrollOutRight
 
-	tradeanim_setup_givemon_scroll
-	tradeanim_show_givemon_data
-	tradeanim_do_givemon_scroll
-	tradeanim_wait_40
-	tradeanim_poof
-	tradeanim_rocking_ball
-	tradeanim_enter_link_tube
-	tradeanim_wait_anim
-	tradeanim_bulge_through_tube
-	tradeanim_wait_anim
-	tradeanim_textbox_scroll
-	tradeanim_give_trademon_sfx
-	tradeanim_tube_to_player
-	tradeanim_sent_to_ot_text
-	tradeanim_scroll_out_right
-	tradeanim_end
+	tradeanim TradeAnim_SetupGivemonScroll
+	tradeanim TradeAnim_ShowGivemonData
+	tradeanim TradeAnim_DoGivemonScroll
+	tradeanim TradeAnim_Wait40
+	tradeanim TradeAnim_Poof
+	tradeanim TradeAnim_RockingBall
+	tradeanim TradeAnim_EnterLinkTube1
+	tradeanim TradeAnim_WaitAnim
+	tradeanim TradeAnim_BulgeThroughTube
+	tradeanim TradeAnim_WaitAnim
+	tradeanim TradeAnim_TextboxScrollStart
+	tradeanim TradeAnim_GiveTrademonSFX
+	tradeanim TradeAnim_TubeToPlayer1
+	tradeanim TradeAnim_SentToOTText
+	tradeanim TradeAnim_ScrollOutRight
+	tradeanim TradeAnim_End
 
 RunTradeAnimScript:
 	ld hl, wTradeAnimAddress
@@ -231,55 +240,54 @@
 	jumptable .JumpTable, wJumptableIndex
 
 .JumpTable:
-; entries correspond to tradeanim_* constants (see macros/scripts/trade_anims.asm)
-	dw TradeAnim_AdvanceScriptPointer ; 00
-	dw TradeAnim_ShowGivemonData      ; 01
-	dw TradeAnim_ShowGetmonData       ; 02
-	dw TradeAnim_EnterLinkTube1       ; 03
-	dw TradeAnim_EnterLinkTube2       ; 04
-	dw TradeAnim_ExitLinkTube         ; 05
-	dw TradeAnim_TubeToOT1            ; 06
-	dw TradeAnim_TubeToOT2            ; 07
-	dw TradeAnim_TubeToOT3            ; 08
-	dw TradeAnim_TubeToOT4            ; 09
-	dw TradeAnim_TubeToOT5            ; 0a
-	dw TradeAnim_TubeToOT6            ; 0b
-	dw TradeAnim_TubeToOT7            ; 0c
-	dw TradeAnim_TubeToOT8            ; 0d
-	dw TradeAnim_TubeToPlayer1        ; 0e
-	dw TradeAnim_TubeToPlayer2        ; 0f
-	dw TradeAnim_TubeToPlayer3        ; 10
-	dw TradeAnim_TubeToPlayer4        ; 11
-	dw TradeAnim_TubeToPlayer5        ; 12
-	dw TradeAnim_TubeToPlayer6        ; 13
-	dw TradeAnim_TubeToPlayer7        ; 14
-	dw TradeAnim_TubeToPlayer8        ; 15
-	dw TradeAnim_SentToOTText         ; 16
-	dw TradeAnim_OTBidsFarewell       ; 17
-	dw TradeAnim_TakeCareOfText       ; 18
-	dw TradeAnim_OTSendsText1         ; 19
-	dw TradeAnim_OTSendsText2         ; 1a
-	dw TradeAnim_SetupGivemonScroll   ; 1b
-	dw TradeAnim_DoGivemonScroll      ; 1c
-	dw TradeAnim_FrontpicScrollStart  ; 1d
-	dw TradeAnim_TextboxScrollStart   ; 1e
-	dw TradeAnim_ScrollOutRight       ; 1f
-	dw TradeAnim_ScrollOutRight2      ; 20
-	dw TraideAnim_Wait80              ; 21
-	dw TraideAnim_Wait40              ; 22
-	dw TradeAnim_RockingBall          ; 23
-	dw TradeAnim_DropBall             ; 24
-	dw TradeAnim_WaitAnim             ; 25
-	dw TradeAnim_WaitAnim2            ; 26
-	dw TradeAnim_Poof                 ; 27
-	dw TradeAnim_BulgeThroughTube     ; 28
-	dw TradeAnim_GiveTrademonSFX      ; 29
-	dw TradeAnim_GetTrademonSFX       ; 2a
-	dw TradeAnim_End                  ; 2b
-	dw TradeAnim_AnimateFrontpic      ; 2c
-	dw TraideAnim_Wait96              ; 2d
-	dw TraideAnim_Wait80IfOTEgg       ; 2e
-	dw TraideAnim_Wait180IfOTEgg      ; 2f
+	add_tradeanim TradeAnim_AdvanceScriptPointer ; 00
+	add_tradeanim TradeAnim_ShowGivemonData      ; 01
+	add_tradeanim TradeAnim_ShowGetmonData       ; 02
+	add_tradeanim TradeAnim_EnterLinkTube1       ; 03
+	add_tradeanim TradeAnim_EnterLinkTube2       ; 04
+	add_tradeanim TradeAnim_ExitLinkTube         ; 05
+	add_tradeanim TradeAnim_TubeToOT1            ; 06
+	add_tradeanim TradeAnim_TubeToOT2            ; 07
+	add_tradeanim TradeAnim_TubeToOT3            ; 08
+	add_tradeanim TradeAnim_TubeToOT4            ; 09
+	add_tradeanim TradeAnim_TubeToOT5            ; 0a
+	add_tradeanim TradeAnim_TubeToOT6            ; 0b
+	add_tradeanim TradeAnim_TubeToOT7            ; 0c
+	add_tradeanim TradeAnim_TubeToOT8            ; 0d
+	add_tradeanim TradeAnim_TubeToPlayer1        ; 0e
+	add_tradeanim TradeAnim_TubeToPlayer2        ; 0f
+	add_tradeanim TradeAnim_TubeToPlayer3        ; 10
+	add_tradeanim TradeAnim_TubeToPlayer4        ; 11
+	add_tradeanim TradeAnim_TubeToPlayer5        ; 12
+	add_tradeanim TradeAnim_TubeToPlayer6        ; 13
+	add_tradeanim TradeAnim_TubeToPlayer7        ; 14
+	add_tradeanim TradeAnim_TubeToPlayer8        ; 15
+	add_tradeanim TradeAnim_SentToOTText         ; 16
+	add_tradeanim TradeAnim_OTBidsFarewell       ; 17
+	add_tradeanim TradeAnim_TakeCareOfText       ; 18
+	add_tradeanim TradeAnim_OTSendsText1         ; 19
+	add_tradeanim TradeAnim_OTSendsText2         ; 1a
+	add_tradeanim TradeAnim_SetupGivemonScroll   ; 1b
+	add_tradeanim TradeAnim_DoGivemonScroll      ; 1c
+	add_tradeanim TradeAnim_FrontpicScrollStart  ; 1d
+	add_tradeanim TradeAnim_TextboxScrollStart   ; 1e
+	add_tradeanim TradeAnim_ScrollOutRight       ; 1f
+	add_tradeanim TradeAnim_ScrollOutRight2      ; 20
+	add_tradeanim TradeAnim_Wait80              ; 21
+	add_tradeanim TradeAnim_Wait40              ; 22
+	add_tradeanim TradeAnim_RockingBall          ; 23
+	add_tradeanim TradeAnim_DropBall             ; 24
+	add_tradeanim TradeAnim_WaitAnim             ; 25
+	add_tradeanim TradeAnim_WaitAnim2            ; 26
+	add_tradeanim TradeAnim_Poof                 ; 27
+	add_tradeanim TradeAnim_BulgeThroughTube     ; 28
+	add_tradeanim TradeAnim_GiveTrademonSFX      ; 29
+	add_tradeanim TradeAnim_GetTrademonSFX       ; 2a
+	add_tradeanim TradeAnim_End                  ; 2b
+	add_tradeanim TradeAnim_AnimateFrontpic      ; 2c
+	add_tradeanim TradeAnim_Wait96              ; 2d
+	add_tradeanim TradeAnim_Wait80IfOTEgg       ; 2e
+	add_tradeanim TradeAnim_Wait180IfOTEgg      ; 2f
 
 TradeAnim_IncrementJumptableIndex:
 	ld hl, wJumptableIndex
@@ -840,25 +848,25 @@
 	call WaitBGMap
 	ret
 
-TraideAnim_Wait80:
+TradeAnim_Wait80:
 	ld c, 80
 	call DelayFrames
 	call TradeAnim_AdvanceScriptPointer
 	ret
 
-TraideAnim_Wait40:
+TradeAnim_Wait40:
 	ld c, 40
 	call DelayFrames
 	call TradeAnim_AdvanceScriptPointer
 	ret
 
-TraideAnim_Wait96:
+TradeAnim_Wait96:
 	ld c, 96
 	call DelayFrames
 	call TradeAnim_AdvanceScriptPointer
 	ret
 
-TraideAnim_Wait80IfOTEgg:
+TradeAnim_Wait80IfOTEgg:
 	call IsOTTrademonEgg
 	ret nz
 	ld c, 80
@@ -865,7 +873,7 @@
 	call DelayFrames
 	ret
 
-TraideAnim_Wait180IfOTEgg:
+TradeAnim_Wait180IfOTEgg:
 	call IsOTTrademonEgg
 	ret nz
 	ld c, 180
@@ -1421,36 +1429,22 @@
 	ret
 
 debugtrade: MACRO
-; species, ot name, ot id (?)
+; species, ot name, ot id
 	db \1, \2
 	dw \3
 ENDM
 
 .DebugTradeData:
-	debugtrade VENUSAUR, "ゲーフり@@", $0123 ; GAME FREAK
+	debugtrade VENUSAUR,  "ゲーフり@@", $0123 ; GAME FREAK
 	debugtrade CHARIZARD, "クりーチャ@", $0456 ; Creatures Inc.
 
-TradeGameBoyTilemap:
-; 6x8
-	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
+TradeGameBoyTilemap:  INCBIN "gfx/trade/game_boy.tilemap" ; 6x8
+TradeLinkTubeTilemap: INCBIN "gfx/trade/link_cable.tilemap" ; 12x3
 
-TradeLinkTubeTilemap:
-; 12x3
-	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
-
-TradeArrowRightGFX: INCBIN "gfx/trade/arrow_right.2bpp"
-TradeArrowLeftGFX:  INCBIN "gfx/trade/arrow_left.2bpp"
-TradeCableGFX:      INCBIN "gfx/trade/cable.2bpp"
-TradeBubbleGFX:     INCBIN "gfx/trade/bubble.2bpp"
-TradeGameBoyLZ:     INCBIN "gfx/trade/game_boy_cable.2bpp.lz"
-TradeBallGFX:       INCBIN "gfx/trade/ball.2bpp"
-TradePoofGFX:       INCBIN "gfx/trade/poof.2bpp"
+TradeArrowRightGFX:   INCBIN "gfx/trade/arrow_right.2bpp"
+TradeArrowLeftGFX:    INCBIN "gfx/trade/arrow_left.2bpp"
+TradeCableGFX:        INCBIN "gfx/trade/cable.2bpp"
+TradeBubbleGFX:       INCBIN "gfx/trade/bubble.2bpp"
+TradeGameBoyLZ:       INCBIN "gfx/trade/game_boy_cable.2bpp.lz"
+TradeBallGFX:         INCBIN "gfx/trade/ball.2bpp"
+TradePoofGFX:         INCBIN "gfx/trade/poof.2bpp"
--- /dev/null
+++ b/gfx/trade/game_boy.tilemap
@@ -1,0 +1,1 @@
+12222345667849::;8<=>>?@ABCCDEFGCHIJACKLMNOPPPQR
\ No newline at end of file
--- /dev/null
+++ b/gfx/trade/link_cable.tilemap
@@ -1,0 +1,1 @@
+CUVSSSSSSSSSCWXTTTTTTTTTCYZCCCCCCCCC
\ No newline at end of file
--- a/macros.asm
+++ b/macros.asm
@@ -14,7 +14,6 @@
 INCLUDE "macros/scripts/map_setup.asm"
 INCLUDE "macros/scripts/battle_commands.asm"
 INCLUDE "macros/scripts/battle_anims.asm"
-INCLUDE "macros/scripts/trade_anims.asm"
 INCLUDE "macros/scripts/gfx_anims.asm"
 
 INCLUDE "macros/legacy.asm"
--- a/macros/scripts/trade_anims.asm
+++ /dev/null
@@ -1,254 +1,0 @@
-; DoTradeAnimation.JumpTable indexes (see engine/movies/trade_animation.asm)
-	const_def
-
-	const tradeanim_next_command ; $00
-tradeanim_next: MACRO
-	db tradeanim_next_command
-ENDM
-
-	const tradeanim_show_givemon_data_command ; $01
-tradeanim_show_givemon_data: MACRO
-	db tradeanim_show_givemon_data_command
-ENDM
-
-	const tradeanim_show_getmon_data_command ; $02
-tradeanim_show_getmon_data: MACRO
-	db tradeanim_show_getmon_data_command
-ENDM
-
-	const tradeanim_enter_link_tube_command ; $03
-tradeanim_enter_link_tube: MACRO
-	db tradeanim_enter_link_tube_command
-ENDM
-
-	const_skip ; continues tradeanim_enter_link_tube_command
-
-	const tradeanim_exit_link_tube_command ; $05
-tradeanim_exit_link_tube: MACRO
-	db tradeanim_exit_link_tube_command
-ENDM
-
-	const tradeanim_tube_to_ot_command ; $06
-tradeanim_tube_to_ot: MACRO
-	db tradeanim_tube_to_ot_command
-ENDM
-
-	const_skip 7 ; continues tradeanim_tube_to_ot_command
-
-	const tradeanim_tube_to_player_command ; $0e
-tradeanim_tube_to_player: MACRO
-	db tradeanim_tube_to_player_command
-ENDM
-
-	const_skip 7 ; continues tradeanim_tube_to_player_command
-
-	const tradeanim_sent_to_ot_text_command ; $16
-tradeanim_sent_to_ot_text: MACRO
-	db tradeanim_sent_to_ot_text_command
-ENDM
-
-	const tradeanim_ot_bids_farewell_command ; $17
-tradeanim_ot_bids_farewell: MACRO
-	db tradeanim_ot_bids_farewell_command
-ENDM
-
-	const tradeanim_take_care_of_text_command ; $18
-tradeanim_take_care_of_text: MACRO
-	db tradeanim_take_care_of_text_command
-ENDM
-
-	const tradeanim_ot_sends_text_1_command ; $19
-tradeanim_ot_sends_text_1: MACRO
-	db tradeanim_ot_sends_text_1_command
-ENDM
-
-	const tradeanim_ot_sends_text_2_command ; $1a
-tradeanim_ot_sends_text_2: MACRO
-	db tradeanim_ot_sends_text_2_command
-ENDM
-
-	const tradeanim_setup_givemon_scroll_command ; $1b
-tradeanim_setup_givemon_scroll: MACRO
-	db tradeanim_setup_givemon_scroll_command
-ENDM
-
-	const tradeanim_do_givemon_scroll_command ; $1c
-tradeanim_do_givemon_scroll: MACRO
-	db tradeanim_do_givemon_scroll_command
-ENDM
-
-	const tradeanim_frontpic_scroll_command ; $1d
-tradeanim_frontpic_scroll: MACRO
-	db tradeanim_frontpic_scroll_command
-ENDM
-
-	const tradeanim_textbox_scroll_command ; $1e
-tradeanim_textbox_scroll: MACRO
-	db tradeanim_textbox_scroll_command
-ENDM
-
-	const tradeanim_scroll_out_right_command ; $1f
-tradeanim_scroll_out_right: MACRO
-	db tradeanim_scroll_out_right_command
-ENDM
-
-	const_skip ; continues tradeanim_scroll_out_right_command
-
-	const tradeanim_wait_80_command ; $21
-tradeanim_wait_80: MACRO
-	db tradeanim_wait_80_command
-ENDM
-
-	const tradeanim_wait_40_command ; $22
-tradeanim_wait_40: MACRO
-	db tradeanim_wait_40_command
-ENDM
-
-	const tradeanim_rocking_ball_command ; $23
-tradeanim_rocking_ball: MACRO
-	db tradeanim_rocking_ball_command
-ENDM
-
-	const tradeanim_drop_ball_command ; $24
-tradeanim_drop_ball: MACRO
-	db tradeanim_drop_ball_command
-ENDM
-
-	const tradeanim_wait_anim_command ; $25
-tradeanim_wait_anim: MACRO
-	db tradeanim_wait_anim_command
-ENDM
-
-	const_skip ; continues tradeanim_wait_anim_command
-
-	const tradeanim_poof_command ; $27
-tradeanim_poof: MACRO
-	db tradeanim_poof_command
-ENDM
-
-	const tradeanim_bulge_through_tube_command ; $28
-tradeanim_bulge_through_tube: MACRO
-	db tradeanim_bulge_through_tube_command
-ENDM
-
-	const tradeanim_give_trademon_sfx_command ; $29
-tradeanim_give_trademon_sfx: MACRO
-	db tradeanim_give_trademon_sfx_command
-ENDM
-
-	const tradeanim_get_trademon_sfx_command ; $2a
-tradeanim_get_trademon_sfx: MACRO
-	db tradeanim_get_trademon_sfx_command
-ENDM
-
-	const tradeanim_end_command ; $2b
-tradeanim_end: MACRO
-	db tradeanim_end_command
-ENDM
-
-	const tradeanim_animate_frontpic_command ; $2c
-tradeanim_animate_frontpic: MACRO
-	db tradeanim_animate_frontpic_command
-ENDM
-
-	const tradeanim_wait_96_command ; $2d
-tradeanim_wait_96: MACRO
-	db tradeanim_wait_96_command
-ENDM
-
-	const tradeanim_wait_80_if_ot_egg_command ; $2e
-tradeanim_wait_80_if_ot_egg: MACRO
-	db tradeanim_wait_80_if_ot_egg_command
-ENDM
-
-	const tradeanim_wait_180_if_ot_egg_command ; $2f
-tradeanim_wait_180_if_ot_egg: MACRO
-	db tradeanim_wait_180_if_ot_egg_command
-ENDM
-
-; Mobile
-	const_def $01
-
-	const mobiletradeanim_showgivemon_command ; $01
-mobiletradeanim_showgivemon: MACRO
-	db mobiletradeanim_showgivemon_command
-ENDM
-
-	const mobiletradeanim_02_command ; $02
-mobiletradeanim_02: MACRO
-	db mobiletradeanim_02_command
-ENDM
-
-	const mobiletradeanim_sendmon_command ; $03
-mobiletradeanim_sendmon: MACRO
-	db mobiletradeanim_sendmon_command
-ENDM
-
-	const_skip ; continues mobiletradeanim_sendmon_command
-
-	const mobiletradeanim_05_command ; $05
-mobiletradeanim_05: MACRO
-	db mobiletradeanim_05_command
-ENDM
-
-	const mobiletradeanim_06_command ; $06
-mobiletradeanim_06: MACRO
-	db mobiletradeanim_06_command
-ENDM
-
-	const mobiletradeanim_07_command ; $07
-mobiletradeanim_07: MACRO
-	db mobiletradeanim_07_command
-ENDM
-
-	const mobiletradeanim_receivemon_command ; $08
-mobiletradeanim_receivemon: MACRO
-	db mobiletradeanim_receivemon_command
-ENDM
-
-	const_skip 2 ; continues mobiletradeanim_receivemon_command
-
-	const mobiletradeanim_showgetmon_command ; $0b
-mobiletradeanim_showgetmon: MACRO
-	db mobiletradeanim_showgetmon_command
-ENDM
-
-	const mobiletradeanim_end_command ; $0c
-mobiletradeanim_end: MACRO
-	db mobiletradeanim_end_command
-ENDM
-
-	const mobiletradeanim_showgtsgivemon_command ; $0d
-mobiletradeanim_showgtsgivemon: MACRO
-	db mobiletradeanim_showgtsgivemon_command
-ENDM
-
-	const mobiletradeanim_showgtsgetmon_command ; $0e
-mobiletradeanim_showgtsgetmon: MACRO
-	db mobiletradeanim_showgtsgetmon_command
-ENDM
-
-	const mobiletradeanim_0f_command ; $0f
-mobiletradeanim_0f: MACRO
-	db mobiletradeanim_0f_command
-ENDM
-
-	const mobiletradeanim_10_command ; $10
-mobiletradeanim_10: MACRO
-	db mobiletradeanim_10_command
-ENDM
-
-	const mobiletradeanim_11_command ; $11
-mobiletradeanim_11: MACRO
-	db mobiletradeanim_11_command
-ENDM
-
-	const mobiletradeanim_12_command ; $12
-mobiletradeanim_12: MACRO
-	db mobiletradeanim_12_command
-ENDM
-
-	const mobiletradeanim_showoddegg_command ; $13
-mobiletradeanim_showoddegg: MACRO
-	db mobiletradeanim_showoddegg_command
-ENDM
--- a/mobile/mobile_42.asm
+++ b/mobile/mobile_42.asm
@@ -1,3 +1,12 @@
+add_mobiletradeanim: MACRO
+\1_MobileTradeCmd:
+	dw \1
+ENDM
+
+mobiletradeanim: MACRO
+	db (\1_MobileTradeCmd - MobileTradeAnim_JumptableLoop.Jumptable) / 2
+ENDM
+
 MobileTradeAnimation_SendGivemonToGTS:
 	ld a, $80
 	ld [wcf65], a
@@ -5,13 +14,13 @@
 	jp RunMobileTradeAnim_NoFrontpics
 
 .TradeAnimScript:
-	mobiletradeanim_showgtsgivemon
-	mobiletradeanim_12
-	mobiletradeanim_10
-	mobiletradeanim_sendmon
-	mobiletradeanim_06
-	mobiletradeanim_0f
-	mobiletradeanim_end
+	mobiletradeanim MobileTradeAnim_ShowPlayerMonForGTS
+	mobiletradeanim MobileTradeAnim_FadeToBlack
+	mobiletradeanim MobileTradeAnim_10
+	mobiletradeanim MobileTradeAnim_GiveTrademon1
+	mobiletradeanim MobileTradeAnim_06
+	mobiletradeanim MobileTradeAnim_0f
+	mobiletradeanim EndMobileTradeAnim
 
 MobileTradeAnimation_RetrieveGivemonFromGTS:
 	ld a, $80
@@ -25,11 +34,11 @@
 	jp RunMobileTradeAnim_NoFrontpics
 
 .TradeAnimScript:
-	mobiletradeanim_11
-	mobiletradeanim_07
-	mobiletradeanim_receivemon
-	mobiletradeanim_showgtsgetmon
-	mobiletradeanim_end
+	mobiletradeanim MobileTradeAnim_11
+	mobiletradeanim MobileTradeAnim_07
+	mobiletradeanim MobileTradeAnim_GetTrademon1
+	mobiletradeanim MobileTradeAnim_ShowOTMonFromGTS
+	mobiletradeanim EndMobileTradeAnim
 
 Function108026:
 	ld a, $0
@@ -44,14 +53,14 @@
 	jp RunMobileTradeAnim_Frontpics
 
 .TradeAnimScript: ; trade
-	mobiletradeanim_showgivemon
-	mobiletradeanim_12
-	mobiletradeanim_02
-	mobiletradeanim_sendmon
-	mobiletradeanim_05
-	mobiletradeanim_receivemon
-	mobiletradeanim_showgetmon
-	mobiletradeanim_end
+	mobiletradeanim MobileTradeAnim_ShowPlayerMonToBeSent
+	mobiletradeanim MobileTradeAnim_FadeToBlack
+	mobiletradeanim MobileTradeAnim_02
+	mobiletradeanim MobileTradeAnim_GiveTrademon1
+	mobiletradeanim MobileTradeAnim_05
+	mobiletradeanim MobileTradeAnim_GetTrademon1
+	mobiletradeanim MobileTradeAnim_ShowOTMonFromTrade
+	mobiletradeanim EndMobileTradeAnim
 
 Function10803d:
 	ld a, $0
@@ -60,11 +69,11 @@
 	jp RunMobileTradeAnim_NoFrontpics
 
 .TradeAnimScript:
-	mobiletradeanim_11
-	mobiletradeanim_07
-	mobiletradeanim_receivemon
-	mobiletradeanim_showoddegg
-	mobiletradeanim_end
+	mobiletradeanim MobileTradeAnim_11
+	mobiletradeanim MobileTradeAnim_07
+	mobiletradeanim MobileTradeAnim_GetTrademon1
+	mobiletradeanim MobileTradeAnim_GetOddEgg
+	mobiletradeanim EndMobileTradeAnim
 
 Function10804d:
 	ld a, $0
@@ -73,9 +82,9 @@
 	jp RunMobileTradeAnim_NoFrontpics
 
 .TradeAnimScript:
-	mobiletradeanim_11
-	mobiletradeanim_showgtsgetmon
-	mobiletradeanim_end
+	mobiletradeanim MobileTradeAnim_11
+	mobiletradeanim MobileTradeAnim_ShowOTMonFromGTS
+	mobiletradeanim EndMobileTradeAnim
 
 RunMobileTradeAnim_Frontpics:
 	ld hl, wTradeAnimAddress
@@ -354,26 +363,26 @@
 	jumptable .Jumptable, wJumptableIndex
 
 .Jumptable:
-	dw GetMobileTradeAnimByte ; 00
-	dw MobileTradeAnim_ShowPlayerMonToBeSent ; 01
-	dw MobileTradeAnim_02 ; 02
-	dw MobileTradeAnim_GiveTrademon1 ; 03
-	dw MobileTradeAnim_GiveTrademon2 ; 04
-	dw MobileTradeAnim_05 ; 05
-	dw MobileTradeAnim_06 ; 06
-	dw MobileTradeAnim_07 ; 07
-	dw MobileTradeAnim_GetTrademon1 ; 08
-	dw MobileTradeAnim_GetTrademon2 ; 09
-	dw MobileTradeAnim_GetTrademon3 ; 0a
-	dw MobileTradeAnim_ShowOTMonFromTrade ; 0b
-	dw EndMobileTradeAnim ; 0c
-	dw MobileTradeAnim_ShowPlayerMonForGTS ; 0d
-	dw MobileTradeAnim_ShowOTMonFromGTS ; 0e
-	dw MobileTradeAnim_0f ; 0f
-	dw MobileTradeAnim_10 ; 10
-	dw MobileTradeAnim_11 ; 11
-	dw MobileTradeAnim_FadeToBlack ; 12
-	dw MobileTradeAnim_GetOddEgg ; 13 get odd egg
+	add_mobiletradeanim GetMobileTradeAnimByte                ; 00
+	add_mobiletradeanim MobileTradeAnim_ShowPlayerMonToBeSent ; 01
+	add_mobiletradeanim MobileTradeAnim_02                    ; 02
+	add_mobiletradeanim MobileTradeAnim_GiveTrademon1         ; 03
+	add_mobiletradeanim MobileTradeAnim_GiveTrademon2         ; 04
+	add_mobiletradeanim MobileTradeAnim_05                    ; 05
+	add_mobiletradeanim MobileTradeAnim_06                    ; 06
+	add_mobiletradeanim MobileTradeAnim_07                    ; 07
+	add_mobiletradeanim MobileTradeAnim_GetTrademon1          ; 08
+	add_mobiletradeanim MobileTradeAnim_GetTrademon2          ; 09
+	add_mobiletradeanim MobileTradeAnim_GetTrademon3          ; 0a
+	add_mobiletradeanim MobileTradeAnim_ShowOTMonFromTrade    ; 0b
+	add_mobiletradeanim EndMobileTradeAnim                    ; 0c
+	add_mobiletradeanim MobileTradeAnim_ShowPlayerMonForGTS   ; 0d
+	add_mobiletradeanim MobileTradeAnim_ShowOTMonFromGTS      ; 0e
+	add_mobiletradeanim MobileTradeAnim_0f                    ; 0f
+	add_mobiletradeanim MobileTradeAnim_10                    ; 10
+	add_mobiletradeanim MobileTradeAnim_11                    ; 11
+	add_mobiletradeanim MobileTradeAnim_FadeToBlack           ; 12
+	add_mobiletradeanim MobileTradeAnim_GetOddEgg             ; 13 get odd egg
 
 MobileTradeAnim_Next:
 	ld hl, wJumptableIndex