ref: 10173f2a6293542f8976cc5dccc9d2080a52caa7
parent: f964d04a873769c0aa1d27a7dd032170f55853fd
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Sun Feb 25 15:12:58 EST 2018
Default macro parameters use recursion; avoids repeating internal structure
--- a/macros/scripts/events.asm
+++ b/macros/scripts/events.asm
@@ -194,23 +194,23 @@
enum giveitem_command ; $1f
giveitem: MACRO
+if _NARG == 1
+ giveitem \1, 1
+else
db giveitem_command
db \1 ; item
-if _NARG == 2
db \2 ; quantity
-else
- db 1
endc
ENDM
enum takeitem_command ; $20
takeitem: MACRO
+if _NARG == 1
+ takeitem \1, 1
+else
db takeitem_command
db \1 ; item
-if _NARG == 2
db \2 ; quantity
-else
- db 1
endc
ENDM
@@ -291,23 +291,21 @@
enum givepoke_command ; $2d
givepoke: MACRO
+if _NARG == 2
+ givepoke \1, \2, NO_ITEM, FALSE
+elif _NARG == 3
+ givepoke \1, \2, \3, FALSE
+else
db givepoke_command
db \1 ; pokemon
db \2 ; level
-if _NARG >= 3
db \3 ; item
-if _NARG >= 4
db \4 ; trainer
if \4
dw \5 ; trainer_name_pointer
dw \6 ; pkmn_nickname
endc
-else
- db 0
endc
-else
- db 0, 0
-endc
ENDM
enum giveegg_command ; $2e
@@ -473,11 +471,11 @@
enum refreshscreen_command ; $48
refreshscreen: MACRO
+if _NARG == 0
+ refreshscreen 0
+else
db refreshscreen_command
-if _NARG == 1
db \1 ; dummy
-else
- db 0
endc
ENDM
@@ -982,12 +980,12 @@
enum verbosegiveitem_command ; $9e
verbosegiveitem: MACRO
+if _NARG == 1
+ verbosegiveitem \1, 1
+else
db verbosegiveitem_command
db \1 ; item
-if _NARG == 2
db \2 ; quantity
-else
- db 1
endc
ENDM
--- a/macros/scripts/maps.asm
+++ b/macros/scripts/maps.asm
@@ -92,10 +92,10 @@
itemball: MACRO
;\1: item: from constants/item_constants.asm
;\2: quantity: default 1
-if _NARG == 2
- db \1, \2
+if _NARG == 1
+ itemball \1, 1
else
- db \1, 1
+ db \1, \2
endc
ENDM
--- a/maps/Route35GoldenrodGate.asm
+++ b/maps/Route35GoldenrodGate.asm
@@ -28,7 +28,7 @@
writetext UnknownText_0x69eb8
playsound SFX_KEY_ITEM
waitsfx
- givepoke SPEAROW, 10, NO_ITEM, 1, GiftSpearowName, GiftSpearowOTName
+ givepoke SPEAROW, 10, NO_ITEM, TRUE, GiftSpearowName, GiftSpearowOTName
givepokeitem GiftSpearowMail
setevent EVENT_GOT_KENYA
.alreadyhavekenya