Create macros for remaining script commands

This commit is contained in:
dannye 2021-01-16 10:53:05 -06:00
parent 518e7d399c
commit 342a351859
4 changed files with 476 additions and 352 deletions

View File

@ -1895,7 +1895,7 @@ ScriptCommand_PrintNPCText: ; ccd4 (3:4cd4)
call Func_cc32
jp IncreaseScriptPointerBy3
Func_ccdc: ; ccdc (3:4cdc)
ScriptCommand_PrintText: ; ccdc (3:4cdc)
ld l, c
ld h, b
call Func_c891
@ -1960,7 +1960,7 @@ asm_cd2f:
set 6, [hl]
jp IncreaseScriptPointerBy4
Func_cd4f: ; cd4f (3:4d4f)
ScriptCommand_StartChallengeHallDuel: ; cd4f (3:4d4f)
call Func_cd66
ld a, [wd696]
farcall Func_118bf
@ -1984,7 +1984,7 @@ Func_cd66: ; cd66 (3:4d66)
ld [wDuelTheme], a
ret
Func_cd76: ; cd76 (3:4d76)
ScriptCommand_BattleCenter: ; cd76 (3:4d76)
ld a, GAME_EVENT_BATTLE_CENTER
ld [wGameEvent], a
ld hl, wd0b4
@ -2003,7 +2003,7 @@ ScriptCommand_PrintVariableNPCText: ; cd83 (3:4d83)
call Func_cc32
jp IncreaseScriptPointerBy5
Func_cd94: ; cd94 (3:4d94)
ScriptCommand_PrintTextForChallengeCup: ; cd94 (3:4d94)
get_flag_value EVENT_FLAG_44
dec a
and $3
@ -2015,7 +2015,7 @@ Func_cd94: ; cd94 (3:4d94)
call Func_cc32
jp IncreaseScriptPointerBy7
Func_cda8: ; cda8 (3:4da8)
ScriptCommand_PrintVariableText: ; cda8 (3:4da8)
ld a, [wScriptControlByte]
or a
jr nz, .asm_cdb1
@ -2038,14 +2038,14 @@ ScriptCommand_PrintTextQuitFully: ; cdb9 (3:4db9)
pop hl
ret
Func_cdcb: ; cdcb (3:4dcb)
ScriptCommand_UnloadActiveNPC: ; cdcb (3:4dcb)
ld a, [wScriptNPC]
ld [wLoadedNPCTempIndex], a
Func_cdd1: ; cdd1 (3:4dd1)
farcall Func_1c50a
jp IncreaseScriptPointerBy1
Func_cdd8: ; cdd8 (3:4dd8)
ScriptCommand_UnloadChallengeHallNPC: ; cdd8 (3:4dd8)
ld a, [wLoadedNPCTempIndex]
push af
ld a, [wTempNPC]
@ -2060,7 +2060,7 @@ Func_cdd8: ; cdd8 (3:4dd8)
ld [wLoadedNPCTempIndex], a
ret
Func_cdf5: ; cdf5 (3:4df5)
ScriptCommand_SetChallengeHallNPCCoords: ; cdf5 (3:4df5)
ld a, [wLoadedNPCTempIndex]
push af
ld a, [wTempNPC]
@ -2292,7 +2292,7 @@ ScriptCommand_TakeCard: ; cf4c (3:4f4c)
call RemoveCardFromCollection
jp IncreaseScriptPointerBy2
Func_cf53: ; cf53 (3:4f53)
ScriptCommand_JumpIfAnyEnergyCardsInCollection: ; cf53 (3:4f53)
ld c, $1
ld b, $0
.asm_cf57
@ -2320,7 +2320,7 @@ Func_cf6d: ; cf6d (3:4f6d)
.asm_cf78
jp IncreaseScriptPointerBy3
Func_cf7b: ; cf7b (3:4f7b)
ScriptCommand_RemoveAllEnergyCardsFromCollection: ; cf7b (3:4f7b)
ld c, $1
.asm_cf7d
push bc
@ -2373,14 +2373,14 @@ Func_cfc0: ; cfc0 (3:4fc0)
call GetScriptArgs1AfterPointer
jp SetScriptPointer
Func_cfc6: ; cfc6 (3:4fc6)
ScriptCommand_SetActiveNPCDirection: ; cfc6 (3:4fc6)
ld a, [wScriptNPC]
ld [wLoadedNPCTempIndex], a
ld a, c
farcall Func_1c52e
jp IncreaseScriptPointerBy2
Func_cfd4: ; cfd4 (3:4fd4)
ScriptCommand_PickNextMan1RequestedCard: ; cfd4 (3:4fd4)
get_flag_value EVENT_FLAG_2D
ld b, a
.asm_cfd9
@ -2421,7 +2421,7 @@ Data_d006: ; d006 (3:5006)
db RAPIDASH
db WEEZING
Func_d00b: ; d00b (3:500b)
ScriptCommand_GetMan1RequestedCardNameText: ; d00b (3:500b)
sla c
ld b, $0
ld hl, wTxRam2
@ -2437,19 +2437,19 @@ Func_d00b: ; d00b (3:500b)
ld [hl], d
jp IncreaseScriptPointerBy2
Func_d025: ; d025 (3:5025)
ScriptCommand_JumpIfMan1RequestedCardOwned: ; d025 (3:5025)
get_flag_value EVENT_FLAG_2B
call GetCardCountInCollectionAndDecks
jp c, Func_cf67
jp Func_cf6d
Func_d032: ; d032 (3:5032)
ScriptCommand_JumpIfMan1RequestedCardInCollection: ; d032 (3:5032)
get_flag_value EVENT_FLAG_2B
call GetCardCountInCollection
jp c, Func_cf67
jp Func_cf6d
Func_d03f: ; d03f (3:503f)
ScriptCommand_RemoveMan1RequestedCardFromCollection: ; d03f (3:503f)
get_flag_value EVENT_FLAG_2B
call RemoveCardFromCollection
jp IncreaseScriptPointerBy1
@ -2498,7 +2498,7 @@ ScriptCommand_SetNextNPCAndScript: ; d088 (3:5088)
call SetNextNPCAndScript
jp IncreaseScriptPointerBy4
Func_d095: ; d095 (3:5095)
ScriptCommand_SetSpriteAttributes: ; d095 (3:5095)
ld a, [wScriptNPC]
ld [wLoadedNPCTempIndex], a
push bc
@ -2522,7 +2522,7 @@ Func_d095: ; d095 (3:5095)
farcall Func_1c57b
jp IncreaseScriptPointerBy4
Func_d0be: ; d0be (3:50be)
ScriptCommand_SetActiveNPCCoords: ; d0be (3:50be)
ld a, [wScriptNPC]
ld [wLoadedNPCTempIndex], a
ld a, c
@ -2539,7 +2539,7 @@ ScriptCommand_DoFrames: ; d0ce (3:50ce)
jr nz, ScriptCommand_DoFrames
jp IncreaseScriptPointerBy2
Func_d0d9: ; d0d9 (3:50d9)
ScriptCommand_JumpIfActiveNPCCoordsMatch: ; d0d9 (3:50d9)
ld a, [wScriptNPC]
ld [wLoadedNPCTempIndex], a
ld d, c
@ -2562,7 +2562,7 @@ ScriptCommand_JumpIfPlayerCoordsMatch: ; d0f2 (3:50f2)
jp nz, ScriptEventFailedNoJump
jp ScriptEventPassedTryJump
Func_d103: ; d103 (3:5103)
ScriptCommand_JumpIfNPCLoaded: ; d103 (3:5103)
ld a, [wLoadedNPCTempIndex]
push af
ld a, [wTempNPC]
@ -2584,7 +2584,7 @@ Func_d103: ; d103 (3:5103)
ld [wLoadedNPCTempIndex], a
ret
Func_d125: ; d125 (3:5125)
ScriptCommand_ShowMedalReceivedScreen: ; d125 (3:5125)
ld a, c
push af
call Func_c2a3
@ -2593,7 +2593,7 @@ Func_d125: ; d125 (3:5125)
call Func_c2d4
jp IncreaseScriptPointerBy2
Func_d135: ; d135 (3:5135)
ScriptCommand_LoadCurrentMapNameIntoTxRamSlot: ; d135 (3:5135)
sla c
ld b, $0
ld hl, wTxRam2
@ -2628,7 +2628,7 @@ MapNames: ; d153 (3:5153)
tx ChallengeHallMapNameText
tx PokemonDomeMapNameText
Func_d16b: ; d16b (3:516b)
ScriptCommand_LoadActiveNPCNameIntoTxRamSlot: ; d16b (3:516b)
ld hl, wCurrentNPCNameTx
ld e, [hl]
inc hl
@ -2653,7 +2653,7 @@ Func_d16b: ; d16b (3:516b)
ld [hl], d
jp IncreaseScriptPointerBy2
Func_d195: ; d195 (3:5195)
ScriptCommand_PickChallengeHallOpponent: ; d195 (3:5195)
ld a, [wTempNPC]
push af
get_flag_value EVENT_FLAG_45
@ -2665,11 +2665,11 @@ Func_d195: ; d195 (3:5195)
ld [wTempNPC], a
jp IncreaseScriptPointerBy1
Func_d1ad: ; d1ad (3:51ad)
ScriptCommand_OpenMenu: ; d1ad (3:51ad)
call MainMenu_c75a
jp IncreaseScriptPointerBy1
Func_d1b3: ; d1b3 (3:51b3)
ScriptCommand_PickChallengeCupPrizeCard: ; d1b3 (3:51b3)
get_flag_value EVENT_FLAG_44
dec a
cp $2
@ -2742,7 +2742,7 @@ ChallengeCupPrizeCards: ; d1dc (3:51dc)
db FLYING_PIKACHU
tx FlyingPikachuTradeCardName
Func_d209: ; d209 (3:5209)
ScriptCommand_PickLegendaryCard: ; d209 (3:5209)
get_flag_value EVENT_FLAG_71
ld e, a
.asm_d20e
@ -2791,7 +2791,7 @@ Flags_d240: ; d240 (3:5240)
db EVENT_FLAG_6F
db EVENT_FLAG_70
Func_d244: ; d244 (3:5244)
ScriptCommand_ReplaceMapBlocks: ; d244 (3:5244)
ld a, c
farcall Func_80ba4
jp IncreaseScriptPointerBy2
@ -3007,15 +3007,15 @@ ScriptCommand_EnterMap: ; d36d (3:536d)
set 4, [hl]
jp IncreaseScriptPointerBy6
Func_d38f: ; d38f (3:538f)
ScriptCommand_FlashScreen: ; d38f (3:538f)
farcall Func_10c96
jp IncreaseScriptPointerBy2
Func_d396: ; d396 (3:5396)
ScriptCommand_SaveGame: ; d396 (3:5396)
farcall Func_1157c
jp IncreaseScriptPointerBy2
Func_d39d: ; d39d (3:539d)
ScriptCommand_GiftCenter: ; d39d (3:539d)
ld a, c
or a
jr nz, .asm_d3ac
@ -3033,7 +3033,7 @@ Func_d39d: ; d39d (3:539d)
.asm_d3b6
jp IncreaseScriptPointerBy2
Func_d3b9: ; d3b9 (3:53b9)
ScriptCommand_PlayCredits: ; d3b9 (3:53b9)
call Func_3917
ld a, GAME_EVENT_CREDITS
ld [wGameEvent], a
@ -3049,14 +3049,14 @@ ScriptCommand_TryGivePCPack: ; d3c9 (3:53c9)
ScriptCommand_nop: ; d3d1 (3:53d1)
jp IncreaseScriptPointerBy1
Func_d3d4: ; d3d4 (3:53d4)
ScriptCommand_GiveStarterDeck: ; d3d4 (3:53d4)
ld a, [wd693]
bank1call Func_7576
jp IncreaseScriptPointerBy1
INCROM $d3dd, $d3e0
Func_d3e0: ; d3e0 (3:53e0)
ScriptCommand_WalkPlayerToMasonLaboratory: ; d3e0 (3:53e0)
ld a, $1
ld [wd32e], a
farcall Func_11024
@ -3069,13 +3069,13 @@ Func_d3e0: ; d3e0 (3:53e0)
farcall Func_10f2e
jp IncreaseScriptPointerBy1
Func_d3fe: ; d3fe (3:53fe)
ScriptCommand_OverrideSong: ; d3fe (3:53fe)
ld a, c
ld [wd112], a
call PlaySong
jp IncreaseScriptPointerBy2
Func_d408: ; d408 (3:5408)
ScriptCommand_SetDefaultSong: ; d408 (3:5408)
ld a, c
ld [wd111], a
jp IncreaseScriptPointerBy2
@ -3090,7 +3090,7 @@ ScriptCommand_PlaySFX: ; d416 (3:5416)
call PlaySFX
jp IncreaseScriptPointerBy2
Func_d41d: ; d41d (3:541d)
ScriptCommand_PlayDefaultSong: ; d41d (3:541d)
call Func_39fc
jp IncreaseScriptPointerBy1
@ -3106,12 +3106,12 @@ ScriptCommand_WaitForSongToFinish: ; d42f (3:542f)
call WaitForSongToFinish
jp IncreaseScriptPointerBy1
Func_d435: ; d435 (3:5435)
ScriptCommand_RecordMasterWin: ; d435 (3:5435)
ld a, c
farcall Func_1c83d
jp IncreaseScriptPointerBy2
Func_d43d: ; d43d (3:543d)
ScriptCommand_ChallengeMachine: ; d43d (3:543d)
ld a, GAME_EVENT_CHALLENGE_MACHINE
ld [wGameEvent], a
ld hl, wd0b4
@ -3275,7 +3275,7 @@ Func_d4fb: ; d4fb (3:54fb)
Script_BeginGame: ; d52e (3:552e)
start_script
do_frames 60
run_command Func_d3e0
walk_player_to_mason_lab
do_frames 120
enter_map $02, MASON_LABORATORY, 14, 26, NORTH
quit_script_fully
@ -3325,9 +3325,8 @@ ChallengeMachineObjectTable: ; d572 (3:5572)
Script_ChallengeMachine: ; d57d (3:557d)
start_script
run_command Func_ccdc
tx ItsTheChallengeMachineText
run_command Func_d43d
print_text ItsTheChallengeMachineText
challenge_machine
quit_script_fully
Script_Tech1: ; d583 (3:5583)
@ -3571,8 +3570,7 @@ Script_EnterLabFirstTime: ; d753 (3:5753)
print_npc_text Text05e5
close_text_box
move_active_npc NPCMovement_d882
run_command Func_cfc6
db $01
set_active_npc_direction EAST
set_player_direction WEST
close_advanced_text_box
set_next_npc_and_script NPC_DRMASON, .ows_d794
@ -3677,8 +3675,7 @@ Script_AfterPracticeDuel: ; d834 (3:5834)
set_player_direction NORTH
print_npc_text Text05f0
close_text_box
run_command Func_ccdc
tx Text05f1
print_text Text05f1
close_text_box
print_npc_text Text05f2
.ows_d85f
@ -3691,16 +3688,14 @@ Script_AfterPracticeDuel: ; d834 (3:5834)
close_text_box
pause_song
play_song MUSIC_BOOSTER_PACK
run_command Func_ccdc
tx Text05f5
print_text Text05f5
wait_for_song_to_finish
resume_song
close_text_box
script_set_flag_value EVENT_FLAG_3E, $03
run_command Func_d3d4
give_stater_deck
print_npc_text Text05f6
run_command Func_d396
db $00
save_game $00
quit_script_fully
NPCMovement_d880: ; d880 (3:5880)
@ -3785,8 +3780,7 @@ Script_LostToAaron: ; d92e (3:592e)
Script_d932: ; d932 (3:5932)
start_script
run_command Func_ccdc
tx Text0605
print_text Text0605
ask_question_jump_default_yes Text0606, .ows_d93c
quit_script_fully
@ -3947,8 +3941,7 @@ Script_Ishihara: ; db4a (3:5b4a)
script_set_flag_value EVENT_FLAG_1F, $03
zero_out_flag_value EVENT_FLAG_38
print_npc_text Text072f
run_command Func_ccdc
tx Text0730
print_text Text0730
take_card CLEFABLE
give_card SURFING_PIKACHU1
show_card_received_screen SURFING_PIKACHU1
@ -3974,8 +3967,7 @@ Script_Ishihara: ; db4a (3:5b4a)
script_set_flag_value EVENT_FLAG_1F, $05
zero_out_flag_value EVENT_FLAG_38
print_npc_text Text072f
run_command Func_ccdc
tx Text0736
print_text Text0736
take_card DITTO
give_card FLYING_PIKACHU
show_card_received_screen FLYING_PIKACHU
@ -4001,8 +3993,7 @@ Script_Ishihara: ; db4a (3:5b4a)
script_set_flag_value EVENT_FLAG_1F, $07
zero_out_flag_value EVENT_FLAG_38
print_npc_text Text072f
run_command Func_ccdc
tx Text073c
print_text Text073c
take_card CHANSEY
give_card SURFING_PIKACHU2
show_card_received_screen SURFING_PIKACHU2
@ -4112,11 +4103,10 @@ Script_LostToImakuni: ; dd5c (3:5d5c)
.ows_dd6e
move_active_npc NPCMovement_dd78
run_command Func_cdcb
unload_active_npc
max_out_flag_value EVENT_TEMP_DUELED_IMAKUNI
run_command Func_d408
db $09
run_command Func_d41d
set_default_song MUSIC_OVERWORLD
play_default_song
quit_script_fully
NPCMovement_dd78: ; dd78 (3:5d78)
@ -4204,10 +4194,8 @@ Script_BeatMitch: ; ddff (3:5dff)
print_npc_text Text047f
max_out_flag_value EVENT_FLAG_0F
try_give_medal_pc_packs
run_command Func_d125
db $0f
run_command Func_d435
db $01
show_medal_received_screen EVENT_FLAG_0F
record_master_win $01
print_npc_text Text0480
give_booster_packs BOOSTER_LABORATORY_NEUTRAL, BOOSTER_LABORATORY_NEUTRAL, NO_BOOSTER
print_npc_text Text0481
@ -4422,8 +4410,7 @@ Script_Gal1: ; e0cf (3:60cf)
.ows_e0fb
script_set_flag_value EVENT_FLAG_12, $02
print_npc_text Gal1LetsTradeText
run_command Func_ccdc
tx Gal1TradeCompleteText
print_text Gal1TradeCompleteText
take_card LAPRAS
give_card ARCANINE1
show_card_received_screen ARCANINE1
@ -4666,8 +4653,7 @@ Script_BeatJoshua: ; e26c (3:626c)
close_text_box
move_active_npc_by_direction NPCMovementTable_e2a1
print_npc_text Text044a
run_command Func_cfc6
db $00
set_active_npc_direction NORTH
close_advanced_text_box
set_next_npc_and_script NPC_AMY, Script_MeetAmy
end_script
@ -4715,18 +4701,10 @@ Script_MeetAmy: ; e2d1 (3:62d1)
set_dialog_npc NPC_AMY
print_npc_text Text044d
close_text_box
run_command Func_d095
db $09
db $2f
db $10
set_sprite_attributes $09, $2f, $10
do_frames $20
run_command Func_d095
db $04
db $0e
db $00
run_command Func_d0be
db $14
db $04
set_sprite_attributes $04, $0e, $00
set_active_npc_coords $14, $04
set_player_direction WEST
move_player WEST, 1
set_player_direction NORTH
@ -4745,10 +4723,7 @@ Script_Amy: ; e304 (3:6304)
.deny_duel
print_npc_text Text0451
run_command Func_d0d9
db $14
db $04
dw Script_LostToAmy.ows_e34e
jump_if_active_npc_coords_match $14, $04, Script_LostToAmy.ows_e34e
quit_script_fully
.start_duel
@ -4763,37 +4738,24 @@ Script_BeatAmy: ; e322 (3:6322)
print_npc_text Text0454
max_out_flag_value EVENT_BEAT_AMY
try_give_medal_pc_packs
run_command Func_d125
db EVENT_BEAT_AMY
run_command Func_d435
db $03
show_medal_received_screen EVENT_BEAT_AMY
record_master_win $03
print_npc_text Text0455
.give_booster_packs
give_booster_packs BOOSTER_LABORATORY_WATER, BOOSTER_LABORATORY_WATER, NO_BOOSTER
print_npc_text Text0456
run_command Func_d0d9
db $14
db $04
dw Script_LostToAmy.ows_e34e
jump_if_active_npc_coords_match $14, $04, Script_LostToAmy.ows_e34e
quit_script_fully
Script_LostToAmy: ; e344 (3:6344)
start_script
print_npc_text Text0457
run_command Func_d0d9
db $14
db $04
dw .ows_e34e
jump_if_active_npc_coords_match $14, $04, .ows_e34e
quit_script_fully
.ows_e34e
run_command Func_d095
db $08
db $2e
db $10
run_command Func_d0be
db $16
db $04
set_sprite_attributes $08, $2e, $10
set_active_npc_coords $16, $04
quit_script_fully
Script_Amy_AlreadyHaveMedal: ; e356 (3:6356)
@ -5038,8 +5000,7 @@ Script_Lass2: ; e61f (3:661f)
max_out_flag_value EVENT_FLAG_04
script_set_flag_value EVENT_FLAG_37, $02
print_npc_text Text06f1
run_command Func_ccdc
tx Text06f2
print_text Text06f2
take_card ODDISH
give_card VILEPLUME
show_card_received_screen VILEPLUME
@ -5064,8 +5025,7 @@ Script_Lass2: ; e61f (3:661f)
max_out_flag_value EVENT_FLAG_04
script_set_flag_value EVENT_FLAG_37, $04
print_npc_text Text06f9
run_command Func_ccdc
tx Text06fa
print_text Text06fa
take_card CLEFAIRY
give_card PIKACHU3
show_card_received_screen PIKACHU3
@ -5090,8 +5050,7 @@ Script_Lass2: ; e61f (3:661f)
max_out_flag_value EVENT_FLAG_04
script_set_flag_value EVENT_FLAG_37, $06
print_npc_text Text0700
run_command Func_ccdc
tx Text0701
print_text Text0701
take_card CHARIZARD
give_card BLASTOISE
show_card_received_screen BLASTOISE
@ -5230,8 +5189,7 @@ Script_FirstRonaldEncounter: ; e862 (3:6862)
start_script
max_out_flag_value EVENT_FLAG_4B
move_active_npc NPCMovement_e894
run_command Func_d135
db $00
load_current_map_name_into_txram_slot $00
print_npc_text Text0645
close_text_box
move_player NORTH, 1
@ -5249,8 +5207,8 @@ Script_FirstRonaldEncounter: ; e862 (3:6862)
set_player_direction WEST
move_player EAST, 4
move_active_npc NPCMovement_e894
run_command Func_cdcb
run_command Func_d41d
unload_active_npc
play_default_song
quit_script_fully
NPCMovement_e894: ; e894 (3:6894)
@ -5297,8 +5255,8 @@ Script_LostToFirstRonaldFight: ; e8f7 (3:68f7)
script_set_flag_value EVENT_FLAG_4C, $02
close_text_box
move_active_npc NPCMovement_e90f
run_command Func_cdcb
run_command Func_d41d
unload_active_npc
play_default_song
quit_script_fully
NPCMovement_e905: ; e905 (3:6905)
@ -5359,8 +5317,8 @@ Script_LostToSecondRonaldFight: ; e955 (3:6955)
script_set_flag_value EVENT_FLAG_4D, $02
close_text_box
move_active_npc NPCMovement_e90f
run_command Func_cdcb
run_command Func_d41d
unload_active_npc
play_default_song
quit_script_fully
PsychicClubLobbyAfterDuel: ; e963 (3:6963)
@ -5661,8 +5619,7 @@ Script_ee76: ; ee76 (3:6e76)
.ows_ee7d
script_set_flag_value EVENT_FLAG_21, $02
run_command Func_ccdc
tx FoundLv9SlowpokeText
print_text FoundLv9SlowpokeText
give_card SLOWPOKE1
show_card_received_screen SLOWPOKE1
quit_script_fully
@ -5753,10 +5710,8 @@ Script_BeatKen: ; ef5e (3:6f5e)
jump_if_flag_nonzero_2 EVENT_FLAG_0A, .give_booster_packs
max_out_flag_value EVENT_FLAG_0A
try_give_medal_pc_packs
run_command Func_d125
db $0a
run_command Func_d435
db $08
show_medal_received_screen EVENT_FLAG_0A
record_master_win $08
print_npc_text Text06c2
.give_booster_packs
give_booster_packs BOOSTER_MYSTERY_NEUTRAL, BOOSTER_MYSTERY_NEUTRAL, NO_BOOSTER
@ -6191,8 +6146,7 @@ Script_f353: ; f353 (3:7353)
move_active_npc NPCMovement_f37d
do_frames 20
move_active_npc NPCMovement_f390
run_command Func_d16b
db $00
load_active_npc_name_into_txram_slot $00
print_npc_text Text0532
close_text_box
move_active_npc NPCMovement_f37f
@ -6203,10 +6157,7 @@ Script_f353: ; f353 (3:7353)
close_text_box
move_active_npc NPCMovement_f38e
print_npc_text Text0535
run_command Func_cd4f
db $04
db $00
db $00
start_challenge_hall_duel PRIZES_4, SAMS_PRACTICE_DECK_ID, MUSIC_STOP
quit_script_fully
NPCMovement_f37d: ; f37d (3:737d)
@ -6254,10 +6205,8 @@ Script_LostAtChallengeHall: ; f392 (3:7392)
move_active_npc NPCMovement_f390
jump_if_flag_equal EVENT_FLAG_45, $02, Script_f410
jump_if_flag_equal EVENT_FLAG_45, $03, Script_f410.ows_f41a
run_command Func_d16b
db $00
run_command Func_d16b
db $01
load_active_npc_name_into_txram_slot $00
load_active_npc_name_into_txram_slot $01
print_npc_text Text0536
.ows_f3ae
close_text_box
@ -6312,10 +6261,8 @@ NPCMovement_f40d: ; f40d (3:740d)
db $ff
Script_f410: ; f410 (4:7410)
run_command Func_d16b
db $00
run_command Func_d16b
db $01
load_active_npc_name_into_txram_slot $00
load_active_npc_name_into_txram_slot $01
print_npc_text Text0538
script_jump Script_LostAtChallengeHall.ows_f3ae
@ -6349,21 +6296,17 @@ Script_WonAtChallengeHall: ; f441 (3:7441)
jump_if_flag_equal EVENT_FLAG_45, $01, NULL
print_variable_npc_text Text053c, Text053d
move_active_npc NPCMovement_f37f
run_command Func_d16b
db $00
load_active_npc_name_into_txram_slot $00
print_npc_text Text053e
close_text_box
move_wram_npc NPCMovement_f4c8
run_command Func_cdd8
unload_challenge_hall_npc
print_npc_text Text053f
close_text_box
run_command Func_d195
run_command Func_cdf5
db $14
db $14
pick_challenge_hall_opponent
set_challenge_hall_npc_coords $14, $14
move_wram_npc NPCMovement_f4d0
run_command Func_d16b
db $00
load_active_npc_name_into_txram_slot $00
jump_if_flag_equal EVENT_FLAG_45, $02, NULL
print_variable_npc_text Text0540, Text0541
move_active_npc NPCMovement_f383
@ -6383,16 +6326,13 @@ Script_WonAtChallengeHall: ; f441 (3:7441)
ask_question_jump_default_yes Text0546, .ows_f4bd
jump_if_flag_equal EVENT_FLAG_45, $02, NULL
print_variable_npc_text Text0547, Text0548
run_command Func_cd4f
db $04
db $00
db $00
start_challenge_hall_duel PRIZES_4, SAMS_PRACTICE_DECK_ID, MUSIC_STOP
quit_script_fully
.ows_f4bd
print_npc_text Text0549
close_text_box
max_out_flag_value EVENT_FLAG_47
run_command Func_d1ad
open_menu
close_text_box
script_jump .ows_f4a4
@ -6425,8 +6365,7 @@ NPCMovement_f4d8: ; f4d8 (3:74d8)
Script_f4db: ; f4db (3:74db)
print_npc_text Text054a
move_active_npc NPCMovement_f37f
run_command Func_d16b
db $00
load_active_npc_name_into_txram_slot $00
print_npc_text Text054b
close_text_box
jump_if_flag_equal EVENT_FLAG_44, $03, .ows_f513
@ -6445,12 +6384,12 @@ Script_f4db: ; f4db (3:74db)
.ows_f513
move_wram_npc NPCMovement_f4c8
.ows_f516
run_command Func_cdd8
unload_challenge_hall_npc
move_active_npc NPCMovement_f383
print_npc_text Text0550
close_text_box
move_active_npc NPCMovement_f38b
run_command Func_d1b3
pick_challenge_cup_prize_card
print_npc_text Text0551
give_card VARIABLE_CARD
show_card_received_screen $00
@ -6715,42 +6654,33 @@ Script_fbf1: ; fbf1 (3:7bf1)
start_script
jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_fc10
max_out_flag_value EVENT_RECEIVED_LEGENDARY_CARD
run_command Func_ccdc
tx Text05b8
print_text Text05b8
give_card ZAPDOS3
give_card MOLTRES2
give_card ARTICUNO2
give_card DRAGONITE1
show_card_received_screen $ff
.ows_fc05
run_command Func_d38f
db $00
run_command Func_ccdc
tx Text05b9
flash_screen $00
print_text Text05b9
.ows_fc0a
run_command Func_d38f
db $01
run_command Func_d396
db $01
run_command Func_d3b9
flash_screen $01
save_game $01
play_credits
quit_script_fully
.ows_fc10
jump_if_flag_equal EVENT_FLAG_71, $0f, .ows_fc20
run_command Func_d209
run_command Func_ccdc
tx Text05ba
pick_legendary_card
print_text Text05ba
give_card VARIABLE_CARD
show_card_received_screen VARIABLE_CARD
script_jump .ows_fc05
.ows_fc20
run_command Func_ccdc
tx Text05bb
run_command Func_d38f
db $00
run_command Func_ccdc
tx Text05bc
print_text Text05bb
flash_screen $00
print_text Text05bc
script_jump .ows_fc0a
Func_fc2b: ; fc2b (3:7c2b)
@ -6785,7 +6715,7 @@ Script_fc52: ; fc52 (3:7c52)
print_text_quit_fully Text06c9
.ows_fc5e
run_command Func_cd76
battle_center
quit_script_fully
Script_fc60: ; fc60 (3:7c60)
@ -6820,8 +6750,7 @@ Func_fc7a: ; fc7a (3:7c7a)
start_script
jump_if_flag_not_equal EVENT_FLAG_74, $02, Func_fcad.ows_fcd5
print_npc_text Text06cd
run_command Func_d39d
db $00
gift_center $00
jump_if_flag_not_less_than EVENT_FLAG_72, $04, Func_fc7a.ows_fcaa
print_npc_text Text06ce
ask_question_jump_default_yes Text06cf, .ows_fca0
@ -6829,13 +6758,10 @@ Func_fc7a: ; fc7a (3:7c7a)
script_jump Func_fc7a.ows_fcaa
.ows_fca0
run_command Func_d396
db $00
save_game $00
play_sfx SFX_56
run_command Func_ccdc
tx Text06d1
run_command Func_d39d
db $01
print_text Text06d1
gift_center $01
quit_script_fully
.ows_fcaa
@ -6848,8 +6774,7 @@ Func_fcad: ; fcad (3:7cad)
start_script
play_sfx SFX_56
run_command Func_d396
db $00
save_game $00
jump_if_flag_equal EVENT_FLAG_72, $00, .ows_fccc
jump_if_flag_equal EVENT_FLAG_72, $02, .ows_fccf
jump_if_flag_equal EVENT_FLAG_72, $03, .ows_fcd2

View File

@ -1008,13 +1008,13 @@ OverworldScriptTable: ; 1217b (4:617b)
dw ScriptCommand_EndScript
dw ScriptCommand_CloseAdvancedTextBox
dw ScriptCommand_PrintNPCText
dw Func_ccdc
dw ScriptCommand_PrintText
dw ScriptCommand_AskQuestionJump
dw ScriptCommand_StartDuel
dw ScriptCommand_PrintVariableNPCText
dw Func_cda8
dw ScriptCommand_PrintVariableText
dw ScriptCommand_PrintTextQuitFully
dw Func_cdcb
dw ScriptCommand_UnloadActiveNPC
dw ScriptCommand_MoveActiveNPCByDirection
dw ScriptCommand_CloseTextBox
dw ScriptCommand_GiveBoosterPacks
@ -1022,16 +1022,16 @@ OverworldScriptTable: ; 1217b (4:617b)
dw ScriptCommand_JumpIfCardInCollection
dw ScriptCommand_GiveCard
dw ScriptCommand_TakeCard
dw Func_cf53
dw Func_cf7b
dw ScriptCommand_JumpIfAnyEnergyCardsInCollection
dw ScriptCommand_RemoveAllEnergyCardsFromCollection
dw ScriptCommand_JumpIfEnoughCardsOwned
dw ScriptCommand_JumpBasedOnFightingClubPupilStatus
dw Func_cfc6
dw Func_cfd4
dw Func_d00b
dw Func_d025
dw Func_d032
dw Func_d03f
dw ScriptCommand_SetActiveNPCDirection
dw ScriptCommand_PickNextMan1RequestedCard
dw ScriptCommand_GetMan1RequestedCardNameText
dw ScriptCommand_JumpIfMan1RequestedCardOwned
dw ScriptCommand_JumpIfMan1RequestedCardInCollection
dw ScriptCommand_RemoveMan1RequestedCardFromCollection
dw ScriptCommand_Jump
dw ScriptCommand_TryGiveMedalPCPacks
dw ScriptCommand_SetPlayerDirection
@ -1039,55 +1039,55 @@ OverworldScriptTable: ; 1217b (4:617b)
dw ScriptCommand_ShowCardReceivedScreen
dw ScriptCommand_SetDialogNPC
dw ScriptCommand_SetNextNPCAndScript
dw Func_d095
dw Func_d0be
dw ScriptCommand_SetSpriteAttributes
dw ScriptCommand_SetActiveNPCCoords
dw ScriptCommand_DoFrames
dw Func_d0d9
dw ScriptCommand_JumpIfActiveNPCCoordsMatch
dw ScriptCommand_JumpIfPlayerCoordsMatch
dw ScriptCommand_MoveActiveNPC
dw ScriptCommand_GiveOneOfEachTrainerBooster
dw Func_d103
dw Func_d125
dw Func_d135
dw Func_d16b
dw Func_cd4f
dw Func_cd94
dw ScriptCommand_JumpIfNPCLoaded
dw ScriptCommand_ShowMedalReceivedScreen
dw ScriptCommand_LoadCurrentMapNameIntoTxRamSlot
dw ScriptCommand_LoadActiveNPCNameIntoTxRamSlot
dw ScriptCommand_StartChallengeHallDuel
dw ScriptCommand_PrintTextForChallengeCup
dw ScriptCommand_MoveWramNPC
dw Func_cdd8
dw Func_cdf5
dw Func_d195
dw Func_d1ad
dw Func_d1b3
dw ScriptCommand_UnloadChallengeHallNPC
dw ScriptCommand_SetChallengeHallNPCCoords
dw ScriptCommand_PickChallengeHallOpponent
dw ScriptCommand_OpenMenu
dw ScriptCommand_PickChallengeCupPrizeCard
dw ScriptCommand_QuitScriptFully
dw Func_d244
dw ScriptCommand_ReplaceMapBlocks
dw ScriptCommand_ChooseDeckToDuelAgainstMultichoice
dw ScriptCommand_OpenDeckMachine
dw ScriptCommand_ChooseStarterDeckMultichoice
dw ScriptCommand_EnterMap
dw ScriptCommand_MoveArbitraryNPC
dw Func_d209
dw Func_d38f
dw Func_d396
dw Func_cd76
dw Func_d39d
dw Func_d3b9
dw ScriptCommand_PickLegendaryCard
dw ScriptCommand_FlashScreen
dw ScriptCommand_SaveGame
dw ScriptCommand_BattleCenter
dw ScriptCommand_GiftCenter
dw ScriptCommand_PlayCredits
dw ScriptCommand_TryGivePCPack
dw ScriptCommand_nop
dw Func_d3d4
dw Func_d3e0
dw Func_d3fe
dw Func_d408
dw ScriptCommand_GiveStarterDeck
dw ScriptCommand_WalkPlayerToMasonLaboratory
dw ScriptCommand_OverrideSong
dw ScriptCommand_SetDefaultSong
dw ScriptCommand_PlaySong
dw ScriptCommand_PlaySFX
dw ScriptCommand_PauseSong
dw ScriptCommand_ResumeSong
dw Func_d41d
dw ScriptCommand_PlayDefaultSong
dw ScriptCommand_WaitForSongToFinish
dw Func_d435
dw ScriptCommand_RecordMasterWin
dw ScriptCommand_AskQuestionJumpDefaultYes
dw ScriptCommand_ShowSamNormalMultichoice
dw ScriptCommand_ShowSamTutorialMultichoice
dw Func_d43d
dw ScriptCommand_ChallengeMachine
dw ScriptCommand_EndScript
dw ScriptCommand_EndScript
dw ScriptCommand_EndScript

View File

@ -8,13 +8,13 @@ ENDM
const ScriptCommand_EndScript_index ; $00
const ScriptCommand_CloseAdvancedTextBox_index ; $01
const ScriptCommand_PrintNPCText_index ; $02
const Func_ccdc_index ; $03
const ScriptCommand_PrintText_index ; $03
const ScriptCommand_AskQuestionJump_index ; $04
const ScriptCommand_StartDuel_index ; $05
const ScriptCommand_PrintVariableNPCText_index ; $06
const Func_cda8_index ; $07
const ScriptCommand_PrintVariableText_index ; $07
const ScriptCommand_PrintTextQuitFully_index ; $08
const Func_cdcb_index ; $09
const ScriptCommand_UnloadActiveNPC_index ; $09
const ScriptCommand_MoveActiveNPCByDirection_index ; $0a
const ScriptCommand_CloseTextBox_index ; $0b
const ScriptCommand_GiveBoosterPacks_index ; $0c
@ -22,16 +22,16 @@ ENDM
const ScriptCommand_JumpIfCardInCollection_index ; $0e
const ScriptCommand_GiveCard_index ; $0f
const ScriptCommand_TakeCard_index ; $10
const Func_cf53_index ; $11
const Func_cf7b_index ; $12
const ScriptCommand_JumpIfAnyEnergyCardsInCollection_index ; $11
const ScriptCommand_RemoveAllEnergyCardsFromCollection_index ; $12
const ScriptCommand_JumpIfEnoughCardsOwned_index ; $13
const ScriptCommand_JumpBasedOnFightingClubPupilStatus_index ; $14
const Func_cfc6_index ; $15
const Func_cfd4_index ; $16
const Func_d00b_index ; $17
const Func_d025_index ; $18
const Func_d032_index ; $19
const Func_d03f_index ; $1a
const ScriptCommand_SetActiveNPCDirection_index ; $15
const ScriptCommand_PickNextMan1RequestedCard_index ; $16
const ScriptCommand_GetMan1RequestedCardNameText_index ; $17
const ScriptCommand_JumpIfMan1RequestedCardOwned_index ; $18
const ScriptCommand_JumpIfMan1RequestedCardInCollection_index ; $19
const ScriptCommand_RemoveMan1RequestedCardFromCollection_index ; $1a
const ScriptCommand_Jump_index ; $1b
const ScriptCommand_TryGiveMedalPCPacks_index ; $1c
const ScriptCommand_SetPlayerDirection_index ; $1d
@ -39,55 +39,55 @@ ENDM
const ScriptCommand_ShowCardReceivedScreen_index ; $1f
const ScriptCommand_SetDialogNPC_index ; $20
const ScriptCommand_SetNextNPCAndScript_index ; $21
const Func_d095_index ; $22
const Func_d0be_index ; $23
const ScriptCommand_SetSpriteAttributes_index ; $22
const ScriptCommand_SetActiveNPCCoords_index ; $23
const ScriptCommand_DoFrames_index ; $24
const Func_d0d9_index ; $25
const ScriptCommand_JumpIfActiveNPCCoordsMatch_index ; $25
const ScriptCommand_JumpIfPlayerCoordsMatch_index ; $26
const ScriptCommand_MoveActiveNPC_index ; $27
const ScriptCommand_GiveOneOfEachTrainerBooster_index ; $28
const Func_d103_index ; $29
const Func_d125_index ; $2a
const Func_d135_index ; $2b
const Func_d16b_index ; $2c
const Func_cd4f_index ; $2d
const Func_cd94_index ; $2e
const ScriptCommand_JumpIfNPCLoaded_index ; $29
const ScriptCommand_ShowMedalReceivedScreen_index ; $2a
const ScriptCommand_LoadCurrentMapNameIntoTxRamSlot_index ; $2b
const ScriptCommand_LoadActiveNPCNameIntoTxRamSlot_index ; $2c
const ScriptCommand_StartChallengeHallDuel_index ; $2d
const ScriptCommand_PrintTextForChallengeCup_index ; $2e
const ScriptCommand_MoveWramNPC_index ; $2f
const Func_cdd8_index ; $30
const Func_cdf5_index ; $31
const Func_d195_index ; $32
const Func_d1ad_index ; $33
const Func_d1b3_index ; $34
const ScriptCommand_UnloadChallengeHallNPC_index ; $30
const ScriptCommand_SetChallengeHallNPCCoords_index ; $31
const ScriptCommand_PickChallengeHallOpponent_index ; $32
const ScriptCommand_OpenMenu_index ; $33
const ScriptCommand_PickChallengeCupPrizeCard_index ; $34
const ScriptCommand_QuitScriptFully_index ; $35
const Func_d244_index ; $36
const ScriptCommand_ReplaceMapBlocks_index ; $36
const ScriptCommand_ChooseDeckToDuelAgainstMultichoice_index ; $37
const ScriptCommand_OpenDeckMachine_index ; $38
const ScriptCommand_ChooseStarterDeckMultichoice_index ; $39
const ScriptCommand_EnterMap_index ; $3a
const ScriptCommand_MoveArbitraryNPC_index ; $3b
const Func_d209_index ; $3c
const Func_d38f_index ; $3d
const Func_d396_index ; $3e
const Func_cd76_index ; $3f
const Func_d39d_index ; $40
const Func_d3b9_index ; $41
const ScriptCommand_PickLegendaryCard_index ; $3c
const ScriptCommand_FlashScreen_index ; $3d
const ScriptCommand_SaveGame_index ; $3e
const ScriptCommand_BattleCenter_index ; $3f
const ScriptCommand_GiftCenter_index ; $40
const ScriptCommand_PlayCredits_index ; $41
const ScriptCommand_TryGivePCPack_index ; $42
const ScriptCommand_nop_index ; $43
const Func_d3d4_index ; $44
const Func_d3e0_index ; $45
const Func_d3fe_index ; $46
const Func_d408_index ; $47
const ScriptCommand_GiveStarterDeck_index ; $44
const ScriptCommand_WalkPlayerToMasonLaboratory_index ; $45
const ScriptCommand_OverrideSong_index ; $46
const ScriptCommand_SetDefaultSong_index ; $47
const ScriptCommand_PlaySong_index ; $48
const ScriptCommand_PlaySFX_index ; $49
const ScriptCommand_PauseSong_index ; $4a
const ScriptCommand_ResumeSong_index ; $4b
const Func_d41d_index ; $4c
const ScriptCommand_PlayDefaultSong_index ; $4c
const ScriptCommand_WaitForSongToFinish_index ; $4d
const Func_d435_index ; $4e
const ScriptCommand_RecordMasterWin_index ; $4e
const ScriptCommand_AskQuestionJumpDefaultYes_index ; $4f
const ScriptCommand_ShowSamNormalMultichoice_index ; $50
const ScriptCommand_ShowSamTutorialMultichoice_index ; $51
const Func_d43d_index ; $52
const ScriptCommand_ChallengeMachine_index ; $52
const ScriptCommand_EndScript2_index ; $53
const ScriptCommand_EndScript3_index ; $54
const ScriptCommand_EndScript4_index ; $55
@ -128,6 +128,12 @@ print_npc_text: MACRO
tx \1 ; Text Pointer
ENDM
; Opens a new dialog window and displays the given text
print_text: MACRO
run_command ScriptCommand_PrintText
tx \1 ; Text Pointer
ENDM
; Displays text and allows players to choose yes or no. Will jump on yes.
; if first argument is 0000 (NULL), will overwrite last text with yes/no.
ask_question_jump: MACRO
@ -148,19 +154,31 @@ start_duel: MACRO
db \3 ; Duel Music (ex MUSIC_DUEL_THEME_1)
ENDM
; Prints the first or second text depending on if wScriptControlByte is nonzero or zero respectively
; Prints the first or second npc text depending on if wScriptControlByte is nonzero or zero respectively
print_variable_npc_text: MACRO
run_command ScriptCommand_PrintVariableNPCText
tx \1 ; Text Pointer
tx \2 ; Text Pointer
ENDM
; Prints the first or second text depending on if wScriptControlByte is nonzero or zero respectively
print_variable_text: MACRO
run_command ScriptCommand_PrintVariableText
tx \1 ; Text Pointer
tx \2 ; Text Pointer
ENDM
; Displays text then fully quits out of scripting system (Does NOT return to RST20)
print_text_quit_fully: MACRO
run_command ScriptCommand_PrintTextQuitFully
tx \1 ; Text Pointer
ENDM
; Removes the current NPC from the map
unload_active_npc: MACRO
run_command ScriptCommand_UnloadActiveNPC
ENDM
; Moves the current NPC depending on their current direction
; Argument points to a table of 4 NPCMovements chosen based on direction value
move_active_npc_by_direction: MACRO
@ -208,6 +226,17 @@ take_card: MACRO
db \1 ; card ID (ex LAPRAS)
ENDM
; Jumps to a given script position if the player has any energy cards in their collection
jump_if_any_energy_cards_in_collection: MACRO
run_command ScriptCommand_JumpIfAnyEnergyCardsInCollection
dw \1 ; script label
ENDM
; Removes all of the player's energy cards from their collection
remove_all_energy_cards_from_collection: MACRO
run_command ScriptCommand_RemoveAllEnergyCardsFromCollection
ENDM
; Jumps to a given script position if the player owns enough cards
jump_if_enough_cards_owned: MACRO
run_command ScriptCommand_JumpIfEnoughCardsOwned
@ -225,6 +254,39 @@ fight_club_pupil_jump: MACRO
dw \5 ; Script Label (All Pupils Defeated)
ENDM
; Causes the active NPC to face the specified direction
set_active_npc_direction: MACRO
run_command ScriptCommand_SetActiveNPCDirection
db \1 ; Direction (ex NORTH)
ENDM
; Picks the next card gift that will be requested by NPC_MAN1
pick_next_man1_requested_card: MACRO
run_command ScriptCommand_PickNextMan1RequestedCard
ENDM
; Loads the name text for the card gift requested by NPC_MAN1
get_man1_requested_card_name_text: MACRO
run_command ScriptCommand_GetMan1RequestedCardNameText
ENDM
; Jumps to the given script position if the player owns the card gift requested by NPC_MAN1
jump_if_man1_requested_card_owned: MACRO
run_command ScriptCommand_JumpIfMan1RequestedCardOwned
dw \1 ; Script Label
ENDM
; Jumps to the given script position if the player's collection contains the card gift requested by NPC_MAN1
jump_if_man1_requested_card_in_collection: MACRO
run_command ScriptCommand_JumpIfMan1RequestedCardInCollection
dw \1 ; Script Label
ENDM
; Removes from the player's collection the card gift requested by NPC_MAN1
remove_man1_requested_card_from_collection: MACRO
run_command ScriptCommand_RemoveMan1RequestedCardFromCollection
ENDM
; Jumps to a given script position
script_jump: MACRO
run_command ScriptCommand_Jump
@ -268,12 +330,35 @@ set_next_npc_and_script: MACRO
dw \2 ; Script Label
ENDM
; Sets some NPC sprite attributes
set_sprite_attributes: MACRO
run_command ScriptCommand_SetSpriteAttributes
db \1 ; Relates to LOADED_NPC_FIELD_05
db \2 ; Relates to LOADED_NPC_FIELD_05
db \3 ; Relates to LOADED_NPC_FIELD_06
ENDM
; Sets the active NPC's coords
set_active_npc_coords: MACRO
run_command ScriptCommand_SetActiveNPCCoords
db \1 ; X Coord
db \2 ; Y Coord
ENDM
; Waits a number of frames
do_frames: MACRO
run_command ScriptCommand_DoFrames
db \1 ; Number of frames to wait
ENDM
; Jumps to a script position if the active NPC's X and Y match the given values
jump_if_active_npc_coords_match: MACRO
run_command ScriptCommand_JumpIfActiveNPCCoordsMatch
db \1 ; X Coord
db \2 ; Y Coord
dw \3 ; Script Label
ENDM
; Jumps to a script position if the player's X and Y match the given values
jump_if_player_coords_match: MACRO
run_command ScriptCommand_JumpIfPlayerCoordsMatch
@ -293,17 +378,93 @@ give_one_of_each_trainer_booster: MACRO
run_command ScriptCommand_GiveOneOfEachTrainerBooster
ENDM
; Jumps to a script position if the NPC is loaded
jump_if_npc_loaded: MACRO
run_command ScriptCommand_JumpIfNPCLoaded
db \1 ; NPC (ex NPC_DRMASON)
dw \2 ; Script Label
ENDM
; Shows the medal received screen for the given master medal
show_medal_received_screen: MACRO
run_command ScriptCommand_ShowMedalReceivedScreen
db \1 ; medal event
ENDM
; Loads the current map name into the given txram slot
load_current_map_name_into_txram_slot: MACRO
run_command ScriptCommand_LoadCurrentMapNameIntoTxRamSlot
db \1 ; TxRam slot
ENDM
; Loads the active NPC name into the given txram slot
load_active_npc_name_into_txram_slot: MACRO
run_command ScriptCommand_LoadActiveNPCNameIntoTxRamSlot
db \1 ; TxRam slot
ENDM
; Begins a duel with the challenge hall opponent
; The deck and song arguments are overwritten when the duel is initialized
start_challenge_hall_duel: MACRO
run_command ScriptCommand_StartChallengeHallDuel
db \1 ; Prize Amount (ex PRIZES_2)
db \2 ; Deck ID (ex SAMS_PRACTICE_DECK_ID)
db \3 ; Duel Music (ex MUSIC_DUEL_THEME_1)
ENDM
; Prints the text based on the current challenge cup number
print_text_for_challenge_cup: MACRO
run_command ScriptCommand_PrintTextForChallengeCup
tx \1 ; Text Pointer for Challenge Cup #1
tx \2 ; Text Pointer for Challenge Cup #2
tx \3 ; Text Pointer for Challenge Cup #3
ENDM
; Moves the NPC in wTempNPC using an NPCMovement
move_wram_npc: MACRO
run_command ScriptCommand_MoveWramNPC
dw \1 ; NPCMovement (ex NPCMovement_d880)
ENDM
; Unloads the Challenge Hall opponent NPC
unload_challenge_hall_npc: MACRO
run_command ScriptCommand_UnloadChallengeHallNPC
ENDM
; Sets the Challenge Hall opponent NPC's coords
set_challenge_hall_npc_coords: MACRO
run_command ScriptCommand_SetChallengeHallNPCCoords
db \1 ; X Coord
db \2 ; Y Coord
ENDM
; Picks the next Challenge Hall opponent NPC
pick_challenge_hall_opponent: MACRO
run_command ScriptCommand_PickChallengeHallOpponent
ENDM
; Opens the pause menu
open_menu: MACRO
run_command ScriptCommand_OpenMenu
ENDM
; Picks the Challenge Cup prize card
pick_challenge_cup_prize_card: MACRO
run_command ScriptCommand_PickChallengeCupPrizeCard
ENDM
; Closes Advanced TextBoxes then Ends Script Loop
quit_script_fully: MACRO
run_command ScriptCommand_QuitScriptFully
ENDM
; Replaces map blocks
; used for deck machines, challenge machine, Pokemon Dome doors, Hall of Honor doors etc
replace_map_blocks: MACRO
run_command ScriptCommand_ReplaceMapBlocks
db \1 ; id
ENDM
choose_deck_to_duel_against: MACRO
run_command ScriptCommand_ChooseDeckToDuelAgainstMultichoice
ENDM
@ -335,6 +496,45 @@ move_npc: MACRO
dw \2 ; NPCMovement (NPCMovement_e2ab)
ENDM
; Picks the next legendary card
pick_legendary_card: MACRO
run_command ScriptCommand_PickLegendaryCard
ENDM
; Flashes the screen to white
; if arg is non-zero, keep the screen white
; otherwise, fade the screen back in
flash_screen: MACRO
run_command ScriptCommand_FlashScreen
db \1 ; keep screen white?
ENDM
; Saves the game
; if arg is non-zero, save the player in MASON_LABORATORY
; otherwise, save the player in their current location
save_game: MACRO
run_command ScriptCommand_SaveGame
db \1 ; send to MASON_LABORATORY?
ENDM
; Loads the Battle Center
battle_center: MACRO
run_command ScriptCommand_BattleCenter
ENDM
; Loads the Gift Center
; if arg is zero, display the options selection menu
; otherwise, execute the player's previously chosen selection
gift_center: MACRO
run_command ScriptCommand_GiftCenter
db \1 ; execute selection?
ENDM
; Plays the credits
play_credits: MACRO
run_command ScriptCommand_PlayCredits
ENDM
; Tries to give the player a specific PC Pack from Dr. Mason
try_give_pc_pack: MACRO
run_command ScriptCommand_TryGivePCPack
@ -346,6 +546,28 @@ script_nop: MACRO
run_command ScriptCommand_nop
ENDM
; Gives the player their previously chosen starter deck
give_stater_deck: MACRO
run_command ScriptCommand_GiveStarterDeck
ENDM
; Walks the player across the overworld map to MASON_LABORATORY
walk_player_to_mason_lab: MACRO
run_command ScriptCommand_WalkPlayerToMasonLaboratory
ENDM
; Plays a song and saves it to wd112
override_song: MACRO
run_command ScriptCommand_OverrideSong
db \1 ; Song ID (ex MUSIC_BOOSTER_PACK)
ENDM
; Sets the default song for the overworld
set_default_song: MACRO
run_command ScriptCommand_SetDefaultSong
db \1 ; Song ID (ex MUSIC_BOOSTER_PACK)
ENDM
; Plays a song
play_song: MACRO
run_command ScriptCommand_PlaySong
@ -368,11 +590,24 @@ resume_song: MACRO
run_command ScriptCommand_ResumeSong
ENDM
; Plays the default overworld song
play_default_song: MACRO
run_command ScriptCommand_PlayDefaultSong
ENDM
; Waits for the current song to finish
wait_for_song_to_finish: MACRO
run_command ScriptCommand_WaitForSongToFinish
ENDM
; Records when the player defeats a master (the 8 Club Masters or the Ronald Grand Master duel)
; the order of wins is stored in wd3bb
; the purpose of this is still unknown
record_master_win: MACRO
run_command ScriptCommand_RecordMasterWin
db \1 ; which master duel
ENDM
; Asks the player a question then jumps
ask_question_jump_default_yes: MACRO
run_command ScriptCommand_AskQuestionJumpDefaultYes
@ -392,6 +627,11 @@ show_sam_tutorial_multichoice: MACRO
run_command ScriptCommand_ShowSamTutorialMultichoice
ENDM
; Runs the Challenge Machine
challenge_machine: MACRO
run_command ScriptCommand_ChallengeMachine
ENDM
; Sets a flag's value
script_set_flag_value: MACRO
run_command ScriptCommand_SetFlagValue
@ -429,7 +669,7 @@ jump_if_flag_not_equal: MACRO
dw \3 ; Script Label
ENDM
; Jump to a script position if a flag is not less than a given value
; Jumps to a script position if a flag is not less than a given value
jump_if_flag_not_less_than: MACRO
run_command ScriptCommand_JumpIfFlagNotLessThan
db \1 ; flag (ex EVENT_FLAG_11)
@ -437,7 +677,7 @@ jump_if_flag_not_less_than: MACRO
dw \3 ; Script Label
ENDM
; Jump to a script position if a flag is less than a given value
; Jumps to a script position if a flag is less than a given value
jump_if_flag_less_than: MACRO
run_command ScriptCommand_JumpIfFlagLessThan
db \1 ; flag (ex EVENT_FLAG_11)

View File

@ -27,13 +27,13 @@ script_commands = {
0x00: { "name": "end_script", "params": [] },
0x01: { "name": "close_advanced_text_box", "params": [] },
0x02: { "name": "print_npc_text", "params": [ "text" ] },
0x03: { "name": "Func_ccdc", "params": [ "text" ] }, # print text without npc name
0x03: { "name": "print_text", "params": [ "text" ] },
0x04: { "name": "ask_question_jump", "params": [ "text", "label" ] },
0x05: { "name": "start_duel", "params": [ "prizes", "deck", "song" ] },
0x06: { "name": "print_variable_npc_text", "params": [ "text", "text" ] },
0x07: { "name": "Func_cda8", "params": [ "text", "text" ] }, # print variable text without npc name
0x07: { "name": "print_variable_text", "params": [ "text", "text" ] },
0x08: { "name": "print_text_quit_fully", "params": [ "text" ] },
0x09: { "name": "Func_cdcb", "params": [] }, # unload active npc
0x09: { "name": "unload_active_npc", "params": [] },
0x0a: { "name": "move_active_npc_by_direction", "params": [ "movement_table" ] },
0x0b: { "name": "close_text_box", "params": [] },
0x0c: { "name": "give_booster_packs", "params": [ "booster", "booster", "booster" ] },
@ -41,16 +41,16 @@ script_commands = {
0x0e: { "name": "jump_if_card_in_collection", "params": [ "card", "label" ] },
0x0f: { "name": "give_card", "params": [ "card" ] },
0x10: { "name": "take_card", "params": [ "card" ] },
0x11: { "name": "Func_cf53", "params": [ "label" ] }, # jump if any energy cards in collection
0x12: { "name": "Func_cf7b", "params": [] }, # remove all energy cards from collection
0x11: { "name": "jump_if_any_energy_cards_in_collection", "params": [ "label" ] },
0x12: { "name": "remove_all_energy_cards_from_collection", "params": [] },
0x13: { "name": "jump_if_enough_cards_owned", "params": [ "word_decimal", "label" ] },
0x14: { "name": "fight_club_pupil_jump", "params": [ "label", "label", "label", "label", "label" ] },
0x15: { "name": "Func_cfc6", "params": [ "direction" ] }, # set active npc direction
0x16: { "name": "Func_cfd4", "params": [] }, # pick next man1 requested card (EVENT_FLAG_2B)
0x17: { "name": "Func_d00b", "params": [] }, # get man1 requested card name text (EVENT_FLAG_2B)
0x18: { "name": "Func_d025", "params": [ "label" ] }, # jump if man1 requested card owned (EVENT_FLAG_2B)
0x19: { "name": "Func_d032", "params": [ "label" ] }, # jump if man1 requested card in collection (EVENT_FLAG_2B)
0x1a: { "name": "Func_d03f", "params": [] }, # remove man1 requested card from collection (EVENT_FLAG_2B)
0x15: { "name": "set_active_npc_direction", "params": [ "direction" ] },
0x16: { "name": "pick_next_man1_requested_card", "params": [] },
0x17: { "name": "get_man1_requested_card_name_text", "params": [] },
0x18: { "name": "jump_if_man1_requested_card_owned", "params": [ "label" ] },
0x19: { "name": "jump_if_man1_requested_card_in_collection", "params": [ "label" ] },
0x1a: { "name": "remove_man1_requested_card_from_collection", "params": [] },
0x1b: { "name": "script_jump", "params": [ "label" ] },
0x1c: { "name": "try_give_medal_pc_packs", "params": [] },
0x1d: { "name": "set_player_direction", "params": [ "direction" ] },
@ -58,55 +58,55 @@ script_commands = {
0x1f: { "name": "show_card_received_screen", "params": [ "card" ] },
0x20: { "name": "set_dialog_npc", "params": [ "npc" ] },
0x21: { "name": "set_next_npc_and_script", "params": [ "npc", "label" ] },
0x22: { "name": "Func_d095", "params": [ "byte", "byte", "byte" ] }, # set sprite attributes LOADED_NPC_FIELD_05 and LOADED_NPC_FIELD_06
0x23: { "name": "Func_d0be", "params": [ "byte_decimal", "byte_decimal" ] }, # coords, set active npc coords
0x22: { "name": "set_sprite_attributes", "params": [ "byte", "byte", "byte" ] },
0x23: { "name": "set_active_npc_coords", "params": [ "byte_decimal", "byte_decimal" ] },
0x24: { "name": "do_frames", "params": [ "byte_decimal" ] },
0x25: { "name": "Func_d0d9", "params": [ "byte_decimal", "byte_decimal", "label" ] }, # coords, jump if active npc coords match
0x25: { "name": "jump_if_active_npc_coords_match", "params": [ "byte_decimal", "byte_decimal", "label" ] },
0x26: { "name": "jump_if_player_coords_match", "params": [ "byte_decimal", "byte_decimal", "label" ] },
0x27: { "name": "move_active_npc", "params": [ "movement" ] },
0x28: { "name": "give_one_of_each_trainer_booster", "params": [] },
0x29: { "name": "Func_d103", "params": [ "npc", "label" ] }, # jump if npc loaded
0x2a: { "name": "Func_d125", "params": [ "event" ] }, # show medal received screen ?
0x2b: { "name": "Func_d135", "params": [ "byte" ] }, # load current map name into tx ram slot
0x2c: { "name": "Func_d16b", "params": [ "byte" ] }, # load active npc name into tx ram slot
0x2d: { "name": "Func_cd4f", "params": [ "prizes", "deck", "song" ] }, # start challenge hall duel
0x2e: { "name": "Func_cd94", "params": [ "text", "text", "text" ] }, # print text based on challenge cup number
0x29: { "name": "jump_if_npc_loaded", "params": [ "npc", "label" ] },
0x2a: { "name": "show_medal_received_screen", "params": [ "event" ] },
0x2b: { "name": "load_current_map_name_into_txram_slot", "params": [ "byte" ] },
0x2c: { "name": "load_active_npc_name_into_txram_slot", "params": [ "byte" ] },
0x2d: { "name": "start_challenge_hall_duel", "params": [ "prizes", "deck", "song" ] },
0x2e: { "name": "print_text_for_challenge_cup", "params": [ "text", "text", "text" ] },
0x2f: { "name": "move_wram_npc", "params": [ "movement" ] },
0x30: { "name": "Func_cdd8", "params": [] }, # unload challenge hall npc
0x31: { "name": "Func_cdf5", "params": [ "byte", "byte" ] }, # coords, set challenge hall npc coords
0x32: { "name": "Func_d195", "params": [] }, # pick challenge hall opponent
0x33: { "name": "Func_d1ad", "params": [] }, # open menu
0x34: { "name": "Func_d1b3", "params": [] }, # pick challenge cup prize card
0x30: { "name": "unload_challenge_hall_npc", "params": [] },
0x31: { "name": "set_challenge_hall_npc_coords", "params": [ "byte_decimal", "byte_decimal" ] },
0x32: { "name": "pick_challenge_hall_opponent", "params": [] },
0x33: { "name": "open_menu", "params": [] },
0x34: { "name": "pick_challenge_cup_prize_card", "params": [] },
0x35: { "name": "quit_script_fully", "params": [] },
0x36: { "name": "Func_d244", "params": [ "byte" ] }, # replace map blocks (dech machines, pokemon dome doors, hall of honor doors, challenge machine)
0x36: { "name": "replace_map_blocks", "params": [ "byte" ] },
0x37: { "name": "choose_deck_to_duel_against", "params": [] },
0x38: { "name": "open_deck_machine", "params": [ "byte" ] },
0x39: { "name": "choose_starter_deck", "params": [] },
0x3a: { "name": "enter_map", "params": [ "byte", "map", "byte_decimal", "byte_decimal", "direction" ] },
0x3b: { "name": "move_npc", "params": [ "npc", "movement" ] },
0x3c: { "name": "Func_d209", "params": [] }, # pick legendary card
0x3d: { "name": "Func_d38f", "params": [ "byte" ] }, # flash screen (bool arg, true to stay white)
0x3e: { "name": "Func_d396", "params": [ "byte" ] }, # save game (bool arg, true to go back to dr mason lab)
0x3f: { "name": "Func_cd76", "params": [] }, # battle center
0x40: { "name": "Func_d39d", "params": [ "byte" ] }, # gift center (bool arg, false for menu, true to executing selection)
0x41: { "name": "Func_d3b9", "params": [] }, # play credits
0x3c: { "name": "pick_legendary_card", "params": [] },
0x3d: { "name": "flash_screen", "params": [ "byte" ] },
0x3e: { "name": "save_game", "params": [ "byte" ] },
0x3f: { "name": "battle_center", "params": [] },
0x40: { "name": "gift_center", "params": [ "byte" ] },
0x41: { "name": "play_credits", "params": [] },
0x42: { "name": "try_give_pc_pack", "params": [ "byte" ] },
0x43: { "name": "script_nop", "params": [] },
0x44: { "name": "Func_d3d4", "params": [] }, # give starter deck
0x45: { "name": "Func_d3e0", "params": [] }, # walk player to dr mason lab
0x46: { "name": "Func_d3fe", "params": [ "song" ] }, # override song
0x47: { "name": "Func_d408", "params": [ "song" ] }, # set default song
0x44: { "name": "give_stater_deck", "params": [] },
0x45: { "name": "walk_player_to_mason_lab", "params": [] },
0x46: { "name": "override_song", "params": [ "song" ] },
0x47: { "name": "set_default_song", "params": [ "song" ] },
0x48: { "name": "play_song", "params": [ "song" ] },
0x49: { "name": "play_sfx", "params": [ "sfx" ] },
0x4a: { "name": "pause_song", "params": [] },
0x4b: { "name": "resume_song", "params": [] },
0x4c: { "name": "Func_d41d", "params": [] }, # play default song
0x4c: { "name": "play_default_song", "params": [] },
0x4d: { "name": "wait_for_song_to_finish", "params": [] },
0x4e: { "name": "Func_d435", "params": [ "byte" ] }, # record master win (8 clubs plus ronald card master)
0x4e: { "name": "record_master_win", "params": [ "byte" ] },
0x4f: { "name": "ask_question_jump_default_yes", "params": [ "text", "label" ] },
0x50: { "name": "show_sam_normal_multichoice", "params": [] },
0x51: { "name": "show_sam_tutorial_multichoice", "params": [] },
0x52: { "name": "Func_d43d", "params": [] }, # challenge machine
0x52: { "name": "challenge_machine", "params": [] },
0x53: { "name": "end_script_2", "params": [] },
0x54: { "name": "end_script_3", "params": [] },
0x55: { "name": "end_script_4", "params": [] },
@ -253,75 +253,43 @@ def dump_script(start_address, address=None, visited=set()):
command_id = rom[command_address]
command = script_commands[command_id]
address += 1
macro_mode = not command["name"].startswith("Func_")
if macro_mode:
output = "\t{}".format(command["name"])
else:
output = "\trun_command {}".format(command["name"])
output = "\t{}".format(command["name"])
# print all params for current command
for i in range(len(command["params"])):
param = rom[address]
param_type = command["params"][i]
param_length = param_lengths[param_type]
if param_type == "byte":
if not macro_mode:
output += "\n\tdb"
output += " ${:02x}".format(param)
elif param_type == "byte_decimal":
if not macro_mode:
output += "\n\tdb"
output += " {}".format(param)
elif param_type == "booster":
if not macro_mode:
output += "\n\tdb"
output += " {}".format(boosters[param])
elif param_type == "card":
if not macro_mode:
output += "\n\tdb"
output += " {}".format(cards[param])
elif param_type == "deck":
if not macro_mode:
output += "\n\tdb"
output += " {}".format(decks[param])
elif param_type == "direction":
if not macro_mode:
output += "\n\tdb"
output += " {}".format(directions[param])
elif param_type == "event":
if not macro_mode:
output += "\n\tdb"
output += " {}".format(events[param])
elif param_type == "map":
if not macro_mode:
output += "\n\tdb"
output += " {}".format(maps[param])
elif param_type == "npc":
if not macro_mode:
output += "\n\tdb"
output += " {}".format(npcs[param])
elif param_type == "prizes":
if not macro_mode:
output += "\n\tdb"
output += " PRIZES_{}".format(param)
elif param_type == "sfx":
if not macro_mode:
output += "\n\tdb"
output += " {}".format(sfxs[param])
elif param_type == "song":
if not macro_mode:
output += "\n\tdb"
output += " {}".format(songs[param])
elif param_type == "word_decimal":
if not macro_mode:
output += "\n\tdw"
output += " {}".format(param + rom[address + 1] * 0x100)
elif param_type == "movement":
param = get_pointer(address)
label = "NPCMovement_{:x}".format(param)
if param in symbols:
label = symbols[param]
if not macro_mode:
output += "\n\tdw"
output += " {}".format(label)
blobs += dump_movement(param)
elif param_type == "movement_table":
@ -329,17 +297,10 @@ def dump_script(start_address, address=None, visited=set()):
label = "NPCMovementTable_{:x}".format(param)
if param in symbols:
label = symbols[param]
if not macro_mode:
output += "\n\tdw"
output += " {}".format(label)
blobs += dump_movement_table(param)
elif param_type == "text":
text_id = param + rom[address + 1] * 0x100
if not macro_mode:
if text_id == 0x0000:
output += "\n\tdw"
else:
output += "\n\ttx"
if text_id == 0x0000:
output += " NULL"
else:
@ -358,11 +319,9 @@ def dump_script(start_address, address=None, visited=set()):
label = symbols[param]
if param > start_address or args.allow_backward_jumps:
branches.add(param)
if not macro_mode:
output += "\n\tdw"
output += " {}".format(label)
address += param_length
if macro_mode and i < len(command["params"]) - 1:
if i < len(command["params"]) - 1:
output += ","
output += "\n"
blobs.append(make_blob(command_address, output, address))