From acb480f1c158ba9382b145c64ecd0d908c863b98 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 9 Aug 2022 12:57:49 -0400 Subject: [PATCH] Sync event.inc and scrcmd.c --- asm/macros/event.inc | 1177 ++++++++++------- data/event_scripts.s | 34 +- data/maps/BirthIsland_Exterior/scripts.inc | 6 +- .../scripts.inc | 4 +- .../scripts.inc | 10 +- data/maps/CeladonCity_GameCorner/scripts.inc | 10 +- .../scripts.inc | 20 +- data/maps/CeruleanCity_BikeShop/scripts.inc | 2 +- data/maps/CeruleanCity_House3/scripts.inc | 2 +- data/maps/CeruleanCity_House5/scripts.inc | 22 +- .../scripts.inc | 20 +- .../scripts.inc | 4 +- .../scripts.inc | 2 +- .../FiveIsland_WaterLabyrinth/scripts.inc | 4 +- data/maps/FuchsiaCity/scripts.inc | 28 +- .../scripts.inc | 6 +- data/maps/MtMoon_B2F/scripts.inc | 4 +- data/maps/PalletTown/scripts.inc | 6 +- .../PalletTown_ProfessorOaksLab/scripts.inc | 14 +- data/maps/PewterCity_Museum_1F/scripts.inc | 8 +- .../PokemonLeague_ChampionsRoom/scripts.inc | 2 +- data/maps/Route1/scripts.inc | 2 +- .../maps/Route10_PokemonCenter_1F/scripts.inc | 6 +- data/maps/Route11_EastEntrance_2F/scripts.inc | 8 +- data/maps/Route15_WestEntrance_2F/scripts.inc | 10 +- .../maps/Route16_NorthEntrance_2F/scripts.inc | 6 +- data/maps/Route18_EastEntrance_2F/scripts.inc | 2 +- data/maps/Route22_NorthEntrance/scripts.inc | 4 +- data/maps/Route23/scripts.inc | 28 +- data/maps/Route25_SeaCottage/scripts.inc | 16 +- data/maps/Route2_EastBuilding/scripts.inc | 6 +- data/maps/Route2_House/scripts.inc | 2 +- data/maps/Route4_PokemonCenter_1F/scripts.inc | 16 +- data/maps/SSAnne_2F_Room1/scripts.inc | 4 +- data/maps/SaffronCity_Dojo/scripts.inc | 14 +- data/maps/SevenIsland_House_Room1/scripts.inc | 2 +- data/maps/SilphCo_7F/scripts.inc | 4 +- .../UndergroundPath_NorthEntrance/scripts.inc | 2 +- data/maps/VermilionCity_House2/scripts.inc | 2 +- data/maps/VictoryRoad_1F/scripts.inc | 4 +- data/maps/VictoryRoad_2F/scripts.inc | 7 +- data/maps/VictoryRoad_3F/scripts.inc | 7 +- data/mystery_event_msg.s | 4 +- data/script_cmd_table.inc | 426 +++--- data/scripts/cable_club.inc | 14 +- data/scripts/day_care.inc | 8 +- data/scripts/field_moves.inc | 30 +- data/scripts/flash.inc | 2 +- data/scripts/move_tutors.inc | 2 +- data/scripts/obtain_item.inc | 34 +- data/scripts/pc_transfer.inc | 8 +- data/scripts/pokedex_rating.inc | 8 +- data/scripts/seagallop.inc | 2 +- data/scripts/static_pokemon.inc | 2 +- data/scripts/surf.inc | 4 +- data/scripts/trainer_battle.inc | 16 +- data/scripts/trainer_card.inc | 8 +- data/scripts/trainer_tower.inc | 2 +- include/constants/maps.h | 4 + include/event_object_lock.h | 8 +- include/event_object_movement.h | 10 +- include/field_weather.h | 4 +- include/fieldmap.h | 8 + include/overworld.h | 6 +- include/script.h | 2 +- include/script_menu.h | 2 +- include/text.h | 2 +- src/event_object_lock.c | 8 +- src/event_object_movement.c | 10 +- src/field_specials.c | 2 +- src/field_weather_util.c | 8 +- src/mevent_server.c | 2 +- src/overworld.c | 12 +- src/rfu_union_tool.c | 4 +- src/scrcmd.c | 307 +++-- src/script.c | 2 +- src/script_menu.c | 2 +- src/union_room.c | 2 +- 78 files changed, 1364 insertions(+), 1148 deletions(-) diff --git a/asm/macros/event.inc b/asm/macros/event.inc index ef1b077de..c79f10a6b 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -44,88 +44,102 @@ .4byte \destination .endm - @ Jumps to the standard function at index function. + @ Jumps to the script in gStdScripts at index function. .macro gotostd function:req .byte 0x08 .byte \function .endm - @ Calls the standard function at index function. + @ Callstd ids + STD_OBTAIN_ITEM = 0 + STD_FIND_ITEM = 1 + + MSGBOX_NPC = 2 + MSGBOX_SIGN = 3 + MSGBOX_DEFAULT = 4 + MSGBOX_YESNO = 5 + MSGBOX_AUTOCLOSE = 6 + + STD_OBTAIN_DECORATION = 7 + STD_PUT_ITEM_AWAY = 8 + STD_RECEIVED_ITEM = 9 + + @ Calls the script in gStdScripts at index function. .macro callstd function:req .byte 0x09 .byte \function .endm - @ If the result of the last comparison matches condition (see Comparison operators), jumps to the standard function at index function. + @ If the result of the last comparison matches condition (see Comparison operators), jumps to the script in gStdScripts at index function. .macro gotostd_if condition:req, function:req .byte 0x0a .byte \condition .byte \function .endm - @ If the result of the last comparison matches condition (see Comparison operators), calls the standard function at index function. + @ If the result of the last comparison matches condition (see Comparison operators), calls the script in gStdScripts at index function. .macro callstd_if condition:req, function:req .byte 0x0b .byte \condition .byte \function .endm - @ Executes a script stored in a default RAM location. - .macro gotoram + @ Equivalent to the 'return' command for a RAM script. + .macro returnram .byte 0x0c .endm - @ Terminates script execution and "resets the script RAM". - .macro killscript + @ Equivalent to the 'end' command for a RAM script. + .macro endram .byte 0x0d .endm - @ Sets mystery event status + @ Sets the Mystery Event script status (MEVENT_STATUS_*). .macro setmysteryeventstatus value:req .byte 0x0e .byte \value .endm - @ Sets the specified script bank to immediate value. - .macro loadword destination:req, value:req + @ Sets the value at the specified script data index to a fixed 4-byte value. + .macro loadword destIndex:req, value:req .byte 0x0f - .byte \destination + .byte \destIndex .4byte \value .endm - @ Sets the specified script bank to immediate value. - .macro loadbyte destination:req, value:req + @ Sets the value at the specified script data index to a fixed byte value. + .macro loadbyte destIndex:req, value:req .byte 0x10 - .byte \destination + .byte \destIndex .byte \value .endm - @ Sets the byte at offset to value. - .macro writebytetoaddr value:req, offset:req + @ Sets the value at the specified pointer. + .macro setptr value:req, ptr:req .byte 0x11 .byte \value - .4byte \offset + .4byte \ptr .endm - @ Copies the byte value at source into the specified script bank. - .macro loadbytefromaddr destination:req, source:req + @ Sets the value at the specified script data index to the value at pointer 'source'. + .macro loadbytefromptr destIndex:req, source:req .byte 0x12 - .byte \destination + .byte \destIndex .4byte \source .endm - @ Not sure. Judging from XSE's description I think it takes the least-significant byte in bank source and writes it to destination. - .macro setptrbyte source:req, destination:req + @ Sets the value at pointer 'destination' to the contents of the script data at 'srcIndex'. + .macro setptrbyte srcIndex:req, destination:req .byte 0x13 - .byte \source + .byte \srcIndex .4byte \destination .endm - @ Copies the contents of bank source into bank destination. - .macro copylocal destination:req, source:req + @ Copies the contents of the script data from one index to another. + .macro copylocal destIndex:req, srcIndex:req .byte 0x14 - .byte \destination - .byte \source + .byte \destIndex + .byte \srcIndex .endm @ Copies the byte at source to destination, replacing whatever byte was previously there. @@ -170,56 +184,64 @@ .2byte \source .endm - @ Compares the values of script banks a and b, after forcing the values to bytes. - .macro compare_local_to_local byte1:req, byte2:req + @ Compares the values of the script data at indexes 'local1' and 'local2'. + @ The result is stored in comparisonResult to be acted on by goto_if / call_if + .macro compare_local_to_local local1:req, local2:req .byte 0x1b - .byte \byte1 - .byte \byte2 + .byte \local1 + .byte \local2 .endm - @ Compares the least-significant byte of the value of script bank a to a fixed byte value (b). - .macro compare_local_to_value a:req, b:req + @ Compares the value of the script data at index 'local' to a fixed value. + @ The result is stored in comparisonResult to be acted on by goto_if / call_if + .macro compare_local_to_value local:req, value:req .byte 0x1c - .byte \a - .byte \b + .byte \local + .byte \value .endm - @ Compares the least-significant byte of the value of script bank a to the byte located at offset b. - .macro compare_local_to_addr a:req, b:req + @ Compares the value of the script data at index 'local' to the value at 'ptr' + @ The result is stored in comparisonResult to be acted on by goto_if / call_if + .macro compare_local_to_ptr local:req, ptr:req .byte 0x1d - .byte \a - .4byte \b + .byte \local + .4byte \ptr .endm - @ Compares the byte located at offset a to the least-significant byte of the value of script bank b. - .macro compare_addr_to_local a:req, b:req + @ Compares the value at 'ptr' to the value of the script data at index 'local'. + @ The result is stored in comparisonResult to be acted on by goto_if / call_if + .macro compare_ptr_to_local ptr:req, local:req .byte 0x1e - .4byte \a - .byte \b + .4byte \ptr + .byte \local .endm - @ Compares the byte located at offset a to a fixed byte value (b). - .macro compare_addr_to_value a:req, b:req + @ Compares the value at 'ptr' to a fixed value. + @ The result is stored in comparisonResult to be acted on by goto_if / call_if + .macro compare_ptr_to_value ptr:req, value:req .byte 0x1f - .4byte \a - .byte \b + .4byte \ptr + .byte \value .endm - @ Compares the byte located at offset a to the byte located at offset b. - .macro compare_addr_to_addr a:req, b:req + @ Compares the value at 'ptr1' to the value at 'ptr2'. + @ The result is stored in comparisonResult to be acted on by goto_if / call_if + .macro compare_ptr_to_ptr ptr1:req, ptr2:req .byte 0x20 - .4byte \a - .4byte \b + .4byte \ptr1 + .4byte \ptr2 .endm - @ Compares the value of `var` to a fixed word value (b). + @ Compares the value of 'var' to a fixed value. + @ The result is stored in comparisonResult to be acted on by goto_if / call_if .macro compare_var_to_value var:req, value:req .byte 0x21 .2byte \var .2byte \value .endm - @ Compares the value of `var` to the value of `var2`. + @ Compares the value of 'var1' to the value of 'var2'. + @ The result is stored in comparisonResult to be acted on by goto_if / call_if .macro compare_var_to_var var1:req, var2:req .byte 0x22 .2byte \var1 @@ -227,7 +249,7 @@ .endm @ Generic compare macro which attempts to deduce argument types based on their values - @ Any values between 0x4000 to 0x40FF and 0x8000 to 0x8014 are considered event variable identifiers + @ Any values between VARS_START to VARS_END and SPECIAL_VARS_START to SPECIAL_VARS_END are considered event variable identifiers .macro compare var:req, arg:req .if ((\arg >= VARS_START && \arg <= VARS_END) || (\arg >= SPECIAL_VARS_START && \arg <= SPECIAL_VARS_END)) compare_var_to_var \var, \arg @@ -236,90 +258,95 @@ .endif .endm - @ Calls the native C function stored at `func`. + @ Calls the native C function stored at func. .macro callnative func:req .byte 0x23 .4byte \func .endm - @ Replaces the script with the function stored at `func`. Execution returns to the bytecode script when func returns TRUE. + @ Replaces the script with the function stored at func. Execution returns to the bytecode script when func returns TRUE. .macro gotonative func:req .byte 0x24 .4byte \func .endm - @ Calls a special function; that is, a piece of ASM code designed for use by scripts and listed in a table of pointers. + @ Calls a function listed in the table in data/specials.inc. .macro special function:req .byte 0x25 .2byte SPECIAL_\function .endm - @ Calls a special function. That function's output (if any) will be written to the variable you specify. + @ Calls a function listed in the table in data/specials.inc. + @ That function's output (if any) will be written to the variable specified by 'output'. .macro specialvar output:req, function:req .byte 0x26 .2byte \output .2byte SPECIAL_\function .endm - @ Blocks script execution until a command or ASM code manually unblocks it. Generally used with specific commands and specials. If this command runs, and a subsequent command or piece of ASM does not unblock state, the script will remain blocked indefinitely (essentially a hang). + @ Blocks script execution until a command or C code manually unblocks it. Generally used with specific + @ commands and specials. Calling EnableBothScriptContexts for instance will allow execution to continue. .macro waitstate .byte 0x27 .endm - @ Blocks script execution for time (frames? milliseconds?). - .macro delay time:req + @ Blocks script execution for frames. (Pokemon Emerald runs at just shy of 60 frames per second.) + .macro delay frames:req .byte 0x28 - .2byte \time + .2byte \frames .endm - @ Sets a to 1. - .macro setflag a:req + @ Sets flag to TRUE. + .macro setflag flag:req .byte 0x29 - .2byte \a + .2byte \flag .endm - @ Sets a to 0. - .macro clearflag a:req + @ Sets flag to FALSE. + .macro clearflag flag:req .byte 0x2a - .2byte \a + .2byte \flag .endm - @ Compares a to 1. - .macro checkflag a:req + @ Compares flag to TRUE and stores the result in comparisonResult to be used by goto_if, etc + @ See additional _if_unset and _if_set macros + .macro checkflag flag:req .byte 0x2b - .2byte \a + .2byte \flag .endm - @ In FireRed, this command is a nop. - .macro initclock hour:req minute:req + @ In FRLG, this command is a nop. In RSE, initializes the RTC's local time offset to the given hour and minute. + .macro initclock hour:req, minute:req .byte 0x2c + .2byte \hour + .2byte \minute .endm - @ In FireRed, this command is a nop. - .macro dodailyevents + @ In FRLG, this command is a nop. In RSE, updates local time using the RTC and runs time based events. + .macro dotimebasedevents .byte 0x2d .endm - @ Resets the values of variables VAR_0x8000, VAR_0x8001, and VAR_0x8002. + @ Sets the values of variables VAR_0x8000, VAR_0x8001, and VAR_0x8002 to 0. In RSE, they'd get the current hour, minute, and second respectively. .macro gettime .byte 0x2e .endm - @ Plays the specified (sound_number) sound. Only one sound may play at a time, with newer ones interrupting older ones. - .macro playse sound_number:req + @ Plays the specified sound. Only one sound may play at a time, with newer ones interrupting older ones. + .macro playse song:req .byte 0x2f - .2byte \sound_number + .2byte \song .endm - @ Blocks script execution until the currently-playing sound (triggered by sound) finishes playing. + @ Blocks script execution until the currently-playing sound (triggered by playse) finishes playing. .macro waitse .byte 0x30 .endm - @ Plays the specified (fanfare_number) fanfare. - .macro playfanfare fanfare_number:req + @ Plays the fanfare specified by the song number. If the specified song is not a fanfare it will instead play the first song in sFanfares. + .macro playfanfare song:req .byte 0x31 - .2byte \fanfare_number + .2byte \song .endm @ Blocks script execution until all currently-playing fanfares finish. @@ -327,17 +354,19 @@ .byte 0x32 .endm - @ Plays the specified (song_number) song. The byte is apparently supposed to be 0x00. - .macro playbgm song_number:req, unknown:req + @ Plays the specified song. If save_song is TRUE, the + @ specified song will be saved as if savebgm was called with it. + .macro playbgm song:req, save_song:req .byte 0x33 - .2byte \song_number - .byte \unknown + .2byte \song + .byte \save_song .endm - @ Plays the specified (song_number) song. - .macro savebgm song_number:req + @ Saves the specified song to be played later. Saved music may be played when Overworld_PlaySpecialMapMusic is called. This occurs on + @ exiting most warps. + .macro savebgm song:req .byte 0x34 - .2byte \song_number + .2byte \song .endm @ Crossfades the currently-playing song into the map's default song. @@ -345,10 +374,10 @@ .byte 0x35 .endm - @ Crossfades the currently-playng song into the specified (song_number) song. - .macro fadenewbgm song_number:req + @ Crossfades the currently-playing song into the specified song. + .macro fadenewbgm song:req .byte 0x36 - .2byte \song_number + .2byte \song .endm @ Fades out the currently-playing song. @@ -357,91 +386,126 @@ .byte \speed .endm - @ Fades the currently-playing song back in. + @ Fades the previously-playing song back in. .macro fadeinbgm speed:req .byte 0x38 .byte \speed .endm - @ Sends the player to Warp warp on Map bank.map. If the specified warp is 0xFF, then the player will instead be sent to (x, y) on the map. - .macro warp map:req, warp:req, x:req, y:req + @ Helper macro for warp commands that formats their arguments. + @ It allows warp macros to either provide 1. a valid id for which warp location to use, + @ or 2. a pair of x/y coordinates to use. Both may be provided but at least one will be + @ ignored by SetPlayerCoordsFromWarp. If none are provided it will use dummy arguments, + @ and the warp will send the player to the center of the map. + @ Examples of valid inputs for a warp command: + @ - warp MAP, x, y + @ - warp MAP, warpId + @ - warp MAP + @ - warp MAP, warpId, x, y + .macro formatwarp map:req, a, b, c + map \map + .ifb \a @ No arguments provided, use dummy warpId and coords. + .byte WARP_ID_NONE + .2byte -1 @ x + .2byte -1 @ y + .else + .ifb \b @ Only one argument provided, treat it as a warpId and use dummy coords. + .byte \a @ warpId + .2byte -1 @ x + .2byte -1 @ y + .else + .ifb \c @ Only two arguments provided, treat them as a coord pair and use dummy warpId. + .byte WARP_ID_NONE + .2byte \a @ x + .2byte \b @ y + .else @ All three arguments provided. Output them and let the warp sort out which to use. + .byte \a @ warpId + .2byte \b @ x + .2byte \c @ y + .endif + .endif + .endif + .endm + + @ Warps the player to the specified map. + @ Warp commands can be given either the id of which warp location to go to on the destination map + @ or a pair of x/y coordinates to go to directly on the destination map. + .macro warp map:req, a, b, c .byte 0x39 - map \map - .byte \warp - .2byte \x - .2byte \y + formatwarp \map, \a, \b, \c .endm - @ Clone of warp that does not play a sound effect. - .macro warpsilent map:req, warp:req, x:req, y:req + @ Warps the player to the specified map without playing a sound effect. + @ Warp commands can be given either the id of which warp location to go to on the destination map + @ or a pair of x/y coordinates to go to directly on the destination map. + .macro warpsilent map:req, a, b, c .byte 0x3a - map \map - .byte \warp - .2byte \x - .2byte \y + formatwarp \map, \a, \b, \c .endm - @ Clone of warp that uses "a walking effect". - .macro warpdoor map:req, warp:req, x:req, y:req + @ Warps the player to the specified map and plays a door opening animation before stepping upwards into it. + @ Warp commands can be given either the id of which warp location to go to on the destination map + @ or a pair of x/y coordinates to go to directly on the destination map. + .macro warpdoor map:req, a, b, c .byte 0x3b - map \map - .byte \warp - .2byte \x - .2byte \y + formatwarp \map, \a, \b, \c .endm - @ Warps the player to another map using a hole animation. + @ Warps the player to another map using a hole animation. If the specified map is MAP_UNDEFINED it will instead + @ use the map set by setholewarp. In either case the target coordinates on the destination map will be the + @ player's current position. .macro warphole map:req .byte 0x3c map \map .endm - @ Clone of warp that uses a teleport effect. It is apparently only used in R/S/E.[source] - .macro warpteleport map:req, warp:req, x:req, y:req + @ Warps the player to the specified map using a teleport effect. Effect is similar to warpspinenter but + @ this warp has a fade out first and doesn't maintain the original facing direction. + @ Warp commands can be given either the id of which warp location to go to on the destination map + @ or a pair of x/y coordinates to go to directly on the destination map. + .macro warpteleport map:req, a, b, c .byte 0x3d - map \map - .byte \warp - .2byte \x - .2byte \y + formatwarp \map, \a, \b, \c .endm - @ Clone of warp. Used by an (unused?) Safari Zone script to return the player to the gatehouse and end the Safari Game. - .macro setwarp map:req, warp:req, x:req, y:req + @ Sets the warp destination to be used later. + @ Warp commands can be given either the id of which warp location to go to on the destination map + @ or a pair of x/y coordinates to go to directly on the destination map. + .macro setwarp map:req, a, b, c .byte 0x3e - map \map - .byte \warp - .2byte \x - .2byte \y + formatwarp \map, \a, \b, \c .endm - @ Sets a default warp place. If a warp tries to send the player to Warp 127 on Map 127.127, they will instead be sent here. Useful when a map has warps that need to go to script-controlled locations (i.e. elevators). - .macro setdynamicwarp map:req, warp:req, x:req, y:req + @ Sets the dynamic warp destination. Warps with a destination map of MAP_NONE will target this destination. + @ Warp commands can be given either the id of which warp location to go to on the destination map + @ or a pair of x/y coordinates to go to directly on the destination map. + .macro setdynamicwarp map:req, a, b, c .byte 0x3f - map \map - .byte \warp - .2byte \x - .2byte \y + formatwarp \map, \a, \b, \c .endm - @ Clone of warp3, except that this writes data to different offsets... - .macro setdivewarp map:req, warp:req, x:req, y:req + @ Sets the destination that diving or emerging from a dive will take the player to. Note that this only + @ applies if the current map does not have a dive/emerge connection. If it does have a corresponding + @ map connection then that map and the player's current coordinates will be used as the destination instead. + @ Warp commands can be given either the id of which warp location to go to on the destination map + @ or a pair of x/y coordinates to go to directly on the destination map. + .macro setdivewarp map:req, a, b, c .byte 0x40 - map \map - .byte \warp - .2byte \x - .2byte \x + formatwarp \map, \a, \b, \c .endm - @ Clone of warp3, except that this writes data to different offsets... - .macro setholewarp map:req, warp:req, x:req, y:req + @ Sets the destination that falling into a hole will take the player to. + @ While it does accept and set the x/y coordinates and warpId, they are ultimately ignored. + @ This is only used to set the map the player should fall to. The exact location on the + @ map to fall to is determined by warphole. + @ Warp commands can be given either the id of which warp location to go to on the destination map + @ or a pair of x/y coordinates to go to directly on the destination map. + .macro setholewarp map:req, a=0, b=0, c .byte 0x41 - map \map - .byte \warp - .2byte \x - .2byte \y + formatwarp \map, \a, \b, \c .endm - @ Retrieves the player's zero-indexed X- and Y-coordinates in the map, and stores them in the specified variables. + @ Retrieves the player's zero-indexed x- and y-coordinates in the map, and stores them in the specified variables. .macro getplayerxy x:req, y:req .byte 0x42 .2byte \x @@ -453,171 +517,181 @@ .byte 0x43 .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 additem index:req, quantity=1 + @ Attempts to add quantity of the specified item 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 additem itemId:req, quantity=1 .byte 0x44 - .2byte \index + .2byte \itemId .2byte \quantity .endm - @ Removes quantity of item index from the player's Bag. - .macro removeitem index:req, quantity=1 + @ Removes quantity of the specified item from the player's Bag. If the player has fewer than 'quantity' in their bag + @ then none will be removed and VAR_RESULT will be set to FALSE. Otherwise it will be set to TRUE. + .macro removeitem itemId:req, quantity=1 .byte 0x45 - .2byte \index + .2byte \itemId .2byte \quantity .endm - @ Checks if the player has enough space in their Bag to hold quantity more of item index. Sets VAR_RESULT to TRUE if there is room, or FALSE is there is no room. - .macro checkitemspace index:req, quantity:req + @ Checks if the player has enough space in their Bag to hold quantity more of the specified item. Sets VAR_RESULT to + @ TRUE if there is room, or FALSE is there is no room. + .macro checkitemspace itemId:req, quantity=1 .byte 0x46 - .2byte \index + .2byte \itemId .2byte \quantity .endm - @ Checks if the player has quantity or more of item index in their Bag. Sets VAR_RESULT to TRUE if the player has enough of the item, or FALSE if they have fewer than quantity of the item. - .macro checkitem index:req, quantity:req + @ Checks if the player has quantity or more of the specified item in their Bag. Sets VAR_RESULT to TRUE if the player has + @ enough of the item, or FALSE if they have fewer than quantity of the item. + .macro checkitem itemId:req, quantity=1 .byte 0x47 - .2byte \index + .2byte \itemId .2byte \quantity .endm - @ Checks which Bag pocket the specified item belongs in, and writes the pocket value (POCKET_*) to VAR_RESULT. This script is used to show the name of the proper Bag pocket when the player receives an item via callstd (simplified to giveitem in XSE). - .macro checkitemtype index:req + @ Checks which Bag pocket the specified item belongs in, and writes the pocket value (POCKET_*) to VAR_RESULT. + @ This is used to show the name of the proper Bag pocket when the player receives an item via callstd. + .macro checkitemtype itemId:req .byte 0x48 - .2byte \index + .2byte \itemId .endm - @ Adds a quantity amount of item index to the player's PC. Both arguments can be variables. - .macro addpcitem index:req, quantity:req + @ Adds quantity of the specified item to the player's PC. + .macro addpcitem itemId:req, quantity=1 .byte 0x49 - .2byte \index + .2byte \itemId .2byte \quantity .endm - @ Checks for quantity amount of item index in the player's PC. Both arguments can be variables. - .macro checkpcitem index:req, quantity:req + @ Checks for quantity of the specified item in the player's PC. + .macro checkpcitem itemId:req, quantity=1 .byte 0x4a - .2byte \index + .2byte \itemId .2byte \quantity .endm - @ In FireRed, this command is a nop. (The argument is read, but not used for anything.) - .macro adddecor decoration:req + @ In FRLG, this command is a nop. In RSE, adds a decoration to the player's PC. + .macro adddecoration decoration:req .byte 0x4b .2byte \decoration .endm - @ In FireRed, this command is a nop. (The argument is read, but not used for anything.) - .macro removedecor decoration:req + @ In FRLG, this command is a nop. In RSE, removes a decoration from the player's PC. + .macro removedecoration decoration:req .byte 0x4c .2byte \decoration .endm - @ In FireRed, this command is a nop. (The argument is read, but not used for anything.) - .macro hasdecor decoration:req + @ In FRLG, this command is a nop. In RSE, checks for decoration in the player's PC. + .macro checkdecor decoration:req .byte 0x4d .2byte \decoration .endm - @ In FireRed, this command is a nop. (The argument is read, but not used for anything.) - .macro checkdecor decoration:req + @ In FRLG, this command is a nop. In RSE, checks if the player has enough space in their PC to hold the decoration. + .macro checkdecorspace decoration:req .byte 0x4e .2byte \decoration .endm - @ Applies the movement data at movements to the specified (index) Object. Also closes any standard message boxes that are still open. - @ If no map is specified, then the current map is used. - .macro applymovement index:req, movements:req, mapGroup, mapNum - .ifb \mapGroup + @ Applies the movement data at movements to the specified (localId) object. If no map is specified, then the current map is used. + .macro applymovement localId:req, movements:req, map + .ifb \map .byte 0x4f - .2byte \index + .2byte \localId .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 + .2byte \localId .4byte \movements - .byte \mapGroup - .byte \mapNum + 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. + @ Blocks script execution until the movements being applied to the specified (localId) object finish. + @ If localId is 0, then the id of the last-moved object will be used instead. If the specified object + @ is not currently being manipulated with applymovement, then this command does nothing. @ If no map is specified, then the current map is used. - .macro waitmovement index:req, mapGroup, mapNum - .ifb \mapGroup + .macro waitmovement localId:req, map + .ifb \map .byte 0x51 - .2byte \index + .2byte \localId .else .byte 0x52 - .2byte \index - .byte \mapGroup - .byte \mapNum + .2byte \localId + map \map .endif .endm - @ Attempts to hide the specified (localId) 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. + @ Attempts to despawn the specified (localId) object on the specified map. + @ It also sets the object's visibility flag if it has one. @ If no map is specified, then the current map is used. - .macro removeobject localId:req, mapGroup, mapNum - .ifb \mapGroup + .macro removeobject localId:req, map + .ifb \map .byte 0x53 .2byte \localId .else .byte 0x54 .2byte \localId - .byte \mapGroup - .byte \mapNum + map \map .endif .endm - .macro addobject localId:req, mapGroup, mapNum - .ifb \mapGroup + @ Attempts to spawn the specified (localId) object the specified map. + @ Note that unlike removeobject this does not modify the object's flag. + @ If no map is specified, then the current map is used. + .macro addobject localId:req, map + .ifb \map .byte 0x55 .2byte \localId .else .byte 0x56 .2byte \localId - .byte \mapGroup - .byte \mapNum + map \map .endif .endm - @ Sets the specified (index) Object's position on the current map. - .macro setobjectxy index:req, x:req, y:req + @ Sets the specified (localId) object's position on the current map. + .macro setobjectxy localId:req, x:req, y:req .byte 0x57 - .2byte \index + .2byte \localId .2byte \x .2byte \y .endm - .macro showobject index:req, map:req + @ Sets the specified object's invisibility to FALSE. + .macro showobjectat localId:req, map:req .byte 0x58 - .2byte \index + .2byte \localId map \map .endm - .macro hideobject index:req, map:req + @ Sets the specified object's invisibility to TRUE. + .macro hideobjectat localId:req, map:req .byte 0x59 - .2byte \index + .2byte \localId map \map .endm - @ If the script was called by an Object, then that Object will turn to face toward the metatile that the player is standing on. + @ Turns the currently selected object (if there is one) to face the player. .macro faceplayer .byte 0x5a .endm - .macro turnobject index:req, direction:req + @ Turns the specified object in the specified direction. + .macro turnobject localId:req, direction:req .byte 0x5b - .2byte \index + .2byte \localId .byte \direction .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 + @ Configures the arguments for a trainer battle, then jumps to the appropriate script in scripts/trainer_battle.inc + .macro trainerbattle type:req, trainer:req, local_id:req, pointer1:req, pointer2, pointer3, pointer4 .byte 0x5c .byte \type .2byte \trainer - .2byte \word + .2byte \local_id .if \type == TRAINER_BATTLE_SINGLE .4byte \pointer1 @ text .4byte \pointer2 @ text @@ -660,8 +734,8 @@ NO_MUSIC = FALSE - @ 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 + @ 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: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 @@ -672,8 +746,8 @@ .endif .endm - @ 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 + @ 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: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 @@ -689,12 +763,12 @@ 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 + @ 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: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 + @ Starts a trainer battle, skipping intro text. Takes a trainer and loss text .macro trainerbattle_no_intro trainer:req, lose_text:req trainerbattle TRAINER_BATTLE_SINGLE_NO_INTRO_TEXT, \trainer, 0, \lose_text .endm @@ -704,412 +778,491 @@ trainerbattle TRAINER_BATTLE_EARLY_RIVAL, \trainer, \flags, \defeat_text, \victory_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 battlebegin + @ Starts a trainer battle using the battle information stored in RAM (usually by the scripts in trainer_battle.inc, which + @ are run by trainerbattle), and blocks script execution until the battle finishes. + .macro dotrainerbattle .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 - @ Compares Flag (trainer + 0x500) to 1. (If the flag is set, then the trainer has been defeated by the player.) + @ Checks if the trainer has been defeated by the player (by comparing the flag 'trainer + TRAINER_FLAGS_START' to TRUE). .macro checktrainerflag trainer:req .byte 0x60 .2byte \trainer .endm - @ Sets Flag (trainer + 0x500). (I didn't make a mistake. The command names actually are backwards.) + @ Sets the trainer flag (trainer + TRAINER_FLAGS_START) to TRUE (defeated). .macro settrainerflag trainer:req .byte 0x61 .2byte \trainer .endm - @ Clears Flag (trainer + 0x500). (I didn't make a mistake. The command names actually are backwards.) + @ Sets the trainer flag (trainer + TRAINER_FLAGS_START) to FALSE (not defeated). .macro cleartrainerflag trainer:req .byte 0x62 .2byte \trainer .endm - .macro setobjectxyperm index:req, x:req, y:req + @ Sets the coordinates of an object's template, so that if the sprite goes off screen + @ it'll still be there when it comes back on screen. + .macro setobjectxyperm localId:req, x:req, y:req .byte 0x63 - .2byte \index + .2byte \localId .2byte \x .2byte \y .endm - .macro moveobjectoffscreen index:req + @ Copies a live object event's xy position to its template, so that if the sprite goes off screen + @ it'll still be there when it comes back on screen. + .macro copyobjectxytoperm localId:req .byte 0x64 - .2byte \index + .2byte \localId .endm - .macro setobjectmovementtype word:req, byte:req + @ Sets the movement type (MOVEMENT_TYPE_*) for an object's template. + .macro setobjectmovementtype localId:req, movementType:req .byte 0x65 - .2byte \word - .byte \byte + .2byte \localId + .byte \movementType .endm - @ If a standard message box (or its text) is being drawn on-screen, this command blocks script execution until the box and its text have been fully drawn. + @ If a standard message box (or its text) is being drawn on-screen, this command blocks script execution until the + @ box and its text have been fully drawn. .macro waitmessage .byte 0x66 .endm - @ Starts displaying a standard message box containing the specified text. If text is a pointer, then the string at that offset will be loaded and used. If text is script bank 0, then the value of script bank 0 will be treated as a pointer to the text. (You can use loadpointer to place a string pointer in a script bank.) + @ Starts displaying a standard message box containing the specified text. If text is a pointer, then the string at + @ that offset will be loaded and used. If text is NULL, then the value of script data 0 will be treated as + @ a pointer to the text. The 'loadword 0' in msgbox sets this value, for instance. .macro message text:req .byte 0x67 .4byte \text .endm - @ Holds the current message box open until the player presses a key. The message box is then closed. + @ Closes the current message box. .macro closemessage .byte 0x68 .endm - @ Ceases movement for all Objects on-screen. + @ Freezes all objects immediately except the player. The player is frozen once their movement is finished. .macro lockall .byte 0x69 .endm - @ If the script was called by an Object, then that Object's movement will cease. + @ Freezes all objects immediately except the player and the selected object. The player and selected object are frozen once their movement is finished. .macro lock .byte 0x6a .endm - @ Resumes normal movement for all Objects on-screen, and closes any standard message boxes that are still open. + @ Resumes normal movement for all objects on-screen, and closes any standard message boxes that are still open. .macro releaseall .byte 0x6b .endm - @ If the script was called by an Object, then that Object's movement will resume. This command also closes any standard message boxes that are still open. + @ Resumes normal movement for the selected object (if there is one) and the player. Also closes any standard message boxes that are still open. .macro release .byte 0x6c .endm - @ Blocks script execution until the player presses any key. + @ Blocks script execution until the player presses the A or B button. .macro waitbuttonpress .byte 0x6d .endm - @ Displays a YES/NO multichoice box at the specified coordinates, and blocks script execution until the user makes a selection. Their selection is stored in VAR_RESULT as NO (0) or YES (1). Pressing B is equivalent to answering NO + @ Displays a YES/NO multichoice box at the specified coordinates, and blocks script execution until the user makes a selection. + @ Their selection is stored in VAR_RESULT as NO (0) or YES (1). Pressing B is equivalent to answering NO .macro yesnobox x:req, y:req .byte 0x6e .byte \x .byte \y .endm - @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined and the one to be used is specified with list. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button. - .macro multichoice x:req, y:req, list:req, b:req + @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. + @ Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with multichoiceId. + @ If ignoreBPress is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button. + .macro multichoice x:req, y:req, multichoiceId:req, ignoreBPress:req .byte 0x6f .byte \x .byte \y - .byte \list - .byte \b + .byte \multichoiceId + .byte \ignoreBPress .endm - @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined and the one to be used is specified with list. The default argument determines the initial position of the cursor when the box is first opened; it is zero-indexed, and if it is too large, it is treated as 0x00. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button. - .macro multichoicedefault x:req, y:req, list:req, default:req, b:req + @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. + @ Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with multichoiceId. + @ The default argument determines the initial position of the cursor when the box is first opened; it is zero-indexed, and if it is too large, it is treated as 0. + @ If ignoreBPress is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button. + .macro multichoicedefault x:req, y:req, multichoiceId:req, default:req, ignoreBPress:req .byte 0x70 .byte \x .byte \y - .byte \list + .byte \multichoiceId .byte \default - .byte \b + .byte \ignoreBPress .endm - @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined and the one to be used is specified with list. The per_row argument determines how many list items will be shown on a single row of the box. - .macro multichoicegrid x:req, y:req, list:req, per_row:req, b:req + @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. + @ Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with multichoiceId. + @ The per_row argument determines how many list items will be shown on a single row of the box. + @ If ignoreBPress is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button. + .macro multichoicegrid x:req, y:req, multichoiceId:req, per_row:req, ignoreBPress:req .byte 0x71 .byte \x .byte \y - .byte \list + .byte \multichoiceId .byte \per_row - .byte \b + .byte \ignoreBPress .endm + @ In FRLG, this command is a nop. .macro drawbox .byte 0x72 .endm - .macro erasebox byte1:req, byte2:req, byte3:req, byte4:req + @ In FRLG, this command is a nop. Still consumes parameters. + .macro erasebox left:req, top:req, right:req, bottom:req .byte 0x73 - .byte \byte1 - .byte \byte2 - .byte \byte3 - .byte \byte4 + .byte \left + .byte \top + .byte \right + .byte \bottom .endm - .macro drawboxtext + @ In FRLG, this command is a nop. Still consumes parameters. + .macro drawboxtext left:req, top:req, multichoiceId:req, ignoreBPress:req .byte 0x74 + .byte \left + .byte \top + .byte \multichoiceId + .byte \ignoreBPress .endm - @ Displays a box containing the front sprite for the specified (species) Pokemon species. - .macro drawmonpic species:req, x:req, y:req + @ Displays a box containing the front sprite for the specified Pokemon species and plays its cry. + .macro showmonpic species:req, x:req, y:req .byte 0x75 .2byte \species .byte \x .byte \y .endm - @ Hides all boxes displayed with drawmonpic. - .macro erasemonpic + @ Hides the box displayed by showmonpic. + .macro hidemonpic .byte 0x76 .endm - @ Draws an image of the winner of the contest. In FireRed, this command is a nop. (The argument is discarded.) - .macro drawcontestwinner a:req + @ In FRLG, this command is a nop. In RSE, draws an image of the winner of the contest. winnerId is any CONTEST_WINNER_* constant. + .macro showcontestpainting winnerId:req .byte 0x77 - .byte \a + .byte \winnerId .endm - @ Displays the string at pointer as braille text in a standard message box. The string must be formatted to use braille characters. + @ Displays the given string as braille text in a standard message box. The string should use the .braille directive + @ to convert text to braille, and be preceded by brailleformat. The brailleformat data is skipped over (in RS, these + @ bytes determined the box's size and position, but in Emerald these are calculated automatically). .macro braillemessage text:req .byte 0x78 .4byte \text .endm - @ Gives the player one of the specified (species) Pokemon at level level holding item. The trailing 0s are unused parameters - .macro givemon species:req, level:req, item:req + @ Formatting for the braille window, to be put at the start of a pointer used by braillemessage. + .macro brailleformat winLeft:req, winTop:req, winRight:req, winBottom:req, textLeft:req, textTop:req + .byte \winLeft + .byte \winTop + .byte \winRight + .byte \winBottom + .byte \textLeft + .byte \textTop + .endm + + @ Gives the player a Pokémon of the specified species and level, holding the specified item. The trailing 0s are unused parameters. + @ VAR_RESULT will be set to MON_GIVEN_TO_PARTY, MON_GIVEN_TO_PC, or MON_CANT_GIVE depending on the outcome. + .macro givemon species:req, level:req, item=ITEM_NONE .byte 0x79 .2byte \species .byte \level .2byte \item - .4byte 0x0 - .4byte 0x0 + .4byte 0 + .4byte 0 .byte 0 .endm + @ Gives the player an Egg of the specified species. + @ VAR_RESULT will be set to MON_GIVEN_TO_PARTY, MON_GIVEN_TO_PC, or MON_CANT_GIVE depending on the outcome. .macro giveegg species:req .byte 0x7a .2byte \species .endm - .macro setmonmove byte1:req, byte2:req, word:req + @ Replaces the move at 'slot' of the Pokémon in the player's party at 'partyIndex' with the specified move. + @ If a value greater than PARTY_SIZE is given for partyIndex it will use the last Pokémon in the party instead. + @ Note that this means in vanilla a value equal to PARTY_SIZE for partyIndex will go out of bounds. + .macro setmonmove partyIndex:req, slot:req, move:req .byte 0x7b - .byte \byte1 - .byte \byte2 - .2byte \word + .byte \partyIndex + .byte \slot + .2byte \move .endm - @ Checks if at least one Pokemon in the player's party knows the specified (index) attack. If so, VAR_RESULT is set to the (zero-indexed) slot number of the first Pokemon that knows the move. If not, VAR_RESULT is set to PARTY_SIZE. VAR_0x8004 is also set to this Pokemon's species. - .macro checkpartymove index:req + @ Checks if at least one Pokemon in the player's party knows the specified move. If so, VAR_RESULT is set to the + @ (zero-indexed) slot number of the first Pokemon that knows the move. If not, VAR_RESULT is set to PARTY_SIZE. + @ VAR_0x8004 is also set to this Pokemon's species. + .macro checkpartymove move:req .byte 0x7c - .2byte \index + .2byte \move .endm - @ Writes the name of the Pokemon at index species to the specified buffer. - .macro getspeciesname out:req, species:req + @ Converts STR_VAR_1, STR_VAR_2, or STR_VAR_3 to its corresponding index into sScriptStringVars (0, 1, or 2). + @ If given anything else it will output it directly. + @ Note: Because the STR_VAR_# arguments given to this macro are not part of a processed string they are not + @ replaced with their charmap values, they are just passed as the literal characters "STR_VAR_#". + .macro stringvar id:req + .if \id == STR_VAR_1 + .byte 0 + .elseif \id == STR_VAR_2 + .byte 1 + .elseif \id == STR_VAR_3 + .byte 2 + .else + .byte \id + .endif + .endm + + @ Writes the name of the given Pokemon species to the specified buffer. + .macro bufferspeciesname stringVarId:req, species:req .byte 0x7d - .byte \out + stringvar \stringVarId .2byte \species .endm - @ Writes the name of the species of the first Pokémon in the player's party to the specified buffer. - .macro getfirstpartymonname out:req + @ Writes the name of the species of the first Pokemon in the player's party to the specified buffer. + .macro bufferleadmonspeciesname stringVarId:req .byte 0x7e - .byte \out + stringvar \stringVarId .endm - @ Writes the nickname of the Pokemon in slot slot (zero-indexed) of the player's party to the specified buffer. If an empty or invalid slot is specified, ten spaces ("") are written to the buffer. - .macro getpartymonname out:req, slot:req + @ Writes the nickname of the Pokemon in 'slot' (zero-indexed) of the player's party to the specified buffer. + @ If an empty or invalid slot is specified, ten spaces ("") are written to the buffer. + .macro bufferpartymonnick stringVarId:req, slot:req .byte 0x7f - .byte \out + stringvar \stringVarId .2byte \slot .endm - @ Writes the name of the item at index item to the specified buffer. If the specified index is larger than the number of items in the game (0x176), the name of item 0 ("????????") is buffered instead. - .macro getitemname out:req, item:req + @ Writes the name of the specified item to the specified buffer. If itemId is >= ITEMS_COUNT, + @ then the name of ITEM_NONE ("????????") is buffered instead. + .macro bufferitemname stringVarId:req, item:req .byte 0x80 - .byte \out + stringvar \stringVarId .2byte \item .endm - @ Writes the name of the decoration at index decoration to the specified buffer. In FireRed, this command is a nop. - .macro getdecorname out:req, decoration:req + @ In FRLG, this command is a nop. In RSE, writes the name of the specified decoration to the specified buffer. + .macro bufferdecorationname stringVarId:req, decoration:req .byte 0x81 - .byte \out + stringvar \stringVarId .2byte \decoration .endm - @ Writes the name of the move at index move to the specified buffer. - .macro getmovename out:req, move:req + @ Writes the name of the specified move to the specified buffer. + .macro buffermovename stringVarId:req, move:req .byte 0x82 - .byte \out + stringvar \stringVarId .2byte \move .endm @ Converts the value of input to a decimal string, and writes that string to the specified buffer. - .macro getnumberstring out:req, input:req + .macro buffernumberstring stringVarId:req, input:req .byte 0x83 - .byte \out + stringvar \stringVarId .2byte \input .endm - @ Writes the standard string identified by index to the specified buffer. This command has no protections in place at all, so specifying an invalid standard string (e.x. 0x2B) can and usually will cause data corruption. - .macro getstdstring out:req, index:req + @ Writes the given standard string (STDSTRING_*) to the specified buffer. Invalid std string ids are not handled. + .macro bufferstdstring stringVarId:req, index:req .byte 0x84 - .byte \out + stringvar \stringVarId .2byte \index .endm - @ Copies the string at offset to the specified buffer. - .macro getstring out:req, offset:req + @ Copies the string at the given pointer to the specified buffer. + .macro bufferstring stringVarId:req, text:req .byte 0x85 - .byte \out - .4byte \offset + stringvar \stringVarId + .4byte \text .endm @ Opens the Pokemart system, offering the specified products for sale. + @ Products should be a list of .2byte item values preceded by an .align 2 .macro pokemart products:req .byte 0x86 .4byte \products .endm @ Opens the Pokemart system and treats the list of items as decorations. - .macro pokemartdecor products:req + @ Products should be a list of .2byte decoration values preceded by an .align 2 + .macro pokemartdecoration products:req .byte 0x87 .4byte \products .endm - @ Apparent clone of pokemart. - .macro pokemartbp products:req + @ Identical to pokemartdecoration, but with slight changes to the clerk dialogue. See uses of MART_TYPE_DECOR2. + .macro pokemartdecoration2 products:req .byte 0x88 .4byte \products .endm - @ Starts up the slot machine minigame. - .macro playslotmachine word:req + @ Starts up the slot machine minigame. id is a SLOT_MACHINE_* value that influences probabilities of certain reel outcomes. + .macro playslotmachine id:req .byte 0x89 - .2byte \word + .2byte \id .endm - @ In FireRed, this command is a nop. - .macro plantberrytree + @ In FRLG, this command is a nop. In RSE, sets a berry tree's berry and growth stage. + .macro setberrytree treeId:req, berry:req, growthStage:req .byte 0x8a + .byte \treeId + .byte \berry + .byte \growthStage .endm - @ In FireRed, this command sets the byte at 0x03000EA8 to 0x01. I do not know what that means. - .macro choosecontestpkmn + @ In FRLG, this command is a nop. In RSE, opens the party menu to select a Pokemon for a contest. + .macro choosecontestmon .byte 0x8b .endm - @ In FireRed, this command is a nop. + @ In FRLG, this command is a nop. In RSE, starts the appeals round of a contest. .macro startcontest .byte 0x8c .endm - @ In FireRed, this command is a nop. + @ In FRLG, this command is a nop. In RSE, shows the results screen of a contest. .macro showcontestresults .byte 0x8d .endm - @ In FireRed, this command is a nop. + @ In FRLG, this command is a nop. In RSE, starts communication to initialize a link contest. .macro contestlinktransfer .byte 0x8e .endm - @ Stores a random integer between 0 and limit in VAR_RESULT. + @ Stores a random integer between 0 and limit (exclusive of limit) in VAR_RESULT. .macro random limit:req .byte 0x8f .2byte \limit .endm - @ If check is 0x00, this command adds value to the player's money. - .macro addmoney value:req, check:req + @ Adds value to the player's money. If adding 'value' money would exceed MAX_MONEY, the player's money is set to MAX_MONEY. + @ If 'disable' is set to anything but 0 then this command does nothing. + .macro addmoney value:req, disable=0 .byte 0x90 .4byte \value - .byte \check + .byte \disable .endm - @ If check is 0x00, this command subtracts value from the player's money. - .macro removemoney value:req, check:req + @ Subtracts value from the player's money. If the player has less than 'value' money, their money is set to 0. + @ If 'disable' is set to anything but 0 then this command does nothing. + .macro removemoney value:req, disable=0 .byte 0x91 .4byte \value - .byte \check + .byte \disable .endm - @ If check is 0x00, this command will check if the player has money >= value; VAR_RESULT is set to TRUE if the player has enough money, or FALSE if they do not. - .macro checkmoney value:req, check:req + @ Checks if the player has money >= value. VAR_RESULT is set to TRUE if the player has enough money, or FALSE if they do not. + @ If 'disable' is set to anything but 0 then this command does nothing. + .macro checkmoney value:req, disable=0 .byte 0x92 .4byte \value - .byte \check + .byte \disable .endm - @ Spawns a secondary box showing how much money the player has. - .macro showmoneybox x:req, y:req, check:req + @ Creates a window showing how much money the player has. + @ If 'disable' is set to anything but 0 then this command does nothing. + .macro showmoneybox x:req, y:req, disable=0 .byte 0x93 .byte \x .byte \y - .byte \check + .byte \disable .endm - @ Hides the secondary box spawned by showmoney. - @ The two arguments are unused. - @ They are retained here for backwards compatibility with Ruby/Sapphire. - .macro hidemoneybox x:req, y:req + @ Destroys the window created by showmoneybox. Consumption of the x and y arguments was dummied out. + .macro hidemoneybox .byte 0x94 - .byte \x - .byte \y + .byte 0 @ \x + .byte 0 @ \y .endm - @ Updates the secondary box spawned by showmoney. Consumes but does not use arguments. - .macro updatemoneybox x:req, y:req, check:req + @ Updates the window created by showmoneybox. Consumption of the x and y arguments was dummied out. + @ If 'disable' is set to anything but 0 then this command does nothing. + .macro updatemoneybox disable=0 .byte 0x95 - .byte \x - .byte \y - .byte \check + .byte 0 @ \x + .byte 0 @ \y + .byte \disable .endm - @ In FireRed, this command is a nop. - .macro getpricereduction + @ In FRLG, this command is a nop. In RSE, gets whether the effects of the specified PokeNews program are active. + .macro getpokenewsactive newsKind:req .byte 0x96 + .2byte \newsKind .endm - @ Fades the screen to black or back, using the specified effect. Effect 0x00 fades in, and effect 0x01 fades out. I don't know if other effects exist. - .macro fadescreen effect:req + @ Fades the screen to and from black and white. Modes are FADE_(TO/FROM)_(WHITE/BLACK) + .macro fadescreen mode:req .byte 0x97 - .byte \effect + .byte \mode .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. Other modes may exist. - .macro fadescreenspeed effect:req, speed:req + @ Fades the screen to and from black and white. Modes are FADE_(TO/FROM)_(WHITE/BLACK) + .macro fadescreenspeed mode:req, speed:req .byte 0x98 - .byte \effect + .byte \mode .byte \speed .endm - .macro setflashradius word:req + @ Sets the flash level. A level of 0 is fully bright, a level of 1 is the largest flash radius, a level + @ of 7 is the smallest flash radius, a level of 8 is fully black. + .macro setflashlevel level:req .byte 0x99 - .2byte \word + .2byte \level .endm - .macro animateflash byte:req + @ Animates the flash radius from its current size to the size it would be at the specified level. + @ Note that this does not actually change the current flash level. It's typically used just before a setflashlevel. + .macro animateflash level:req .byte 0x9a - .byte \byte + .byte \level .endm - .macro messageautoscroll pointer:req + @ Automatically scrolls through the message without player input and at a fixed speed. + .macro messageautoscroll text:req .byte 0x9b - .4byte \pointer + .4byte \text .endm - @ Executes the specified field move animation. + @ Executes the specified field effect animation (FLDEFF_*). .macro dofieldeffect animation:req .byte 0x9c .2byte \animation .endm - @ Sets up the field effect argument argument with the value value. - .macro setfieldeffectarg argument:req, param:req + @ Sets the field effect argument at index 'argNum' to 'value.' + .macro setfieldeffectargument argNum:req, value:req .byte 0x9d - .byte \argument - .2byte \param + .byte \argNum + .2byte \value .endm - @ Blocks script execution until all playing field move animations complete. + @ Blocks script execution until all playing field effect animations complete. .macro waitfieldeffect animation:req .byte 0x9e .2byte \animation @@ -1121,25 +1274,26 @@ .2byte \heallocation .endm - @ Checks the player's gender. If male, then MALE (0) is stored in VAR_RESULT. If female, then FEMALE (1) is stored in VAR_RESULT. + @ Checks the player's gender. Stores the result (MALE (0) or FEMALE (1)) in VAR_RESULT. .macro checkplayergender .byte 0xa0 .endm - @ Plays the specified (species) Pokemon's cry. You can use waitcry to block script execution until the sound finishes. - .macro playmoncry species:req, effect:req + @ Plays the cry of the given species. Mode is any CRY_MODE_* constant. + @ You can use waitmoncry to block script execution until the cry finishes. + .macro playmoncry species:req, mode:req .byte 0xa1 .2byte \species - .2byte \effect + .2byte \mode .endm - @ Changes the metatile at (x, y) on the current map. - .macro setmetatile x:req, y:req, metatile_number:req, tile_attrib:req + @ Set the metatile at (x, y) on the current map to the given metatile and impassability. + .macro setmetatile x:req, y:req, metatileId:req, impassable:req .byte 0xa2 .2byte \x .2byte \y - .2byte \metatile_number - .2byte \tile_attrib + .2byte \metatileId + .2byte \impassable .endm @ Queues a weather change to the default weather for the map. @@ -1158,54 +1312,62 @@ .byte 0xa5 .endm - @ This command manages cases in which maps have tiles that change state when stepped on (specifically, cracked/breakable floors). - .macro setstepcallback subroutine:req + @ Enables the overworld task specified by stepCbId (STEP_CB_*). Only 1 can be active at a time. See src/field_tasks.c for more. + .macro setstepcallback stepCbId:req .byte 0xa6 - .byte \subroutine + .byte \stepCbId .endm + @ Sets the current map layout to the one specified by index (LAYOUT_*). + @ This should be done before the layout is loaded, typically in the ON_TRANSITION map script. .macro setmaplayoutindex index:req .byte 0xa7 .2byte \index .endm - .macro setobjectpriority index:req, map:req, priority:req + @ Sets the specified object's sprite's subpriority, and sets fixedPriority to TRUE. + @ Only used to hide the player and Briney behind the boat. + .macro setobjectsubpriority localId:req, map:req, subpriority:req .byte 0xa8 - .2byte \index + .2byte \localId map \map - .byte \priority + .byte \subpriority .endm - .macro resetobjectpriority index:req, map:req + @ Sets the specified object's fixedPriority to FALSE. Does not change the subpriority field. + .macro resetobjectsubpriority localId:req, map:req .byte 0xa9 - .2byte \index + .2byte \localId map \map .endm - .macro createvobject sprite:req, byte2:req, x:req, y:req, elevation:req, direction:req + @ Creates a sprite with object graphics. Used when creating large groups of static NPCs that exceed the object event limit. + @ The specified id can be used to refer to the sprite again later with turnvobject. + .macro createvobject graphicsId:req, id:req, x:req, y:req, elevation=3, direction=DIR_SOUTH .byte 0xaa - .byte \sprite - .byte \byte2 + .byte \graphicsId + .byte \id .2byte \x .2byte \y .byte \elevation .byte \direction .endm - .macro turnvobject index:req, direction:req + @ Turns a sprite created with createvobject. + .macro turnvobject id:req, direction:req .byte 0xab - .byte \index + .byte \id .byte \direction .endm - @ Opens the door metatile at (X, Y) with an animation. + @ Opens the door metatile at (x, y) with an animation. .macro opendoor x:req, y:req .byte 0xac .2byte \x .2byte \y .endm - @ Closes the door metatile at (X, Y) with an animation. + @ Closes the door metatile at (x, y) with an animation. .macro closedoor x:req, y:req .byte 0xad .2byte \x @@ -1217,47 +1379,58 @@ .byte 0xae .endm - @ Sets the door tile at (x, y) to be open without an animation. + @ Sets the door metatile at (x, y) to be open without an animation. .macro setdooropen x:req, y:req .byte 0xaf .2byte \x .2byte \y .endm - @ Sets the door tile at (x, y) to be closed without an animation. - .macro setdoorclosed2 x:req, y:req + @ Sets the door metatile at (x, y) to be closed without an animation. + .macro setdoorclosed x:req, y:req .byte 0xb0 .2byte \x .2byte \y .endm - @ In Emerald, this command consumes its parameters and does nothing. In FireRed, this command is a nop. - .macro addelevmenuitem + @ In FRLG, this command is a nop. It is implemented but unused in Ruby/Sapphire. + .macro addelevmenuitem a:req, b:req, c:req, d:req .byte 0xb1 + .byte \a + .2byte \b + .2byte \c + .2byte \d .endm - @ In FireRed and Emerald, this command is a nop. + @ In FRLG, this command is a nop. It is implemented but unused in Ruby/Sapphire. .macro showelevmenu .byte 0xb2 .endm + @ Gets the number of coins the player has and stores it in the variable 'out'. .macro checkcoins out:req .byte 0xb3 .2byte \out .endm + @ Gives 'count' coins to the player, up to a total of MAX_COINS. + @ If the player already has MAX_COINS then VAR_RESULT is set to TRUE, otherwise it is set to FALSE. .macro addcoins count:req .byte 0xb4 .2byte \count .endm - .macro removecoins word:req + @ Takes 'count' coins from the player. + @ If the player has fewer than 'count' coins then no coins are taken and VAR_RESULT is set to TRUE. + @ Otherwise VAR_RESULT is set to FALSE. + .macro removecoins count:req .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. - .macro setwildbattle species:req, level:req, item:req + @ Prepares to start a wild battle against a 'species' at 'level' holding 'item'. Running this command will not affect + @ normal wild battles. You start the prepared battle with dowildbattle. + .macro setwildbattle species:req, level:req, item=ITEM_NONE .byte 0xb6 .2byte \species .byte \level @@ -1269,83 +1442,90 @@ .byte 0xb7 .endm - .macro setvaddress long:req + @ Sets a relative address to be used by the other vcommands as part of a Mystery Gift script. + .macro setvaddress pointer:req .byte 0xb8 - .4byte \long + .4byte \pointer .endm - .macro vgoto pointer:req + @ Equivalent to goto using the relative address set by setvaddress. + .macro vgoto destination:req .byte 0xb9 - .4byte \pointer + .4byte \destination .endm - .macro vcall pointer:req + @ Equivalent to call using the relative address set by setvaddress. + .macro vcall destination:req .byte 0xba - .4byte \pointer + .4byte \destination .endm - .macro vgoto_if byte:req, pointer:req + @ Equivalent to goto_if using the relative address set by setvaddress. + .macro vgoto_if condition:req, destination:req .byte 0xbb - .byte \byte - .4byte \pointer + .byte \condition + .4byte \destination .endm - .macro vcall_if byte:req, pointer:req + @ Equivalent to call_if using the relative address set by setvaddress. + .macro vcall_if condition:req, destination:req .byte 0xbc - .byte \byte - .4byte \pointer + .byte \condition + .4byte \destination .endm - .macro vmessage pointer:req + @ Equivalent to message using the relative address set by setvaddress. + .macro vmessage text:req .byte 0xbd - .4byte \pointer + .4byte \text .endm - .macro vloadptr pointer:req + @ Expands the given text at the pointer (- the relative address set by setvaddress) into gStringVar4 + .macro vbuffermessage text:req .byte 0xbe - .4byte \pointer + .4byte \text .endm - .macro vbufferstring byte:req, pointer:req + @ Equivalent to bufferstring using the relative address set by setvaddress. + .macro vbufferstring stringVarIndex:req, text:req .byte 0xbf - .byte \byte - .4byte \pointer + stringvar \stringVarIndex + .4byte \text .endm - @ Spawns a secondary box showing how many Coins the player has. + @ Create a window showing how many Coins the player has. .macro showcoinsbox x:req, y:req .byte 0xc0 .byte \x .byte \y .endm - @ Hides the secondary box spawned by showcoins. It consumes its arguments but doesn't use them. + @ Destroys the window created by showcoins. It consumes its arguments but doesn't use them. .macro hidecoinsbox x:req, y:req .byte 0xc1 .byte \x .byte \y .endm - @ Updates the secondary box spawned by showcoins. It consumes its arguments but doesn't use them. + @ Updates the window created by showcoins. It consumes its arguments but doesn't use them. .macro updatecoinsbox x:req, y:req .byte 0xc2 .byte \x .byte \y .endm - @ Increases the value of the specified game stat by 1. The stat's value will not be allowed to exceed 0x00FFFFFF. + @ Increases the value of the specified game stat by 1. The maximum value of a stat is 0xFFFFFF. See include/constants/game_stat.h .macro incrementgamestat stat:req .byte 0xc3 .byte \stat .endm @ Sets the destination that using an Escape Rope or Dig will take the player to. - .macro setescapewarp map:req, warp:req, x:req, y:req + @ Warp commands can be given either the id of which warp location to go to on the destination map + @ or a pair of x/y coordinates to go to directly on the destination map. + .macro setescapewarp map:req, a, b, c .byte 0xc4 - map \map - .byte \warp - .2byte \x - .2byte \y + formatwarp \map, \a, \b, \c .endm @ Blocks script execution until cry finishes. @@ -1353,10 +1533,10 @@ .byte 0xc5 .endm - @ Writes the name of the specified (box) PC box to the specified buffer. - .macro bufferboxname out:req, box:req + @ Writes the name of the specified PC box to the specified buffer. + .macro bufferboxname stringVarId:req, box:req .byte 0xc6 - .byte \out + stringvar \stringVarId .2byte \box .endm @@ -1394,21 +1574,22 @@ .4byte \value .endm - @ Sets the Pokemon in the specified slot of the player party's eventLegal bit. + @ Sets the eventLegal bit for the Pokemon in the specified slot of the player's party. .macro setmoneventlegal slot:req .byte 0xcd .2byte \slot .endm - @ Checks if the Pokemon in the specified slot of the player's party has its eventLegal bit set. If it isn't set, + @ Checks if the eventLegal bit is set for the Pokemon in the specified slot of the player's party. If it isn't set, @ VAR_RESULT is TRUE. If the bit is set (or if the specified slot is empty or invalid), VAR_RESULT is FALSE. .macro checkmoneventlegal slot:req .byte 0xce .2byte \slot .endm - @ Depending on factors I haven't managed to understand yet, this command may cause script execution to jump to the offset specified by the pointer at 0x020375C0. - .macro execram + @ Jumps to the ram script saved from a Wonder Card. If there is no valid saved Wonder Card or if the + @ ram script is invalid then this does nothing. + .macro trywondercardscript .byte 0xcf .endm @@ -1418,13 +1599,13 @@ .2byte \worldmapflag .endm - @ Clone of warpteleport? It is apparently only used in FR/LG, and only with specials.[source] - .macro warpteleport2 map:req, warp:req, x:req, y:req + @ Warps the player to the specified map using a teleport effect. Effect is similar to warpteleport, but + @ this warp has no fade out and maintains the original facing direction. + @ Warp commands can be given either the id of which warp location to go to on the destination map + @ or a pair of x/y coordinates to go to directly on the destination map. + .macro warpspinenter map:req, a, b, c .byte 0xd1 - map \map - .byte \warp - .2byte \x - .2byte \y + formatwarp \map, \a, \b, \c .endm @ Changes the location where the player caught the Pokemon in the specified slot of their party. @@ -1439,9 +1620,12 @@ .4byte \pointer .endm - .macro bufferitemnameplural out:req, item:req, quantity:req + @ Writes the name of the specified item to the specified buffer. If 'item' is a Berry or ITEM_POKE_BALL + @ and if the quantity is 2 or more, the buffered string will be pluralized ("IES" or "S" appended). + @ If the specified item is >= ITEMS_COUNT then the name of ITEM_NONE ("????????") is buffered instead. + .macro bufferitemnameplural stringVarId:req, item:req, quantity:req .byte 0xd4 - .byte \out + stringvar \stringVarId .2byte \item .2byte \quantity .endm @@ -1459,28 +1643,48 @@ goto_if TRUE, \dest .endm - .macro goto_if_lt dest:req @ LESS THAN - goto_if 0, \dest - .endm - - .macro goto_if_eq dest:req @ EQUAL - goto_if 1, \dest + @ Allows 'compare' followed by a conditional goto/call to be combined into a single statement. + @ The following are examples of the two acceptable formats this facilitates: + @ compare VAR_RESULT, TRUE + @ goto_if_eq MyScript + @ - or - + @ goto_if_eq VAR_RESULT, TRUE, MyScript + @ + @ The first two arguments to this macro are the base command, e.g. 'goto_if 1' for goto_if_eq. + @ The remaining arguments 'a, b, c' depend on the format: + @ For a single statement, 'a' and 'b' are the values to compare and 'c' is the destination pointer. + @ For a statement preceded by a compare, 'a' is the destination pointer and 'b/c' are not provided. + .macro trycompare jump:req, condition:req, a:req, b, c + .ifnb \c + compare \a, \b + \jump \condition, \c + .else + \jump \condition, \a + .endif .endm - .macro goto_if_gt dest:req @ GREATER THAN - goto_if 2, \dest + .macro goto_if_lt a:req, b, c @ LESS THAN + trycompare goto_if, 0, \a, \b, \c .endm - .macro goto_if_le dest:req @ LESS THAN OR EQUAL - goto_if 3, \dest + .macro goto_if_eq a:req, b, c @ EQUAL + trycompare goto_if, 1, \a, \b, \c .endm - .macro goto_if_ge dest:req @ GREATER THAN OR EQUAL - goto_if 4, \dest + .macro goto_if_gt a:req, b, c @ GREATER THAN + trycompare goto_if, 2, \a, \b, \c .endm - .macro goto_if_ne dest:req @ NOT EQUAL - goto_if 5, \dest + .macro goto_if_le a:req, b, c @ LESS THAN OR EQUAL + trycompare goto_if, 3, \a, \b, \c + .endm + + .macro goto_if_ge a:req, b, c @ GREATER THAN OR EQUAL + trycompare goto_if, 4, \a, \b, \c + .endm + + .macro goto_if_ne a:req, b, c @ NOT EQUAL + trycompare goto_if, 5, \a, \b, \c .endm .macro call_if_unset flag:req, dest:req @@ -1493,36 +1697,36 @@ call_if TRUE, \dest .endm - .macro call_if_lt dest:req @ LESS THAN - call_if 0, \dest - .endm - - .macro call_if_eq dest:req @ EQUAL - call_if 1, \dest + .macro call_if_lt a:req, b, c @ LESS THAN + trycompare call_if, 0, \a, \b, \c .endm - .macro call_if_gt dest:req @ GREATER THAN - call_if 2, \dest + .macro call_if_eq a:req, b, c @ EQUAL + trycompare call_if, 1, \a, \b, \c .endm - .macro call_if_le dest:req @ LESS THAN OR EQUAL - call_if 3, \dest + .macro call_if_gt a:req, b, c @ GREATER THAN + trycompare call_if, 2, \a, \b, \c .endm - .macro call_if_ge dest:req @ GREATER THAN OR EQUAL - call_if 4, \dest + .macro call_if_le a:req, b, c @ LESS THAN OR EQUAL + trycompare call_if, 3, \a, \b, \c .endm - .macro call_if_ne dest:req @ NOT EQUAL - call_if 5, \dest + .macro call_if_ge a:req, b, c @ GREATER THAN OR EQUAL + trycompare call_if, 4, \a, \b, \c .endm - .macro vgoto_if_eq dest:req - vgoto_if TRUE, \dest + .macro call_if_ne a:req, b, c @ NOT EQUAL + trycompare call_if, 5, \a, \b, \c .endm - .macro vgoto_if_ne dest:req - vgoto_if FALSE, \dest + .macro vgoto_if_eq a:req, b, c + trycompare vgoto_if, TRUE, \a, \b, \c + .endm + + .macro vgoto_if_ne a:req, b, c + trycompare vgoto_if, FALSE, \a, \b, \c .endm .macro vgoto_if_set flag:req, dest:req @@ -1564,34 +1768,27 @@ goto_if_eq \dest .endm + YES = 1 + NO = 0 + + @ Buffers the given text and calls the relevant standard message script (see gStdScripts). .macro msgbox text:req, type=MSGBOX_DEFAULT loadword 0, \text callstd \type .endm - @ Callstd ids - STD_OBTAIN_ITEM = 0 - STD_FIND_ITEM = 1 - - MSGBOX_NPC = 2 - MSGBOX_SIGN = 3 - MSGBOX_DEFAULT = 4 - MSGBOX_YESNO = 5 - MSGBOX_AUTOCLOSE = 6 - - STD_OBTAIN_DECOR = 7 - STD_PUT_ITEM_AWAY = 8 - STD_RECEIVED_ITEM = 9 - - YES = 1 - NO = 0 - + @ Gives 'amount' of the specified 'item' to the player and prints a message with fanfare. + @ If the player doesn't have space for all the items then as many are added as possible, the + @ message indicates there is no room, and VAR_RESULT is set to FALSE. + @ Otherwise VAR_RESULT is set to TRUE, and the message indicates they have received the item(s). .macro giveitem item:req, amount=1 setorcopyvar VAR_0x8000, \item setorcopyvar VAR_0x8001, \amount callstd STD_OBTAIN_ITEM .endm + @ For picking up items in the overworld. Similar to giveitem, but with different language and + @ sets the flag of the last-talked to object (the item the player picked up). .macro finditem item:req, amount=1 setorcopyvar VAR_0x8000, \item setorcopyvar VAR_0x8001, \amount @@ -1641,3 +1838,11 @@ getbraillestringwidth \text call EventScript_BrailleCursorWaitButton .endm + + @ Creates an "event legal" Pokémon for an encounter + .macro seteventmon species:req, level:req, item=ITEM_NONE + setvar VAR_0x8004, \species + setvar VAR_0x8005, \level + setvar VAR_0x8006, \item + special CreateEventLegalEnemyMon + .endm diff --git a/data/event_scripts.s b/data/event_scripts.s index 004f61131..bfe879183 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -73,16 +73,16 @@ gSpecialVars:: .align 2 gStdScripts:: - .4byte Std_ObtainItem - .4byte Std_FindItem - .4byte Std_MsgboxNPC - .4byte Std_MsgboxSign - .4byte Std_MsgboxDefault - .4byte Std_MsgboxYesNo - .4byte Std_MsgboxAutoclose - .4byte Std_ObtainDecoration - .4byte Std_PutItemAway - .4byte Std_ReceivedItem + .4byte Std_ObtainItem @ STD_OBTAIN_ITEM + .4byte Std_FindItem @ STD_FIND_ITEM + .4byte Std_MsgboxNPC @ MSGBOX_NPC + .4byte Std_MsgboxSign @ MSGBOX_SIGN + .4byte Std_MsgboxDefault @ MSGBOX_DEFAULT + .4byte Std_MsgboxYesNo @ MSGBOX_YESNO + .4byte Std_MsgboxAutoclose @ MSGBOX_AUTOCLOSE + .4byte Std_ObtainDecoration @ STD_OBTAIN_DECORATION + .4byte Std_PutItemAway @ STD_PUT_ITEM_AWAY + .4byte Std_ReceivedItem @ STD_RECEIVED_ITEM gStdScriptsEnd:: .include "data/maps/BattleColosseum_2P/scripts.inc" @@ -1112,7 +1112,7 @@ EventScript_ChangePokemonNickname:: @ Unused EventScript_HandOverItem:: - getitemname 0, VAR_0x8004 + bufferitemname STR_VAR_1, VAR_0x8004 playfanfare MUS_OBTAIN_TMHM message Text_HandedOverItem waitmessage @@ -1264,7 +1264,7 @@ VermilionCity_PokemonCenter_1F_EventScript_ExplainVSSeeker:: .include "data/scripts/white_out.inc" Std_PutItemAway:: - bufferitemnameplural 1, VAR_0x8000, VAR_0x8001 + bufferitemnameplural STR_VAR_2, VAR_0x8000, VAR_0x8001 checkitemtype VAR_0x8000 call EventScript_BufferPutAwayPocketName msgbox Text_PutItemAway @@ -1280,23 +1280,23 @@ EventScript_BufferPutAwayPocketName:: end EventScript_BufferPutAwayPocketItems:: - getstdstring 2, STDSTRING_ITEMS_POCKET + bufferstdstring STR_VAR_3, STDSTRING_ITEMS_POCKET return EventScript_BufferPutAwayPocketKeyItems:: - getstdstring 2, STDSTRING_KEY_ITEMS_POCKET + bufferstdstring STR_VAR_3, STDSTRING_KEY_ITEMS_POCKET return EventScript_BufferPutAwayPocketPokeBalls:: - getstdstring 2, STDSTRING_POKEBALLS_POCKET + bufferstdstring STR_VAR_3, STDSTRING_POKEBALLS_POCKET return EventScript_BufferPutAwayPocketTMCase:: - getstdstring 2, STDSTRING_TM_CASE + bufferstdstring STR_VAR_3, STDSTRING_TM_CASE return EventScript_BufferPutAwayPocketBerryPouch:: - getstdstring 2, STDSTRING_BERRY_POUCH + bufferstdstring STR_VAR_3, STDSTRING_BERRY_POUCH return .include "data/scripts/seagallop.inc" diff --git a/data/maps/BirthIsland_Exterior/scripts.inc b/data/maps/BirthIsland_Exterior/scripts.inc index 9c42fd3c1..3c0bd7681 100644 --- a/data/maps/BirthIsland_Exterior/scripts.inc +++ b/data/maps/BirthIsland_Exterior/scripts.inc @@ -71,9 +71,9 @@ BirthIsland_Exterior_EventScript_NotSolved3:: BirthIsland_Exterior_EventScript_Deoxys:: addobject LOCALID_DEOXYS waitse - setfieldeffectarg 0, LOCALID_DEOXYS_ROCK - setfieldeffectarg 1, 56 - setfieldeffectarg 2, 2 + setfieldeffectargument 0, LOCALID_DEOXYS_ROCK + setfieldeffectargument 1, 56 + setfieldeffectargument 2, 2 dofieldeffect FLDEFF_DESTROY_DEOXYS_ROCK playbgm MUS_ENCOUNTER_DEOXYS, 0 waitfieldeffect FLDEFF_DESTROY_DEOXYS_ROCK diff --git a/data/maps/CeladonCity_Condominiums_RoofRoom/scripts.inc b/data/maps/CeladonCity_Condominiums_RoofRoom/scripts.inc index 079e461af..0a2208b66 100644 --- a/data/maps/CeladonCity_Condominiums_RoofRoom/scripts.inc +++ b/data/maps/CeladonCity_Condominiums_RoofRoom/scripts.inc @@ -27,7 +27,7 @@ CeladonCity_Condominiums_RoofRoom_EventScript_GetEeveeParty:: message CeladonCity_Condominiums_RoofRoom_Text_ObtainedAnEevee waitmessage waitfanfare - getspeciesname 0, SPECIES_EEVEE + bufferspeciesname STR_VAR_1, SPECIES_EEVEE msgbox Text_GiveNicknameToThisMon, MSGBOX_YESNO compare VAR_RESULT, NO goto_if_eq CeladonCity_Condominiums_RoofRoom_EventScript_SetGotEevee @@ -42,7 +42,7 @@ CeladonCity_Condominiums_RoofRoom_EventScript_GetEeveePC:: message CeladonCity_Condominiums_RoofRoom_Text_ObtainedAnEevee waitmessage waitfanfare - getspeciesname 0, SPECIES_EEVEE + bufferspeciesname STR_VAR_1, SPECIES_EEVEE msgbox Text_GiveNicknameToThisMon, MSGBOX_YESNO compare VAR_RESULT, NO goto_if_eq CeladonCity_Condominiums_RoofRoom_EventScript_TransferEeveeToPC diff --git a/data/maps/CeladonCity_DepartmentStore_Roof/scripts.inc b/data/maps/CeladonCity_DepartmentStore_Roof/scripts.inc index 14d250852..16e9df340 100644 --- a/data/maps/CeladonCity_DepartmentStore_Roof/scripts.inc +++ b/data/maps/CeladonCity_DepartmentStore_Roof/scripts.inc @@ -141,8 +141,8 @@ CeladonCity_DepartmentStore_Roof_EventScript_GiveLemonade:: end CeladonCity_DepartmentStore_Roof_EventScript_GiveDrink:: - getitemname 0, VAR_0x8008 - getitemname 1, VAR_0x8009 + bufferitemname STR_VAR_1, VAR_0x8008 + bufferitemname STR_VAR_2, VAR_0x8009 removeitem VAR_0x8008, 1 checkitemspace VAR_0x8009, 1 compare VAR_RESULT, FALSE @@ -267,8 +267,8 @@ CeladonCity_DepartmentStore_Roof_EventScript_TryBuyDrink:: call_if_eq CeladonCity_DepartmentStore_Roof_EventScript_RemoveMoneySodaPop compare VAR_TEMP_1, 2 call_if_eq CeladonCity_DepartmentStore_Roof_EventScript_RemoveMoneyLemonade - updatemoneybox 0, 0, 0 - getitemname 0, VAR_TEMP_0 + updatemoneybox + bufferitemname STR_VAR_1, VAR_TEMP_0 playse SE_VEND msgbox CeladonCity_DepartmentStore_Roof_Text_DrinkCanPoppedOut additem VAR_TEMP_0 @@ -292,6 +292,6 @@ CeladonCity_DepartmentStore_Roof_EventScript_NoRoomForDrink:: end CeladonCity_DepartmentStore_Roof_EventScript_ExitVendingMachine:: - hidemoneybox 0, 0 + hidemoneybox releaseall end diff --git a/data/maps/CeladonCity_GameCorner/scripts.inc b/data/maps/CeladonCity_GameCorner/scripts.inc index 60c541af3..8cd7ca69b 100644 --- a/data/maps/CeladonCity_GameCorner/scripts.inc +++ b/data/maps/CeladonCity_GameCorner/scripts.inc @@ -70,7 +70,7 @@ CeladonCity_GameCorner_EventScript_Buy50Coins:: end CeladonCity_GameCorner_EventScript_BoughtCoins:: - updatemoneybox 0, 0, 0 + updatemoneybox updatecoinsbox 0, 5 playse SE_SHOP msgbox CeladonCity_GameCorner_Text_HereAreYourCoins @@ -78,7 +78,7 @@ CeladonCity_GameCorner_EventScript_BoughtCoins:: end CeladonCity_GameCorner_EventScript_ClerkEnd:: - hidemoneybox 0, 0 + hidemoneybox hidecoinsbox 0, 5 release end @@ -256,9 +256,9 @@ CeladonCity_GameCorner_EventScript_SlotMachine:: msgbox CeladonCity_GameCorner_Text_SlotMachineWantToPlay, MSGBOX_YESNO compare VAR_RESULT, NO goto_if_eq CeladonCity_GameCorner_EventScript_DontPlaySlotMachine - setfieldeffectarg 0, 255 - setfieldeffectarg 1, 10 - setfieldeffectarg 2, 14 + setfieldeffectargument 0, 255 + setfieldeffectargument 1, 10 + setfieldeffectargument 2, 14 dofieldeffect FLDEFF_SMILEY_FACE_ICON waitfieldeffect FLDEFF_SMILEY_FACE_ICON specialvar VAR_RESULT, GetRandomSlotMachineId diff --git a/data/maps/CeladonCity_GameCorner_PrizeRoom/scripts.inc b/data/maps/CeladonCity_GameCorner_PrizeRoom/scripts.inc index 8070c752c..544eb4a93 100644 --- a/data/maps/CeladonCity_GameCorner_PrizeRoom/scripts.inc +++ b/data/maps/CeladonCity_GameCorner_PrizeRoom/scripts.inc @@ -104,7 +104,7 @@ CeladonCity_GameCorner_PrizeRoom_EventScript_Porygon:: end CeladonCity_GameCorner_PrizeRoom_EventScript_ConfirmPrizeMon:: - getspeciesname 0, VAR_TEMP_1 + bufferspeciesname STR_VAR_1, VAR_TEMP_1 msgbox CeladonCity_GameCorner_PrizeRoom_Text_YouWantPrize, MSGBOX_YESNO compare VAR_RESULT, NO goto_if_eq CeladonCity_GameCorner_PrizeRoom_EventScript_EndPrizeExchange @@ -213,7 +213,7 @@ CeladonCity_GameCorner_PrizeRoom_EventScript_NotEnoughCoins:: CeladonCity_GameCorner_PrizeRoom_EventScript_ReceivedMonParty:: removecoins VAR_TEMP_2 updatecoinsbox 0, 5 - getspeciesname 0, VAR_TEMP_1 + bufferspeciesname STR_VAR_1, VAR_TEMP_1 playfanfare MUS_LEVEL_UP message Text_PlayerObtainedTheMon waitmessage @@ -227,7 +227,7 @@ CeladonCity_GameCorner_PrizeRoom_EventScript_ReceivedMonParty:: CeladonCity_GameCorner_PrizeRoom_EventScript_ReceivedMonPC:: removecoins VAR_TEMP_2 updatecoinsbox 0, 5 - getspeciesname 0, VAR_TEMP_1 + bufferspeciesname STR_VAR_1, VAR_TEMP_1 playfanfare MUS_LEVEL_UP message Text_PlayerObtainedTheMon waitmessage @@ -271,35 +271,35 @@ CeladonCity_GameCorner_PrizeRoom_EventScript_ChoosePrizeTM:: CeladonCity_GameCorner_PrizeRoom_EventScript_TM13:: setvar VAR_TEMP_1, ITEM_TM13 setvar VAR_TEMP_2, 4000 - getmovename 1, MOVE_ICE_BEAM + buffermovename STR_VAR_2, MOVE_ICE_BEAM goto CeladonCity_GameCorner_PrizeRoom_EventScript_ConfirmPrizeTM end CeladonCity_GameCorner_PrizeRoom_EventScript_TM23:: setvar VAR_TEMP_1, ITEM_TM23 setvar VAR_TEMP_2, 3500 - getmovename 1, MOVE_IRON_TAIL + buffermovename STR_VAR_2, MOVE_IRON_TAIL goto CeladonCity_GameCorner_PrizeRoom_EventScript_ConfirmPrizeTM end CeladonCity_GameCorner_PrizeRoom_EventScript_TM24:: setvar VAR_TEMP_1, ITEM_TM24 setvar VAR_TEMP_2, 4000 - getmovename 1, MOVE_THUNDERBOLT + buffermovename STR_VAR_2, MOVE_THUNDERBOLT goto CeladonCity_GameCorner_PrizeRoom_EventScript_ConfirmPrizeTM end CeladonCity_GameCorner_PrizeRoom_EventScript_TM30:: setvar VAR_TEMP_1, ITEM_TM30 setvar VAR_TEMP_2, 4500 - getmovename 1, MOVE_SHADOW_BALL + buffermovename STR_VAR_2, MOVE_SHADOW_BALL goto CeladonCity_GameCorner_PrizeRoom_EventScript_ConfirmPrizeTM end CeladonCity_GameCorner_PrizeRoom_EventScript_TM35:: setvar VAR_TEMP_1, ITEM_TM35 setvar VAR_TEMP_2, 4000 - getmovename 1, MOVE_FLAMETHROWER + buffermovename STR_VAR_2, MOVE_FLAMETHROWER goto CeladonCity_GameCorner_PrizeRoom_EventScript_ConfirmPrizeTM end @@ -311,7 +311,7 @@ CeladonCity_GameCorner_PrizeRoom_EventScript_ConfirmPrizeTM:: end CeladonCity_GameCorner_PrizeRoom_EventScript_ConfirmPrizeItem:: - getitemname 0, VAR_TEMP_1 + bufferitemname STR_VAR_1, VAR_TEMP_1 msgbox CeladonCity_GameCorner_PrizeRoom_Text_YouWantPrize, MSGBOX_YESNO compare VAR_RESULT, NO goto_if_eq CeladonCity_GameCorner_PrizeRoom_EventScript_EndPrizeExchange @@ -319,7 +319,7 @@ CeladonCity_GameCorner_PrizeRoom_EventScript_ConfirmPrizeItem:: end CeladonCity_GameCorner_PrizeRoom_EventScript_TryGivePrize:: - getitemname 0, VAR_TEMP_1 + bufferitemname STR_VAR_1, VAR_TEMP_1 checkcoins VAR_RESULT compare VAR_RESULT, VAR_TEMP_2 goto_if_lt CeladonCity_GameCorner_PrizeRoom_EventScript_NotEnoughCoins diff --git a/data/maps/CeruleanCity_BikeShop/scripts.inc b/data/maps/CeruleanCity_BikeShop/scripts.inc index d20038d1f..931ee7b12 100644 --- a/data/maps/CeruleanCity_BikeShop/scripts.inc +++ b/data/maps/CeruleanCity_BikeShop/scripts.inc @@ -24,7 +24,7 @@ CeruleanCity_BikeShop_EventScript_TryPurchaseBicycle:: CeruleanCity_BikeShop_EventScript_ClerkGoodbye:: msgbox CeruleanCity_BikeShop_Text_ThankYouComeAgain - hidemoneybox 0, 0 + hidemoneybox release end diff --git a/data/maps/CeruleanCity_House3/scripts.inc b/data/maps/CeruleanCity_House3/scripts.inc index d0e4fda5e..23268dbfe 100644 --- a/data/maps/CeruleanCity_House3/scripts.inc +++ b/data/maps/CeruleanCity_House3/scripts.inc @@ -32,7 +32,7 @@ CeruleanCity_House3_EventScript_DeclineTrade:: end CeruleanCity_House3_EventScript_NotRequestedMon:: - getspeciesname 0, VAR_0x8009 + bufferspeciesname STR_VAR_1, VAR_0x8009 msgbox Trade_Text_ThisIsntMon release end diff --git a/data/maps/CeruleanCity_House5/scripts.inc b/data/maps/CeruleanCity_House5/scripts.inc index bebc51077..5eaac5b59 100644 --- a/data/maps/CeruleanCity_House5/scripts.inc +++ b/data/maps/CeruleanCity_House5/scripts.inc @@ -57,77 +57,77 @@ CeruleanCity_House5_EventScript_ChooseExchangeItem:: end CeruleanCity_House5_EventScript_EnergyPowder:: - getitemname 0, ITEM_ENERGY_POWDER + bufferitemname STR_VAR_1, ITEM_ENERGY_POWDER setvar VAR_0x8008, ITEM_ENERGY_POWDER setvar VAR_0x8009, 50 goto CeruleanCity_House5_EventScript_ExchangePowderForItem end CeruleanCity_House5_EventScript_EnergyRoot:: - getitemname 0, ITEM_ENERGY_ROOT + bufferitemname STR_VAR_1, ITEM_ENERGY_ROOT setvar VAR_0x8008, ITEM_ENERGY_ROOT setvar VAR_0x8009, 80 goto CeruleanCity_House5_EventScript_ExchangePowderForItem end CeruleanCity_House5_EventScript_HealPowder:: - getitemname 0, ITEM_HEAL_POWDER + bufferitemname STR_VAR_1, ITEM_HEAL_POWDER setvar VAR_0x8008, ITEM_HEAL_POWDER setvar VAR_0x8009, 50 goto CeruleanCity_House5_EventScript_ExchangePowderForItem end CeruleanCity_House5_EventScript_RevivalHerb:: - getitemname 0, ITEM_REVIVAL_HERB + bufferitemname STR_VAR_1, ITEM_REVIVAL_HERB setvar VAR_0x8008, ITEM_REVIVAL_HERB setvar VAR_0x8009, 300 goto CeruleanCity_House5_EventScript_ExchangePowderForItem end CeruleanCity_House5_EventScript_Protein:: - getitemname 0, ITEM_PROTEIN + bufferitemname STR_VAR_1, ITEM_PROTEIN setvar VAR_0x8008, ITEM_PROTEIN setvar VAR_0x8009, 1000 goto CeruleanCity_House5_EventScript_ExchangePowderForItem end CeruleanCity_House5_EventScript_Iron:: - getitemname 0, ITEM_IRON + bufferitemname STR_VAR_1, ITEM_IRON setvar VAR_0x8008, ITEM_IRON setvar VAR_0x8009, 1000 goto CeruleanCity_House5_EventScript_ExchangePowderForItem end CeruleanCity_House5_EventScript_Carbos:: - getitemname 0, ITEM_CARBOS + bufferitemname STR_VAR_1, ITEM_CARBOS setvar VAR_0x8008, ITEM_CARBOS setvar VAR_0x8009, 1000 goto CeruleanCity_House5_EventScript_ExchangePowderForItem end CeruleanCity_House5_EventScript_Calcium:: - getitemname 0, ITEM_CALCIUM + bufferitemname STR_VAR_1, ITEM_CALCIUM setvar VAR_0x8008, ITEM_CALCIUM setvar VAR_0x8009, 1000 goto CeruleanCity_House5_EventScript_ExchangePowderForItem end CeruleanCity_House5_EventScript_Zinc:: - getitemname 0, ITEM_ZINC + bufferitemname STR_VAR_1, ITEM_ZINC setvar VAR_0x8008, ITEM_ZINC setvar VAR_0x8009, 1000 goto CeruleanCity_House5_EventScript_ExchangePowderForItem end CeruleanCity_House5_EventScript_HPUp:: - getitemname 0, ITEM_HP_UP + bufferitemname STR_VAR_1, ITEM_HP_UP setvar VAR_0x8008, ITEM_HP_UP setvar VAR_0x8009, 1000 goto CeruleanCity_House5_EventScript_ExchangePowderForItem end CeruleanCity_House5_EventScript_PPUp:: - getitemname 0, ITEM_PP_UP + bufferitemname STR_VAR_1, ITEM_PP_UP setvar VAR_0x8008, ITEM_PP_UP setvar VAR_0x8009, 3000 goto CeruleanCity_House5_EventScript_ExchangePowderForItem diff --git a/data/maps/CinnabarIsland_PokemonLab_ExperimentRoom/scripts.inc b/data/maps/CinnabarIsland_PokemonLab_ExperimentRoom/scripts.inc index 6f81a5407..f3e905b95 100644 --- a/data/maps/CinnabarIsland_PokemonLab_ExperimentRoom/scripts.inc +++ b/data/maps/CinnabarIsland_PokemonLab_ExperimentRoom/scripts.inc @@ -32,7 +32,7 @@ CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_DeclineTrade:: end CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_NotRequestedMon:: - getspeciesname 0, VAR_0x8009 + bufferspeciesname STR_VAR_1, VAR_0x8009 msgbox Trade_Text_WhatThatsNoMon release end @@ -148,8 +148,8 @@ CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_ChooseFossilDomeAmber:: end CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_ShowHelixFossil:: - getspeciesname 0, SPECIES_OMANYTE - getitemname 1, ITEM_HELIX_FOSSIL + bufferspeciesname STR_VAR_1, SPECIES_OMANYTE + bufferitemname STR_VAR_2, ITEM_HELIX_FOSSIL msgbox CinnabarIsland_PokemonLab_ExperimentRoom_Text_ThatFossilIsOfMonMakeItLiveAgain, MSGBOX_YESNO compare VAR_RESULT, NO goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_DeclineReviveFossil @@ -163,8 +163,8 @@ CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_ShowHelixFossil:: end CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_ShowDomeFossil:: - getspeciesname 0, SPECIES_KABUTO - getitemname 1, ITEM_DOME_FOSSIL + bufferspeciesname STR_VAR_1, SPECIES_KABUTO + bufferitemname STR_VAR_2, ITEM_DOME_FOSSIL msgbox CinnabarIsland_PokemonLab_ExperimentRoom_Text_ThatFossilIsOfMonMakeItLiveAgain, MSGBOX_YESNO compare VAR_RESULT, NO goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_DeclineReviveFossil @@ -178,8 +178,8 @@ CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_ShowDomeFossil:: end CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_ShowOldAmber:: - getspeciesname 0, SPECIES_AERODACTYL - getitemname 1, ITEM_OLD_AMBER + bufferspeciesname STR_VAR_1, SPECIES_AERODACTYL + bufferitemname STR_VAR_2, ITEM_OLD_AMBER msgbox CinnabarIsland_PokemonLab_ExperimentRoom_Text_ThatFossilIsOfMonMakeItLiveAgain, MSGBOX_YESNO compare VAR_RESULT, NO goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_DeclineReviveFossil @@ -213,7 +213,7 @@ CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_GiveRevivedMon:: CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_GiveOmanyte:: setvar VAR_TEMP_1, SPECIES_OMANYTE - getspeciesname 0, SPECIES_OMANYTE + bufferspeciesname STR_VAR_1, SPECIES_OMANYTE msgbox CinnabarIsland_PokemonLab_ExperimentRoom_Text_FossilMonBackToLife givemon SPECIES_OMANYTE, 5, ITEM_NONE compare VAR_RESULT, 2 @@ -227,7 +227,7 @@ CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_GiveOmanyte:: CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_GiveKabuto:: setvar VAR_TEMP_1, SPECIES_KABUTO - getspeciesname 0, SPECIES_KABUTO + bufferspeciesname STR_VAR_1, SPECIES_KABUTO msgbox CinnabarIsland_PokemonLab_ExperimentRoom_Text_FossilMonBackToLife givemon SPECIES_KABUTO, 5, ITEM_NONE compare VAR_RESULT, 2 @@ -241,7 +241,7 @@ CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_GiveKabuto:: CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_GiveAerodactyl:: setvar VAR_TEMP_1, SPECIES_AERODACTYL - getspeciesname 0, SPECIES_AERODACTYL + bufferspeciesname STR_VAR_1, SPECIES_AERODACTYL msgbox CinnabarIsland_PokemonLab_ExperimentRoom_Text_FossilMonBackToLife givemon SPECIES_AERODACTYL, 5, ITEM_NONE compare VAR_RESULT, 2 diff --git a/data/maps/CinnabarIsland_PokemonLab_Lounge/scripts.inc b/data/maps/CinnabarIsland_PokemonLab_Lounge/scripts.inc index 45d2a11c0..fa4f456a6 100644 --- a/data/maps/CinnabarIsland_PokemonLab_Lounge/scripts.inc +++ b/data/maps/CinnabarIsland_PokemonLab_Lounge/scripts.inc @@ -32,7 +32,7 @@ CinnabarIsland_PokemonLab_Lounge_EventScript_CliftonDeclineTrade:: end CinnabarIsland_PokemonLab_Lounge_EventScript_CliftonNotRequestedMon:: - getspeciesname 0, VAR_0x8009 + bufferspeciesname STR_VAR_1, VAR_0x8009 msgbox Trade_Text_ThisIsntMon release end @@ -79,7 +79,7 @@ CinnabarIsland_PokemonLab_Lounge_EventScript_NormaDeclineTrade:: end CinnabarIsland_PokemonLab_Lounge_EventScript_NormaNotRequestedMon:: - getspeciesname 0, VAR_0x8009 + bufferspeciesname STR_VAR_1, VAR_0x8009 msgbox Trade_Text_ThisIsNoMon release end diff --git a/data/maps/FiveIsland_ResortGorgeous_House/scripts.inc b/data/maps/FiveIsland_ResortGorgeous_House/scripts.inc index 9b42f9966..8c799e14a 100644 --- a/data/maps/FiveIsland_ResortGorgeous_House/scripts.inc +++ b/data/maps/FiveIsland_ResortGorgeous_House/scripts.inc @@ -62,7 +62,7 @@ FiveIsland_ResortGorgeous_House_EventScript_ShowRequestedMon:: call_if_eq FiveIsland_ResortGorgeous_House_EventScript_ButlerApproachPlayerEast compare VAR_FACING, DIR_WEST call_if_eq FiveIsland_ResortGorgeous_House_EventScript_ButlerApproachPlayerWest - moveobjectoffscreen LOCALID_BUTLER + copyobjectxytoperm LOCALID_BUTLER msgbox FiveIsland_ResortGorgeous_House_Text_ButlerPleaseAcceptThisAsHerThanks giveitem VAR_RESORT_GORGEOUS_REWARD compare VAR_RESULT, FALSE diff --git a/data/maps/FiveIsland_WaterLabyrinth/scripts.inc b/data/maps/FiveIsland_WaterLabyrinth/scripts.inc index eb5febc8c..a7c37cbfd 100644 --- a/data/maps/FiveIsland_WaterLabyrinth/scripts.inc +++ b/data/maps/FiveIsland_WaterLabyrinth/scripts.inc @@ -45,12 +45,12 @@ FiveIsland_WaterLabyrinth_EventScript_TryGiveEgg:: @ If the player has a Togepi/Togetic from this game (assumed to be the one the man gave you) then comment on it @ Otherwise make normal comment FiveIsland_WaterLabyrinth_EventScript_PostEggComment:: - getspeciesname 1, SPECIES_TOGEPI + bufferspeciesname STR_VAR_2, SPECIES_TOGEPI setvar VAR_0x8004, SPECIES_TOGEPI specialvar VAR_RESULT, PlayerPartyContainsSpeciesWithPlayerID compare VAR_RESULT, TRUE goto_if_eq FiveIsland_WaterLabyrinth_EventScript_MonDaisyComment - getspeciesname 1, SPECIES_TOGETIC + bufferspeciesname STR_VAR_2, SPECIES_TOGETIC setvar VAR_0x8004, SPECIES_TOGETIC specialvar VAR_RESULT, PlayerPartyContainsSpeciesWithPlayerID compare VAR_RESULT, TRUE diff --git a/data/maps/FuchsiaCity/scripts.inc b/data/maps/FuchsiaCity/scripts.inc index 67192553e..f50aa66bc 100644 --- a/data/maps/FuchsiaCity/scripts.inc +++ b/data/maps/FuchsiaCity/scripts.inc @@ -72,9 +72,9 @@ FuchsiaCity_EventScript_ChanseySign:: lockall setvar VAR_0x8004, SPECIES_CHANSEY special SetSeenMon - drawmonpic SPECIES_CHANSEY, 10, 3 + showmonpic SPECIES_CHANSEY, 10, 3 msgbox FuchsiaCity_Text_ChanseySign - erasemonpic + hidemonpic releaseall end @@ -82,9 +82,9 @@ FuchsiaCity_EventScript_VoltorbSign:: lockall setvar VAR_0x8004, SPECIES_VOLTORB special SetSeenMon - drawmonpic SPECIES_VOLTORB, 10, 3 + showmonpic SPECIES_VOLTORB, 10, 3 msgbox FuchsiaCity_Text_VoltorbSign - erasemonpic + hidemonpic releaseall end @@ -92,9 +92,9 @@ FuchsiaCity_EventScript_KangaskhanSign:: lockall setvar VAR_0x8004, SPECIES_KANGASKHAN special SetSeenMon - drawmonpic SPECIES_KANGASKHAN, 10, 3 + showmonpic SPECIES_KANGASKHAN, 10, 3 msgbox FuchsiaCity_Text_KangaskhanSign - erasemonpic + hidemonpic releaseall end @@ -102,9 +102,9 @@ FuchsiaCity_EventScript_SlowpokeSign:: lockall setvar VAR_0x8004, SPECIES_SLOWPOKE special SetSeenMon - drawmonpic SPECIES_SLOWPOKE, 10, 3 + showmonpic SPECIES_SLOWPOKE, 10, 3 msgbox FuchsiaCity_Text_SlowpokeSign - erasemonpic + hidemonpic releaseall end @@ -112,9 +112,9 @@ FuchsiaCity_EventScript_LaprasSign:: lockall setvar VAR_0x8004, SPECIES_LAPRAS special SetSeenMon - drawmonpic SPECIES_LAPRAS, 10, 3 + showmonpic SPECIES_LAPRAS, 10, 3 msgbox FuchsiaCity_Text_LaprasSign - erasemonpic + hidemonpic releaseall end @@ -123,17 +123,17 @@ FuchsiaCity_EventScript_FossilMonSign:: goto_if_set FLAG_GOT_DOME_FOSSIL, FuchsiaCity_EventScript_OmanyteSign setvar VAR_0x8004, SPECIES_KABUTO special SetSeenMon - drawmonpic SPECIES_KABUTO, 10, 3 + showmonpic SPECIES_KABUTO, 10, 3 msgbox FuchsiaCity_Text_KabutoSign - erasemonpic + hidemonpic releaseall end FuchsiaCity_EventScript_OmanyteSign:: setvar VAR_0x8004, SPECIES_OMANYTE special SetSeenMon - drawmonpic SPECIES_OMANYTE, 10, 3 + showmonpic SPECIES_OMANYTE, 10, 3 msgbox FuchsiaCity_Text_OmanyteSign - erasemonpic + hidemonpic releaseall end diff --git a/data/maps/FuchsiaCity_SafariZone_Entrance/scripts.inc b/data/maps/FuchsiaCity_SafariZone_Entrance/scripts.inc index e58fc0c65..00a22853b 100644 --- a/data/maps/FuchsiaCity_SafariZone_Entrance/scripts.inc +++ b/data/maps/FuchsiaCity_SafariZone_Entrance/scripts.inc @@ -117,7 +117,7 @@ FuchsiaCity_SafariZone_Entrance_EventScript_TryEnterSafariZone:: compare VAR_RESULT, FALSE goto_if_eq FuchsiaCity_SafariZone_Entrance_EventScript_NotEnoughMoney removemoney 500, 0 - updatemoneybox 0, 0, 0 + updatemoneybox msgbox FuchsiaCity_SafariZone_Entrance_Text_ThatllBe500WeOnlyUseSpecialBalls textcolor 3 playfanfare MUS_LEVEL_UP @@ -126,7 +126,7 @@ FuchsiaCity_SafariZone_Entrance_EventScript_TryEnterSafariZone:: call EventScript_RestorePrevTextColor msgbox FuchsiaCity_SafariZone_Entrance_Text_CallYouOnPAWhenYouRunOut closemessage - hidemoneybox 0, 0 + hidemoneybox compare VAR_TEMP_2, 0 call_if_eq FuchsiaCity_SafariZone_Entrance_EventScript_EnterSafariZoneMid compare VAR_TEMP_2, 1 @@ -172,7 +172,7 @@ FuchsiaCity_SafariZone_Entrance_EventScript_NotEnoughMoney:: FuchsiaCity_SafariZone_Entrance_EventScript_ForcePlayerBack:: closemessage - hidemoneybox 0, 0 + hidemoneybox applymovement OBJ_EVENT_ID_PLAYER, FuchsiaCity_SafariZone_Entrance_Movement_ForceBack waitmovement 0 releaseall diff --git a/data/maps/MtMoon_B2F/scripts.inc b/data/maps/MtMoon_B2F/scripts.inc index 7b2ca76ae..cb4fb4b40 100644 --- a/data/maps/MtMoon_B2F/scripts.inc +++ b/data/maps/MtMoon_B2F/scripts.inc @@ -67,7 +67,7 @@ MtMoon_B2F_EventScript_DomeFossil:: delay 10 applymovement LOCALID_MIGUEL, MtMoon_B2F_Movement_MiguelToHelixFossil waitmovement 0 - moveobjectoffscreen LOCALID_MIGUEL + copyobjectxytoperm LOCALID_MIGUEL textcolor 0 playfanfare MUS_OBTAIN_KEY_ITEM message MtMoon_B2F_Text_ThenThisFossilIsMine @@ -99,7 +99,7 @@ MtMoon_B2F_EventScript_HelixFossil:: delay 10 applymovement LOCALID_MIGUEL, MtMoon_B2F_Movement_MiguelToDomeFossil waitmovement 0 - moveobjectoffscreen LOCALID_MIGUEL + copyobjectxytoperm LOCALID_MIGUEL textcolor 0 playfanfare MUS_OBTAIN_KEY_ITEM message MtMoon_B2F_Text_ThenThisFossilIsMine diff --git a/data/maps/PalletTown/scripts.inc b/data/maps/PalletTown/scripts.inc index f6a1777ab..6aedb3871 100644 --- a/data/maps/PalletTown/scripts.inc +++ b/data/maps/PalletTown/scripts.inc @@ -59,8 +59,8 @@ PalletTown_EventScript_OakRatingScene:: specialvar VAR_RESULT, GetPokedexCount copyvar VAR_0x8008, VAR_0x8005 copyvar VAR_0x8009, VAR_0x8006 - getnumberstring 0, VAR_0x8008 - getnumberstring 1, VAR_0x8009 + buffernumberstring STR_VAR_1, VAR_0x8008 + buffernumberstring STR_VAR_2, VAR_0x8009 compare VAR_0x8009, 60 goto_if_lt PalletTown_EventScript_NotEnoughMonsForNationalDex msgbox PalletTown_Text_CaughtXImpressiveFollowMe @@ -356,7 +356,7 @@ PalletTown_EventScript_SignLady:: call_if_eq PalletTown_EventScript_SignLadyMoveOutOfWayRight compare VAR_FACING, DIR_EAST call_if_ne PalletTown_EventScript_SignLadyMoveOutOfWayLeft - moveobjectoffscreen 1 + copyobjectxytoperm LOCALID_SIGN_LADY setflag FLAG_TEMP_2 release end diff --git a/data/maps/PalletTown_ProfessorOaksLab/scripts.inc b/data/maps/PalletTown_ProfessorOaksLab/scripts.inc index 1d6fbfbeb..a862f2fd4 100644 --- a/data/maps/PalletTown_ProfessorOaksLab/scripts.inc +++ b/data/maps/PalletTown_ProfessorOaksLab/scripts.inc @@ -852,8 +852,8 @@ PalletTown_ProfessorOaksLab_EventScript_RatePokedexOrTryGiveBalls:: specialvar VAR_RESULT, GetPokedexCount copyvar VAR_0x8008, VAR_0x8005 copyvar VAR_0x8009, VAR_0x8006 - getnumberstring 0, VAR_0x8008 - getnumberstring 1, VAR_0x8009 + buffernumberstring STR_VAR_1, VAR_0x8008 + buffernumberstring STR_VAR_2, VAR_0x8009 compare VAR_0x8009, 1 @ Player only has starter goto_if_eq PalletTown_ProfessorOaksLab_EventScript_CheckIfPlayerNeedsBalls goto PalletTown_ProfessorOaksLab_EventScript_RatePokedex @@ -1169,7 +1169,7 @@ PalletTown_ProfessorOaksLab_EventScript_BulbasaurBall:: PalletTown_ProfessorOaksLab_EventScript_ConfirmStarterChoice:: applymovement LOCALID_PROF_OAK, Movement_FaceRight waitmovement 0 - drawmonpic PLAYER_STARTER_SPECIES, 10, 3 + showmonpic PLAYER_STARTER_SPECIES, 10, 3 textcolor 0 compare PLAYER_STARTER_NUM, 0 goto_if_eq PalletTown_ProfessorOaksLab_EventScript_ConfirmBulbasaur @@ -1204,12 +1204,12 @@ PalletTown_ProfessorOaksLab_EventScript_ConfirmCharmander:: end PalletTown_ProfessorOaksLab_EventScript_DeclinedStarter:: - erasemonpic + hidemonpic release end PalletTown_ProfessorOaksLab_EventScript_ChoseStarter:: - erasemonpic + hidemonpic removeobject VAR_LAST_TALKED msgbox PalletTown_ProfessorOaksLab_Text_OakThisMonIsEnergetic call EventScript_RestorePrevTextColor @@ -1217,7 +1217,7 @@ PalletTown_ProfessorOaksLab_EventScript_ChoseStarter:: setflag FLAG_PALLET_LADY_NOT_BLOCKING_SIGN givemon PLAYER_STARTER_SPECIES, 5, ITEM_NONE copyvar VAR_STARTER_MON, PLAYER_STARTER_NUM - getspeciesname 0, PLAYER_STARTER_SPECIES + bufferspeciesname STR_VAR_1, PLAYER_STARTER_SPECIES message PalletTown_ProfessorOaksLab_Text_ReceivedMonFromOak waitmessage playfanfare MUS_OBTAIN_KEY_ITEM @@ -1268,7 +1268,7 @@ PalletTown_ProfessorOaksLab_EventScript_RivalTakesStarter:: msgbox PalletTown_ProfessorOaksLab_Text_RivalIllTakeThisOneThen removeobject RIVAL_STARTER_ID textcolor 3 - getspeciesname 0, RIVAL_STARTER_SPECIES + bufferspeciesname STR_VAR_1, RIVAL_STARTER_SPECIES message PalletTown_ProfessorOaksLab_Text_RivalReceivedMonFromOak waitmessage playfanfare MUS_OBTAIN_KEY_ITEM diff --git a/data/maps/PewterCity_Museum_1F/scripts.inc b/data/maps/PewterCity_Museum_1F/scripts.inc index d73ae856c..ad72bfbe4 100644 --- a/data/maps/PewterCity_Museum_1F/scripts.inc +++ b/data/maps/PewterCity_Museum_1F/scripts.inc @@ -71,7 +71,7 @@ PewterCity_Museum_1F_EventScript_EntranceTrigger:: goto_if_eq PewterCity_Museum_1F_EventScript_TryPayForTicket msgbox PewterCity_Museum_1F_Text_ComeAgain closemessage - hidemoneybox 0, 0 + hidemoneybox applymovement OBJ_EVENT_ID_PLAYER, PewterCity_Museum_1F_Movement_ForcePlayerExit waitmovement 0 releaseall @@ -90,11 +90,11 @@ PewterCity_Museum_1F_EventScript_TryPayForTicket:: call_if_eq PewterCity_Museum_1F_EventScript_PlayerApproachCounterRight playse SE_SHOP removemoney 50, 0 - updatemoneybox 0, 0, 0 + updatemoneybox waitse msgbox PewterCity_Museum_1F_Text_Right50YThankYou setvar VAR_MAP_SCENE_PEWTER_CITY_MUSEUM_1F, 1 - hidemoneybox 0, 0 + hidemoneybox releaseall end @@ -116,7 +116,7 @@ PewterCity_Museum_1F_EventScript_PlayerApproachCounterRight:: PewterCity_Museum_1F_EventScript_NotEnoughMoney:: msgbox PewterCity_Museum_1F_Text_DontHaveEnoughMoney closemessage - hidemoneybox 0, 0 + hidemoneybox applymovement OBJ_EVENT_ID_PLAYER, PewterCity_Museum_1F_Movement_ForcePlayerExit waitmovement 0 releaseall diff --git a/data/maps/PokemonLeague_ChampionsRoom/scripts.inc b/data/maps/PokemonLeague_ChampionsRoom/scripts.inc index 1c9558459..8accc5502 100644 --- a/data/maps/PokemonLeague_ChampionsRoom/scripts.inc +++ b/data/maps/PokemonLeague_ChampionsRoom/scripts.inc @@ -79,7 +79,7 @@ PokemonLeague_ChampionsRoom_EventScript_EnterRoom:: waitmovement 0 delay 25 specialvar VAR_RESULT, GetStarterSpecies - getspeciesname 0, VAR_RESULT + bufferspeciesname STR_VAR_1, VAR_RESULT msgbox PokemonLeague_ChampionsRoom_Text_OakCongratulations applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestRight applymovement LOCALID_RIVAL, Movement_WalkInPlaceFastestLeft diff --git a/data/maps/Route1/scripts.inc b/data/maps/Route1/scripts.inc index 90bc0327b..cd8a3cfaa 100644 --- a/data/maps/Route1/scripts.inc +++ b/data/maps/Route1/scripts.inc @@ -10,7 +10,7 @@ Route1_EventScript_MartClerk:: checkitemspace ITEM_POTION, 1 compare VAR_RESULT, FALSE goto_if_eq EventScript_BagIsFull - getitemname 1, ITEM_POTION + bufferitemname STR_VAR_2, ITEM_POTION playfanfare MUS_LEVEL_UP message Text_ObtainedTheX waitmessage diff --git a/data/maps/Route10_PokemonCenter_1F/scripts.inc b/data/maps/Route10_PokemonCenter_1F/scripts.inc index 5cbe2e973..ad106810b 100644 --- a/data/maps/Route10_PokemonCenter_1F/scripts.inc +++ b/data/maps/Route10_PokemonCenter_1F/scripts.inc @@ -39,7 +39,7 @@ Route10_PokemonCenter_1F_EventScript_Aide:: goto_if_eq Aide_EventScript_DeclineCheckMons setvar VAR_0x8004, 0 specialvar VAR_RESULT, GetPokedexCount - getnumberstring 2, VAR_0x8006 + buffernumberstring STR_VAR_3, VAR_0x8006 call Route10_PokemonCenter_1F_EventScript_GetAideRequestInfo compare VAR_0x8006, REQUIRED_OWNED_MONS goto_if_lt Aide_EventScript_HaventCaughtEnough @@ -59,6 +59,6 @@ Route10_PokemonCenter_1F_EventScript_AlreadyGotEverstone:: end Route10_PokemonCenter_1F_EventScript_GetAideRequestInfo:: - getnumberstring 0, REQUIRED_OWNED_MONS - getitemname 1, ITEM_EVERSTONE + buffernumberstring STR_VAR_1, REQUIRED_OWNED_MONS + bufferitemname STR_VAR_2, ITEM_EVERSTONE return diff --git a/data/maps/Route11_EastEntrance_2F/scripts.inc b/data/maps/Route11_EastEntrance_2F/scripts.inc index e59125e42..51baa1f53 100644 --- a/data/maps/Route11_EastEntrance_2F/scripts.inc +++ b/data/maps/Route11_EastEntrance_2F/scripts.inc @@ -46,7 +46,7 @@ Route11_EastEntrance_2F_EventScript_DeclineTrade:: end Route11_EastEntrance_2F_EventScript_NotRequestedMon:: - getspeciesname 0, VAR_0x8009 + bufferspeciesname STR_VAR_1, VAR_0x8009 msgbox Trade_Text_WhatThatsNoMon release end @@ -66,7 +66,7 @@ Route11_EastEntrance_2F_EventScript_Aide:: goto_if_eq Aide_EventScript_DeclineCheckMons setvar VAR_0x8004, 0 specialvar VAR_RESULT, GetPokedexCount - getnumberstring 2, VAR_0x8006 + buffernumberstring STR_VAR_3, VAR_0x8006 call Route11_EastEntrance_2F_EventScript_GetAideRequestInfo compare VAR_0x8006, REQUIRED_CAUGHT_MONS goto_if_lt Aide_EventScript_HaventCaughtEnough @@ -86,6 +86,6 @@ Route11_EastEntrance_2F_EventScript_AlreadyGotItemfinder:: end Route11_EastEntrance_2F_EventScript_GetAideRequestInfo:: - getnumberstring 0, REQUIRED_CAUGHT_MONS - getitemname 1, ITEM_ITEMFINDER + buffernumberstring STR_VAR_1, REQUIRED_CAUGHT_MONS + bufferitemname STR_VAR_2, ITEM_ITEMFINDER return diff --git a/data/maps/Route15_WestEntrance_2F/scripts.inc b/data/maps/Route15_WestEntrance_2F/scripts.inc index 9b74877b8..e799ca57d 100644 --- a/data/maps/Route15_WestEntrance_2F/scripts.inc +++ b/data/maps/Route15_WestEntrance_2F/scripts.inc @@ -6,10 +6,10 @@ Route15_WestEntrance_2F_MapScripts:: Route15_WestEntrance_2F_EventScript_LeftBinoculars:: lockall msgbox Route15_WestEntrance_2F_Text_LargeShiningBird - drawmonpic SPECIES_ARTICUNO, 10, 3 + showmonpic SPECIES_ARTICUNO, 10, 3 delay 20 waitbuttonpress - erasemonpic + hidemonpic setvar VAR_0x8004, SPECIES_ARTICUNO special SetSeenMon releaseall @@ -29,7 +29,7 @@ Route15_WestEntrance_2F_EventScript_Aide:: goto_if_eq Aide_EventScript_DeclineCheckMons setvar VAR_0x8004, 0 specialvar VAR_RESULT, GetPokedexCount - getnumberstring 2, VAR_0x8006 + buffernumberstring STR_VAR_3, VAR_0x8006 call Route15_WestEntrance_2F_EventScript_GetAideRequestInfo compare VAR_0x8006, REQUIRED_CAUGHT_MONS goto_if_lt Aide_EventScript_HaventCaughtEnough @@ -49,6 +49,6 @@ Route15_WestEntrance_2F_EventScript_AlreadyGotExpShare:: end Route15_WestEntrance_2F_EventScript_GetAideRequestInfo:: - getnumberstring 0, REQUIRED_CAUGHT_MONS - getitemname 1, ITEM_EXP_SHARE + buffernumberstring STR_VAR_1, REQUIRED_CAUGHT_MONS + bufferitemname STR_VAR_2, ITEM_EXP_SHARE return diff --git a/data/maps/Route16_NorthEntrance_2F/scripts.inc b/data/maps/Route16_NorthEntrance_2F/scripts.inc index 57ef19ea4..63f7c7c8a 100644 --- a/data/maps/Route16_NorthEntrance_2F/scripts.inc +++ b/data/maps/Route16_NorthEntrance_2F/scripts.inc @@ -29,7 +29,7 @@ Route16_NorthEntrance_2F_EventScript_Aide:: goto_if_eq Aide_EventScript_DeclineCheckMons setvar VAR_0x8004, 0 specialvar VAR_RESULT, GetPokedexCount - getnumberstring 2, VAR_0x8006 + buffernumberstring STR_VAR_3, VAR_0x8006 call Route16_NorthEntrance_2F_EventScript_GetAideRequestInfo compare VAR_0x8006, REQUIRED_CAUGHT_MONS goto_if_lt Aide_EventScript_HaventCaughtEnough @@ -49,6 +49,6 @@ Route16_NorthEntrance_2F_EventScript_AlreadyGotAmuletCoin:: end Route16_NorthEntrance_2F_EventScript_GetAideRequestInfo:: - getnumberstring 0, REQUIRED_CAUGHT_MONS - getitemname 1, ITEM_AMULET_COIN + buffernumberstring STR_VAR_1, REQUIRED_CAUGHT_MONS + bufferitemname STR_VAR_2, ITEM_AMULET_COIN return diff --git a/data/maps/Route18_EastEntrance_2F/scripts.inc b/data/maps/Route18_EastEntrance_2F/scripts.inc index edf1eafe1..814d9e0d0 100644 --- a/data/maps/Route18_EastEntrance_2F/scripts.inc +++ b/data/maps/Route18_EastEntrance_2F/scripts.inc @@ -36,7 +36,7 @@ Route18_EastEntrance_2F_EventScript_DeclineTrade:: end Route18_EastEntrance_2F_EventScript_NotRequestedMon:: - getspeciesname 0, VAR_0x8009 + bufferspeciesname STR_VAR_1, VAR_0x8009 msgbox Trade_Text_WhatThatsNoMon release end diff --git a/data/maps/Route22_NorthEntrance/scripts.inc b/data/maps/Route22_NorthEntrance/scripts.inc index b21257306..b98823c78 100644 --- a/data/maps/Route22_NorthEntrance/scripts.inc +++ b/data/maps/Route22_NorthEntrance/scripts.inc @@ -5,7 +5,7 @@ Route22_NorthEntrance_EventScript_BoulderBadgeGuard:: lock faceplayer setvar VAR_TEMP_1, 1 - getstdstring 0, STDSTRING_BOULDER_BADGE + bufferstdstring STR_VAR_1, STDSTRING_BOULDER_BADGE goto Route22_NorthEntrance_EventScript_BadgeGuard end @@ -13,6 +13,6 @@ Route22_NorthEntrance_EventScript_BoulderBadgeGuardTrigger:: lockall setvar VAR_TEMP_1, 1 setvar VAR_0x8009, 1 - getstdstring 0, STDSTRING_BOULDER_BADGE + bufferstdstring STR_VAR_1, STDSTRING_BOULDER_BADGE goto Route23_EventScript_BadgeGuardTrigger end diff --git a/data/maps/Route23/scripts.inc b/data/maps/Route23/scripts.inc index 45a33ac4d..03d576bc1 100644 --- a/data/maps/Route23/scripts.inc +++ b/data/maps/Route23/scripts.inc @@ -23,7 +23,7 @@ Route23_EventScript_CascadeBadgeGuard:: lock faceplayer setvar VAR_TEMP_1, 2 - getstdstring 0, STDSTRING_CASCADE_BADGE + bufferstdstring STR_VAR_1, STDSTRING_CASCADE_BADGE goto Route23_EventScript_BadgeGuard end @@ -31,7 +31,7 @@ Route23_EventScript_ThunderBadgeGuard:: lock faceplayer setvar VAR_TEMP_1, 3 - getstdstring 0, STDSTRING_THUNDER_BADGE + bufferstdstring STR_VAR_1, STDSTRING_THUNDER_BADGE goto Route23_EventScript_BadgeGuard end @@ -39,7 +39,7 @@ Route23_EventScript_RainbowBadgeGuard:: lock faceplayer setvar VAR_TEMP_1, 4 - getstdstring 0, STDSTRING_RAINBOW_BADGE + bufferstdstring STR_VAR_1, STDSTRING_RAINBOW_BADGE goto Route23_EventScript_BadgeGuard end @@ -47,7 +47,7 @@ Route23_EventScript_SoulBadgeGuard:: lock faceplayer setvar VAR_TEMP_1, 5 - getstdstring 0, STDSTRING_SOUL_BADGE + bufferstdstring STR_VAR_1, STDSTRING_SOUL_BADGE goto Route23_EventScript_BadgeGuard end @@ -55,7 +55,7 @@ Route23_EventScript_MarshBadgeGuard:: lock faceplayer setvar VAR_TEMP_1, 6 - getstdstring 0, STDSTRING_MARSH_BADGE + bufferstdstring STR_VAR_1, STDSTRING_MARSH_BADGE goto Route23_EventScript_BadgeGuard end @@ -63,7 +63,7 @@ Route23_EventScript_VolcanoBadgeGuard:: lock faceplayer setvar VAR_TEMP_1, 7 - getstdstring 0, STDSTRING_VOLCANO_BADGE + bufferstdstring STR_VAR_1, STDSTRING_VOLCANO_BADGE goto Route23_EventScript_BadgeGuard end @@ -71,7 +71,7 @@ Route23_EventScript_EarthBadgeGuard:: lock faceplayer setvar VAR_TEMP_1, 8 - getstdstring 0, STDSTRING_EARTH_BADGE + bufferstdstring STR_VAR_1, STDSTRING_EARTH_BADGE goto Route23_EventScript_BadgeGuard end @@ -79,7 +79,7 @@ Route23_EventScript_CascadeBadgeGuardTrigger:: lockall setvar VAR_TEMP_1, 2 setvar VAR_0x8009, LOCALID_CASCADE_BADGE_GUARD - getstdstring 0, STDSTRING_CASCADE_BADGE + bufferstdstring STR_VAR_1, STDSTRING_CASCADE_BADGE goto Route23_EventScript_BadgeGuardTrigger end @@ -87,7 +87,7 @@ Route23_EventScript_ThunderBadgeGuardTrigger:: lockall setvar VAR_TEMP_1, 3 setvar VAR_0x8009, LOCALID_THUNDER_BADGE_GUARD - getstdstring 0, STDSTRING_THUNDER_BADGE + bufferstdstring STR_VAR_1, STDSTRING_THUNDER_BADGE goto Route23_EventScript_BadgeGuardTrigger end @@ -95,7 +95,7 @@ Route23_EventScript_RainbowBadgeGuardTrigger:: lockall setvar VAR_TEMP_1, 4 setvar VAR_0x8009, LOCALID_RAINBOW_BADGE_GUARD - getstdstring 0, STDSTRING_RAINBOW_BADGE + bufferstdstring STR_VAR_1, STDSTRING_RAINBOW_BADGE goto Route23_EventScript_BadgeGuardTrigger end @@ -103,7 +103,7 @@ Route23_EventScript_SoulBadgeGuardTrigger:: lockall setvar VAR_TEMP_1, 5 setvar VAR_0x8009, LOCALID_SOUL_BADGE_GUARD - getstdstring 0, STDSTRING_SOUL_BADGE + bufferstdstring STR_VAR_1, STDSTRING_SOUL_BADGE goto Route23_EventScript_BadgeGuardTrigger end @@ -111,7 +111,7 @@ Route23_EventScript_MarshBadgeGuardTrigger:: lockall setvar VAR_TEMP_1, 6 setvar VAR_0x8009, LOCALID_MARSH_BADGE_GUARD - getstdstring 0, STDSTRING_MARSH_BADGE + bufferstdstring STR_VAR_1, STDSTRING_MARSH_BADGE goto Route23_EventScript_BadgeGuardTrigger end @@ -119,7 +119,7 @@ Route23_EventScript_VolcanoBadgeGuardTrigger:: lockall setvar VAR_TEMP_1, 7 setvar VAR_0x8009, LOCALID_VOLCANO_BADGE_GUARD - getstdstring 0, STDSTRING_VOLCANO_BADGE + bufferstdstring STR_VAR_1, STDSTRING_VOLCANO_BADGE goto Route23_EventScript_BadgeGuardTrigger end @@ -127,7 +127,7 @@ Route23_EventScript_EarthBadgeGuardTrigger:: lockall setvar VAR_TEMP_1, 8 setvar VAR_0x8009, LOCALID_EARTH_BADGE_GUARD - getstdstring 0, STDSTRING_EARTH_BADGE + bufferstdstring STR_VAR_1, STDSTRING_EARTH_BADGE goto Route23_EventScript_BadgeGuardTrigger end diff --git a/data/maps/Route25_SeaCottage/scripts.inc b/data/maps/Route25_SeaCottage/scripts.inc index 83173399c..182aec7e7 100644 --- a/data/maps/Route25_SeaCottage/scripts.inc +++ b/data/maps/Route25_SeaCottage/scripts.inc @@ -258,36 +258,36 @@ Route25_SeaCottage_EventScript_BillsMonList:: end Route25_SeaCottage_EventScript_ViewEevee:: - drawmonpic SPECIES_EEVEE, 10, 3 + showmonpic SPECIES_EEVEE, 10, 3 waitbuttonpress - erasemonpic + hidemonpic setvar VAR_0x8004, SPECIES_EEVEE special SetSeenMon goto Route25_SeaCottage_EventScript_BillsMonList end Route25_SeaCottage_EventScript_ViewFlareon:: - drawmonpic SPECIES_FLAREON, 10, 3 + showmonpic SPECIES_FLAREON, 10, 3 waitbuttonpress - erasemonpic + hidemonpic setvar VAR_0x8004, SPECIES_FLAREON special SetSeenMon goto Route25_SeaCottage_EventScript_BillsMonList end Route25_SeaCottage_EventScript_ViewJolteon:: - drawmonpic SPECIES_JOLTEON, 10, 3 + showmonpic SPECIES_JOLTEON, 10, 3 waitbuttonpress - erasemonpic + hidemonpic setvar VAR_0x8004, SPECIES_JOLTEON special SetSeenMon goto Route25_SeaCottage_EventScript_BillsMonList end Route25_SeaCottage_EventScript_ViewVaporeon:: - drawmonpic SPECIES_VAPOREON, 10, 3 + showmonpic SPECIES_VAPOREON, 10, 3 waitbuttonpress - erasemonpic + hidemonpic setvar VAR_0x8004, SPECIES_VAPOREON special SetSeenMon goto Route25_SeaCottage_EventScript_BillsMonList diff --git a/data/maps/Route2_EastBuilding/scripts.inc b/data/maps/Route2_EastBuilding/scripts.inc index e602b4fc0..60d995140 100644 --- a/data/maps/Route2_EastBuilding/scripts.inc +++ b/data/maps/Route2_EastBuilding/scripts.inc @@ -13,7 +13,7 @@ Route2_EastBuilding_EventScript_Aide:: goto_if_eq Aide_EventScript_DeclineCheckMons setvar VAR_0x8004, 0 specialvar VAR_RESULT, GetPokedexCount - getnumberstring 2, VAR_0x8006 + buffernumberstring STR_VAR_3, VAR_0x8006 call Route2_EastBuilding_EventScript_GetAideRequestInfo compare VAR_0x8006, REQUIRED_SEEN_MONS goto_if_lt Aide_EventScript_HaventCaughtEnough @@ -33,8 +33,8 @@ Route2_EastBuilding_EventScript_AlreadyGotHM05:: end Route2_EastBuilding_EventScript_GetAideRequestInfo:: - getnumberstring 0, REQUIRED_SEEN_MONS - getitemname 1, ITEM_HM05 + buffernumberstring STR_VAR_1, REQUIRED_SEEN_MONS + bufferitemname STR_VAR_2, ITEM_HM05 return Route2_EastBuilding_EventScript_Rocker:: diff --git a/data/maps/Route2_House/scripts.inc b/data/maps/Route2_House/scripts.inc index 9ddb1e292..c252e38b3 100644 --- a/data/maps/Route2_House/scripts.inc +++ b/data/maps/Route2_House/scripts.inc @@ -32,7 +32,7 @@ Route2_House_EventScript_DeclineTrade:: end Route2_House_EventScript_NotRequestedMon:: - getspeciesname 0, VAR_0x8009 + bufferspeciesname STR_VAR_1, VAR_0x8009 msgbox Trade_Text_WhatThatsNoMon release end diff --git a/data/maps/Route4_PokemonCenter_1F/scripts.inc b/data/maps/Route4_PokemonCenter_1F/scripts.inc index 0f32e6f43..f7a37ac6e 100644 --- a/data/maps/Route4_PokemonCenter_1F/scripts.inc +++ b/data/maps/Route4_PokemonCenter_1F/scripts.inc @@ -66,7 +66,7 @@ Route4_PokemonCenter_1F_EventScript_BuyMagikarpParty:: goto_if_eq Route4_PokemonCenter_1F_EventScript_EndPurchaseMagikarp call EventScript_GetGiftMonPartySlot fadescreen FADE_TO_BLACK - hidemoneybox 0, 0 + hidemoneybox special ChangePokemonNickname waitstate goto Route4_PokemonCenter_1F_EventScript_BoughtMagikarp @@ -78,7 +78,7 @@ Route4_PokemonCenter_1F_EventScript_BuyMagikarpPC:: compare VAR_RESULT, NO goto_if_eq Route4_PokemonCenter_1F_EventScript_TransferMagikarpCloseMoneyBox fadescreen FADE_TO_BLACK - hidemoneybox 0, 0 + hidemoneybox special ChangeBoxPokemonNickname waitstate lock @@ -97,7 +97,7 @@ Route4_PokemonCenter_1F_EventScript_TransferMagikarp:: end Route4_PokemonCenter_1F_EventScript_EndPurchaseMagikarp:: - hidemoneybox 0, 0 + hidemoneybox goto Route4_PokemonCenter_1F_EventScript_BoughtMagikarp end @@ -108,23 +108,23 @@ Route4_PokemonCenter_1F_EventScript_BoughtMagikarp:: Route4_PokemonCenter_1F_EventScript_PayForMagikarp:: removemoney MAGIKARP_PRICE, 0 - updatemoneybox 0, 0, 0 + updatemoneybox playfanfare MUS_LEVEL_UP message Route4_PokemonCenter_1F_Text_PaidOutrageouslyForMagikarp waitmessage waitfanfare - getspeciesname 0, SPECIES_MAGIKARP + bufferspeciesname STR_VAR_1, SPECIES_MAGIKARP return Route4_PokemonCenter_1F_EventScript_DeclineMagikarp:: msgbox Route4_PokemonCenter_1F_Text_OnlyDoingThisAsFavorToYou - hidemoneybox 0, 0 + hidemoneybox release end Route4_PokemonCenter_1F_EventScript_NotEnoughMoney:: msgbox Route4_PokemonCenter_1F_Text_YoullNeedMoreMoney - hidemoneybox 0, 0 + hidemoneybox release end @@ -136,7 +136,7 @@ Route4_PokemonCenter_1F_EventScript_AlreadyBoughtMagikarp:: Route4_PokemonCenter_1F_EventScript_NoRoomForMagikarp:: textcolor 0 msgbox Route4_PokemonCenter_1F_Text_NoRoomForMorePokemon - hidemoneybox 0, 0 + hidemoneybox release end diff --git a/data/maps/SSAnne_2F_Room1/scripts.inc b/data/maps/SSAnne_2F_Room1/scripts.inc index 183c71528..06292bc3c 100644 --- a/data/maps/SSAnne_2F_Room1/scripts.inc +++ b/data/maps/SSAnne_2F_Room1/scripts.inc @@ -8,8 +8,8 @@ SSAnne_2F_Room1_EventScript_Gentleman:: waitmessage setvar VAR_0x8004, SPECIES_SNORLAX special SetSeenMon - drawmonpic SPECIES_SNORLAX, 10, 3 + showmonpic SPECIES_SNORLAX, 10, 3 waitbuttonpress - erasemonpic + hidemonpic release end diff --git a/data/maps/SaffronCity_Dojo/scripts.inc b/data/maps/SaffronCity_Dojo/scripts.inc index 2cc0b23bc..126c2a6c5 100644 --- a/data/maps/SaffronCity_Dojo/scripts.inc +++ b/data/maps/SaffronCity_Dojo/scripts.inc @@ -23,7 +23,7 @@ SaffronCity_Dojo_EventScript_HitmonleeBall:: lock faceplayer goto_if_set FLAG_GOT_HITMON_FROM_DOJO, SaffronCity_Dojo_EventScript_AlreadyGotHitmon - drawmonpic SPECIES_HITMONLEE, 10, 3 + showmonpic SPECIES_HITMONLEE, 10, 3 setvar VAR_TEMP_1, SPECIES_HITMONLEE applymovement LOCALID_KARATE_MASTER, Movement_WalkInPlaceFastestUp waitmovement 0 @@ -32,7 +32,7 @@ SaffronCity_Dojo_EventScript_HitmonleeBall:: call EventScript_RestorePrevTextColor compare VAR_RESULT, YES goto_if_eq SaffronCity_Dojo_EventScript_GiveHitmon - erasemonpic + hidemonpic release end @@ -45,7 +45,7 @@ SaffronCity_Dojo_EventScript_HitmonchanBall:: lock faceplayer goto_if_set FLAG_GOT_HITMON_FROM_DOJO, SaffronCity_Dojo_EventScript_AlreadyGotHitmon - drawmonpic SPECIES_HITMONCHAN, 10, 3 + showmonpic SPECIES_HITMONCHAN, 10, 3 setvar VAR_TEMP_1, SPECIES_HITMONCHAN applymovement LOCALID_KARATE_MASTER, Movement_WalkInPlaceFastestUp waitmovement 0 @@ -54,12 +54,12 @@ SaffronCity_Dojo_EventScript_HitmonchanBall:: call EventScript_RestorePrevTextColor compare VAR_RESULT, YES goto_if_eq SaffronCity_Dojo_EventScript_GiveHitmon - erasemonpic + hidemonpic release end SaffronCity_Dojo_EventScript_GiveHitmon:: - erasemonpic + hidemonpic givemon VAR_TEMP_1, 25, ITEM_NONE compare VAR_RESULT, 0 goto_if_eq SaffronCity_Dojo_EventScript_ReceivedHitmonParty @@ -72,7 +72,7 @@ SaffronCity_Dojo_EventScript_GiveHitmon:: SaffronCity_Dojo_EventScript_ReceivedHitmonParty:: removeobject VAR_LAST_TALKED - getspeciesname 0, VAR_TEMP_1 + bufferspeciesname STR_VAR_1, VAR_TEMP_1 playfanfare MUS_LEVEL_UP message SaffronCity_Dojo_Text_ReceivedMonFromKarateMaster waitmessage @@ -88,7 +88,7 @@ SaffronCity_Dojo_EventScript_ReceivedHitmonParty:: SaffronCity_Dojo_EventScript_ReceivedHitmonPC:: removeobject VAR_LAST_TALKED - getspeciesname 0, VAR_TEMP_1 + bufferspeciesname STR_VAR_1, VAR_TEMP_1 playfanfare MUS_LEVEL_UP message SaffronCity_Dojo_Text_ReceivedMonFromKarateMaster waitmessage diff --git a/data/maps/SevenIsland_House_Room1/scripts.inc b/data/maps/SevenIsland_House_Room1/scripts.inc index e2e8c4e6b..fda16db24 100644 --- a/data/maps/SevenIsland_House_Room1/scripts.inc +++ b/data/maps/SevenIsland_House_Room1/scripts.inc @@ -40,7 +40,7 @@ SevenIsland_House_Room1_EventScript_OldWomanCommentOnBattle:: waitmovement 0 applymovement LOCALID_OLD_WOMAN, SevenIsland_House_Room1_Movement_OldWomanWalkBehindPlayer waitmovement 0 - moveobjectoffscreen LOCALID_OLD_WOMAN + copyobjectxytoperm LOCALID_OLD_WOMAN applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp waitmovement 0 compare VAR_MAP_SCENE_SEVEN_ISLAND_HOUSE_ROOM1, 1 diff --git a/data/maps/SilphCo_7F/scripts.inc b/data/maps/SilphCo_7F/scripts.inc index cce9193ae..353ed43af 100644 --- a/data/maps/SilphCo_7F/scripts.inc +++ b/data/maps/SilphCo_7F/scripts.inc @@ -145,7 +145,7 @@ SilphCo_7F_EventScript_ReceiveLaprasParty:: message SilphCo_7F_Text_ObtainedLaprasFromEmployee waitmessage waitfanfare - getspeciesname 0, SPECIES_LAPRAS + bufferspeciesname STR_VAR_1, SPECIES_LAPRAS msgbox Text_GiveNicknameToThisMon, MSGBOX_YESNO compare VAR_RESULT, NO goto_if_eq SilphCo_7F_EventScript_EndReceiveLapras @@ -160,7 +160,7 @@ SilphCo_7F_EventScript_ReceiveLaprasPC:: message SilphCo_7F_Text_ObtainedLaprasFromEmployee waitmessage waitfanfare - getspeciesname 0, SPECIES_LAPRAS + bufferspeciesname STR_VAR_1, SPECIES_LAPRAS msgbox Text_GiveNicknameToThisMon, MSGBOX_YESNO compare VAR_RESULT, NO goto_if_eq SilphCo_7F_EventScript_LaprasTransferredToPC diff --git a/data/maps/UndergroundPath_NorthEntrance/scripts.inc b/data/maps/UndergroundPath_NorthEntrance/scripts.inc index 207055dc7..64a7ba916 100644 --- a/data/maps/UndergroundPath_NorthEntrance/scripts.inc +++ b/data/maps/UndergroundPath_NorthEntrance/scripts.inc @@ -28,7 +28,7 @@ UndergroundPath_NorthEntrance_EventScript_DeclineTrade:: end UndergroundPath_NorthEntrance_EventScript_NotRequestedMon:: - getspeciesname 0, VAR_0x8009 + bufferspeciesname STR_VAR_1, VAR_0x8009 msgbox Trade_Text_ThisIsNoMon release end diff --git a/data/maps/VermilionCity_House2/scripts.inc b/data/maps/VermilionCity_House2/scripts.inc index 51ff9a355..a6c960685 100644 --- a/data/maps/VermilionCity_House2/scripts.inc +++ b/data/maps/VermilionCity_House2/scripts.inc @@ -28,7 +28,7 @@ VermilionCity_House2_EventScript_DeclineTrade:: end VermilionCity_House2_EventScript_NotRequestedMon:: - getspeciesname 0, VAR_0x8009 + bufferspeciesname STR_VAR_1, VAR_0x8009 msgbox VermilionCity_House2_Text_ThisIsNoMon release end diff --git a/data/maps/VictoryRoad_1F/scripts.inc b/data/maps/VictoryRoad_1F/scripts.inc index 9c3f748bb..f9d118b09 100644 --- a/data/maps/VictoryRoad_1F/scripts.inc +++ b/data/maps/VictoryRoad_1F/scripts.inc @@ -1,3 +1,5 @@ +.set LOCALID_BOULDER, 5 + VictoryRoad_1F_MapScripts:: map_script MAP_SCRIPT_ON_LOAD, VictoryRoad_1F_OnLoad map_script MAP_SCRIPT_ON_TRANSITION, VictoryRoad_1F_OnTransition @@ -26,7 +28,7 @@ VictoryRoad_1F_EventScript_FloorSwitch:: playse SE_ICE_BREAK special DrawWholeMapView waitse - moveobjectoffscreen 5 + copyobjectxytoperm LOCALID_BOULDER setvar VAR_MAP_SCENE_VICTORY_ROAD_1F, 100 releaseall end diff --git a/data/maps/VictoryRoad_2F/scripts.inc b/data/maps/VictoryRoad_2F/scripts.inc index 46d259144..738c62818 100644 --- a/data/maps/VictoryRoad_2F/scripts.inc +++ b/data/maps/VictoryRoad_2F/scripts.inc @@ -1,3 +1,6 @@ +.set LOCALID_BOULDER1, 11 +.set LOCALID_BOULDER2, 12 + VictoryRoad_2F_MapScripts:: map_script MAP_SCRIPT_ON_LOAD, VictoryRoad_2F_OnLoad .byte 0 @@ -28,7 +31,7 @@ VictoryRoad_2F_EventScript_FloorSwitch1:: playse SE_ICE_BREAK special DrawWholeMapView waitse - moveobjectoffscreen 11 + copyobjectxytoperm LOCALID_BOULDER1 setvar VAR_MAP_SCENE_VICTORY_ROAD_2F_BOULDER1, 100 releaseall end @@ -46,7 +49,7 @@ VictoryRoad_2F_EventScript_FloorSwitch2:: playse SE_ICE_BREAK special DrawWholeMapView waitse - moveobjectoffscreen 12 + copyobjectxytoperm LOCALID_BOULDER2 setvar VAR_MAP_SCENE_VICTORY_ROAD_2F_BOULDER2, 100 releaseall end diff --git a/data/maps/VictoryRoad_3F/scripts.inc b/data/maps/VictoryRoad_3F/scripts.inc index 6348480b7..6a6ba11b7 100644 --- a/data/maps/VictoryRoad_3F/scripts.inc +++ b/data/maps/VictoryRoad_3F/scripts.inc @@ -1,3 +1,6 @@ +.set LOCALID_BOULDER1, 7 +.set LOCALID_BOULDER2, 10 + VictoryRoad_3F_MapScripts:: map_script MAP_SCRIPT_ON_LOAD, VictoryRoad_3F_OnLoad .byte 0 @@ -21,8 +24,8 @@ VictoryRoad_3F_EventScript_FloorSwitch:: playse SE_ICE_BREAK special DrawWholeMapView waitse - moveobjectoffscreen 7 - moveobjectoffscreen 10 + copyobjectxytoperm LOCALID_BOULDER1 + copyobjectxytoperm LOCALID_BOULDER2 setvar VAR_MAP_SCENE_VICTORY_ROAD_3F, 100 releaseall end diff --git a/data/mystery_event_msg.s b/data/mystery_event_msg.s index af7048be3..78c2e05f0 100644 --- a/data/mystery_event_msg.s +++ b/data/mystery_event_msg.s @@ -21,7 +21,7 @@ MysteryEventScript_StampCard:: setorcopyvar VAR_RESULT, 0 specialvar VAR_0x8009, BattleCardAction subvar VAR_0x8008, VAR_0x8009 - getnumberstring 0, VAR_0x8008 + buffernumberstring STR_VAR_1, VAR_0x8008 lock faceplayer vmessage sText_MysteryGiftStampCard @@ -39,7 +39,7 @@ sText_MysteryGiftStampCard: MysteryEventScript_SurfPichu:: setvaddress MysteryEventScript_SurfPichu vgoto_if_unset FLAG_MYSTERY_GIFT_DONE, SurfPichu_GiveIfPossible - gotoram + returnram SurfPichu_GiveIfPossible: specialvar VAR_EVENT_PICHU_SLOT, CalculatePlayerPartyCount diff --git a/data/script_cmd_table.inc b/data/script_cmd_table.inc index 11449b86f..0a9535ae9 100644 --- a/data/script_cmd_table.inc +++ b/data/script_cmd_table.inc @@ -1,219 +1,219 @@ .align 2 gScriptCmdTable:: - .4byte ScrCmd_nop - .4byte ScrCmd_nop1 - .4byte ScrCmd_end - .4byte ScrCmd_return - .4byte ScrCmd_call - .4byte ScrCmd_goto - .4byte ScrCmd_goto_if - .4byte ScrCmd_call_if - .4byte ScrCmd_gotostd - .4byte ScrCmd_callstd - .4byte ScrCmd_gotostd_if - .4byte ScrCmd_callstd_if - .4byte ScrCmd_gotoram - .4byte ScrCmd_killscript - .4byte ScrCmd_setmysteryeventstatus - .4byte ScrCmd_loadword - .4byte ScrCmd_loadbyte - .4byte ScrCmd_writebytetoaddr - .4byte ScrCmd_loadbytefromaddr - .4byte ScrCmd_setptrbyte - .4byte ScrCmd_copylocal - .4byte ScrCmd_copybyte - .4byte ScrCmd_setvar - .4byte ScrCmd_addvar - .4byte ScrCmd_subvar - .4byte ScrCmd_copyvar - .4byte ScrCmd_setorcopyvar - .4byte ScrCmd_compare_local_to_local - .4byte ScrCmd_compare_local_to_value - .4byte ScrCmd_compare_local_to_addr - .4byte ScrCmd_compare_addr_to_local - .4byte ScrCmd_compare_addr_to_value - .4byte ScrCmd_compare_addr_to_addr - .4byte ScrCmd_compare_var_to_value - .4byte ScrCmd_compare_var_to_var - .4byte ScrCmd_callnative - .4byte ScrCmd_gotonative - .4byte ScrCmd_special - .4byte ScrCmd_specialvar - .4byte ScrCmd_waitstate - .4byte ScrCmd_delay - .4byte ScrCmd_setflag - .4byte ScrCmd_clearflag - .4byte ScrCmd_checkflag - .4byte ScrCmd_initclock - .4byte ScrCmd_dodailyevents - .4byte ScrCmd_gettime - .4byte ScrCmd_playse - .4byte ScrCmd_waitse - .4byte ScrCmd_playfanfare - .4byte ScrCmd_waitfanfare - .4byte ScrCmd_playbgm - .4byte ScrCmd_savebgm - .4byte ScrCmd_fadedefaultbgm - .4byte ScrCmd_fadenewbgm - .4byte ScrCmd_fadeoutbgm - .4byte ScrCmd_fadeinbgm - .4byte ScrCmd_warp - .4byte ScrCmd_warpsilent - .4byte ScrCmd_warpdoor - .4byte ScrCmd_warphole - .4byte ScrCmd_warpteleport - .4byte ScrCmd_setwarp - .4byte ScrCmd_setdynamicwarp - .4byte ScrCmd_setdivewarp - .4byte ScrCmd_setholewarp - .4byte ScrCmd_getplayerxy - .4byte ScrCmd_getpartysize - .4byte ScrCmd_additem - .4byte ScrCmd_removeitem - .4byte ScrCmd_checkitemspace - .4byte ScrCmd_checkitem - .4byte ScrCmd_checkitemtype - .4byte ScrCmd_addpcitem - .4byte ScrCmd_checkpcitem - .4byte ScrCmd_givedecoration - .4byte ScrCmd_takedecoration - .4byte ScrCmd_checkdecor - .4byte ScrCmd_checkdecorspace - .4byte ScrCmd_applymovement - .4byte ScrCmd_applymovement_at - .4byte ScrCmd_waitmovement - .4byte ScrCmd_waitmovement_at - .4byte ScrCmd_removeobject - .4byte ScrCmd_removeobject_at - .4byte ScrCmd_addobject - .4byte ScrCmd_addobject_at - .4byte ScrCmd_setobjectxy - .4byte ScrCmd_showobject_at - .4byte ScrCmd_hideobject_at - .4byte ScrCmd_faceplayer - .4byte ScrCmd_turnobject - .4byte ScrCmd_trainerbattle - .4byte ScrCmd_dotrainerbattle - .4byte ScrCmd_gotopostbattlescript - .4byte ScrCmd_gotobeatenscript - .4byte ScrCmd_checktrainerflag - .4byte ScrCmd_settrainerflag - .4byte ScrCmd_cleartrainerflag - .4byte ScrCmd_setobjectxyperm - .4byte ScrCmd_moveobjectoffscreen - .4byte ScrCmd_setobjectmovementtype - .4byte ScrCmd_waitmessage - .4byte ScrCmd_message - .4byte ScrCmd_closemessage - .4byte ScrCmd_lockall - .4byte ScrCmd_lock - .4byte ScrCmd_releaseall - .4byte ScrCmd_release - .4byte ScrCmd_waitbuttonpress - .4byte ScrCmd_yesnobox - .4byte ScrCmd_multichoice - .4byte ScrCmd_multichoicedefault - .4byte ScrCmd_multichoicegrid - .4byte ScrCmd_drawbox - .4byte ScrCmd_erasebox - .4byte ScrCmd_drawboxtext - .4byte ScrCmd_showmonpic - .4byte ScrCmd_hidemonpic - .4byte ScrCmd_showcontestwinner - .4byte ScrCmd_braillemessage - .4byte ScrCmd_givemon - .4byte ScrCmd_giveegg - .4byte ScrCmd_setmonmove - .4byte ScrCmd_checkpartymove - .4byte ScrCmd_bufferspeciesname - .4byte ScrCmd_bufferleadmonspeciesname - .4byte ScrCmd_bufferpartymonnick - .4byte ScrCmd_bufferitemname - .4byte ScrCmd_bufferdecorationname - .4byte ScrCmd_buffermovename - .4byte ScrCmd_buffernumberstring - .4byte ScrCmd_bufferstdstring - .4byte ScrCmd_bufferstring - .4byte ScrCmd_pokemart - .4byte ScrCmd_pokemartdecoration - .4byte ScrCmd_pokemartdecoration2 - .4byte ScrCmd_playslotmachine - .4byte ScrCmd_setberrytree - .4byte ScrCmd_choosecontestmon - .4byte ScrCmd_startcontest - .4byte ScrCmd_showcontestresults - .4byte ScrCmd_contestlinktransfer - .4byte ScrCmd_random - .4byte ScrCmd_addmoney - .4byte ScrCmd_removemoney - .4byte ScrCmd_checkmoney - .4byte ScrCmd_showmoneybox - .4byte ScrCmd_hidemoneybox - .4byte ScrCmd_updatemoneybox - .4byte ScrCmd_getpricereduction - .4byte ScrCmd_fadescreen - .4byte ScrCmd_fadescreenspeed - .4byte ScrCmd_setflashradius - .4byte ScrCmd_animateflash - .4byte ScrCmd_messageautoscroll - .4byte ScrCmd_dofieldeffect - .4byte ScrCmd_setfieldeffectarg - .4byte ScrCmd_waitfieldeffect - .4byte ScrCmd_setrespawn - .4byte ScrCmd_checkplayergender - .4byte ScrCmd_playmoncry - .4byte ScrCmd_setmetatile - .4byte ScrCmd_resetweather - .4byte ScrCmd_setweather - .4byte ScrCmd_doweather - .4byte ScrCmd_setstepcallback - .4byte ScrCmd_setmaplayoutindex - .4byte ScrCmd_setobjectpriority - .4byte ScrCmd_resetobjectpriority - .4byte ScrCmd_createvobject - .4byte ScrCmd_turnvobject - .4byte ScrCmd_opendoor - .4byte ScrCmd_closedoor - .4byte ScrCmd_waitdooranim - .4byte ScrCmd_setdooropen - .4byte ScrCmd_setdoorclosed - .4byte ScrCmd_addelevmenuitem - .4byte ScrCmd_showelevmenu - .4byte ScrCmd_checkcoins - .4byte ScrCmd_addcoins - .4byte ScrCmd_removecoins - .4byte ScrCmd_setwildbattle - .4byte ScrCmd_dowildbattle - .4byte ScrCmd_setvaddress - .4byte ScrCmd_vgoto - .4byte ScrCmd_vcall - .4byte ScrCmd_vgoto_if - .4byte ScrCmd_vcall_if - .4byte ScrCmd_vmessage - .4byte ScrCmd_vloadword - .4byte ScrCmd_vbufferstring - .4byte ScrCmd_showcoinsbox - .4byte ScrCmd_hidecoinsbox - .4byte ScrCmd_updatecoinsbox - .4byte ScrCmd_incrementgamestat - .4byte ScrCmd_setescapewarp - .4byte ScrCmd_waitmoncry - .4byte ScrCmd_bufferboxname - .4byte ScrCmd_textcolor - .4byte ScrCmd_loadhelp - .4byte ScrCmd_unloadhelp - .4byte ScrCmd_signmsg - .4byte ScrCmd_normalmsg - .4byte ScrCmd_comparestattoword - .4byte ScrCmd_setmoneventlegal - .4byte ScrCmd_checkmoneventlegal - .4byte ScrCmd_execram - .4byte ScrCmd_setworldmapflag - .4byte ScrCmd_warpteleport2 - .4byte ScrCmd_setmonmetlocation - .4byte ScrCmd_getbraillestringwidth - .4byte ScrCmd_bufferitemnameplural + .4byte ScrCmd_nop @ 0x00 + .4byte ScrCmd_nop1 @ 0x01 + .4byte ScrCmd_end @ 0x02 + .4byte ScrCmd_return @ 0x03 + .4byte ScrCmd_call @ 0x04 + .4byte ScrCmd_goto @ 0x05 + .4byte ScrCmd_goto_if @ 0x06 + .4byte ScrCmd_call_if @ 0x07 + .4byte ScrCmd_gotostd @ 0x08 + .4byte ScrCmd_callstd @ 0x09 + .4byte ScrCmd_gotostd_if @ 0x0a + .4byte ScrCmd_callstd_if @ 0x0b + .4byte ScrCmd_returnram @ 0x0c + .4byte ScrCmd_endram @ 0x0d + .4byte ScrCmd_setmysteryeventstatus @ 0x0e + .4byte ScrCmd_loadword @ 0x0f + .4byte ScrCmd_loadbyte @ 0x10 + .4byte ScrCmd_setptr @ 0x11 + .4byte ScrCmd_loadbytefromptr @ 0x12 + .4byte ScrCmd_setptrbyte @ 0x13 + .4byte ScrCmd_copylocal @ 0x14 + .4byte ScrCmd_copybyte @ 0x15 + .4byte ScrCmd_setvar @ 0x16 + .4byte ScrCmd_addvar @ 0x17 + .4byte ScrCmd_subvar @ 0x18 + .4byte ScrCmd_copyvar @ 0x19 + .4byte ScrCmd_setorcopyvar @ 0x1a + .4byte ScrCmd_compare_local_to_local @ 0x1b + .4byte ScrCmd_compare_local_to_value @ 0x1c + .4byte ScrCmd_compare_local_to_ptr @ 0x1d + .4byte ScrCmd_compare_ptr_to_local @ 0x1e + .4byte ScrCmd_compare_ptr_to_value @ 0x1f + .4byte ScrCmd_compare_ptr_to_ptr @ 0x20 + .4byte ScrCmd_compare_var_to_value @ 0x21 + .4byte ScrCmd_compare_var_to_var @ 0x22 + .4byte ScrCmd_callnative @ 0x23 + .4byte ScrCmd_gotonative @ 0x24 + .4byte ScrCmd_special @ 0x25 + .4byte ScrCmd_specialvar @ 0x26 + .4byte ScrCmd_waitstate @ 0x27 + .4byte ScrCmd_delay @ 0x28 + .4byte ScrCmd_setflag @ 0x29 + .4byte ScrCmd_clearflag @ 0x2a + .4byte ScrCmd_checkflag @ 0x2b + .4byte ScrCmd_initclock @ 0x2c + .4byte ScrCmd_dotimebasedevents @ 0x2d + .4byte ScrCmd_gettime @ 0x2e + .4byte ScrCmd_playse @ 0x2f + .4byte ScrCmd_waitse @ 0x30 + .4byte ScrCmd_playfanfare @ 0x31 + .4byte ScrCmd_waitfanfare @ 0x32 + .4byte ScrCmd_playbgm @ 0x33 + .4byte ScrCmd_savebgm @ 0x34 + .4byte ScrCmd_fadedefaultbgm @ 0x35 + .4byte ScrCmd_fadenewbgm @ 0x36 + .4byte ScrCmd_fadeoutbgm @ 0x37 + .4byte ScrCmd_fadeinbgm @ 0x38 + .4byte ScrCmd_warp @ 0x39 + .4byte ScrCmd_warpsilent @ 0x3a + .4byte ScrCmd_warpdoor @ 0x3b + .4byte ScrCmd_warphole @ 0x3c + .4byte ScrCmd_warpteleport @ 0x3d + .4byte ScrCmd_setwarp @ 0x3e + .4byte ScrCmd_setdynamicwarp @ 0x3f + .4byte ScrCmd_setdivewarp @ 0x40 + .4byte ScrCmd_setholewarp @ 0x41 + .4byte ScrCmd_getplayerxy @ 0x42 + .4byte ScrCmd_getpartysize @ 0x43 + .4byte ScrCmd_additem @ 0x44 + .4byte ScrCmd_removeitem @ 0x45 + .4byte ScrCmd_checkitemspace @ 0x46 + .4byte ScrCmd_checkitem @ 0x47 + .4byte ScrCmd_checkitemtype @ 0x48 + .4byte ScrCmd_addpcitem @ 0x49 + .4byte ScrCmd_checkpcitem @ 0x4a + .4byte ScrCmd_adddecoration @ 0x4b + .4byte ScrCmd_removedecoration @ 0x4c + .4byte ScrCmd_checkdecor @ 0x4d + .4byte ScrCmd_checkdecorspace @ 0x4e + .4byte ScrCmd_applymovement @ 0x4f + .4byte ScrCmd_applymovementat @ 0x50 + .4byte ScrCmd_waitmovement @ 0x51 + .4byte ScrCmd_waitmovementat @ 0x52 + .4byte ScrCmd_removeobject @ 0x53 + .4byte ScrCmd_removeobjectat @ 0x54 + .4byte ScrCmd_addobject @ 0x55 + .4byte ScrCmd_addobjectat @ 0x56 + .4byte ScrCmd_setobjectxy @ 0x57 + .4byte ScrCmd_showobjectat @ 0x58 + .4byte ScrCmd_hideobjectat @ 0x59 + .4byte ScrCmd_faceplayer @ 0x5a + .4byte ScrCmd_turnobject @ 0x5b + .4byte ScrCmd_trainerbattle @ 0x5c + .4byte ScrCmd_dotrainerbattle @ 0x5d + .4byte ScrCmd_gotopostbattlescript @ 0x5e + .4byte ScrCmd_gotobeatenscript @ 0x5f + .4byte ScrCmd_checktrainerflag @ 0x60 + .4byte ScrCmd_settrainerflag @ 0x61 + .4byte ScrCmd_cleartrainerflag @ 0x62 + .4byte ScrCmd_setobjectxyperm @ 0x63 + .4byte ScrCmd_copyobjectxytoperm @ 0x64 + .4byte ScrCmd_setobjectmovementtype @ 0x65 + .4byte ScrCmd_waitmessage @ 0x66 + .4byte ScrCmd_message @ 0x67 + .4byte ScrCmd_closemessage @ 0x68 + .4byte ScrCmd_lockall @ 0x69 + .4byte ScrCmd_lock @ 0x6a + .4byte ScrCmd_releaseall @ 0x6b + .4byte ScrCmd_release @ 0x6c + .4byte ScrCmd_waitbuttonpress @ 0x6d + .4byte ScrCmd_yesnobox @ 0x6e + .4byte ScrCmd_multichoice @ 0x6f + .4byte ScrCmd_multichoicedefault @ 0x70 + .4byte ScrCmd_multichoicegrid @ 0x71 + .4byte ScrCmd_drawbox @ 0x72 + .4byte ScrCmd_erasebox @ 0x73 + .4byte ScrCmd_drawboxtext @ 0x74 + .4byte ScrCmd_showmonpic @ 0x75 + .4byte ScrCmd_hidemonpic @ 0x76 + .4byte ScrCmd_showcontestpainting @ 0x77 + .4byte ScrCmd_braillemessage @ 0x78 + .4byte ScrCmd_givemon @ 0x79 + .4byte ScrCmd_giveegg @ 0x7a + .4byte ScrCmd_setmonmove @ 0x7b + .4byte ScrCmd_checkpartymove @ 0x7c + .4byte ScrCmd_bufferspeciesname @ 0x7d + .4byte ScrCmd_bufferleadmonspeciesname @ 0x7e + .4byte ScrCmd_bufferpartymonnick @ 0x7f + .4byte ScrCmd_bufferitemname @ 0x80 + .4byte ScrCmd_bufferdecorationname @ 0x81 + .4byte ScrCmd_buffermovename @ 0x82 + .4byte ScrCmd_buffernumberstring @ 0x83 + .4byte ScrCmd_bufferstdstring @ 0x84 + .4byte ScrCmd_bufferstring @ 0x85 + .4byte ScrCmd_pokemart @ 0x86 + .4byte ScrCmd_pokemartdecoration @ 0x87 + .4byte ScrCmd_pokemartdecoration2 @ 0x88 + .4byte ScrCmd_playslotmachine @ 0x8 + .4byte ScrCmd_setberrytree @ 0x8a + .4byte ScrCmd_choosecontestmon @ 0x8b + .4byte ScrCmd_startcontest @ 0x8c + .4byte ScrCmd_showcontestresults @ 0x8d + .4byte ScrCmd_contestlinktransfer @ 0x8e + .4byte ScrCmd_random @ 0x8f + .4byte ScrCmd_addmoney @ 0x90 + .4byte ScrCmd_removemoney @ 0x91 + .4byte ScrCmd_checkmoney @ 0x92 + .4byte ScrCmd_showmoneybox @ 0x93 + .4byte ScrCmd_hidemoneybox @ 0x94 + .4byte ScrCmd_updatemoneybox @ 0x95 + .4byte ScrCmd_getpokenewsactive @ 0x96 + .4byte ScrCmd_fadescreen @ 0x97 + .4byte ScrCmd_fadescreenspeed @ 0x98 + .4byte ScrCmd_setflashlevel @ 0x99 + .4byte ScrCmd_animateflash @ 0x9a + .4byte ScrCmd_messageautoscroll @ 0x9b + .4byte ScrCmd_dofieldeffect @ 0x9c + .4byte ScrCmd_setfieldeffectargument @ 0x9d + .4byte ScrCmd_waitfieldeffect @ 0x9e + .4byte ScrCmd_setrespawn @ 0x9f + .4byte ScrCmd_checkplayergender @ 0xa0 + .4byte ScrCmd_playmoncry @ 0xa1 + .4byte ScrCmd_setmetatile @ 0xa2 + .4byte ScrCmd_resetweather @ 0xa3 + .4byte ScrCmd_setweather @ 0xa4 + .4byte ScrCmd_doweather @ 0xa5 + .4byte ScrCmd_setstepcallback @ 0xa6 + .4byte ScrCmd_setmaplayoutindex @ 0xa7 + .4byte ScrCmd_setobjectsubpriority @ 0xa8 + .4byte ScrCmd_resetobjectsubpriority @ 0xa9 + .4byte ScrCmd_createvobject @ 0xaa + .4byte ScrCmd_turnvobject @ 0xab + .4byte ScrCmd_opendoor @ 0xac + .4byte ScrCmd_closedoor @ 0xad + .4byte ScrCmd_waitdooranim @ 0xae + .4byte ScrCmd_setdooropen @ 0xaf + .4byte ScrCmd_setdoorclosed @ 0xb0 + .4byte ScrCmd_addelevmenuitem @ 0xb1 + .4byte ScrCmd_showelevmenu @ 0xb2 + .4byte ScrCmd_checkcoins @ 0xb3 + .4byte ScrCmd_addcoins @ 0xb4 + .4byte ScrCmd_removecoins @ 0xb5 + .4byte ScrCmd_setwildbattle @ 0xb6 + .4byte ScrCmd_dowildbattle @ 0xb7 + .4byte ScrCmd_setvaddress @ 0xb8 + .4byte ScrCmd_vgoto @ 0xb9 + .4byte ScrCmd_vcall @ 0xba + .4byte ScrCmd_vgoto_if @ 0xbb + .4byte ScrCmd_vcall_if @ 0xbc + .4byte ScrCmd_vmessage @ 0xbd + .4byte ScrCmd_vbuffermessage @ 0xbe + .4byte ScrCmd_vbufferstring @ 0xbf + .4byte ScrCmd_showcoinsbox @ 0xc0 + .4byte ScrCmd_hidecoinsbox @ 0xc1 + .4byte ScrCmd_updatecoinsbox @ 0xc2 + .4byte ScrCmd_incrementgamestat @ 0xc3 + .4byte ScrCmd_setescapewarp @ 0xc4 + .4byte ScrCmd_waitmoncry @ 0xc5 + .4byte ScrCmd_bufferboxname @ 0xc6 + .4byte ScrCmd_textcolor @ 0xc7 + .4byte ScrCmd_loadhelp @ 0xc8 + .4byte ScrCmd_unloadhelp @ 0xc9 + .4byte ScrCmd_signmsg @ 0xca + .4byte ScrCmd_normalmsg @ 0xcb + .4byte ScrCmd_comparestattoword @ 0xcc + .4byte ScrCmd_setmoneventlegal @ 0xcd + .4byte ScrCmd_checkmoneventlegal @ 0xce + .4byte ScrCmd_trywondercardscript @ 0xcf + .4byte ScrCmd_setworldmapflag @ 0xd0 + .4byte ScrCmd_warpspinenter @ 0xd1 + .4byte ScrCmd_setmonmetlocation @ 0xd2 + .4byte ScrCmd_getbraillestringwidth @ 0xd3 + .4byte ScrCmd_bufferitemnameplural @ 0xd4 gScriptCmdTableEnd:: .4byte ScrCmd_nop diff --git a/data/scripts/cable_club.inc b/data/scripts/cable_club.inc index 4774025e8..dec8d1cb6 100644 --- a/data/scripts/cable_club.inc +++ b/data/scripts/cable_club.inc @@ -16,7 +16,7 @@ EventScript_HideMysteryGiftMan:: CableClub_EventScript_MysteryGiftMan:: goto_if_questlog EventScript_ReleaseEnd special QuestLog_CutRecording - execram + trywondercardscript @ Unused EventScript_MysteryGiftThankYou:: @@ -323,7 +323,7 @@ CableClub_EventScript_EnterColosseum:: waitdooranim applymovement OBJ_EVENT_ID_PLAYER, Movement_PlayerEnterLinkRoom waitmovement 0 - hideobject OBJ_EVENT_ID_PLAYER, 0 + hideobjectat OBJ_EVENT_ID_PLAYER, 0 closedoor 9, 1 waitdooranim release @@ -432,7 +432,7 @@ CableClub_EventScript_EnterTradeCenter:: waitdooranim applymovement OBJ_EVENT_ID_PLAYER, Movement_PlayerEnterLinkRoom waitmovement 0 - hideobject OBJ_EVENT_ID_PLAYER, 0 + hideobjectat OBJ_EVENT_ID_PLAYER, 0 closedoor 9, 1 waitdooranim release @@ -831,12 +831,12 @@ CableClub_EventScript_EnterUnionRoom:: waitdooranim applymovement OBJ_EVENT_ID_PLAYER, Movement_PlayerEnterLinkRoom waitmovement 0 - hideobject OBJ_EVENT_ID_PLAYER, 0 + hideobjectat OBJ_EVENT_ID_PLAYER, 0 closedoor 5, 1 waitdooranim special Script_ResetUnionRoomTrade special SetCableClubWarp - warpteleport2 MAP_UNION_ROOM, 255, 7, 11 + warpspinenter MAP_UNION_ROOM, 255, 7, 11 waitstate special UnionRoomSpecial waitstate @@ -1137,7 +1137,7 @@ CableClub_EventScript_EnterWirelessLinkRoom:: waitdooranim applymovement OBJ_EVENT_ID_PLAYER, Movement_PlayerEnterLinkRoom waitmovement 0 - hideobject OBJ_EVENT_ID_PLAYER, 0 + hideobjectat OBJ_EVENT_ID_PLAYER, 0 closedoor 9, 1 waitdooranim release @@ -1331,7 +1331,7 @@ CableClub_EventScript_EnterMinigame:: closemessage applymovement OBJ_EVENT_ID_PLAYER, Movement_PlayerEnterMinigameRoom waitmovement 0 - hideobject OBJ_EVENT_ID_PLAYER, 0 + hideobjectat OBJ_EVENT_ID_PLAYER, 0 release waitstate end diff --git a/data/scripts/day_care.inc b/data/scripts/day_care.inc index febf7aa28..e227cbf52 100644 --- a/data/scripts/day_care.inc +++ b/data/scripts/day_care.inc @@ -19,7 +19,7 @@ Route5_PokemonDayCare_EventScript_TryGiveMon:: goto_if_eq Route5_PokemonDayCare_EventScript_OnlyOneMonInParty msgbox Route5_PokemonDayCare_Text_WhichMonShouldIRaise fadescreen FADE_TO_BLACK - hidemoneybox 0, 0 + hidemoneybox special ChooseSendDaycareMon waitstate showmoneybox 0, 0, 0 @@ -91,11 +91,11 @@ Route5_PokemonDayCare_EventScript_RetrieveMon:: setvar VAR_0x8004, 0 specialvar VAR_RESULT, TakePokemonFromRoute5Daycare special SubtractMoneyFromVar0x8005 - updatemoneybox 0, 0, 0 + updatemoneybox copyvar VAR_0x8008, VAR_RESULT getpartysize subvar VAR_RESULT, 1 - getpartymonname 0, VAR_RESULT + bufferpartymonnick STR_VAR_1, VAR_RESULT copyvar VAR_RESULT, VAR_0x8008 msgbox Route5_PokemonDayCare_Text_ThankYouHeresMon textcolor 3 @@ -113,7 +113,7 @@ Route5_PokemonDayCare_EventScript_NoRoomInParty:: end Route5_PokemonDayCare_EventScript_CloseMoneyBox:: - hidemoneybox 0, 0 + hidemoneybox release end diff --git a/data/scripts/field_moves.inc b/data/scripts/field_moves.inc index 74a93e8af..80e8ba366 100644 --- a/data/scripts/field_moves.inc +++ b/data/scripts/field_moves.inc @@ -5,9 +5,9 @@ EventScript_CutTree:: checkpartymove MOVE_CUT compare VAR_RESULT, PARTY_SIZE goto_if_eq EventScript_CantCutTree - setfieldeffectarg 0, VAR_RESULT - getpartymonname 0, VAR_RESULT - getmovename 1, MOVE_CUT + setfieldeffectargument 0, VAR_RESULT + bufferpartymonnick STR_VAR_1, VAR_RESULT + buffermovename STR_VAR_2, MOVE_CUT msgbox Text_CutTreeDown, MSGBOX_YESNO compare VAR_RESULT, NO goto_if_eq EventScript_DontCutTree @@ -65,9 +65,9 @@ EventScript_RockSmash:: checkpartymove MOVE_ROCK_SMASH compare VAR_RESULT, PARTY_SIZE goto_if_eq EventScript_CantSmashRock - setfieldeffectarg 0, VAR_RESULT - getpartymonname 0, VAR_RESULT - getmovename 1, MOVE_ROCK_SMASH + setfieldeffectargument 0, VAR_RESULT + bufferpartymonnick STR_VAR_1, VAR_RESULT + buffermovename STR_VAR_2, MOVE_ROCK_SMASH msgbox Text_UseRockSmash, MSGBOX_YESNO compare VAR_RESULT, NO goto_if_eq EventScript_DontSmashRock @@ -129,7 +129,7 @@ EventScript_StrengthBoulder:: checkpartymove MOVE_STRENGTH compare VAR_RESULT, PARTY_SIZE goto_if_eq EventScript_CantMoveBoulder - setfieldeffectarg 0, VAR_RESULT + setfieldeffectargument 0, VAR_RESULT msgbox Text_UseStrength, MSGBOX_YESNO compare VAR_RESULT, NO goto_if_eq EventScript_DontUseStrength @@ -188,8 +188,8 @@ EventScript_Waterfall:: checkpartymove MOVE_WATERFALL compare VAR_RESULT, PARTY_SIZE goto_if_eq EventScript_WaterCrashingDown - getpartymonname 0, VAR_RESULT - setfieldeffectarg 0, VAR_RESULT + bufferpartymonnick STR_VAR_1, VAR_RESULT + setfieldeffectargument 0, VAR_RESULT msgbox Text_UseWaterfall, MSGBOX_YESNO compare VAR_RESULT, NO goto_if_eq EventScript_EndWaterfall @@ -222,9 +222,9 @@ EventScript_DeepWater:: checkpartymove MOVE_DIVE compare VAR_RESULT, PARTY_SIZE goto_if_eq EventScript_MayGoUnderwater - getpartymonname 0, VAR_RESULT - setfieldeffectarg 0, VAR_RESULT - setfieldeffectarg 1, 1 + bufferpartymonnick STR_VAR_1, VAR_RESULT + setfieldeffectargument 0, VAR_RESULT + setfieldeffectargument 1, 1 msgbox Text_SeaIsDeepUseDive, MSGBOX_YESNO compare VAR_RESULT, NO goto_if_eq EventScript_EndDive @@ -245,9 +245,9 @@ EventScript_TrySurface:: checkpartymove MOVE_DIVE compare VAR_RESULT, PARTY_SIZE goto_if_eq EventScript_CantSurface - getpartymonname 0, VAR_RESULT - setfieldeffectarg 0, VAR_RESULT - setfieldeffectarg 1, 1 + bufferpartymonnick STR_VAR_1, VAR_RESULT + setfieldeffectargument 0, VAR_RESULT + setfieldeffectargument 1, 1 msgbox Text_LightFilteringUseDive, MSGBOX_YESNO compare VAR_RESULT, NO goto_if_eq EventScript_EndSurface diff --git a/data/scripts/flash.inc b/data/scripts/flash.inc index 38b6db6cf..c30887d30 100644 --- a/data/scripts/flash.inc +++ b/data/scripts/flash.inc @@ -1,4 +1,4 @@ EventScript_FldEffFlash:: animateflash 0 - setflashradius 0 + setflashlevel 0 end diff --git a/data/scripts/move_tutors.inc b/data/scripts/move_tutors.inc index c1b5e4bab..711f6a5a3 100644 --- a/data/scripts/move_tutors.inc +++ b/data/scripts/move_tutors.inc @@ -455,7 +455,7 @@ TwoIsland_CapeBrink_House_EventScript_StarterTutor:: faceplayer goto_if_set FLAG_LEARNED_ALL_MOVES_AT_CAPE_BRINK, CapeBrinkTutor_EventScript_TaughtAllMoves goto_if_set FLAG_TEMP_2, CapeBrinkTutor_EventScript_MoveJustTaught - getfirstpartymonname 0 + bufferleadmonspeciesname STR_VAR_1 msgbox Text_UltimateMoveThatMon specialvar VAR_RESULT, CapeBrinkGetMoveToTeachLeadPokemon compare VAR_RESULT, FALSE diff --git a/data/scripts/obtain_item.inc b/data/scripts/obtain_item.inc index e4f49c9f6..87eace4e5 100644 --- a/data/scripts/obtain_item.inc +++ b/data/scripts/obtain_item.inc @@ -17,7 +17,7 @@ Std_ObtainItem:: return EventScript_ObtainItemMessage:: - bufferitemnameplural 1, VAR_0x8000, VAR_0x8001 + bufferitemnameplural STR_VAR_2, VAR_0x8000, VAR_0x8001 checkitemtype VAR_0x8000 call EventScript_BufferPocketNameTryFanfare compare VAR_0x8007, TRUE @@ -36,31 +36,31 @@ EventScript_BufferPocketNameTryFanfare:: end EventScript_BufferItemsPocket:: - getstdstring 2, STDSTRING_ITEMS_POCKET + bufferstdstring STR_VAR_3, STDSTRING_ITEMS_POCKET compare VAR_0x8007, TRUE call_if_eq EventScript_PlayFanfareObtainedItem return EventScript_BufferKeyItemsPocket:: - getstdstring 2, STDSTRING_KEY_ITEMS_POCKET + bufferstdstring STR_VAR_3, STDSTRING_KEY_ITEMS_POCKET compare VAR_0x8007, TRUE call_if_eq EventScript_PlayFanfareObtainedItem return EventScript_BufferPokeBallsPocket:: - getstdstring 2, STDSTRING_POKEBALLS_POCKET + bufferstdstring STR_VAR_3, STDSTRING_POKEBALLS_POCKET compare VAR_0x8007, TRUE call_if_eq EventScript_PlayFanfareObtainedItem return EventScript_BufferTMCase:: - getstdstring 2, STDSTRING_TM_CASE + bufferstdstring STR_VAR_3, STDSTRING_TM_CASE compare VAR_0x8007, TRUE call_if_eq EventScript_PlayFanfareObtainedTMHM return EventScript_BufferBerryPouch:: - getstdstring 2, STDSTRING_BERRY_POUCH + bufferstdstring STR_VAR_3, STDSTRING_BERRY_POUCH compare VAR_0x8007, TRUE call_if_eq EventScript_PlayFanfareObtainedItem return @@ -86,13 +86,13 @@ EventScript_PlayFanfareObtainedTMHM:: return Std_ObtainDecoration:: - adddecor VAR_0x8000 + adddecoration VAR_0x8000 copyvar VAR_0x8007, VAR_RESULT call EventScript_ObtainDecorMessage return EventScript_ObtainDecorMessage:: - getdecorname 1, VAR_0x8000 + bufferdecorationname STR_VAR_2, VAR_0x8000 compare VAR_0x8007, TRUE call_if_eq EventScript_ObtainedDecor compare VAR_0x8007, FALSE @@ -120,7 +120,7 @@ Std_FindItem:: copyvar VAR_0x8005, VAR_0x8001 checkitemspace VAR_0x8000, VAR_0x8001 copyvar VAR_0x8007, VAR_RESULT - getitemname 1, VAR_0x8000 + bufferitemname STR_VAR_2, VAR_0x8000 checkitemtype VAR_0x8000 call EventScript_BufferPocketNameTryFanfare compare VAR_0x8007, TRUE @@ -174,7 +174,7 @@ EventScript_HiddenItemScript:: EventScript_TryPickUpHiddenItem:: additem VAR_0x8005, VAR_0x8006 copyvar VAR_0x8007, VAR_RESULT - getitemname 1, VAR_0x8005 + bufferitemname STR_VAR_2, VAR_0x8005 checkitemtype VAR_0x8005 call EventScript_BufferPocketNameTryFanfare return @@ -196,12 +196,12 @@ EventScript_FoundSingleItem:: return EventScript_FoundCoins:: - getnumberstring 0, VAR_0x8006 + buffernumberstring STR_VAR_1, VAR_0x8006 message Text_FoundXCoins return EventScript_FoundMultipleItems:: - getnumberstring 0, VAR_0x8006 + buffernumberstring STR_VAR_1, VAR_0x8006 message Text_FoundXItems return @@ -219,7 +219,7 @@ EventScript_TryPickUpHiddenCoins:: compare VAR_RESULT, FALSE goto_if_eq EventScript_HiddenCoinsButCaseIsFull addcoins VAR_0x8006 - getstdstring 1, STDSTRING_COINS + bufferstdstring STR_VAR_2, STDSTRING_COINS call EventScript_PlayFanfareObtainedItem call EventScript_FoundCoins waitfanfare @@ -230,8 +230,8 @@ EventScript_TryPickUpHiddenCoins:: end EventScript_HiddenCoinsButCaseIsFull:: - getnumberstring 0, VAR_0x8006 - getstdstring 1, STDSTRING_COINS + buffernumberstring STR_VAR_1, VAR_0x8006 + bufferstdstring STR_VAR_2, STDSTRING_COINS msgbox Text_FoundXCoins msgbox Text_CoinCaseIsFull setvar VAR_RESULT, 0 @@ -239,8 +239,8 @@ EventScript_HiddenCoinsButCaseIsFull:: end EventScript_NoCaseForHiddenCoins:: - getnumberstring 0, VAR_0x8006 - getstdstring 1, STDSTRING_COINS + buffernumberstring STR_VAR_1, VAR_0x8006 + bufferstdstring STR_VAR_2, STDSTRING_COINS msgbox Text_FoundXCoins msgbox Text_NothingToPutThemIn setvar VAR_RESULT, 0 diff --git a/data/scripts/pc_transfer.inc b/data/scripts/pc_transfer.inc index 76df5f0ed..ae23eace5 100644 --- a/data/scripts/pc_transfer.inc +++ b/data/scripts/pc_transfer.inc @@ -13,8 +13,8 @@ EventScript_NameReceivedBoxMon:: return EventScript_TransferredToPC:: - bufferboxname 0, VAR_PC_BOX_TO_SEND_MON - getspeciesname 1, VAR_TEMP_1 + bufferboxname STR_VAR_1, VAR_PC_BOX_TO_SEND_MON + bufferspeciesname STR_VAR_2, VAR_TEMP_1 call_if_unset FLAG_SYS_NOT_SOMEONES_PC, EventScript_TransferredSomeonesPC call_if_set FLAG_SYS_NOT_SOMEONES_PC, EventScript_TransferredBillsPC return @@ -28,7 +28,7 @@ EventScript_TransferredSomeonesPC:: EventScript_TransferredSomeonesPCBoxFull:: specialvar VAR_RESULT, GetPCBoxToSendMon - bufferboxname 2, VAR_RESULT + bufferboxname STR_VAR_3, VAR_RESULT msgbox Text_MonSentToBoxSomeonesBoxFull return @@ -41,6 +41,6 @@ EventScript_TransferredBillsPC:: EventScript_TransferredBillsPCBoxFull:: specialvar VAR_RESULT, GetPCBoxToSendMon - bufferboxname 2, VAR_RESULT + bufferboxname STR_VAR_3, VAR_RESULT msgbox Text_MonSentToBoxBillsBoxFull return diff --git a/data/scripts/pokedex_rating.inc b/data/scripts/pokedex_rating.inc index 1e537f131..808659b08 100644 --- a/data/scripts/pokedex_rating.inc +++ b/data/scripts/pokedex_rating.inc @@ -43,8 +43,8 @@ PokedexRating_EventScript_Rate:: copyvar VAR_0x8008, VAR_0x8005 copyvar VAR_0x8009, VAR_0x8006 copyvar VAR_0x800A, VAR_RESULT - getnumberstring 0, VAR_0x8008 @ Num Kanto Seen - getnumberstring 1, VAR_0x8009 @ Num Kanto Caught + buffernumberstring STR_VAR_1, VAR_0x8008 @ Num Kanto Seen + buffernumberstring STR_VAR_2, VAR_0x8009 @ Num Kanto Caught msgbox PokedexRating_Text_SeenXOwnedY call_if_unset FLAG_OAKS_RATING_IS_VIA_PC, PokedexRating_EventScript_SetTextColor call PokedexRating_EventScript_ShowRatingMsg @@ -54,8 +54,8 @@ PokedexRating_EventScript_Rate:: specialvar VAR_RESULT, GetPokedexCount copyvar VAR_0x8008, VAR_0x8005 copyvar VAR_0x8009, VAR_0x8006 - getnumberstring 0, VAR_0x8008 @ Num National Seen - getnumberstring 1, VAR_0x8009 @ Num National Caught + buffernumberstring STR_VAR_1, VAR_0x8008 @ Num National Seen + buffernumberstring STR_VAR_2, VAR_0x8009 @ Num National Caught msgbox PokedexRating_Text_NationalDexSeenXOwnedY specialvar VAR_RESULT, HasAllMons compare VAR_RESULT, FALSE diff --git a/data/scripts/seagallop.inc b/data/scripts/seagallop.inc index fc82f71e3..d64ed41e7 100644 --- a/data/scripts/seagallop.inc +++ b/data/scripts/seagallop.inc @@ -90,7 +90,7 @@ EventScript_ChooseDestFromIslandVermilionAllowed:: EventScript_SailToDest:: specialvar VAR_RESULT, GetSeagallopNumber - getnumberstring 0, VAR_RESULT + buffernumberstring STR_VAR_1, VAR_RESULT compare VAR_0x8004, SEAGALLOP_VERMILION_CITY goto_if_eq EventScript_DepartingVermilion compare VAR_0x8004, SEAGALLOP_VERMILION_CITY diff --git a/data/scripts/static_pokemon.inc b/data/scripts/static_pokemon.inc index 38b5d0c07..ea443ea3e 100644 --- a/data/scripts/static_pokemon.inc +++ b/data/scripts/static_pokemon.inc @@ -9,7 +9,7 @@ EventScript_MonFlewAway:: fadescreen FADE_TO_BLACK removeobject VAR_LAST_TALKED fadescreen FADE_FROM_BLACK - getspeciesname 0, VAR_0x8004 + bufferspeciesname STR_VAR_1, VAR_0x8004 msgbox Text_MonFlewAway release end diff --git a/data/scripts/surf.inc b/data/scripts/surf.inc index 13d46e028..43a64b3fe 100644 --- a/data/scripts/surf.inc +++ b/data/scripts/surf.inc @@ -3,8 +3,8 @@ EventScript_UseSurf:: checkpartymove MOVE_SURF compare VAR_RESULT, PARTY_SIZE goto_if_eq EventScript_UseSurfEnd - getpartymonname 0, VAR_RESULT - setfieldeffectarg 0, VAR_RESULT + bufferpartymonnick STR_VAR_1, VAR_RESULT + setfieldeffectargument 0, VAR_RESULT lockall msgbox Text_WantToSurf, MSGBOX_YESNO compare VAR_RESULT, NO diff --git a/data/scripts/trainer_battle.inc b/data/scripts/trainer_battle.inc index 657b56b96..ca774d982 100644 --- a/data/scripts/trainer_battle.inc +++ b/data/scripts/trainer_battle.inc @@ -18,7 +18,7 @@ EventScript_TryDoNormalTrainerBattle:: goto EventScript_DoTrainerBattle EventScript_NoTrainerBattle:: - ontrainerbattleend + gotopostbattlescript EventScript_TryDoDoubleTrainerBattle:: lock @@ -42,15 +42,15 @@ EventScript_NotEnoughMonsForDoubleBattle:: end EventScript_NoDoubleTrainerBattle:: - ontrainerbattleend + gotopostbattlescript EventScript_DoNoIntroTrainerBattle:: applymovement VAR_LAST_TALKED, Movement_RevealTrainer waitmovement 0 special PlayTrainerEncounterMusic goto_if_questlog EventScript_EndQuestLogBattle - battlebegin - ontrainerbattleend + dotrainerbattle + gotopostbattlescript EventScript_TryDoRematchBattle:: call EventScript_RevealTrainer @@ -69,7 +69,7 @@ EventScript_TryDoRematchBattle:: end EventScript_NoRematchBattle:: - ontrainerbattleend + gotopostbattlescript EventScript_TryDoDoubleRematchBattle:: specialvar VAR_RESULT, IsTrainerReadyForRematch @@ -90,7 +90,7 @@ EventScript_TryDoDoubleRematchBattle:: end EventScript_NoDoubleRematchBattle:: - ontrainerbattleend + gotopostbattlescript EventScript_NotEnoughMonsForDoubleRematchBattle:: special ShowTrainerCantBattleSpeech @@ -117,7 +117,7 @@ EventScript_DoTrainerBattle:: waitmessage waitbuttonpress goto_if_questlog EventScript_EndQuestLogBattle - battlebegin + dotrainerbattle specialvar VAR_RESULT, GetTrainerBattleMode compare VAR_RESULT, TRAINER_BATTLE_SINGLE goto_if_eq EventScript_EndTrainerBattle @@ -134,7 +134,7 @@ EventScript_EndTrainerBattle:: end EventScript_EndTrainerBattleContinueScript:: - ontrainerbattleendgoto + gotobeatenscript EventScript_EndQuestLogBattle:: special SetBattledTrainerFlag diff --git a/data/scripts/trainer_card.inc b/data/scripts/trainer_card.inc index 933d7b800..6ba90358b 100644 --- a/data/scripts/trainer_card.inc +++ b/data/scripts/trainer_card.inc @@ -11,7 +11,7 @@ CeladonCity_GameCorner_EventScript_PhotoPrinter:: goto_if_eq CeladonCity_GameCorner_EventScript_NotEnoughMoneyForPhoto playse SE_SHOP removemoney 50, 0 - updatemoneybox 0, 0, 0 + updatemoneybox waitse message CeladonCity_GameCorner_Text_ChoosePrintType waitmessage @@ -51,18 +51,18 @@ CeladonCity_GameCorner_EventScript_PrintPhoto:: delay 60 special UpdateTrainerCardPhotoIcons msgbox CeladonCity_GameCorner_Text_PrintIsReadyCheckTrainerCard - hidemoneybox 0, 0 + hidemoneybox releaseall end CeladonCity_GameCorner_EventScript_DeclinePhoto:: - hidemoneybox 0, 0 + hidemoneybox releaseall end CeladonCity_GameCorner_EventScript_NotEnoughMoneyForPhoto:: msgbox CeladonCity_GameCorner_Text_DontHaveEnoughMoney - hidemoneybox 0, 0 + hidemoneybox releaseall end diff --git a/data/scripts/trainer_tower.inc b/data/scripts/trainer_tower.inc index 70a15b3ec..3c54a90c4 100644 --- a/data/scripts/trainer_tower.inc +++ b/data/scripts/trainer_tower.inc @@ -297,7 +297,7 @@ TrainerTower_Roof_EventScript_ReceivePrize: message Text_ObtainedTheX waitfanfare waitmessage - getstdstring 2, STDSTRING_ITEMS_POCKET + bufferstdstring STR_VAR_3, STDSTRING_ITEMS_POCKET msgbox Text_PutItemAway call EventScript_RestorePrevTextColor goto TrainerTower_Roof_EventScript_CheckFinalTime diff --git a/include/constants/maps.h b/include/constants/maps.h index 395b07f46..57cc1d078 100644 --- a/include/constants/maps.h +++ b/include/constants/maps.h @@ -12,4 +12,8 @@ #define MAP(map) MAP_GROUP(map), MAP_NUM(map) +// Used to indicate an invalid warp id, for dummy warps or when a warp should +// use the given coordinates rather than the coordinates of a target warp. +#define WARP_ID_NONE (-1) + #endif // GUARD_CONSTANTS_MAPS_H diff --git a/include/event_object_lock.h b/include/event_object_lock.h index b7beeb070..43ce97173 100644 --- a/include/event_object_lock.h +++ b/include/event_object_lock.h @@ -3,10 +3,10 @@ #include "global.h" -bool8 NativeScript_WaitPlayerStopMoving(void); -void ScriptFreezeObjectEvents(void); -bool8 NativeScript_WaitPlayerAndTargetNPCStopMoving(void); -void LockSelectedObjectEvent(void); +bool8 IsFreezePlayerFinished(void); +void FreezeObjects_WaitForPlayer(void); +bool8 IsFreezeSelectedObjectAndPlayerFinished(void); +void FreezeObjects_WaitForPlayerAndSelected(void); void ClearPlayerHeldMovementAndUnfreezeObjectEvents(void); bool8 walkrun_is_standing_still(void); void UnionRoom_UnlockPlayerAndChatPartner(void); diff --git a/include/event_object_movement.h b/include/event_object_movement.h index 10ee23172..b59fb209b 100644 --- a/include/event_object_movement.h +++ b/include/event_object_movement.h @@ -76,7 +76,7 @@ void SetSpritePosToOffsetMapCoords(s16 *, s16 *, s16, s16); void ObjectEventClearHeldMovement(struct ObjectEvent *); void ObjectEventClearHeldMovementIfActive(struct ObjectEvent *); void SpawnObjectEventsInView(s16, s16); -u8 sprite_new(u8, u8, s16, s16, u8, u8); +u8 CreateVirtualObject(u8, u8, s16, s16, u8, u8); u8 AddPseudoObjectEvent(u16, SpriteCallback, s16, s16, u8); u8 TrySpawnObjectEvent(u8 localId, u8 mapNum, u8 mapGroup); int SpawnSpecialObjectEventParameterized(u8, u8, u8, s16, s16, u8); @@ -88,11 +88,11 @@ void ObjectEventTurn(struct ObjectEvent *, u8); void ObjectEventTurnByLocalIdAndMap(u8, u8, u8, u8); void ObjectEventForceSetHeldMovement(struct ObjectEvent *, u8); const struct ObjectEventGraphicsInfo *GetObjectEventGraphicsInfo(u8); -void ShowOrHideObjectByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup, u8 state); +void SetObjectInvisibility(u8 localId, u8 mapNum, u8 mapGroup, u8 state); void FreeAndReserveObjectSpritePalettes(void); void SetObjectPositionByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup, s16 x, s16 y); -void UnfixObjectPriorityByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup); -void SetObjectPriorityByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup, u8 subpriority); +void ResetObjectSubpriority(u8 localId, u8 mapNum, u8 mapGroup); +void SetObjectSubpriority(u8 localId, u8 mapNum, u8 mapGroup, u8 subpriority); void ObjectEventGetLocalIdAndMap(struct ObjectEvent *objectEvent, void *localId, void *mapNum, void *mapGroup); void ShiftObjectEventCoords(struct ObjectEvent *, s16, s16); void TryOverrideObjectEventTemplateCoords(u8, u8, u8); @@ -138,7 +138,7 @@ bool8 UpdateWalkSlowerAnim(struct Sprite *sprite); void SetJumpSpriteData(struct Sprite *, u8, u8, u8); u8 DoJumpSpriteMovement(struct Sprite *); u8 DoJumpSpecialSpriteMovement(struct Sprite *); -void TurnObjectEvent(u8, u8); +void TurnVirtualObject(u8, u8); const u8 *GetObjectEventScriptPointerByObjectEventId(u8 objectEventId); u8 GetFirstInactiveObjectEventId(void); u8 GetCollisionFlagsAtCoords(struct ObjectEvent * objectEvent, s16 x, s16 y, u8 direction); diff --git a/include/field_weather.h b/include/field_weather.h index 7bb7b2677..77308d135 100644 --- a/include/field_weather.h +++ b/include/field_weather.h @@ -113,11 +113,11 @@ extern struct Weather *const gWeatherPtr; void FadeScreen(u8 mode, s8 delay); -void SetSav1Weather(u32); +void SetSavedWeather(u32); u8 GetSav1Weather(void); void DoCurrentWeather(void); -void SetSav1WeatherFromCurrMapHeader(void); +void SetSavedWeatherFromCurrMapHeader(void); void SlightlyDarkenPalsInWeather(u16 *, u16 *, u32); void PlayRainStoppingSoundEffect(void); bool8 IsWeatherNotFadingIn(void); diff --git a/include/fieldmap.h b/include/fieldmap.h index 1dcc5d793..91e976294 100644 --- a/include/fieldmap.h +++ b/include/fieldmap.h @@ -12,6 +12,14 @@ #define MAX_MAP_DATA_SIZE 0x2800 #define VIRTUAL_MAP_SIZE (MAX_MAP_DATA_SIZE) +// Map coordinates are offset by 7 when using the map +// buffer because it needs to load sufficient border +// metatiles to fill the player's view (the player has +// 7 metatiles of view horizontally in either direction). +#define MAP_OFFSET 7 +#define MAP_OFFSET_W (MAP_OFFSET * 2 + 1) +#define MAP_OFFSET_H (MAP_OFFSET * 2) + extern struct BackupMapLayout VMap; extern const struct MapLayout Route1_Layout; diff --git a/include/overworld.h b/include/overworld.h index 90db48772..56e656f07 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -60,8 +60,8 @@ extern u8 gLocalLinkPlayerId; void IncrementGameStat(u8 index); -void Overworld_SetMapObjTemplateCoords(u8, s16, s16); -void Overworld_SetObjEventTemplateMovementType(u8, u8); +void SetObjEventTemplateCoords(u8, s16, s16); +void SetObjEventTemplateMovementType(u8, u8); void SetWarpDestination(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); @@ -77,7 +77,7 @@ u8 IsMapTypeOutdoors(u8 mapType); void Overworld_ClearSavedMusic(void); bool32 Overworld_MusicCanOverrideMapMusic(u16 song); -void Overworld_SetFlashLevel(s32 a1); +void SetFlashLevel(s32 a1); u8 Overworld_GetFlashLevel(void); void Overworld_SetSavedMusic(u16); diff --git a/include/script.h b/include/script.h index acb2d55e3..cd3268181 100644 --- a/include/script.h +++ b/include/script.h @@ -61,7 +61,7 @@ bool8 InitRamScript(u8 *script, u16 scriptSize, u8 mapGroup, u8 mapNum, u8 objec const u8 *GetRamScript(u8 objectId, const u8 *script); bool32 ValidateRamScript(void); void MEventSetRamScript(u8 * script, u16 scriptSize); -u8 * sub_8069E48(void); +u8 * GetSavedRamScriptIfValid(void); void RegisterQuestLogInput(u8 var); void ClearMsgBoxCancelableState(void); void SetQuestLogInputIsDpadFlag(void); diff --git a/include/script_menu.h b/include/script_menu.h index 006ce5578..3b62f459e 100644 --- a/include/script_menu.h +++ b/include/script_menu.h @@ -13,7 +13,7 @@ bool8 ScriptMenu_ShowPokemonPic(u16 var1, u8 var2, u8 var3); bool8 CreatePCMenu(void); void ScriptMenu_DisplayPCStartupPrompt(void); -bool8 (*ScriptMenu_GetPicboxWaitFunc(void))(void); +bool8 (*ScriptMenu_HidePokemonPic(void))(void); void QLPlaybackCB_DestroyScriptMenuMonPicSprites(void); void PicboxCancel(void); diff --git a/include/text.h b/include/text.h index d0c7f8f54..a20da3b10 100644 --- a/include/text.h +++ b/include/text.h @@ -169,7 +169,7 @@ enum { FONT_3, FONT_4, FONT_5, - FONT_6, + FONT_BRAILLE, }; enum diff --git a/src/event_object_lock.c b/src/event_object_lock.c index 073e243a1..e9adbb680 100644 --- a/src/event_object_lock.c +++ b/src/event_object_lock.c @@ -23,7 +23,7 @@ void Task_WaitPlayerStopMoving(u8 taskId) } } -bool8 NativeScript_WaitPlayerStopMoving(void) +bool8 IsFreezePlayerFinished(void) { if (FuncIsActiveTask(Task_WaitPlayerStopMoving)) return FALSE; @@ -34,7 +34,7 @@ bool8 NativeScript_WaitPlayerStopMoving(void) } } -void ScriptFreezeObjectEvents(void) +void FreezeObjects_WaitForPlayer(void) { FreezeObjectEvents(); CreateTask(Task_WaitPlayerStopMoving, 80); @@ -60,7 +60,7 @@ void Task_WaitPlayerAndTargetNPCStopMoving(u8 taskId) DestroyTask(taskId); } -bool8 NativeScript_WaitPlayerAndTargetNPCStopMoving(void) +bool8 IsFreezeSelectedObjectAndPlayerFinished(void) { if (FuncIsActiveTask(Task_WaitPlayerAndTargetNPCStopMoving)) return FALSE; @@ -71,7 +71,7 @@ bool8 NativeScript_WaitPlayerAndTargetNPCStopMoving(void) } } -void LockSelectedObjectEvent(void) +void FreezeObjects_WaitForPlayerAndSelected(void) { u8 taskId; diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 919ca99c2..acf21293b 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -1715,7 +1715,7 @@ u8 AddPseudoObjectEvent(u16 graphicsId, SpriteCallback callback, s16 x, s16 y, u return spriteId; } -u8 sprite_new(u8 graphicsId, u8 a1, s16 x, s16 y, u8 z, u8 direction) +u8 CreateVirtualObject(u8 graphicsId, u8 a1, s16 x, s16 y, u8 z, u8 direction) { u8 spriteId; struct Sprite *sprite; @@ -2069,7 +2069,7 @@ static void SetObjectEventDynamicGraphicsId(struct ObjectEvent *objectEvent) } } -void ShowOrHideObjectByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup, u8 state) +void SetObjectInvisibility(u8 localId, u8 mapNum, u8 mapGroup, u8 state) { u8 objectEventId; @@ -2099,7 +2099,7 @@ void EnableObjectGroundEffectsByXY(s16 x, s16 y) } } -void SetObjectPriorityByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup, u8 subpriority) +void SetObjectSubpriority(u8 localId, u8 mapNum, u8 mapGroup, u8 subpriority) { u8 objectEventId; struct ObjectEvent *objectEvent; @@ -2114,7 +2114,7 @@ void SetObjectPriorityByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup, u8 sub } } -void UnfixObjectPriorityByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup) +void ResetObjectSubpriority(u8 localId, u8 mapNum, u8 mapGroup) { u8 objectEventId; struct ObjectEvent *objectEvent; @@ -9252,7 +9252,7 @@ static int GetObjectEventSpriteId(u8 objectEventId) return MAX_SPRITES; } -void TurnObjectEvent(u8 objectEventId, u8 direction) +void TurnVirtualObject(u8 objectEventId, u8 direction) { u8 animNum; u8 spriteId = GetObjectEventSpriteId(objectEventId); diff --git a/src/field_specials.c b/src/field_specials.c index 0f8093e8e..731807d2e 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -2419,7 +2419,7 @@ static void MoveDeoxysObject(u8 num) else gFieldEffectArguments[5] = 5; FieldEffectStart(FLDEFF_MOVE_DEOXYS_ROCK); - Overworld_SetMapObjTemplateCoords(1, sDeoxysCoords[num][0], sDeoxysCoords[num][1]); + SetObjEventTemplateCoords(1, sDeoxysCoords[num][0], sDeoxysCoords[num][1]); } static void Task_WaitDeoxysFieldEffect(u8 taskId) diff --git a/src/field_weather_util.c b/src/field_weather_util.c index 459071736..abf3c9fec 100644 --- a/src/field_weather_util.c +++ b/src/field_weather_util.c @@ -6,7 +6,7 @@ static u8 TranslateWeatherNum(u8 weather); static void UpdateRainCounter(u8 newWeather, u8 oldWeather); -void SetSav1Weather(u32 weather) +void SetSavedWeather(u32 weather) { u8 oldWeather = gSaveBlock1Ptr->weather; gSaveBlock1Ptr->weather = TranslateWeatherNum(weather); @@ -18,7 +18,7 @@ u8 GetSav1Weather(void) return gSaveBlock1Ptr->weather; } -void SetSav1WeatherFromCurrMapHeader(void) +void SetSavedWeatherFromCurrMapHeader(void) { u8 oldWeather = gSaveBlock1Ptr->weather; gSaveBlock1Ptr->weather = TranslateWeatherNum(gMapHeader.weather); @@ -27,13 +27,13 @@ void SetSav1WeatherFromCurrMapHeader(void) void SetWeather(u32 weather) { - SetSav1Weather(weather); + SetSavedWeather(weather); SetNextWeather(GetSav1Weather()); } void SetWeather_Unused(u32 weather) { - SetSav1Weather(weather); + SetSavedWeather(weather); SetCurrentAndNextWeather(GetSav1Weather()); } diff --git a/src/mevent_server.c b/src/mevent_server.c index b304fa09b..7d4929195 100644 --- a/src/mevent_server.c +++ b/src/mevent_server.c @@ -251,7 +251,7 @@ static u32 common_mainseq_4(struct mevent_srv_common * svr) break; case 28: AGB_ASSERT_EX(cmd->flag == FALSE && cmd->parameter == NULL, ABSPATH("mevent_server.c"), 517); - svr->sendBuffer1 = sub_8069E48(); + svr->sendBuffer1 = GetSavedRamScriptIfValid(); break; case 29: mevent_srv_common_init_send(svr, 0x1b, cmd->parameter, cmd->flag); diff --git a/src/overworld.c b/src/overworld.c index e010de6b1..6c1420418 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -438,7 +438,7 @@ static void LoadSaveblockObjEventScripts(void) } } -void Overworld_SetMapObjTemplateCoords(u8 localId, s16 x, s16 y) +void SetObjEventTemplateCoords(u8 localId, s16 x, s16 y) { int i; struct ObjectEventTemplate * savObjTemplates = gSaveBlock1Ptr->objectEventTemplates; @@ -453,7 +453,7 @@ void Overworld_SetMapObjTemplateCoords(u8 localId, s16 x, s16 y) } } -void Overworld_SetObjEventTemplateMovementType(u8 localId, u8 movementType) +void SetObjEventTemplateMovementType(u8 localId, u8 movementType) { s32 i; @@ -756,7 +756,7 @@ void LoadMapFromCameraTransition(u8 mapGroup, u8 mapNum) ResetCyclingRoadChallengeData(); RestartWildEncounterImmunitySteps(); MapResetTrainerRematches(mapGroup, mapNum); - SetSav1WeatherFromCurrMapHeader(); + SetSavedWeatherFromCurrMapHeader(); ChooseAmbientCrySpecies(); SetDefaultFlashLevel(); Overworld_ClearSavedMusic(); @@ -791,7 +791,7 @@ static void LoadMapFromWarp(bool32 unused) ResetCyclingRoadChallengeData(); RestartWildEncounterImmunitySteps(); MapResetTrainerRematches(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum); - SetSav1WeatherFromCurrMapHeader(); + SetSavedWeatherFromCurrMapHeader(); ChooseAmbientCrySpecies(); if (isOutdoors) FlagClear(FLAG_SYS_FLASH_ACTIVE); @@ -813,7 +813,7 @@ static void sub_80559A8(void) LoadObjEventTemplatesFromHeader(); isOutdoors = IsMapTypeOutdoors(gMapHeader.mapType); TrySetMapSaveWarpStatus(); - SetSav1WeatherFromCurrMapHeader(); + SetSavedWeatherFromCurrMapHeader(); ChooseAmbientCrySpecies(); SetDefaultFlashLevel(); sub_8110920(); @@ -956,7 +956,7 @@ static void SetDefaultFlashLevel(void) gSaveBlock1Ptr->flashLevel = gMaxFlashLevel; } -void Overworld_SetFlashLevel(s32 flashLevel) +void SetFlashLevel(s32 flashLevel) { if (flashLevel < 0 || flashLevel > gMaxFlashLevel) flashLevel = 0; diff --git a/src/rfu_union_tool.c b/src/rfu_union_tool.c index 21d095a9e..d6c1c411e 100644 --- a/src/rfu_union_tool.c +++ b/src/rfu_union_tool.c @@ -439,7 +439,7 @@ void CreateGroupMemberObjectsInvisible(u8 * sprite_ids, s32 group) for (i = 0; i < 5; i++) { s32 obj_id = 5 * group + i; - sprite_ids[obj_id] = sprite_new(OBJ_EVENT_GFX_MAN, obj_id - 0x38, sUnionPartnerCoords[group][0] + sFacingDirectionOffsets[i][0], sUnionPartnerCoords[group][1] + sFacingDirectionOffsets[i][1], 3, 1); + sprite_ids[obj_id] = CreateVirtualObject(OBJ_EVENT_GFX_MAN, obj_id - 0x38, sUnionPartnerCoords[group][0] + sFacingDirectionOffsets[i][0], sUnionPartnerCoords[group][1] + sFacingDirectionOffsets[i][1], 3, 1); RfuUnionObjectToggleInvisibility(obj_id - 0x38, TRUE); } } @@ -653,7 +653,7 @@ bool32 RfuUnionTool_GetGroupAndMemberInFrontOfPlayer(struct UnkStruct_Main0 *mai static void UnionPartnerObjectSetFacing(s32 member, s32 group, u8 direction) { - TurnObjectEvent(5 * group - 0x38 + member, direction); + TurnVirtualObject(5 * group - 0x38 + member, direction); } void UpdateUnionGroupMemberFacing(u32 member, u32 group, struct UnkStruct_Main0 *main0_p) diff --git a/src/scrcmd.c b/src/scrcmd.c index 823593623..7bc654d13 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -9,6 +9,7 @@ #include "field_screen_effect.h" #include "quest_log.h" #include "map_preview_screen.h" +#include "fieldmap.h" #include "field_weather.h" #include "field_tasks.h" #include "field_fadetransition.h" @@ -34,6 +35,7 @@ #include "fieldmap.h" #include "field_door.h" #include "constants/event_objects.h" +#include "constants/maps.h" #include "constants/sound.h" extern u16 (*const gSpecials[])(void); @@ -44,12 +46,12 @@ extern const u8 *const gStdScriptsEnd[]; static bool8 ScriptContext_NextCommandEndsScript(struct ScriptContext * ctx); static u8 ScriptContext_GetQuestLogInput(struct ScriptContext * ctx); -static EWRAM_DATA ptrdiff_t gVScriptOffset = 0; +static EWRAM_DATA ptrdiff_t sAddressOffset = 0; // For relative addressing in vgoto etc., used by saved scripts (e.g. Mystery Event) static EWRAM_DATA u8 sQuestLogWaitButtonPressTimer = 0; static EWRAM_DATA u16 sPauseCounter = 0; static EWRAM_DATA u16 sMovingNpcId = 0; -static EWRAM_DATA u16 sMovingNpcMapBank = 0; -static EWRAM_DATA u16 sMovingNpcMapId = 0; +static EWRAM_DATA u16 sMovingNpcMapGroup = 0; +static EWRAM_DATA u16 sMovingNpcMapNum = 0; static EWRAM_DATA u16 sFieldEffectScriptId = 0; struct ScriptContext * sQuestLogScriptContextPtr; @@ -95,7 +97,7 @@ bool8 ScrCmd_gotonative(struct ScriptContext * ctx) bool8 ScrCmd_special(struct ScriptContext * ctx) { - u16 (*const *specialPtr)(void) = gSpecials + ScriptReadHalfword(ctx); + u16 (*const *specialPtr)(void) = &gSpecials[ScriptReadHalfword(ctx)]; if (specialPtr < gSpecialsEnd) (*specialPtr)(); else @@ -106,7 +108,7 @@ bool8 ScrCmd_special(struct ScriptContext * ctx) bool8 ScrCmd_specialvar(struct ScriptContext * ctx) { u16 * varPtr = GetVarPointer(ScriptReadHalfword(ctx)); - u16 (*const *specialPtr)(void) = gSpecials + ScriptReadHalfword(ctx); + u16 (*const *specialPtr)(void) = &gSpecials[ScriptReadHalfword(ctx)]; if (specialPtr < gSpecialsEnd) *varPtr = (*specialPtr)(); else @@ -170,28 +172,28 @@ bool8 ScrCmd_setvaddress(struct ScriptContext * ctx) u32 addr1 = (u32)ctx->scriptPtr - 1; u32 addr2 = ScriptReadWord(ctx); - gVScriptOffset = addr2 - addr1; + sAddressOffset = addr2 - addr1; return FALSE; } bool8 ScrCmd_vgoto(struct ScriptContext * ctx) { const u8 * scrptr = (const u8 *)ScriptReadWord(ctx); - ScriptJump(ctx, scrptr - gVScriptOffset); + ScriptJump(ctx, scrptr - sAddressOffset); return FALSE; } bool8 ScrCmd_vcall(struct ScriptContext * ctx) { const u8 * scrptr = (const u8 *)ScriptReadWord(ctx); - ScriptCall(ctx, scrptr - gVScriptOffset); + ScriptCall(ctx, scrptr - sAddressOffset); return FALSE; } bool8 ScrCmd_vgoto_if(struct ScriptContext * ctx) { u8 condition = ScriptReadByte(ctx); - const u8 * scrptr = (const u8 *)ScriptReadWord(ctx) - gVScriptOffset; + const u8 * scrptr = (const u8 *)ScriptReadWord(ctx) - sAddressOffset; if (sScriptConditionTable[condition][ctx->comparisonResult] == 1) ScriptJump(ctx, scrptr); return FALSE; @@ -200,7 +202,7 @@ bool8 ScrCmd_vgoto_if(struct ScriptContext * ctx) bool8 ScrCmd_vcall_if(struct ScriptContext * ctx) { u8 condition = ScriptReadByte(ctx); - const u8 * scrptr = (const u8 *)ScriptReadWord(ctx) - gVScriptOffset; + const u8 * scrptr = (const u8 *)ScriptReadWord(ctx) - sAddressOffset; if (sScriptConditionTable[condition][ctx->comparisonResult] == 1) ScriptCall(ctx, scrptr); return FALSE; @@ -209,7 +211,7 @@ bool8 ScrCmd_vcall_if(struct ScriptContext * ctx) bool8 ScrCmd_gotostd(struct ScriptContext * ctx) { u8 stdIdx = ScriptReadByte(ctx); - const u8 *const * script = gStdScripts + stdIdx; + const u8 *const * script = &gStdScripts[stdIdx]; if (script < gStdScriptsEnd) ScriptJump(ctx, *script); return FALSE; @@ -218,7 +220,7 @@ bool8 ScrCmd_gotostd(struct ScriptContext * ctx) bool8 ScrCmd_callstd(struct ScriptContext * ctx) { u8 stdIdx = ScriptReadByte(ctx); - const u8 *const * script = gStdScripts + stdIdx; + const u8 *const * script = &gStdScripts[stdIdx]; if (script < gStdScriptsEnd) ScriptCall(ctx, *script); return FALSE; @@ -250,13 +252,13 @@ bool8 ScrCmd_callstd_if(struct ScriptContext * ctx) return FALSE; } -bool8 ScrCmd_gotoram(struct ScriptContext * ctx) +bool8 ScrCmd_returnram(struct ScriptContext * ctx) { ScriptJump(ctx, gRAMScriptPtr); return FALSE; } -bool8 ScrCmd_killscript(struct ScriptContext * ctx) +bool8 ScrCmd_endram(struct ScriptContext * ctx) { ClearRamScript(); StopScript(ctx); @@ -269,9 +271,9 @@ bool8 ScrCmd_setmysteryeventstatus(struct ScriptContext * ctx) return FALSE; } -bool8 ScrCmd_execram(struct ScriptContext * ctx) +bool8 ScrCmd_trywondercardscript(struct ScriptContext * ctx) { - const u8 * script = sub_8069E48(); + const u8 * script = GetSavedRamScriptIfValid(); if (script != NULL) { gRAMScriptPtr = ctx->scriptPtr; @@ -282,19 +284,19 @@ bool8 ScrCmd_execram(struct ScriptContext * ctx) bool8 ScrCmd_loadword(struct ScriptContext * ctx) { - u8 which = ScriptReadByte(ctx); - ctx->data[which] = ScriptReadWord(ctx); + u8 index = ScriptReadByte(ctx); + ctx->data[index] = ScriptReadWord(ctx); return FALSE; } -bool8 ScrCmd_loadbytefromaddr(struct ScriptContext * ctx) +bool8 ScrCmd_loadbytefromptr(struct ScriptContext * ctx) { - u8 which = ScriptReadByte(ctx); - ctx->data[which] = *(const u8 *)ScriptReadWord(ctx); + u8 index = ScriptReadByte(ctx); + ctx->data[index] = *(const u8 *)ScriptReadWord(ctx); return FALSE; } -bool8 ScrCmd_writebytetoaddr(struct ScriptContext * ctx) +bool8 ScrCmd_setptr(struct ScriptContext * ctx) { u8 value = ScriptReadByte(ctx); *(u8 *)ScriptReadWord(ctx) = value; @@ -303,23 +305,23 @@ bool8 ScrCmd_writebytetoaddr(struct ScriptContext * ctx) bool8 ScrCmd_loadbyte(struct ScriptContext * ctx) { - u8 which = ScriptReadByte(ctx); - ctx->data[which] = ScriptReadByte(ctx); + u8 index = ScriptReadByte(ctx); + ctx->data[index] = ScriptReadByte(ctx); return FALSE; } bool8 ScrCmd_setptrbyte(struct ScriptContext * ctx) { - u8 which = ScriptReadByte(ctx); - *(u8 *)ScriptReadWord(ctx) = ctx->data[which]; + u8 index = ScriptReadByte(ctx); + *(u8 *)ScriptReadWord(ctx) = ctx->data[index]; return FALSE; } bool8 ScrCmd_copylocal(struct ScriptContext * ctx) { - u8 whichDst = ScriptReadByte(ctx); - u8 whichSrc = ScriptReadByte(ctx); - ctx->data[whichDst] = ctx->data[whichSrc]; + u8 destIndex = ScriptReadByte(ctx); + u8 srcIndex = ScriptReadByte(ctx); + ctx->data[destIndex] = ctx->data[srcIndex]; return FALSE; } @@ -352,69 +354,67 @@ bool8 ScrCmd_setorcopyvar(struct ScriptContext * ctx) return FALSE; } -u8 compare_012(u16 left, u16 right) +static u8 Compare(u16 a, u16 b) { - if (left < right) + if (a < b) return 0; - else if (left == right) + else if (a == b) return 1; else return 2; } -// comparelocaltolocal bool8 ScrCmd_compare_local_to_local(struct ScriptContext * ctx) { const u8 value1 = ctx->data[ScriptReadByte(ctx)]; const u8 value2 = ctx->data[ScriptReadByte(ctx)]; - ctx->comparisonResult = compare_012(value1, value2); + ctx->comparisonResult = Compare(value1, value2); return FALSE; } -// comparelocaltoimm bool8 ScrCmd_compare_local_to_value(struct ScriptContext * ctx) { const u8 value1 = ctx->data[ScriptReadByte(ctx)]; const u8 value2 = ScriptReadByte(ctx); - ctx->comparisonResult = compare_012(value1, value2); + ctx->comparisonResult = Compare(value1, value2); return FALSE; } -bool8 ScrCmd_compare_local_to_addr(struct ScriptContext * ctx) +bool8 ScrCmd_compare_local_to_ptr(struct ScriptContext * ctx) { const u8 value1 = ctx->data[ScriptReadByte(ctx)]; const u8 value2 = *(const u8 *)ScriptReadWord(ctx); - ctx->comparisonResult = compare_012(value1, value2); + ctx->comparisonResult = Compare(value1, value2); return FALSE; } -bool8 ScrCmd_compare_addr_to_local(struct ScriptContext * ctx) +bool8 ScrCmd_compare_ptr_to_local(struct ScriptContext * ctx) { const u8 value1 = *(const u8 *)ScriptReadWord(ctx); const u8 value2 = ctx->data[ScriptReadByte(ctx)]; - ctx->comparisonResult = compare_012(value1, value2); + ctx->comparisonResult = Compare(value1, value2); return FALSE; } -bool8 ScrCmd_compare_addr_to_value(struct ScriptContext * ctx) +bool8 ScrCmd_compare_ptr_to_value(struct ScriptContext * ctx) { const u8 value1 = *(const u8 *)ScriptReadWord(ctx); const u8 value2 = ScriptReadByte(ctx); - ctx->comparisonResult = compare_012(value1, value2); + ctx->comparisonResult = Compare(value1, value2); return FALSE; } -bool8 ScrCmd_compare_addr_to_addr(struct ScriptContext * ctx) +bool8 ScrCmd_compare_ptr_to_ptr(struct ScriptContext * ctx) { const u8 value1 = *(const u8 *)ScriptReadWord(ctx); const u8 value2 = *(const u8 *)ScriptReadWord(ctx); - ctx->comparisonResult = compare_012(value1, value2); + ctx->comparisonResult = Compare(value1, value2); return FALSE; } @@ -423,7 +423,7 @@ bool8 ScrCmd_compare_var_to_value(struct ScriptContext * ctx) const u16 value1 = *GetVarPointer(ScriptReadHalfword(ctx)); const u16 value2 = ScriptReadHalfword(ctx); - ctx->comparisonResult = compare_012(value1, value2); + ctx->comparisonResult = Compare(value1, value2); return FALSE; } @@ -432,10 +432,11 @@ bool8 ScrCmd_compare_var_to_var(struct ScriptContext * ctx) const u16 *ptr1 = GetVarPointer(ScriptReadHalfword(ctx)); const u16 *ptr2 = GetVarPointer(ScriptReadHalfword(ctx)); - ctx->comparisonResult = compare_012(*ptr1, *ptr2); + ctx->comparisonResult = Compare(*ptr1, *ptr2); return FALSE; } +// Note: addvar doesn't support adding from a variable in vanilla. bool8 ScrCmd_addvar(struct ScriptContext * ctx) { u16 *ptr = GetVarPointer(ScriptReadHalfword(ctx)); @@ -521,7 +522,7 @@ bool8 ScrCmd_checkpcitem(struct ScriptContext * ctx) return FALSE; } -bool8 ScrCmd_givedecoration(struct ScriptContext * ctx) +bool8 ScrCmd_adddecoration(struct ScriptContext * ctx) { u32 decorId = VarGet(ScriptReadHalfword(ctx)); @@ -529,7 +530,7 @@ bool8 ScrCmd_givedecoration(struct ScriptContext * ctx) return FALSE; } -bool8 ScrCmd_takedecoration(struct ScriptContext * ctx) +bool8 ScrCmd_removedecoration(struct ScriptContext * ctx) { u32 decorId = VarGet(ScriptReadHalfword(ctx)); @@ -607,11 +608,9 @@ bool8 ScrCmd_animateflash(struct ScriptContext * ctx) return TRUE; } -bool8 ScrCmd_setflashradius(struct ScriptContext * ctx) +bool8 ScrCmd_setflashlevel(struct ScriptContext * ctx) { - u16 flashLevel = VarGet(ScriptReadHalfword(ctx)); - - Overworld_SetFlashLevel(flashLevel); + SetFlashLevel(VarGet(ScriptReadHalfword(ctx))); return FALSE; } @@ -642,9 +641,7 @@ bool8 ScrCmd_fadescreenspeed(struct ScriptContext * ctx) static bool8 RunPauseTimer(void) { - sPauseCounter--; - - if (sPauseCounter == 0) + if (--sPauseCounter == 0) return TRUE; else return FALSE; @@ -666,7 +663,7 @@ bool8 ScrCmd_initclock(struct ScriptContext * ctx) return FALSE; } -bool8 ScrCmd_dodailyevents(struct ScriptContext * ctx) +bool8 ScrCmd_dotimebasedevents(struct ScriptContext * ctx) { // DoTimeBasedEvents(); return FALSE; @@ -688,13 +685,13 @@ bool8 ScrCmd_setweather(struct ScriptContext * ctx) { u16 weather = VarGet(ScriptReadHalfword(ctx)); - SetSav1Weather(weather); + SetSavedWeather(weather); return FALSE; } bool8 ScrCmd_resetweather(struct ScriptContext * ctx) { - SetSav1WeatherFromCurrMapHeader(); + SetSavedWeatherFromCurrMapHeader(); return FALSE; } @@ -768,10 +765,10 @@ bool8 ScrCmd_warphole(struct ScriptContext * ctx) u16 y; PlayerGetDestCoords(&x, &y); - if (mapGroup == 0xFF && mapNum == 0xFF) - SetWarpDestinationToFixedHoleWarp(x - 7, y - 7); + if (mapGroup == MAP_GROUP(UNDEFINED) && mapNum == MAP_NUM(UNDEFINED)) + SetWarpDestinationToFixedHoleWarp(x - MAP_OFFSET, y - MAP_OFFSET); else - SetWarpDestination(mapGroup, mapNum, -1, x - 7, y - 7); + SetWarpDestination(mapGroup, mapNum, WARP_ID_NONE, x - MAP_OFFSET, y - MAP_OFFSET); DoFallWarp(); ResetInitialPlayerAvatarState(); return TRUE; @@ -791,7 +788,7 @@ bool8 ScrCmd_warpteleport(struct ScriptContext * ctx) return TRUE; } -bool8 ScrCmd_warpteleport2(struct ScriptContext * ctx) +bool8 ScrCmd_warpspinenter(struct ScriptContext * ctx) { u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); @@ -922,11 +919,11 @@ bool8 ScrCmd_waitfanfare(struct ScriptContext * ctx) bool8 ScrCmd_playbgm(struct ScriptContext * ctx) { u16 songId = ScriptReadHalfword(ctx); - bool8 val = ScriptReadByte(ctx); + bool8 save = ScriptReadByte(ctx); if (QL_IS_PLAYBACK_STATE) return FALSE; - if (val == TRUE) + if (save == TRUE) Overworld_SetSavedMusic(songId); PlayNewMapMusic(songId); return FALSE; @@ -992,7 +989,7 @@ bool8 ScrCmd_applymovement(struct ScriptContext * ctx) return FALSE; } -bool8 ScrCmd_applymovement_at(struct ScriptContext * ctx) +bool8 ScrCmd_applymovementat(struct ScriptContext * ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); const void *movementScript = (const void *)ScriptReadWord(ctx); @@ -1006,7 +1003,7 @@ bool8 ScrCmd_applymovement_at(struct ScriptContext * ctx) static bool8 WaitForMovementFinish(void) { - return ScriptMovement_IsObjectMovementFinished(sMovingNpcId, sMovingNpcMapId, sMovingNpcMapBank); + return ScriptMovement_IsObjectMovementFinished(sMovingNpcId, sMovingNpcMapNum, sMovingNpcMapGroup); } bool8 ScrCmd_waitmovement(struct ScriptContext * ctx) @@ -1015,13 +1012,13 @@ bool8 ScrCmd_waitmovement(struct ScriptContext * ctx) if (localId != 0) sMovingNpcId = localId; - sMovingNpcMapBank = gSaveBlock1Ptr->location.mapGroup; - sMovingNpcMapId = gSaveBlock1Ptr->location.mapNum; + sMovingNpcMapGroup = gSaveBlock1Ptr->location.mapGroup; + sMovingNpcMapNum = gSaveBlock1Ptr->location.mapNum; SetupNativeScript(ctx, WaitForMovementFinish); return TRUE; } -bool8 ScrCmd_waitmovement_at(struct ScriptContext * ctx) +bool8 ScrCmd_waitmovementat(struct ScriptContext * ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); u8 mapBank; @@ -1031,8 +1028,8 @@ bool8 ScrCmd_waitmovement_at(struct ScriptContext * ctx) sMovingNpcId = localId; mapBank = ScriptReadByte(ctx); mapId = ScriptReadByte(ctx); - sMovingNpcMapBank = mapBank; - sMovingNpcMapId = mapId; + sMovingNpcMapGroup = mapBank; + sMovingNpcMapNum = mapId; SetupNativeScript(ctx, WaitForMovementFinish); return TRUE; } @@ -1045,7 +1042,7 @@ bool8 ScrCmd_removeobject(struct ScriptContext * ctx) return FALSE; } -bool8 ScrCmd_removeobject_at(struct ScriptContext * ctx) +bool8 ScrCmd_removeobjectat(struct ScriptContext * ctx) { u16 objectId = VarGet(ScriptReadHalfword(ctx)); u8 mapGroup = ScriptReadByte(ctx); @@ -1063,7 +1060,7 @@ bool8 ScrCmd_addobject(struct ScriptContext * ctx) return FALSE; } -bool8 ScrCmd_addobject_at(struct ScriptContext * ctx) +bool8 ScrCmd_addobjectat(struct ScriptContext * ctx) { u16 objectId = VarGet(ScriptReadHalfword(ctx)); u8 mapGroup = ScriptReadByte(ctx); @@ -1089,11 +1086,11 @@ bool8 ScrCmd_setobjectxyperm(struct ScriptContext * ctx) u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); - Overworld_SetMapObjTemplateCoords(localId, x, y); + SetObjEventTemplateCoords(localId, x, y); return FALSE; } -bool8 ScrCmd_moveobjectoffscreen(struct ScriptContext * ctx) +bool8 ScrCmd_copyobjectxytoperm(struct ScriptContext * ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); @@ -1101,44 +1098,44 @@ bool8 ScrCmd_moveobjectoffscreen(struct ScriptContext * ctx) return FALSE; } -bool8 ScrCmd_showobject_at(struct ScriptContext * ctx) +bool8 ScrCmd_showobjectat(struct ScriptContext * ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); - ShowOrHideObjectByLocalIdAndMap(localId, mapNum, mapGroup, 0); + SetObjectInvisibility(localId, mapNum, mapGroup, FALSE); return FALSE; } -bool8 ScrCmd_hideobject_at(struct ScriptContext * ctx) +bool8 ScrCmd_hideobjectat(struct ScriptContext * ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); - ShowOrHideObjectByLocalIdAndMap(localId, mapNum, mapGroup, 1); + SetObjectInvisibility(localId, mapNum, mapGroup, TRUE); return FALSE; } -bool8 ScrCmd_setobjectpriority(struct ScriptContext * ctx) +bool8 ScrCmd_setobjectsubpriority(struct ScriptContext * ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); u8 priority = ScriptReadByte(ctx); - SetObjectPriorityByLocalIdAndMap(localId, mapNum, mapGroup, priority + 83); + SetObjectSubpriority(localId, mapNum, mapGroup, priority + 83); return FALSE; } -bool8 ScrCmd_resetobjectpriority(struct ScriptContext * ctx) +bool8 ScrCmd_resetobjectsubpriority(struct ScriptContext * ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); - UnfixObjectPriorityByLocalIdAndMap(localId, mapNum, mapGroup); + ResetObjectSubpriority(localId, mapNum, mapGroup); return FALSE; } @@ -1166,32 +1163,34 @@ bool8 ScrCmd_setobjectmovementtype(struct ScriptContext * ctx) u16 localId = VarGet(ScriptReadHalfword(ctx)); u8 movementType = ScriptReadByte(ctx); - Overworld_SetObjEventTemplateMovementType(localId, movementType); + SetObjEventTemplateMovementType(localId, movementType); return FALSE; } bool8 ScrCmd_createvobject(struct ScriptContext * ctx) { u8 graphicsId = ScriptReadByte(ctx); - u8 v2 = ScriptReadByte(ctx); + u8 virtualObjId = ScriptReadByte(ctx); u16 x = VarGet(ScriptReadHalfword(ctx)); u32 y = VarGet(ScriptReadHalfword(ctx)); u8 elevation = ScriptReadByte(ctx); u8 direction = ScriptReadByte(ctx); - sprite_new(graphicsId, v2, x, y, elevation, direction); + CreateVirtualObject(graphicsId, virtualObjId, x, y, elevation, direction); return FALSE; } bool8 ScrCmd_turnvobject(struct ScriptContext * ctx) { - u8 v1 = ScriptReadByte(ctx); + u8 virtualObjId = ScriptReadByte(ctx); u8 direction = ScriptReadByte(ctx); - TurnObjectEvent(v1, direction); + TurnVirtualObject(virtualObjId, direction); return FALSE; } +// lockall freezes all object events except the player immediately. +// The player is frozen after waiting for their current movement to finish. bool8 ScrCmd_lockall(struct ScriptContext * ctx) { if (IsUpdateLinkStateCBActive()) @@ -1200,8 +1199,8 @@ bool8 ScrCmd_lockall(struct ScriptContext * ctx) } else { - ScriptFreezeObjectEvents(); - SetupNativeScript(ctx, NativeScript_WaitPlayerStopMoving); + FreezeObjects_WaitForPlayer(); + SetupNativeScript(ctx, IsFreezePlayerFinished); return TRUE; } } @@ -1216,13 +1215,13 @@ bool8 ScrCmd_lock(struct ScriptContext * ctx) { if (gObjectEvents[gSelectedObjectEvent].active) { - LockSelectedObjectEvent(); - SetupNativeScript(ctx, NativeScript_WaitPlayerAndTargetNPCStopMoving); + FreezeObjects_WaitForPlayerAndSelected(); + SetupNativeScript(ctx, IsFreezeSelectedObjectAndPlayerFinished); } else { - ScriptFreezeObjectEvents(); - SetupNativeScript(ctx, NativeScript_WaitPlayerStopMoving); + FreezeObjects_WaitForPlayer(); + SetupNativeScript(ctx, IsFreezePlayerFinished); } return TRUE; } @@ -1429,7 +1428,7 @@ bool8 ScrCmd_multichoice(struct ScriptContext * ctx) u8 left = ScriptReadByte(ctx); u8 top = ScriptReadByte(ctx); u8 multichoiceId = ScriptReadByte(ctx); - u8 ignoreBPress = ScriptReadByte(ctx); + bool8 ignoreBPress = ScriptReadByte(ctx); if (ScriptMenu_Multichoice(left, top, multichoiceId, ignoreBPress) == TRUE) { @@ -1448,7 +1447,7 @@ bool8 ScrCmd_multichoicedefault(struct ScriptContext * ctx) u8 top = ScriptReadByte(ctx); u8 multichoiceId = ScriptReadByte(ctx); u8 defaultChoice = ScriptReadByte(ctx); - u8 ignoreBPress = ScriptReadByte(ctx); + bool8 ignoreBPress = ScriptReadByte(ctx); if (ScriptMenu_MultichoiceWithDefault(left, top, multichoiceId, ignoreBPress, defaultChoice) == TRUE) { @@ -1478,7 +1477,7 @@ bool8 ScrCmd_multichoicegrid(struct ScriptContext * ctx) u8 top = ScriptReadByte(ctx); u8 multichoiceId = ScriptReadByte(ctx); u8 numColumns = ScriptReadByte(ctx); - u8 ignoreBPress = ScriptReadByte(ctx); + bool8 ignoreBPress = ScriptReadByte(ctx); if (ScriptMenu_MultichoiceGrid(left, top, multichoiceId, ignoreBPress, numColumns) == TRUE) { @@ -1498,7 +1497,7 @@ bool8 ScrCmd_erasebox(struct ScriptContext * ctx) u8 right = ScriptReadByte(ctx); u8 bottom = ScriptReadByte(ctx); - // MenuZeroFillWindowRect(left, top, right, bottom); + // Menu_EraseWindowRect(left, top, right, bottom); return FALSE; } @@ -1507,7 +1506,7 @@ bool8 ScrCmd_drawboxtext(struct ScriptContext * ctx) // u8 left = ScriptReadByte(ctx); // u8 top = ScriptReadByte(ctx); // u8 multichoiceId = ScriptReadByte(ctx); -// u8 ignoreBPress = ScriptReadByte(ctx); +// bool8 ignoreBPress = ScriptReadByte(ctx); /*if (Multichoice(left, top, multichoiceId, ignoreBPress) == TRUE) { @@ -1530,7 +1529,9 @@ bool8 ScrCmd_showmonpic(struct ScriptContext * ctx) bool8 ScrCmd_hidemonpic(struct ScriptContext * ctx) { - bool8 (*func)(void) = ScriptMenu_GetPicboxWaitFunc(); + // The hide function returns a pointer to a function + // that returns true once the pic is hidden + bool8 (*func)(void) = ScriptMenu_HidePokemonPic(); if (func == NULL) return FALSE; @@ -1538,18 +1539,18 @@ bool8 ScrCmd_hidemonpic(struct ScriptContext * ctx) return TRUE; } -bool8 ScrCmd_showcontestwinner(struct ScriptContext * ctx) +bool8 ScrCmd_showcontestpainting(struct ScriptContext * ctx) { - u8 v1 = ScriptReadByte(ctx); - + u8 contestWinnerId = ScriptReadByte(ctx); /* - if (v1) - sub_812FDA8(v1); - ShowContestWinner(); - ScriptContext1_Stop(); - return TRUE; - */ + // Artist's painting is temporary and already has its data loaded + if (contestWinnerId != CONTEST_WINNER_ARTIST) + SetContestWinnerForPainting(contestWinnerId); + ShowContestPainting(); + ScriptContext1_Stop() + return TRUE; + */ return FALSE; } @@ -1561,7 +1562,7 @@ bool8 ScrCmd_braillemessage(struct ScriptContext * ctx) LoadStdWindowFrameGfx(); DrawDialogueFrame(0, 1); - AddTextPrinterParameterized(0, FONT_6, ptr, 0, 1, 0, NULL); + AddTextPrinterParameterized(0, FONT_BRAILLE, ptr, 0, 1, 0, NULL); return FALSE; } @@ -1571,15 +1572,15 @@ bool8 ScrCmd_getbraillestringwidth(struct ScriptContext * ctx) if (ptr == NULL) ptr = (u8 *)ctx->data[0]; - gSpecialVar_0x8004 = GetStringWidth(FONT_6, ptr, -1); + gSpecialVar_0x8004 = GetStringWidth(FONT_BRAILLE, ptr, -1); return FALSE; } bool8 ScrCmd_vmessage(struct ScriptContext * ctx) { - u32 v1 = ScriptReadWord(ctx); + u32 msg = ScriptReadWord(ctx); - ShowFieldMessage((u8 *)(v1 - gVScriptOffset)); + ShowFieldMessage((u8 *)(msg - sAddressOffset)); return FALSE; } @@ -1629,8 +1630,8 @@ bool8 ScrCmd_bufferitemname(struct ScriptContext * ctx) return FALSE; } -const u8 gUnknown_83A72A0[] = _("S"); -const u8 gUnknown_83A72A2[] = _("IES"); +static const u8 sText_S[] = _("S"); +static const u8 sText_IES[] = _("IES"); bool8 ScrCmd_bufferitemnameplural(struct ScriptContext * ctx) { @@ -1640,15 +1641,15 @@ bool8 ScrCmd_bufferitemnameplural(struct ScriptContext * ctx) CopyItemName(itemId, sScriptStringVars[stringVarIndex]); if (itemId == ITEM_POKE_BALL && quantity >= 2) - StringAppend(sScriptStringVars[stringVarIndex], gUnknown_83A72A0); - else if (itemId >= ITEM_CHERI_BERRY && itemId < ITEM_ENIGMA_BERRY && quantity >= 2) + StringAppend(sScriptStringVars[stringVarIndex], sText_S); + else if (itemId >= FIRST_BERRY_INDEX && itemId < LAST_BERRY_INDEX && quantity >= 2) { u16 strlength = StringLength(sScriptStringVars[stringVarIndex]); if (strlength != 0) { u8 * endptr = sScriptStringVars[stringVarIndex] + strlength; endptr[-1] = EOS; - StringAppend(sScriptStringVars[stringVarIndex], gUnknown_83A72A2); + StringAppend(sScriptStringVars[stringVarIndex], sText_IES); } } @@ -1676,10 +1677,10 @@ bool8 ScrCmd_buffermovename(struct ScriptContext * ctx) bool8 ScrCmd_buffernumberstring(struct ScriptContext * ctx) { u8 stringVarIndex = ScriptReadByte(ctx); - u16 v1 = VarGet(ScriptReadHalfword(ctx)); - u8 v2 = CountDigits(v1); + u16 num = VarGet(ScriptReadHalfword(ctx)); + u8 numDigits = CountDigits(num); - ConvertIntToDecimalStringN(sScriptStringVars[stringVarIndex], v1, 0, v2); + ConvertIntToDecimalStringN(sScriptStringVars[stringVarIndex], num, STR_CONV_MODE_LEFT_ALIGN, numDigits); return FALSE; } @@ -1692,17 +1693,6 @@ bool8 ScrCmd_bufferstdstring(struct ScriptContext * ctx) return FALSE; } -/* -bool8 ScrCmd_buffercontesttype(struct ScriptContext * ctx) -{ - u8 stringVarIndex = ScriptReadByte(ctx); - u16 index = VarGet(ScriptReadHalfword(ctx)); - - sub_818E868(sScriptStringVars[stringVarIndex], index); - return FALSE; -} -*/ - bool8 ScrCmd_bufferstring(struct ScriptContext * ctx) { u8 stringVarIndex = ScriptReadByte(ctx); @@ -1712,9 +1702,9 @@ bool8 ScrCmd_bufferstring(struct ScriptContext * ctx) return FALSE; } -bool8 ScrCmd_vloadword(struct ScriptContext * ctx) +bool8 ScrCmd_vbuffermessage(struct ScriptContext * ctx) { - const u8 *ptr = (u8 *)(ScriptReadWord(ctx) - gVScriptOffset); + const u8 *ptr = (u8 *)(ScriptReadWord(ctx) - sAddressOffset); StringExpandPlaceholders(gStringVar4, ptr); return FALSE; @@ -1725,7 +1715,7 @@ bool8 ScrCmd_vbufferstring(struct ScriptContext * ctx) u8 stringVarIndex = ScriptReadByte(ctx); u32 addr = ScriptReadWord(ctx); - const u8 *src = (u8 *)(addr - gVScriptOffset); + const u8 *src = (u8 *)(addr - sAddressOffset); u8 *dest = sScriptStringVars[stringVarIndex]; StringCopy(dest, src); return FALSE; @@ -1964,6 +1954,7 @@ bool8 ScrCmd_pokemartdecoration(struct ScriptContext * ctx) return TRUE; } +// Changes clerk dialogue slightly from above. See MART_TYPE_DECOR2 bool8 ScrCmd_pokemartdecoration2(struct ScriptContext * ctx) { const void *ptr = (void *)ScriptReadWord(ctx); @@ -1989,13 +1980,13 @@ bool8 ScrCmd_setberrytree(struct ScriptContext * ctx) // u8 growthStage = ScriptReadByte(ctx); // // if (berry == 0) -// PlantBerryTree(treeId, 0, growthStage, FALSE); +// PlantBerryTree(treeId, berry, growthStage, FALSE); // else // PlantBerryTree(treeId, berry, growthStage, FALSE); return FALSE; } -bool8 ScrCmd_getpricereduction(struct ScriptContext * ctx) +bool8 ScrCmd_getpokenewsactive(struct ScriptContext * ctx) { // u16 value = VarGet(ScriptReadHalfword(ctx)); // @@ -2005,7 +1996,7 @@ bool8 ScrCmd_getpricereduction(struct ScriptContext * ctx) bool8 ScrCmd_choosecontestmon(struct ScriptContext * ctx) { -// sub_81B9404(); +// ChooseContestMon(); ScriptContext1_Stop(); return TRUE; } @@ -2013,7 +2004,7 @@ bool8 ScrCmd_choosecontestmon(struct ScriptContext * ctx) bool8 ScrCmd_startcontest(struct ScriptContext * ctx) { -// sub_80F840C(); +// StartContest(); // ScriptContext1_Stop(); // return TRUE; return FALSE; @@ -2021,7 +2012,7 @@ bool8 ScrCmd_startcontest(struct ScriptContext * ctx) bool8 ScrCmd_showcontestresults(struct ScriptContext * ctx) { -// sub_80F8484(); +// ShowContestResults(); // ScriptContext1_Stop(); // return TRUE; return FALSE; @@ -2029,7 +2020,7 @@ bool8 ScrCmd_showcontestresults(struct ScriptContext * ctx) bool8 ScrCmd_contestlinktransfer(struct ScriptContext * ctx) { -// sub_80F84C4(gSpecialVar_ContestCategory); +// ContestLinkTransfer(gSpecialVar_ContestCategory); // ScriptContext1_Stop(); // return TRUE; return FALSE; @@ -2044,7 +2035,7 @@ bool8 ScrCmd_dofieldeffect(struct ScriptContext * ctx) return FALSE; } -bool8 ScrCmd_setfieldeffectarg(struct ScriptContext * ctx) +bool8 ScrCmd_setfieldeffectargument(struct ScriptContext * ctx) { u8 argNum = ScriptReadByte(ctx); @@ -2101,11 +2092,11 @@ bool8 ScrCmd_setmetatile(struct ScriptContext * ctx) u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); u16 tileId = VarGet(ScriptReadHalfword(ctx)); - u16 v8 = VarGet(ScriptReadHalfword(ctx)); + bool16 isImpassable = VarGet(ScriptReadHalfword(ctx)); - x += 7; - y += 7; - if (!v8) + x += MAP_OFFSET; + y += MAP_OFFSET; + if (!isImpassable) MapGridSetMetatileIdAt(x, y, tileId); else MapGridSetMetatileIdAt(x, y, tileId | METATILE_COLLISION_MASK); @@ -2117,8 +2108,8 @@ bool8 ScrCmd_opendoor(struct ScriptContext * ctx) u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); - x += 7; - y += 7; + x += MAP_OFFSET; + y += MAP_OFFSET; PlaySE(GetDoorSoundEffect(x, y)); FieldAnimateDoorOpen(x, y); return FALSE; @@ -2129,8 +2120,8 @@ bool8 ScrCmd_closedoor(struct ScriptContext * ctx) u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); - x += 7; - y += 7; + x += MAP_OFFSET; + y += MAP_OFFSET; FieldAnimateDoorClose(x, y); return FALSE; } @@ -2154,8 +2145,8 @@ bool8 ScrCmd_setdooropen(struct ScriptContext * ctx) u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); - x += 7; - y += 7; + x += MAP_OFFSET; + y += MAP_OFFSET; FieldSetDoorOpened(x, y); return FALSE; } @@ -2165,8 +2156,8 @@ bool8 ScrCmd_setdoorclosed(struct ScriptContext * ctx) u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); - x += 7; - y += 7; + x += MAP_OFFSET; + y += MAP_OFFSET; FieldSetDoorClosed(x, y); return FALSE; } @@ -2202,9 +2193,9 @@ bool8 ScrCmd_addcoins(struct ScriptContext * ctx) u16 coins = VarGet(ScriptReadHalfword(ctx)); if (AddCoins(coins) == TRUE) - gSpecialVar_Result = 0; + gSpecialVar_Result = FALSE; else - gSpecialVar_Result = 1; + gSpecialVar_Result = TRUE; return FALSE; } @@ -2213,9 +2204,9 @@ bool8 ScrCmd_removecoins(struct ScriptContext * ctx) u16 coins = VarGet(ScriptReadHalfword(ctx)); if (RemoveCoins(coins) == TRUE) - gSpecialVar_Result = 0; + gSpecialVar_Result = FALSE; else - gSpecialVar_Result = 1; + gSpecialVar_Result = TRUE; return FALSE; } diff --git a/src/script.c b/src/script.c index 08ae42deb..1592170cd 100644 --- a/src/script.c +++ b/src/script.c @@ -523,7 +523,7 @@ bool32 ValidateRamScript(void) return TRUE; } -u8 *sub_8069E48(void) +u8 *GetSavedRamScriptIfValid(void) { struct RamScriptData *scriptData = &gSaveBlock1Ptr->ramScript.data; if (!ValidateReceivedWonderCard()) diff --git a/src/script_menu.c b/src/script_menu.c index 384881982..d59ed07f7 100644 --- a/src/script_menu.c +++ b/src/script_menu.c @@ -1048,7 +1048,7 @@ bool8 ScriptMenu_ShowPokemonPic(u16 species, u8 x, u8 y) return TRUE; } -bool8 (*ScriptMenu_GetPicboxWaitFunc(void))(void) +bool8 (*ScriptMenu_HidePokemonPic(void))(void) { u8 taskId = FindTaskIdByFunc(Task_ScriptShowMonPic); if (taskId == 0xFF) diff --git a/src/union_room.c b/src/union_room.c index cadc00181..cc7df613a 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -4657,7 +4657,7 @@ static void HandleCancelTrade(bool32 unlockObjs) static void UR_EnableScriptContext2AndFreezeObjectEvents(void) { ScriptContext2_Enable(); - ScriptFreezeObjectEvents(); + FreezeObjects_WaitForPlayer(); } static u8 GetSinglePartnerSpriteGenderParam(s32 linkPlayer)