From f2e7b1507e564ba3b6b027a17aeeec2f89fba8c8 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sat, 11 Jan 2020 12:02:58 -0500 Subject: Port some macro/script fixes from pokefirered --- asm/macros/event.inc | 54 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 12 deletions(-) (limited to 'asm') diff --git a/asm/macros/event.inc b/asm/macros/event.inc index 5865856c3..b26851148 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -469,14 +469,14 @@ .endm @ Attempts to add quantity of item index to the player's Bag. If the player has enough room, the item will be added and VAR_RESULT will be set to TRUE; otherwise, VAR_RESULT is set to FALSE. - .macro giveitem index:req, quantity:req + .macro additem index:req, quantity=1 .byte 0x44 .2byte \index .2byte \quantity .endm @ Removes quantity of item index from the player's Bag. - .macro takeitem index:req, quantity:req + .macro takeitem index:req, quantity=1 .byte 0x45 .2byte \index .2byte \quantity @@ -517,7 +517,7 @@ .endm @ Adds decoration to the player's PC. In FireRed, this command is a nop. (The argument is read, but not used for anything.) - .macro givedecoration decoration:req + .macro adddecoration decoration:req .byte 0x4b .2byte \decoration .endm @@ -1564,12 +1564,12 @@ .macro goto_if_unset flag:req, dest:req checkflag \flag - goto_if 0, \dest + goto_if FALSE, \dest .endm .macro goto_if_set flag:req, dest:req checkflag \flag - goto_if 1, \dest + goto_if TRUE, \dest .endm .macro goto_if_lt dest:req @ LESS THAN @@ -1598,12 +1598,12 @@ .macro call_if_unset flag:req, dest:req checkflag \flag - call_if 0, \dest + call_if FALSE, \dest .endm .macro call_if_set flag:req, dest:req checkflag \flag - call_if 1, \dest + call_if TRUE, \dest .endm .macro call_if_lt dest:req @ LESS THAN @@ -1631,11 +1631,41 @@ .endm .macro vgoto_if_eq dest:req - vgoto_if 1, \dest + vgoto_if TRUE, \dest .endm .macro vgoto_if_ne dest:req - vgoto_if 0, \dest + vgoto_if FALSE, \dest + .endm + + .macro vgoto_if_unset flag:req, dest:req + checkflag \flag + vgoto_if FALSE, \dest + .endm + + .macro vgoto_if_set flag:req, dest:req + checkflag \flag + vgoto_if TRUE, \dest + .endm + + .macro goto_if_defeated trainer:req, dest:req + checktrainerflag \trainer + goto_if TRUE, \dest + .endm + + .macro goto_if_undefeated trainer:req, dest:req + checktrainerflag \trainer + goto_if FALSE, \dest + .endm + + .macro call_if_defeated trainer:req, dest:req + checktrainerflag \trainer + call_if TRUE, \dest + .endm + + .macro call_if_undefeated trainer:req, dest:req + checktrainerflag \trainer + call_if FALSE, \dest .endm .macro switch var:req @@ -1663,19 +1693,19 @@ callstd \type .endm - .macro giveitem_std item:req, amount=1 + .macro giveitem item:req, amount=1 setorcopyvar VAR_0x8000, \item setorcopyvar VAR_0x8001, \amount callstd STD_OBTAIN_ITEM .endm - .macro finditem_std item:req, amount=1 + .macro finditem item:req, amount=1 setorcopyvar VAR_0x8000, \item setorcopyvar VAR_0x8001, \amount callstd STD_FIND_ITEM .endm - .macro givedecoration_std decoration:req + .macro givedecoration decoration:req setorcopyvar VAR_0x8000, \decoration callstd STD_OBTAIN_DECORATION .endm -- cgit v1.2.3 From e497fc64e302f6c9257da5a9435d2905e2e780a8 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sun, 12 Jan 2020 20:20:02 -0500 Subject: if_undefeated macro to if_not_defeated --- asm/macros/event.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'asm') diff --git a/asm/macros/event.inc b/asm/macros/event.inc index b26851148..298e8eb7c 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -1653,7 +1653,7 @@ goto_if TRUE, \dest .endm - .macro goto_if_undefeated trainer:req, dest:req + .macro goto_if_not_defeated trainer:req, dest:req checktrainerflag \trainer goto_if FALSE, \dest .endm @@ -1663,7 +1663,7 @@ call_if TRUE, \dest .endm - .macro call_if_undefeated trainer:req, dest:req + .macro call_if_not_defeated trainer:req, dest:req checktrainerflag \trainer call_if FALSE, \dest .endm -- cgit v1.2.3 From c19289596da7ccd86219d3f7e246a2e48a2f9ed7 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sun, 12 Jan 2020 23:24:52 -0500 Subject: Give/Take to Add/Remove for silent script macros --- asm/macros/event.inc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'asm') diff --git a/asm/macros/event.inc b/asm/macros/event.inc index 298e8eb7c..abb2eb13a 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -476,7 +476,7 @@ .endm @ Removes quantity of item index from the player's Bag. - .macro takeitem index:req, quantity=1 + .macro removeitem index:req, quantity=1 .byte 0x45 .2byte \index .2byte \quantity @@ -503,7 +503,7 @@ .endm @ Adds a quantity amount of item index to the player's PC. Both arguments can be variables. - .macro givepcitem index:req, quantity:req + .macro addpcitem index:req, quantity:req .byte 0x49 .2byte \index .2byte \quantity @@ -523,7 +523,7 @@ .endm @ Removes a decoration from the player's PC. In FireRed, this command is a nop. (The argument is read, but not used for anything.) - .macro takedecoration decoration:req + .macro removedecoration decoration:req .byte 0x4c .2byte \decoration .endm @@ -1050,14 +1050,14 @@ .endm @ If check is 0x00, this command adds value to the player's money. - .macro givemoney value:req, check:req + .macro addmoney value:req, check:req .byte 0x90 .4byte \value .byte \check .endm @ If check is 0x00, this command subtracts value from the player's money. - .macro takemoney value:req, check:req + .macro removemoney value:req, check:req .byte 0x91 .4byte \value .byte \check @@ -1281,12 +1281,12 @@ .2byte \out .endm - .macro givecoins count:req + .macro addcoins count:req .byte 0xb4 .2byte \count .endm - .macro takecoins count:req + .macro removecoins count:req .byte 0xb5 .2byte \count .endm -- cgit v1.2.3