From bad5323642a0db0875ca6213370b1947c1fc105a Mon Sep 17 00:00:00 2001 From: Melody Date: Sun, 2 Dec 2018 07:17:54 -0500 Subject: cleans up trainer battle scripts * adds battle type macros * adds `trainerbattle_normal` macro * adds `trainerbattle_double` macro * adds rematch macros * adds no intro macro --- asm/macros/event.inc | 65 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 50 insertions(+), 15 deletions(-) (limited to 'asm/macros') diff --git a/asm/macros/event.inc b/asm/macros/event.inc index 33afdc3b3..8c6110b64 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -629,60 +629,95 @@ .endm @ If the Trainer flag for Trainer index is not set, this command does absolutely nothing. - .macro trainerbattle type:req, trainer:req, word:req, pointer1:req, pointer2, pointer3, pointer4 + .macro trainerbattle type, trainer, local_id, pointer1, pointer2, pointer3, pointer4 .byte 0x5c .byte \type .2byte \trainer - .2byte \word - .if \type == 0 + .2byte \local_id + .if \type == TRAINER_BATTLE_NORMAL .4byte \pointer1 @ text .4byte \pointer2 @ text - .elseif \type == 1 + .elseif \type == TRAINER_BATTLE_CONTINUE_SCRIPT_NO_MUSIC .4byte \pointer1 @ text .4byte \pointer2 @ text .4byte \pointer3 @ event script - .elseif \type == 2 + .elseif \type == TRAINER_BATTLE_CONTINUE_SCRIPT .4byte \pointer1 @ text .4byte \pointer2 @ text .4byte \pointer3 @ event script - .elseif \type == 3 + .elseif \type == TRAINER_BATTLE_NORMAL_NO_INTRO_TEXT .4byte \pointer1 @ text - .elseif \type == 4 + .elseif \type == TRAINER_BATTLE_DOUBLE .4byte \pointer1 @ text .4byte \pointer2 @ text .4byte \pointer3 @ text - .elseif \type == 5 + .elseif \type == TRAINER_BATTLE_REMATCH .4byte \pointer1 @ text .4byte \pointer2 @ text - .elseif \type == 6 + .elseif \type == TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE .4byte \pointer1 @ text .4byte \pointer2 @ text .4byte \pointer3 @ text .4byte \pointer4 @ event script - .elseif \type == 7 + .elseif \type == TRAINER_BATTLE_REMATCH_DOUBLE .4byte \pointer1 @ text .4byte \pointer2 @ text .4byte \pointer3 @ text - .elseif \type == 8 + .elseif \type == TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC .4byte \pointer1 @ text .4byte \pointer2 @ text .4byte \pointer3 @ text .4byte \pointer4 @ event script - .elseif \type == 9 + .elseif \type == TRAINER_BATTLE_9 .4byte \pointer1 @ text .4byte \pointer2 @ text - .elseif \type == 10 + .elseif \type == TRAINER_BATTLE_SET_TRAINER_A .4byte \pointer1 @ text .4byte \pointer2 @ text - .elseif \type == 11 + .elseif \type == TRAINER_BATTLE_SET_TRAINER_B .4byte \pointer1 @ text .4byte \pointer2 @ text - .elseif \type == 12 + .elseif \type == TRAINER_BATTLE_12 .4byte \pointer1 @ text .4byte \pointer2 @ text .endif .endm + NO_MUSIC = FALSE + + @ Starts a normal trainer battle + .macro trainerbattle_normal trainer, intro_text, lose_text, event_script=FALSE, music=TRUE + .if \event_script == FALSE + trainerbattle TRAINER_BATTLE_NORMAL, \trainer, 0, \intro_text, \lose_text + .elseif \event_script != FALSE && \music == TRUE + trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT, \trainer, 0, \intro_text, \lose_text, \event_script + .else + trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT_NO_MUSIC, \trainer, 0, \intro_text, \lose_text, \event_script + .endif + .endm + + @ Starts a double trainer battle + .macro trainerbattle_double trainer, intro_text, lose_text, not_enough_pkmn_text, event_script=FALSE, music=TRUE + .if \event_script == FALSE + trainerbattle TRAINER_BATTLE_DOUBLE, \trainer, 0, \intro_text, \lose_text, \not_enough_pkmn_text + .elseif \event_script != FALSE && \music == TRUE + trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE, \trainer, 0, \intro_text, \lose_text, \not_enough_pkmn_text, \event_script + .else + trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC, \trainer, 0, \intro_text, \lose_text, \not_enough_pkmn_text, \event_script + .endif + .endm + + .macro trainerbattle_rematch trainer, intro_text, lose_text + trainerbattle TRAINER_BATTLE_REMATCH, \trainer, 0, \intro_text, \lose_text + .endm + + .macro trainerbattle_rematch_double trainer, intro_text, lose_text, not_enough_pkmn_text + trainerbattle TRAINER_BATTLE_REMATCH_DOUBLE, \trainer, 0, \intro_text, \lose_text, \not_enough_pkmn_text + .endm + + .macro trainerbattle_no_intro trainer, lose_text + trainerbattle TRAINER_BATTLE_NORMAL_NO_INTRO_TEXT, \trainer, 0, \lose_text + .endm @ Starts a trainer battle using the battle information stored in RAM (usually by trainerbattle, which actually calls this command behind-the-scenes), and blocks script execution until the battle finishes. .macro trainerbattlebegin -- cgit v1.2.3 From 10725def8e356a6ea9346b1ea3170e1429314db3 Mon Sep 17 00:00:00 2001 From: Melody Date: Sun, 2 Dec 2018 13:54:48 -0500 Subject: =?UTF-8?q?trainerbattle=5Fnormal=20=E2=86=92=20trainerbattle=5Fsi?= =?UTF-8?q?ngle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * trainerbattle_normal → trainerbattle_single * TRAINER_BATTLE_NORMAL → TRAINER_BATTLE_SINGLE * improves the macro documentation a little --- asm/macros/event.inc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'asm/macros') diff --git a/asm/macros/event.inc b/asm/macros/event.inc index 8c6110b64..e7756c317 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -634,7 +634,7 @@ .byte \type .2byte \trainer .2byte \local_id - .if \type == TRAINER_BATTLE_NORMAL + .if \type == TRAINER_BATTLE_SINGLE .4byte \pointer1 @ text .4byte \pointer2 @ text .elseif \type == TRAINER_BATTLE_CONTINUE_SCRIPT_NO_MUSIC @@ -645,7 +645,7 @@ .4byte \pointer1 @ text .4byte \pointer2 @ text .4byte \pointer3 @ event script - .elseif \type == TRAINER_BATTLE_NORMAL_NO_INTRO_TEXT + .elseif \type == TRAINER_BATTLE_SINGLE_NO_INTRO_TEXT .4byte \pointer1 @ text .elseif \type == TRAINER_BATTLE_DOUBLE .4byte \pointer1 @ text @@ -685,10 +685,11 @@ NO_MUSIC = FALSE - @ Starts a normal trainer battle - .macro trainerbattle_normal trainer, intro_text, lose_text, event_script=FALSE, music=TRUE + @ Starts a single trainer battle, takes a trainer, intro text, loss text, and an optional event script + @ when used with an event script, you can also pass in an optional flag to disable music + .macro trainerbattle_single trainer, intro_text, lose_text, event_script=FALSE, music=TRUE .if \event_script == FALSE - trainerbattle TRAINER_BATTLE_NORMAL, \trainer, 0, \intro_text, \lose_text + trainerbattle TRAINER_BATTLE_SINGLE, \trainer, 0, \intro_text, \lose_text .elseif \event_script != FALSE && \music == TRUE trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT, \trainer, 0, \intro_text, \lose_text, \event_script .else @@ -696,7 +697,8 @@ .endif .endm - @ Starts a double trainer battle + @ Starts a double trainer battle, takes a trainer, intro text, loss text, text for when you have too few pokemon + @ and an optional event script, when used with an event script you can pass in an optional flag to disable music .macro trainerbattle_double trainer, intro_text, lose_text, not_enough_pkmn_text, event_script=FALSE, music=TRUE .if \event_script == FALSE trainerbattle TRAINER_BATTLE_DOUBLE, \trainer, 0, \intro_text, \lose_text, \not_enough_pkmn_text @@ -707,18 +709,22 @@ .endif .endm + @ Starts a rematch battle, takes a trainer, intro text and loss text .macro trainerbattle_rematch trainer, intro_text, lose_text trainerbattle TRAINER_BATTLE_REMATCH, \trainer, 0, \intro_text, \lose_text .endm + @ Starts a rematch double battle, takes a trainer, intro text, loss text, and text for when you have too few pokemon .macro trainerbattle_rematch_double trainer, intro_text, lose_text, not_enough_pkmn_text trainerbattle TRAINER_BATTLE_REMATCH_DOUBLE, \trainer, 0, \intro_text, \lose_text, \not_enough_pkmn_text .endm + @ Starts a trainer battle, skipping intro text, takes a trainer and loss text .macro trainerbattle_no_intro trainer, lose_text - trainerbattle TRAINER_BATTLE_NORMAL_NO_INTRO_TEXT, \trainer, 0, \lose_text + trainerbattle TRAINER_BATTLE_SINGLE_NO_INTRO_TEXT, \trainer, 0, \lose_text .endm + @ Starts a trainer battle using the battle information stored in RAM (usually by trainerbattle, which actually calls this command behind-the-scenes), and blocks script execution until the battle finishes. .macro trainerbattlebegin .byte 0x5d -- cgit v1.2.3 From a2a99bde115e183267db6bb4b5c1dc73d57284fc Mon Sep 17 00:00:00 2001 From: Melody Date: Sun, 2 Dec 2018 15:10:05 -0500 Subject: adds req for macro arguments --- asm/macros/event.inc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'asm/macros') diff --git a/asm/macros/event.inc b/asm/macros/event.inc index e7756c317..d66992c35 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -629,7 +629,7 @@ .endm @ If the Trainer flag for Trainer index is not set, this command does absolutely nothing. - .macro trainerbattle type, trainer, local_id, pointer1, pointer2, pointer3, pointer4 + .macro trainerbattle type:req, trainer:req, local_id:req, pointer1:req, pointer2, pointer3, pointer4 .byte 0x5c .byte \type .2byte \trainer @@ -687,10 +687,10 @@ @ Starts a single trainer battle, takes a trainer, intro text, loss text, and an optional event script @ when used with an event script, you can also pass in an optional flag to disable music - .macro trainerbattle_single trainer, intro_text, lose_text, event_script=FALSE, music=TRUE + .macro trainerbattle_single trainer:req, intro_text:req, lose_text:req, event_script=FALSE, music=TRUE .if \event_script == FALSE trainerbattle TRAINER_BATTLE_SINGLE, \trainer, 0, \intro_text, \lose_text - .elseif \event_script != FALSE && \music == TRUE + .elseif \music == TRUE trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT, \trainer, 0, \intro_text, \lose_text, \event_script .else trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT_NO_MUSIC, \trainer, 0, \intro_text, \lose_text, \event_script @@ -699,10 +699,10 @@ @ Starts a double trainer battle, takes a trainer, intro text, loss text, text for when you have too few pokemon @ and an optional event script, when used with an event script you can pass in an optional flag to disable music - .macro trainerbattle_double trainer, intro_text, lose_text, not_enough_pkmn_text, event_script=FALSE, music=TRUE + .macro trainerbattle_double trainer:req, intro_text:req, lose_text:req, not_enough_pkmn_text:req, event_script=FALSE, music=TRUE .if \event_script == FALSE trainerbattle TRAINER_BATTLE_DOUBLE, \trainer, 0, \intro_text, \lose_text, \not_enough_pkmn_text - .elseif \event_script != FALSE && \music == TRUE + .elseif \music == TRUE trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE, \trainer, 0, \intro_text, \lose_text, \not_enough_pkmn_text, \event_script .else trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC, \trainer, 0, \intro_text, \lose_text, \not_enough_pkmn_text, \event_script @@ -710,17 +710,17 @@ .endm @ Starts a rematch battle, takes a trainer, intro text and loss text - .macro trainerbattle_rematch trainer, intro_text, lose_text + .macro trainerbattle_rematch trainer:req, intro_text:req, lose_text:req trainerbattle TRAINER_BATTLE_REMATCH, \trainer, 0, \intro_text, \lose_text .endm @ Starts a rematch double battle, takes a trainer, intro text, loss text, and text for when you have too few pokemon - .macro trainerbattle_rematch_double trainer, intro_text, lose_text, not_enough_pkmn_text + .macro trainerbattle_rematch_double trainer:req, intro_text:req, lose_text:req, not_enough_pkmn_text:req trainerbattle TRAINER_BATTLE_REMATCH_DOUBLE, \trainer, 0, \intro_text, \lose_text, \not_enough_pkmn_text .endm @ Starts a trainer battle, skipping intro text, takes a trainer and loss text - .macro trainerbattle_no_intro trainer, lose_text + .macro trainerbattle_no_intro trainer:req, lose_text:req trainerbattle TRAINER_BATTLE_SINGLE_NO_INTRO_TEXT, \trainer, 0, \lose_text .endm -- cgit v1.2.3