diff options
Diffstat (limited to 'asm/macros/event.inc')
-rw-r--r-- | asm/macros/event.inc | 134 |
1 files changed, 74 insertions, 60 deletions
diff --git a/asm/macros/event.inc b/asm/macros/event.inc index 69cdb38e5..d7b4bca37 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -226,6 +226,18 @@ .2byte \var2 .endm + @ Generic compare macro which attempts to deduce argument types based on their values + @ Any values between 0x4000 to 0x4FFF and 0x8000 to 0x8FFF are considered event variable identifiers + .macro compare arg1, arg2 + .if ((\arg1 >> 12) == 4 || (\arg1 >> 12) == 8) && ((\arg2 >> 12) == 4 || (\arg2 >> 12) == 8) + compare_var_to_var \arg1, \arg2 + .elseif ((\arg1 >> 12) == 4 || (\arg1 >> 12) == 8) && (\arg2 >= 0 && \arg2 <= 0xFFFF) + compare_var_to_value \arg1, \arg2 + .else + .error "Invalid arguments for 'compare'" + .endif + .endm + @ Calls the native C function stored at `func`. .macro callnative func .byte 0x23 @@ -518,57 +530,58 @@ .endm @ Applies the movement data at movements to the specified (index) Object. Also closes any standard message boxes that are still open. - .macro applymovement index, movements - .byte 0x4f - .2byte \index - .4byte \movements - .endm - - @ Applies the movement data at movements to the specified (index) Object on the specified (map_group, map_num) map. Really only useful if the object has followed from one map to another (e.g. Wally during the catching event). - .macro applymovementat variable, movements, map - .byte 0x50 - .2byte \variable - .4byte \movements - map \map + @ If no map is specified, then the current map is used. + .macro applymovement index, movements, map + .ifb \map + .byte 0x4f + .2byte \index + .4byte \movements + .else + @ Really only useful if the object has followed from one map to another (e.g. Wally during the catching event). + .byte 0x50 + .2byte \index + .4byte \movements + map \map + .endif .endm @ Blocks script execution until the movements being applied to the specified (index) Object finish. If the specified Object is 0x0000, then the command will block script execution until all Objects affected by applymovement finish their movements. If the specified Object is not currently being manipulated with applymovement, then this command does nothing. - .macro waitmovement index - .byte 0x51 - .2byte \index - .endm - - @ Blocks script execution until the movements being applied to the specified (index) Object on the specified (map) map finish. - .macro waitmovementat index, map - .byte 0x52 - .2byte \index - map \map - .endm - - @ Attempts to hide the specified (index) Object on the current map, by setting its visibility flag if it has a valid one. If the Object does not have a valid visibility flag, this command does nothing. - .macro removeobject index - .byte 0x53 - .2byte \index + @ If no map is specified, then the current map is used. + .macro waitmovement index, map + .ifb \map + .byte 0x51 + .2byte \index + .else + .byte 0x52 + .2byte \index + map \map + .endif .endm @ Attempts to hide the specified (index) Object on the specified (map_group, map_num) map, by setting its visibility flag if it has a valid one. If the Object does not have a valid visibility flag, this command does nothing. - .macro removeobjectat index, map - .byte 0x54 - .2byte \index - map \map - .endm - - @ Unsets the specified (index) Object's visibility flag on the current map if it has a valid one. If the Object does not have a valid visibility flag, this command does nothing. - .macro addobject index - .byte 0x55 - .2byte \index + @ If no map is specified, then the current map is used. + .macro removeobject index, map + .ifb \map + .byte 0x53 + .2byte \index + .else + .byte 0x54 + .2byte \index + map \map + .endif .endm @ Unsets the specified (index) Object's visibility flag on the specified (map_group, map_num) map if it has a valid one. If the Object does not have a valid visibility flag, this command does nothing. - .macro addobjectat index, map - .byte 0x56 - .2byte \index - map \map + @ If no map is specified, then the current map is used. + .macro addobject index, map + .ifb \map + .byte 0x55 + .2byte \index + .else + .byte 0x56 + .2byte \index + map \map + .endif .endm @ Sets the specified (index) Object's position on the current map. @@ -663,11 +676,13 @@ .byte 0x5d .endm - .macro ontrainerbattleend + @ Goes to address after the trainerbattle command (called by the battle functions, see battle_setup.c) + .macro gotopostbattlescript .byte 0x5e .endm - .macro ontrainerbattleendgoto + @ Goes to address specified in the trainerbattle command (called by the battle functions, see battle_setup.c) + .macro gotobeatenscript .byte 0x5f .endm @@ -848,11 +863,11 @@ .2byte \species .endm - .macro setmonmove byte1, byte2, word + .macro setmonmove index, slot, move .byte 0x7b - .byte \byte1 - .byte \byte2 - .2byte \word + .byte \index + .byte \slot + .2byte \move .endm @ Checks if at least one Pokemon in the player's party knows the specified (index) attack. If so, variable 0x800D (LASTRESULT) is set to the (zero-indexed) slot number of the first Pokemon that knows the move. If not, LASTRESULT is set to 0x0006. Variable 0x8004 is also set to this Pokemon's species. @@ -956,7 +971,7 @@ .endm @ This allows you to choose a Pokemon to use in a contest. In FireRed, this command sets the byte at 0x03000EA8 to 0x01. - .macro choosecontestpkmn + .macro choosecontestmon .byte 0x8b .endm @@ -1022,10 +1037,10 @@ .byte \y .endm - @ Gets the price reduction for the index (word) given. In FireRed, this command is a nop. - .macro getpricereduction word + @ Gets the price reduction for the index given. In FireRed, this command is a nop. + .macro getpricereduction index .byte 0x96 - .2byte \word + .2byte \index .endm @ Fades the screen to and from black and white. Mode 0x00 fades from black, mode 0x01 fades out to black, mode 0x2 fades in from white, and mode 0x3 fades out to white. @@ -1076,9 +1091,9 @@ .endm @ Sets which healing place the player will return to if all of the Pokemon in their party faint. - .macro setrespawn flightspot + .macro setrespawn heallocation .byte 0x9f - .2byte \flightspot + .2byte \heallocation .endm @ Checks the player's gender. If male, then 0x0000 is stored in variable 0x800D (LASTRESULT). If female, then 0x0001 is stored in LASTRESULT. @@ -1185,7 +1200,7 @@ .endm @ Sets the door tile at (x, y) to be closed without an animation. - .macro setdoorclosed2 x, y + .macro setdoorclosed x, y .byte 0xb0 .2byte \x .2byte \y @@ -1215,9 +1230,9 @@ .2byte \count .endm - .macro takecoins word + .macro takecoins count .byte 0xb5 - .2byte \word + .2byte \count .endm @ Prepares to start a wild battle against a species at Level level holding item. Running this command will not affect normal wild battles. You start the prepared battle with dowildbattle. @@ -1233,10 +1248,9 @@ .byte 0xb7 .endm - .macro setvaddress long, word + .macro setvaddress pointer .byte 0xb8 - .4byte \long - .2byte \word + .4byte \pointer .endm .macro vgoto pointer |